id
stringlengths
1
6
tokens
sequence
labels
sequence
0
[ "import", "{", "Term", "as", "T", "}", "from", "\"@lezer/lr/dist/constants\"", ";", "import", "{", "GenError", "}", "from", "\"./error\"", ";", "const", "enum", "TermFlag", "{", "Terminal", "=", "1", ",", "Top", "=", "2", ",", "Eof", "=", "4", ",", "Preserve", "=", "8", ",", "Repeated", "=", "16", ",", "Inline", "=", "32", "}", "export", "type", "Props", "=", "{", "[", "name", "]", ":", "string", ";", "}", ";", "export", "function", "hasProps", "(", "props", ")", "{", "for", "(", "let", "_p", "in", "props", ")", "return", "true", ";", "return", "false", ";", "}", "let", "termHash", "=", "0", ";", "export", "class", "Term", "{", "hash", "=", "++", "termHash", ";", "id", "=", "-", "1", ";", "rules", ":", "Rule", "[", "]", "=", "[", "]", ";", "constructor", "(", "readonly", "name", ",", "private", "flags", ",", "readonly", "nodeName", ",", "readonly", "props", "=", "{", "}", ")", "{", "}", "toString", "(", ")", "{", "return", "this", ".", "name", ";", "}", "get", "nodeType", "(", ")", "{", "return", "this", ".", "top", "||", "this", ".", "nodeName", "!=", "null", "||", "hasProps", "(", "this", ".", "props", ")", "||", "this", ".", "repeated", ";", "}", "get", "terminal", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Terminal", ")", ">", "0", ";", "}", "get", "eof", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Eof", ")", ">", "0", ";", "}", "get", "error", "(", ")", "{", "return", "\"error\"", "in", "this", ".", "props", ";", "}", "get", "top", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Top", ")", ">", "0", ";", "}", "get", "interesting", "(", ")", "{", "return", "this", ".", "flags", ">", "0", "||", "this", ".", "nodeName", "!=", "null", ";", "}", "get", "repeated", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Repeated", ")", ">", "0", ";", "}", "set", "preserve", "(", "value", ")", "{", "this", ".", "flags", "=", "value", "?", "this", ".", "flags", "|", "TermFlag", ".", "Preserve", ":", "this", ".", "flags", "&", "~", "TermFlag", ".", "Preserve", ";", "}", "get", "preserve", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Preserve", ")", ">", "0", ";", "}", "set", "inline", "(", "value", ")", "{", "this", ".", "flags", "=", "value", "?", "this", ".", "flags", "|", "TermFlag", ".", "Inline", ":", "this", ".", "flags", "&", "~", "TermFlag", ".", "Inline", ";", "}", "get", "inline", "(", ")", "{", "return", "(", "this", ".", "flags", "&", "TermFlag", ".", "Inline", ")", ">", "0", ";", "}", "cmp", "(", "other", ")", "{", "return", "this", ".", "hash", "-", "other", ".", "hash", ";", "}", "}", "export", "class", "TermSet", "{", "terms", ":", "Term", "[", "]", "=", "[", "]", ";", "names", ":", "{", "[", "name", "]", ":", "Term", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "eof", ":", "Term", ";", "error", ":", "Term", ";", "tops", ":", "Term", "[", "]", "=", "[", "]", ";", "constructor", "(", ")", "{", "this", ".", "eof", "=", "this", ".", "term", "(", "\"␄\"", ",", "null", ",", "TermFlag", ".", "Terminal", "|", "TermFlag", ".", "Eof", ")", ";", "this", ".", "error", "=", "this", ".", "term", "(", "\"⚠\"", ",", "\"⚠\"", ",", "TermFlag", ".", "Preserve", ")", ";", "}", "term", "(", "name", ",", "nodeName", ",", "flags", "=", "0", ",", "props", "=", "{", "}", ")", "{", "let", "term", "=", "new", "Term", "(", "name", ",", "flags", ",", "nodeName", ",", "props", ")", ";", "this", ".", "terms", ".", "push", "(", "term", ")", ";", "this", ".", "names", "[", "name", "]", "=", "term", ";", "return", "term", ";", "}", "makeTop", "(", "nodeName", ",", "props", ")", "{", "const", "term", "=", "this", ".", "term", "(", "\"@top\"", ",", "nodeName", ",", "TermFlag", ".", "Top", ",", "props", ")", ";", "this", ".", "tops", ".", "push", "(", "term", ")", ";", "return", "term", ";", "}", "makeTerminal", "(", "name", ",", "nodeName", ",", "props", "=", "{", "}", ")", "{", "return", "this", ".", "term", "(", "name", ",", "nodeName", ",", "TermFlag", ".", "Terminal", ",", "props", ")", ";", "}", "makeNonTerminal", "(", "name", ",", "nodeName", ",", "props", "=", "{", "}", ")", "{", "return", "this", ".", "term", "(", "name", ",", "nodeName", ",", "0", ",", "props", ")", ";", "}", "makeRepeat", "(", "name", ")", "{", "return", "this", ".", "term", "(", "name", ",", "null", ",", "TermFlag", ".", "Repeated", ")", ";", "}", "uniqueName", "(", "name", ")", "{", "for", "(", "let", "i", "=", "0", ";", ";", "i", "++", ")", "{", "let", "cur", "=", "i", "?", "`${", "name", "}-${", "i", "}`", ":", "name", ";", "if", "(", "!", "this", ".", "names", "[", "cur", "]", ")", "return", "cur", ";", "}", "}", "finish", "(", "rules", ")", "{", "for", "(", "let", "rule", "of", "rules", ")", "rule", ".", "name", ".", "rules", ".", "push", "(", "rule", ")", ";", "this", ".", "terms", "=", "this", ".", "terms", ".", "filter", "(", "t", "=>", "t", ".", "terminal", "||", "t", ".", "preserve", "||", "rules", ".", "some", "(", "r", "=>", "r", ".", "name", "==", "t", "||", "r", ".", "parts", ".", "includes", "(", "t", ")", ")", ")", ";", "let", "names", "=", "{", "}", ";", "let", "nodeTypes", "=", "[", "this", ".", "error", "]", ";", "this", ".", "error", ".", "id", "=", "T", ".", "Err", ";", "let", "nextID", "=", "T", ".", "Err", "+", "1", ";", "for", "(", "let", "term", "of", "this", ".", "terms", ")", "if", "(", "term", ".", "id", "<", "0", "&&", "term", ".", "nodeType", "&&", "!", "term", ".", "repeated", ")", "{", "term", ".", "id", "=", "nextID", "++", ";", "nodeTypes", ".", "push", "(", "term", ")", ";", "}", "let", "minRepeatTerm", "=", "nextID", ";", "for", "(", "let", "term", "of", "this", ".", "terms", ")", "if", "(", "term", ".", "repeated", ")", "{", "term", ".", "id", "=", "nextID", "++", ";", "nodeTypes", ".", "push", "(", "term", ")", ";", "}", "this", ".", "eof", ".", "id", "=", "nextID", "++", ";", "for", "(", "let", "term", "of", "this", ".", "terms", ")", "{", "if", "(", "term", ".", "id", "<", "0", ")", "term", ".", "id", "=", "nextID", "++", ";", "if", "(", "term", ".", "name", ")", "names", "[", "term", ".", "id", "]", "=", "term", ".", "name", ";", "}", "if", "(", "nextID", ">=", "0xfffe", ")", "throw", "new", "GenError", "(", "\"Too many terms\"", ")", ";", "return", "{", "nodeTypes", ",", "names", ",", "minRepeatTerm", ",", "maxTerm", ":", "nextID", "-", "1", "}", ";", "}", "}", "export", "function", "cmpSet", "<", "T", ">", "(", "a", ",", "b", ",", "cmp", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "return", "a", ".", "length", "-", "b", ".", "length", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "{", "let", "diff", "=", "cmp", "(", "a", "[", "i", "]", ",", "b", "[", "i", "]", ")", ";", "if", "(", "diff", ")", "return", "diff", ";", "}", "return", "0", ";", "}", "const", "none", "=", "[", "]", ";", "export", "class", "Conflicts", "{", "constructor", "(", "readonly", "precedence", ",", "readonly", "ambigGroups", "=", "none", ",", "readonly", "cut", "=", "0", ")", "{", "}", "join", "(", "other", ")", "{", "if", "(", "this", "==", "Conflicts", ".", "none", "||", "this", "==", "other", ")", "return", "other", ";", "if", "(", "other", "==", "Conflicts", ".", "none", ")", "return", "this", ";", "return", "new", "Conflicts", "(", "Math", ".", "max", "(", "this", ".", "precedence", ",", "other", ".", "precedence", ")", ",", "union", "(", "this", ".", "ambigGroups", ",", "other", ".", "ambigGroups", ")", ",", "Math", ".", "max", "(", "this", ".", "cut", ",", "other", ".", "cut", ")", ")", ";", "}", "cmp", "(", "other", ")", "{", "return", "this", ".", "precedence", "-", "other", ".", "precedence", "||", "cmpSet", "(", "this", ".", "ambigGroups", ",", "other", ".", "ambigGroups", ",", "(", "a", ",", "b", ")", "=>", "a", "<", "b", "?", "-", "1", ":", "a", ">", "b", "?", "1", ":", "0", ")", "||", "this", ".", "cut", "-", "other", ".", "cut", ";", "}", "static", "none", "=", "new", "Conflicts", "(", "0", ")", ";", "}", "export", "function", "union", "<", "T", ">", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "==", "0", "||", "a", "==", "b", ")", "return", "b", ";", "if", "(", "b", ".", "length", "==", "0", ")", "return", "a", ";", "let", "result", "=", "a", ".", "slice", "(", ")", ";", "for", "(", "let", "value", "of", "b", ")", "if", "(", "!", "a", ".", "includes", "(", "value", ")", ")", "result", ".", "push", "(", "value", ")", ";", "return", "result", ".", "sort", "(", ")", ";", "}", "let", "ruleID", "=", "0", ";", "export", "class", "Rule", "{", "id", "=", "ruleID", "++", ";", "constructor", "(", "readonly", "name", ",", "readonly", "parts", ",", "readonly", "conflicts", ",", "readonly", "skip", ")", "{", "}", "cmp", "(", "rule", ")", "{", "return", "this", ".", "id", "-", "rule", ".", "id", ";", "}", "cmpNoName", "(", "rule", ")", "{", "return", "this", ".", "parts", ".", "length", "-", "rule", ".", "parts", ".", "length", "||", "this", ".", "skip", ".", "hash", "-", "rule", ".", "skip", ".", "hash", "||", "this", ".", "parts", ".", "reduce", "(", "(", "r", ",", "s", ",", "i", ")", "=>", "r", "||", "s", ".", "cmp", "(", "rule", ".", "parts", "[", "i", "]", ")", ",", "0", ")", "||", "cmpSet", "(", "this", ".", "conflicts", ",", "rule", ".", "conflicts", ",", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "name", "+", "\" -> \"", "+", "this", ".", "parts", ".", "join", "(", "\" \"", ")", ";", "}", "get", "isRepeatWrap", "(", ")", "{", "return", "this", ".", "name", ".", "repeated", "&&", "this", ".", "parts", ".", "length", "==", "2", "&&", "this", ".", "parts", "[", "0", "]", "==", "this", ".", "name", ";", "}", "sameReduce", "(", "other", ")", "{", "return", "this", ".", "name", "==", "other", ".", "name", "&&", "this", ".", "parts", ".", "length", "==", "other", ".", "parts", ".", "length", "&&", "this", ".", "isRepeatWrap", "==", "other", ".", "isRepeatWrap", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 32, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 3, null, null, 2, null, null, 32, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, 2, null, 3, null, null, null, 32, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, 32, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, 14834, null, 14834, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 14834, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, 229, null, null, null, 3, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 229, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 14834, null, 14834, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
1
[ "export", "function", "hash", "(", "a", ",", "b", ")", "{", "return", "(", "a", "<<", "5", ")", "+", "a", "+", "b", ";", "}", "export", "function", "hashString", "(", "h", ",", "s", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "s", ".", "length", ";", "i", "++", ")", "h", "=", "hash", "(", "h", ",", "s", ".", "charCodeAt", "(", "i", ")", ")", ";", "return", "h", ";", "}" ]
[ null, null, 3, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 3, null, 2, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
2
[ "export", "const", "verbose", "=", "(", "typeof", "process", "!=", "\"undefined\"", "&&", "process", ".", "env", ".", "LOG", ")", "||", "\"\"", ";", "export", "const", "timing", "=", "/\\btime\\b/", ".", "test", "(", "verbose", ")", ";", "export", "const", "time", "=", "timing", "?", "(", "label", ",", "f", ")", "=>", "{", "let", "t0", "=", "Date", ".", "now", "(", ")", ";", "let", "result", "=", "f", "(", ")", ";", "console", ".", "log", "(", "`${", "label", "} (${", "(", "(", "Date", ".", "now", "(", ")", "-", "t0", ")", "/", "1000", ")", ".", "toFixed", "(", "2", ")", "}s)`", ")", ";", "return", "result", ";", "}", ":", "(", "_label", ",", "f", ")", "=>", "f", "(", ")", ";" ]
[ null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 11, null, null, null, null, 2, null, 11, null, null, null, null, 3, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 11, null, null, null, null, null, null ]
3
[ "import", "{", "Term", ",", "TermSet", ",", "Rule", ",", "cmpSet", ",", "Conflicts", ",", "union", "}", "from", "\"./grammar\"", ";", "import", "{", "hash", ",", "hashString", "}", "from", "\"./hash\"", ";", "import", "{", "GenError", "}", "from", "\"./error\"", ";", "import", "{", "timing", "}", "from", "\"./log\"", ";", "export", "class", "Pos", "{", "hash", ":", "number", "=", "0", ";", "constructor", "(", "readonly", "rule", ",", "readonly", "pos", ",", "readonly", "ahead", ",", "public", "ambigAhead", ",", "readonly", "skipAhead", ",", "readonly", "via", ")", "{", "}", "finish", "(", ")", "{", "let", "h", "=", "hash", "(", "hash", "(", "this", ".", "rule", ".", "id", ",", "this", ".", "pos", ")", ",", "this", ".", "skipAhead", ".", "hash", ")", ";", "for", "(", "let", "a", "of", "this", ".", "ahead", ")", "h", "=", "hash", "(", "h", ",", "a", ".", "hash", ")", ";", "for", "(", "let", "group", "of", "this", ".", "ambigAhead", ")", "h", "=", "hashString", "(", "h", ",", "group", ")", ";", "this", ".", "hash", "=", "h", ";", "return", "this", ";", "}", "get", "next", "(", ")", "{", "return", "this", ".", "pos", "<", "this", ".", "rule", ".", "parts", ".", "length", "?", "this", ".", "rule", ".", "parts", "[", "this", ".", "pos", "]", ":", "null", ";", "}", "advance", "(", ")", "{", "return", "new", "Pos", "(", "this", ".", "rule", ",", "this", ".", "pos", "+", "1", ",", "this", ".", "ahead", ",", "this", ".", "ambigAhead", ",", "this", ".", "skipAhead", ",", "this", ".", "via", ")", ".", "finish", "(", ")", ";", "}", "get", "skip", "(", ")", "{", "return", "this", ".", "pos", "==", "this", ".", "rule", ".", "parts", ".", "length", "?", "this", ".", "skipAhead", ":", "this", ".", "rule", ".", "skip", ";", "}", "cmp", "(", "pos", ")", "{", "return", "this", ".", "rule", ".", "cmp", "(", "pos", ".", "rule", ")", "||", "this", ".", "pos", "-", "pos", ".", "pos", "||", "this", ".", "skipAhead", ".", "hash", "-", "pos", ".", "skipAhead", ".", "hash", "||", "cmpSet", "(", "this", ".", "ahead", ",", "pos", ".", "ahead", ",", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", "||", "cmpSet", "(", "this", ".", "ambigAhead", ",", "pos", ".", "ambigAhead", ",", "cmpStr", ")", ";", "}", "eqSimple", "(", "pos", ")", "{", "return", "pos", ".", "rule", "==", "this", ".", "rule", "&&", "pos", ".", "pos", "==", "this", ".", "pos", ";", "}", "toString", "(", ")", "{", "let", "parts", "=", "this", ".", "rule", ".", "parts", ".", "map", "(", "t", "=>", "t", ".", "name", ")", ";", "parts", ".", "splice", "(", "this", ".", "pos", ",", "0", ",", "\"·\"", ")", ";", "return", "`${", "this", ".", "rule", ".", "name", "} -> ${", "parts", ".", "join", "(", "\" \"", ")", "}`", ";", "}", "eq", "(", "other", ")", "{", "return", "this", "==", "other", "||", "this", ".", "hash", "==", "other", ".", "hash", "&&", "this", ".", "rule", "==", "other", ".", "rule", "&&", "this", ".", "pos", "==", "other", ".", "pos", "&&", "this", ".", "skipAhead", "==", "other", ".", "skipAhead", "&&", "sameSet", "(", "this", ".", "ahead", ",", "other", ".", "ahead", ")", "&&", "sameSet", "(", "this", ".", "ambigAhead", ",", "other", ".", "ambigAhead", ")", ";", "}", "trail", "(", "maxLen", "=", "60", ")", "{", "let", "result", "=", "[", "]", ";", "for", "(", "let", "pos", "=", "this", ";", "pos", ";", "pos", "=", "pos", ".", "via", ")", "{", "for", "(", "let", "i", "=", "pos", ".", "pos", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "result", ".", "push", "(", "pos", ".", "rule", ".", "parts", "[", "i", "]", ")", ";", "}", "let", "value", "=", "result", ".", "reverse", "(", ")", ".", "join", "(", "\" \"", ")", ";", "if", "(", "value", ".", "length", ">", "maxLen", ")", "value", "=", "value", ".", "slice", "(", "value", ".", "length", "-", "maxLen", ")", ".", "replace", "(", "/.*? /", ",", "\"… \"", ")", ";", "return", "value", ";", "}", "conflicts", "(", "pos", "=", "this", ".", "pos", ")", "{", "let", "result", "=", "this", ".", "rule", ".", "conflicts", "[", "pos", "]", ";", "if", "(", "pos", "==", "this", ".", "rule", ".", "parts", ".", "length", "&&", "this", ".", "ambigAhead", ".", "length", ")", "result", "=", "result", ".", "join", "(", "new", "Conflicts", "(", "0", ",", "this", ".", "ambigAhead", ")", ")", ";", "return", "result", ";", "}", "static", "addOrigins", "(", "group", ",", "context", ")", "{", "let", "result", "=", "group", ".", "slice", "(", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "result", ".", "length", ";", "i", "++", ")", "{", "let", "next", "=", "result", "[", "i", "]", ";", "if", "(", "next", ".", "pos", "==", "0", ")", "for", "(", "let", "pos", "of", "context", ")", "{", "if", "(", "pos", ".", "next", "==", "next", ".", "rule", ".", "name", "&&", "!", "result", ".", "includes", "(", "pos", ")", ")", "result", ".", "push", "(", "pos", ")", ";", "}", "}", "return", "result", ";", "}", "}", "function", "conflictsAt", "(", "group", ")", "{", "let", "result", "=", "Conflicts", ".", "none", ";", "for", "(", "let", "pos", "of", "group", ")", "result", "=", "result", ".", "join", "(", "pos", ".", "conflicts", "(", ")", ")", ";", "return", "result", ";", "}", "function", "compareRepeatPrec", "(", "a", ",", "b", ")", "{", "for", "(", "let", "pos", "of", "a", ")", "if", "(", "pos", ".", "rule", ".", "name", ".", "repeated", ")", "{", "for", "(", "let", "posB", "of", "b", ")", "if", "(", "posB", ".", "rule", ".", "name", "==", "pos", ".", "rule", ".", "name", ")", "{", "if", "(", "pos", ".", "rule", ".", "isRepeatWrap", "&&", "pos", ".", "pos", "==", "2", ")", "return", "1", ";", "if", "(", "posB", ".", "rule", ".", "isRepeatWrap", "&&", "posB", ".", "pos", "==", "2", ")", "return", "-", "1", ";", "}", "}", "return", "0", ";", "}", "function", "cmpStr", "(", "a", ",", "b", ")", "{", "return", "a", "<", "b", "?", "-", "1", ":", "a", ">", "b", "?", "1", ":", "0", ";", "}", "function", "termsAhead", "(", "rule", ",", "pos", ",", "after", ",", "first", ")", "{", "let", "found", "=", "[", "]", ";", "for", "(", "let", "i", "=", "pos", "+", "1", ";", "i", "<", "rule", ".", "parts", ".", "length", ";", "i", "++", ")", "{", "let", "next", "=", "rule", ".", "parts", "[", "i", "]", ",", "cont", "=", "false", ";", "if", "(", "next", ".", "terminal", ")", "{", "addTo", "(", "next", ",", "found", ")", ";", "}", "else", "for", "(", "let", "term", "of", "first", "[", "next", ".", "name", "]", ")", "{", "if", "(", "term", "==", "null", ")", "cont", "=", "true", ";", "else", "addTo", "(", "term", ",", "found", ")", ";", "}", "if", "(", "!", "cont", ")", "return", "found", ";", "}", "for", "(", "let", "a", "of", "after", ")", "addTo", "(", "a", ",", "found", ")", ";", "return", "found", ";", "}", "function", "eqSet", "<", "T", "extends", "{", "eq", "(", "other", ")", ":", "boolean", ";", "}", ">", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "return", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "if", "(", "!", "a", "[", "i", "]", ".", "eq", "(", "b", "[", "i", "]", ")", ")", "return", "false", ";", "return", "true", ";", "}", "function", "sameSet", "<", "T", ">", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "return", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "if", "(", "a", "[", "i", "]", "!=", "b", "[", "i", "]", ")", "return", "false", ";", "return", "true", ";", "}", "export", "class", "Shift", "{", "constructor", "(", "readonly", "term", ",", "readonly", "target", ")", "{", "}", "eq", "(", "other", ")", "{", "return", "other", "instanceof", "Shift", "&&", "this", ".", "term", "==", "other", ".", "term", "&&", "other", ".", "target", ".", "id", "==", "this", ".", "target", ".", "id", ";", "}", "cmp", "(", "other", ")", "{", "return", "other", "instanceof", "Reduce", "?", "-", "1", ":", "this", ".", "term", ".", "id", "-", "other", ".", "term", ".", "id", "||", "this", ".", "target", ".", "id", "-", "other", ".", "target", ".", "id", ";", "}", "toString", "(", ")", "{", "return", "\"s\"", "+", "this", ".", "target", ".", "id", ";", "}", "map", "(", "mapping", ",", "states", ")", "{", "let", "mapped", "=", "states", "[", "mapping", "[", "this", ".", "target", ".", "id", "]", "]", ";", "return", "mapped", "==", "this", ".", "target", "?", "this", ":", "new", "Shift", "(", "this", ".", "term", ",", "mapped", ")", ";", "}", "}", "export", "class", "Reduce", "{", "constructor", "(", "readonly", "term", ",", "readonly", "rule", ")", "{", "}", "eq", "(", "other", ")", "{", "return", "other", "instanceof", "Reduce", "&&", "this", ".", "term", "==", "other", ".", "term", "&&", "other", ".", "rule", ".", "sameReduce", "(", "this", ".", "rule", ")", ";", "}", "cmp", "(", "other", ")", "{", "return", "other", "instanceof", "Shift", "?", "1", ":", "this", ".", "term", ".", "id", "-", "other", ".", "term", ".", "id", "||", "this", ".", "rule", ".", "name", ".", "id", "-", "other", ".", "rule", ".", "name", ".", "id", "||", "this", ".", "rule", ".", "parts", ".", "length", "-", "other", ".", "rule", ".", "parts", ".", "length", ";", "}", "toString", "(", ")", "{", "return", "`${", "this", ".", "rule", ".", "name", ".", "name", "}(${", "this", ".", "rule", ".", "parts", ".", "length", "})`", ";", "}", "map", "(", ")", "{", "return", "this", ";", "}", "}", "function", "hashPositions", "(", "set", ")", "{", "let", "h", "=", "5381", ";", "for", "(", "let", "pos", "of", "set", ")", "h", "=", "hash", "(", "h", ",", "pos", ".", "hash", ")", ";", "return", "h", ";", "}", "export", "class", "State", "{", "actions", ":", "(", "Shift", "|", "Reduce", ")", "[", "]", "=", "[", "]", ";", "actionPositions", ":", "(", "readonly", "Pos", "[", "]", ")", "[", "]", "=", "[", "]", ";", "goto", ":", "Shift", "[", "]", "=", "[", "]", ";", "tokenGroup", ":", "number", "=", "-", "1", ";", "defaultReduce", ":", "Rule", "|", "null", "=", "null", ";", "constructor", "(", "public", "id", ",", "public", "set", ",", "public", "flags", "=", "0", ",", "readonly", "skip", ",", "readonly", "hash", "=", "hashPositions", "(", "set", ")", ",", "readonly", "startRule", "=", "null", ")", "{", "}", "toString", "(", ")", "{", "let", "actions", "=", "this", ".", "actions", ".", "map", "(", "t", "=>", "t", ".", "term", "+", "\"=\"", "+", "t", ")", ".", "join", "(", "\",\"", ")", "+", "(", "this", ".", "goto", ".", "length", "?", "\" | \"", "+", "this", ".", "goto", ".", "map", "(", "g", "=>", "g", ".", "term", "+", "\"=\"", "+", "g", ")", ".", "join", "(", "\",\"", ")", ":", "\"\"", ")", ";", "return", "this", ".", "id", "+", "\": \"", "+", "this", ".", "set", ".", "filter", "(", "p", "=>", "p", ".", "pos", ">", "0", ")", ".", "join", "(", ")", "+", "(", "this", ".", "defaultReduce", "?", "`\\n always ${", "this", ".", "defaultReduce", ".", "name", "}(${", "this", ".", "defaultReduce", ".", "parts", ".", "length", "})`", ":", "actions", ".", "length", "?", "\"\\n \"", "+", "actions", ":", "\"\"", ")", ";", "}", "addActionInner", "(", "value", ",", "positions", ")", "{", "check", ":", "for", "(", "let", "i", "=", "0", ";", "i", "<", "this", ".", "actions", ".", "length", ";", "i", "++", ")", "{", "let", "action", "=", "this", ".", "actions", "[", "i", "]", ";", "if", "(", "action", ".", "term", "==", "value", ".", "term", ")", "{", "if", "(", "action", ".", "eq", "(", "value", ")", ")", "return", "null", ";", "let", "fullPos", "=", "Pos", ".", "addOrigins", "(", "positions", ",", "this", ".", "set", ")", ",", "actionFullPos", "=", "Pos", ".", "addOrigins", "(", "this", ".", "actionPositions", "[", "i", "]", ",", "this", ".", "set", ")", ";", "let", "conflicts", "=", "conflictsAt", "(", "fullPos", ")", ",", "actionConflicts", "=", "conflictsAt", "(", "actionFullPos", ")", ";", "let", "diff", "=", "compareRepeatPrec", "(", "fullPos", ",", "actionFullPos", ")", "||", "conflicts", ".", "precedence", "-", "actionConflicts", ".", "precedence", ";", "if", "(", "diff", ">", "0", ")", "{", "this", ".", "actions", ".", "splice", "(", "i", ",", "1", ")", ";", "this", ".", "actionPositions", ".", "splice", "(", "i", ",", "1", ")", ";", "i", "--", ";", "continue", "check", ";", "}", "else", "if", "(", "diff", "<", "0", ")", "{", "return", "null", ";", "}", "else", "if", "(", "conflicts", ".", "ambigGroups", ".", "some", "(", "g", "=>", "actionConflicts", ".", "ambigGroups", ".", "includes", "(", "g", ")", ")", ")", "{", "continue", "check", ";", "}", "else", "{", "return", "action", ";", "}", "}", "}", "this", ".", "actions", ".", "push", "(", "value", ")", ";", "this", ".", "actionPositions", ".", "push", "(", "positions", ")", ";", "return", "null", ";", "}", "addAction", "(", "value", ",", "positions", ",", "conflicts", ")", "{", "let", "conflict", "=", "this", ".", "addActionInner", "(", "value", ",", "positions", ")", ";", "if", "(", "conflict", ")", "{", "let", "conflictPos", "=", "this", ".", "actionPositions", "[", "this", ".", "actions", ".", "indexOf", "(", "conflict", ")", "]", "[", "0", "]", ";", "let", "rules", "=", "[", "positions", "[", "0", "]", ".", "rule", ".", "name", ",", "conflictPos", ".", "rule", ".", "name", "]", ";", "if", "(", "conflicts", ".", "some", "(", "c", "=>", "c", ".", "rules", ".", "some", "(", "r", "=>", "rules", ".", "includes", "(", "r", ")", ")", ")", ")", "return", ";", "let", "error", ";", "if", "(", "conflict", "instanceof", "Shift", ")", "error", "=", "`shift/reduce conflict between\\n ${", "conflictPos", "}\\nand\\n ${", "positions", "[", "0", "]", ".", "rule", "}`", ";", "else", "error", "=", "`reduce/reduce conflict between\\n ${", "conflictPos", ".", "rule", "}\\nand\\n ${", "positions", "[", "0", "]", ".", "rule", "}`", ";", "error", "+=", "`\\nWith input:\\n ${", "positions", "[", "0", "]", ".", "trail", "(", "70", ")", "} · ${", "value", ".", "term", "} …`", ";", "error", "+=", "findConflictOrigin", "(", "conflictPos", ",", "positions", "[", "0", "]", ")", ";", "conflicts", ".", "push", "(", "new", "Conflict", "(", "error", ",", "rules", ")", ")", ";", "}", "}", "getGoto", "(", "term", ")", "{", "return", "this", ".", "goto", ".", "find", "(", "a", "=>", "a", ".", "term", "==", "term", ")", ";", "}", "hasSet", "(", "set", ")", "{", "return", "eqSet", "(", "this", ".", "set", ",", "set", ")", ";", "}", "finish", "(", ")", "{", "if", "(", "this", ".", "actions", ".", "length", ")", "{", "let", "first", "=", "this", ".", "actions", "[", "0", "]", ";", "if", "(", "first", "instanceof", "Reduce", ")", "{", "let", "{", "rule", "}", "=", "first", ";", "if", "(", "this", ".", "actions", ".", "every", "(", "a", "=>", "a", "instanceof", "Reduce", "&&", "a", ".", "rule", ".", "sameReduce", "(", "rule", ")", ")", ")", "this", ".", "defaultReduce", "=", "rule", ";", "}", "}", "this", ".", "actions", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", ";", "this", ".", "goto", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", ";", "}", "eq", "(", "other", ")", "{", "let", "dThis", "=", "this", ".", "defaultReduce", ",", "dOther", "=", "other", ".", "defaultReduce", ";", "if", "(", "dThis", "||", "dOther", ")", "return", "dThis", "&&", "dOther", "?", "dThis", ".", "sameReduce", "(", "dOther", ")", ":", "false", ";", "return", "this", ".", "skip", "==", "other", ".", "skip", "&&", "this", ".", "tokenGroup", "==", "other", ".", "tokenGroup", "&&", "eqSet", "(", "this", ".", "actions", ",", "other", ".", "actions", ")", "&&", "eqSet", "(", "this", ".", "goto", ",", "other", ".", "goto", ")", ";", "}", "}", "function", "closure", "(", "set", ",", "first", ")", "{", "let", "added", "=", "[", "]", ",", "redo", "=", "[", "]", ";", "function", "addFor", "(", "name", ",", "ahead", ",", "ambigAhead", ",", "skipAhead", ",", "via", ")", "{", "for", "(", "let", "rule", "of", "name", ".", "rules", ")", "{", "let", "add", "=", "added", ".", "find", "(", "a", "=>", "a", ".", "rule", "==", "rule", ")", ";", "if", "(", "!", "add", ")", "{", "let", "existing", "=", "set", ".", "find", "(", "p", "=>", "p", ".", "pos", "==", "0", "&&", "p", ".", "rule", "==", "rule", ")", ";", "add", "=", "existing", "?", "new", "Pos", "(", "rule", ",", "0", ",", "existing", ".", "ahead", ".", "slice", "(", ")", ",", "existing", ".", "ambigAhead", ",", "existing", ".", "skipAhead", ",", "existing", ".", "via", ")", ":", "new", "Pos", "(", "rule", ",", "0", ",", "[", "]", ",", "none", ",", "skipAhead", ",", "via", ")", ";", "added", ".", "push", "(", "add", ")", ";", "}", "if", "(", "add", ".", "skipAhead", "!=", "skipAhead", ")", "throw", "new", "GenError", "(", "\"Inconsistent skip sets after \"", "+", "via", ".", "trail", "(", ")", ")", ";", "add", ".", "ambigAhead", "=", "union", "(", "add", ".", "ambigAhead", ",", "ambigAhead", ")", ";", "for", "(", "let", "term", "of", "ahead", ")", "if", "(", "!", "add", ".", "ahead", ".", "includes", "(", "term", ")", ")", "{", "add", ".", "ahead", ".", "push", "(", "term", ")", ";", "if", "(", "add", ".", "rule", ".", "parts", ".", "length", "&&", "!", "add", ".", "rule", ".", "parts", "[", "0", "]", ".", "terminal", ")", "addTo", "(", "add", ",", "redo", ")", ";", "}", "}", "}", "for", "(", "let", "pos", "of", "set", ")", "{", "let", "next", "=", "pos", ".", "next", ";", "if", "(", "next", "&&", "!", "next", ".", "terminal", ")", "addFor", "(", "next", ",", "termsAhead", "(", "pos", ".", "rule", ",", "pos", ".", "pos", ",", "pos", ".", "ahead", ",", "first", ")", ",", "pos", ".", "conflicts", "(", "pos", ".", "pos", "+", "1", ")", ".", "ambigGroups", ",", "pos", ".", "pos", "==", "pos", ".", "rule", ".", "parts", ".", "length", "-", "1", "?", "pos", ".", "skipAhead", ":", "pos", ".", "rule", ".", "skip", ",", "pos", ")", ";", "}", "while", "(", "redo", ".", "length", ")", "{", "let", "add", "=", "redo", ".", "pop", "(", ")", "!", ";", "addFor", "(", "add", ".", "rule", ".", "parts", "[", "0", "]", ",", "termsAhead", "(", "add", ".", "rule", ",", "0", ",", "add", ".", "ahead", ",", "first", ")", ",", "union", "(", "add", ".", "rule", ".", "conflicts", "[", "1", "]", ".", "ambigGroups", ",", "add", ".", "rule", ".", "parts", ".", "length", "==", "1", "?", "add", ".", "ambigAhead", ":", "none", ")", ",", "add", ".", "rule", ".", "parts", ".", "length", "==", "1", "?", "add", ".", "skipAhead", ":", "add", ".", "rule", ".", "skip", ",", "add", ")", ";", "}", "let", "result", "=", "set", ".", "slice", "(", ")", ";", "for", "(", "let", "add", "of", "added", ")", "{", "add", ".", "ahead", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "hash", "-", "b", ".", "hash", ")", ";", "add", ".", "finish", "(", ")", ";", "let", "origIndex", "=", "set", ".", "findIndex", "(", "p", "=>", "p", ".", "pos", "==", "0", "&&", "p", ".", "rule", "==", "add", ".", "rule", ")", ";", "if", "(", "origIndex", ">", "-", "1", ")", "result", "[", "origIndex", "]", "=", "add", ";", "else", "result", ".", "push", "(", "add", ")", ";", "}", "return", "result", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", ";", "}", "function", "addTo", "<", "T", ">", "(", "value", ",", "array", ")", "{", "if", "(", "!", "array", ".", "includes", "(", "value", ")", ")", "array", ".", "push", "(", "value", ")", ";", "}", "export", "function", "computeFirstSets", "(", "terms", ")", "{", "let", "table", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "t", "of", "terms", ".", "terms", ")", "if", "(", "!", "t", ".", "terminal", ")", "table", "[", "t", ".", "name", "]", "=", "[", "]", ";", "for", "(", ";", ";", ")", "{", "let", "change", "=", "false", ";", "for", "(", "let", "nt", "of", "terms", ".", "terms", ")", "if", "(", "!", "nt", ".", "terminal", ")", "for", "(", "let", "rule", "of", "nt", ".", "rules", ")", "{", "let", "set", "=", "table", "[", "nt", ".", "name", "]", ";", "let", "found", "=", "false", ",", "startLen", "=", "set", ".", "length", ";", "for", "(", "let", "part", "of", "rule", ".", "parts", ")", "{", "found", "=", "true", ";", "if", "(", "part", ".", "terminal", ")", "{", "addTo", "(", "part", ",", "set", ")", ";", "}", "else", "{", "for", "(", "let", "t", "of", "table", "[", "part", ".", "name", "]", ")", "{", "if", "(", "t", "==", "null", ")", "found", "=", "false", ";", "else", "addTo", "(", "t", ",", "set", ")", ";", "}", "}", "if", "(", "found", ")", "break", ";", "}", "if", "(", "!", "found", ")", "addTo", "(", "null", ",", "set", ")", ";", "if", "(", "set", ".", "length", ">", "startLen", ")", "change", "=", "true", ";", "}", "if", "(", "!", "change", ")", "return", "table", ";", "}", "}", "class", "Core", "{", "constructor", "(", "readonly", "set", ",", "readonly", "state", ")", "{", "}", "}", "class", "Conflict", "{", "constructor", "(", "readonly", "error", ",", "readonly", "rules", ")", "{", "}", "}", "function", "findConflictOrigin", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "eqSimple", "(", "b", ")", ")", "return", "\"\"", ";", "function", "via", "(", "root", ",", "start", ")", "{", "let", "hist", "=", "[", "]", ";", "for", "(", "let", "p", "=", "start", ".", "via", "!", ";", "!", "p", ".", "eqSimple", "(", "root", ")", ";", "p", "=", "p", ".", "via", "!", ")", "hist", ".", "push", "(", "p", ")", ";", "if", "(", "!", "hist", ".", "length", ")", "return", "\"\"", ";", "hist", ".", "unshift", "(", "start", ")", ";", "return", "hist", ".", "reverse", "(", ")", ".", "map", "(", "(", "p", ",", "i", ")", "=>", "\"\\n\"", "+", "\" \"", ".", "repeat", "(", "i", "+", "1", ")", "+", "(", "p", "==", "start", "?", "\"\"", ":", "\"via \"", ")", "+", "p", ")", ".", "join", "(", "\"\"", ")", ";", "}", "for", "(", "let", "p", "=", "a", ";", "p", ";", "p", "=", "p", ".", "via", ")", "for", "(", "let", "p2", "=", "b", ";", "p2", ";", "p2", "=", "p2", ".", "via", ")", "{", "if", "(", "p", ".", "eqSimple", "(", "p2", ")", ")", "return", "\"\\nShared origin: \"", "+", "p", "+", "via", "(", "p", ",", "a", ")", "+", "via", "(", "p", ",", "b", ")", ";", "}", "return", "\"\"", ";", "}", "export", "function", "buildFullAutomaton", "(", "terms", ",", "startTerms", ",", "first", ")", "{", "let", "states", "=", "[", "]", ";", "let", "cores", "=", "{", "}", ";", "let", "t0", "=", "Date", ".", "now", "(", ")", ";", "function", "getState", "(", "core", ",", "top", "?", ")", "{", "if", "(", "core", ".", "length", "==", "0", ")", "return", "null", ";", "let", "coreHash", "=", "hashPositions", "(", "core", ")", ",", "byHash", "=", "cores", "[", "coreHash", "]", ";", "let", "skip", ";", "for", "(", "let", "pos", "of", "core", ")", "{", "if", "(", "!", "skip", ")", "skip", "=", "pos", ".", "skip", ";", "else", "if", "(", "skip", "!=", "pos", ".", "skip", ")", "throw", "new", "GenError", "(", "\"Inconsistent skip sets after \"", "+", "pos", ".", "trail", "(", ")", ")", ";", "}", "if", "(", "byHash", ")", "for", "(", "let", "known", "of", "byHash", ")", "if", "(", "eqSet", "(", "core", ",", "known", ".", "set", ")", ")", "{", "if", "(", "known", ".", "state", ".", "skip", "!=", "skip", ")", "throw", "new", "GenError", "(", "\"Inconsistent skip sets after \"", "+", "known", ".", "set", "[", "0", "]", ".", "trail", "(", ")", ")", ";", "return", "known", ".", "state", ";", "}", "let", "set", "=", "closure", "(", "core", ",", "first", ")", ";", "let", "hash", "=", "hashPositions", "(", "set", ")", ",", "found", ";", "if", "(", "!", "top", ")", "for", "(", "let", "state", "of", "states", ")", "if", "(", "state", ".", "hash", "==", "hash", "&&", "state", ".", "hasSet", "(", "set", ")", ")", "found", "=", "state", ";", "if", "(", "!", "found", ")", "{", "found", "=", "new", "State", "(", "states", ".", "length", ",", "set", ",", "0", ",", "skip", "!", ",", "hash", ",", "top", ")", ";", "states", ".", "push", "(", "found", ")", ";", "if", "(", "timing", "&&", "states", ".", "length", "%", "500", "==", "0", ")", "console", ".", "log", "(", "`${", "states", ".", "length", "} states after ${", "(", "(", "Date", ".", "now", "(", ")", "-", "t0", ")", "/", "1000", ")", ".", "toFixed", "(", "2", ")", "}s`", ")", ";", "}", ";", "(", "cores", "[", "coreHash", "]", "||", "(", "cores", "[", "coreHash", "]", "=", "[", "]", ")", ")", ".", "push", "(", "new", "Core", "(", "core", ",", "found", ")", ")", ";", "return", "found", ";", "}", "for", "(", "const", "startTerm", "of", "startTerms", ")", "{", "const", "startSkip", "=", "startTerm", ".", "rules", ".", "length", "?", "startTerm", ".", "rules", "[", "0", "]", ".", "skip", ":", "terms", ".", "names", "[", "\"%noskip\"", "]", "!", ";", "getState", "(", "startTerm", ".", "rules", ".", "map", "(", "rule", "=>", "new", "Pos", "(", "rule", ",", "0", ",", "[", "terms", ".", "eof", "]", ",", "none", ",", "startSkip", ",", "null", ")", ".", "finish", "(", ")", ")", ",", "startTerm", ")", ";", "}", "let", "conflicts", "=", "[", "]", ";", "for", "(", "let", "filled", "=", "0", ";", "filled", "<", "states", ".", "length", ";", "filled", "++", ")", "{", "let", "state", "=", "states", "[", "filled", "]", ";", "let", "byTerm", "=", "[", "]", ",", "byTermPos", "=", "[", "]", ",", "atEnd", "=", "[", "]", ";", "for", "(", "let", "pos", "of", "state", ".", "set", ")", "{", "if", "(", "pos", ".", "pos", "==", "pos", ".", "rule", ".", "parts", ".", "length", ")", "{", "if", "(", "!", "pos", ".", "rule", ".", "name", ".", "top", ")", "atEnd", ".", "push", "(", "pos", ")", ";", "}", "else", "{", "let", "next", "=", "pos", ".", "rule", ".", "parts", "[", "pos", ".", "pos", "]", ";", "let", "index", "=", "byTerm", ".", "indexOf", "(", "next", ")", ";", "if", "(", "index", "<", "0", ")", "{", "byTerm", ".", "push", "(", "next", ")", ";", "byTermPos", ".", "push", "(", "[", "pos", "]", ")", ";", "}", "else", "{", "byTermPos", "[", "index", "]", ".", "push", "(", "pos", ")", ";", "}", "}", "}", "for", "(", "let", "i", "=", "0", ";", "i", "<", "byTerm", ".", "length", ";", "i", "++", ")", "{", "let", "term", "=", "byTerm", "[", "i", "]", ",", "positions", "=", "byTermPos", "[", "i", "]", ".", "map", "(", "p", "=>", "p", ".", "advance", "(", ")", ")", ";", "if", "(", "term", ".", "terminal", ")", "{", "let", "set", "=", "applyCut", "(", "positions", ")", ";", "let", "next", "=", "getState", "(", "set", ")", ";", "if", "(", "next", ")", "state", ".", "addAction", "(", "new", "Shift", "(", "term", ",", "next", ")", ",", "byTermPos", "[", "i", "]", ",", "conflicts", ")", ";", "}", "else", "{", "let", "goto", "=", "getState", "(", "positions", ")", ";", "if", "(", "goto", ")", "state", ".", "goto", ".", "push", "(", "new", "Shift", "(", "term", ",", "goto", ")", ")", ";", "}", "}", "let", "replaced", "=", "false", ";", "for", "(", "let", "pos", "of", "atEnd", ")", "for", "(", "let", "ahead", "of", "pos", ".", "ahead", ")", "{", "let", "count", "=", "state", ".", "actions", ".", "length", ";", "state", ".", "addAction", "(", "new", "Reduce", "(", "ahead", ",", "pos", ".", "rule", ")", ",", "[", "pos", "]", ",", "conflicts", ")", ";", "if", "(", "state", ".", "actions", ".", "length", "==", "count", ")", "replaced", "=", "true", ";", "}", "if", "(", "replaced", ")", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "goto", ".", "length", ";", "i", "++", ")", "{", "let", "start", "=", "first", "[", "state", ".", "goto", "[", "i", "]", ".", "term", ".", "name", "]", ";", "if", "(", "!", "start", ".", "some", "(", "term", "=>", "state", ".", "actions", ".", "some", "(", "a", "=>", "a", ".", "term", "==", "term", "&&", "(", "a", "instanceof", "Shift", ")", ")", ")", ")", "state", ".", "goto", ".", "splice", "(", "i", "--", ",", "1", ")", ";", "}", "}", "if", "(", "conflicts", ".", "length", ")", "throw", "new", "GenError", "(", "conflicts", ".", "map", "(", "c", "=>", "c", ".", "error", ")", ".", "join", "(", "\"\\n\\n\"", ")", ")", ";", "for", "(", "let", "state", "of", "states", ")", "state", ".", "finish", "(", ")", ";", "if", "(", "timing", ")", "console", ".", "log", "(", "`${", "states", ".", "length", "} states total.`", ")", ";", "return", "states", ";", "}", "function", "applyCut", "(", "set", ")", "{", "let", "found", "=", "null", ",", "cut", "=", "1", ";", "for", "(", "let", "pos", "of", "set", ")", "{", "let", "value", "=", "pos", ".", "rule", ".", "conflicts", "[", "pos", ".", "pos", "-", "1", "]", ".", "cut", ";", "if", "(", "value", "<", "cut", ")", "continue", ";", "if", "(", "!", "found", "||", "value", ">", "cut", ")", "{", "cut", "=", "value", ";", "found", "=", "[", "]", ";", "}", "found", ".", "push", "(", "pos", ")", ";", "}", "return", "found", "||", "set", ";", "}", "function", "canMergeInner", "(", "a", ",", "b", ",", "mapping", ")", "{", "for", "(", "let", "goto", "of", "a", ".", "goto", ")", "for", "(", "let", "other", "of", "b", ".", "goto", ")", "{", "if", "(", "goto", ".", "term", "==", "other", ".", "term", "&&", "mapping", "[", "goto", ".", "target", ".", "id", "]", "!=", "mapping", "[", "other", ".", "target", ".", "id", "]", ")", "return", "false", ";", "}", "actions", ":", "for", "(", "let", "action", "of", "a", ".", "actions", ")", "{", "let", "conflict", "=", "false", ";", "for", "(", "let", "other", "of", "b", ".", "actions", ")", "if", "(", "other", ".", "term", "==", "action", ".", "term", ")", "{", "if", "(", "action", "instanceof", "Shift", "?", "other", "instanceof", "Shift", "&&", "mapping", "[", "action", ".", "target", ".", "id", "]", "==", "mapping", "[", "other", ".", "target", ".", "id", "]", ":", "other", ".", "eq", "(", "action", ")", ")", "continue", "actions", ";", "conflict", "=", "true", ";", "}", "if", "(", "conflict", ")", "return", "false", ";", "}", "return", "true", ";", "}", "function", "canMerge", "(", "a", ",", "b", ",", "mapping", ")", "{", "return", "canMergeInner", "(", "a", ",", "b", ",", "mapping", ")", "&&", "canMergeInner", "(", "b", ",", "a", ",", "mapping", ")", ";", "}", "function", "mergeStates", "(", "states", ",", "mapping", ")", "{", "let", "newStates", "=", "[", "]", ";", "for", "(", "let", "state", "of", "states", ")", "{", "let", "newID", "=", "mapping", "[", "state", ".", "id", "]", ";", "if", "(", "!", "newStates", "[", "newID", "]", ")", "{", "newStates", "[", "newID", "]", "=", "new", "State", "(", "newID", ",", "state", ".", "set", ",", "0", ",", "state", ".", "skip", ",", "state", ".", "hash", ",", "state", ".", "startRule", ")", ";", "newStates", "[", "newID", "]", ".", "tokenGroup", "=", "state", ".", "tokenGroup", ";", "newStates", "[", "newID", "]", ".", "defaultReduce", "=", "state", ".", "defaultReduce", ";", "}", "}", "for", "(", "let", "state", "of", "states", ")", "{", "let", "newID", "=", "mapping", "[", "state", ".", "id", "]", ",", "target", "=", "newStates", "[", "newID", "]", ";", "target", ".", "flags", "|=", "state", ".", "flags", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "actions", ".", "length", ";", "i", "++", ")", "{", "let", "action", "=", "state", ".", "actions", "[", "i", "]", ".", "map", "(", "mapping", ",", "newStates", ")", ";", "if", "(", "!", "target", ".", "actions", ".", "some", "(", "a", "=>", "a", ".", "eq", "(", "action", ")", ")", ")", "{", "target", ".", "actions", ".", "push", "(", "action", ")", ";", "target", ".", "actionPositions", ".", "push", "(", "state", ".", "actionPositions", "[", "i", "]", ")", ";", "}", "}", "for", "(", "let", "goto", "of", "state", ".", "goto", ")", "{", "let", "mapped", "=", "goto", ".", "map", "(", "mapping", ",", "newStates", ")", ";", "if", "(", "!", "target", ".", "goto", ".", "some", "(", "g", "=>", "g", ".", "eq", "(", "mapped", ")", ")", ")", "target", ".", "goto", ".", "push", "(", "mapped", ")", ";", "}", "}", "return", "newStates", ";", "}", "class", "Group", "{", "members", ":", "number", "[", "]", ";", "constructor", "(", "readonly", "origin", ",", "member", ")", "{", "this", ".", "members", "=", "[", "member", "]", ";", "}", "}", "function", "samePosSet", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "return", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "if", "(", "!", "a", "[", "i", "]", ".", "eqSimple", "(", "b", "[", "i", "]", ")", ")", "return", "false", ";", "return", "true", ";", "}", "function", "collapseAutomaton", "(", "states", ")", "{", "let", "mapping", "=", "[", "]", ",", "groups", "=", "[", "]", ";", "assignGroups", ":", "for", "(", "let", "i", "=", "0", ";", "i", "<", "states", ".", "length", ";", "i", "++", ")", "{", "let", "state", "=", "states", "[", "i", "]", ";", "if", "(", "!", "state", ".", "startRule", ")", "for", "(", "let", "j", "=", "0", ";", "j", "<", "groups", ".", "length", ";", "j", "++", ")", "{", "let", "group", "=", "groups", "[", "j", "]", ",", "other", "=", "states", "[", "group", ".", "members", "[", "0", "]", "]", ";", "if", "(", "state", ".", "tokenGroup", "==", "other", ".", "tokenGroup", "&&", "state", ".", "skip", "==", "other", ".", "skip", "&&", "!", "other", ".", "startRule", "&&", "samePosSet", "(", "state", ".", "set", ",", "other", ".", "set", ")", ")", "{", "group", ".", "members", ".", "push", "(", "i", ")", ";", "mapping", ".", "push", "(", "j", ")", ";", "continue", "assignGroups", ";", "}", "}", "mapping", ".", "push", "(", "groups", ".", "length", ")", ";", "groups", ".", "push", "(", "new", "Group", "(", "groups", ".", "length", ",", "i", ")", ")", ";", "}", "function", "spill", "(", "groupIndex", ",", "index", ")", "{", "let", "group", "=", "groups", "[", "groupIndex", "]", ",", "state", "=", "states", "[", "group", ".", "members", "[", "index", "]", "]", ";", "let", "pop", "=", "group", ".", "members", ".", "pop", "(", ")", "!", ";", "if", "(", "index", "!=", "group", ".", "members", ".", "length", ")", "group", ".", "members", "[", "index", "]", "=", "pop", ";", "for", "(", "let", "i", "=", "groupIndex", "+", "1", ";", "i", "<", "groups", ".", "length", ";", "i", "++", ")", "{", "mapping", "[", "state", ".", "id", "]", "=", "i", ";", "if", "(", "groups", "[", "i", "]", ".", "origin", "==", "group", ".", "origin", "&&", "groups", "[", "i", "]", ".", "members", ".", "every", "(", "id", "=>", "canMerge", "(", "state", ",", "states", "[", "id", "]", ",", "mapping", ")", ")", ")", "{", "groups", "[", "i", "]", ".", "members", ".", "push", "(", "state", ".", "id", ")", ";", "return", ";", "}", "}", "mapping", "[", "state", ".", "id", "]", "=", "groups", ".", "length", ";", "groups", ".", "push", "(", "new", "Group", "(", "group", ".", "origin", ",", "state", ".", "id", ")", ")", ";", "}", "for", "(", "let", "pass", "=", "1", ";", ";", "pass", "++", ")", "{", "let", "conflicts", "=", "false", ",", "t0", "=", "Date", ".", "now", "(", ")", ";", "for", "(", "let", "g", "=", "0", ",", "startLen", "=", "groups", ".", "length", ";", "g", "<", "startLen", ";", "g", "++", ")", "{", "let", "group", "=", "groups", "[", "g", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "group", ".", "members", ".", "length", "-", "1", ";", "i", "++", ")", "{", "for", "(", "let", "j", "=", "i", "+", "1", ";", "j", "<", "group", ".", "members", ".", "length", ";", "j", "++", ")", "{", "let", "idA", "=", "group", ".", "members", "[", "i", "]", ",", "idB", "=", "group", ".", "members", "[", "j", "]", ";", "if", "(", "!", "canMerge", "(", "states", "[", "idA", "]", ",", "states", "[", "idB", "]", ",", "mapping", ")", ")", "{", "conflicts", "=", "true", ";", "spill", "(", "g", ",", "j", "--", ")", ";", "}", "}", "}", "}", "if", "(", "timing", ")", "console", ".", "log", "(", "`Collapse pass ${", "pass", "}${", "conflicts", "?", "``", ":", "`, done`", "} (${", "(", "(", "Date", ".", "now", "(", ")", "-", "t0", ")", "/", "1000", ")", ".", "toFixed", "(", "2", ")", "}s)`", ")", ";", "if", "(", "!", "conflicts", ")", "return", "mergeStates", "(", "states", ",", "mapping", ")", ";", "}", "}", "function", "mergeIdentical", "(", "states", ")", "{", "for", "(", "let", "pass", "=", "1", ";", ";", "pass", "++", ")", "{", "let", "mapping", "=", "[", "]", ",", "didMerge", "=", "false", ",", "t0", "=", "Date", ".", "now", "(", ")", ";", "let", "newStates", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "states", ".", "length", ";", "i", "++", ")", "{", "let", "state", "=", "states", "[", "i", "]", ";", "let", "match", "=", "newStates", ".", "findIndex", "(", "s", "=>", "state", ".", "eq", "(", "s", ")", ")", ";", "if", "(", "match", "<", "0", ")", "{", "mapping", "[", "i", "]", "=", "newStates", ".", "length", ";", "newStates", ".", "push", "(", "state", ")", ";", "}", "else", "{", "mapping", "[", "i", "]", "=", "match", ";", "didMerge", "=", "true", ";", "let", "other", "=", "newStates", "[", "match", "]", ",", "add", "=", "null", ";", "for", "(", "let", "pos", "of", "state", ".", "set", ")", "if", "(", "!", "other", ".", "set", ".", "some", "(", "p", "=>", "p", ".", "eqSimple", "(", "pos", ")", ")", ")", "(", "add", "||", "(", "add", "=", "[", "]", ")", ")", ".", "push", "(", "pos", ")", ";", "if", "(", "add", ")", "other", ".", "set", "=", "add", ".", "concat", "(", "other", ".", "set", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "cmp", "(", "b", ")", ")", ";", "}", "}", "if", "(", "timing", ")", "console", ".", "log", "(", "`Merge identical pass ${", "pass", "}${", "didMerge", "?", "\"\"", ":", "\", done\"", "} (${", "(", "(", "Date", ".", "now", "(", ")", "-", "t0", ")", "/", "1000", ")", ".", "toFixed", "(", "2", ")", "}s)`", ")", ";", "if", "(", "!", "didMerge", ")", "return", "states", ";", "for", "(", "let", "state", "of", "newStates", ")", "if", "(", "!", "state", ".", "defaultReduce", ")", "{", "state", ".", "actions", "=", "state", ".", "actions", ".", "map", "(", "a", "=>", "a", ".", "map", "(", "mapping", ",", "newStates", ")", ")", ";", "state", ".", "goto", "=", "state", ".", "goto", ".", "map", "(", "a", "=>", "a", ".", "map", "(", "mapping", ",", "newStates", ")", ")", ";", "}", "for", "(", "let", "i", "=", "0", ";", "i", "<", "newStates", ".", "length", ";", "i", "++", ")", "newStates", "[", "i", "]", ".", "id", "=", "i", ";", "states", "=", "newStates", ";", "}", "}", "const", "none", "=", "[", "]", ";", "export", "function", "finishAutomaton", "(", "full", ")", "{", "return", "mergeIdentical", "(", "collapseAutomaton", "(", "full", ")", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, 3, null, null, 5, null, null, null, null, null, 229, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, 5, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 14834, null, 3, null, null, null, null, null, null, null, 14834, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 14834, null, null, null, null, null, 14834, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 277, null, 3, null, null, null, 6, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, 38, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, 277, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 3, null, null, null, null, 229, null, null, 3, null, null, null, null, null, null, null, 229, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 14834, null, null, null, null, null, null, 14834, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8714, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, 229, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, 25941, null, null, null, null, null, null, null, null, null, null, null, 8, null, 38, null, null, null, 277, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, 6, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, 4, null, 229, null, null, null, null, null, 229, null, 1653, null, null, null, null, null, 277, null, null, null, null, null, null, null, 1653, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, 229, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 11, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 42364, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 8, null, null, null, 3, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, 1653, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 1653, null, 1653, null, null, null, 5, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 42364, null, 5, null, 6, null, null, null, 5, null, null, null, null, null, 6, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 229, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3839, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 1653, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8714, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 1653, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 38, null, 38, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 38, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 38, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 360, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3, null, 3, null, null, null, 360, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 8, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 360, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 8, null, null, null, 3, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, 3, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, 5, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
4
[ "export", "class", "Node", "{", "constructor", "(", "readonly", "start", ")", "{", "}", "}", "export", "class", "GrammarDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "rules", ",", "readonly", "topRules", ",", "readonly", "tokens", ",", "readonly", "context", ",", "readonly", "externalTokens", ",", "readonly", "externalSpecializers", ",", "readonly", "precedences", ",", "readonly", "mainSkip", ",", "readonly", "scopedSkip", ",", "readonly", "dialects", ",", "readonly", "externalProps", ",", "readonly", "autoDelim", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "Object", ".", "values", "(", "this", ".", "rules", ")", ".", "join", "(", "\"\\n\"", ")", ";", "}", "}", "export", "class", "RuleDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "id", ",", "readonly", "props", ",", "readonly", "params", ",", "readonly", "expr", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "id", ".", "name", "+", "(", "this", ".", "params", ".", "length", "?", "`<${", "this", ".", "params", ".", "join", "(", ")", "}>`", ":", "\"\"", ")", "+", "\" -> \"", "+", "this", ".", "expr", ";", "}", "}", "export", "class", "PrecDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "items", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "TokenPrecDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "items", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "TokenConflictDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "a", ",", "readonly", "b", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "TokenDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "precedences", ",", "readonly", "conflicts", ",", "readonly", "rules", ",", "readonly", "literals", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "LiteralDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "literal", ",", "readonly", "props", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "ContextDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "id", ",", "readonly", "source", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "ExternalTokenDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "id", ",", "readonly", "source", ",", "readonly", "tokens", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "ExternalSpecializeDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "type", ",", "readonly", "token", ",", "readonly", "id", ",", "readonly", "source", ",", "readonly", "tokens", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "ExternalPropDeclaration", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "id", ",", "readonly", "externalID", ",", "readonly", "source", ")", "{", "super", "(", "start", ")", ";", "}", "}", "export", "class", "Identifier", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "name", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "name", ";", "}", "}", "export", "class", "Expression", "extends", "Node", "{", "walk", "(", "f", ")", "{", "return", "f", "(", "this", ")", ";", "}", "eq", "(", "_other", ")", "{", "return", "false", ";", "}", "prec", "!", ":", "number", ";", "}", "Expression", ".", "prototype", ".", "prec", "=", "10", ";", "export", "class", "NameExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "namespace", ",", "readonly", "id", ",", "readonly", "args", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "id", ".", "name", "+", "(", "this", ".", "args", ".", "length", "?", "`<${", "this", ".", "args", ".", "join", "(", ")", "}>`", ":", "\"\"", ")", ";", "}", "eq", "(", "other", ")", "{", "return", "(", "this", ".", "namespace", "?", "other", ".", "namespace", "!=", "null", "&&", "other", ".", "namespace", ".", "name", "==", "this", ".", "namespace", ".", "name", ":", "!", "other", ".", "namespace", ")", "&&", "this", ".", "id", ".", "name", "==", "other", ".", "id", ".", "name", "&&", "exprsEq", "(", "this", ".", "args", ",", "other", ".", "args", ")", ";", "}", "walk", "(", "f", ")", "{", "let", "args", "=", "walkExprs", "(", "this", ".", "args", ",", "f", ")", ";", "return", "f", "(", "args", "==", "this", ".", "args", "?", "this", ":", "new", "NameExpression", "(", "this", ".", "start", ",", "this", ".", "namespace", ",", "this", ".", "id", ",", "args", ")", ")", ";", "}", "}", "export", "class", "SpecializeExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "type", ",", "readonly", "props", ",", "readonly", "token", ",", "readonly", "content", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "`@${", "this", ".", "type", "}[${", "this", ".", "props", ".", "join", "(", "\",\"", ")", "}]<${", "this", ".", "token", "}, ${", "this", ".", "content", "}>`", ";", "}", "eq", "(", "other", ")", "{", "return", "this", ".", "type", "==", "other", ".", "type", "&&", "Prop", ".", "eqProps", "(", "this", ".", "props", ",", "other", ".", "props", ")", "&&", "exprEq", "(", "this", ".", "token", ",", "other", ".", "token", ")", "&&", "exprEq", "(", "this", ".", "content", ",", "other", ".", "content", ")", ";", "}", "walk", "(", "f", ")", "{", "let", "token", "=", "this", ".", "token", ".", "walk", "(", "f", ")", ",", "content", "=", "this", ".", "content", ".", "walk", "(", "f", ")", ";", "return", "f", "(", "token", "==", "this", ".", "token", "&&", "content", "==", "this", ".", "content", "?", "this", ":", "new", "SpecializeExpression", "(", "this", ".", "start", ",", "this", ".", "type", ",", "this", ".", "props", ",", "token", ",", "content", ")", ")", ";", "}", "}", "export", "class", "InlineRuleExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "rule", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "let", "rule", "=", "this", ".", "rule", ";", "return", "`${", "rule", ".", "id", "}${", "rule", ".", "props", ".", "length", "?", "`[${", "rule", ".", "props", ".", "join", "(", "\",\"", ")", "}]`", ":", "\"\"", "} { ${", "rule", ".", "expr", "} }`", ";", "}", "eq", "(", "other", ")", "{", "let", "rule", "=", "this", ".", "rule", ",", "oRule", "=", "other", ".", "rule", ";", "return", "exprEq", "(", "rule", ".", "expr", ",", "oRule", ".", "expr", ")", "&&", "rule", ".", "id", ".", "name", "==", "oRule", ".", "id", ".", "name", "&&", "Prop", ".", "eqProps", "(", "rule", ".", "props", ",", "oRule", ".", "props", ")", ";", "}", "walk", "(", "f", ")", "{", "let", "rule", "=", "this", ".", "rule", ",", "expr", "=", "rule", ".", "expr", ".", "walk", "(", "f", ")", ";", "return", "f", "(", "expr", "==", "rule", ".", "expr", "?", "this", ":", "new", "InlineRuleExpression", "(", "this", ".", "start", ",", "new", "RuleDeclaration", "(", "rule", ".", "start", ",", "rule", ".", "id", ",", "rule", ".", "props", ",", "[", "]", ",", "expr", ")", ")", ")", ";", "}", "}", "export", "class", "ChoiceExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "exprs", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "exprs", ".", "map", "(", "e", "=>", "maybeParens", "(", "e", ",", "this", ")", ")", ".", "join", "(", "\" | \"", ")", ";", "}", "eq", "(", "other", ")", "{", "return", "exprsEq", "(", "this", ".", "exprs", ",", "other", ".", "exprs", ")", ";", "}", "walk", "(", "f", ")", "{", "let", "exprs", "=", "walkExprs", "(", "this", ".", "exprs", ",", "f", ")", ";", "return", "f", "(", "exprs", "==", "this", ".", "exprs", "?", "this", ":", "new", "ChoiceExpression", "(", "this", ".", "start", ",", "exprs", ")", ")", ";", "}", "}", "ChoiceExpression", ".", "prototype", ".", "prec", "=", "1", ";", "export", "class", "SequenceExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "exprs", ",", "readonly", "markers", ",", "readonly", "empty", "=", "false", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "this", ".", "empty", "?", "\"()\"", ":", "this", ".", "exprs", ".", "map", "(", "e", "=>", "maybeParens", "(", "e", ",", "this", ")", ")", ".", "join", "(", "\" \"", ")", ";", "}", "eq", "(", "other", ")", "{", "return", "exprsEq", "(", "this", ".", "exprs", ",", "other", ".", "exprs", ")", "&&", "this", ".", "markers", ".", "every", "(", "(", "m", ",", "i", ")", "=>", "{", "let", "om", "=", "other", ".", "markers", "[", "i", "]", ";", "return", "m", ".", "length", "==", "om", ".", "length", "&&", "m", ".", "every", "(", "(", "x", ",", "i", ")", "=>", "x", ".", "eq", "(", "om", "[", "i", "]", ")", ")", ";", "}", ")", ";", "}", "walk", "(", "f", ")", "{", "let", "exprs", "=", "walkExprs", "(", "this", ".", "exprs", ",", "f", ")", ";", "return", "f", "(", "exprs", "==", "this", ".", "exprs", "?", "this", ":", "new", "SequenceExpression", "(", "this", ".", "start", ",", "exprs", ",", "this", ".", "markers", ",", "this", ".", "empty", "&&", "!", "exprs", ".", "length", ")", ")", ";", "}", "}", "SequenceExpression", ".", "prototype", ".", "prec", "=", "2", ";", "export", "class", "ConflictMarker", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "id", ",", "readonly", "type", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "(", "this", ".", "type", "==", "\"ambig\"", "?", "\"~\"", ":", "\"!\"", ")", "+", "this", ".", "id", ".", "name", ";", "}", "eq", "(", "other", ")", "{", "return", "this", ".", "id", ".", "name", "==", "other", ".", "id", ".", "name", "&&", "this", ".", "type", "==", "other", ".", "type", ";", "}", "}", "export", "class", "RepeatExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "expr", ",", "readonly", "kind", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "maybeParens", "(", "this", ".", "expr", ",", "this", ")", "+", "this", ".", "kind", ";", "}", "eq", "(", "other", ")", "{", "return", "exprEq", "(", "this", ".", "expr", ",", "other", ".", "expr", ")", "&&", "this", ".", "kind", "==", "other", ".", "kind", ";", "}", "walk", "(", "f", ")", "{", "let", "expr", "=", "this", ".", "expr", ".", "walk", "(", "f", ")", ";", "return", "f", "(", "expr", "==", "this", ".", "expr", "?", "this", ":", "new", "RepeatExpression", "(", "this", ".", "start", ",", "expr", ",", "this", ".", "kind", ")", ")", ";", "}", "}", "RepeatExpression", ".", "prototype", ".", "prec", "=", "3", ";", "export", "class", "LiteralExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "value", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "JSON", ".", "stringify", "(", "this", ".", "value", ")", ";", "}", "eq", "(", "other", ")", "{", "return", "this", ".", "value", "==", "other", ".", "value", ";", "}", "}", "export", "class", "SetExpression", "extends", "Expression", "{", "constructor", "(", "start", ",", "readonly", "ranges", ",", "readonly", "inverted", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "`[${", "this", ".", "inverted", "?", "\"^\"", ":", "\"\"", "}${", "this", ".", "ranges", ".", "map", "(", "(", "[", "a", ",", "b", "]", ")", "=>", "{", "return", "String", ".", "fromCodePoint", "(", "a", ")", "+", "(", "b", "==", "a", "+", "1", "?", "\"\"", ":", "\"-\"", "+", "String", ".", "fromCodePoint", "(", "b", ")", ")", ";", "}", ")", "}]`", ";", "}", "eq", "(", "other", ")", "{", "return", "this", ".", "inverted", "==", "other", ".", "inverted", "&&", "this", ".", "ranges", ".", "length", "==", "other", ".", "ranges", ".", "length", "&&", "this", ".", "ranges", ".", "every", "(", "(", "[", "a", ",", "b", "]", ",", "i", ")", "=>", "{", "let", "[", "x", ",", "y", "]", "=", "other", ".", "ranges", "[", "i", "]", ";", "return", "a", "==", "x", "&&", "b", "==", "y", ";", "}", ")", ";", "}", "}", "export", "class", "AnyExpression", "extends", "Expression", "{", "constructor", "(", "start", ")", "{", "super", "(", "start", ")", ";", "}", "toString", "(", ")", "{", "return", "\"_\"", ";", "}", "eq", "(", ")", "{", "return", "true", ";", "}", "}", "function", "walkExprs", "(", "exprs", ",", "f", ")", "{", "let", "result", "=", "null", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "exprs", ".", "length", ";", "i", "++", ")", "{", "let", "expr", "=", "exprs", "[", "i", "]", ".", "walk", "(", "f", ")", ";", "if", "(", "expr", "!=", "exprs", "[", "i", "]", "&&", "!", "result", ")", "result", "=", "exprs", ".", "slice", "(", "0", ",", "i", ")", ";", "if", "(", "result", ")", "result", ".", "push", "(", "expr", ")", ";", "}", "return", "result", "||", "exprs", ";", "}", "export", "function", "exprEq", "(", "a", ",", "b", ")", "{", "return", "a", ".", "constructor", "==", "b", ".", "constructor", "&&", "a", ".", "eq", "(", "b", "as", "any", ")", ";", "}", "export", "function", "exprsEq", "(", "a", ",", "b", ")", "{", "return", "a", ".", "length", "==", "b", ".", "length", "&&", "a", ".", "every", "(", "(", "e", ",", "i", ")", "=>", "exprEq", "(", "e", ",", "b", "[", "i", "]", ")", ")", ";", "}", "export", "class", "Prop", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "at", ",", "readonly", "name", ",", "readonly", "value", ")", "{", "super", "(", "start", ")", ";", "}", "eq", "(", "other", ")", "{", "return", "this", ".", "name", "==", "other", ".", "name", "&&", "this", ".", "value", ".", "length", "==", "other", ".", "value", ".", "length", "&&", "this", ".", "value", ".", "every", "(", "(", "v", ",", "i", ")", "=>", "v", ".", "value", "==", "other", ".", "value", "[", "i", "]", ".", "value", "&&", "v", ".", "name", "==", "other", ".", "value", "[", "i", "]", ".", "name", ")", ";", "}", "toString", "(", ")", "{", "let", "result", "=", "(", "this", ".", "at", "?", "\"@\"", ":", "\"\"", ")", "+", "this", ".", "name", ";", "if", "(", "this", ".", "value", ".", "length", ")", "{", "result", "+=", "\"=\"", ";", "for", "(", "let", "{", "name", ",", "value", "}", "of", "this", ".", "value", ")", "result", "+=", "name", "?", "`{${", "name", "}}`", ":", "/[^\\w-]/", ".", "test", "(", "value", "!", ")", "?", "JSON", ".", "stringify", "(", "value", ")", ":", "value", ";", "}", "return", "result", ";", "}", "static", "eqProps", "(", "a", ",", "b", ")", "{", "return", "a", ".", "length", "==", "b", ".", "length", "&&", "a", ".", "every", "(", "(", "p", ",", "i", ")", "=>", "p", ".", "eq", "(", "b", "[", "i", "]", ")", ")", ";", "}", "}", "export", "class", "PropPart", "extends", "Node", "{", "constructor", "(", "start", ",", "readonly", "value", ",", "readonly", "name", ")", "{", "super", "(", "start", ")", ";", "}", "}", "function", "maybeParens", "(", "node", ",", "parent", ")", "{", "return", "node", ".", "prec", "<", "parent", ".", "prec", "?", "\"(\"", "+", "node", ".", "toString", "(", ")", "+", "\")\"", ":", "node", ".", "toString", "(", ")", ";", "}" ]
[ null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 0, null, null, 0, null, null, null, null, null, null, null, null, 0, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, 71, null, null, 140, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, 140, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, null, null, null, null, null, null, 8, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 37591, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, null, null, null, 71, null, null, 71, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 16516, null, null, null, null, null, null, null, null, 2, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, 16516, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, 16516, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 37592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 140, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 71, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 5092, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 5, null, null, 8, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, 5, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 8, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 8, null, 4668, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4668, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 2, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
5
[ "import", "{", "Term", ",", "union", "}", "from", "\"./grammar\"", ";", "import", "{", "GenError", "}", "from", "\"./error\"", ";", "export", "const", "MAX_CHAR", "=", "0xfffe", ";", "export", "class", "Edge", "{", "constructor", "(", "readonly", "from", ",", "readonly", "to", ",", "readonly", "target", ")", "{", "}", "toString", "(", ")", "{", "return", "`-> ${", "this", ".", "target", ".", "id", "}[label=${", "JSON", ".", "stringify", "(", "this", ".", "from", "<", "0", "?", "\"ε\"", ":", "charFor", "(", "this", ".", "from", ")", "+", "(", "this", ".", "to", ">", "this", ".", "from", "+", "1", "?", "\"-\"", "+", "charFor", "(", "this", ".", "to", "-", "1", ")", ":", "\"\"", ")", ")", "}]`", ";", "}", "}", "function", "charFor", "(", "n", ")", "{", "return", "n", ">", "MAX_CHAR", "?", "\"∞\"", ":", "n", ">=", "0xd800", "&&", "n", "<", "0xdfff", "?", "\"\\\\u{\"", "+", "n", ".", "toString", "(", "16", ")", "+", "\"}\"", ":", "String", ".", "fromCharCode", "(", "n", ")", ";", "}", "type", "Partition", "=", "{", "[", "id", "]", ":", "State", "[", "]", ";", "}", ";", "function", "minimize", "(", "states", ",", "start", ")", "{", "let", "partition", "=", "Object", ".", "create", "(", "null", ")", ";", "let", "byAccepting", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "state", "of", "states", ")", "{", "let", "id", "=", "ids", "(", "state", ".", "accepting", ")", ";", "let", "group", "=", "byAccepting", "[", "id", "]", "||", "(", "byAccepting", "[", "id", "]", "=", "[", "]", ")", ";", "group", ".", "push", "(", "state", ")", ";", "partition", "[", "state", ".", "id", "]", "=", "group", ";", "}", "for", "(", ";", ";", ")", "{", "let", "split", "=", "false", ",", "newPartition", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "state", "of", "states", ")", "{", "if", "(", "newPartition", "[", "state", ".", "id", "]", ")", "continue", ";", "let", "group", "=", "partition", "[", "state", ".", "id", "]", ";", "if", "(", "group", ".", "length", "==", "1", ")", "{", "newPartition", "[", "group", "[", "0", "]", ".", "id", "]", "=", "group", ";", "continue", ";", "}", "let", "parts", "=", "[", "]", ";", "groups", ":", "for", "(", "let", "state", "of", "group", ")", "{", "for", "(", "let", "p", "of", "parts", ")", "{", "if", "(", "isEquivalent", "(", "state", ",", "p", "[", "0", "]", ",", "partition", ")", ")", "{", "p", ".", "push", "(", "state", ")", ";", "continue", "groups", ";", "}", "}", "parts", ".", "push", "(", "[", "state", "]", ")", ";", "}", "if", "(", "parts", ".", "length", ">", "1", ")", "split", "=", "true", ";", "for", "(", "let", "p", "of", "parts", ")", "for", "(", "let", "s", "of", "p", ")", "newPartition", "[", "s", ".", "id", "]", "=", "p", ";", "}", "if", "(", "!", "split", ")", "return", "applyMinimization", "(", "states", ",", "start", ",", "partition", ")", ";", "partition", "=", "newPartition", ";", "}", "}", "function", "isEquivalent", "(", "a", ",", "b", ",", "partition", ")", "{", "if", "(", "a", ".", "edges", ".", "length", "!=", "b", ".", "edges", ".", "length", ")", "return", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "edges", ".", "length", ";", "i", "++", ")", "{", "let", "eA", "=", "a", ".", "edges", "[", "i", "]", ",", "eB", "=", "b", ".", "edges", "[", "i", "]", ";", "if", "(", "eA", ".", "from", "!=", "eB", ".", "from", "||", "eA", ".", "to", "!=", "eB", ".", "to", "||", "partition", "[", "eA", ".", "target", ".", "id", "]", "!=", "partition", "[", "eB", ".", "target", ".", "id", "]", ")", "return", "false", ";", "}", "return", "true", ";", "}", "function", "applyMinimization", "(", "states", ",", "start", ",", "partition", ")", "{", "for", "(", "let", "state", "of", "states", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "edges", ".", "length", ";", "i", "++", ")", "{", "let", "edge", "=", "state", ".", "edges", "[", "i", "]", ",", "target", "=", "partition", "[", "edge", ".", "target", ".", "id", "]", "[", "0", "]", ";", "if", "(", "target", "!=", "edge", ".", "target", ")", "state", ".", "edges", "[", "i", "]", "=", "new", "Edge", "(", "edge", ".", "from", ",", "edge", ".", "to", ",", "target", ")", ";", "}", "}", "return", "partition", "[", "start", ".", "id", "]", "[", "0", "]", ";", "}", "let", "stateID", "=", "1", ";", "export", "class", "State", "{", "edges", ":", "Edge", "[", "]", "=", "[", "]", ";", "constructor", "(", "readonly", "accepting", "=", "[", "]", ",", "readonly", "id", "=", "stateID", "++", ")", "{", "}", "edge", "(", "from", ",", "to", ",", "target", ")", "{", "this", ".", "edges", ".", "push", "(", "new", "Edge", "(", "from", ",", "to", ",", "target", ")", ")", ";", "}", "nullEdge", "(", "target", ")", "{", "this", ".", "edge", "(", "-", "1", ",", "-", "1", ",", "target", ")", ";", "}", "compile", "(", ")", "{", "let", "labeled", "=", "Object", ".", "create", "(", "null", ")", ",", "localID", "=", "0", ";", "let", "startState", "=", "explore", "(", "this", ".", "closure", "(", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "id", "-", "b", ".", "id", ")", ")", ";", "return", "minimize", "(", "Object", ".", "values", "(", "labeled", ")", ",", "startState", ")", ";", "function", "explore", "(", "states", ")", "{", "let", "newState", "=", "labeled", "[", "ids", "(", "states", ")", "]", "=", "new", "State", "(", "states", ".", "reduce", "(", "(", "a", ",", "s", ")", "=>", "union", "(", "a", ",", "s", ".", "accepting", ")", ",", "[", "]", ")", "as", "Term", "[", "]", ",", "localID", "++", ")", ";", "let", "out", "=", "[", "]", ";", "for", "(", "let", "state", "of", "states", ")", "for", "(", "let", "edge", "of", "state", ".", "edges", ")", "{", "if", "(", "edge", ".", "from", ">=", "0", ")", "out", ".", "push", "(", "edge", ")", ";", "}", "let", "transitions", "=", "mergeEdges", "(", "out", ")", ";", "for", "(", "let", "merged", "of", "transitions", ")", "{", "let", "targets", "=", "merged", ".", "targets", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "id", "-", "b", ".", "id", ")", ";", "newState", ".", "edge", "(", "merged", ".", "from", ",", "merged", ".", "to", ",", "labeled", "[", "ids", "(", "targets", ")", "]", "||", "explore", "(", "targets", ")", ")", ";", "}", "return", "newState", ";", "}", "}", "closure", "(", ")", "{", "let", "result", "=", "[", "]", ",", "seen", "=", "Object", ".", "create", "(", "null", ")", ";", "function", "explore", "(", "state", ")", "{", "if", "(", "seen", "[", "state", ".", "id", "]", ")", "return", ";", "seen", "[", "state", ".", "id", "]", "=", "true", ";", "if", "(", "state", ".", "edges", ".", "some", "(", "e", "=>", "e", ".", "from", ">=", "0", ")", "||", "(", "state", ".", "accepting", ".", "length", ">", "0", "&&", "!", "state", ".", "edges", ".", "some", "(", "e", "=>", "sameSet", "(", "state", ".", "accepting", ",", "e", ".", "target", ".", "accepting", ")", ")", ")", ")", "result", ".", "push", "(", "state", ")", ";", "for", "(", "let", "edge", "of", "state", ".", "edges", ")", "if", "(", "edge", ".", "from", "<", "0", ")", "explore", "(", "edge", ".", "target", ")", ";", "}", "explore", "(", "this", ")", ";", "return", "result", ";", "}", "findConflicts", "(", "occurTogether", ")", "{", "let", "conflicts", "=", "[", "]", ",", "cycleTerms", "=", "this", ".", "cycleTerms", "(", ")", ";", "function", "add", "(", "a", ",", "b", ",", "soft", ",", "aEdges", ",", "bEdges", "?", ")", "{", "if", "(", "a", ".", "id", "<", "b", ".", "id", ")", "{", "[", "a", ",", "b", "]", "=", "[", "b", ",", "a", "]", ";", "soft", "=", "-", "soft", ";", "}", "let", "found", "=", "conflicts", ".", "find", "(", "c", "=>", "c", ".", "a", "==", "a", "&&", "c", ".", "b", "==", "b", ")", ";", "if", "(", "!", "found", ")", "conflicts", ".", "push", "(", "new", "Conflict", "(", "a", ",", "b", ",", "soft", ",", "exampleFromEdges", "(", "aEdges", ")", ",", "bEdges", "&&", "exampleFromEdges", "(", "bEdges", ")", ")", ")", ";", "else", "if", "(", "found", ".", "soft", "!=", "soft", ")", "found", ".", "soft", "=", "0", ";", "}", "this", ".", "reachable", "(", "(", "state", ",", "edges", ")", "=>", "{", "if", "(", "state", ".", "accepting", ".", "length", "==", "0", ")", "return", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "accepting", ".", "length", ";", "i", "++", ")", "for", "(", "let", "j", "=", "i", "+", "1", ";", "j", "<", "state", ".", "accepting", ".", "length", ";", "j", "++", ")", "add", "(", "state", ".", "accepting", "[", "i", "]", ",", "state", ".", "accepting", "[", "j", "]", ",", "0", ",", "edges", ")", ";", "state", ".", "reachable", "(", "(", "s", ",", "es", ")", "=>", "{", "if", "(", "s", "!=", "state", ")", "for", "(", "let", "term", "of", "s", ".", "accepting", ")", "{", "let", "hasCycle", "=", "cycleTerms", ".", "includes", "(", "term", ")", ";", "for", "(", "let", "orig", "of", "state", ".", "accepting", ")", "if", "(", "term", "!=", "orig", ")", "add", "(", "term", ",", "orig", ",", "hasCycle", "||", "cycleTerms", ".", "includes", "(", "orig", ")", "||", "!", "occurTogether", "(", "term", ",", "orig", ")", "?", "0", ":", "1", ",", "edges", ",", "edges", ".", "concat", "(", "es", ")", ")", ";", "}", "}", ")", ";", "}", ")", ";", "return", "conflicts", ";", "}", "cycleTerms", "(", ")", "{", "let", "work", "=", "[", "]", ";", "this", ".", "reachable", "(", "state", "=>", "{", "for", "(", "let", "{", "target", "}", "of", "state", ".", "edges", ")", "work", ".", "push", "(", "state", ",", "target", ")", ";", "}", ")", ";", "let", "table", "=", "new", "Map", ";", "let", "haveCycle", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "work", ".", "length", ";", ")", "{", "let", "from", "=", "work", "[", "i", "++", "]", ",", "to", "=", "work", "[", "i", "++", "]", ";", "let", "entry", "=", "table", ".", "get", "(", "from", ")", ";", "if", "(", "!", "entry", ")", "table", ".", "set", "(", "from", ",", "entry", "=", "[", "]", ")", ";", "if", "(", "entry", ".", "includes", "(", "to", ")", ")", "continue", ";", "if", "(", "from", "==", "to", ")", "{", "if", "(", "!", "haveCycle", ".", "includes", "(", "from", ")", ")", "haveCycle", ".", "push", "(", "from", ")", ";", "}", "else", "{", "for", "(", "let", "next", "of", "entry", ")", "work", ".", "push", "(", "from", ",", "next", ")", ";", "entry", ".", "push", "(", "to", ")", ";", "}", "}", "let", "result", "=", "[", "]", ";", "for", "(", "let", "state", "of", "haveCycle", ")", "{", "for", "(", "let", "term", "of", "state", ".", "accepting", ")", "{", "if", "(", "!", "result", ".", "includes", "(", "term", ")", ")", "result", ".", "push", "(", "term", ")", ";", "}", "}", "return", "result", ";", "}", "reachable", "(", "f", ")", "{", "let", "seen", "=", "[", "]", ",", "edges", "=", "[", "]", ";", "(", "function", "explore", "(", "s", ")", "{", "f", "(", "s", ",", "edges", ")", ";", "seen", ".", "push", "(", "s", ")", ";", "for", "(", "let", "edge", "of", "s", ".", "edges", ")", "if", "(", "!", "seen", ".", "includes", "(", "edge", ".", "target", ")", ")", "{", "edges", ".", "push", "(", "edge", ")", ";", "explore", "(", "edge", ".", "target", ")", ";", "edges", ".", "pop", "(", ")", ";", "}", "}", ")", "(", "this", ")", ";", "}", "toString", "(", ")", "{", "let", "out", "=", "\"digraph {\\n\"", ";", "this", ".", "reachable", "(", "state", "=>", "{", "if", "(", "state", ".", "accepting", ".", "length", ")", "out", "+=", "` ${", "state", ".", "id", "} [label=${", "JSON", ".", "stringify", "(", "state", ".", "accepting", ".", "join", "(", ")", ")", "}];\\n`", ";", "for", "(", "let", "edge", "of", "state", ".", "edges", ")", "out", "+=", "` ${", "state", ".", "id", "} ${", "edge", "};\\n`", ";", "}", ")", ";", "return", "out", "+", "\"}\"", ";", "}", "toArray", "(", "groupMasks", ",", "precedence", ")", "{", "let", "offsets", "=", "[", "]", ";", "let", "data", "=", "[", "]", ";", "this", ".", "reachable", "(", "state", "=>", "{", "let", "start", "=", "data", ".", "length", ";", "let", "acceptEnd", "=", "start", "+", "3", "+", "state", ".", "accepting", ".", "length", "*", "2", ";", "offsets", "[", "state", ".", "id", "]", "=", "start", ";", "data", ".", "push", "(", "state", ".", "stateMask", "(", "groupMasks", ")", ",", "acceptEnd", ",", "state", ".", "edges", ".", "length", ")", ";", "state", ".", "accepting", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "precedence", ".", "indexOf", "(", "a", ".", "id", ")", "-", "precedence", ".", "indexOf", "(", "b", ".", "id", ")", ")", ";", "for", "(", "let", "term", "of", "state", ".", "accepting", ")", "data", ".", "push", "(", "term", ".", "id", ",", "groupMasks", "[", "term", ".", "id", "]", "||", "0xffff", ")", ";", "for", "(", "let", "edge", "of", "state", ".", "edges", ")", "data", ".", "push", "(", "edge", ".", "from", ",", "edge", ".", "to", ",", "-", "edge", ".", "target", ".", "id", "-", "1", ")", ";", "}", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "data", ".", "length", ";", "i", "++", ")", "if", "(", "data", "[", "i", "]", "<", "0", ")", "data", "[", "i", "]", "=", "offsets", "[", "-", "data", "[", "i", "]", "-", "1", "]", ";", "if", "(", "data", ".", "length", ">", "2", "**", "16", ")", "throw", "new", "GenError", "(", "\"Tokenizer tables too big to represent with 16-bit offsets.\"", ")", ";", "return", "Uint16Array", ".", "from", "(", "data", ")", ";", "}", "stateMask", "(", "groupMasks", ")", "{", "let", "mask", "=", "0", ";", "this", ".", "reachable", "(", "state", "=>", "{", "for", "(", "let", "term", "of", "state", ".", "accepting", ")", "mask", "|=", "(", "groupMasks", "[", "term", ".", "id", "]", "||", "0xffff", ")", ";", "}", ")", ";", "return", "mask", ";", "}", "}", "export", "class", "Conflict", "{", "constructor", "(", "readonly", "a", ",", "readonly", "b", ",", "public", "soft", ",", "readonly", "exampleA", ",", "readonly", "exampleB", "?", ")", "{", "}", "}", "function", "exampleFromEdges", "(", "edges", ")", "{", "let", "str", "=", "\"\"", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "edges", ".", "length", ";", "i", "++", ")", "str", "+=", "String", ".", "fromCharCode", "(", "edges", "[", "i", "]", ".", "from", ")", ";", "return", "str", ";", "}", "function", "ids", "(", "elts", ")", "{", "let", "result", "=", "\"\"", ";", "for", "(", "let", "elt", "of", "elts", ")", "{", "if", "(", "result", ".", "length", ")", "result", "+=", "\"-\"", ";", "result", "+=", "elt", ".", "id", ";", "}", "return", "result", ";", "}", "function", "sameSet", "<", "T", ">", "(", "a", ",", "b", ")", "{", "if", "(", "a", ".", "length", "!=", "b", ".", "length", ")", "return", "false", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "a", ".", "length", ";", "i", "++", ")", "if", "(", "a", "[", "i", "]", "!=", "b", "[", "i", "]", ")", "return", "false", ";", "return", "true", ";", "}", "class", "MergedEdge", "{", "constructor", "(", "readonly", "from", ",", "readonly", "to", ",", "readonly", "targets", ")", "{", "}", "}", "function", "mergeEdges", "(", "edges", ")", "{", "let", "separate", "=", "[", "]", ",", "result", "=", "[", "]", ";", "for", "(", "let", "edge", "of", "edges", ")", "{", "if", "(", "!", "separate", ".", "includes", "(", "edge", ".", "from", ")", ")", "separate", ".", "push", "(", "edge", ".", "from", ")", ";", "if", "(", "!", "separate", ".", "includes", "(", "edge", ".", "to", ")", ")", "separate", ".", "push", "(", "edge", ".", "to", ")", ";", "}", "separate", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", "-", "b", ")", ";", "for", "(", "let", "i", "=", "1", ";", "i", "<", "separate", ".", "length", ";", "i", "++", ")", "{", "let", "from", "=", "separate", "[", "i", "-", "1", "]", ",", "to", "=", "separate", "[", "i", "]", ";", "let", "found", "=", "[", "]", ";", "for", "(", "let", "edge", "of", "edges", ")", "if", "(", "edge", ".", "to", ">", "from", "&&", "edge", ".", "from", "<", "to", ")", "{", "for", "(", "let", "target", "of", "edge", ".", "target", ".", "closure", "(", ")", ")", "if", "(", "!", "found", ".", "includes", "(", "target", ")", ")", "found", ".", "push", "(", "target", ")", ";", "}", "if", "(", "found", ".", "length", ")", "result", ".", "push", "(", "new", "MergedEdge", "(", "from", ",", "to", ",", "found", ")", ")", ";", "}", "return", "result", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, 3, null, null, 38, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, 5, null, 38, null, null, null, 9382, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, 9382, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 38, null, 38, null, 9382, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, 38, null, 9382, null, null, null, null, null, 38, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, 4, null, 3, null, 3, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, 6, null, null, null, null, null, null, null, null, 3, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, 5, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 38, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 4, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 8, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, 4, null, 229, null, 229, null, 3, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8714, null, null, null, null, null, 8714, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 701, null, 6, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 38, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 6, null, null, null, 3, null, null, null, null, null, null, null, 38, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, 229, null, null, 3, null, null, 2, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 5, null, null, null, 2, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, 3, null, null, 5, null, null, null, null, null, 5, null, 5, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 655, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
6
[ "import", "{", "GrammarDeclaration", ",", "RuleDeclaration", ",", "PrecDeclaration", ",", "TokenPrecDeclaration", ",", "TokenConflictDeclaration", ",", "TokenDeclaration", ",", "LiteralDeclaration", ",", "ContextDeclaration", ",", "ExternalTokenDeclaration", ",", "ExternalSpecializeDeclaration", ",", "ExternalPropDeclaration", ",", "Identifier", ",", "Expression", ",", "NameExpression", ",", "ChoiceExpression", ",", "SequenceExpression", ",", "LiteralExpression", ",", "RepeatExpression", ",", "SetExpression", ",", "InlineRuleExpression", ",", "Prop", ",", "PropPart", ",", "SpecializeExpression", ",", "AnyExpression", ",", "ConflictMarker", "}", "from", "\"./node\"", ";", "import", "{", "GenError", "}", "from", "\"./error\"", ";", "let", "word", "=", "/[\\w_-]+/gy", ";", "try", "{", "word", "=", "/[\\p{Alphabetic}\\d_-]+/ugy", ";", "}", "catch", "(", "_", ")", "{", "}", "const", "none", "=", "[", "]", ";", "export", "class", "Input", "{", "type", "=", "\"sof\"", ";", "value", ":", "any", "=", "null", ";", "start", "=", "0", ";", "end", "=", "0", ";", "constructor", "(", "readonly", "string", ",", "readonly", "fileName", "=", "null", ")", "{", "this", ".", "next", "(", ")", ";", "}", "lineInfo", "(", "pos", ")", "{", "for", "(", "let", "line", "=", "1", ",", "cur", "=", "0", ";", ";", ")", "{", "let", "next", "=", "this", ".", "string", ".", "indexOf", "(", "\"\\n\"", ",", "cur", ")", ";", "if", "(", "next", ">", "-", "1", "&&", "next", "<", "pos", ")", "{", "++", "line", ";", "cur", "=", "next", "+", "1", ";", "}", "else", "{", "return", "{", "line", ",", "ch", ":", "pos", "-", "cur", "}", ";", "}", "}", "}", "message", "(", "msg", ",", "pos", "=", "-", "1", ")", "{", "let", "posInfo", "=", "this", ".", "fileName", "||", "\"\"", ";", "if", "(", "pos", ">", "-", "1", ")", "{", "let", "info", "=", "this", ".", "lineInfo", "(", "pos", ")", ";", "posInfo", "+=", "(", "posInfo", "?", "\" \"", ":", "\"\"", ")", "+", "info", ".", "line", "+", "\":\"", "+", "info", ".", "ch", ";", "}", "return", "posInfo", "?", "msg", "+", "` (${", "posInfo", "})`", ":", "msg", ";", "}", "raise", "(", "msg", ",", "pos", "=", "-", "1", ")", "{", "throw", "new", "GenError", "(", "this", ".", "message", "(", "msg", ",", "pos", ")", ")", ";", "}", "match", "(", "pos", ",", "re", ")", "{", "let", "match", "=", "re", ".", "exec", "(", "this", ".", "string", ".", "slice", "(", "pos", ")", ")", ";", "return", "match", "?", "pos", "+", "match", "[", "0", "]", ".", "length", ":", "-", "1", ";", "}", "next", "(", ")", "{", "let", "start", "=", "this", ".", "match", "(", "this", ".", "end", ",", "/^(\\s|\\/\\/.*|\\/\\*[^]*?\\*\\/)*/", ")", ";", "if", "(", "start", "==", "this", ".", "string", ".", "length", ")", "return", "this", ".", "set", "(", "\"eof\"", ",", "null", ",", "start", ",", "start", ")", ";", "let", "next", "=", "this", ".", "string", "[", "start", "]", ";", "if", "(", "next", "==", "'\"'", ")", "{", "let", "end", "=", "this", ".", "match", "(", "start", "+", "1", ",", "/^(\\\\.|[^\"])*\"/", ")", ";", "if", "(", "end", "==", "-", "1", ")", "this", ".", "raise", "(", "\"Unterminated string literal\"", ",", "start", ")", ";", "return", "this", ".", "set", "(", "\"string\"", ",", "readString", "(", "this", ".", "string", ".", "slice", "(", "start", "+", "1", ",", "end", "-", "1", ")", ")", ",", "start", ",", "end", ")", ";", "}", "else", "if", "(", "next", "==", "\"'\"", ")", "{", "let", "end", "=", "this", ".", "match", "(", "start", "+", "1", ",", "/^(\\\\.|[^'])*'/", ")", ";", "if", "(", "end", "==", "-", "1", ")", "this", ".", "raise", "(", "\"Unterminated string literal\"", ",", "start", ")", ";", "return", "this", ".", "set", "(", "\"string\"", ",", "readString", "(", "this", ".", "string", ".", "slice", "(", "start", "+", "1", ",", "end", "-", "1", ")", ")", ",", "start", ",", "end", ")", ";", "}", "else", "if", "(", "next", "==", "\"@\"", ")", "{", "word", ".", "lastIndex", "=", "start", "+", "1", ";", "let", "m", "=", "word", ".", "exec", "(", "this", ".", "string", ")", ";", "if", "(", "!", "m", ")", "return", "this", ".", "raise", "(", "\"@ without a name\"", ",", "start", ")", ";", "return", "this", ".", "set", "(", "\"at\"", ",", "m", "[", "0", "]", ",", "start", ",", "start", "+", "1", "+", "m", "[", "0", "]", ".", "length", ")", ";", "}", "else", "if", "(", "(", "next", "==", "\"$\"", "||", "next", "==", "\"!\"", ")", "&&", "this", ".", "string", "[", "start", "+", "1", "]", "==", "\"[\"", ")", "{", "let", "end", "=", "this", ".", "match", "(", "start", "+", "2", ",", "/^(?:\\\\.|[^\\]])*\\]/", ")", ";", "if", "(", "end", "==", "-", "1", ")", "this", ".", "raise", "(", "\"Unterminated character set\"", ",", "start", ")", ";", "return", "this", ".", "set", "(", "\"set\"", ",", "this", ".", "string", ".", "slice", "(", "start", "+", "2", ",", "end", "-", "1", ")", ",", "start", ",", "end", ")", ";", "}", "else", "if", "(", "/[\\[\\]()!~+*?{}<>\\.,|:$=]/", ".", "test", "(", "next", ")", ")", "{", "return", "this", ".", "set", "(", "next", ",", "null", ",", "start", ",", "start", "+", "1", ")", ";", "}", "else", "{", "word", ".", "lastIndex", "=", "start", ";", "let", "m", "=", "word", ".", "exec", "(", "this", ".", "string", ")", ";", "if", "(", "!", "m", ")", "return", "this", ".", "raise", "(", "\"Unexpected character \"", "+", "JSON", ".", "stringify", "(", "next", ")", ",", "start", ")", ";", "return", "this", ".", "set", "(", "\"id\"", ",", "m", "[", "0", "]", ",", "start", ",", "start", "+", "m", "[", "0", "]", ".", "length", ")", ";", "}", "}", "set", "(", "type", ",", "value", ",", "start", ",", "end", ")", "{", "this", ".", "type", "=", "type", ";", "this", ".", "value", "=", "value", ";", "this", ".", "start", "=", "start", ";", "this", ".", "end", "=", "end", ";", "}", "eat", "(", "type", ",", "value", "=", "null", ")", "{", "if", "(", "this", ".", "type", "==", "type", "&&", "(", "value", "==", "null", "||", "this", ".", "value", "===", "value", ")", ")", "{", "this", ".", "next", "(", ")", ";", "return", "true", ";", "}", "else", "{", "return", "false", ";", "}", "}", "unexpected", "(", ")", "{", "return", "this", ".", "raise", "(", "`Unexpected token '${", "this", ".", "string", ".", "slice", "(", "this", ".", "start", ",", "this", ".", "end", ")", "}'`", ",", "this", ".", "start", ")", ";", "}", "expect", "(", "type", ",", "value", "=", "null", ")", "{", "let", "val", "=", "this", ".", "value", ";", "if", "(", "this", ".", "type", "!=", "type", "||", "!", "(", "value", "==", "null", "||", "val", "===", "value", ")", ")", "this", ".", "unexpected", "(", ")", ";", "this", ".", "next", "(", ")", ";", "return", "val", ";", "}", "parse", "(", ")", "{", "return", "parseGrammar", "(", "this", ")", ";", "}", "}", "function", "parseGrammar", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "let", "rules", "=", "[", "]", ";", "let", "prec", "=", "null", ";", "let", "tokens", "=", "null", ";", "let", "mainSkip", "=", "null", ";", "let", "scopedSkip", "=", "[", "]", ";", "let", "dialects", "=", "[", "]", ";", "let", "context", "=", "null", ";", "let", "external", "=", "[", "]", ";", "let", "specialized", "=", "[", "]", ";", "let", "props", "=", "[", "]", ";", "let", "tops", "=", "[", "]", ";", "let", "sawTop", "=", "false", ";", "let", "autoDelim", "=", "false", ";", "while", "(", "input", ".", "type", "!=", "\"eof\"", ")", "{", "let", "start", "=", "input", ".", "start", ";", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"top\"", ")", ")", "{", "if", "(", "input", ".", "type", "as", "any", "!=", "\"id\"", ")", "input", ".", "raise", "(", "`Top rules must have a name`", ",", "input", ".", "start", ")", ";", "tops", ".", "push", "(", "parseRule", "(", "input", ",", "parseIdent", "(", "input", ")", ")", ")", ";", "sawTop", "=", "true", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"at\"", "&&", "input", ".", "value", "==", "\"tokens\"", ")", "{", "if", "(", "tokens", ")", "input", ".", "raise", "(", "`Multiple @tokens declaractions`", ",", "input", ".", "start", ")", ";", "else", "tokens", "=", "parseTokens", "(", "input", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"context\"", ")", ")", "{", "if", "(", "context", ")", "input", ".", "raise", "(", "`Multiple @context declarations`", ",", "start", ")", ";", "let", "id", "=", "parseIdent", "(", "input", ")", ";", "input", ".", "expect", "(", "\"id\"", ",", "\"from\"", ")", ";", "let", "source", "=", "input", ".", "expect", "(", "\"string\"", ")", ";", "context", "=", "new", "ContextDeclaration", "(", "start", ",", "id", ",", "source", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"external\"", ")", ")", "{", "if", "(", "input", ".", "eat", "(", "\"id\"", ",", "\"tokens\"", ")", ")", "external", ".", "push", "(", "parseExternalTokens", "(", "input", ",", "start", ")", ")", ";", "else", "if", "(", "input", ".", "eat", "(", "\"id\"", ",", "\"prop\"", ")", ")", "props", ".", "push", "(", "parseExternalProp", "(", "input", ",", "start", ")", ")", ";", "else", "if", "(", "input", ".", "eat", "(", "\"id\"", ",", "\"extend\"", ")", ")", "specialized", ".", "push", "(", "parseExternalSpecialize", "(", "input", ",", "\"extend\"", ",", "start", ")", ")", ";", "else", "if", "(", "input", ".", "eat", "(", "\"id\"", ",", "\"specialize\"", ")", ")", "specialized", ".", "push", "(", "parseExternalSpecialize", "(", "input", ",", "\"specialize\"", ",", "start", ")", ")", ";", "else", "input", ".", "unexpected", "(", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"dialects\"", ")", ")", "{", "input", ".", "expect", "(", "\"{\"", ")", ";", "for", "(", "let", "first", "=", "true", ";", "!", "input", ".", "eat", "(", "\"}\"", ")", ";", "first", "=", "false", ")", "{", "if", "(", "!", "first", ")", "input", ".", "eat", "(", "\",\"", ")", ";", "dialects", ".", "push", "(", "parseIdent", "(", "input", ")", ")", ";", "}", "}", "else", "if", "(", "input", ".", "type", "==", "\"at\"", "&&", "input", ".", "value", "==", "\"precedence\"", ")", "{", "if", "(", "prec", ")", "input", ".", "raise", "(", "`Multiple precedence declarations`", ",", "input", ".", "start", ")", ";", "prec", "=", "parsePrecedence", "(", "input", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"detectDelim\"", ")", ")", "{", "autoDelim", "=", "true", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"skip\"", ")", ")", "{", "let", "skip", "=", "parseBracedExpr", "(", "input", ")", ";", "if", "(", "input", ".", "type", "==", "\"{\"", ")", "{", "input", ".", "next", "(", ")", ";", "let", "rules", "=", "[", "]", ",", "topRules", "=", "[", "]", ";", "while", "(", "!", "input", ".", "eat", "(", "\"}\"", ")", ")", "{", "if", "(", "input", ".", "eat", "(", "\"at\"", ",", "\"top\"", ")", ")", "{", "topRules", ".", "push", "(", "parseRule", "(", "input", ",", "parseIdent", "(", "input", ")", ")", ")", ";", "sawTop", "=", "true", ";", "}", "else", "{", "rules", ".", "push", "(", "parseRule", "(", "input", ")", ")", ";", "}", "}", "scopedSkip", ".", "push", "(", "{", "expr", ":", "skip", ",", "topRules", ",", "rules", "}", ")", ";", "}", "else", "{", "if", "(", "mainSkip", ")", "input", ".", "raise", "(", "`Multiple top-level skip declarations`", ",", "input", ".", "start", ")", ";", "mainSkip", "=", "skip", ";", "}", "}", "else", "{", "rules", ".", "push", "(", "parseRule", "(", "input", ")", ")", ";", "}", "}", "if", "(", "!", "sawTop", ")", "return", "input", ".", "raise", "(", "`Missing @top declaration`", ")", ";", "return", "new", "GrammarDeclaration", "(", "start", ",", "rules", ",", "tops", ",", "tokens", ",", "context", ",", "external", ",", "specialized", ",", "prec", ",", "mainSkip", ",", "scopedSkip", ",", "dialects", ",", "props", ",", "autoDelim", ")", ";", "}", "function", "parseRule", "(", "input", ",", "named", "?", ")", "{", "let", "start", "=", "named", "?", "named", ".", "start", ":", "input", ".", "start", ";", "let", "id", "=", "named", "||", "parseIdent", "(", "input", ")", ";", "let", "props", "=", "parseProps", "(", "input", ")", ";", "let", "params", "=", "[", "]", ";", "if", "(", "input", ".", "eat", "(", "\"<\"", ")", ")", "while", "(", "!", "input", ".", "eat", "(", "\">\"", ")", ")", "{", "if", "(", "params", ".", "length", ")", "input", ".", "expect", "(", "\",\"", ")", ";", "params", ".", "push", "(", "parseIdent", "(", "input", ")", ")", ";", "}", "let", "expr", "=", "parseBracedExpr", "(", "input", ")", ";", "return", "new", "RuleDeclaration", "(", "start", ",", "id", ",", "props", ",", "params", ",", "expr", ")", ";", "}", "function", "parseProps", "(", "input", ")", "{", "if", "(", "input", ".", "type", "!=", "\"[\"", ")", "return", "none", ";", "let", "props", "=", "[", "]", ";", "input", ".", "expect", "(", "\"[\"", ")", ";", "while", "(", "!", "input", ".", "eat", "(", "\"]\"", ")", ")", "{", "if", "(", "props", ".", "length", ")", "input", ".", "expect", "(", "\",\"", ")", ";", "props", ".", "push", "(", "parseProp", "(", "input", ")", ")", ";", "}", "return", "props", ";", "}", "function", "parseProp", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ",", "value", "=", "[", "]", ",", "name", "=", "input", ".", "value", ",", "at", "=", "input", ".", "type", "==", "\"at\"", ";", "if", "(", "!", "input", ".", "eat", "(", "\"at\"", ")", "&&", "!", "input", ".", "eat", "(", "\"id\"", ")", ")", "input", ".", "unexpected", "(", ")", ";", "if", "(", "input", ".", "eat", "(", "\"=\"", ")", ")", "for", "(", ";", ";", ")", "{", "if", "(", "input", ".", "type", "==", "\"string\"", "||", "input", ".", "type", "==", "\"id\"", ")", "{", "value", ".", "push", "(", "new", "PropPart", "(", "input", ".", "start", ",", "input", ".", "value", ",", "null", ")", ")", ";", "input", ".", "next", "(", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\".\"", ")", ")", "{", "value", ".", "push", "(", "new", "PropPart", "(", "input", ".", "start", ",", "\".\"", ",", "null", ")", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"{\"", ")", ")", "{", "value", ".", "push", "(", "new", "PropPart", "(", "input", ".", "start", ",", "null", ",", "input", ".", "expect", "(", "\"id\"", ")", ")", ")", ";", "input", ".", "expect", "(", "\"}\"", ")", ";", "}", "else", "{", "break", ";", "}", "}", "return", "new", "Prop", "(", "start", ",", "at", ",", "name", ",", "value", ")", ";", "}", "function", "parseBracedExpr", "(", "input", ")", "{", "input", ".", "expect", "(", "\"{\"", ")", ";", "let", "expr", "=", "parseExprChoice", "(", "input", ")", ";", "input", ".", "expect", "(", "\"}\"", ")", ";", "return", "expr", ";", "}", "const", "SET_MARKER", "=", "\"\\ufdda\"", ";", "function", "parseExprInner", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "if", "(", "input", ".", "eat", "(", "\"(\"", ")", ")", "{", "let", "expr", "=", "parseExprChoice", "(", "input", ")", ";", "input", ".", "expect", "(", "\")\"", ")", ";", "return", "expr", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"string\"", ")", "{", "let", "value", "=", "input", ".", "value", ";", "input", ".", "next", "(", ")", ";", "if", "(", "value", ".", "length", "==", "0", ")", "return", "new", "SequenceExpression", "(", "start", ",", "none", ",", "[", "none", ",", "none", "]", ")", ";", "return", "new", "LiteralExpression", "(", "start", ",", "value", ")", ";", "}", "else", "if", "(", "input", ".", "eat", "(", "\"id\"", ",", "\"_\"", ")", ")", "{", "return", "new", "AnyExpression", "(", "start", ")", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"set\"", ")", "{", "let", "content", "=", "input", ".", "value", ",", "invert", "=", "input", ".", "string", "[", "input", ".", "start", "]", "==", "\"!\"", ";", "let", "unescaped", "=", "readString", "(", "content", ".", "replace", "(", "/\\\\.|-|\"/g", ",", "(", "m", ")", "=>", "{", "return", "m", "==", "\"-\"", "?", "SET_MARKER", ":", "m", "==", "'\"'", "?", "'\\\\\"'", ":", "m", ";", "}", ")", ")", ";", "let", "ranges", "=", "[", "]", ";", "for", "(", "let", "pos", "=", "0", ";", "pos", "<", "unescaped", ".", "length", ";", ")", "{", "let", "code", "=", "unescaped", ".", "codePointAt", "(", "pos", ")", "!", ";", "pos", "+=", "code", ">", "0xffff", "?", "2", ":", "1", ";", "if", "(", "pos", "<", "unescaped", ".", "length", "-", "1", "&&", "unescaped", "[", "pos", "]", "==", "SET_MARKER", ")", "{", "let", "end", "=", "unescaped", ".", "codePointAt", "(", "pos", "+", "1", ")", "!", ";", "pos", "+=", "end", ">", "0xffff", "?", "3", ":", "2", ";", "if", "(", "end", "<", "code", ")", "input", ".", "raise", "(", "\"Invalid character range\"", ",", "input", ".", "start", ")", ";", "addRange", "(", "input", ",", "ranges", ",", "code", ",", "end", "+", "1", ")", ";", "}", "else", "{", "if", "(", "code", "==", "SET_MARKER", ".", "charCodeAt", "(", "0", ")", ")", "code", "=", "45", ";", "addRange", "(", "input", ",", "ranges", ",", "code", ",", "code", "+", "1", ")", ";", "}", "}", "input", ".", "next", "(", ")", ";", "return", "new", "SetExpression", "(", "start", ",", "ranges", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", "[", "0", "]", "-", "b", "[", "0", "]", ")", ",", "invert", ")", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"at\"", "&&", "(", "input", ".", "value", "==", "\"specialize\"", "||", "input", ".", "value", "==", "\"extend\"", ")", ")", "{", "let", "{", "start", ",", "value", "}", "=", "input", ";", "input", ".", "next", "(", ")", ";", "let", "props", "=", "parseProps", "(", "input", ")", ";", "input", ".", "expect", "(", "\"<\"", ")", ";", "let", "token", "=", "parseExprChoice", "(", "input", ")", ",", "content", ";", "if", "(", "input", ".", "eat", "(", "\",\"", ")", ")", "{", "content", "=", "parseExprChoice", "(", "input", ")", ";", "}", "else", "if", "(", "token", "instanceof", "LiteralExpression", ")", "{", "content", "=", "token", ";", "}", "else", "{", "input", ".", "raise", "(", "`@${", "value", "} requires two arguments when its first argument isn't a literal string`", ")", ";", "}", "input", ".", "expect", "(", "\">\"", ")", ";", "return", "new", "SpecializeExpression", "(", "start", ",", "value", ",", "props", ",", "token", ",", "content", ")", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"[\"", ")", "{", "let", "rule", "=", "parseRule", "(", "input", ",", "new", "Identifier", "(", "start", ",", "\"_anon\"", ")", ")", ";", "if", "(", "rule", ".", "params", ".", "length", ")", "input", ".", "raise", "(", "`Inline rules can't have parameters`", ",", "rule", ".", "start", ")", ";", "return", "new", "InlineRuleExpression", "(", "start", ",", "rule", ")", ";", "}", "else", "{", "let", "id", "=", "parseIdent", "(", "input", ")", ";", "if", "(", "input", ".", "type", "==", "\"[\"", "||", "input", ".", "type", "==", "\"{\"", ")", "{", "let", "rule", "=", "parseRule", "(", "input", ",", "id", ")", ";", "if", "(", "rule", ".", "params", ".", "length", ")", "input", ".", "raise", "(", "`Inline rules can't have parameters`", ",", "rule", ".", "start", ")", ";", "return", "new", "InlineRuleExpression", "(", "start", ",", "rule", ")", ";", "}", "else", "{", "let", "namespace", "=", "null", ";", "if", "(", "input", ".", "eat", "(", "\".\"", ")", ")", "{", "namespace", "=", "id", ";", "id", "=", "parseIdent", "(", "input", ")", ";", "}", "return", "new", "NameExpression", "(", "start", ",", "namespace", ",", "id", ",", "parseArgs", "(", "input", ")", ")", ";", "}", "}", "}", "function", "parseArgs", "(", "input", ")", "{", "let", "args", "=", "[", "]", ";", "if", "(", "input", ".", "eat", "(", "\"<\"", ")", ")", "while", "(", "!", "input", ".", "eat", "(", "\">\"", ")", ")", "{", "if", "(", "args", ".", "length", ")", "input", ".", "expect", "(", "\",\"", ")", ";", "args", ".", "push", "(", "parseExprChoice", "(", "input", ")", ")", ";", "}", "return", "args", ";", "}", "function", "addRange", "(", "input", ",", "ranges", ",", "from", ",", "to", ")", "{", "if", "(", "!", "ranges", ".", "every", "(", "(", "[", "a", ",", "b", "]", ")", "=>", "b", "<=", "from", "||", "a", ">=", "to", ")", ")", "input", ".", "raise", "(", "\"Overlapping character range\"", ",", "input", ".", "start", ")", ";", "ranges", ".", "push", "(", "[", "from", ",", "to", "]", ")", ";", "}", "function", "parseExprSuffix", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "let", "expr", "=", "parseExprInner", "(", "input", ")", ";", "for", "(", ";", ";", ")", "{", "let", "kind", "=", "input", ".", "type", ";", "if", "(", "input", ".", "eat", "(", "\"*\"", ")", "||", "input", ".", "eat", "(", "\"?\"", ")", "||", "input", ".", "eat", "(", "\"+\"", ")", ")", "expr", "=", "new", "RepeatExpression", "(", "start", ",", "expr", ",", "kind", "as", "\"*\"", "|", "\"+\"", "|", "\"?\"", ")", ";", "else", "return", "expr", ";", "}", "}", "function", "endOfSequence", "(", "input", ")", "{", "return", "input", ".", "type", "==", "\"}\"", "||", "input", ".", "type", "==", "\")\"", "||", "input", ".", "type", "==", "\"|\"", "||", "input", ".", "type", "==", "\"/\"", "||", "input", ".", "type", "==", "\"/\\\\\"", "||", "input", ".", "type", "==", "\"{\"", "||", "input", ".", "type", "==", "\",\"", "||", "input", ".", "type", "==", "\">\"", ";", "}", "function", "parseExprSequence", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ",", "exprs", "=", "[", "]", ",", "markers", "=", "[", "none", "]", ";", "do", "{", "for", "(", ";", ";", ")", "{", "let", "localStart", "=", "input", ".", "start", ",", "markerType", "!", ";", "if", "(", "input", ".", "eat", "(", "\"~\"", ")", ")", "markerType", "=", "\"ambig\"", ";", "else", "if", "(", "input", ".", "eat", "(", "\"!\"", ")", ")", "markerType", "=", "\"prec\"", ";", "else", "break", ";", "markers", "[", "markers", ".", "length", "-", "1", "]", "=", "markers", "[", "markers", ".", "length", "-", "1", "]", ".", "concat", "(", "new", "ConflictMarker", "(", "localStart", ",", "parseIdent", "(", "input", ")", ",", "markerType", ")", ")", ";", "}", "if", "(", "endOfSequence", "(", "input", ")", ")", "break", ";", "exprs", ".", "push", "(", "parseExprSuffix", "(", "input", ")", ")", ";", "markers", ".", "push", "(", "none", ")", ";", "}", "while", "(", "!", "endOfSequence", "(", "input", ")", ")", ";", "if", "(", "exprs", ".", "length", "==", "1", "&&", "markers", ".", "every", "(", "ms", "=>", "ms", ".", "length", "==", "0", ")", ")", "return", "exprs", "[", "0", "]", ";", "return", "new", "SequenceExpression", "(", "start", ",", "exprs", ",", "markers", ",", "!", "exprs", ".", "length", ")", ";", "}", "function", "parseExprChoice", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ",", "left", "=", "parseExprSequence", "(", "input", ")", ";", "if", "(", "!", "input", ".", "eat", "(", "\"|\"", ")", ")", "return", "left", ";", "let", "exprs", "=", "[", "left", "]", ";", "do", "{", "exprs", ".", "push", "(", "parseExprSequence", "(", "input", ")", ")", ";", "}", "while", "(", "input", ".", "eat", "(", "\"|\"", ")", ")", ";", "let", "empty", "=", "exprs", ".", "find", "(", "s", "=>", "s", "instanceof", "SequenceExpression", "&&", "s", ".", "empty", ")", ";", "if", "(", "empty", ")", "input", ".", "raise", "(", "\"Empty expression in choice operator. If this is intentional, use () to make it explicit.\"", ",", "empty", ".", "start", ")", ";", "return", "new", "ChoiceExpression", "(", "start", ",", "exprs", ")", ";", "}", "function", "parseIdent", "(", "input", ")", "{", "if", "(", "input", ".", "type", "!=", "\"id\"", ")", "input", ".", "unexpected", "(", ")", ";", "let", "start", "=", "input", ".", "start", ",", "name", "=", "input", ".", "value", ";", "input", ".", "next", "(", ")", ";", "return", "new", "Identifier", "(", "start", ",", "name", ")", ";", "}", "function", "parsePrecedence", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "input", ".", "next", "(", ")", ";", "input", ".", "expect", "(", "\"{\"", ")", ";", "let", "items", "=", "[", "]", ";", "while", "(", "!", "input", ".", "eat", "(", "\"}\"", ")", ")", "{", "if", "(", "items", ".", "length", ")", "input", ".", "eat", "(", "\",\"", ")", ";", "items", ".", "push", "(", "{", "id", ":", "parseIdent", "(", "input", ")", ",", "type", ":", "input", ".", "eat", "(", "\"at\"", ",", "\"left\"", ")", "?", "\"left\"", ":", "input", ".", "eat", "(", "\"at\"", ",", "\"right\"", ")", "?", "\"right\"", ":", "input", ".", "eat", "(", "\"at\"", ",", "\"cut\"", ")", "?", "\"cut\"", ":", "null", "}", ")", ";", "}", "return", "new", "PrecDeclaration", "(", "start", ",", "items", ")", ";", "}", "function", "parseTokens", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "input", ".", "next", "(", ")", ";", "input", ".", "expect", "(", "\"{\"", ")", ";", "let", "tokenRules", "=", "[", "]", ";", "let", "literals", "=", "[", "]", ";", "let", "precedences", "=", "[", "]", ";", "let", "conflicts", "=", "[", "]", ";", "while", "(", "!", "input", ".", "eat", "(", "\"}\"", ")", ")", "{", "if", "(", "input", ".", "type", "==", "\"at\"", "&&", "input", ".", "value", "==", "\"precedence\"", ")", "{", "precedences", ".", "push", "(", "parseTokenPrecedence", "(", "input", ")", ")", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"at\"", "&&", "input", ".", "value", "==", "\"conflict\"", ")", "{", "conflicts", ".", "push", "(", "parseTokenConflict", "(", "input", ")", ")", ";", "}", "else", "if", "(", "input", ".", "type", "==", "\"string\"", ")", "{", "literals", ".", "push", "(", "new", "LiteralDeclaration", "(", "input", ".", "start", ",", "input", ".", "expect", "(", "\"string\"", ")", ",", "parseProps", "(", "input", ")", ")", ")", ";", "}", "else", "{", "tokenRules", ".", "push", "(", "parseRule", "(", "input", ")", ")", ";", "}", "}", "return", "new", "TokenDeclaration", "(", "start", ",", "precedences", ",", "conflicts", ",", "tokenRules", ",", "literals", ")", ";", "}", "function", "parseTokenPrecedence", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "input", ".", "next", "(", ")", ";", "input", ".", "expect", "(", "\"{\"", ")", ";", "let", "tokens", "=", "[", "]", ";", "while", "(", "!", "input", ".", "eat", "(", "\"}\"", ")", ")", "{", "if", "(", "tokens", ".", "length", ")", "input", ".", "eat", "(", "\",\"", ")", ";", "let", "expr", "=", "parseExprInner", "(", "input", ")", ";", "if", "(", "expr", "instanceof", "LiteralExpression", "||", "expr", "instanceof", "NameExpression", ")", "tokens", ".", "push", "(", "expr", ")", ";", "else", "input", ".", "raise", "(", "`Invalid expression in token precedences`", ",", "expr", ".", "start", ")", ";", "}", "return", "new", "TokenPrecDeclaration", "(", "start", ",", "tokens", ")", ";", "}", "function", "parseTokenConflict", "(", "input", ")", "{", "let", "start", "=", "input", ".", "start", ";", "input", ".", "next", "(", ")", ";", "input", ".", "expect", "(", "\"{\"", ")", ";", "let", "a", "=", "parseExprInner", "(", "input", ")", ";", "if", "(", "!", "(", "a", "instanceof", "LiteralExpression", "||", "a", "instanceof", "NameExpression", ")", ")", "input", ".", "raise", "(", "`Invalid expression in token conflict`", ",", "a", ".", "start", ")", ";", "input", ".", "eat", "(", "\",\"", ")", ";", "let", "b", "=", "parseExprInner", "(", "input", ")", ";", "if", "(", "!", "(", "b", "instanceof", "LiteralExpression", "||", "b", "instanceof", "NameExpression", ")", ")", "input", ".", "raise", "(", "`Invalid expression in token conflict`", ",", "b", ".", "start", ")", ";", "input", ".", "expect", "(", "\"}\"", ")", ";", "return", "new", "TokenConflictDeclaration", "(", "start", ",", "a", ",", "b", ")", ";", "}", "function", "parseExternalTokenSet", "(", "input", ")", "{", "let", "tokens", "=", "[", "]", ";", "input", ".", "expect", "(", "\"{\"", ")", ";", "while", "(", "!", "input", ".", "eat", "(", "\"}\"", ")", ")", "{", "if", "(", "tokens", ".", "length", ")", "input", ".", "eat", "(", "\",\"", ")", ";", "let", "id", "=", "parseIdent", "(", "input", ")", ";", "let", "props", "=", "parseProps", "(", "input", ")", ";", "tokens", ".", "push", "(", "{", "id", ",", "props", "}", ")", ";", "}", "return", "tokens", ";", "}", "function", "parseExternalTokens", "(", "input", ",", "start", ")", "{", "let", "id", "=", "parseIdent", "(", "input", ")", ";", "input", ".", "expect", "(", "\"id\"", ",", "\"from\"", ")", ";", "let", "from", "=", "input", ".", "expect", "(", "\"string\"", ")", ";", "return", "new", "ExternalTokenDeclaration", "(", "start", ",", "id", ",", "from", ",", "parseExternalTokenSet", "(", "input", ")", ")", ";", "}", "function", "parseExternalSpecialize", "(", "input", ",", "type", ",", "start", ")", "{", "let", "token", "=", "parseBracedExpr", "(", "input", ")", ";", "let", "id", "=", "parseIdent", "(", "input", ")", ";", "input", ".", "expect", "(", "\"id\"", ",", "\"from\"", ")", ";", "let", "from", "=", "input", ".", "expect", "(", "\"string\"", ")", ";", "return", "new", "ExternalSpecializeDeclaration", "(", "start", ",", "type", ",", "token", ",", "id", ",", "from", ",", "parseExternalTokenSet", "(", "input", ")", ")", ";", "}", "function", "parseExternalProp", "(", "input", ",", "start", ")", "{", "let", "externalID", "=", "parseIdent", "(", "input", ")", ";", "let", "id", "=", "input", ".", "eat", "(", "\"id\"", ",", "\"as\"", ")", "?", "parseIdent", "(", "input", ")", ":", "externalID", ";", "input", ".", "expect", "(", "\"id\"", ",", "\"from\"", ")", ";", "let", "from", "=", "input", ".", "expect", "(", "\"string\"", ")", ";", "return", "new", "ExternalPropDeclaration", "(", "start", ",", "id", ",", "externalID", ",", "from", ")", ";", "}", "function", "readString", "(", "string", ")", "{", "let", "point", "=", "/\\\\(?:u\\{([\\da-f]+)\\}|u([\\da-f]{4})|x([\\da-f]{2})|([ntbrf0])|(.))|[^]/yig", ";", "let", "out", "=", "\"\"", ",", "m", ";", "while", "(", "m", "=", "point", ".", "exec", "(", "string", ")", ")", "{", "let", "[", "all", ",", "u1", ",", "u2", ",", "u3", ",", "single", ",", "unknown", "]", "=", "m", ";", "if", "(", "u1", "||", "u2", "||", "u3", ")", "out", "+=", "String", ".", "fromCodePoint", "(", "parseInt", "(", "u1", "||", "u2", "||", "u3", ",", "16", ")", ")", ";", "else", "if", "(", "single", ")", "out", "+=", "single", "==", "\"n\"", "?", "\"\\n\"", ":", "single", "==", "\"t\"", "?", "\"\\t\"", ":", "single", "==", "\"0\"", "?", "\"\\0\"", ":", "single", "==", "\"r\"", "?", "\"\\r\"", ":", "single", "==", "\"f\"", "?", "\"\\f\"", ":", "\"\\b\"", ";", "else", "if", "(", "unknown", ")", "out", "+=", "unknown", ";", "else", "out", "+=", "all", ";", "}", "return", "out", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 27, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 6, null, 3, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 3, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 3, null, 27, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, null, null, 3, null, null, null, null, null, null, 5, null, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, 71, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 0, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 8, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, 312, null, 140, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 312, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4668, null, 312, null, null, null, 3, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 312, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 71, null, 312, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 312, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 312, null, 5, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 312, null, null, null, 3, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 312, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 312, null, null, null, 3, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 312, null, null, null, 3, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, 312, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 312, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, 3, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, 2, null, 3, null, null, null, 71, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 312, null, 3, null, null, null, 140, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, 27, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
7
[ "import", "{", "Encode", "}", "from", "\"@lezer/lr/dist/constants\"", ";", "function", "digitToChar", "(", "digit", ")", "{", "let", "ch", "=", "digit", "+", "Encode", ".", "Start", ";", "if", "(", "ch", ">=", "Encode", ".", "Gap1", ")", "ch", "++", ";", "if", "(", "ch", ">=", "Encode", ".", "Gap2", ")", "ch", "++", ";", "return", "String", ".", "fromCharCode", "(", "ch", ")", ";", "}", "export", "function", "encode", "(", "value", ",", "max", "=", "0xffff", ")", "{", "if", "(", "value", ">", "max", ")", "throw", "new", "Error", "(", "\"Trying to encode a number that's too big: \"", "+", "value", ")", ";", "if", "(", "value", "==", "Encode", ".", "BigVal", ")", "return", "String", ".", "fromCharCode", "(", "Encode", ".", "BigValCode", ")", ";", "let", "result", "=", "\"\"", ";", "for", "(", "let", "first", "=", "Encode", ".", "Base", ";", ";", "first", "=", "0", ")", "{", "let", "low", "=", "value", "%", "Encode", ".", "Base", ",", "rest", "=", "value", "-", "low", ";", "result", "=", "digitToChar", "(", "low", "+", "first", ")", "+", "result", ";", "if", "(", "rest", "==", "0", ")", "break", ";", "value", "=", "rest", "/", "Encode", ".", "Base", ";", "}", "return", "result", ";", "}", "export", "function", "encodeArray", "(", "values", ",", "max", "=", "0xffff", ")", "{", "let", "result", "=", "'\"'", "+", "encode", "(", "values", ".", "length", ",", "0xffffffff", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "values", ".", "length", ";", "i", "++", ")", "result", "+=", "encode", "(", "values", "[", "i", "]", ",", "max", ")", ";", "result", "+=", "'\"'", ";", "return", "result", ";", "}" ]
[ null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
8
[ "import", "{", "GrammarDeclaration", ",", "RuleDeclaration", ",", "TokenDeclaration", ",", "ExternalTokenDeclaration", ",", "ExternalSpecializeDeclaration", ",", "Expression", ",", "Identifier", ",", "LiteralExpression", ",", "NameExpression", ",", "SequenceExpression", ",", "ChoiceExpression", ",", "RepeatExpression", ",", "SetExpression", ",", "AnyExpression", ",", "ConflictMarker", ",", "InlineRuleExpression", ",", "SpecializeExpression", ",", "Prop", ",", "PropPart", ",", "exprsEq", ",", "exprEq", "}", "from", "\"./node\"", ";", "import", "{", "Term", ",", "TermSet", ",", "Rule", ",", "Conflicts", ",", "Props", ",", "hasProps", "}", "from", "\"./grammar\"", ";", "import", "{", "State", ",", "MAX_CHAR", ",", "Conflict", "}", "from", "\"./token\"", ";", "import", "{", "Input", "}", "from", "\"./parse\"", ";", "import", "{", "computeFirstSets", ",", "buildFullAutomaton", ",", "finishAutomaton", ",", "State", "as", "LRState", ",", "Shift", ",", "Reduce", ",", "Pos", "}", "from", "\"./automaton\"", ";", "import", "{", "encodeArray", "}", "from", "\"./encode\"", ";", "import", "{", "GenError", "}", "from", "\"./error\"", ";", "import", "{", "verbose", ",", "time", "}", "from", "\"./log\"", ";", "import", "{", "NodeProp", "}", "from", "\"@lezer/common\"", ";", "import", "{", "LRParser", ",", "ExternalTokenizer", ",", "Stack", ",", "ContextTracker", "}", "from", "\"@lezer/lr\"", ";", "import", "{", "Action", ",", "Specialize", ",", "StateFlag", ",", "Seq", ",", "ParseState", ",", "File", "}", "from", "\"@lezer/lr/dist/constants\"", ";", "const", "none", "=", "[", "]", ";", "class", "Parts", "{", "constructor", "(", "readonly", "terms", ",", "readonly", "conflicts", ")", "{", "}", "concat", "(", "other", ")", "{", "if", "(", "this", "==", "Parts", ".", "none", ")", "return", "other", ";", "if", "(", "other", "==", "Parts", ".", "none", ")", "return", "this", ";", "let", "conflicts", "=", "null", ";", "if", "(", "this", ".", "conflicts", "||", "other", ".", "conflicts", ")", "{", "conflicts", "=", "this", ".", "conflicts", "?", "this", ".", "conflicts", ".", "slice", "(", ")", ":", "this", ".", "ensureConflicts", "(", ")", "as", "Conflicts", "[", "]", ";", "let", "otherConflicts", "=", "other", ".", "ensureConflicts", "(", ")", ";", "conflicts", "[", "conflicts", ".", "length", "-", "1", "]", "=", "conflicts", "[", "conflicts", ".", "length", "-", "1", "]", ".", "join", "(", "otherConflicts", "[", "0", "]", ")", ";", "for", "(", "let", "i", "=", "1", ";", "i", "<", "otherConflicts", ".", "length", ";", "i", "++", ")", "conflicts", ".", "push", "(", "otherConflicts", "[", "i", "]", ")", ";", "}", "return", "new", "Parts", "(", "this", ".", "terms", ".", "concat", "(", "other", ".", "terms", ")", ",", "conflicts", ")", ";", "}", "withConflicts", "(", "pos", ",", "conflicts", ")", "{", "if", "(", "conflicts", "==", "Conflicts", ".", "none", ")", "return", "this", ";", "let", "array", "=", "this", ".", "conflicts", "?", "this", ".", "conflicts", ".", "slice", "(", ")", ":", "this", ".", "ensureConflicts", "(", ")", "as", "Conflicts", "[", "]", ";", "array", "[", "pos", "]", "=", "array", "[", "pos", "]", ".", "join", "(", "conflicts", ")", ";", "return", "new", "Parts", "(", "this", ".", "terms", ",", "array", ")", ";", "}", "ensureConflicts", "(", ")", "{", "if", "(", "this", ".", "conflicts", ")", "return", "this", ".", "conflicts", ";", "let", "empty", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<=", "this", ".", "terms", ".", "length", ";", "i", "++", ")", "empty", ".", "push", "(", "Conflicts", ".", "none", ")", ";", "return", "empty", ";", "}", "static", "none", "=", "new", "Parts", "(", "none", ",", "null", ")", ";", "}", "function", "p", "(", "...", "terms", ")", "{", "return", "new", "Parts", "(", "terms", ",", "null", ")", ";", "}", "class", "BuiltRule", "{", "constructor", "(", "readonly", "id", ",", "readonly", "args", ",", "readonly", "term", ")", "{", "}", "matches", "(", "expr", ")", "{", "return", "this", ".", "id", "==", "expr", ".", "id", ".", "name", "&&", "exprsEq", "(", "expr", ".", "args", ",", "this", ".", "args", ")", ";", "}", "matchesRepeat", "(", "expr", ")", "{", "return", "this", ".", "id", "==", "\"+\"", "&&", "exprEq", "(", "expr", ".", "expr", ",", "this", ".", "args", "[", "0", "]", ")", ";", "}", "}", "export", "type", "BuildOptions", "=", "{", "fileName", "?", ":", "string", ";", "warn", "?", ":", "(", "message", ":", "string", ")", "=>", "void", ";", "includeNames", "?", ":", "boolean", ";", "moduleStyle", "?", ":", "string", ";", "exportName", "?", ":", "string", ";", "externalTokenizer", "?", ":", "(", "name", ":", "string", ",", "terms", ":", "{", "[", "name", "]", ":", "number", ";", "}", ")", "=>", "ExternalTokenizer", ";", "externalSpecializer", "?", ":", "(", "name", ":", "string", ",", "terms", ":", "{", "[", "name", "]", ":", "number", ";", "}", ")", "=>", "(", "value", ":", "string", ",", "stack", ":", "Stack", ")", "=>", "number", ";", "externalProp", "?", ":", "(", "name", ":", "string", ")", "=>", "NodeProp", "<", "any", ">", ";", "contextTracker", "?", ":", "ContextTracker", "<", "any", ">", ";", "}", ";", "type", "SkipInfo", "=", "{", "skip", ":", "readonly", "Term", "[", "]", ";", "rule", ":", "Term", "|", "null", ";", "startTokens", ":", "readonly", "Term", "[", "]", ";", "id", ":", "number", ";", "}", ";", "class", "Builder", "{", "ast", "!", ":", "GrammarDeclaration", ";", "input", "!", ":", "Input", ";", "terms", "=", "new", "TermSet", ";", "tokens", ":", "TokenSet", ";", "externalTokens", ":", "ExternalTokenSet", "[", "]", ";", "externalSpecializers", ":", "ExternalSpecializer", "[", "]", ";", "specialized", ":", "{", "[", "name", "]", ":", "{", "value", ":", "string", ";", "name", ":", "string", "|", "null", ";", "term", ":", "Term", ";", "type", ":", "string", ";", "dialect", ":", "number", "|", "null", ";", "}", "[", "]", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "tokenOrigins", ":", "{", "[", "name", "]", ":", "{", "spec", "?", ":", "Term", ";", "external", "?", ":", "ExternalTokenSet", "|", "ExternalSpecializer", ";", "}", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "rules", ":", "Rule", "[", "]", "=", "[", "]", ";", "built", ":", "BuiltRule", "[", "]", "=", "[", "]", ";", "ruleNames", ":", "{", "[", "name", "]", ":", "Identifier", "|", "null", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "namespaces", ":", "{", "[", "name", "]", ":", "Namespace", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "namedTerms", ":", "{", "[", "name", "]", ":", "Term", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "termTable", ":", "{", "[", "name", "]", ":", "number", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "knownProps", ":", "{", "[", "name", "]", ":", "{", "prop", ":", "NodeProp", "<", "any", ">", ";", "source", ":", "{", "name", ":", "string", ";", "from", ":", "string", "|", "null", ";", "}", ";", "}", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "dialects", ":", "readonly", "string", "[", "]", ";", "dynamicRulePrecedences", ":", "{", "rule", ":", "Term", ";", "prec", ":", "number", ";", "}", "[", "]", "=", "[", "]", ";", "definedGroups", ":", "{", "name", ":", "Term", ";", "group", ":", "string", ";", "rule", ":", "RuleDeclaration", ";", "}", "[", "]", "=", "[", "]", ";", "astRules", ":", "{", "skip", ":", "Term", ";", "rule", ":", "RuleDeclaration", ";", "}", "[", "]", "=", "[", "]", ";", "currentSkip", ":", "Term", "[", "]", "=", "[", "]", ";", "skipRules", "!", ":", "Term", "[", "]", ";", "constructor", "(", "text", ",", "readonly", "options", ")", "{", "time", "(", "\"Parse\"", ",", "(", ")", "=>", "{", "this", ".", "input", "=", "new", "Input", "(", "text", ",", "options", ".", "fileName", ")", ";", "this", ".", "ast", "=", "this", ".", "input", ".", "parse", "(", ")", ";", "}", ")", ";", "let", "NP", "=", "NodeProp", ";", "for", "(", "let", "prop", "in", "NP", ")", "{", "if", "(", "NP", "[", "prop", "]", "instanceof", "NodeProp", "&&", "!", "NP", "[", "prop", "]", ".", "perNode", ")", "this", ".", "knownProps", "[", "prop", "]", "=", "{", "prop", ":", "NP", "[", "prop", "]", ",", "source", ":", "{", "name", ":", "prop", ",", "from", ":", "null", "}", "}", ";", "}", "for", "(", "let", "prop", "of", "this", ".", "ast", ".", "externalProps", ")", "{", "this", ".", "knownProps", "[", "prop", ".", "id", ".", "name", "]", "=", "{", "prop", ":", "this", ".", "options", ".", "externalProp", "?", "this", ".", "options", ".", "externalProp", "(", "prop", ".", "id", ".", "name", ")", ":", "new", "NodeProp", "<", "string", ">", "(", ")", ",", "source", ":", "{", "name", ":", "prop", ".", "externalID", ".", "name", ",", "from", ":", "prop", ".", "source", "}", "}", ";", "}", "this", ".", "dialects", "=", "this", ".", "ast", ".", "dialects", ".", "map", "(", "d", "=>", "d", ".", "name", ")", ";", "this", ".", "tokens", "=", "new", "TokenSet", "(", "this", ",", "this", ".", "ast", ".", "tokens", ")", ";", "this", ".", "externalTokens", "=", "this", ".", "ast", ".", "externalTokens", ".", "map", "(", "ext", "=>", "new", "ExternalTokenSet", "(", "this", ",", "ext", ")", ")", ";", "this", ".", "externalSpecializers", "=", "this", ".", "ast", ".", "externalSpecializers", ".", "map", "(", "decl", "=>", "new", "ExternalSpecializer", "(", "this", ",", "decl", ")", ")", ";", "time", "(", "\"Build rules\"", ",", "(", ")", "=>", "{", "let", "noSkip", "=", "this", ".", "newName", "(", "\"%noskip\"", ",", "true", ")", ";", "this", ".", "defineRule", "(", "noSkip", ",", "[", "]", ")", ";", "let", "mainSkip", "=", "this", ".", "ast", ".", "mainSkip", "?", "this", ".", "newName", "(", "\"%mainskip\"", ",", "true", ")", ":", "noSkip", ";", "let", "scopedSkip", "=", "[", "]", ",", "topRules", "=", "[", "]", ";", "for", "(", "let", "rule", "of", "this", ".", "ast", ".", "rules", ")", "this", ".", "astRules", ".", "push", "(", "{", "skip", ":", "mainSkip", ",", "rule", "}", ")", ";", "for", "(", "let", "rule", "of", "this", ".", "ast", ".", "topRules", ")", "topRules", ".", "push", "(", "{", "skip", ":", "mainSkip", ",", "rule", "}", ")", ";", "for", "(", "let", "scoped", "of", "this", ".", "ast", ".", "scopedSkip", ")", "{", "let", "skip", "=", "noSkip", ",", "found", "=", "this", ".", "ast", ".", "scopedSkip", ".", "findIndex", "(", "(", "sc", ",", "i", ")", "=>", "i", "<", "scopedSkip", ".", "length", "&&", "exprEq", "(", "sc", ".", "expr", ",", "scoped", ".", "expr", ")", ")", ";", "if", "(", "found", ">", "-", "1", ")", "skip", "=", "scopedSkip", "[", "found", "]", ";", "else", "if", "(", "this", ".", "ast", ".", "mainSkip", "&&", "exprEq", "(", "scoped", ".", "expr", ",", "this", ".", "ast", ".", "mainSkip", ")", ")", "skip", "=", "mainSkip", ";", "else", "if", "(", "!", "isEmpty", "(", "scoped", ".", "expr", ")", ")", "skip", "=", "this", ".", "newName", "(", "\"%skip\"", ",", "true", ")", ";", "scopedSkip", ".", "push", "(", "skip", ")", ";", "for", "(", "let", "rule", "of", "scoped", ".", "rules", ")", "this", ".", "astRules", ".", "push", "(", "{", "skip", ",", "rule", "}", ")", ";", "for", "(", "let", "rule", "of", "scoped", ".", "topRules", ")", "topRules", ".", "push", "(", "{", "skip", ",", "rule", "}", ")", ";", "}", "for", "(", "let", "{", "rule", "}", "of", "this", ".", "astRules", ")", "{", "this", ".", "unique", "(", "rule", ".", "id", ")", ";", "if", "(", "this", ".", "namespaces", "[", "rule", ".", "id", ".", "name", "]", ")", "this", ".", "raise", "(", "`Rule name '${", "rule", ".", "id", ".", "name", "}' conflicts with a defined namespace`", ",", "rule", ".", "id", ".", "start", ")", ";", "}", "this", ".", "currentSkip", ".", "push", "(", "noSkip", ")", ";", "this", ".", "skipRules", "=", "mainSkip", "==", "noSkip", "?", "[", "mainSkip", "]", ":", "[", "noSkip", ",", "mainSkip", "]", ";", "if", "(", "mainSkip", "!=", "noSkip", ")", "this", ".", "defineRule", "(", "mainSkip", ",", "this", ".", "normalizeExpr", "(", "this", ".", "ast", ".", "mainSkip", "!", ")", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "this", ".", "ast", ".", "scopedSkip", ".", "length", ";", "i", "++", ")", "{", "let", "skip", "=", "scopedSkip", "[", "i", "]", ";", "if", "(", "!", "this", ".", "skipRules", ".", "includes", "(", "skip", ")", ")", "{", "this", ".", "skipRules", ".", "push", "(", "skip", ")", ";", "if", "(", "skip", "!=", "noSkip", ")", "this", ".", "defineRule", "(", "skip", ",", "this", ".", "normalizeExpr", "(", "this", ".", "ast", ".", "scopedSkip", "[", "i", "]", ".", "expr", ")", ")", ";", "}", "}", "this", ".", "currentSkip", ".", "pop", "(", ")", ";", "for", "(", "let", "{", "rule", ",", "skip", "}", "of", "topRules", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "rule", ".", "start", "-", "b", ".", "rule", ".", "start", ")", ")", "{", "this", ".", "unique", "(", "rule", ".", "id", ")", ";", "this", ".", "used", "(", "rule", ".", "id", ".", "name", ")", ";", "this", ".", "currentSkip", ".", "push", "(", "skip", ")", ";", "let", "{", "name", ",", "props", "}", "=", "this", ".", "nodeInfo", "(", "rule", ".", "props", ",", "\"a\"", ",", "rule", ".", "id", ".", "name", ",", "none", ",", "none", ",", "rule", ".", "expr", ")", ";", "let", "term", "=", "this", ".", "terms", ".", "makeTop", "(", "name", ",", "props", ")", ";", "this", ".", "namedTerms", "[", "name", "!", "]", "=", "term", ";", "this", ".", "defineRule", "(", "term", ",", "this", ".", "normalizeExpr", "(", "rule", ".", "expr", ")", ")", ";", "this", ".", "currentSkip", ".", "pop", "(", ")", ";", "}", "for", "(", "let", "ext", "of", "this", ".", "externalSpecializers", ")", "ext", ".", "finish", "(", ")", ";", "for", "(", "let", "{", "skip", ",", "rule", "}", "of", "this", ".", "astRules", ")", "{", "if", "(", "this", ".", "ruleNames", "[", "rule", ".", "id", ".", "name", "]", "&&", "isExported", "(", "rule", ")", "&&", "!", "rule", ".", "params", ".", "length", ")", "{", "this", ".", "buildRule", "(", "rule", ",", "[", "]", ",", "skip", ",", "false", ")", ";", "if", "(", "rule", ".", "expr", "instanceof", "SequenceExpression", "&&", "rule", ".", "expr", ".", "exprs", ".", "length", "==", "0", ")", "this", ".", "used", "(", "rule", ".", "id", ".", "name", ")", ";", "}", "}", "}", ")", ";", "for", "(", "let", "name", "in", "this", ".", "ruleNames", ")", "{", "let", "value", "=", "this", ".", "ruleNames", "[", "name", "]", ";", "if", "(", "value", ")", "this", ".", "warn", "(", "`Unused rule '${", "value", ".", "name", "}'`", ",", "value", ".", "start", ")", ";", "}", "this", ".", "tokens", ".", "takePrecedences", "(", ")", ";", "this", ".", "tokens", ".", "takeConflicts", "(", ")", ";", "for", "(", "let", "{", "name", ",", "group", ",", "rule", "}", "of", "this", ".", "definedGroups", ")", "this", ".", "defineGroup", "(", "name", ",", "group", ",", "rule", ")", ";", "this", ".", "checkGroups", "(", ")", ";", "}", "unique", "(", "id", ")", "{", "if", "(", "id", ".", "name", "in", "this", ".", "ruleNames", ")", "this", ".", "raise", "(", "`Duplicate definition of rule '${", "id", ".", "name", "}'`", ",", "id", ".", "start", ")", ";", "this", ".", "ruleNames", "[", "id", ".", "name", "]", "=", "id", ";", "}", "used", "(", "name", ")", "{", "this", ".", "ruleNames", "[", "name", "]", "=", "null", ";", "}", "defineNamespace", "(", "name", ",", "value", ",", "pos", "=", "0", ")", "{", "if", "(", "this", ".", "namespaces", "[", "name", "]", ")", "this", ".", "raise", "(", "`Duplicate definition of namespace '${", "name", "}'`", ",", "pos", ")", ";", "this", ".", "namespaces", "[", "name", "]", "=", "value", ";", "}", "newName", "(", "base", ",", "nodeName", "=", "null", ",", "props", "=", "{", "}", ")", "{", "for", "(", "let", "i", "=", "nodeName", "?", "0", ":", "1", ";", ";", "i", "++", ")", "{", "let", "name", "=", "i", "?", "`${", "base", "}-${", "i", "}`", ":", "base", ";", "if", "(", "!", "this", ".", "terms", ".", "names", "[", "name", "]", ")", "return", "this", ".", "terms", ".", "makeNonTerminal", "(", "name", ",", "nodeName", "===", "true", "?", "null", ":", "nodeName", ",", "props", ")", ";", "}", "}", "prepareParser", "(", ")", "{", "let", "rules", "=", "time", "(", "\"Simplify rules\"", ",", "(", ")", "=>", "simplifyRules", "(", "this", ".", "rules", ",", "[", "...", "this", ".", "skipRules", ",", "...", "this", ".", "terms", ".", "tops", "]", ")", ")", ";", "let", "{", "nodeTypes", ",", "names", ":", "termNames", ",", "minRepeatTerm", ",", "maxTerm", "}", "=", "this", ".", "terms", ".", "finish", "(", "rules", ")", ";", "for", "(", "let", "prop", "in", "this", ".", "namedTerms", ")", "this", ".", "termTable", "[", "prop", "]", "=", "this", ".", "namedTerms", "[", "prop", "]", ".", "id", ";", "if", "(", "/\\bgrammar\\b/", ".", "test", "(", "verbose", ")", ")", "console", ".", "log", "(", "rules", ".", "join", "(", "\"\\n\"", ")", ")", ";", "let", "startTerms", "=", "this", ".", "terms", ".", "tops", ".", "slice", "(", ")", ";", "let", "first", "=", "computeFirstSets", "(", "this", ".", "terms", ")", ";", "let", "skipInfo", "=", "this", ".", "skipRules", ".", "map", "(", "(", "name", ",", "id", ")", "=>", "{", "let", "skip", "=", "[", "]", ",", "startTokens", "=", "[", "]", ",", "rules", "=", "[", "]", ";", "for", "(", "let", "rule", "of", "name", ".", "rules", ")", "{", "if", "(", "!", "rule", ".", "parts", ".", "length", ")", "continue", ";", "let", "start", "=", "rule", ".", "parts", "[", "0", "]", ";", "for", "(", "let", "t", "of", "start", ".", "terminal", "?", "[", "start", "]", ":", "first", "[", "start", ".", "name", "]", "||", "[", "]", ")", "if", "(", "!", "startTokens", ".", "includes", "(", "t", ")", ")", "startTokens", ".", "push", "(", "t", ")", ";", "if", "(", "start", ".", "terminal", "&&", "rule", ".", "parts", ".", "length", "==", "1", "&&", "!", "rules", ".", "some", "(", "r", "=>", "r", "!=", "rule", "&&", "r", ".", "parts", "[", "0", "]", "==", "start", ")", ")", "skip", ".", "push", "(", "start", ")", ";", "else", "rules", ".", "push", "(", "rule", ")", ";", "}", "name", ".", "rules", "=", "rules", ";", "if", "(", "rules", ".", "length", ")", "startTerms", ".", "push", "(", "name", ")", ";", "return", "{", "skip", ",", "rule", ":", "rules", ".", "length", "?", "name", ":", "null", ",", "startTokens", ",", "id", "}", ";", "}", ")", ";", "let", "fullTable", "=", "time", "(", "\"Build full automaton\"", ",", "(", ")", "=>", "buildFullAutomaton", "(", "this", ".", "terms", ",", "startTerms", ",", "first", ")", ")", ";", "let", "{", "tokenGroups", ",", "tokenPrec", ",", "tokenData", "}", "=", "time", "(", "\"Build token groups\"", ",", "(", ")", "=>", "this", ".", "tokens", ".", "buildTokenGroups", "(", "fullTable", ",", "skipInfo", ")", ")", ";", "let", "table", "=", "time", "(", "\"Finish automaton\"", ",", "(", ")", "=>", "finishAutomaton", "(", "fullTable", ")", "as", "readonly", "LRState", "[", "]", ")", ";", "let", "skipState", "=", "findSkipStates", "(", "table", ",", "this", ".", "terms", ".", "tops", ")", ";", "if", "(", "/\\blr\\b/", ".", "test", "(", "verbose", ")", ")", "console", ".", "log", "(", "table", ".", "join", "(", "\"\\n\"", ")", ")", ";", "let", "specialized", "=", "[", "]", ";", "for", "(", "let", "ext", "of", "this", ".", "externalSpecializers", ")", "specialized", ".", "push", "(", "ext", ")", ";", "for", "(", "let", "name", "in", "this", ".", "specialized", ")", "specialized", ".", "push", "(", "{", "token", ":", "this", ".", "terms", ".", "names", "[", "name", "]", ",", "table", ":", "buildSpecializeTable", "(", "this", ".", "specialized", "[", "name", "]", ")", "}", ")", ";", "let", "tokStart", "=", "(", "tokenizer", ")", "=>", "{", "if", "(", "tokenizer", "instanceof", "ExternalTokenDeclaration", ")", "return", "tokenizer", ".", "start", ";", "return", "this", ".", "tokens", ".", "ast", "?", "this", ".", "tokens", ".", "ast", ".", "start", ":", "-", "1", ";", "}", ";", "let", "tokenizers", "=", "(", "tokenGroups", "as", "(", "TokenGroup", "|", "ExternalTokenDeclaration", ")", "[", "]", ")", ".", "concat", "(", "this", ".", "externalTokens", ".", "map", "(", "e", "=>", "e", ".", "ast", ")", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "tokStart", "(", "a", ")", "-", "tokStart", "(", "b", ")", ")", ";", "let", "data", "=", "new", "DataBuilder", ";", "let", "skipData", "=", "skipInfo", ".", "map", "(", "info", "=>", "{", "let", "actions", "=", "[", "]", ";", "for", "(", "let", "term", "of", "info", ".", "skip", ")", "actions", ".", "push", "(", "term", ".", "id", ",", "0", ",", "Action", ".", "StayFlag", ">>", "16", ")", ";", "if", "(", "info", ".", "rule", ")", "{", "let", "state", "=", "table", ".", "find", "(", "s", "=>", "s", ".", "startRule", "==", "info", ".", "rule", ")", "!", ";", "for", "(", "let", "action", "of", "state", ".", "actions", "as", "Shift", "[", "]", ")", "actions", ".", "push", "(", "action", ".", "term", ".", "id", ",", "state", ".", "id", ",", "Action", ".", "GotoFlag", ">>", "16", ")", ";", "}", "actions", ".", "push", "(", "Seq", ".", "End", ",", "Seq", ".", "Done", ")", ";", "return", "data", ".", "storeArray", "(", "actions", ")", ";", "}", ")", ";", "let", "states", "=", "time", "(", "\"Finish states\"", ",", "(", ")", "=>", "{", "let", "states", "=", "new", "Uint32Array", "(", "table", ".", "length", "*", "ParseState", ".", "Size", ")", ";", "let", "forceReductions", "=", "this", ".", "computeForceReductions", "(", "table", ",", "skipInfo", ")", ";", "let", "finishCx", "=", "new", "FinishStateContext", "(", "tokenizers", ",", "data", ",", "states", ",", "skipData", ",", "skipInfo", ",", "table", ",", "this", ")", ";", "for", "(", "let", "s", "of", "table", ")", "finishCx", ".", "finish", "(", "s", ",", "skipState", "(", "s", ".", "id", ")", ",", "forceReductions", "[", "s", ".", "id", "]", ")", ";", "return", "states", ";", "}", ")", ";", "let", "dialects", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "this", ".", "dialects", ".", "length", ";", "i", "++", ")", "dialects", "[", "this", ".", "dialects", "[", "i", "]", "]", "=", "data", ".", "storeArray", "(", "(", "this", ".", "tokens", ".", "byDialect", "[", "i", "]", "||", "none", ")", ".", "map", "(", "t", "=>", "t", ".", "id", ")", ".", "concat", "(", "Seq", ".", "End", ")", ")", ";", "let", "dynamicPrecedences", "=", "null", ";", "if", "(", "this", ".", "dynamicRulePrecedences", ".", "length", ")", "{", "dynamicPrecedences", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "{", "rule", ",", "prec", "}", "of", "this", ".", "dynamicRulePrecedences", ")", "dynamicPrecedences", "[", "rule", ".", "id", "]", "=", "prec", ";", "}", "let", "topRules", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "term", "of", "this", ".", "terms", ".", "tops", ")", "topRules", "[", "term", ".", "nodeName", "!", "]", "=", "[", "table", ".", "find", "(", "state", "=>", "state", ".", "startRule", "==", "term", ")", "!", ".", "id", ",", "term", ".", "id", "]", ";", "let", "precTable", "=", "data", ".", "storeArray", "(", "tokenPrec", ".", "concat", "(", "Seq", ".", "End", ")", ")", ";", "let", "{", "nodeProps", ",", "skippedTypes", "}", "=", "this", ".", "gatherNodeProps", "(", "nodeTypes", ")", ";", "return", "{", "states", ",", "stateData", ":", "data", ".", "finish", "(", ")", ",", "goto", ":", "computeGotoTable", "(", "table", ")", ",", "nodeNames", ":", "nodeTypes", ".", "filter", "(", "t", "=>", "t", ".", "id", "<", "minRepeatTerm", ")", ".", "map", "(", "t", "=>", "t", ".", "nodeName", ")", ".", "join", "(", "\" \"", ")", ",", "nodeProps", ",", "skippedTypes", ",", "maxTerm", ",", "repeatNodeCount", ":", "nodeTypes", ".", "length", "-", "minRepeatTerm", ",", "tokenizers", ",", "tokenData", ",", "topRules", ",", "dialects", ",", "dynamicPrecedences", ",", "specialized", ",", "tokenPrec", ":", "precTable", ",", "termNames", "}", ";", "}", "getParser", "(", ")", "{", "let", "{", "states", ",", "stateData", ",", "goto", ",", "nodeNames", ",", "nodeProps", ":", "rawNodeProps", ",", "skippedTypes", ",", "maxTerm", ",", "repeatNodeCount", ",", "tokenizers", ":", "rawTokenizers", ",", "tokenData", ",", "topRules", ",", "dialects", ",", "dynamicPrecedences", ",", "specialized", ":", "rawSpecialized", ",", "tokenPrec", ",", "termNames", "}", "=", "this", ".", "prepareParser", "(", ")", ";", "let", "specialized", "=", "rawSpecialized", ".", "map", "(", "v", "=>", "{", "if", "(", "v", "instanceof", "ExternalSpecializer", ")", "{", "let", "ext", "=", "this", ".", "options", ".", "externalSpecializer", "!", "(", "v", ".", "ast", ".", "id", ".", "name", ",", "this", ".", "termTable", ")", ";", "return", "{", "term", ":", "v", ".", "term", "!", ".", "id", ",", "get", ":", "(", "value", ",", "stack", ")", "=>", "(", "ext", "(", "value", ",", "stack", ")", "<<", "1", ")", "|", "(", "v", ".", "ast", ".", "type", "==", "\"extend\"", "?", "Specialize", ".", "Extend", ":", "Specialize", ".", "Specialize", ")", "}", ";", "}", "else", "{", "return", "{", "term", ":", "v", ".", "token", ".", "id", ",", "get", ":", "(", "value", ")", "=>", "v", ".", "table", "[", "value", "]", "||", "-", "1", "}", ";", "}", "}", ")", ";", "let", "tokenizers", "=", "rawTokenizers", ".", "map", "(", "tok", "=>", "{", "return", "tok", "instanceof", "ExternalTokenDeclaration", "?", "this", ".", "options", ".", "externalTokenizer", "!", "(", "tok", ".", "id", ".", "name", ",", "this", ".", "termTable", ")", ":", "tok", ".", "id", ";", "}", ")", ";", "return", "(", "LRParser", "as", "any", ")", ".", "deserialize", "(", "{", "version", ":", "File", ".", "Version", ",", "states", ",", "stateData", ",", "goto", ",", "nodeNames", ",", "maxTerm", ",", "repeatNodeCount", ",", "nodeProps", ":", "rawNodeProps", ".", "map", "(", "(", "{", "prop", ",", "terms", "}", ")", "=>", "[", "this", ".", "knownProps", "[", "prop", "]", ".", "prop", ",", "...", "terms", "]", ")", ",", "skippedNodes", ":", "skippedTypes", ",", "tokenData", ",", "tokenizers", ",", "context", ":", "this", ".", "ast", ".", "context", "?", "this", ".", "options", ".", "contextTracker", ":", "undefined", ",", "topRules", ",", "dialects", ",", "dynamicPrecedences", ",", "specialized", ",", "tokenPrec", ",", "termNames", "}", ")", ";", "}", "getParserFile", "(", ")", "{", "let", "{", "states", ",", "stateData", ",", "goto", ",", "nodeNames", ",", "nodeProps", ":", "rawNodeProps", ",", "skippedTypes", ",", "maxTerm", ",", "repeatNodeCount", ",", "tokenizers", ":", "rawTokenizers", ",", "tokenData", ",", "topRules", ",", "dialects", ":", "rawDialects", ",", "dynamicPrecedences", ",", "specialized", ":", "rawSpecialized", ",", "tokenPrec", ",", "termNames", "}", "=", "this", ".", "prepareParser", "(", ")", ";", "let", "mod", "=", "this", ".", "options", ".", "moduleStyle", "||", "\"es\"", ";", "let", "gen", "=", "\"// This file was generated by lezer-generator. You probably shouldn't edit it.\\n\"", ",", "head", "=", "gen", ";", "head", "+=", "mod", "==", "\"cjs\"", "?", "`const {LRParser} = require(\"@lezer/lr\")\\n`", ":", "`import {LRParser} from \"@lezer/lr\"\\n`", ";", "let", "imports", "=", "{", "}", ",", "imported", "=", "Object", ".", "create", "(", "null", ")", ";", "let", "defined", "=", "Object", ".", "create", "(", "null", ")", ";", "let", "exportName", "=", "this", ".", "options", ".", "exportName", "||", "\"parser\"", ";", "defined", ".", "Parser", "=", "defined", "[", "exportName", "]", "=", "true", ";", "let", "getName", "=", "(", "prefix", ")", "=>", "{", "for", "(", "let", "i", "=", "0", ";", ";", "i", "++", ")", "{", "let", "id", "=", "prefix", "+", "(", "i", "?", "\"_\"", "+", "i", ":", "\"\"", ")", ";", "if", "(", "!", "defined", "[", "id", "]", ")", "return", "id", ";", "}", "}", ";", "let", "importName", "=", "(", "name", ",", "source", ",", "prefix", ")", "=>", "{", "let", "spec", "=", "name", "+", "\" from \"", "+", "source", ";", "if", "(", "imported", "[", "spec", "]", ")", "return", "imported", "[", "spec", "]", ";", "let", "src", "=", "JSON", ".", "stringify", "(", "source", ")", ",", "varName", "=", "name", ";", "if", "(", "name", "in", "defined", ")", "{", "varName", "=", "getName", "(", "prefix", ")", ";", "name", "+=", "`${", "mod", "==", "\"cjs\"", "?", "\":\"", ":", "\" as\"", "} ${", "varName", "}`", ";", "}", ";", "(", "imports", "[", "src", "]", "||", "(", "imports", "[", "src", "]", "=", "[", "]", ")", ")", ".", "push", "(", "name", ")", ";", "return", "imported", "[", "spec", "]", "=", "varName", ";", "}", ";", "let", "tokenizers", "=", "rawTokenizers", ".", "map", "(", "tok", "=>", "{", "if", "(", "tok", "instanceof", "ExternalTokenDeclaration", ")", "{", "let", "{", "source", ",", "id", ":", "{", "name", "}", "}", "=", "tok", ";", "return", "importName", "(", "name", ",", "source", ",", "\"tok\"", ")", ";", "}", "else", "{", "return", "tok", ".", "id", ";", "}", "}", ")", ";", "let", "context", "=", "this", ".", "ast", ".", "context", "?", "importName", "(", "this", ".", "ast", ".", "context", ".", "id", ".", "name", ",", "this", ".", "ast", ".", "context", ".", "source", ",", "\"cx\"", ")", ":", "null", ";", "let", "nodeProps", "=", "rawNodeProps", ".", "map", "(", "(", "{", "prop", ",", "terms", "}", ")", "=>", "{", "let", "{", "source", "}", "=", "this", ".", "knownProps", "[", "prop", "]", ";", "let", "propID", "=", "source", ".", "from", "?", "importName", "(", "source", ".", "name", ",", "source", ".", "from", ",", "\"prop\"", ")", ":", "importName", "(", "\"NodeProp\"", ",", "\"@lezer/common\"", ",", "\"NodeProp\"", ")", "+", "\".\"", "+", "source", ".", "name", ";", "return", "`[${", "propID", "}, ${", "terms", ".", "map", "(", "serializePropValue", ")", ".", "join", "(", "\",\"", ")", "}]`", ";", "}", ")", ";", "function", "specializationTableString", "(", "table", ")", "{", "return", "\"{__proto__:null,\"", "+", "Object", ".", "keys", "(", "table", ")", ".", "map", "(", "key", "=>", "`${", "/\\W/", ".", "test", "(", "key", ")", "?", "JSON", ".", "stringify", "(", "key", ")", ":", "key", "}:${", "table", "[", "key", "]", "}`", ")", ".", "join", "(", "\", \"", ")", "+", "\"}\"", ";", "}", "let", "specHead", "=", "\"\"", ";", "let", "specialized", "=", "rawSpecialized", ".", "map", "(", "v", "=>", "{", "if", "(", "v", "instanceof", "ExternalSpecializer", ")", "{", "let", "name", "=", "importName", "(", "v", ".", "ast", ".", "id", ".", "name", ",", "v", ".", "ast", ".", "source", ",", "v", ".", "ast", ".", "id", ".", "name", ")", ";", "return", "`{term: ${", "v", ".", "term", "!", ".", "id", "}, get: (value, stack) => (${", "name", "}(value, stack) << 1)${", "v", ".", "ast", ".", "type", "==", "\"extend\"", "?", "` | ${", "Specialize", ".", "Extend", "}`", ":", "''", "}}`", ";", "}", "else", "{", "let", "tableName", "=", "getName", "(", "\"spec_\"", "+", "v", ".", "token", ".", "name", ".", "replace", "(", "/\\W/g", ",", "\"\"", ")", ")", ";", "specHead", "+=", "`const ${", "tableName", "} = ${", "specializationTableString", "(", "v", ".", "table", ")", "}\\n`", ";", "return", "`{term: ${", "v", ".", "token", ".", "id", "}, get: value => ${", "tableName", "}[value] || -1}`", ";", "}", "}", ")", ";", "for", "(", "let", "source", "in", "imports", ")", "{", "if", "(", "mod", "==", "\"cjs\"", ")", "head", "+=", "`const {${", "imports", "[", "source", "]", ".", "join", "(", "\", \"", ")", "}} = require(${", "source", "})\\n`", ";", "else", "head", "+=", "`import {${", "imports", "[", "source", "]", ".", "join", "(", "\", \"", ")", "}} from ${", "source", "}\\n`", ";", "}", "head", "+=", "specHead", ";", "function", "serializePropValue", "(", "value", ")", "{", "return", "typeof", "value", "!=", "\"string\"", "||", "/^(true|false|\\d+(\\.\\d+)?|\\.\\d+)$/", ".", "test", "(", "value", ")", "?", "value", ":", "JSON", ".", "stringify", "(", "value", ")", ";", "}", "let", "dialects", "=", "Object", ".", "keys", "(", "rawDialects", ")", ".", "map", "(", "d", "=>", "`${", "d", "}: ${", "rawDialects", "[", "d", "]", "}`", ")", ";", "let", "parserStr", "=", "`LRParser.deserialize({\n version: ${", "File", ".", "Version", "},\n states: ${", "encodeArray", "(", "states", ",", "0xffffffff", ")", "},\n stateData: ${", "encodeArray", "(", "stateData", ")", "},\n goto: ${", "encodeArray", "(", "goto", ")", "},\n nodeNames: ${", "JSON", ".", "stringify", "(", "nodeNames", ")", "},\n maxTerm: ${", "maxTerm", "}${", "context", "?", "`,\n context: ${", "context", "}`", ":", "\"\"", "}${", "nodeProps", ".", "length", "?", "`,\n nodeProps: [\n ${", "nodeProps", ".", "join", "(", "\",\\n \"", ")", "}\n ]`", ":", "\"\"", "}${", "skippedTypes", ".", "length", "?", "`,\n skippedNodes: ${", "JSON", ".", "stringify", "(", "skippedTypes", ")", "}`", ":", "\"\"", "},\n repeatNodeCount: ${", "repeatNodeCount", "},\n tokenData: ${", "encodeArray", "(", "tokenData", ")", "},\n tokenizers: [${", "tokenizers", ".", "join", "(", "\", \"", ")", "}],\n topRules: ${", "JSON", ".", "stringify", "(", "topRules", ")", "}${", "dialects", ".", "length", "?", "`,\n dialects: {${", "dialects", ".", "join", "(", "\", \"", ")", "}}`", ":", "\"\"", "}${", "dynamicPrecedences", "?", "`,\n dynamicPrecedences: ${", "JSON", ".", "stringify", "(", "dynamicPrecedences", ")", "}`", ":", "\"\"", "}${", "specialized", ".", "length", "?", "`,\n specialized: [${", "specialized", ".", "join", "(", "\",\"", ")", "}]`", ":", "\"\"", "},\n tokenPrec: ${", "tokenPrec", "}${", "this", ".", "options", ".", "includeNames", "?", "`,\n termNames: ${", "JSON", ".", "stringify", "(", "termNames", ")", "}`", ":", "''", "}\n})`", ";", "let", "terms", "=", "[", "]", ";", "for", "(", "let", "name", "in", "this", ".", "termTable", ")", "{", "let", "id", "=", "name", ";", "if", "(", "KEYWORDS", ".", "includes", "(", "id", ")", ")", "for", "(", "let", "i", "=", "1", ";", ";", "i", "++", ")", "{", "id", "=", "\"_\"", ".", "repeat", "(", "i", ")", "+", "name", ";", "if", "(", "!", "(", "id", "in", "this", ".", "termTable", ")", ")", "break", ";", "}", "terms", ".", "push", "(", "`${", "id", "}${", "mod", "==", "\"cjs\"", "?", "\":\"", ":", "\" =\"", "} ${", "this", ".", "termTable", "[", "name", "]", "}`", ")", ";", "}", "for", "(", "let", "id", "=", "0", ";", "id", "<", "this", ".", "dialects", ".", "length", ";", "id", "++", ")", "terms", ".", "push", "(", "`Dialect_${", "this", ".", "dialects", "[", "id", "]", "}${", "mod", "==", "\"cjs\"", "?", "\":\"", ":", "\" =\"", "} ${", "id", "}`", ")", ";", "return", "{", "parser", ":", "head", "+", "(", "mod", "==", "\"cjs\"", "?", "`exports.${", "exportName", "} = ${", "parserStr", "}\\n`", ":", "`export const ${", "exportName", "} = ${", "parserStr", "}\\n`", ")", ",", "terms", ":", "mod", "==", "\"cjs\"", "?", "`${", "gen", "}module.exports = {\\n ${", "terms", ".", "join", "(", "\",\\n \"", ")", "}\\n}`", ":", "`${", "gen", "}export const\\n ${", "terms", ".", "join", "(", "\",\\n \"", ")", "}\\n`", "}", ";", "}", "gatherNonSkippedNodes", "(", ")", "{", "let", "seen", "=", "Object", ".", "create", "(", "null", ")", ";", "let", "work", "=", "[", "]", ";", "let", "add", "=", "(", "term", ")", "=>", "{", "if", "(", "!", "seen", "[", "term", ".", "id", "]", ")", "{", "seen", "[", "term", ".", "id", "]", "=", "true", ";", "work", ".", "push", "(", "term", ")", ";", "}", "}", ";", "this", ".", "terms", ".", "tops", ".", "forEach", "(", "add", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "work", ".", "length", ";", "i", "++", ")", "{", "for", "(", "let", "rule", "of", "work", "[", "i", "]", ".", "rules", ")", "for", "(", "let", "part", "of", "rule", ".", "parts", ")", "add", "(", "part", ")", ";", "}", "return", "seen", ";", "}", "gatherNodeProps", "(", "nodeTypes", ")", "{", "let", "notSkipped", "=", "this", ".", "gatherNonSkippedNodes", "(", ")", ",", "skippedTypes", "=", "[", "]", ";", "let", "nodeProps", "=", "[", "]", ";", "for", "(", "let", "type", "of", "nodeTypes", ")", "{", "if", "(", "!", "notSkipped", "[", "type", ".", "id", "]", "&&", "!", "type", ".", "error", ")", "skippedTypes", ".", "push", "(", "type", ".", "id", ")", ";", "for", "(", "let", "prop", "in", "type", ".", "props", ")", "{", "let", "known", "=", "this", ".", "knownProps", "[", "prop", "]", ";", "if", "(", "!", "known", ")", "throw", "new", "GenError", "(", "\"No known prop type for \"", "+", "prop", ")", ";", "if", "(", "known", ".", "source", ".", "from", "==", "null", "&&", "(", "known", ".", "source", ".", "name", "==", "\"repeated\"", "||", "known", ".", "source", ".", "name", "==", "\"error\"", ")", ")", "continue", ";", "let", "rec", "=", "nodeProps", ".", "find", "(", "r", "=>", "r", ".", "prop", "==", "prop", ")", ";", "if", "(", "!", "rec", ")", "nodeProps", ".", "push", "(", "rec", "=", "{", "prop", ",", "values", ":", "{", "}", "}", ")", ";", "(", "rec", ".", "values", "[", "type", ".", "props", "[", "prop", "]", "]", "||", "(", "rec", ".", "values", "[", "type", ".", "props", "[", "prop", "]", "]", "=", "[", "]", ")", ")", ".", "push", "(", "type", ".", "id", ")", ";", "}", "}", "return", "{", "nodeProps", ":", "nodeProps", ".", "map", "(", "(", "{", "prop", ",", "values", "}", ")", "=>", "{", "let", "terms", "=", "[", "]", ";", "for", "(", "let", "val", "in", "values", ")", "{", "let", "ids", "=", "values", "[", "val", "]", ";", "if", "(", "ids", ".", "length", "==", "1", ")", "{", "terms", ".", "push", "(", "ids", "[", "0", "]", ",", "val", ")", ";", "}", "else", "{", "terms", ".", "push", "(", "-", "ids", ".", "length", ")", ";", "for", "(", "let", "id", "of", "ids", ")", "terms", ".", "push", "(", "id", ")", ";", "terms", ".", "push", "(", "val", ")", ";", "}", "}", "return", "{", "prop", ",", "terms", "}", ";", "}", ")", ",", "skippedTypes", "}", ";", "}", "makeTerminal", "(", "name", ",", "tag", ",", "props", ")", "{", "return", "this", ".", "terms", ".", "makeTerminal", "(", "this", ".", "terms", ".", "uniqueName", "(", "name", ")", ",", "tag", ",", "props", ")", ";", "}", "computeForceReductions", "(", "states", ",", "skipInfo", ")", "{", "let", "reductions", "=", "[", "]", ";", "let", "candidates", "=", "[", "]", ";", "let", "gotoEdges", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "state", "of", "states", ")", "{", "reductions", ".", "push", "(", "0", ")", ";", "for", "(", "let", "edge", "of", "state", ".", "goto", ")", "{", "let", "array", "=", "gotoEdges", "[", "edge", ".", "term", ".", "id", "]", "||", "(", "gotoEdges", "[", "edge", ".", "term", ".", "id", "]", "=", "[", "]", ")", ";", "let", "found", "=", "array", ".", "find", "(", "o", "=>", "o", ".", "target", "==", "edge", ".", "target", ".", "id", ")", ";", "if", "(", "found", ")", "found", ".", "parents", ".", "push", "(", "state", ".", "id", ")", ";", "else", "array", ".", "push", "(", "{", "parents", ":", "[", "state", ".", "id", "]", ",", "target", ":", "edge", ".", "target", ".", "id", "}", ")", ";", "}", "candidates", "[", "state", ".", "id", "]", "=", "state", ".", "set", ".", "filter", "(", "pos", "=>", "pos", ".", "pos", ">", "0", "&&", "!", "pos", ".", "rule", ".", "name", ".", "top", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "b", ".", "pos", "-", "a", ".", "pos", "||", "a", ".", "rule", ".", "parts", ".", "length", "-", "b", ".", "rule", ".", "parts", ".", "length", ")", ";", "}", "let", "length1Reductions", "=", "Object", ".", "create", "(", "null", ")", ";", "function", "createsCycle", "(", "term", ",", "startState", ",", "parents", "=", "null", ")", "{", "let", "edges", "=", "gotoEdges", "[", "term", "]", ";", "if", "(", "!", "edges", ")", "return", "false", ";", "return", "edges", ".", "some", "(", "val", "=>", "{", "let", "parentIntersection", "=", "parents", "?", "parents", ".", "filter", "(", "id", "=>", "val", ".", "parents", ".", "includes", "(", "id", ")", ")", ":", "val", ".", "parents", ";", "if", "(", "parentIntersection", ".", "length", "==", "0", ")", "return", "false", ";", "if", "(", "val", ".", "target", "==", "startState", ")", "return", "true", ";", "let", "found", "=", "length1Reductions", "[", "val", ".", "target", "]", ";", "return", "found", "!=", "null", "&&", "createsCycle", "(", "found", ",", "startState", ",", "parentIntersection", ")", ";", "}", ")", ";", "}", "for", "(", "let", "state", "of", "states", ")", "{", "if", "(", "state", ".", "defaultReduce", "&&", "state", ".", "defaultReduce", ".", "parts", ".", "length", ">", "0", ")", "{", "reductions", "[", "state", ".", "id", "]", "=", "reduceAction", "(", "state", ".", "defaultReduce", ",", "skipInfo", ")", ";", "if", "(", "state", ".", "defaultReduce", ".", "parts", ".", "length", "==", "1", ")", "length1Reductions", "[", "state", ".", "id", "]", "=", "state", ".", "defaultReduce", ".", "name", ".", "id", ";", "}", "}", "for", "(", "let", "setSize", "=", "1", ";", ";", "setSize", "++", ")", "{", "let", "done", "=", "true", ";", "for", "(", "let", "state", "of", "states", ")", "{", "if", "(", "state", ".", "defaultReduce", ")", "continue", ";", "let", "set", "=", "candidates", "[", "state", ".", "id", "]", ";", "if", "(", "set", ".", "length", "!=", "setSize", ")", "{", "if", "(", "set", ".", "length", ">", "setSize", ")", "done", "=", "false", ";", "continue", ";", "}", "for", "(", "let", "pos", "of", "set", ")", "{", "if", "(", "pos", ".", "pos", "!=", "1", "||", "!", "createsCycle", "(", "pos", ".", "rule", ".", "name", ".", "id", ",", "state", ".", "id", ")", ")", "{", "reductions", "[", "state", ".", "id", "]", "=", "reduceAction", "(", "pos", ".", "rule", ",", "skipInfo", ",", "pos", ".", "pos", ")", ";", "if", "(", "pos", ".", "pos", "==", "1", ")", "length1Reductions", "[", "state", ".", "id", "]", "=", "pos", ".", "rule", ".", "name", ".", "id", ";", "break", ";", "}", "}", "}", "if", "(", "done", ")", "break", ";", "}", "return", "reductions", ";", "}", "substituteArgs", "(", "expr", ",", "args", ",", "params", ")", "{", "if", "(", "args", ".", "length", "==", "0", ")", "return", "expr", ";", "return", "expr", ".", "walk", "(", "expr", "=>", "{", "let", "found", ";", "if", "(", "expr", "instanceof", "NameExpression", "&&", "!", "expr", ".", "namespace", "&&", "(", "found", "=", "params", ".", "findIndex", "(", "p", "=>", "p", ".", "name", "==", "expr", ".", "id", ".", "name", ")", ")", ">", "-", "1", ")", "{", "let", "arg", "=", "args", "[", "found", "]", ";", "if", "(", "expr", ".", "args", ".", "length", ")", "{", "if", "(", "arg", "instanceof", "NameExpression", "&&", "!", "arg", ".", "args", ".", "length", ")", "return", "new", "NameExpression", "(", "expr", ".", "start", ",", "arg", ".", "namespace", ",", "arg", ".", "id", ",", "expr", ".", "args", ")", ";", "this", ".", "raise", "(", "`Passing arguments to a parameter that already has arguments`", ",", "expr", ".", "start", ")", ";", "}", "return", "arg", ";", "}", "else", "if", "(", "expr", "instanceof", "InlineRuleExpression", ")", "{", "let", "r", "=", "expr", ".", "rule", ",", "props", "=", "this", ".", "substituteArgsInProps", "(", "r", ".", "props", ",", "args", ",", "params", ")", ";", "return", "props", "==", "r", ".", "props", "?", "expr", ":", "new", "InlineRuleExpression", "(", "expr", ".", "start", ",", "new", "RuleDeclaration", "(", "r", ".", "start", ",", "r", ".", "id", ",", "props", ",", "r", ".", "params", ",", "r", ".", "expr", ")", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "SpecializeExpression", ")", "{", "let", "props", "=", "this", ".", "substituteArgsInProps", "(", "expr", ".", "props", ",", "args", ",", "params", ")", ";", "return", "props", "==", "expr", ".", "props", "?", "expr", ":", "new", "SpecializeExpression", "(", "expr", ".", "start", ",", "expr", ".", "type", ",", "props", ",", "expr", ".", "token", ",", "expr", ".", "content", ")", ";", "}", "return", "expr", ";", "}", ")", ";", "}", "substituteArgsInProps", "(", "props", ",", "args", ",", "params", ")", "{", "let", "substituteInValue", "=", "(", "value", ")", "=>", "{", "let", "result", "=", "value", "as", "PropPart", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "value", ".", "length", ";", "i", "++", ")", "{", "let", "part", "=", "value", "[", "i", "]", ";", "if", "(", "!", "part", ".", "name", ")", "continue", ";", "let", "found", "=", "params", ".", "findIndex", "(", "p", "=>", "p", ".", "name", "==", "part", ".", "name", ")", ";", "if", "(", "found", "<", "0", ")", "continue", ";", "if", "(", "result", "==", "value", ")", "result", "=", "value", ".", "slice", "(", ")", ";", "let", "expr", "=", "args", "[", "found", "]", ";", "if", "(", "expr", "instanceof", "NameExpression", "&&", "!", "expr", ".", "namespace", "&&", "!", "expr", ".", "args", ".", "length", ")", "result", "[", "i", "]", "=", "new", "PropPart", "(", "part", ".", "start", ",", "expr", ".", "id", ".", "name", ",", "null", ")", ";", "else", "if", "(", "expr", "instanceof", "LiteralExpression", ")", "result", "[", "i", "]", "=", "new", "PropPart", "(", "part", ".", "start", ",", "expr", ".", "value", ",", "null", ")", ";", "else", "this", ".", "raise", "(", "`Trying to interpolate expression '${", "expr", "}' into a prop`", ",", "part", ".", "start", ")", ";", "}", "return", "result", ";", "}", ";", "let", "result", "=", "props", "as", "Prop", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "props", ".", "length", ";", "i", "++", ")", "{", "let", "prop", "=", "props", "[", "i", "]", ",", "value", "=", "substituteInValue", "(", "prop", ".", "value", ")", ";", "if", "(", "value", "!=", "prop", ".", "value", ")", "{", "if", "(", "result", "==", "props", ")", "result", "=", "props", ".", "slice", "(", ")", ";", "result", "[", "i", "]", "=", "new", "Prop", "(", "prop", ".", "start", ",", "prop", ".", "at", ",", "prop", ".", "name", ",", "value", ")", ";", "}", "}", "return", "result", ";", "}", "conflictsFor", "(", "markers", ")", "{", "let", "here", "=", "Conflicts", ".", "none", ",", "atEnd", "=", "Conflicts", ".", "none", ";", "for", "(", "let", "marker", "of", "markers", ")", "{", "if", "(", "marker", ".", "type", "==", "\"ambig\"", ")", "{", "here", "=", "here", ".", "join", "(", "new", "Conflicts", "(", "0", ",", "[", "marker", ".", "id", ".", "name", "]", ")", ")", ";", "}", "else", "{", "let", "precs", "=", "this", ".", "ast", ".", "precedences", "!", ";", "let", "index", "=", "precs", "?", "precs", ".", "items", ".", "findIndex", "(", "item", "=>", "item", ".", "id", ".", "name", "==", "marker", ".", "id", ".", "name", ")", ":", "-", "1", ";", "if", "(", "index", "<", "0", ")", "this", ".", "raise", "(", "`Reference to unknown precedence: '${", "marker", ".", "id", ".", "name", "}'`", ",", "marker", ".", "id", ".", "start", ")", ";", "let", "prec", "=", "precs", ".", "items", "[", "index", "]", ",", "value", "=", "precs", ".", "items", ".", "length", "-", "index", ";", "if", "(", "prec", ".", "type", "==", "\"cut\"", ")", "{", "here", "=", "here", ".", "join", "(", "new", "Conflicts", "(", "0", ",", "none", ",", "value", ")", ")", ";", "}", "else", "{", "here", "=", "here", ".", "join", "(", "new", "Conflicts", "(", "value", "<<", "2", ")", ")", ";", "atEnd", "=", "atEnd", ".", "join", "(", "new", "Conflicts", "(", "(", "value", "<<", "2", ")", "+", "(", "prec", ".", "type", "==", "\"left\"", "?", "1", ":", "prec", ".", "type", "==", "\"right\"", "?", "-", "1", ":", "0", ")", ")", ")", ";", "}", "}", "}", "return", "{", "here", ",", "atEnd", "}", ";", "}", "raise", "(", "message", ",", "pos", "=", "1", ")", "{", "return", "this", ".", "input", ".", "raise", "(", "message", ",", "pos", ")", ";", "}", "warn", "(", "message", ",", "pos", "=", "-", "1", ")", "{", "let", "msg", "=", "this", ".", "input", ".", "message", "(", "message", ",", "pos", ")", ";", "if", "(", "this", ".", "options", ".", "warn", ")", "this", ".", "options", ".", "warn", "(", "msg", ")", ";", "else", "console", ".", "warn", "(", "msg", ")", ";", "}", "defineRule", "(", "name", ",", "choices", ")", "{", "let", "skip", "=", "this", ".", "currentSkip", "[", "this", ".", "currentSkip", ".", "length", "-", "1", "]", ";", "for", "(", "let", "choice", "of", "choices", ")", "this", ".", "rules", ".", "push", "(", "new", "Rule", "(", "name", ",", "choice", ".", "terms", ",", "choice", ".", "ensureConflicts", "(", ")", ",", "skip", ")", ")", ";", "}", "resolve", "(", "expr", ")", "{", "if", "(", "expr", ".", "namespace", ")", "{", "let", "ns", "=", "this", ".", "namespaces", "[", "expr", ".", "namespace", ".", "name", "]", ";", "if", "(", "!", "ns", ")", "this", ".", "raise", "(", "`Reference to undefined namespace '${", "expr", ".", "namespace", ".", "name", "}'`", ",", "expr", ".", "start", ")", ";", "return", "ns", ".", "resolve", "(", "expr", ",", "this", ")", ";", "}", "else", "{", "for", "(", "let", "built", "of", "this", ".", "built", ")", "if", "(", "built", ".", "matches", "(", "expr", ")", ")", "return", "[", "p", "(", "built", ".", "term", ")", "]", ";", "let", "found", "=", "this", ".", "tokens", ".", "getToken", "(", "expr", ")", ";", "if", "(", "found", ")", "return", "[", "p", "(", "found", ")", "]", ";", "for", "(", "let", "ext", "of", "this", ".", "externalTokens", ")", "{", "let", "found", "=", "ext", ".", "getToken", "(", "expr", ")", ";", "if", "(", "found", ")", "return", "[", "p", "(", "found", ")", "]", ";", "}", "for", "(", "let", "ext", "of", "this", ".", "externalSpecializers", ")", "{", "let", "found", "=", "ext", ".", "getToken", "(", "expr", ")", ";", "if", "(", "found", ")", "return", "[", "p", "(", "found", ")", "]", ";", "}", "let", "known", "=", "this", ".", "astRules", ".", "find", "(", "r", "=>", "r", ".", "rule", ".", "id", ".", "name", "==", "expr", ".", "id", ".", "name", ")", ";", "if", "(", "!", "known", ")", "return", "this", ".", "raise", "(", "`Reference to undefined rule '${", "expr", ".", "id", ".", "name", "}'`", ",", "expr", ".", "start", ")", ";", "if", "(", "known", ".", "rule", ".", "params", ".", "length", "!=", "expr", ".", "args", ".", "length", ")", "this", ".", "raise", "(", "`Wrong number or arguments for '${", "expr", ".", "id", ".", "name", "}'`", ",", "expr", ".", "start", ")", ";", "this", ".", "used", "(", "known", ".", "rule", ".", "id", ".", "name", ")", ";", "return", "[", "p", "(", "this", ".", "buildRule", "(", "known", ".", "rule", ",", "expr", ".", "args", ",", "known", ".", "skip", ")", ")", "]", ";", "}", "}", "normalizeRepeat", "(", "expr", ")", "{", "let", "known", "=", "this", ".", "built", ".", "find", "(", "b", "=>", "b", ".", "matchesRepeat", "(", "expr", ")", ")", ";", "if", "(", "known", ")", "return", "p", "(", "known", ".", "term", ")", ";", "let", "name", "=", "expr", ".", "expr", ".", "prec", "<", "expr", ".", "prec", "?", "`(${", "expr", ".", "expr", "})+`", ":", "`${", "expr", ".", "expr", "}+`", ";", "let", "term", "=", "this", ".", "terms", ".", "makeRepeat", "(", "this", ".", "terms", ".", "uniqueName", "(", "name", ")", ")", ";", "this", ".", "built", ".", "push", "(", "new", "BuiltRule", "(", "\"+\"", ",", "[", "expr", ".", "expr", "]", ",", "term", ")", ")", ";", "this", ".", "defineRule", "(", "term", ",", "this", ".", "normalizeExpr", "(", "expr", ".", "expr", ")", ".", "concat", "(", "p", "(", "term", ",", "term", ")", ")", ")", ";", "return", "p", "(", "term", ")", ";", "}", "normalizeSequence", "(", "expr", ")", "{", "let", "result", "=", "expr", ".", "exprs", ".", "map", "(", "e", "=>", "this", ".", "normalizeExpr", "(", "e", ")", ")", ";", "let", "builder", "=", "this", ";", "function", "complete", "(", "start", ",", "from", ",", "endConflicts", ")", "{", "let", "{", "here", ",", "atEnd", "}", "=", "builder", ".", "conflictsFor", "(", "expr", ".", "markers", "[", "from", "]", ")", ";", "if", "(", "from", "==", "result", ".", "length", ")", "return", "[", "start", ".", "withConflicts", "(", "start", ".", "terms", ".", "length", ",", "here", ".", "join", "(", "endConflicts", ")", ")", "]", ";", "let", "choices", "=", "[", "]", ";", "for", "(", "let", "choice", "of", "result", "[", "from", "]", ")", "{", "for", "(", "let", "full", "of", "complete", "(", "start", ".", "concat", "(", "choice", ")", ".", "withConflicts", "(", "start", ".", "terms", ".", "length", ",", "here", ")", ",", "from", "+", "1", ",", "endConflicts", ".", "join", "(", "atEnd", ")", ")", ")", "choices", ".", "push", "(", "full", ")", ";", "}", "return", "choices", ";", "}", "return", "complete", "(", "Parts", ".", "none", ",", "0", ",", "Conflicts", ".", "none", ")", ";", "}", "normalizeExpr", "(", "expr", ")", "{", "if", "(", "expr", "instanceof", "RepeatExpression", "&&", "expr", ".", "kind", "==", "\"?\"", ")", "{", "return", "[", "Parts", ".", "none", ",", "...", "this", ".", "normalizeExpr", "(", "expr", ".", "expr", ")", "]", ";", "}", "else", "if", "(", "expr", "instanceof", "RepeatExpression", ")", "{", "let", "repeated", "=", "this", ".", "normalizeRepeat", "(", "expr", ")", ";", "return", "expr", ".", "kind", "==", "\"+\"", "?", "[", "repeated", "]", ":", "[", "Parts", ".", "none", ",", "repeated", "]", ";", "}", "else", "if", "(", "expr", "instanceof", "ChoiceExpression", ")", "{", "return", "expr", ".", "exprs", ".", "reduce", "(", "(", "o", ",", "e", ")", "=>", "o", ".", "concat", "(", "this", ".", "normalizeExpr", "(", "e", ")", ")", ",", "[", "]", "as", "Parts", "[", "]", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "SequenceExpression", ")", "{", "return", "this", ".", "normalizeSequence", "(", "expr", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "LiteralExpression", ")", "{", "return", "[", "p", "(", "this", ".", "tokens", ".", "getLiteral", "(", "expr", ")", "!", ")", "]", ";", "}", "else", "if", "(", "expr", "instanceof", "NameExpression", ")", "{", "return", "this", ".", "resolve", "(", "expr", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "SpecializeExpression", ")", "{", "return", "[", "p", "(", "this", ".", "resolveSpecialization", "(", "expr", ")", ")", "]", ";", "}", "else", "if", "(", "expr", "instanceof", "InlineRuleExpression", ")", "{", "return", "[", "p", "(", "this", ".", "buildRule", "(", "expr", ".", "rule", ",", "none", ",", "this", ".", "currentSkip", "[", "this", ".", "currentSkip", ".", "length", "-", "1", "]", ",", "true", ")", ")", "]", ";", "}", "else", "{", "return", "this", ".", "raise", "(", "`This type of expression ('${", "expr", "}') may not occur in non-token rules`", ",", "expr", ".", "start", ")", ";", "}", "}", "buildRule", "(", "rule", ",", "args", ",", "skip", ",", "inline", "=", "false", ")", "{", "let", "expr", "=", "this", ".", "substituteArgs", "(", "rule", ".", "expr", ",", "args", ",", "rule", ".", "params", ")", ";", "let", "{", "name", ":", "nodeName", ",", "props", ",", "dynamicPrec", ",", "inline", ":", "explicitInline", ",", "group", ",", "exported", "}", "=", "this", ".", "nodeInfo", "(", "rule", ".", "props", "||", "none", ",", "inline", "?", "\"pg\"", ":", "\"pgi\"", ",", "rule", ".", "id", ".", "name", ",", "args", ",", "rule", ".", "params", ",", "rule", ".", "expr", ")", ";", "if", "(", "exported", "&&", "rule", ".", "params", ".", "length", ")", "this", ".", "warn", "(", "`Can't export parameterized rules`", ",", "rule", ".", "start", ")", ";", "if", "(", "exported", "&&", "inline", ")", "this", ".", "warn", "(", "`Can't export inline rule`", ",", "rule", ".", "start", ")", ";", "let", "name", "=", "this", ".", "newName", "(", "rule", ".", "id", ".", "name", "+", "(", "args", ".", "length", "?", "\"<\"", "+", "args", ".", "join", "(", "\",\"", ")", "+", "\">\"", ":", "\"\"", ")", ",", "nodeName", "||", "true", ",", "props", ")", ";", "if", "(", "explicitInline", ")", "name", ".", "inline", "=", "true", ";", "if", "(", "dynamicPrec", ")", "this", ".", "registerDynamicPrec", "(", "name", ",", "dynamicPrec", ")", ";", "if", "(", "(", "name", ".", "nodeType", "||", "exported", ")", "&&", "rule", ".", "params", ".", "length", "==", "0", ")", "{", "if", "(", "!", "nodeName", ")", "name", ".", "preserve", "=", "true", ";", "if", "(", "!", "inline", ")", "this", ".", "namedTerms", "[", "exported", "||", "rule", ".", "id", ".", "name", "]", "=", "name", ";", "}", "if", "(", "!", "inline", ")", "this", ".", "built", ".", "push", "(", "new", "BuiltRule", "(", "rule", ".", "id", ".", "name", ",", "args", ",", "name", ")", ")", ";", "this", ".", "currentSkip", ".", "push", "(", "skip", ")", ";", "this", ".", "defineRule", "(", "name", ",", "this", ".", "normalizeExpr", "(", "expr", ")", ")", ";", "this", ".", "currentSkip", ".", "pop", "(", ")", ";", "if", "(", "group", ")", "this", ".", "definedGroups", ".", "push", "(", "{", "name", ",", "group", ",", "rule", "}", ")", ";", "return", "name", ";", "}", "nodeInfo", "(", "props", ",", "allow", ",", "defaultName", "=", "null", ",", "args", "=", "none", ",", "params", "=", "none", ",", "expr", "?", ",", "defaultProps", "?", ")", "{", "let", "result", "=", "{", "}", ";", "let", "name", "=", "defaultName", "&&", "(", "allow", ".", "indexOf", "(", "\"a\"", ")", ">", "-", "1", "||", "!", "ignored", "(", "defaultName", ")", ")", "&&", "!", "/ /", ".", "test", "(", "defaultName", ")", "?", "defaultName", ":", "null", ";", "let", "dialect", "=", "null", ",", "dynamicPrec", "=", "0", ",", "inline", "=", "false", ",", "group", "=", "null", ",", "exported", "=", "null", ";", "for", "(", "let", "prop", "of", "props", ")", "{", "if", "(", "!", "prop", ".", "at", ")", "{", "if", "(", "!", "this", ".", "knownProps", "[", "prop", ".", "name", "]", ")", "{", "let", "builtin", "=", "[", "\"name\"", ",", "\"dialect\"", ",", "\"dynamicPrecedence\"", ",", "\"export\"", ",", "\"isGroup\"", "]", ".", "includes", "(", "prop", ".", "name", ")", "?", "` (did you mean '@${", "prop", ".", "name", "}'?)`", ":", "\"\"", ";", "this", ".", "raise", "(", "`Unknown prop name '${", "prop", ".", "name", "}'${", "builtin", "}`", ",", "prop", ".", "start", ")", ";", "}", "result", "[", "prop", ".", "name", "]", "=", "this", ".", "finishProp", "(", "prop", ",", "args", ",", "params", ")", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"name\"", ")", "{", "name", "=", "this", ".", "finishProp", "(", "prop", ",", "args", ",", "params", ")", ";", "if", "(", "/ /", ".", "test", "(", "name", ")", ")", "this", ".", "raise", "(", "`Node names cannot have spaces ('${", "name", "}')`", ",", "prop", ".", "start", ")", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"dialect\"", ")", "{", "if", "(", "allow", ".", "indexOf", "(", "\"d\"", ")", "<", "0", ")", "this", ".", "raise", "(", "\"Can't specify a dialect on non-token rules\"", ",", "props", "[", "0", "]", ".", "start", ")", ";", "if", "(", "prop", ".", "value", ".", "length", "!=", "1", "&&", "!", "prop", ".", "value", "[", "0", "]", ".", "value", ")", "this", ".", "raise", "(", "\"The '@dialect' rule prop must hold a plain string value\"", ")", ";", "let", "dialectID", "=", "this", ".", "dialects", ".", "indexOf", "(", "prop", ".", "value", "[", "0", "]", ".", "value", "!", ")", ";", "if", "(", "dialectID", "<", "0", ")", "this", ".", "raise", "(", "`Unknown dialect '${", "prop", ".", "value", "[", "0", "]", ".", "value", "}'`", ",", "prop", ".", "value", "[", "0", "]", ".", "start", ")", ";", "dialect", "=", "dialectID", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"dynamicPrecedence\"", ")", "{", "if", "(", "allow", ".", "indexOf", "(", "\"p\"", ")", "<", "0", ")", "this", ".", "raise", "(", "\"Dynamic precedence can only be specified on nonterminals\"", ")", ";", "if", "(", "prop", ".", "value", ".", "length", "!=", "1", "||", "!", "/^-?(?:10|\\d)$/", ".", "test", "(", "prop", ".", "value", "[", "0", "]", ".", "value", "!", ")", ")", "this", ".", "raise", "(", "\"The '@dynamicPrecedence' rule prop must hold an integer between -10 and 10\"", ")", ";", "dynamicPrec", "=", "+", "prop", ".", "value", "[", "0", "]", ".", "value", "!", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"inline\"", ")", "{", "if", "(", "prop", ".", "value", ".", "length", ")", "this", ".", "raise", "(", "\"'@inline' doesn't take a value\"", ",", "prop", ".", "value", "[", "0", "]", ".", "start", ")", ";", "if", "(", "allow", ".", "indexOf", "(", "\"i\"", ")", "<", "0", ")", "this", ".", "raise", "(", "\"Inline can only be specified on nonterminals\"", ")", ";", "inline", "=", "true", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"isGroup\"", ")", "{", "if", "(", "allow", ".", "indexOf", "(", "\"g\"", ")", "<", "0", ")", "this", ".", "raise", "(", "\"'@isGroup' can only be specified on nonterminals\"", ")", ";", "group", "=", "prop", ".", "value", ".", "length", "?", "this", ".", "finishProp", "(", "prop", ",", "args", ",", "params", ")", ":", "defaultName", ";", "}", "else", "if", "(", "prop", ".", "name", "==", "\"export\"", ")", "{", "if", "(", "prop", ".", "value", ".", "length", ")", "exported", "=", "this", ".", "finishProp", "(", "prop", ",", "args", ",", "params", ")", ";", "else", "exported", "=", "defaultName", ";", "}", "else", "{", "this", ".", "raise", "(", "`Unknown built-in prop name '@${", "prop", ".", "name", "}'`", ",", "prop", ".", "start", ")", ";", "}", "}", "if", "(", "expr", "&&", "this", ".", "ast", ".", "autoDelim", "&&", "(", "name", "||", "hasProps", "(", "result", ")", ")", ")", "{", "let", "delim", "=", "this", ".", "findDelimiters", "(", "expr", ")", ";", "if", "(", "delim", ")", "{", "addToProp", "(", "delim", "[", "0", "]", ",", "\"closedBy\"", ",", "delim", "[", "1", "]", ".", "nodeName", "!", ")", ";", "addToProp", "(", "delim", "[", "1", "]", ",", "\"openedBy\"", ",", "delim", "[", "0", "]", ".", "nodeName", "!", ")", ";", "}", "}", "if", "(", "defaultProps", "&&", "hasProps", "(", "defaultProps", ")", ")", "{", "for", "(", "let", "prop", "in", "defaultProps", ")", "if", "(", "!", "(", "prop", "in", "result", ")", ")", "result", "[", "prop", "]", "=", "defaultProps", "[", "prop", "]", ";", "}", "if", "(", "hasProps", "(", "result", ")", "&&", "!", "name", ")", "this", ".", "raise", "(", "`Node has properties but no name`", ",", "props", ".", "length", "?", "props", "[", "0", "]", ".", "start", ":", "expr", "!", ".", "start", ")", ";", "if", "(", "inline", "&&", "(", "hasProps", "(", "result", ")", "||", "dialect", "||", "dynamicPrec", ")", ")", "this", ".", "raise", "(", "`Inline nodes can't have props, dynamic precedence, or a dialect`", ",", "props", "[", "0", "]", ".", "start", ")", ";", "if", "(", "inline", "&&", "name", ")", "name", "=", "null", ";", "return", "{", "name", ",", "props", ":", "result", ",", "dialect", ",", "dynamicPrec", ",", "inline", ",", "group", ",", "exported", "}", ";", "}", "finishProp", "(", "prop", ",", "args", ",", "params", ")", "{", "return", "prop", ".", "value", ".", "map", "(", "part", "=>", "{", "if", "(", "part", ".", "value", ")", "return", "part", ".", "value", ";", "let", "pos", "=", "params", ".", "findIndex", "(", "param", "=>", "param", ".", "name", "==", "part", ".", "name", ")", ";", "if", "(", "pos", "<", "0", ")", "this", ".", "raise", "(", "`Property refers to '${", "part", ".", "name", "}', but no parameter by that name is in scope`", ",", "part", ".", "start", ")", ";", "let", "expr", "=", "args", "[", "pos", "]", ";", "if", "(", "expr", "instanceof", "NameExpression", "&&", "!", "expr", ".", "args", ".", "length", "&&", "!", "expr", ".", "namespace", ")", "return", "expr", ".", "id", ".", "name", ";", "if", "(", "expr", "instanceof", "LiteralExpression", ")", "return", "expr", ".", "value", ";", "return", "this", ".", "raise", "(", "`Expression '${", "expr", "}' can not be used as part of a property value`", ",", "part", ".", "start", ")", ";", "}", ")", ".", "join", "(", "\"\"", ")", ";", "}", "resolveSpecialization", "(", "expr", ")", "{", "let", "type", "=", "expr", ".", "type", ";", "let", "{", "name", ",", "props", ",", "dialect", "}", "=", "this", ".", "nodeInfo", "(", "expr", ".", "props", ",", "\"d\"", ")", ";", "let", "terminal", "=", "this", ".", "normalizeExpr", "(", "expr", ".", "token", ")", ";", "if", "(", "terminal", ".", "length", "!=", "1", "||", "terminal", "[", "0", "]", ".", "terms", ".", "length", "!=", "1", "||", "!", "terminal", "[", "0", "]", ".", "terms", "[", "0", "]", ".", "terminal", ")", "this", ".", "raise", "(", "`The first argument to '${", "type", "}' must resolve to a token`", ",", "expr", ".", "token", ".", "start", ")", ";", "let", "values", ";", "if", "(", "expr", ".", "content", "instanceof", "LiteralExpression", ")", "values", "=", "[", "expr", ".", "content", ".", "value", "]", ";", "else", "if", "(", "(", "expr", ".", "content", "instanceof", "ChoiceExpression", ")", "&&", "expr", ".", "content", ".", "exprs", ".", "every", "(", "e", "=>", "e", "instanceof", "LiteralExpression", ")", ")", "values", "=", "expr", ".", "content", ".", "exprs", ".", "map", "(", "expr", "=>", "(", "expr", "as", "LiteralExpression", ")", ".", "value", ")", ";", "else", "return", "this", ".", "raise", "(", "`The second argument to '${", "expr", ".", "type", "}' must be a literal or choice of literals`", ",", "expr", ".", "content", ".", "start", ")", ";", "let", "term", "=", "terminal", "[", "0", "]", ".", "terms", "[", "0", "]", ",", "token", "=", "null", ";", "let", "table", "=", "this", ".", "specialized", "[", "term", ".", "name", "]", "||", "(", "this", ".", "specialized", "[", "term", ".", "name", "]", "=", "[", "]", ")", ";", "for", "(", "let", "value", "of", "values", ")", "{", "let", "known", "=", "table", ".", "find", "(", "sp", "=>", "sp", ".", "value", "==", "value", ")", ";", "if", "(", "known", "==", "null", ")", "{", "if", "(", "!", "token", ")", "{", "token", "=", "this", ".", "makeTerminal", "(", "term", ".", "name", "+", "\"/\"", "+", "JSON", ".", "stringify", "(", "value", ")", ",", "name", ",", "props", ")", ";", "if", "(", "dialect", "!=", "null", ")", "(", "this", ".", "tokens", ".", "byDialect", "[", "dialect", "]", "||", "(", "this", ".", "tokens", ".", "byDialect", "[", "dialect", "]", "=", "[", "]", ")", ")", ".", "push", "(", "token", ")", ";", "}", "table", ".", "push", "(", "{", "value", ",", "term", ":", "token", ",", "type", ",", "dialect", ",", "name", "}", ")", ";", "this", ".", "tokenOrigins", "[", "token", ".", "name", "]", "=", "{", "spec", ":", "term", "}", ";", "}", "else", "{", "if", "(", "known", ".", "type", "!=", "type", ")", "this", ".", "raise", "(", "`Conflicting specialization types for ${", "JSON", ".", "stringify", "(", "value", ")", "} of ${", "term", ".", "name", "} (${", "type", "} vs ${", "known", ".", "type", "})`", ",", "expr", ".", "start", ")", ";", "if", "(", "known", ".", "dialect", "!=", "dialect", ")", "this", ".", "raise", "(", "`Conflicting dialects for specialization ${", "JSON", ".", "stringify", "(", "value", ")", "} of ${", "term", ".", "name", "}`", ",", "expr", ".", "start", ")", ";", "if", "(", "known", ".", "name", "!=", "name", ")", "this", ".", "raise", "(", "`Conflicting names for specialization ${", "JSON", ".", "stringify", "(", "value", ")", "} of ${", "term", ".", "name", "}`", ",", "expr", ".", "start", ")", ";", "if", "(", "token", "&&", "known", ".", "term", "!=", "token", ")", "this", ".", "raise", "(", "`Conflicting specialization tokens for ${", "JSON", ".", "stringify", "(", "value", ")", "} of ${", "term", ".", "name", "}`", ",", "expr", ".", "start", ")", ";", "token", "=", "known", ".", "term", ";", "}", "}", "return", "token", "!", ";", "}", "findDelimiters", "(", "expr", ")", "{", "if", "(", "!", "(", "expr", "instanceof", "SequenceExpression", ")", "||", "expr", ".", "exprs", ".", "length", "<", "2", ")", "return", "null", ";", "let", "findToken", "=", "(", "expr", ")", ":", "{", "term", ":", "Term", ";", "str", ":", "string", ";", "}", "|", "null", "=>", "{", "if", "(", "expr", "instanceof", "LiteralExpression", ")", "return", "{", "term", ":", "this", ".", "tokens", ".", "getLiteral", "(", "expr", ")", ",", "str", ":", "expr", ".", "value", "}", ";", "if", "(", "expr", "instanceof", "NameExpression", "&&", "expr", ".", "args", ".", "length", "==", "0", ")", "{", "let", "rule", "=", "this", ".", "ast", ".", "rules", ".", "find", "(", "r", "=>", "r", ".", "id", ".", "name", "==", "expr", ".", "id", ".", "name", ")", ";", "if", "(", "rule", ")", "return", "findToken", "(", "rule", ".", "expr", ")", ";", "let", "token", "=", "this", ".", "tokens", ".", "rules", ".", "find", "(", "r", "=>", "r", ".", "id", ".", "name", "==", "expr", ".", "id", ".", "name", ")", ";", "if", "(", "token", "&&", "token", ".", "expr", "instanceof", "LiteralExpression", ")", "return", "{", "term", ":", "this", ".", "tokens", ".", "getToken", "(", "expr", ")", "!", ",", "str", ":", "token", ".", "expr", ".", "value", "}", ";", "}", "return", "null", ";", "}", ";", "let", "lastToken", "=", "findToken", "(", "expr", ".", "exprs", "[", "expr", ".", "exprs", ".", "length", "-", "1", "]", ")", ";", "if", "(", "!", "lastToken", "||", "!", "lastToken", ".", "term", ".", "nodeName", ")", "return", "null", ";", "const", "brackets", "=", "[", "\"()\"", ",", "\"[]\"", ",", "\"{}\"", ",", "\"<>\"", "]", ";", "let", "bracket", "=", "brackets", ".", "find", "(", "b", "=>", "lastToken", "!", ".", "str", ".", "indexOf", "(", "b", "[", "1", "]", ")", ">", "-", "1", "&&", "lastToken", "!", ".", "str", ".", "indexOf", "(", "b", "[", "0", "]", ")", "<", "0", ")", ";", "if", "(", "!", "bracket", ")", "return", "null", ";", "let", "firstToken", "=", "findToken", "(", "expr", ".", "exprs", "[", "0", "]", ")", ";", "if", "(", "!", "firstToken", "||", "!", "firstToken", ".", "term", ".", "nodeName", "||", "firstToken", ".", "str", ".", "indexOf", "(", "bracket", "[", "0", "]", ")", "<", "0", "||", "firstToken", ".", "str", ".", "indexOf", "(", "bracket", "[", "1", "]", ")", ">", "-", "1", ")", "return", "null", ";", "return", "[", "firstToken", ".", "term", ",", "lastToken", ".", "term", "]", ";", "}", "registerDynamicPrec", "(", "term", ",", "prec", ")", "{", "this", ".", "dynamicRulePrecedences", ".", "push", "(", "{", "rule", ":", "term", ",", "prec", "}", ")", ";", "term", ".", "preserve", "=", "true", ";", "}", "defineGroup", "(", "rule", ",", "group", ",", "ast", ")", "{", "let", "recur", "=", "[", "]", ";", "let", "getNamed", "=", "(", "rule", ")", ":", "Term", "[", "]", "=>", "{", "if", "(", "rule", ".", "nodeName", ")", "return", "[", "rule", "]", ";", "if", "(", "recur", ".", "includes", "(", "rule", ")", ")", "this", ".", "raise", "(", "`Rule '${", "ast", ".", "id", ".", "name", "}' cannot define a group because it contains a non-named recursive rule ('${", "rule", ".", "name", "}')`", ",", "ast", ".", "start", ")", ";", "let", "result", "=", "[", "]", ";", "recur", ".", "push", "(", "rule", ")", ";", "for", "(", "let", "r", "of", "this", ".", "rules", ")", "if", "(", "r", ".", "name", "==", "rule", ")", "{", "let", "names", "=", "r", ".", "parts", ".", "map", "(", "getNamed", ")", ".", "filter", "(", "x", "=>", "x", ".", "length", ")", ";", "if", "(", "names", ".", "length", ">", "1", ")", "this", ".", "raise", "(", "`Rule '${", "ast", ".", "id", ".", "name", "}' cannot define a group because some choices produce multiple named nodes`", ",", "ast", ".", "start", ")", ";", "if", "(", "names", ".", "length", "==", "1", ")", "for", "(", "let", "n", "of", "names", "[", "0", "]", ")", "result", ".", "push", "(", "n", ")", ";", "}", "recur", ".", "pop", "(", ")", ";", "return", "result", ";", "}", ";", "for", "(", "let", "name", "of", "getNamed", "(", "rule", ")", ")", "name", ".", "props", "[", "\"group\"", "]", "=", "(", "name", ".", "props", "[", "\"group\"", "]", "?.", "split", "(", "\" \"", ")", "||", "[", "]", ")", ".", "concat", "(", "group", ")", ".", "sort", "(", ")", ".", "join", "(", "\" \"", ")", ";", "}", "checkGroups", "(", ")", "{", "let", "groups", "=", "Object", ".", "create", "(", "null", ")", ",", "nodeNames", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "term", "of", "this", ".", "terms", ".", "terms", ")", "if", "(", "term", ".", "nodeName", ")", "{", "nodeNames", "[", "term", ".", "nodeName", "]", "=", "true", ";", "if", "(", "term", ".", "props", "[", "\"group\"", "]", ")", "for", "(", "let", "group", "of", "term", ".", "props", "[", "\"group\"", "]", ".", "split", "(", "\" \"", ")", ")", "{", ";", "(", "groups", "[", "group", "]", "||", "(", "groups", "[", "group", "]", "=", "[", "]", ")", ")", ".", "push", "(", "term", ")", ";", "}", "}", "let", "names", "=", "Object", ".", "keys", "(", "groups", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "names", ".", "length", ";", "i", "++", ")", "{", "let", "name", "=", "names", "[", "i", "]", ",", "terms", "=", "groups", "[", "name", "]", ";", "if", "(", "nodeNames", "[", "name", "]", ")", "this", ".", "warn", "(", "`Group name '${", "name", "}' conflicts with a node of the same name`", ")", ";", "for", "(", "let", "j", "=", "i", "+", "1", ";", "j", "<", "names", ".", "length", ";", "j", "++", ")", "{", "let", "other", "=", "groups", "[", "names", "[", "j", "]", "]", ";", "if", "(", "terms", ".", "some", "(", "t", "=>", "other", ".", "includes", "(", "t", ")", ")", "&&", "(", "terms", ".", "length", ">", "other", ".", "length", "?", "other", ".", "some", "(", "t", "=>", "!", "terms", ".", "includes", "(", "t", ")", ")", ":", "terms", ".", "some", "(", "t", "=>", "!", "other", ".", "includes", "(", "t", ")", ")", ")", ")", "this", ".", "warn", "(", "`Groups '${", "name", "}' and '${", "names", "[", "j", "]", "}' overlap without one being a superset of the other`", ")", ";", "}", "}", "}", "}", "const", "MinSharedActions", "=", "5", ";", "type", "SharedActions", "=", "{", "actions", ":", "readonly", "(", "Shift", "|", "Reduce", ")", "[", "]", ";", "addr", ":", "number", ";", "}", ";", "class", "FinishStateContext", "{", "sharedActions", ":", "SharedActions", "[", "]", "=", "[", "]", ";", "constructor", "(", "readonly", "tokenizers", ",", "readonly", "data", ",", "readonly", "stateArray", ",", "readonly", "skipData", ",", "readonly", "skipInfo", ",", "readonly", "states", ",", "readonly", "builder", ")", "{", "}", "findSharedActions", "(", "state", ")", "{", "if", "(", "state", ".", "actions", ".", "length", "<", "MinSharedActions", ")", "return", "null", ";", "let", "found", "=", "null", ";", "for", "(", "let", "shared", "of", "this", ".", "sharedActions", ")", "{", "if", "(", "(", "!", "found", "||", "shared", ".", "actions", ".", "length", ">", "found", ".", "actions", ".", "length", ")", "&&", "shared", ".", "actions", ".", "every", "(", "a", "=>", "state", ".", "actions", ".", "some", "(", "b", "=>", "b", ".", "eq", "(", "a", ")", ")", ")", ")", "found", "=", "shared", ";", "}", "if", "(", "found", ")", "return", "found", ";", "let", "max", "=", "null", ",", "scratch", "=", "[", "]", ";", "for", "(", "let", "i", "=", "state", ".", "id", "+", "1", ";", "i", "<", "this", ".", "states", ".", "length", ";", "i", "++", ")", "{", "let", "other", "=", "this", ".", "states", "[", "i", "]", ",", "fill", "=", "0", ";", "if", "(", "other", ".", "defaultReduce", "||", "other", ".", "actions", ".", "length", "<", "MinSharedActions", ")", "continue", ";", "for", "(", "let", "a", "of", "state", ".", "actions", ")", "for", "(", "let", "b", "of", "other", ".", "actions", ")", "if", "(", "a", ".", "eq", "(", "b", ")", ")", "scratch", "[", "fill", "++", "]", "=", "a", ";", "if", "(", "fill", ">=", "MinSharedActions", "&&", "(", "!", "max", "||", "max", ".", "length", "<", "fill", ")", ")", "{", "max", "=", "scratch", ";", "scratch", "=", "[", "]", ";", "}", "}", "if", "(", "!", "max", ")", "return", "null", ";", "let", "result", "=", "{", "actions", ":", "max", ",", "addr", ":", "this", ".", "storeActions", "(", "max", ",", "-", "1", ",", "null", ")", "}", ";", "this", ".", "sharedActions", ".", "push", "(", "result", ")", ";", "return", "result", ";", "}", "storeActions", "(", "actions", ",", "skipReduce", ",", "shared", ")", "{", "if", "(", "skipReduce", "<", "0", "&&", "shared", "&&", "shared", ".", "actions", ".", "length", "==", "actions", ".", "length", ")", "return", "shared", ".", "addr", ";", "let", "data", "=", "[", "]", ";", "for", "(", "let", "action", "of", "actions", ")", "{", "if", "(", "shared", "&&", "shared", ".", "actions", ".", "some", "(", "a", "=>", "a", ".", "eq", "(", "action", ")", ")", ")", "continue", ";", "if", "(", "action", "instanceof", "Shift", ")", "{", "data", ".", "push", "(", "action", ".", "term", ".", "id", ",", "action", ".", "target", ".", "id", ",", "0", ")", ";", "}", "else", "{", "let", "code", "=", "reduceAction", "(", "action", ".", "rule", ",", "this", ".", "skipInfo", ")", ";", "if", "(", "code", "!=", "skipReduce", ")", "data", ".", "push", "(", "action", ".", "term", ".", "id", ",", "code", "&", "Action", ".", "ValueMask", ",", "code", ">>", "16", ")", ";", "}", "}", "data", ".", "push", "(", "Seq", ".", "End", ")", ";", "if", "(", "skipReduce", ">", "-", "1", ")", "data", ".", "push", "(", "Seq", ".", "Other", ",", "skipReduce", "&", "Action", ".", "ValueMask", ",", "skipReduce", ">>", "16", ")", ";", "else", "if", "(", "shared", ")", "data", ".", "push", "(", "Seq", ".", "Next", ",", "shared", ".", "addr", "&", "0xffff", ",", "shared", ".", "addr", ">>", "16", ")", ";", "else", "data", ".", "push", "(", "Seq", ".", "Done", ")", ";", "return", "this", ".", "data", ".", "storeArray", "(", "data", ")", ";", "}", "finish", "(", "state", ",", "isSkip", ",", "forcedReduce", ")", "{", "let", "b", "=", "this", ".", "builder", ";", "let", "skipID", "=", "b", ".", "skipRules", ".", "indexOf", "(", "state", ".", "skip", ")", ";", "let", "skipTable", "=", "this", ".", "skipData", "[", "skipID", "]", ",", "skipTerms", "=", "this", ".", "skipInfo", "[", "skipID", "]", ".", "startTokens", ";", "let", "defaultReduce", "=", "state", ".", "defaultReduce", "?", "reduceAction", "(", "state", ".", "defaultReduce", ",", "this", ".", "skipInfo", ")", ":", "0", ";", "let", "flags", "=", "isSkip", "?", "StateFlag", ".", "Skipped", ":", "0", ";", "let", "skipReduce", "=", "-", "1", ",", "shared", "=", "null", ";", "if", "(", "defaultReduce", "==", "0", ")", "{", "for", "(", "const", "action", "of", "state", ".", "actions", ")", "if", "(", "action", "instanceof", "Reduce", "&&", "action", ".", "term", ".", "eof", "&&", "this", ".", "skipInfo", ".", "some", "(", "i", "=>", "i", ".", "rule", "==", "action", ".", "rule", ".", "name", ")", ")", "skipReduce", "=", "reduceAction", "(", "action", ".", "rule", ",", "this", ".", "skipInfo", ")", ";", "if", "(", "skipReduce", "<", "0", ")", "shared", "=", "this", ".", "findSharedActions", "(", "state", ")", ";", "}", "if", "(", "state", ".", "set", ".", "some", "(", "p", "=>", "p", ".", "rule", ".", "name", ".", "top", "&&", "p", ".", "pos", "==", "p", ".", "rule", ".", "parts", ".", "length", ")", ")", "flags", "|=", "StateFlag", ".", "Accepting", ";", "let", "external", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "actions", ".", "length", "+", "skipTerms", ".", "length", ";", "i", "++", ")", "{", "let", "term", "=", "i", "<", "state", ".", "actions", ".", "length", "?", "state", ".", "actions", "[", "i", "]", ".", "term", ":", "skipTerms", "[", "i", "-", "state", ".", "actions", ".", "length", "]", ";", "for", "(", ";", ";", ")", "{", "let", "orig", "=", "b", ".", "tokenOrigins", "[", "term", ".", "name", "]", ";", "if", "(", "orig", "&&", "orig", ".", "spec", ")", "{", "term", "=", "orig", ".", "spec", ";", "continue", ";", "}", "if", "(", "orig", "&&", "(", "orig", ".", "external", "instanceof", "ExternalTokenSet", ")", ")", "addToSet", "(", "external", ",", "orig", ".", "external", ".", "ast", ")", ";", "break", ";", "}", "}", "external", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "a", ".", "start", "-", "b", ".", "start", ")", ";", "let", "tokenizerMask", "=", "0", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "this", ".", "tokenizers", ".", "length", ";", "i", "++", ")", "{", "let", "tok", "=", "this", ".", "tokenizers", "[", "i", "]", ";", "if", "(", "tok", "instanceof", "ExternalTokenDeclaration", "?", "external", ".", "includes", "(", "tok", ")", ":", "tok", ".", "id", "==", "state", ".", "tokenGroup", ")", "tokenizerMask", "|=", "(", "1", "<<", "i", ")", ";", "}", "let", "base", "=", "state", ".", "id", "*", "ParseState", ".", "Size", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "Flags", "]", "=", "flags", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "Actions", "]", "=", "this", ".", "storeActions", "(", "defaultReduce", "?", "none", ":", "state", ".", "actions", ",", "skipReduce", ",", "shared", ")", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "Skip", "]", "=", "skipTable", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "TokenizerMask", "]", "=", "tokenizerMask", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "DefaultReduce", "]", "=", "defaultReduce", ";", "this", ".", "stateArray", "[", "base", "+", "ParseState", ".", "ForcedReduce", "]", "=", "forcedReduce", ";", "}", "}", "function", "addToProp", "(", "term", ",", "prop", ",", "value", ")", "{", "let", "cur", "=", "term", ".", "props", "[", "prop", "]", ";", "if", "(", "!", "cur", "||", "cur", ".", "split", "(", "\" \"", ")", ".", "indexOf", "(", "value", ")", "<", "0", ")", "term", ".", "props", "[", "prop", "]", "=", "cur", "?", "cur", "+", "\" \"", "+", "value", ":", "value", ";", "}", "function", "buildSpecializeTable", "(", "spec", ")", "{", "let", "table", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "{", "value", ",", "term", ",", "type", "}", "of", "spec", ")", "{", "let", "code", "=", "type", "==", "\"specialize\"", "?", "Specialize", ".", "Specialize", ":", "Specialize", ".", "Extend", ";", "table", "[", "value", "]", "=", "(", "term", ".", "id", "<<", "1", ")", "|", "code", ";", "}", "return", "table", ";", "}", "function", "reduceAction", "(", "rule", ",", "skipInfo", ",", "depth", "=", "rule", ".", "parts", ".", "length", ")", "{", "return", "rule", ".", "name", ".", "id", "|", "Action", ".", "ReduceFlag", "|", "(", "rule", ".", "isRepeatWrap", "&&", "depth", "==", "rule", ".", "parts", ".", "length", "?", "Action", ".", "RepeatFlag", ":", "0", ")", "|", "(", "skipInfo", ".", "some", "(", "i", "=>", "i", ".", "rule", "==", "rule", ".", "name", ")", "?", "Action", ".", "StayFlag", ":", "0", ")", "|", "(", "depth", "<<", "Action", ".", "ReduceDepthShift", ")", ";", "}", "function", "findArray", "(", "data", ",", "value", ")", "{", "search", ":", "for", "(", "let", "i", "=", "0", ";", ";", ")", "{", "let", "next", "=", "data", ".", "indexOf", "(", "value", "[", "0", "]", ",", "i", ")", ";", "if", "(", "next", "==", "-", "1", "||", "next", "+", "value", ".", "length", ">", "data", ".", "length", ")", "break", ";", "for", "(", "let", "j", "=", "1", ";", "j", "<", "value", ".", "length", ";", "j", "++", ")", "{", "if", "(", "value", "[", "j", "]", "!=", "data", "[", "next", "+", "j", "]", ")", "{", "i", "=", "next", "+", "1", ";", "continue", "search", ";", "}", "}", "return", "next", ";", "}", "return", "-", "1", ";", "}", "function", "findSkipStates", "(", "table", ",", "startRules", ")", "{", "let", "nonSkip", "=", "Object", ".", "create", "(", "null", ")", ";", "let", "work", "=", "[", "]", ";", "let", "add", "=", "(", "state", ")", "=>", "{", "if", "(", "!", "nonSkip", "[", "state", ".", "id", "]", ")", "{", "nonSkip", "[", "state", ".", "id", "]", "=", "true", ";", "work", ".", "push", "(", "state", ")", ";", "}", "}", ";", "for", "(", "let", "state", "of", "table", ")", "if", "(", "state", ".", "startRule", "&&", "startRules", ".", "includes", "(", "state", ".", "startRule", ")", ")", "add", "(", "state", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "work", ".", "length", ";", "i", "++", ")", "{", "for", "(", "let", "a", "of", "work", "[", "i", "]", ".", "actions", ")", "if", "(", "a", "instanceof", "Shift", ")", "add", "(", "a", ".", "target", ")", ";", "for", "(", "let", "a", "of", "work", "[", "i", "]", ".", "goto", ")", "add", "(", "a", ".", "target", ")", ";", "}", "return", "(", "id", ")", "=>", "!", "nonSkip", "[", "id", "]", ";", "}", "class", "DataBuilder", "{", "data", ":", "number", "[", "]", "=", "[", "]", ";", "storeArray", "(", "data", ")", "{", "let", "found", "=", "findArray", "(", "this", ".", "data", ",", "data", ")", ";", "if", "(", "found", ">", "-", "1", ")", "return", "found", ";", "let", "pos", "=", "this", ".", "data", ".", "length", ";", "for", "(", "let", "num", "of", "data", ")", "this", ".", "data", ".", "push", "(", "num", ")", ";", "return", "pos", ";", "}", "finish", "(", ")", "{", "return", "Uint16Array", ".", "from", "(", "this", ".", "data", ")", ";", "}", "}", "function", "computeGotoTable", "(", "states", ")", "{", "let", "goto", "=", "{", "}", ";", "let", "maxTerm", "=", "0", ";", "for", "(", "let", "state", "of", "states", ")", "{", "for", "(", "let", "entry", "of", "state", ".", "goto", ")", "{", "maxTerm", "=", "Math", ".", "max", "(", "entry", ".", "term", ".", "id", ",", "maxTerm", ")", ";", "let", "set", "=", "goto", "[", "entry", ".", "term", ".", "id", "]", "||", "(", "goto", "[", "entry", ".", "term", ".", "id", "]", "=", "{", "}", ")", ";", "(", "set", "[", "entry", ".", "target", ".", "id", "]", "||", "(", "set", "[", "entry", ".", "target", ".", "id", "]", "=", "[", "]", ")", ")", ".", "push", "(", "state", ".", "id", ")", ";", "}", "}", "let", "data", "=", "new", "DataBuilder", ";", "let", "index", "=", "[", "]", ";", "let", "offset", "=", "maxTerm", "+", "2", ";", "for", "(", "let", "term", "=", "0", ";", "term", "<=", "maxTerm", ";", "term", "++", ")", "{", "let", "entries", "=", "goto", "[", "term", "]", ";", "if", "(", "!", "entries", ")", "{", "index", ".", "push", "(", "1", ")", ";", "continue", ";", "}", "let", "termTable", "=", "[", "]", ";", "let", "keys", "=", "Object", ".", "keys", "(", "entries", ")", ";", "for", "(", "let", "target", "of", "keys", ")", "{", "let", "list", "=", "entries", "[", "target", "as", "any", "]", ";", "termTable", ".", "push", "(", "(", "target", "==", "keys", "[", "keys", ".", "length", "-", "1", "]", "?", "1", ":", "0", ")", "+", "(", "list", ".", "length", "<<", "1", ")", ")", ";", "termTable", ".", "push", "(", "+", "target", ")", ";", "for", "(", "let", "source", "of", "list", ")", "termTable", ".", "push", "(", "source", ")", ";", "}", "index", ".", "push", "(", "data", ".", "storeArray", "(", "termTable", ")", "+", "offset", ")", ";", "}", "if", "(", "index", ".", "some", "(", "n", "=>", "n", ">", "0xffff", ")", ")", "throw", "new", "GenError", "(", "\"Goto table too large\"", ")", ";", "return", "Uint16Array", ".", "from", "(", "[", "maxTerm", "+", "1", ",", "...", "index", ",", "...", "data", ".", "data", "]", ")", ";", "}", "class", "TokenGroup", "{", "constructor", "(", "readonly", "tokens", ",", "readonly", "id", ")", "{", "}", "}", "function", "addToSet", "<", "T", ">", "(", "set", ",", "value", ")", "{", "if", "(", "!", "set", ".", "includes", "(", "value", ")", ")", "set", ".", "push", "(", "value", ")", ";", "}", "function", "buildTokenMasks", "(", "groups", ")", "{", "let", "masks", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "group", "of", "groups", ")", "{", "let", "groupMask", "=", "1", "<<", "group", ".", "id", ";", "for", "(", "let", "term", "of", "group", ".", "tokens", ")", "{", "masks", "[", "term", ".", "id", "]", "=", "(", "masks", "[", "term", ".", "id", "]", "||", "0", ")", "|", "groupMask", ";", "}", "}", "return", "masks", ";", "}", "interface", "Namespace", "{", "resolve", "(", "expr", ",", "builder", ")", ":", "Parts", "[", "]", ";", "}", "class", "TokenArg", "{", "constructor", "(", "readonly", "name", ",", "readonly", "expr", ",", "readonly", "scope", ")", "{", "}", "}", "class", "BuildingRule", "{", "constructor", "(", "readonly", "name", ",", "readonly", "start", ",", "readonly", "to", ",", "readonly", "args", ")", "{", "}", "}", "class", "TokenSet", "{", "startState", ":", "State", "=", "new", "State", ";", "built", ":", "BuiltRule", "[", "]", "=", "[", "]", ";", "building", ":", "BuildingRule", "[", "]", "=", "[", "]", ";", "rules", ":", "readonly", "RuleDeclaration", "[", "]", ";", "byDialect", ":", "{", "[", "dialect", "]", ":", "Term", "[", "]", ";", "}", "=", "Object", ".", "create", "(", "null", ")", ";", "precedenceRelations", ":", "readonly", "{", "term", ":", "Term", ";", "after", ":", "readonly", "Term", "[", "]", ";", "}", "[", "]", "=", "[", "]", ";", "explicitConflicts", ":", "{", "a", ":", "Term", ";", "b", ":", "Term", ";", "}", "[", "]", "=", "[", "]", ";", "constructor", "(", "readonly", "b", ",", "readonly", "ast", ")", "{", "this", ".", "rules", "=", "ast", "?", "ast", ".", "rules", ":", "none", ";", "for", "(", "let", "rule", "of", "this", ".", "rules", ")", "this", ".", "b", ".", "unique", "(", "rule", ".", "id", ")", ";", "}", "getToken", "(", "expr", ")", "{", "for", "(", "let", "built", "of", "this", ".", "built", ")", "if", "(", "built", ".", "matches", "(", "expr", ")", ")", "return", "built", ".", "term", ";", "let", "name", "=", "expr", ".", "id", ".", "name", ";", "let", "rule", "=", "this", ".", "rules", ".", "find", "(", "r", "=>", "r", ".", "id", ".", "name", "==", "name", ")", ";", "if", "(", "!", "rule", ")", "return", "null", ";", "let", "{", "name", ":", "nodeName", ",", "props", ",", "dialect", ",", "exported", "}", "=", "this", ".", "b", ".", "nodeInfo", "(", "rule", ".", "props", ",", "\"d\"", ",", "name", ",", "expr", ".", "args", ",", "rule", ".", "params", ".", "length", "!=", "expr", ".", "args", ".", "length", "?", "none", ":", "rule", ".", "params", ")", ";", "let", "term", "=", "this", ".", "b", ".", "makeTerminal", "(", "expr", ".", "toString", "(", ")", ",", "nodeName", ",", "props", ")", ";", "if", "(", "dialect", "!=", "null", ")", "(", "this", ".", "byDialect", "[", "dialect", "]", "||", "(", "this", ".", "byDialect", "[", "dialect", "]", "=", "[", "]", ")", ")", ".", "push", "(", "term", ")", ";", "if", "(", "(", "term", ".", "nodeType", "||", "exported", ")", "&&", "rule", ".", "params", ".", "length", "==", "0", ")", "{", "if", "(", "!", "term", ".", "nodeType", ")", "term", ".", "preserve", "=", "true", ";", "this", ".", "b", ".", "namedTerms", "[", "exported", "||", "name", "]", "=", "term", ";", "}", "this", ".", "buildRule", "(", "rule", ",", "expr", ",", "this", ".", "startState", ",", "new", "State", "(", "[", "term", "]", ")", ")", ";", "this", ".", "built", ".", "push", "(", "new", "BuiltRule", "(", "name", ",", "expr", ".", "args", ",", "term", ")", ")", ";", "return", "term", ";", "}", "getLiteral", "(", "expr", ")", "{", "let", "id", "=", "JSON", ".", "stringify", "(", "expr", ".", "value", ")", ";", "for", "(", "let", "built", "of", "this", ".", "built", ")", "if", "(", "built", ".", "id", "==", "id", ")", "return", "built", ".", "term", ";", "let", "name", "=", "null", ",", "props", "=", "{", "}", ",", "dialect", "=", "null", ",", "exported", "=", "null", ";", "let", "decl", "=", "this", ".", "ast", "?", "this", ".", "ast", ".", "literals", ".", "find", "(", "l", "=>", "l", ".", "literal", "==", "expr", ".", "value", ")", ":", "null", ";", "if", "(", "decl", ")", "(", "{", "name", ",", "props", ",", "dialect", ",", "exported", "}", "=", "this", ".", "b", ".", "nodeInfo", "(", "decl", ".", "props", ",", "\"da\"", ",", "expr", ".", "value", ")", ")", ";", "let", "term", "=", "this", ".", "b", ".", "makeTerminal", "(", "id", ",", "name", ",", "props", ")", ";", "if", "(", "dialect", "!=", "null", ")", "(", "this", ".", "byDialect", "[", "dialect", "]", "||", "(", "this", ".", "byDialect", "[", "dialect", "]", "=", "[", "]", ")", ")", ".", "push", "(", "term", ")", ";", "if", "(", "exported", ")", "this", ".", "b", ".", "namedTerms", "[", "exported", "]", "=", "term", ";", "this", ".", "build", "(", "expr", ",", "this", ".", "startState", ",", "new", "State", "(", "[", "term", "]", ")", ",", "none", ")", ";", "this", ".", "built", ".", "push", "(", "new", "BuiltRule", "(", "id", ",", "none", ",", "term", ")", ")", ";", "return", "term", ";", "}", "buildRule", "(", "rule", ",", "expr", ",", "from", ",", "to", ",", "args", "=", "none", ")", "{", "let", "name", "=", "expr", ".", "id", ".", "name", ";", "if", "(", "rule", ".", "params", ".", "length", "!=", "expr", ".", "args", ".", "length", ")", "this", ".", "b", ".", "raise", "(", "`Incorrect number of arguments for token '${", "name", "}'`", ",", "expr", ".", "start", ")", ";", "let", "building", "=", "this", ".", "building", ".", "find", "(", "b", "=>", "b", ".", "name", "==", "name", "&&", "exprsEq", "(", "expr", ".", "args", ",", "b", ".", "args", ")", ")", ";", "if", "(", "building", ")", "{", "if", "(", "building", ".", "to", "==", "to", ")", "{", "from", ".", "nullEdge", "(", "building", ".", "start", ")", ";", "return", ";", "}", "let", "lastIndex", "=", "this", ".", "building", ".", "length", "-", "1", ";", "while", "(", "this", ".", "building", "[", "lastIndex", "]", ".", "name", "!=", "name", ")", "lastIndex", "--", ";", "this", ".", "b", ".", "raise", "(", "`Invalid (non-tail) recursion in token rules: ${", "this", ".", "building", ".", "slice", "(", "lastIndex", ")", ".", "map", "(", "b", "=>", "b", ".", "name", ")", ".", "join", "(", "\" -> \"", ")", "}`", ",", "expr", ".", "start", ")", ";", "}", "this", ".", "b", ".", "used", "(", "rule", ".", "id", ".", "name", ")", ";", "let", "start", "=", "new", "State", ";", "from", ".", "nullEdge", "(", "start", ")", ";", "this", ".", "building", ".", "push", "(", "new", "BuildingRule", "(", "name", ",", "start", ",", "to", ",", "expr", ".", "args", ")", ")", ";", "this", ".", "build", "(", "this", ".", "b", ".", "substituteArgs", "(", "rule", ".", "expr", ",", "expr", ".", "args", ",", "rule", ".", "params", ")", ",", "start", ",", "to", ",", "expr", ".", "args", ".", "map", "(", "(", "e", ",", "i", ")", "=>", "new", "TokenArg", "(", "rule", "!", ".", "params", "[", "i", "]", ".", "name", ",", "e", ",", "args", ")", ")", ")", ";", "this", ".", "building", ".", "pop", "(", ")", ";", "}", "build", "(", "expr", ",", "from", ",", "to", ",", "args", ")", "{", "if", "(", "expr", "instanceof", "NameExpression", ")", "{", "if", "(", "expr", ".", "namespace", ")", "{", "if", "(", "expr", ".", "namespace", ".", "name", "==", "\"std\"", ")", "return", "this", ".", "buildStd", "(", "expr", ",", "from", ",", "to", ")", ";", "this", ".", "b", ".", "raise", "(", "`Unknown namespace '${", "expr", ".", "namespace", ".", "name", "}'`", ",", "expr", ".", "start", ")", ";", "}", "let", "name", "=", "expr", ".", "id", ".", "name", ",", "arg", "=", "args", ".", "find", "(", "a", "=>", "a", ".", "name", "==", "name", ")", ";", "if", "(", "arg", ")", "return", "this", ".", "build", "(", "arg", ".", "expr", ",", "from", ",", "to", ",", "arg", ".", "scope", ")", ";", "let", "rule", "=", "this", ".", "rules", ".", "find", "(", "r", "=>", "r", ".", "id", ".", "name", "==", "name", ")", ";", "if", "(", "!", "rule", ")", "return", "this", ".", "b", ".", "raise", "(", "`Reference to rule '${", "expr", ".", "id", ".", "name", "}', which isn't found in this token group`", ",", "expr", ".", "start", ")", ";", "this", ".", "buildRule", "(", "rule", ",", "expr", ",", "from", ",", "to", ",", "args", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "ChoiceExpression", ")", "{", "for", "(", "let", "choice", "of", "expr", ".", "exprs", ")", "this", ".", "build", "(", "choice", ",", "from", ",", "to", ",", "args", ")", ";", "}", "else", "if", "(", "isEmpty", "(", "expr", ")", ")", "{", "from", ".", "nullEdge", "(", "to", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "SequenceExpression", ")", "{", "let", "conflict", "=", "expr", ".", "markers", ".", "find", "(", "c", "=>", "c", ".", "length", ">", "0", ")", ";", "if", "(", "conflict", ")", "this", ".", "b", ".", "raise", "(", "\"Conflict marker in token expression\"", ",", "conflict", "[", "0", "]", ".", "start", ")", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "expr", ".", "exprs", ".", "length", ";", "i", "++", ")", "{", "let", "next", "=", "i", "==", "expr", ".", "exprs", ".", "length", "-", "1", "?", "to", ":", "new", "State", ";", "this", ".", "build", "(", "expr", ".", "exprs", "[", "i", "]", ",", "from", ",", "next", ",", "args", ")", ";", "from", "=", "next", ";", "}", "}", "else", "if", "(", "expr", "instanceof", "RepeatExpression", ")", "{", "if", "(", "expr", ".", "kind", "==", "\"*\"", ")", "{", "let", "loop", "=", "new", "State", ";", "from", ".", "nullEdge", "(", "loop", ")", ";", "this", ".", "build", "(", "expr", ".", "expr", ",", "loop", ",", "loop", ",", "args", ")", ";", "loop", ".", "nullEdge", "(", "to", ")", ";", "}", "else", "if", "(", "expr", ".", "kind", "==", "\"+\"", ")", "{", "let", "loop", "=", "new", "State", ";", "this", ".", "build", "(", "expr", ".", "expr", ",", "from", ",", "loop", ",", "args", ")", ";", "this", ".", "build", "(", "expr", ".", "expr", ",", "loop", ",", "loop", ",", "args", ")", ";", "loop", ".", "nullEdge", "(", "to", ")", ";", "}", "else", "{", "from", ".", "nullEdge", "(", "to", ")", ";", "this", ".", "build", "(", "expr", ".", "expr", ",", "from", ",", "to", ",", "args", ")", ";", "}", "}", "else", "if", "(", "expr", "instanceof", "SetExpression", ")", "{", "for", "(", "let", "[", "a", ",", "b", "]", "of", "expr", ".", "inverted", "?", "invertRanges", "(", "expr", ".", "ranges", ")", ":", "expr", ".", "ranges", ")", "rangeEdges", "(", "from", ",", "to", ",", "a", ",", "b", ")", ";", "}", "else", "if", "(", "expr", "instanceof", "LiteralExpression", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "expr", ".", "value", ".", "length", ";", "i", "++", ")", "{", "let", "ch", "=", "expr", ".", "value", ".", "charCodeAt", "(", "i", ")", ";", "let", "next", "=", "i", "==", "expr", ".", "value", ".", "length", "-", "1", "?", "to", ":", "new", "State", ";", "from", ".", "edge", "(", "ch", ",", "ch", "+", "1", ",", "next", ")", ";", "from", "=", "next", ";", "}", "}", "else", "if", "(", "expr", "instanceof", "AnyExpression", ")", "{", "from", ".", "edge", "(", "0", ",", "MAX_CHAR", "+", "1", ",", "to", ")", ";", "}", "else", "{", "return", "this", ".", "b", ".", "raise", "(", "`Unrecognized expression type in token`", ",", "(", "expr", "as", "any", ")", ".", "start", ")", ";", "}", "}", "buildStd", "(", "expr", ",", "from", ",", "to", ")", "{", "if", "(", "expr", ".", "args", ".", "length", ")", "this", ".", "b", ".", "raise", "(", "`'std.${", "expr", ".", "id", ".", "name", "}' does not take arguments`", ",", "expr", ".", "args", "[", "0", "]", ".", "start", ")", ";", "if", "(", "!", "STD_RANGES", ".", "hasOwnProperty", "(", "expr", ".", "id", ".", "name", ")", ")", "this", ".", "b", ".", "raise", "(", "`There is no builtin rule 'std.${", "expr", ".", "id", ".", "name", "}'`", ",", "expr", ".", "start", ")", ";", "for", "(", "let", "[", "a", ",", "b", "]", "of", "STD_RANGES", "[", "expr", ".", "id", ".", "name", "]", ")", "from", ".", "edge", "(", "a", ",", "b", ",", "to", ")", ";", "}", "takePrecedences", "(", ")", "{", "let", "rel", "=", "this", ".", "precedenceRelations", "=", "[", "]", ";", "if", "(", "this", ".", "ast", ")", "for", "(", "let", "group", "of", "this", ".", "ast", ".", "precedences", ")", "{", "let", "prev", "=", "[", "]", ";", "for", "(", "let", "item", "of", "group", ".", "items", ")", "{", "let", "level", "=", "[", "]", ";", "if", "(", "item", "instanceof", "NameExpression", ")", "{", "for", "(", "let", "built", "of", "this", ".", "built", ")", "if", "(", "item", ".", "args", ".", "length", "?", "built", ".", "matches", "(", "item", ")", ":", "built", ".", "id", "==", "item", ".", "id", ".", "name", ")", "level", ".", "push", "(", "built", ".", "term", ")", ";", "}", "else", "{", "let", "id", "=", "JSON", ".", "stringify", "(", "item", ".", "value", ")", ",", "found", "=", "this", ".", "built", ".", "find", "(", "b", "=>", "b", ".", "id", "==", "id", ")", ";", "if", "(", "found", ")", "level", ".", "push", "(", "found", ".", "term", ")", ";", "}", "if", "(", "!", "level", ".", "length", ")", "this", ".", "b", ".", "warn", "(", "`Precedence specified for unknown token ${", "item", "}`", ",", "item", ".", "start", ")", ";", "for", "(", "let", "term", "of", "level", ")", "addRel", "(", "rel", ",", "term", ",", "prev", ")", ";", "prev", "=", "prev", ".", "concat", "(", "level", ")", ";", "}", "}", "}", "takeConflicts", "(", ")", "{", "let", "resolve", "=", "(", "expr", ")", "=>", "{", "if", "(", "expr", "instanceof", "NameExpression", ")", "{", "for", "(", "let", "built", "of", "this", ".", "built", ")", "if", "(", "built", ".", "matches", "(", "expr", ")", ")", "return", "built", ".", "term", ";", "}", "else", "{", "let", "id", "=", "JSON", ".", "stringify", "(", "expr", ".", "value", ")", ",", "found", "=", "this", ".", "built", ".", "find", "(", "b", "=>", "b", ".", "id", "==", "id", ")", ";", "if", "(", "found", ")", "return", "found", ".", "term", ";", "}", "this", ".", "b", ".", "warn", "(", "`Precedence specified for unknown token ${", "expr", "}`", ",", "expr", ".", "start", ")", ";", "return", "null", ";", "}", ";", "for", "(", "let", "c", "of", "this", ".", "ast", "?.", "conflicts", "||", "[", "]", ")", "{", "let", "a", "=", "resolve", "(", "c", ".", "a", ")", ",", "b", "=", "resolve", "(", "c", ".", "b", ")", ";", "if", "(", "a", "&&", "b", ")", "{", "if", "(", "a", ".", "id", "<", "b", ".", "id", ")", "[", "a", ",", "b", "]", "=", "[", "b", ",", "a", "]", ";", "this", ".", "explicitConflicts", ".", "push", "(", "{", "a", ",", "b", "}", ")", ";", "}", "}", "}", "precededBy", "(", "a", ",", "b", ")", "{", "let", "found", "=", "this", ".", "precedenceRelations", ".", "find", "(", "r", "=>", "r", ".", "term", "==", "a", ")", ";", "return", "found", "&&", "found", ".", "after", ".", "includes", "(", "b", ")", ";", "}", "buildTokenGroups", "(", "states", ",", "skipInfo", ")", "{", "let", "tokens", "=", "this", ".", "startState", ".", "compile", "(", ")", ";", "if", "(", "tokens", ".", "accepting", ".", "length", ")", "this", ".", "b", ".", "raise", "(", "`Grammar contains zero-length tokens (in '${", "tokens", ".", "accepting", "[", "0", "]", ".", "name", "}')`", ",", "this", ".", "rules", ".", "find", "(", "r", "=>", "r", ".", "id", ".", "name", "==", "tokens", ".", "accepting", "[", "0", "]", ".", "name", ")", "!", ".", "start", ")", ";", "if", "(", "/\\btokens\\b/", ".", "test", "(", "verbose", ")", ")", "console", ".", "log", "(", "tokens", ".", "toString", "(", ")", ")", ";", "let", "allConflicts", "=", "tokens", ".", "findConflicts", "(", "checkTogether", "(", "states", ",", "this", ".", "b", ",", "skipInfo", ")", ")", ".", "filter", "(", "(", "{", "a", ",", "b", "}", ")", "=>", "!", "this", ".", "precededBy", "(", "a", ",", "b", ")", "&&", "!", "this", ".", "precededBy", "(", "b", ",", "a", ")", ")", ";", "for", "(", "let", "{", "a", ",", "b", "}", "of", "this", ".", "explicitConflicts", ")", "{", "if", "(", "!", "allConflicts", ".", "some", "(", "c", "=>", "c", ".", "a", "==", "a", "&&", "c", ".", "b", "==", "b", ")", ")", "allConflicts", ".", "push", "(", "new", "Conflict", "(", "a", ",", "b", ",", "0", ",", "\"\"", ",", "\"\"", ")", ")", ";", "}", "let", "softConflicts", "=", "allConflicts", ".", "filter", "(", "c", "=>", "c", ".", "soft", ")", ",", "conflicts", "=", "allConflicts", ".", "filter", "(", "c", "=>", "!", "c", ".", "soft", ")", ";", "let", "errors", "=", "[", "]", ";", "let", "groups", "=", "[", "]", ";", "for", "(", "let", "state", "of", "states", ")", "{", "if", "(", "state", ".", "defaultReduce", ")", "continue", ";", "let", "terms", "=", "[", "]", ",", "incompatible", "=", "[", "]", ";", "let", "skip", "=", "skipInfo", "[", "this", ".", "b", ".", "skipRules", ".", "indexOf", "(", "state", ".", "skip", ")", "]", ".", "startTokens", ";", "for", "(", "let", "term", "of", "skip", ")", "if", "(", "state", ".", "actions", ".", "some", "(", "a", "=>", "a", ".", "term", "==", "term", ")", ")", "this", ".", "b", ".", "raise", "(", "`Use of token ${", "term", ".", "name", "} conflicts with skip rule`", ")", ";", "let", "stateTerms", "=", "[", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "state", ".", "actions", ".", "length", "+", "(", "skip", "?", "skip", ".", "length", ":", "0", ")", ";", "i", "++", ")", "{", "let", "term", "=", "i", "<", "state", ".", "actions", ".", "length", "?", "state", ".", "actions", "[", "i", "]", ".", "term", ":", "skip", "[", "i", "-", "state", ".", "actions", ".", "length", "]", ";", "let", "orig", "=", "this", ".", "b", ".", "tokenOrigins", "[", "term", ".", "name", "]", ";", "if", "(", "orig", "&&", "orig", ".", "spec", ")", "term", "=", "orig", ".", "spec", ";", "else", "if", "(", "orig", "&&", "orig", ".", "external", ")", "continue", ";", "addToSet", "(", "stateTerms", ",", "term", ")", ";", "}", "if", "(", "stateTerms", ".", "length", "==", "0", ")", "continue", ";", "for", "(", "let", "term", "of", "stateTerms", ")", "{", "for", "(", "let", "conflict", "of", "conflicts", ")", "{", "let", "conflicting", "=", "conflict", ".", "a", "==", "term", "?", "conflict", ".", "b", ":", "conflict", ".", "b", "==", "term", "?", "conflict", ".", "a", ":", "null", ";", "if", "(", "!", "conflicting", ")", "continue", ";", "if", "(", "stateTerms", ".", "includes", "(", "conflicting", ")", "&&", "!", "errors", ".", "some", "(", "e", "=>", "e", ".", "conflict", "==", "conflict", ")", ")", "{", "let", "example", "=", "conflict", ".", "exampleA", "?", "` (example: ${", "JSON", ".", "stringify", "(", "conflict", ".", "exampleA", ")", "}${", "conflict", ".", "exampleB", "?", "` vs ${", "JSON", ".", "stringify", "(", "conflict", ".", "exampleB", ")", "}`", ":", "\"\"", "})`", ":", "\"\"", ";", "errors", ".", "push", "(", "{", "error", ":", "`Overlapping tokens ${", "term", ".", "name", "} and ${", "conflicting", ".", "name", "} used in same context${", "example", "}\\n`", "+", "`After: ${", "state", ".", "set", "[", "0", "]", ".", "trail", "(", ")", "}`", ",", "conflict", "}", ")", ";", "}", "addToSet", "(", "terms", ",", "term", ")", ";", "addToSet", "(", "incompatible", ",", "conflicting", ")", ";", "}", "}", "let", "tokenGroup", "=", "null", ";", "for", "(", "let", "group", "of", "groups", ")", "{", "if", "(", "incompatible", ".", "some", "(", "term", "=>", "group", ".", "tokens", ".", "includes", "(", "term", ")", ")", ")", "continue", ";", "for", "(", "let", "term", "of", "terms", ")", "addToSet", "(", "group", ".", "tokens", ",", "term", ")", ";", "tokenGroup", "=", "group", ";", "break", ";", "}", "if", "(", "!", "tokenGroup", ")", "{", "tokenGroup", "=", "new", "TokenGroup", "(", "terms", ",", "groups", ".", "length", ")", ";", "groups", ".", "push", "(", "tokenGroup", ")", ";", "}", "state", ".", "tokenGroup", "=", "tokenGroup", ".", "id", ";", "}", "if", "(", "errors", ".", "length", ")", "this", ".", "b", ".", "raise", "(", "errors", ".", "map", "(", "e", "=>", "e", ".", "error", ")", ".", "join", "(", "\"\\n\\n\"", ")", ")", ";", "if", "(", "groups", ".", "length", ">", "16", ")", "this", ".", "b", ".", "raise", "(", "`Too many different token groups (${", "groups", ".", "length", "}) to represent them as a 16-bit bitfield`", ")", ";", "let", "precTable", "=", "[", "]", ",", "rel", "=", "this", ".", "precedenceRelations", ".", "slice", "(", ")", ";", "for", "(", "let", "{", "a", ",", "b", ",", "soft", "}", "of", "softConflicts", ")", "if", "(", "soft", ")", "{", "if", "(", "!", "rel", ".", "some", "(", "r", "=>", "r", ".", "term", "==", "a", ")", "||", "!", "rel", ".", "some", "(", "r", "=>", "r", ".", "term", "==", "b", ")", ")", "continue", ";", "if", "(", "soft", "<", "0", ")", "[", "a", ",", "b", "]", "=", "[", "b", ",", "a", "]", ";", "addRel", "(", "rel", ",", "b", ",", "[", "a", "]", ")", ";", "addRel", "(", "rel", ",", "a", ",", "[", "]", ")", ";", "}", "add", ":", "while", "(", "rel", ".", "length", ")", "{", "for", "(", "let", "i", "=", "0", ";", "i", "<", "rel", ".", "length", ";", "i", "++", ")", "{", "let", "record", "=", "rel", "[", "i", "]", ";", "if", "(", "record", ".", "after", ".", "every", "(", "t", "=>", "precTable", ".", "includes", "(", "t", ".", "id", ")", ")", ")", "{", "precTable", ".", "push", "(", "record", ".", "term", ".", "id", ")", ";", "if", "(", "rel", ".", "length", "==", "1", ")", "break", "add", ";", "rel", "[", "i", "]", "=", "rel", ".", "pop", "(", ")", "!", ";", "continue", "add", ";", "}", "}", "this", ".", "b", ".", "raise", "(", "`Cyclic token precedence relation between ${", "rel", ".", "map", "(", "r", "=>", "r", ".", "term", ")", ".", "join", "(", "\", \"", ")", "}`", ")", ";", "}", "precTable", "=", "precTable", ".", "filter", "(", "id", "=>", "allConflicts", ".", "some", "(", "c", "=>", "!", "c", ".", "soft", "&&", "(", "c", ".", "a", ".", "id", "==", "id", "||", "c", ".", "b", ".", "id", "==", "id", ")", ")", ")", ";", "return", "{", "tokenGroups", ":", "groups", ",", "tokenPrec", ":", "precTable", ",", "tokenData", ":", "tokens", ".", "toArray", "(", "buildTokenMasks", "(", "groups", ")", ",", "precTable", ")", "}", ";", "}", "}", "function", "checkTogether", "(", "states", ",", "b", ",", "skipInfo", ")", "{", "let", "cache", "=", "Object", ".", "create", "(", "null", ")", ";", "function", "hasTerm", "(", "state", ",", "term", ")", "{", "return", "state", ".", "actions", ".", "some", "(", "a", "=>", "a", ".", "term", "==", "term", ")", "||", "skipInfo", "[", "b", ".", "skipRules", ".", "indexOf", "(", "state", ".", "skip", ")", "]", ".", "startTokens", ".", "includes", "(", "term", ")", ";", "}", "return", "(", "a", ",", "b", ")", "=>", "{", "if", "(", "a", ".", "id", "<", "b", ".", "id", ")", "[", "a", ",", "b", "]", "=", "[", "b", ",", "a", "]", ";", "let", "key", "=", "a", ".", "id", "|", "(", "b", ".", "id", "<<", "16", ")", ",", "cached", "=", "cache", "[", "key", "]", ";", "if", "(", "cached", "!=", "null", ")", "return", "cached", ";", "return", "cache", "[", "key", "]", "=", "states", ".", "some", "(", "state", "=>", "hasTerm", "(", "state", ",", "a", ")", "&&", "hasTerm", "(", "state", ",", "b", ")", ")", ";", "}", ";", "}", "function", "invertRanges", "(", "ranges", ")", "{", "let", "pos", "=", "0", ",", "result", "=", "[", "]", ";", "for", "(", "let", "[", "a", ",", "b", "]", "of", "ranges", ")", "{", "if", "(", "a", ">", "pos", ")", "result", ".", "push", "(", "[", "pos", ",", "a", "]", ")", ";", "pos", "=", "b", ";", "}", "if", "(", "pos", "<=", "MAX_CODE", ")", "result", ".", "push", "(", "[", "pos", ",", "MAX_CODE", "+", "1", "]", ")", ";", "return", "result", ";", "}", "const", "ASTRAL", "=", "0x10000", ",", "GAP_START", "=", "0xd800", ",", "GAP_END", "=", "0xe000", ",", "MAX_CODE", "=", "0x10ffff", ";", "const", "LOW_SURR_B", "=", "0xdc00", ",", "HIGH_SURR_B", "=", "0xdfff", ";", "function", "rangeEdges", "(", "from", ",", "to", ",", "low", ",", "hi", ")", "{", "if", "(", "low", "<", "GAP_START", "&&", "hi", "==", "MAX_CODE", "+", "1", ")", "{", "from", ".", "edge", "(", "low", ",", "MAX_CHAR", "+", "1", ",", "to", ")", ";", "return", ";", "}", "if", "(", "low", "<", "ASTRAL", ")", "{", "if", "(", "low", "<", "GAP_START", ")", "from", ".", "edge", "(", "low", ",", "Math", ".", "min", "(", "hi", ",", "GAP_START", ")", ",", "to", ")", ";", "if", "(", "hi", ">", "GAP_END", ")", "from", ".", "edge", "(", "Math", ".", "max", "(", "low", ",", "GAP_END", ")", ",", "Math", ".", "min", "(", "hi", ",", "MAX_CHAR", "+", "1", ")", ",", "to", ")", ";", "low", "=", "ASTRAL", ";", "}", "if", "(", "hi", "<", "ASTRAL", ")", "return", ";", "let", "lowStr", "=", "String", ".", "fromCodePoint", "(", "low", ")", ",", "hiStr", "=", "String", ".", "fromCodePoint", "(", "hi", "-", "1", ")", ";", "let", "lowA", "=", "lowStr", ".", "charCodeAt", "(", "0", ")", ",", "lowB", "=", "lowStr", ".", "charCodeAt", "(", "1", ")", ";", "let", "hiA", "=", "hiStr", ".", "charCodeAt", "(", "0", ")", ",", "hiB", "=", "hiStr", ".", "charCodeAt", "(", "1", ")", ";", "if", "(", "lowA", "==", "hiA", ")", "{", "let", "hop", "=", "new", "State", ";", "from", ".", "edge", "(", "lowA", ",", "lowA", "+", "1", ",", "hop", ")", ";", "hop", ".", "edge", "(", "lowB", ",", "hiB", "+", "1", ",", "to", ")", ";", "}", "else", "{", "let", "midStart", "=", "lowA", ",", "midEnd", "=", "hiA", ";", "if", "(", "lowB", ">", "LOW_SURR_B", ")", "{", "midStart", "++", ";", "let", "hop", "=", "new", "State", ";", "from", ".", "edge", "(", "lowA", ",", "lowA", "+", "1", ",", "hop", ")", ";", "hop", ".", "edge", "(", "lowB", ",", "HIGH_SURR_B", "+", "1", ",", "to", ")", ";", "}", "if", "(", "hiB", "<", "HIGH_SURR_B", ")", "{", "midEnd", "--", ";", "let", "hop", "=", "new", "State", ";", "from", ".", "edge", "(", "hiA", ",", "hiA", "+", "1", ",", "hop", ")", ";", "hop", ".", "edge", "(", "LOW_SURR_B", ",", "hiB", "+", "1", ",", "to", ")", ";", "}", "if", "(", "midStart", "<=", "midEnd", ")", "{", "let", "hop", "=", "new", "State", ";", "from", ".", "edge", "(", "midStart", ",", "midEnd", "+", "1", ",", "hop", ")", ";", "hop", ".", "edge", "(", "LOW_SURR_B", ",", "HIGH_SURR_B", "+", "1", ",", "to", ")", ";", "}", "}", "}", "const", "STD_RANGES", "=", "{", "asciiLetter", ":", "[", "[", "65", ",", "91", "]", ",", "[", "97", ",", "123", "]", "]", ",", "asciiLowercase", ":", "[", "[", "97", ",", "123", "]", "]", ",", "asciiUppercase", ":", "[", "[", "65", ",", "91", "]", "]", ",", "digit", ":", "[", "[", "48", ",", "58", "]", "]", ",", "whitespace", ":", "[", "[", "9", ",", "14", "]", ",", "[", "32", ",", "33", "]", ",", "[", "133", ",", "134", "]", ",", "[", "160", ",", "161", "]", ",", "[", "5760", ",", "5761", "]", ",", "[", "8192", ",", "8203", "]", ",", "[", "8232", ",", "8234", "]", ",", "[", "8239", ",", "8240", "]", ",", "[", "8287", ",", "8288", "]", ",", "[", "12288", ",", "12289", "]", "]", "}", ";", "function", "isEmpty", "(", "expr", ")", "{", "return", "expr", "instanceof", "SequenceExpression", "&&", "expr", ".", "exprs", ".", "length", "==", "0", ";", "}", "function", "gatherExtTokens", "(", "b", ",", "tokens", ")", "{", "let", "result", "=", "Object", ".", "create", "(", "null", ")", ";", "for", "(", "let", "token", "of", "tokens", ")", "{", "b", ".", "unique", "(", "token", ".", "id", ")", ";", "let", "{", "name", ",", "props", ",", "dialect", "}", "=", "b", ".", "nodeInfo", "(", "token", ".", "props", ",", "\"d\"", ",", "token", ".", "id", ".", "name", ")", ";", "let", "term", "=", "b", ".", "makeTerminal", "(", "token", ".", "id", ".", "name", ",", "name", ",", "props", ")", ";", "if", "(", "dialect", "!=", "null", ")", "(", "b", ".", "tokens", ".", "byDialect", "[", "dialect", "]", "||", "(", "b", ".", "tokens", ".", "byDialect", "[", "dialect", "]", "=", "[", "]", ")", ")", ".", "push", "(", "term", ")", ";", "b", ".", "namedTerms", "[", "token", ".", "id", ".", "name", "]", "=", "result", "[", "token", ".", "id", ".", "name", "]", "=", "term", ";", "}", "return", "result", ";", "}", "function", "findExtToken", "(", "b", ",", "tokens", ",", "expr", ")", "{", "let", "found", "=", "tokens", "[", "expr", ".", "id", ".", "name", "]", ";", "if", "(", "!", "found", ")", "return", "null", ";", "if", "(", "expr", ".", "args", ".", "length", ")", "b", ".", "raise", "(", "\"External tokens cannot take arguments\"", ",", "expr", ".", "args", "[", "0", "]", ".", "start", ")", ";", "b", ".", "used", "(", "expr", ".", "id", ".", "name", ")", ";", "return", "found", ";", "}", "function", "addRel", "(", "rel", ",", "term", ",", "after", ")", "{", "let", "found", "=", "rel", ".", "findIndex", "(", "r", "=>", "r", ".", "term", "==", "term", ")", ";", "if", "(", "found", "<", "0", ")", "rel", ".", "push", "(", "{", "term", ",", "after", "}", ")", ";", "else", "rel", "[", "found", "]", "=", "{", "term", ",", "after", ":", "rel", "[", "found", "]", ".", "after", ".", "concat", "(", "after", ")", "}", ";", "}", "class", "ExternalTokenSet", "{", "tokens", ":", "{", "[", "name", "]", ":", "Term", ";", "}", ";", "constructor", "(", "readonly", "b", ",", "readonly", "ast", ")", "{", "this", ".", "tokens", "=", "gatherExtTokens", "(", "b", ",", "ast", ".", "tokens", ")", ";", "for", "(", "let", "name", "in", "this", ".", "tokens", ")", "this", ".", "b", ".", "tokenOrigins", "[", "this", ".", "tokens", "[", "name", "]", ".", "name", "]", "=", "{", "external", ":", "this", "}", ";", "}", "getToken", "(", "expr", ")", "{", "return", "findExtToken", "(", "this", ".", "b", ",", "this", ".", "tokens", ",", "expr", ")", ";", "}", "}", "class", "ExternalSpecializer", "{", "term", ":", "Term", "|", "null", "=", "null", ";", "tokens", ":", "{", "[", "name", "]", ":", "Term", ";", "}", ";", "constructor", "(", "readonly", "b", ",", "readonly", "ast", ")", "{", "this", ".", "tokens", "=", "gatherExtTokens", "(", "b", ",", "ast", ".", "tokens", ")", ";", "}", "finish", "(", ")", "{", "let", "terms", "=", "this", ".", "b", ".", "normalizeExpr", "(", "this", ".", "ast", ".", "token", ")", ";", "if", "(", "terms", ".", "length", "!=", "1", "||", "terms", "[", "0", "]", ".", "terms", ".", "length", "!=", "1", "||", "!", "terms", "[", "0", "]", ".", "terms", "[", "0", "]", ".", "terminal", ")", "this", ".", "b", ".", "raise", "(", "`The token expression to '@external ${", "this", ".", "ast", ".", "type", "}' must resolve to a token`", ",", "this", ".", "ast", ".", "token", ".", "start", ")", ";", "this", ".", "term", "=", "terms", "[", "0", "]", ".", "terms", "[", "0", "]", ";", "for", "(", "let", "name", "in", "this", ".", "tokens", ")", "this", ".", "b", ".", "tokenOrigins", "[", "this", ".", "tokens", "[", "name", "]", ".", "name", "]", "=", "{", "spec", ":", "this", ".", "term", ",", "external", ":", "this", "}", ";", "}", "getToken", "(", "expr", ")", "{", "return", "findExtToken", "(", "this", ".", "b", ",", "this", ".", "tokens", ",", "expr", ")", ";", "}", "}", "function", "inlineRules", "(", "rules", ",", "preserve", ")", "{", "for", "(", "let", "pass", "=", "0", ";", ";", "pass", "++", ")", "{", "let", "inlinable", "=", "Object", ".", "create", "(", "null", ")", ",", "found", ";", "if", "(", "pass", "==", "0", ")", "for", "(", "let", "rule", "of", "rules", ")", "{", "if", "(", "rule", ".", "name", ".", "inline", "&&", "!", "inlinable", "[", "rule", ".", "name", ".", "name", "]", ")", "{", "let", "group", "=", "rules", ".", "filter", "(", "r", "=>", "r", ".", "name", "==", "rule", ".", "name", ")", ";", "if", "(", "group", ".", "some", "(", "r", "=>", "r", ".", "parts", ".", "includes", "(", "rule", ".", "name", ")", ")", ")", "continue", ";", "found", "=", "inlinable", "[", "rule", ".", "name", ".", "name", "]", "=", "group", ";", "}", "}", "for", "(", "let", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ";", "i", "++", ")", "{", "let", "rule", "=", "rules", "[", "i", "]", ";", "if", "(", "!", "rule", ".", "name", ".", "interesting", "&&", "!", "rule", ".", "parts", ".", "includes", "(", "rule", ".", "name", ")", "&&", "rule", ".", "parts", ".", "length", "<", "3", "&&", "!", "preserve", ".", "includes", "(", "rule", ".", "name", ")", "&&", "(", "rule", ".", "parts", ".", "length", "==", "1", "||", "rules", ".", "every", "(", "other", "=>", "other", ".", "skip", "==", "rule", ".", "skip", "||", "!", "other", ".", "parts", ".", "includes", "(", "rule", ".", "name", ")", ")", ")", "&&", "!", "rule", ".", "parts", ".", "some", "(", "p", "=>", "!", "!", "inlinable", "[", "p", ".", "name", "]", ")", "&&", "!", "rules", ".", "some", "(", "(", "r", ",", "j", ")", "=>", "j", "!=", "i", "&&", "r", ".", "name", "==", "rule", ".", "name", ")", ")", "found", "=", "inlinable", "[", "rule", ".", "name", ".", "name", "]", "=", "[", "rule", "]", ";", "}", "if", "(", "!", "found", ")", "return", "rules", ";", "let", "newRules", "=", "[", "]", ";", "for", "(", "let", "rule", "of", "rules", ")", "{", "if", "(", "inlinable", "[", "rule", ".", "name", ".", "name", "]", ")", "continue", ";", "if", "(", "!", "rule", ".", "parts", ".", "some", "(", "p", "=>", "!", "!", "inlinable", "[", "p", ".", "name", "]", ")", ")", "{", "newRules", ".", "push", "(", "rule", ")", ";", "continue", ";", "}", "function", "expand", "(", "at", ",", "conflicts", ",", "parts", ")", "{", "if", "(", "at", "==", "rule", ".", "parts", ".", "length", ")", "{", "newRules", ".", "push", "(", "new", "Rule", "(", "rule", ".", "name", ",", "parts", ",", "conflicts", ",", "rule", ".", "skip", ")", ")", ";", "return", ";", "}", "let", "next", "=", "rule", ".", "parts", "[", "at", "]", ",", "replace", "=", "inlinable", "[", "next", ".", "name", "]", ";", "if", "(", "!", "replace", ")", "{", "expand", "(", "at", "+", "1", ",", "conflicts", ".", "concat", "(", "rule", ".", "conflicts", "[", "at", "+", "1", "]", ")", ",", "parts", ".", "concat", "(", "next", ")", ")", ";", "return", ";", "}", "for", "(", "let", "r", "of", "replace", ")", "expand", "(", "at", "+", "1", ",", "conflicts", ".", "slice", "(", "0", ",", "conflicts", ".", "length", "-", "1", ")", ".", "concat", "(", "conflicts", "[", "at", "]", ".", "join", "(", "r", ".", "conflicts", "[", "0", "]", ")", ")", ".", "concat", "(", "r", ".", "conflicts", ".", "slice", "(", "1", ",", "r", ".", "conflicts", ".", "length", "-", "1", ")", ")", ".", "concat", "(", "rule", ".", "conflicts", "[", "at", "+", "1", "]", ".", "join", "(", "r", ".", "conflicts", "[", "r", ".", "conflicts", ".", "length", "-", "1", "]", ")", ")", ",", "parts", ".", "concat", "(", "r", ".", "parts", ")", ")", ";", "}", "expand", "(", "0", ",", "[", "rule", ".", "conflicts", "[", "0", "]", "]", ",", "[", "]", ")", ";", "}", "rules", "=", "newRules", ";", "}", "}", "function", "mergeRules", "(", "rules", ")", "{", "let", "merged", "=", "Object", ".", "create", "(", "null", ")", ",", "found", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "rules", ".", "length", ";", ")", "{", "let", "groupStart", "=", "i", ";", "let", "name", "=", "rules", "[", "i", "++", "]", ".", "name", ";", "while", "(", "i", "<", "rules", ".", "length", "&&", "rules", "[", "i", "]", ".", "name", "==", "name", ")", "i", "++", ";", "let", "size", "=", "i", "-", "groupStart", ";", "if", "(", "name", ".", "interesting", ")", "continue", ";", "for", "(", "let", "j", "=", "i", ";", "j", "<", "rules", ".", "length", ";", ")", "{", "let", "otherStart", "=", "j", ",", "otherName", "=", "rules", "[", "j", "++", "]", ".", "name", ";", "while", "(", "j", "<", "rules", ".", "length", "&&", "rules", "[", "j", "]", ".", "name", "==", "otherName", ")", "j", "++", ";", "if", "(", "j", "-", "otherStart", "!=", "size", "||", "otherName", ".", "interesting", ")", "continue", ";", "let", "match", "=", "true", ";", "for", "(", "let", "k", "=", "0", ";", "k", "<", "size", "&&", "match", ";", "k", "++", ")", "{", "let", "a", "=", "rules", "[", "groupStart", "+", "k", "]", ",", "b", "=", "rules", "[", "otherStart", "+", "k", "]", ";", "if", "(", "a", ".", "cmpNoName", "(", "b", ")", "!=", "0", ")", "match", "=", "false", ";", "}", "if", "(", "match", ")", "found", "=", "merged", "[", "name", ".", "name", "]", "=", "otherName", ";", "}", "}", "if", "(", "!", "found", ")", "return", "rules", ";", "let", "newRules", "=", "[", "]", ";", "for", "(", "let", "rule", "of", "rules", ")", "if", "(", "!", "merged", "[", "rule", ".", "name", ".", "name", "]", ")", "{", "newRules", ".", "push", "(", "rule", ".", "parts", ".", "every", "(", "p", "=>", "!", "merged", "[", "p", ".", "name", "]", ")", "?", "rule", ":", "new", "Rule", "(", "rule", ".", "name", ",", "rule", ".", "parts", ".", "map", "(", "p", "=>", "merged", "[", "p", ".", "name", "]", "||", "p", ")", ",", "rule", ".", "conflicts", ",", "rule", ".", "skip", ")", ")", ";", "}", "return", "newRules", ";", "}", "function", "simplifyRules", "(", "rules", ",", "preserve", ")", "{", "return", "mergeRules", "(", "inlineRules", "(", "rules", ",", "preserve", ")", ")", ";", "}", "export", "function", "buildParser", "(", "text", ",", "options", "=", "{", "}", ")", "{", "let", "builder", "=", "new", "Builder", "(", "text", ",", "options", ")", ",", "parser", "=", "builder", ".", "getParser", "(", ")", ";", "(", "parser", "as", "any", ")", ".", "termTable", "=", "builder", ".", "termTable", ";", "return", "parser", ";", "}", "const", "KEYWORDS", "=", "[", "\"break\"", ",", "\"case\"", ",", "\"catch\"", ",", "\"continue\"", ",", "\"debugger\"", ",", "\"default\"", ",", "\"do\"", ",", "\"else\"", ",", "\"finally\"", ",", "\"for\"", ",", "\"function\"", ",", "\"if\"", ",", "\"return\"", ",", "\"switch\"", ",", "\"throw\"", ",", "\"try\"", ",", "\"var\"", ",", "\"while\"", ",", "\"with\"", ",", "\"null\"", ",", "\"true\"", ",", "\"false\"", ",", "\"instanceof\"", ",", "\"typeof\"", ",", "\"void\"", ",", "\"delete\"", ",", "\"new\"", ",", "\"in\"", ",", "\"this\"", ",", "\"const\"", ",", "\"class\"", ",", "\"extends\"", ",", "\"export\"", ",", "\"import\"", ",", "\"super\"", ",", "\"enum\"", ",", "\"implements\"", ",", "\"interface\"", ",", "\"let\"", ",", "\"package\"", ",", "\"private\"", ",", "\"protected\"", ",", "\"public\"", ",", "\"static\"", ",", "\"yield\"", "]", ";", "export", "function", "buildParserFile", "(", "text", ",", "options", "=", "{", "}", ")", "{", "return", "new", "Builder", "(", "text", ",", "options", ")", ".", "getParserFile", "(", ")", ";", "}", "function", "ignored", "(", "name", ")", "{", "let", "first", "=", "name", "[", "0", "]", ";", "return", "first", "==", "\"_\"", "||", "first", ".", "toUpperCase", "(", ")", "!=", "first", ";", "}", "function", "isExported", "(", "rule", ")", "{", "return", "rule", ".", "props", ".", "some", "(", "p", "=>", "p", ".", "at", "&&", "p", ".", "name", "==", "\"export\"", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 225, null, null, null, 19651, null, 19651, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19651, null, 3, null, 14834, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19651, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 229, null, null, null, 8, null, 37591, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 892, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, 1180, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, null, null, null, null, 32, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 3, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, 5, null, null, null, null, null, 0, null, null, null, 5, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 11, null, null, null, null, null, null, null, null, null, null, 366, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 349, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 2, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 2, null, 2, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 4, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 6, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 2, null, 2, null, 32, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 8, null, 3, null, 3, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4668, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 14834, null, null, null, null, null, 14834, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 229, null, 5, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19651, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 37591, null, null, null, null, null, null, null, null, null, null, 1180, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19651, null, 0, null, null, null, 35093, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 37592, null, null, null, 5, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 19651, null, 3, null, 14834, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 19651, null, null, null, null, null, null, null, null, null, null, 19651, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19651, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 16516, null, null, null, 229, null, 8, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, 32, null, null, null, null, 32, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 8, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 4668, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 4668, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 140, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 229, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 229, null, 2, null, 16516, null, null, null, 5, null, null, null, null, null, 5, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 6, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 0, null, null, 366, null, null, null, null, null, null, null, null, null, null, null, 715, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 0, null, 8, null, 3, null, null, null, 715, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1653, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 229, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 5, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 277, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 5, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 4, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 5, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 701, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 701, null, null, null, null, null, 6, null, null, null, null, null, 3, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, 25941, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, 5, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, 3, null, null, null, null, null, 4, null, null, null, null, 5, null, 11, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 5, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 31899, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37591, null, 715, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 38, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 715, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 37591, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 5092, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 16516, null, 37591, null, 38, null, 38, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 71, null, 38, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 0, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 37591, null, 38, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, 35093, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 229, null, 229, null, null, null, 6, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 16516, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8714, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 8714, null, null, null, null, null, null, 5, null, null, null, null, null, 8714, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, 8714, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31899, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, 8714, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, 715, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, 8, null, 0, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, 3, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, 3, null, null, null, 3, null, null, null, null, 3, null, null, null, 3, null, null, null, null, 4, null, 38, null, 38, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 38, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 71, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 715, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 715, null, 6, null, 37591, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 5, null, 229, null, null, null, null, null, 3, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 715, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 37591, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 715, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, 37591, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 277, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 229, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, 2, null, 892, null, null, null, null, null, null, 715, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 2, null, 892, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 16516, null, null, null, null, null, null, null, null, null, 4668, null, null, null, null, null, null, null, null, null, null, null, null, null ]
9
[ "import", "{", "buildParserFile", ",", "GenError", "}", "from", "\"..\"", ";", "let", "file", "=", "undefined", ",", "out", "=", "undefined", ",", "moduleStyle", "=", "\"es\"", ",", "includeNames", "=", "false", ",", "exportName", "=", "undefined", ",", "noTerms", "=", "false", ";", "let", "{", "writeFileSync", ",", "readFileSync", "}", "=", "require", "(", "\"fs\"", ")", ";", "const", "usage", "=", "\"Usage: build-parser [--cjs] [--names] [--noTerms] [--output outfile] [--export name] file\"", ";", "for", "(", "let", "i", "=", "2", ";", "i", "<", "process", ".", "argv", ".", "length", ";", ")", "{", "let", "arg", "=", "process", ".", "argv", "[", "i", "++", "]", ";", "if", "(", "!", "/^-/", ".", "test", "(", "arg", ")", ")", "{", "if", "(", "file", ")", "error", "(", "\"Multiple input files given\"", ")", ";", "file", "=", "arg", ";", "}", "else", "if", "(", "arg", "==", "\"--help\"", ")", "{", "console", ".", "log", "(", "usage", ")", ";", "process", ".", "exit", "(", "0", ")", ";", "}", "else", "if", "(", "arg", "==", "\"--cjs\"", ")", "{", "moduleStyle", "=", "\"cjs\"", ";", "}", "else", "if", "(", "arg", "==", "\"-o\"", "||", "arg", "==", "\"--output\"", ")", "{", "if", "(", "out", ")", "error", "(", "\"Multiple output files given\"", ")", ";", "out", "=", "process", ".", "argv", "[", "i", "++", "]", ";", "}", "else", "if", "(", "arg", "==", "\"--names\"", ")", "{", "includeNames", "=", "true", ";", "}", "else", "if", "(", "arg", "==", "\"--export\"", ")", "{", "exportName", "=", "process", ".", "argv", "[", "i", "++", "]", ";", "}", "else", "if", "(", "arg", "==", "\"--noTerms\"", ")", "{", "noTerms", "=", "true", ";", "}", "else", "{", "error", "(", "\"Unrecognized option \"", "+", "arg", ")", ";", "}", "}", "if", "(", "!", "file", ")", "error", "(", "\"No input file given\"", ")", ";", "function", "error", "(", "msg", ")", "{", "console", ".", "error", "(", "msg", ")", ";", "console", ".", "log", "(", "usage", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", "let", "parser", ",", "terms", ";", "try", "{", ";", "(", "{", "parser", ",", "terms", "}", "=", "buildParserFile", "(", "readFileSync", "(", "file", ",", "\"utf8\"", ")", ",", "{", "fileName", ":", "file", ",", "moduleStyle", ",", "includeNames", ",", "exportName", "}", ")", ")", ";", "}", "catch", "(", "e", ")", "{", "console", ".", "error", "(", "e", "instanceof", "GenError", "?", "e", ".", "message", ":", "e", ".", "stack", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", "if", "(", "out", ")", "{", "let", "ext", "=", "/^(.*)\\.(c?js|ts|esm?)$/", ".", "exec", "(", "out", ")", ";", "let", "[", "parserFile", ",", "termFile", "]", "=", "ext", "?", "[", "out", ",", "ext", "[", "1", "]", "+", "\".terms.\"", "+", "ext", "[", "2", "]", "]", ":", "[", "out", "+", "\".js\"", ",", "out", "+", "\".terms.js\"", "]", ";", "writeFileSync", "(", "parserFile", ",", "parser", ")", ";", "if", "(", "!", "noTerms", ")", "writeFileSync", "(", "termFile", ",", "terms", ")", ";", "console", ".", "log", "(", "`Wrote ${", "parserFile", "}${", "noTerms", "?", "\"\"", ":", "` and ${", "termFile", "}`", "}`", ")", ";", "}", "else", "{", "console", ".", "log", "(", "parser", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, 8, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
10
[ "import", "{", "Tree", ",", "NodeType", ",", "NodeProp", ",", "Parser", "}", "from", "\"@lezer/common\"", ";", "const", "none", "=", "[", "]", ";", "class", "TestSpec", "{", "constructor", "(", "readonly", "name", ",", "readonly", "props", ",", "readonly", "children", "=", "none", ",", "readonly", "wildcard", "=", "false", ")", "{", "}", "static", "parse", "(", "spec", ")", "{", "let", "pos", "=", "0", ",", "tok", "=", "\"sof\"", ",", "value", "=", "\"\"", ";", "function", "err", "(", ")", "{", "throw", "new", "SyntaxError", "(", "\"Invalid test spec: \"", "+", "spec", ")", ";", "}", "function", "next", "(", ")", "{", "while", "(", "pos", "<", "spec", ".", "length", "&&", "/\\s/", ".", "test", "(", "spec", ".", "charAt", "(", "pos", ")", ")", ")", "pos", "++", ";", "if", "(", "pos", "==", "spec", ".", "length", ")", "return", "tok", "=", "\"eof\"", ";", "let", "next", "=", "spec", ".", "charAt", "(", "pos", "++", ")", ";", "if", "(", "next", "==", "\"(\"", "&&", "spec", ".", "slice", "(", "pos", ",", "pos", "+", "4", ")", "==", "\"...)\"", ")", "{", "pos", "+=", "4", ";", "return", "tok", "=", "\"...\"", ";", "}", "if", "(", "/[\\[\\](),=]/", ".", "test", "(", "next", ")", ")", "return", "tok", "=", "next", ";", "if", "(", "/[^()\\[\\],=\"\\s]/", ".", "test", "(", "next", ")", ")", "{", "let", "name", "=", "/[^()\\[\\],=\"\\s]*/", ".", "exec", "(", "spec", ".", "slice", "(", "pos", "-", "1", ")", ")", ";", "value", "=", "name", "!", "[", "0", "]", ";", "pos", "+=", "name", "!", "[", "0", "]", ".", "length", "-", "1", ";", "return", "tok", "=", "\"name\"", ";", "}", "if", "(", "next", "==", "'\"'", ")", "{", "let", "content", "=", "/^\"((?:[^\\\\\"]|\\\\.)*)\"/", ".", "exec", "(", "spec", ".", "slice", "(", "pos", "-", "1", ")", ")", "||", "err", "(", ")", ";", "value", "=", "JSON", ".", "parse", "(", "content", "[", "0", "]", ")", ";", "pos", "+=", "content", "[", "0", "]", ".", "length", "-", "1", ";", "return", "tok", "=", "\"name\"", ";", "}", "return", "err", "(", ")", ";", "}", "next", "(", ")", ";", "function", "parseSeq", "(", ")", "{", "let", "seq", "=", "[", "]", ";", "while", "(", "tok", "!=", "\"eof\"", "&&", "tok", "!=", "\")\"", ")", "{", "seq", ".", "push", "(", "parse", "(", ")", ")", ";", "if", "(", "tok", "==", "\",\"", ")", "next", "(", ")", ";", "}", "return", "seq", ";", "}", "function", "parse", "(", ")", "{", "let", "name", "=", "value", ",", "children", "=", "none", ",", "props", "=", "[", "]", ",", "wildcard", "=", "false", ";", "if", "(", "tok", "!=", "\"name\"", ")", "err", "(", ")", ";", "next", "(", ")", ";", "if", "(", "tok", "as", "any", "==", "\"[\"", ")", "{", "next", "(", ")", ";", "while", "(", "tok", "as", "any", "!=", "\"]\"", ")", "{", "if", "(", "tok", "as", "any", "!=", "\"name\"", ")", "err", "(", ")", ";", "let", "prop", "=", "(", "NodeProp", "as", "any", ")", "[", "value", "]", "as", "NodeProp", "<", "any", ">", ",", "val", "=", "\"\"", ";", "if", "(", "!", "(", "prop", "instanceof", "NodeProp", ")", ")", "err", "(", ")", ";", "next", "(", ")", ";", "if", "(", "tok", "as", "any", "==", "\"=\"", ")", "{", "next", "(", ")", ";", "if", "(", "tok", "as", "any", "!=", "\"name\"", ")", "err", "(", ")", ";", "val", "=", "value", ";", "next", "(", ")", ";", "}", "props", ".", "push", "(", "{", "prop", ",", "value", ":", "prop", ".", "deserialize", "(", "val", ")", "}", ")", ";", "}", "next", "(", ")", ";", "}", "if", "(", "tok", "as", "any", "==", "\"(\"", ")", "{", "next", "(", ")", ";", "children", "=", "parseSeq", "(", ")", ";", "if", "(", "tok", "!=", "\")\"", ")", "err", "(", ")", ";", "next", "(", ")", ";", "}", "else", "if", "(", "tok", "as", "any", "==", "\"...\"", ")", "{", "wildcard", "=", "true", ";", "next", "(", ")", ";", "}", "return", "new", "TestSpec", "(", "name", ",", "props", ",", "children", ",", "wildcard", ")", ";", "}", "let", "result", "=", "parseSeq", "(", ")", ";", "if", "(", "tok", "!=", "\"eof\"", ")", "err", "(", ")", ";", "return", "result", ";", "}", "matches", "(", "type", ")", "{", "if", "(", "type", ".", "name", "!=", "this", ".", "name", ")", "return", "false", ";", "for", "(", "let", "{", "prop", ",", "value", "}", "of", "this", ".", "props", ")", "if", "(", "(", "value", "||", "type", ".", "prop", "(", "prop", ")", ")", "&&", "JSON", ".", "stringify", "(", "type", ".", "prop", "(", "prop", ")", ")", "!=", "JSON", ".", "stringify", "(", "value", ")", ")", "return", "false", ";", "return", "true", ";", "}", "}", "function", "defaultIgnore", "(", "type", ")", "{", "return", "/\\W/", ".", "test", "(", "type", ".", "name", ")", ";", "}", "export", "function", "testTree", "(", "tree", ",", "expect", ",", "mayIgnore", "=", "defaultIgnore", ")", "{", "let", "specs", "=", "TestSpec", ".", "parse", "(", "expect", ")", ";", "let", "stack", "=", "[", "specs", "]", ",", "pos", "=", "[", "0", "]", ";", "tree", ".", "iterate", "(", "{", "enter", "(", "type", ",", "start", ")", "{", "if", "(", "!", "type", ".", "name", ")", "return", ";", "let", "last", "=", "stack", ".", "length", "-", "1", ",", "index", "=", "pos", "[", "last", "]", ",", "seq", "=", "stack", "[", "last", "]", ";", "let", "next", "=", "index", "<", "seq", ".", "length", "?", "seq", "[", "index", "]", ":", "null", ";", "if", "(", "next", "&&", "next", ".", "matches", "(", "type", ")", ")", "{", "if", "(", "next", ".", "wildcard", ")", "{", "pos", "[", "last", "]", "++", ";", "return", "false", ";", "}", "pos", ".", "push", "(", "0", ")", ";", "stack", ".", "push", "(", "next", ".", "children", ")", ";", "return", "undefined", ";", "}", "else", "if", "(", "mayIgnore", "(", "type", ")", ")", "{", "return", "false", ";", "}", "else", "{", "let", "parent", "=", "last", ">", "0", "?", "stack", "[", "last", "-", "1", "]", "[", "pos", "[", "last", "-", "1", "]", "]", ".", "name", ":", "\"tree\"", ";", "let", "after", "=", "next", "?", "next", ".", "name", "+", "(", "parent", "==", "\"tree\"", "?", "\"\"", ":", "\" in \"", "+", "parent", ")", ":", "`end of ${", "parent", "}`", ";", "throw", "new", "Error", "(", "`Expected ${", "after", "}, got ${", "type", ".", "name", "} at ${", "start", "} \\n${", "tree", "}`", ")", ";", "}", "}", ",", "leave", "(", "type", ",", "start", ")", "{", "if", "(", "!", "type", ".", "name", ")", "return", ";", "let", "last", "=", "stack", ".", "length", "-", "1", ",", "index", "=", "pos", "[", "last", "]", ",", "seq", "=", "stack", "[", "last", "]", ";", "if", "(", "index", "<", "seq", ".", "length", ")", "throw", "new", "Error", "(", "`Unexpected end of ${", "type", ".", "name", "}. Expected ${", "seq", ".", "slice", "(", "index", ")", ".", "map", "(", "s", "=>", "s", ".", "name", ")", ".", "join", "(", "\", \"", ")", "} at ${", "start", "}\\n${", "tree", "}`", ")", ";", "pos", ".", "pop", "(", ")", ";", "stack", ".", "pop", "(", ")", ";", "pos", "[", "last", "-", "1", "]", "++", ";", "}", "}", ")", ";", "if", "(", "pos", "[", "0", "]", "!=", "specs", ".", "length", ")", "throw", "new", "Error", "(", "`Unexpected end of tree. Expected ${", "stack", "[", "0", "]", ".", "slice", "(", "pos", "[", "0", "]", ")", ".", "map", "(", "s", "=>", "s", ".", "name", ")", ".", "join", "(", "\", \"", ")", "} at ${", "tree", ".", "length", "}\\n${", "tree", "}`", ")", ";", "}", "param", "{", "string", "}", "file", "param", "{", "number", "}", "index", "function", "toLineContext", "(", "file", ",", "index", ")", "{", "const", "endEol", "=", "file", ".", "indexOf", "(", "'\\n'", ",", "index", "+", "80", ")", ";", "const", "endIndex", "=", "endEol", "===", "-", "1", "?", "file", ".", "length", ":", "endEol", ";", "return", "file", ".", "substring", "(", "index", ",", "endIndex", ")", ".", "split", "(", "/\\n/", ")", ".", "map", "(", "str", "=>", "' | '", "+", "str", ")", ".", "join", "(", "'\\n'", ")", ";", "}", "export", "function", "fileTests", "(", "file", ",", "fileName", ",", "mayIgnore", "=", "defaultIgnore", ")", "{", "let", "caseExpr", "=", "/\\s*#\\s*(.*)(?:\\r\\n|\\r|\\n)([^]*?)==+>([^]*?)(?:$|(?:\\r\\n|\\r|\\n)+(?=#))/gy", ";", "let", "tests", "=", "[", "]", ";", "let", "lastIndex", "=", "0", ";", "for", "(", ";", ";", ")", "{", "let", "m", "=", "caseExpr", ".", "exec", "(", "file", ")", ";", "if", "(", "!", "m", ")", "throw", "new", "Error", "(", "`Unexpected file format in ${", "fileName", "} around\\n\\n${", "toLineContext", "(", "file", ",", "lastIndex", ")", "}`", ")", ";", "let", "[", ",", "name", ",", "configStr", "]", "=", "/(.*?)(\\{.*?\\})?$/", ".", "exec", "(", "m", "[", "1", "]", ")", "!", ";", "let", "config", "=", "configStr", "?", "JSON", ".", "parse", "(", "configStr", ")", ":", "null", ";", "let", "text", "=", "m", "[", "2", "]", ".", "trim", "(", ")", ",", "expected", "=", "m", "[", "3", "]", ";", "tests", ".", "push", "(", "{", "name", ",", "run", "(", "parser", ")", "{", "let", "strict", "=", "!", "/⚠|\\.\\.\\./", ".", "test", "(", "expected", ")", ";", "if", "(", "(", "parser", "as", "any", ")", ".", "configure", "&&", "(", "strict", "||", "config", ")", ")", "parser", "=", "(", "parser", "as", "any", ")", ".", "configure", "(", "{", "strict", ",", "...", "config", "}", ")", ";", "testTree", "(", "parser", ".", "parse", "(", "text", ")", ",", "expected", ",", "mayIgnore", ")", ";", "}", "}", ")", ";", "lastIndex", "=", "m", ".", "index", "+", "m", "[", "0", "]", ".", "length", ";", "if", "(", "lastIndex", "==", "file", ".", "length", ")", "break", ";", "}", "return", "tests", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 5, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, 2, null, null, null, 3, null, null, null, 2, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25943, null, null, null, null, 2, null, null, null, null, null, null, null, 5, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 871, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 871, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 367, null, 2, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 8, null, 871, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25943, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 871, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25943, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25943, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 3, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 2, null, 2, null, 8, null, null, null, null, null, 27, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
11
[ "import", "{", "buildParser", "}", "from", "\"../dist/index.js\"", ";", "import", "{", "NodeProp", "}", "from", "\"@lezer/common\"", ";", "import", "{", "LRParser", ",", "ExternalTokenizer", ",", "InputStream", "}", "from", "\"@lezer/lr\"", ";", "import", "{", "fileTests", "}", "from", "\"../dist/test.js\"", ";", "import", "ist", "from", "\"ist\"", ";", "import", "*", "as", "fs", "from", "\"fs\"", ";", "import", "*", "as", "path", "from", "\"path\"", ";", "import", "{", "fileURLToPath", "}", "from", "\"url\"", ";", "let", "caseDir", "=", "path", ".", "join", "(", "path", ".", "dirname", "(", "fileURLToPath", "(", "import", ".", "meta", ".", "url", ")", ")", ",", "\"cases\"", ")", ";", "function", "externalTokenizer", "(", "name", ",", "terms", ")", "{", "if", "(", "name", "==", "\"ext1\"", ")", "return", "new", "ExternalTokenizer", "(", "(", "input", ")", "=>", "{", "if", "(", "input", ".", "next", "==", "\"{\"", ".", "charCodeAt", "(", "0", ")", ")", "{", "input", ".", "advance", "(", ")", ";", "input", ".", "acceptToken", "(", "terms", ".", "braceOpen", ")", ";", "}", "else", "if", "(", "input", ".", "next", "==", "\"}\"", ".", "charCodeAt", "(", "0", ")", ")", "{", "input", ".", "advance", "(", ")", ";", "input", ".", "acceptToken", "(", "terms", ".", "braceClose", ")", ";", "}", "else", "if", "(", "input", ".", "next", "==", "\".\"", ".", "charCodeAt", "(", "0", ")", ")", "{", "input", ".", "advance", "(", ")", ";", "input", ".", "acceptToken", "(", "terms", ".", "Dot", ")", ";", "}", "}", ")", ";", "throw", "new", "Error", "(", "\"Undefined external tokenizer \"", "+", "name", ")", ";", "}", "function", "externalSpecializer", "(", "name", ",", "terms", ")", "{", "if", "(", "name", "==", "\"spec1\"", ")", "return", "(", "value", ")", "=>", "value", "==", "\"one\"", "?", "terms", ".", "one", ":", "value", "==", "\"two\"", "?", "terms", ".", "two", ":", "-", "1", ";", "throw", "new", "Error", "(", "\"Undefined external specialize \"", "+", "name", ")", ";", "}", "function", "externalProp", "(", ")", "{", "return", "new", "NodeProp", "<", "string", ">", "(", "{", "deserialize", ":", "x", "=>", "x", "}", ")", ";", "}", "describe", "(", "\"Cases\"", ",", "(", ")", "=>", "{", "for", "(", "let", "file", "of", "fs", ".", "readdirSync", "(", "caseDir", ")", ")", "{", "let", "match", "=", "/^(.*)\\.txt$/", ".", "exec", "(", "file", ")", ";", "if", "(", "!", "match", ")", "continue", ";", "let", "name", "=", "match", "[", "1", "]", ",", "fileName", "=", "path", ".", "join", "(", "caseDir", ",", "file", ")", ";", "let", "content", "=", "fs", ".", "readFileSync", "(", "fileName", ",", "\"utf8\"", ")", ";", "let", "grammar", "=", "/^([^]*?)($|\\n# )/", ".", "exec", "(", "content", ")", "!", ";", "content", "=", "content", ".", "slice", "(", "grammar", "[", "1", "]", ".", "length", ")", ";", "let", "parser", "=", "null", ";", "let", "force", "=", "(", ")", "=>", "{", "if", "(", "!", "parser", ")", "parser", "=", "buildParser", "(", "grammar", "[", "1", "]", ",", "{", "fileName", ",", "externalTokenizer", ",", "externalSpecializer", ",", "externalProp", ",", "warn", "(", "msg", ")", "{", "throw", "new", "Error", "(", "msg", ")", ";", "}", "}", ")", ";", "return", "parser", ";", "}", ";", "let", "expectedErr", "=", "/\\/\\/! (.*)/", ".", "exec", "(", "grammar", "[", "1", "]", ")", ";", "let", "noCases", "=", "!", "/\\S/", ".", "test", "(", "content", ")", ";", "if", "(", "noCases", "&&", "!", "expectedErr", ")", "throw", "new", "Error", "(", "\"Test with neither expected errors nor input cases (\"", "+", "file", "+", "\")\"", ")", ";", "if", "(", "expectedErr", ")", "it", "(", "`${", "name", "} fails`", ",", "(", ")", "=>", "{", "ist", ".", "throws", "(", "force", ",", "(", "e", ")", "=>", "e", ".", "message", ".", "toLowerCase", "(", ")", ".", "indexOf", "(", "expectedErr", "!", "[", "1", "]", ".", "trim", "(", ")", ".", "toLowerCase", "(", ")", ")", ">=", "0", ")", ";", "}", ")", ";", "if", "(", "!", "noCases", ")", "for", "(", "let", "{", "name", ":", "n", ",", "run", "}", "of", "fileTests", "(", "content", ",", "file", ")", ")", "it", "(", "name", "+", "\"/\"", "+", "n", ",", "(", ")", "=>", "run", "(", "force", "(", ")", ")", ")", ";", "}", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, 6999, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, null, null, null, 25942, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 86, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
12
[ "import", "{", "buildParser", ",", "BuildOptions", "}", "from", "\"../dist/index.js\"", ";", "import", "{", "Tree", ",", "TreeFragment", ",", "NodeProp", ",", "parseMixed", ",", "SyntaxNode", "}", "from", "\"@lezer/common\"", ";", "import", "{", "LRParser", ",", "ParserConfig", "}", "from", "\"@lezer/lr\"", ";", "import", "{", "testTree", "}", "from", "\"../dist/test.js\"", ";", "import", "ist", "from", "\"ist\"", ";", "function", "p", "(", "text", ",", "options", "?", ",", "config", "?", ")", "{", "let", "value", "=", "null", ";", "return", "(", ")", "=>", "{", "if", "(", "!", "value", ")", "{", "value", "=", "buildParser", "(", "text", ",", "Object", ".", "assign", "(", "{", "}", ",", "{", "warn", "(", "e", ")", "{", "throw", "new", "Error", "(", "e", ")", ";", "}", "}", ",", "options", ")", ")", ";", "if", "(", "config", ")", "value", "=", "value", ".", "configure", "(", "config", ")", ";", "}", "return", "value", ";", "}", ";", "}", "function", "shared", "(", "a", ",", "b", ")", "{", "let", "inA", "=", "new", "Set", "<", "Tree", ">", "(", ")", ",", "shared", "=", "0", ";", "(", "function", "register", "(", "t", ")", "{", "if", "(", "t", "instanceof", "Tree", ")", "{", "let", "mounted", "=", "t", ".", "prop", "(", "NodeProp", ".", "mounted", ")", ";", "if", "(", "mounted", "&&", "!", "mounted", ".", "overlay", ")", "t", "=", "mounted", ".", "tree", ";", "t", ".", "children", ".", "forEach", "(", "register", ")", ";", "}", "inA", ".", "add", "(", "t", ")", ";", "}", ")", "(", "a", ")", ";", "(", "function", "scan", "(", "t", ")", "{", "if", "(", "inA", ".", "has", "(", "t", ")", ")", "{", "shared", "+=", "t", ".", "length", ";", "}", "else", "if", "(", "t", "instanceof", "Tree", ")", "{", "let", "mounted", "=", "t", ".", "prop", "(", "NodeProp", ".", "mounted", ")", ";", "(", "mounted", "&&", "!", "mounted", ".", "overlay", "?", "mounted", ".", "tree", ":", "t", ")", ".", "children", ".", "forEach", "(", "scan", ")", ";", "}", "}", ")", "(", "b", ")", ";", "return", "Math", ".", "round", "(", "100", "*", "shared", "/", "b", ".", "length", ")", ";", "}", "function", "fragments", "(", "tree", ",", "...", "changes", ")", "{", "return", "TreeFragment", ".", "applyChanges", "(", "TreeFragment", ".", "addTree", "(", "tree", ")", ",", "changes", ".", "map", "(", "(", "[", "fromA", ",", "toA", ",", "fromB", "=", "fromA", ",", "toB", "=", "toA", "]", ")", "=>", "(", "{", "fromA", ",", "toA", ",", "fromB", ",", "toB", "}", ")", ")", ",", "2", ")", ";", "}", "describe", "(", "\"parsing\"", ",", "(", ")", "=>", "{", "let", "p1", "=", "p", "(", "`\n @precedence { call }\n\n @top T { statement* }\n statement { Cond | Loop | Block | expression \";\" }\n Cond { kw<\"if\"> expression statement }\n Block { \"{\" statement* \"}\" }\n Loop { kw<\"while\"> expression statement }\n expression { Call | Num | Var | \"!\" expression }\n Call { expression !call \"(\" expression* \")\" }\n\n kw<value> { @specialize<Var, value> }\n @tokens {\n Num { std.digit+ }\n Var { std.asciiLetter+ }\n whitespace { std.whitespace+ }\n }\n @skip { whitespace }`", ")", ";", "function", "qq", "(", "ast", ")", "{", "return", "function", "(", "query", ",", "offset", "=", "1", ")", ":", "{", "start", ":", "number", ";", "end", ":", "number", ";", "}", "{", "let", "result", "=", "null", ",", "cursor", "=", "ast", ".", "cursor", "(", ")", ";", "do", "{", "if", "(", "cursor", ".", "name", "==", "query", "&&", "--", "offset", "==", "0", ")", "result", "=", "{", "start", ":", "cursor", ".", "from", ",", "end", ":", "cursor", ".", "to", "}", ";", "}", "while", "(", "cursor", ".", "next", "(", ")", ")", ";", "if", "(", "result", ")", "return", "result", ";", "throw", "new", "Error", "(", "\"Couldn't find \"", "+", "query", ")", ";", "}", ";", "}", "it", "(", "\"can parse incrementally\"", ",", "(", ")", "=>", "{", "let", "doc", "=", "\"if true { print(1); hello; } while false { if 1 do(something 1 2 3); }\"", ".", "repeat", "(", "10", ")", ";", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", "}", ")", ".", "parse", "(", "doc", ")", ";", "let", "content", "=", "\"Cond(Var,Block(Call(Var,Num),Var)),Loop(Var,Block(Cond(Num,Call(Var,Var,Num,Num,Num))))\"", ";", "let", "expected", "=", "\"T(\"", "+", "(", "content", "+", "\",\"", ")", ".", "repeat", "(", "9", ")", "+", "content", "+", "\")\"", ";", "testTree", "(", "ast", ",", "expected", ")", ";", "ist", "(", "ast", ".", "length", ",", "700", ")", ";", "let", "pos", "=", "doc", ".", "indexOf", "(", "\"false\"", ")", ",", "doc2", "=", "doc", ".", "slice", "(", "0", ",", "pos", ")", "+", "\"x\"", "+", "doc", ".", "slice", "(", "pos", "+", "5", ")", ";", "let", "ast2", "=", "p1", "(", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", "}", ")", ".", "parse", "(", "doc2", ",", "fragments", "(", "ast", ",", "[", "pos", ",", "pos", "+", "5", ",", "pos", ",", "pos", "+", "1", "]", ")", ")", ";", "testTree", "(", "ast2", ",", "expected", ")", ";", "ist", "(", "shared", "(", "ast", ",", "ast2", ")", ",", "40", ",", "\">\"", ")", ";", "ist", "(", "ast2", ".", "length", ",", "696", ")", ";", "}", ")", ";", "it", "(", "\"assigns the correct node positions\"", ",", "(", ")", "=>", "{", "let", "doc", "=", "\"if 1 { while 2 { foo(bar(baz bug)); } }\"", ";", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", ",", "strict", ":", "true", "}", ")", ".", "parse", "(", "doc", ")", ";", "let", "q", "=", "qq", "(", "ast", ")", ";", "ist", "(", "ast", ".", "length", ",", "39", ")", ";", "let", "cond", "=", "q", "(", "\"Cond\"", ")", ",", "one", "=", "q", "(", "\"Num\"", ")", ";", "ist", "(", "cond", ".", "start", ",", "0", ")", ";", "ist", "(", "cond", ".", "end", ",", "39", ")", ";", "ist", "(", "one", ".", "start", ",", "3", ")", ";", "ist", "(", "one", ".", "end", ",", "4", ")", ";", "let", "loop", "=", "q", "(", "\"Loop\"", ")", ",", "two", "=", "q", "(", "\"Num\"", ",", "2", ")", ";", "ist", "(", "loop", ".", "start", ",", "7", ")", ";", "ist", "(", "loop", ".", "end", ",", "37", ")", ";", "ist", "(", "two", ".", "start", ",", "13", ")", ";", "ist", "(", "two", ".", "end", ",", "14", ")", ";", "let", "call", "=", "q", "(", "\"Call\"", ")", ",", "inner", "=", "q", "(", "\"Call\"", ",", "2", ")", ";", "ist", "(", "call", ".", "start", ",", "17", ")", ";", "ist", "(", "call", ".", "end", ",", "34", ")", ";", "ist", "(", "inner", ".", "start", ",", "21", ")", ";", "ist", "(", "inner", ".", "end", ",", "33", ")", ";", "let", "bar", "=", "q", "(", "\"Var\"", ",", "2", ")", ",", "bug", "=", "q", "(", "\"Var\"", ",", "4", ")", ";", "ist", "(", "bar", ".", "start", ",", "21", ")", ";", "ist", "(", "bar", ".", "end", ",", "24", ")", ";", "ist", "(", "bug", ".", "start", ",", "29", ")", ";", "ist", "(", "bug", ".", "end", ",", "32", ")", ";", "}", ")", ";", "let", "resolveDoc", "=", "\"while 111 { one; two(three 20); }\"", ";", "function", "testResolve", "(", "bufferLength", ")", "{", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "strict", ":", "true", ",", "bufferLength", "}", ")", ".", "parse", "(", "resolveDoc", ")", ";", "let", "cx111", "=", "ast", ".", "cursor", "(", "7", ")", ";", "ist", "(", "cx111", ".", "name", ",", "\"Num\"", ")", ";", "ist", "(", "cx111", ".", "from", ",", "6", ")", ";", "ist", "(", "cx111", ".", "to", ",", "9", ")", ";", "cx111", ".", "parent", "(", ")", ";", "ist", "(", "cx111", ".", "name", ",", "\"Loop\"", ")", ";", "ist", "(", "cx111", ".", "from", ",", "0", ")", ";", "ist", "(", "cx111", ".", "to", ",", "33", ")", ";", "let", "cxThree", "=", "ast", ".", "cursor", "(", "22", ")", ";", "ist", "(", "cxThree", ".", "name", ",", "\"Var\"", ")", ";", "ist", "(", "cxThree", ".", "from", ",", "21", ")", ";", "ist", "(", "cxThree", ".", "to", ",", "26", ")", ";", "cxThree", ".", "parent", "(", ")", ";", "ist", "(", "cxThree", ".", "name", ",", "\"Call\"", ")", ";", "ist", "(", "cxThree", ".", "from", ",", "17", ")", ";", "ist", "(", "cxThree", ".", "to", ",", "30", ")", ";", "let", "branch", "=", "cxThree", ".", "moveTo", "(", "18", ")", ";", "ist", "(", "branch", ".", "name", ",", "\"Var\"", ")", ";", "ist", "(", "branch", ".", "from", ",", "17", ")", ";", "ist", "(", "branch", ".", "to", ",", "20", ")", ";", "ist", "(", "ast", ".", "cursor", "(", "6", ")", ".", "name", ",", "\"Loop\"", ")", ";", "ist", "(", "ast", ".", "cursor", "(", "9", ")", ".", "name", ",", "\"Loop\"", ")", ";", "let", "c", "=", "ast", ".", "cursor", "(", "20", ")", ";", "ist", "(", "c", ".", "firstChild", "(", ")", ")", ";", "ist", "(", "c", ".", "name", ",", "\"Var\"", ")", ";", "ist", "(", "c", ".", "nextSibling", "(", ")", ")", ";", "ist", "(", "c", ".", "name", ",", "\"Var\"", ")", ";", "ist", "(", "c", ".", "nextSibling", "(", ")", ")", ";", "ist", "(", "c", ".", "name", ",", "\"Num\"", ")", ";", "ist", "(", "!", "c", ".", "nextSibling", "(", ")", ")", ";", "}", "it", "(", "\"can resolve positions in buffers\"", ",", "(", ")", "=>", "testResolve", "(", "1024", ")", ")", ";", "it", "(", "\"can resolve positions in trees\"", ",", "(", ")", "=>", "testResolve", "(", "2", ")", ")", ";", "let", "iterDoc", "=", "\"while 1 { a; b; c(d e); } while 2 { f; }\"", ";", "let", "iterSeq", "=", "[", "\"T\"", ",", "0", ",", "\"Loop\"", ",", "0", ",", "\"Num\"", ",", "6", ",", "\"/Num\"", ",", "7", ",", "\"Block\"", ",", "8", ",", "\"Var\"", ",", "10", ",", "\"/Var\"", ",", "11", ",", "\"Var\"", ",", "13", ",", "\"/Var\"", ",", "14", ",", "\"Call\"", ",", "16", ",", "\"Var\"", ",", "16", ",", "\"/Var\"", ",", "17", ",", "\"Var\"", ",", "18", ",", "\"/Var\"", ",", "19", ",", "\"Var\"", ",", "20", ",", "\"/Var\"", ",", "21", ",", "\"/Call\"", ",", "22", ",", "\"/Block\"", ",", "25", ",", "\"/Loop\"", ",", "25", ",", "\"Loop\"", ",", "26", ",", "\"Num\"", ",", "32", ",", "\"/Num\"", ",", "33", ",", "\"Block\"", ",", "34", ",", "\"Var\"", ",", "36", ",", "\"/Var\"", ",", "37", ",", "\"/Block\"", ",", "40", ",", "\"/Loop\"", ",", "40", ",", "\"/T\"", ",", "40", "]", ";", "let", "partialSeq", "=", "[", "\"T\"", ",", "0", ",", "\"Loop\"", ",", "0", ",", "\"Block\"", ",", "8", ",", "\"Var\"", ",", "13", ",", "\"/Var\"", ",", "14", ",", "\"Call\"", ",", "16", ",", "\"Var\"", ",", "16", ",", "\"/Var\"", ",", "17", ",", "\"Var\"", ",", "18", ",", "\"/Var\"", ",", "19", ",", "\"/Call\"", ",", "22", ",", "\"/Block\"", ",", "25", ",", "\"/Loop\"", ",", "25", ",", "\"/T\"", ",", "40", "]", ";", "function", "testIter", "(", "bufferLength", ",", "partial", ")", "{", "let", "parser", "=", "p1", "(", ")", ",", "output", "=", "[", "]", ";", "let", "ast", "=", "parser", ".", "configure", "(", "{", "strict", ":", "true", ",", "bufferLength", "}", ")", ".", "parse", "(", "iterDoc", ")", ";", "ast", ".", "iterate", "(", "{", "from", ":", "partial", "?", "13", ":", "0", ",", "to", ":", "partial", "?", "19", ":", "ast", ".", "length", ",", "enter", "(", "open", ",", "start", ")", "{", "output", ".", "push", "(", "open", ".", "name", ",", "start", ")", ";", "}", ",", "leave", "(", "close", ",", "_", ",", "end", ")", "{", "output", ".", "push", "(", "\"/\"", "+", "close", ".", "name", ",", "end", ")", ";", "}", "}", ")", ";", "ist", "(", "output", ".", "join", "(", ")", ",", "(", "partial", "?", "partialSeq", ":", "iterSeq", ")", ".", "join", "(", ")", ")", ";", "}", "it", "(", "\"supports forward iteration in buffers\"", ",", "(", ")", "=>", "testIter", "(", "1024", ",", "false", ")", ")", ";", "it", "(", "\"supports forward iteration in trees\"", ",", "(", ")", "=>", "testIter", "(", "2", ",", "false", ")", ")", ";", "it", "(", "\"supports partial forward iteration in buffers\"", ",", "(", ")", "=>", "testIter", "(", "1024", ",", "true", ")", ")", ";", "it", "(", "\"supports partial forward iteration in trees\"", ",", "(", ")", "=>", "testIter", "(", "2", ",", "true", ")", ")", ";", "it", "(", "\"can skip individual nodes during iteration\"", ",", "(", ")", "=>", "{", "let", "ast", "=", "p1", "(", ")", ".", "parse", "(", "\"foo(baz(baz), bug(quux)\"", ")", ";", "let", "ids", "=", "0", ";", "ast", ".", "iterate", "(", "{", "enter", "(", "type", ",", "start", ")", "{", "if", "(", "type", ".", "name", "==", "\"Var\"", ")", "ids", "++", ";", "return", "start", "==", "4", "&&", "type", ".", "name", "==", "\"Call\"", "?", "false", ":", "undefined", ";", "}", "}", ")", ";", "ist", "(", "ids", ",", "3", ")", ";", "}", ")", ";", "it", "(", "\"doesn't incorrectly reuse nodes\"", ",", "(", ")", "=>", "{", "let", "parser", "=", "buildParser", "(", "`\n@precedence { times @left, plus @left }\n@top T { expr+ }\nexpr { Bin | Var }\nBin { expr !plus \"+\" expr | expr !times \"*\" expr }\n@skip { space }\n@tokens { space { \" \"+ } Var { \"x\" } \"*\"[@name=Times] \"+\"[@name=Plus] }\n`", ")", ";", "let", "p", "=", "parser", ".", "configure", "(", "{", "strict", ":", "true", ",", "bufferLength", ":", "2", "}", ")", ";", "let", "ast", "=", "p", ".", "parse", "(", "\"x + x + x\"", ")", ";", "testTree", "(", "ast", ",", "\"T(Bin(Bin(Var,Plus,Var),Plus,Var))\"", ")", ";", "let", "ast2", "=", "p", ".", "parse", "(", "\"x * x + x + x\"", ",", "fragments", "(", "ast", ",", "[", "0", ",", "0", ",", "0", ",", "4", "]", ")", ")", ";", "testTree", "(", "ast2", ",", "\"T(Bin(Bin(Bin(Var,Times,Var),Plus,Var),Plus,Var))\"", ")", ";", "}", ")", ";", "it", "(", "\"can cache skipped content\"", ",", "(", ")", "=>", "{", "let", "comments", "=", "buildParser", "(", "`\n@top T { \"x\"+ }\n@skip { space | Comment }\n@skip {} {\n Comment { commentStart (Comment | commentContent)* commentEnd }\n}\n@tokens {\n space { \" \"+ }\n commentStart { \"(\" }\n commentEnd { \")\" }\n commentContent { ![()]+ }\n}`", ")", ";", "let", "doc", "=", "\"x (one (two) (three \"", "+", "\"(y)\"", ".", "repeat", "(", "500", ")", "+", "\")) x\"", ";", "let", "ast", "=", "comments", ".", "configure", "(", "{", "bufferLength", ":", "10", ",", "strict", ":", "true", "}", ")", ".", "parse", "(", "doc", ")", ";", "let", "ast2", "=", "comments", ".", "configure", "(", "{", "bufferLength", ":", "10", "}", ")", ".", "parse", "(", "doc", ".", "slice", "(", "1", ")", ",", "fragments", "(", "ast", ",", "[", "0", ",", "1", ",", "0", ",", "0", "]", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "ast2", ")", ",", "80", ",", "\">\"", ")", ";", "}", ")", ";", "it", "(", "\"doesn't get slow on long invalid input\"", ",", "(", ")", "=>", "{", "let", "t0", "=", "Date", ".", "now", "(", ")", ";", "let", "ast", "=", "p1", "(", ")", ".", "parse", "(", "\"#\"", ".", "repeat", "(", "2000", ")", ")", ";", "ist", "(", "Date", ".", "now", "(", ")", "-", "t0", "<", "500", ")", ";", "ist", "(", "ast", ".", "toString", "(", ")", ",", "\"T(⚠)\"", ")", ";", "}", ")", ";", "it", "(", "\"supports input ranges\"", ",", "(", ")", "=>", "{", "let", "tree", "=", "p1", "(", ")", ".", "parse", "(", "`if 1{{x}}0{{y}}0 foo {{z}};`", ",", "[", "]", ",", "[", "{", "from", ":", "0", ",", "to", ":", "4", "}", ",", "{", "from", ":", "9", ",", "to", ":", "10", "}", ",", "{", "from", ":", "15", ",", "to", ":", "21", "}", ",", "{", "from", ":", "26", ",", "to", ":", "27", "}", "]", ")", ";", "ist", "(", "tree", ".", "toString", "(", ")", ",", "\"T(Cond(Num,Var))\"", ")", ";", "}", ")", ";", "it", "(", "\"doesn't reuse nodes whose tokens looked ahead beyond the unchanged fragments\"", ",", "(", ")", "=>", "{", "let", "comments", "=", "buildParser", "(", "`\n@top Top { (Group | Char)* }\n@tokens {\n Group { \"(\" ![)]* \")\" }\n Char { _ }\n}`", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", "}", ")", ";", "let", "doc", "=", "\"xxx(\"", "+", "\"x\"", ".", "repeat", "(", "996", ")", ";", "let", "tree1", "=", "comments", ".", "parse", "(", "doc", ")", ";", "let", "tree2", "=", "comments", ".", "parse", "(", "doc", "+", "\")\"", ",", "TreeFragment", ".", "applyChanges", "(", "TreeFragment", ".", "addTree", "(", "tree1", ")", ",", "[", "{", "fromA", ":", "1000", ",", "toA", ":", "1000", ",", "fromB", ":", "1000", ",", "toB", ":", "1001", "}", "]", ")", ")", ";", "ist", "(", "tree2", ".", "toString", "(", ")", ",", "\"Top(Char,Char,Char,Group)\"", ")", ";", "}", ")", ";", "}", ")", ";", "describe", "(", "\"sequences\"", ",", "(", ")", "=>", "{", "let", "p1", "=", "p", "(", "`\n @top T { (X | Y)+ }\n @skip { C }\n C { \"c\" }\n X { \"x\" }\n Y { \"y\" \";\"* }`", ")", ";", "function", "depth", "(", "tree", ")", "{", "return", "tree", "instanceof", "Tree", "?", "tree", ".", "children", ".", "reduce", "(", "(", "d", ",", "c", ")", "=>", "Math", ".", "max", "(", "d", ",", "depth", "(", "c", ")", "+", "1", ")", ",", "1", ")", ":", "1", ";", "}", "function", "breadth", "(", "tree", ")", "{", "return", "tree", "instanceof", "Tree", "?", "tree", ".", "children", ".", "reduce", "(", "(", "b", ",", "c", ")", "=>", "Math", ".", "max", "(", "b", ",", "breadth", "(", "c", ")", ")", ",", "tree", ".", "children", ".", "length", ")", ":", "0", ";", "}", "it", "(", "\"balances parsed sequences\"", ",", "(", ")", "=>", "{", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "strict", ":", "true", ",", "bufferLength", ":", "10", "}", ")", ".", "parse", "(", "\"x\"", ".", "repeat", "(", "1000", ")", ")", ";", "let", "d", "=", "depth", "(", "ast", ")", ",", "b", "=", "breadth", "(", "ast", ")", ";", "ist", "(", "d", ",", "6", ",", "\"<=\"", ")", ";", "ist", "(", "d", ",", "4", ",", "\">=\"", ")", ";", "ist", "(", "b", ",", "5", ",", "\">=\"", ")", ";", "ist", "(", "b", ",", "10", ",", "\"<=\"", ")", ";", "}", ")", ";", "it", "(", "\"creates a tree for long content-less repeats\"", ",", "(", ")", "=>", "{", "let", "p", "=", "buildParser", "(", "`\n@top T { (A | B { \"[\" b+ \"]\" })+ }\n@tokens {\n A { \"a\" }\n b { \"b\" }\n}`", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", "}", ")", ";", "let", "tree", "=", "p", ".", "parse", "(", "\"a[\"", "+", "\"b\"", ".", "repeat", "(", "500", ")", "+", "\"]\"", ")", ";", "ist", "(", "tree", ".", "toString", "(", ")", ",", "\"T(A,B)\"", ")", ";", "ist", "(", "depth", "(", "tree", ")", ",", "5", ",", "\">=\"", ")", ";", "}", ")", ";", "it", "(", "\"balancing doesn't get confused by skipped nodes\"", ",", "(", ")", "=>", "{", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "strict", ":", "true", ",", "bufferLength", ":", "10", "}", ")", ".", "parse", "(", "\"xc\"", ".", "repeat", "(", "1000", ")", ")", ";", "let", "d", "=", "depth", "(", "ast", ")", ",", "b", "=", "breadth", "(", "ast", ")", ";", "ist", "(", "d", ",", "6", ",", "\"<=\"", ")", ";", "ist", "(", "d", ",", "4", ",", "\">=\"", ")", ";", "ist", "(", "b", ",", "5", ",", "\">=\"", ")", ";", "ist", "(", "b", ",", "10", ",", "\"<=\"", ")", ";", "}", ")", ";", "it", "(", "\"caches parts of sequences\"", ",", "(", ")", "=>", "{", "let", "doc", "=", "\"x\"", ".", "repeat", "(", "1000", ")", ",", "p", "=", "p1", "(", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", "}", ")", ";", "let", "ast", "=", "p", ".", "parse", "(", "doc", ")", ";", "let", "full", "=", "p", ".", "parse", "(", "doc", ",", "TreeFragment", ".", "addTree", "(", "ast", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "full", ")", ",", "99", ",", "\">\"", ")", ";", "let", "front", "=", "p", ".", "parse", "(", "doc", ",", "fragments", "(", "ast", ",", "[", "900", ",", "1000", "]", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "front", ")", ",", "50", ",", "\">\"", ")", ";", "let", "back", "=", "p", ".", "parse", "(", "doc", ",", "fragments", "(", "ast", ",", "[", "0", ",", "100", "]", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "back", ")", ",", "50", ",", "\">\"", ")", ";", "let", "middle", "=", "p", ".", "parse", "(", "doc", ",", "fragments", "(", "ast", ",", "[", "0", ",", "100", "]", ",", "[", "900", ",", "1000", "]", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "middle", ")", ",", "50", ",", "\">\"", ")", ";", "let", "sides", "=", "p", ".", "parse", "(", "doc", ",", "fragments", "(", "ast", ",", "[", "450", ",", "550", "]", ")", ")", ";", "ist", "(", "shared", "(", "ast", ",", "sides", ")", ",", "50", ",", "\">\"", ")", ";", "}", ")", ";", "it", "(", "\"assigns the right positions to sequences\"", ",", "(", ")", "=>", "{", "let", "doc", "=", "\"x\"", ".", "repeat", "(", "100", ")", "+", "\"y;;;;;;;;;\"", "+", "\"x\"", ".", "repeat", "(", "90", ")", ";", "let", "ast", "=", "p1", "(", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", "}", ")", ".", "parse", "(", "doc", ")", ";", "let", "i", "=", "0", ";", "ast", ".", "iterate", "(", "{", "enter", "(", "type", ",", "start", ",", "end", ")", "{", "if", "(", "i", "==", "0", ")", "{", "ist", "(", "type", ".", "name", ",", "\"T\"", ")", ";", "}", "else", "if", "(", "i", "==", "101", ")", "{", "ist", "(", "type", ".", "name", ",", "\"Y\"", ")", ";", "ist", "(", "start", ",", "100", ")", ";", "ist", "(", "end", ",", "110", ")", ";", "}", "else", "{", "ist", "(", "type", ".", "name", ",", "\"X\"", ")", ";", "ist", "(", "end", ",", "start", "+", "1", ")", ";", "ist", "(", "start", ",", "i", "<=", "100", "?", "i", "-", "1", ":", "i", "+", "8", ")", ";", "}", "i", "++", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "describe", "(", "\"multiple tops\"", ",", "(", ")", "=>", "{", "it", "(", "\"parses named tops\"", ",", "(", ")", "=>", "{", "let", "parser", "=", "buildParser", "(", "`\n@top X { FOO C }\n@top Y { B C }\nFOO { B }\nB { \"b\" }\nC { \"c\" }\n`", ")", ";", "testTree", "(", "parser", ".", "parse", "(", "\"bc\"", ")", ",", "\"X(FOO(B), C)\"", ")", ";", "testTree", "(", "parser", ".", "configure", "(", "{", "top", ":", "\"X\"", "}", ")", ".", "parse", "(", "\"bc\"", ")", ",", "\"X(FOO(B), C)\"", ")", ";", "testTree", "(", "parser", ".", "configure", "(", "{", "top", ":", "\"Y\"", "}", ")", ".", "parse", "(", "\"bc\"", ")", ",", "\"Y(B, C)\"", ")", ";", "}", ")", ";", "it", "(", "\"parses first top as default\"", ",", "(", ")", "=>", "{", "let", "parser", "=", "buildParser", "(", "`\n@top X { FOO C }\n@top Y { B C }\nFOO { B }\nB { \"b\" }\nC { \"c\" }\n`", ")", ";", "testTree", "(", "parser", ".", "parse", "(", "\"bc\"", ")", ",", "\"X(FOO(B), C)\"", ")", ";", "testTree", "(", "parser", ".", "configure", "(", "{", "top", ":", "\"Y\"", "}", ")", ".", "parse", "(", "\"bc\"", ")", ",", "\"Y(B, C)\"", ")", ";", "}", ")", ";", "}", ")", ";", "describe", "(", "\"mixed languages\"", ",", "(", ")", "=>", "{", "const", "blob", "=", "p", "(", "`@top Blob { ch* } @tokens { ch { _ } }`", ",", "undefined", ",", "{", "bufferLength", ":", "10", "}", ")", ";", "it", "(", "\"can mix grammars\"", ",", "(", ")", "=>", "{", "let", "inner", "=", "buildParser", "(", "`\n @top I { expr+ }\n expr { B { Open{\"(\"} expr+ Close{\")\"} } | Dot{\".\"} }`", ")", ";", "let", "outer", "=", "buildParser", "(", "`\n @top O { expr+ }\n expr { \"[[\" NestContent \"]]\" | Bang{\"!\"} }\n @tokens {\n NestContent[@export] { ![\\\\]]+ }\n \"[[\"[@name=Start] \"]]\"[@name=End]\n }\n `", ")", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "if", "(", "node", ".", "name", "==", "\"NestContent\"", ")", "return", "{", "parser", ":", "inner", "}", ";", "return", "null", ";", "}", ")", "}", ")", ";", "testTree", "(", "outer", ".", "parse", "(", "\"![[((.).)]][[.]]\"", ")", ",", "'O(Bang,Start,I(B(Open,B(Open,Dot,Close),Dot,Close)),End,Start,I(Dot),End)'", ")", ";", "testTree", "(", "outer", ".", "parse", "(", "\"[[/\\]]\"", ")", ",", "'O(Start,I(⚠),End)'", ")", ";", "let", "tree", "=", "outer", ".", "parse", "(", "\"[[(.)]]\"", ")", ";", "let", "innerNode", "=", "tree", ".", "topNode", ".", "childAfter", "(", "2", ")", "!", ";", "ist", "(", "innerNode", ".", "name", ",", "\"I\"", ")", ";", "ist", "(", "innerNode", ".", "from", ",", "2", ")", ";", "ist", "(", "innerNode", ".", "to", ",", "5", ")", ";", "ist", "(", "innerNode", ".", "firstChild", "!", ".", "from", ",", "2", ")", ";", "ist", "(", "innerNode", ".", "firstChild", "!", ".", "to", ",", "5", ")", ";", "}", ")", ";", "it", "(", "\"supports conditional nesting\"", ",", "(", ")", "=>", "{", "let", "inner", "=", "buildParser", "(", "`@top Script { any } @tokens { any { ![]+ } }`", ")", ";", "let", "outer", "=", "buildParser", "(", "`\n @top T { Tag }\n Tag { Open Content? Close }\n Open { \"<\" name \">\" }\n Close { \"</\" name \">\" }\n @tokens {\n name { std.asciiLetter+ }\n Content { ![<]+ }\n }\n `", ")", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "(", "node", ",", "input", ")", "=>", "{", "if", "(", "node", ".", "name", "==", "\"Content\"", ")", "{", "let", "open", "=", "node", ".", "node", ".", "parent", "!", ".", "firstChild", "!", ";", "if", "(", "input", ".", "read", "(", "open", ".", "from", ",", "open", ".", "to", ")", "==", "\"<script>\"", ")", "return", "{", "parser", ":", "inner", "}", ";", "}", "return", "null", ";", "}", ")", "}", ")", ";", "testTree", "(", "outer", ".", "parse", "(", "\"<foo>bar</foo>\"", ")", ",", "\"T(Tag(Open,Content,Close))\"", ")", ";", "testTree", "(", "outer", ".", "parse", "(", "\"<script>hello</script>\"", ")", ",", "\"T(Tag(Open,Script,Close))\"", ")", ";", "}", ")", ";", "it", "(", "\"can parse incrementally across nesting\"", ",", "(", ")", "=>", "{", "let", "outer", "=", "buildParser", "(", "`\n @top Program { (Nest | Name)* }\n @skip { space }\n @skip {} {\n Nest { \"{\" Nested \"}\" }\n Nested { nestedChar* }\n }\n @tokens {\n space { std.whitespace+ }\n nestedChar { ![}] }\n Name { $[a-z]+ }\n }\n `", ")", ".", "configure", "(", "{", "bufferLength", ":", "10", ",", "wrap", ":", "parseMixed", "(", "node", "=>", "node", ".", "name", "==", "\"Nested\"", "?", "{", "parser", ":", "blob", "(", ")", "}", ":", "null", ")", "}", ")", ";", "let", "base", "=", "\"hello {bbbb} \"", ";", "let", "doc", "=", "base", ".", "repeat", "(", "500", ")", "+", "\"{\"", "+", "\"b\"", ".", "repeat", "(", "1000", ")", "+", "\"} \"", "+", "base", ".", "repeat", "(", "500", ")", ",", "off", "=", "base", ".", "length", "*", "500", "+", "500", ";", "let", "ast1", "=", "outer", ".", "parse", "(", "doc", ")", ";", "let", "ast2", "=", "outer", ".", "parse", "(", "doc", ".", "slice", "(", "0", ",", "off", ")", "+", "\"bbb\"", "+", "doc", ".", "slice", "(", "off", ")", ",", "TreeFragment", ".", "applyChanges", "(", "TreeFragment", ".", "addTree", "(", "ast1", ")", ",", "[", "{", "fromA", ":", "off", ",", "toA", ":", "off", ",", "fromB", ":", "off", ",", "toB", ":", "off", "+", "3", "}", "]", ")", ")", ";", "ist", "(", "ast1", ".", "toString", "(", ")", ",", "ast2", ".", "toString", "(", ")", ")", ";", "ist", "(", "shared", "(", "ast1", ",", "ast2", ")", ",", "90", ",", "\">\"", ")", ";", "}", ")", ";", "it", "(", "\"can create overlays\"", ",", "(", ")", "=>", "{", "let", "outer", "=", "buildParser", "(", "`\n @top Doc { (Dir | Content)* }\n Dir { \"{{\" Word \"}}\" }\n @tokens {\n Content { (![{] | \"{\" ![{])+ }\n Word { $[a-z]+ }\n }\n `", ")", ";", "let", "mix", "=", "outer", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "return", "node", ".", "name", "==", "\"Doc\"", "?", "{", "parser", ":", "blob", "(", ")", ",", "overlay", ":", "node", "=>", "node", ".", "name", "==", "\"Content\"", "}", ":", "null", ";", "}", ")", "}", ")", ";", "let", "tree", "=", "mix", ".", "parse", "(", "\"foo{{bar}}baz{{bug}}\"", ")", ";", "ist", "(", "tree", ".", "toString", "(", ")", ",", "\"Doc(Content,Dir(Word),Content,Dir(Word))\"", ")", ";", "let", "c1", "=", "tree", ".", "resolveInner", "(", "1", ")", ";", "ist", "(", "c1", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "c1", ".", "from", ",", "0", ")", ";", "ist", "(", "c1", ".", "to", ",", "13", ")", ";", "ist", "(", "c1", ".", "parent", "!", ".", "name", ",", "\"Doc\"", ")", ";", "ist", "(", "tree", ".", "resolveInner", "(", "10", ",", "1", ")", ".", "name", ",", "\"Blob\"", ")", ";", "let", "mix2", "=", "outer", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "return", "node", ".", "name", "==", "\"Doc\"", "?", "{", "parser", ":", "blob", "(", ")", ",", "overlay", ":", "[", "{", "from", ":", "5", ",", "to", ":", "7", "}", "]", "}", ":", "null", ";", "}", ")", "}", ")", ";", "let", "tree2", "=", "mix2", ".", "parse", "(", "\"{{a}}bc{{d}}\"", ")", ";", "let", "c2", "=", "tree2", ".", "resolveInner", "(", "6", ")", ";", "ist", "(", "c2", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "c2", ".", "from", ",", "5", ")", ";", "ist", "(", "c2", ".", "to", ",", "7", ")", ";", "}", ")", ";", "it", "(", "\"reuses ranges from previous parses\"", ",", "(", ")", "=>", "{", "let", "outer", "=", "buildParser", "(", "`\n @top Doc { expr* }\n expr {\n Paren { \"(\" expr* \")\" } |\n Array { \"[\" expr* \"]\" } |\n Number |\n String\n }\n @skip { space }\n @tokens {\n Number { $[0-9]+ }\n String { \"'\" ![']* \"'\" }\n space { $[ \\n]+ }\n }\n `", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", ",", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "return", "node", ".", "name", "==", "\"Array\"", "?", "{", "parser", ":", "blob", "(", ")", ",", "overlay", ":", "node", "=>", "{", "if", "(", "node", ".", "name", "==", "\"String\"", ")", "{", "queried", ".", "push", "(", "node", ".", "from", ")", ";", "return", "true", ";", "}", "return", "false", ";", "}", "}", ":", "null", ";", "}", ")", "}", ")", ";", "let", "queried", "=", "[", "]", ";", "let", "doc", "=", "\" (100) (() [50] 123456789012345678901234 ((['one' 123456789012345678901234 (('two'))]) ['three'])) \"", ";", "let", "tree", "=", "outer", ".", "parse", "(", "doc", ")", ";", "ist", "(", "tree", ".", "toString", "(", ")", ",", "\"Doc(Paren(Number),Paren(Paren,Array(Number),Number,Paren(Paren(Array(String,Number,Paren(Paren(String)))),Array(String))))\"", ")", ";", "let", "inOne", "=", "tree", ".", "resolveInner", "(", "45", ")", ";", "ist", "(", "inOne", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "inOne", ".", "from", ",", "44", ")", ";", "ist", "(", "inOne", ".", "to", ",", "82", ")", ";", "ist", "(", "inOne", ".", "nextSibling", ",", "null", ")", ";", "ist", "(", "inOne", ".", "prevSibling", ",", "null", ")", ";", "ist", "(", "inOne", ".", "parent", "!", ".", "name", ",", "\"Array\"", ")", ";", "ist", "(", "tree", ".", "resolveInner", "(", "89", ")", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "queried", ".", "join", "(", ")", ",", "\"44,77,88\"", ")", ";", "queried", ".", "length", "=", "0", ";", "let", "tree2", "=", "outer", ".", "parse", "(", "doc", ".", "slice", "(", "0", ",", "45", ")", "+", "\"x\"", "+", "doc", ".", "slice", "(", "46", ")", ",", "fragments", "(", "tree", ",", "[", "45", ",", "46", "]", ")", ")", ";", "ist", "(", "queried", ".", "join", "(", ")", ",", "\"44\"", ")", ";", "ist", "(", "shared", "(", "tree", ",", "tree2", ")", ",", "20", ",", "\">\"", ")", ";", "}", ")", ";", "it", "(", "\"properly handles fragment offsets\"", ",", "(", ")", "=>", "{", "let", "inner", "=", "buildParser", "(", "`@top Text { (Word | \" \")* } @tokens { Word { ![ ]+ } }`", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", "}", ")", ";", "let", "outer", "=", "buildParser", "(", "`\n @top Doc { expr* }\n expr { Wrap { \"(\" expr* \")\" } | Templ { \"[\" expr* \"]\" } | Number | String }\n @skip { space }\n @tokens {\n Number { $[0-9]+ }\n String { \"'\" ![']* \"'\" }\n space { $[ \\n]+ }\n }\n `", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", ",", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "return", "node", ".", "name", "==", "\"Templ\"", "?", "{", "parser", ":", "inner", ",", "overlay", ":", "node", "=>", "node", ".", "name", "==", "\"String\"", "?", "{", "from", ":", "node", ".", "from", "+", "1", ",", "to", ":", "node", ".", "to", "-", "1", "}", ":", "false", "}", ":", "null", ";", "}", ")", "}", ")", ";", "let", "doc", "=", "\" 0123456789012345678901234 (['123456789 123456789 12345 stuff' 123456789 (('123456789 123456789 12345 other' 4))] 200)\"", ";", "let", "tree", "=", "outer", ".", "parse", "(", "doc", ")", ";", "let", "tree1", "=", "outer", ".", "parse", "(", "\"88\"", "+", "doc", ",", "fragments", "(", "tree", ",", "[", "0", ",", "0", ",", "0", ",", "2", "]", ")", ")", ";", "ist", "(", "tree", ".", "resolveInner", "(", "50", ")", ".", "tree", ",", "tree1", ".", "resolveInner", "(", "52", ")", ".", "tree", ")", ";", "let", "tree2", "=", "outer", ".", "parse", "(", "\"88\"", "+", "doc", ".", "slice", "(", "0", ",", "30", ")", "+", "doc", ".", "slice", "(", "31", ")", ",", "fragments", "(", "tree", ",", "[", "0", ",", "0", ",", "0", ",", "2", "]", ",", "[", "30", ",", "31", ",", "32", ",", "32", "]", ")", ")", ";", "ist", "(", "shared", "(", "tree", ",", "tree2", ")", ",", "20", ",", "\">\"", ")", ";", "ist", "(", "shared", "(", "tree", ".", "resolveInner", "(", "49", ")", ".", "tree", "!", ",", "tree2", ".", "resolveInner", "(", "50", ")", ".", "tree", "!", ")", ",", "20", ",", "\">\"", ")", ";", "let", "other", "=", "tree2", ".", "resolveInner", "(", "103", ",", "1", ")", ";", "ist", "(", "other", ".", "from", ",", "103", ")", ";", "ist", "(", "other", ".", "to", ",", "108", ")", ";", "}", ")", ";", "it", "(", "\"supports nested overlays\"", ",", "(", ")", "=>", "{", "let", "outer", "=", "buildParser", "(", "`\n @top Doc { expr* }\n expr {\n Paren { \"(\" expr* \")\" } |\n Array { \"[\" expr* \"]\" } |\n Number |\n String\n }\n @skip { space }\n @tokens {\n Number { $[0-9]+ }\n String { \"'\" ![']* \"'\" }\n space { $[ \\n]+ }\n }\n `", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", ",", "}", ")", ";", "function", "testMixed", "(", "parser", ")", "{", "let", "tree", "=", "parser", ".", "parse", "(", "\"['x' 100 (['xxx' 20 ('xx')] 'xxx')]\"", ")", ";", "let", "blob1", "=", "tree", ".", "resolveInner", "(", "2", ",", "1", ")", ";", "ist", "(", "blob1", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "blob1", ".", "from", ",", "2", ")", ";", "ist", "(", "blob1", ".", "to", ",", "32", ")", ";", "let", "blob2", "=", "tree", ".", "resolveInner", "(", "12", ",", "1", ")", ";", "ist", "(", "blob2", ".", "name", ",", "\"Blob\"", ")", ";", "ist", "(", "blob2", ".", "from", ",", "12", ")", ";", "ist", "(", "blob2", ".", "to", ",", "24", ")", ";", "}", "testMixed", "(", "outer", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "return", "node", ".", "name", "==", "\"Array\"", "?", "{", "parser", ":", "blob", "(", ")", ",", "overlay", ":", "node", "=>", "node", ".", "name", "==", "\"String\"", "?", "{", "from", ":", "node", ".", "from", "+", "1", ",", "to", ":", "node", ".", "to", "-", "1", "}", ":", "false", "}", ":", "null", ";", "}", ")", "}", ")", ")", ";", "testMixed", "(", "outer", ".", "configure", "(", "{", "wrap", ":", "parseMixed", "(", "node", "=>", "{", "if", "(", "node", ".", "name", "!=", "\"Array\"", ")", "return", "null", ";", "let", "ranges", "=", "[", "]", ";", "let", "scan", "=", "(", "node", ")", "=>", "{", "if", "(", "node", ".", "name", "==", "\"String\"", ")", "ranges", ".", "push", "(", "{", "from", ":", "node", ".", "from", "+", "1", ",", "to", ":", "node", ".", "to", "-", "1", "}", ")", ";", "else", "for", "(", "let", "ch", "=", "node", ".", "firstChild", ";", "ch", ";", "ch", "=", "ch", ".", "nextSibling", ")", "if", "(", "ch", ".", "name", "!=", "\"Array\"", ")", "scan", "(", "ch", ")", ";", "}", ";", "scan", "(", "node", ".", "node", ")", ";", "return", "{", "parser", ":", "blob", "(", ")", ",", "overlay", ":", "ranges", "}", ";", "}", ")", "}", ")", ")", ";", "}", ")", ";", "it", "(", "\"re-parses cut-off inner parses even if the outer tree was finished\"", ",", "(", ")", "=>", "{", "let", "inner", "=", "buildParser", "(", "`@top Phrase { \"<\" ch* \">\" } @tokens { ch { ![>] } }`", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", "}", ")", ";", "let", "parser", "=", "buildParser", "(", "`\n @top Doc { Section* }\n Section { \"{\" SectionContent? \"}\" }\n @tokens { SectionContent { ![}]+ } }\n `", ")", ".", "configure", "(", "{", "bufferLength", ":", "2", ",", "wrap", ":", "parseMixed", "(", "node", "=>", "node", ".", "name", "==", "\"SectionContent\"", "?", "{", "parser", ":", "inner", "}", ":", "null", ")", "}", ")", ";", "let", "input", "=", "`{<${", "\"x\"", ".", "repeat", "(", "100", ")", "}>}{<xxxx>}`", ",", "tree1", ";", "let", "parse", "=", "parser", ".", "startParse", "(", "input", ")", ";", "while", "(", "parse", ".", "parsedPos", "<", "50", ")", "parse", ".", "advance", "(", ")", ";", "parse", ".", "stopAt", "(", "parse", ".", "parsedPos", ")", ";", "while", "(", "!", "(", "tree1", "=", "parse", ".", "advance", "(", ")", ")", ")", "{", "}", "ist", "(", "tree1", ".", "toString", "(", ")", ",", "\"Doc(Section(Phrase(⚠)),Section(Phrase(⚠)))\"", ")", ";", "let", "tree2", "=", "parser", ".", "parse", "(", "input", ",", "TreeFragment", ".", "addTree", "(", "tree1", ")", ")", ";", "ist", "(", "tree2", ".", "toString", "(", ")", ",", "\"Doc(Section(Phrase),Section(Phrase))\"", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, 2, null, 892, null, null, 0, null, null, null, null, 25942, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 367, null, 367, null, null, null, 30, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, null, null, null, null, null, null, 6, null, 367, null, null, null, null, null, 2, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 4, null, 3, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 3, null, 8, null, null, null, 25942, null, null, null, null, null, 5, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 871, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 871, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 8, null, 871, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 25942, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 4, null, 871, null, 3, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25942, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, 312, null, null, null, null, null, null, null, null, null, null, null, null, null, 2143, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 25942, null, null, null, 367, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, 4, null, null, 2143, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2143, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 19652, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
13
[ "import", "{", "fileTests", "}", "from", "\"../dist/test.js\"", ";", "describe", "(", "\"test\"", ",", "(", ")", "=>", "{", "it", "(", "\"handle parser error\"", ",", "(", ")", "=>", "{", "const", "content", "=", "`\n# Working Spec\n\nb\n\n==> B\n\n# Broken Spec\n\nbbbb bbbb bbbb bbbb\nbbbb bbbb bbbb bbbb\nbbbb bbbb bbbb bbbb\nbbbb bbbb bbbb bbbb aaaa\nbbbb\n`", ";", "const", "expectedError", "=", "`Unexpected file format in test-error.txt around\n\n | # Broken Spec\n |${", "' '", "}\n | bbbb bbbb bbbb bbbb\n | bbbb bbbb bbbb bbbb\n | bbbb bbbb bbbb bbbb\n | bbbb bbbb bbbb bbbb aaaa`", ";", "const", "file", "=", "\"test-error.txt\"", ";", "try", "{", "fileTests", "(", "content", ",", "file", ")", ";", "}", "catch", "(", "err", ")", "{", "if", "(", "err", ".", "message", "!==", "expectedError", ")", "{", "throw", "err", ";", "}", "}", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
14
[ "exports", "import", "{", "injectable", "}", "from", "'inversify'", ";", "import", "{", "get", ",", "has", ",", "isPlainObject", ",", "merge", ",", "set", "}", "from", "'lodash'", ";", "/**\n * Config\n * An easy to use application wide configuration class\n */", "@", "injectable", "(", ")", "export", "class", "Config", "{", "var", "protected", "tree", ":", "object", ";", "param", "{", "object", "}", "obj", "return", "{", "object", "}", "protected", "static", "freeze", "(", "obj", ")", "{", "const", "newObject", "=", "{", "}", ";", "Object", ".", "getOwnPropertyNames", "(", "obj", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", "if", "(", "isPlainObject", "(", "obj", "[", "key", "]", ")", ")", "{", "newObject", "[", "key", "]", "=", "this", ".", "freeze", "(", "obj", "[", "key", "]", ")", ";", "}", "else", "{", "newObject", "[", "key", "]", "=", "obj", "[", "key", "]", ";", "}", "}", ")", ";", "return", "Object", ".", "freeze", "(", "newObject", ")", ";", "}", "param", "{", "object", "}", "obj", "return", "{", "object", "}", "protected", "static", "unfreeze", "(", "obj", ")", "{", "const", "newObject", "=", "{", "}", ";", "Object", ".", "getOwnPropertyNames", "(", "obj", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", "if", "(", "typeof", "obj", "[", "key", "]", "===", "'object'", ")", "{", "newObject", "[", "key", "]", "=", "this", ".", "unfreeze", "(", "obj", "[", "key", "]", ")", ";", "}", "else", "{", "newObject", "[", "key", "]", "=", "obj", "[", "key", "]", ";", "}", "}", ")", ";", "return", "newObject", ";", "}", "var", "protected", "get", "immutable", "(", ")", "{", "return", "Object", ".", "isFrozen", "(", "this", ".", "tree", ")", ";", "}", "param", "{", "object", "}", "configuration", "constructor", "(", "configuration", "=", "{", "}", ")", "{", "this", ".", "tree", "=", "configuration", ";", "}", "param", "{", "*", "}", "key", "param", "{", "*", "}", "def", "return", "{", "*", "}", "public", "get", "(", "key", ",", "def", "?", ")", "{", "if", "(", "key", "===", "'.'", ")", "{", "return", "this", ".", "tree", ";", "}", "if", "(", "this", ".", "has", "(", "key", ")", "===", "false", ")", "{", "return", "def", ";", "}", "return", "get", "(", "this", ".", "tree", ",", "key", ")", ";", "}", "param", "{", "string", "}", "key", "return", "{", "boolean", "}", "public", "has", "(", "key", ")", "{", "return", "has", "(", "this", ".", "tree", ",", "key", ")", ";", "}", "param", "{", "string", "}", "key", "param", "{", "*", "}", "return", "{", "Config", "}", "public", "set", "(", "key", ",", "value", ")", "{", "if", "(", "this", ".", "immutable", "===", "true", ")", "{", "throw", "new", "Error", "(", "'Configuration is immutable'", ")", ";", "}", "set", "(", "this", ".", "tree", ",", "key", ",", "value", ")", ";", "return", "this", ";", "}", "param", "{", "object", "}", "obj", "return", "{", "Config", "}", "public", "merge", "(", "obj", ")", "{", "if", "(", "this", ".", "immutable", "===", "true", ")", "{", "throw", "new", "Error", "(", "'Configuration is immutable'", ")", ";", "}", "merge", "(", "this", ".", "tree", ",", "obj", ")", ";", "return", "this", ";", "}", "return", "{", "Config", "}", "public", "freeze", "(", ")", "{", "this", ".", "tree", "=", "Config", ".", "freeze", "(", "this", ".", "tree", ")", ";", "return", "this", ";", "}", "return", "{", "Config", "}", "public", "unfreeze", "(", ")", "{", "this", ".", "tree", "=", "Config", ".", "unfreeze", "(", "this", ".", "tree", ")", ";", "return", "this", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 6, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 6, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
15
[ "exports", "exports", "exports", "exports", "import", "*", "as", "fs", "from", "'fs'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "Config", "}", "from", "'./index'", ";", "var", "const", "environmentPrefix", "=", "'HOUSTON'", ";", "var", "const", "configurationPaths", "=", "[", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "'config.js'", ")", ",", "path", ".", "resolve", "(", "'/etc/houston/config.js'", ")", "]", ";", "example", "param", "{", "string", "}", "str", "return", "{", "string", "}", "export", "function", "stringToDot", "(", "str", ")", "{", "return", "str", ".", "toLowerCase", "(", ")", ".", "split", "(", "'_'", ")", ".", "splice", "(", "1", ")", ".", "join", "(", "'.'", ")", ".", "replace", "(", "'env'", ",", "'environment'", ")", ";", "}", "return", "{", "Config", "}", "export", "function", "getEnvironmentConfig", "(", ")", "{", "const", "config", "=", "new", "Config", "(", ")", ";", "Object", ".", "keys", "(", "process", ".", "env", ")", ".", "forEach", "(", "(", "key", ")", "=>", "{", "if", "(", "key", ".", "startsWith", "(", "environmentPrefix", ")", ")", "{", "const", "name", "=", "stringToDot", "(", "key", ")", ";", "const", "numberValue", "=", "Number", "(", "process", ".", "env", "[", "key", "]", ")", ";", "if", "(", "isNaN", "(", "numberValue", ")", "===", "false", ")", "{", "config", ".", "set", "(", "name", ",", "numberValue", ")", ";", "}", "else", "{", "config", ".", "set", "(", "name", ",", "process", ".", "env", "[", "key", "]", ")", ";", "}", "}", "}", ")", ";", "if", "(", "process", ".", "env", ".", "NODE_ENV", "!=", "null", ")", "{", "config", ".", "set", "(", "'environment'", ",", "process", ".", "env", ".", "NODE_ENV", ")", ";", "}", "if", "(", "process", ".", "env", ".", "NODE_DEBUG", "!=", "null", ")", "{", "config", ".", "set", "(", "'log.console'", ",", "'debug'", ")", ";", "}", "return", "config", ".", "freeze", "(", ")", ";", "}", "return", "{", "Config", "}", "export", "function", "getProgramConfig", "(", ")", "{", "const", "config", "=", "new", "Config", "(", ")", ";", "try", "{", "const", "pkg", "=", "require", "(", "'../../../package.json'", ")", ";", "const", "[", "major", ",", "minor", ",", "patch", "]", "=", "pkg", ".", "version", ".", "split", "(", "'-'", ")", "[", "0", "]", ".", "split", "(", "'.'", ")", ";", "config", ".", "set", "(", "'houston.version'", ",", "pkg", ".", "version", ")", ";", "config", ".", "set", "(", "'houston.major'", ",", "major", ")", ";", "config", ".", "set", "(", "'houston.minor'", ",", "minor", ")", ";", "config", ".", "set", "(", "'houston.patch'", ",", "patch", ")", ";", "}", "catch", "(", "e", ")", "{", "}", "try", "{", "const", "gitCommitPath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'..'", ",", "'..'", ",", "'..'", ",", "'.git'", ",", "'ORIG_HEAD'", ")", ";", "const", "exists", "=", "fs", ".", "statSync", "(", "gitCommitPath", ")", ".", "isFile", "(", ")", ";", "if", "(", "exists", "===", "true", ")", "{", "const", "commit", "=", "fs", ".", "readFileSync", "(", "gitCommitPath", ",", "{", "encoding", ":", "'utf8'", "}", ")", ".", "trim", "(", ")", ";", "config", ".", "set", "(", "'houston.commit'", ",", "commit", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "}", "try", "{", "const", "gitChangePath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'..'", ",", "'..'", ",", "'..'", ",", "'.git'", ",", "'COMMIT_EDITMSG'", ")", ";", "const", "exists", "=", "fs", ".", "statSync", "(", "gitChangePath", ")", ".", "isFile", "(", ")", ";", "if", "(", "exists", "===", "true", ")", "{", "const", "change", "=", "fs", ".", "readFileSync", "(", "gitChangePath", ",", "{", "encoding", ":", "'utf8'", "}", ")", ".", "trim", "(", ")", ";", "config", ".", "set", "(", "'houston.change'", ",", "change", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "}", "return", "config", ".", "freeze", "(", ")", ";", "}", "param", "{", "string", "}", "p", "throws", "return", "{", "Config", "}", "export", "function", "getFileConfig", "(", "p", "?", ")", "{", "const", "config", "=", "new", "Config", "(", ")", ";", "let", "file", "=", "{", "}", ";", "if", "(", "p", "!=", "null", "&&", "p", ".", "startsWith", "(", "'/'", ")", ")", "{", "file", "=", "require", "(", "p", ")", ";", "}", "else", "if", "(", "p", "!=", "null", ")", "{", "const", "relativeP", "=", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "p", ")", ";", "file", "=", "require", "(", "relativeP", ")", ";", "}", "else", "{", "for", "(", "const", "possible", "of", "configurationPaths", ")", "{", "try", "{", "if", "(", "fs", ".", "statSync", "(", "possible", ")", ".", "isFile", "(", ")", ")", "{", "file", "=", "require", "(", "possible", ")", ";", "break", ";", "}", "}", "catch", "(", "e", ")", "{", "}", "}", "}", "return", "config", ".", "merge", "(", "file", ")", ".", "freeze", "(", ")", ";", "}", "param", "{", "string", "}", "p", "throws", "return", "{", "Config", "}", "export", "function", "getConfig", "(", "p", "?", ")", "{", "const", "environment", "=", "getEnvironmentConfig", "(", ")", ";", "const", "program", "=", "getProgramConfig", "(", ")", ";", "const", "file", "=", "getFileConfig", "(", "p", ")", ";", "const", "config", "=", "new", "Config", "(", ")", ";", "return", "config", ".", "merge", "(", "program", ".", "get", "(", "'.'", ")", ")", ".", "merge", "(", "file", ".", "get", "(", "'.'", ")", ")", ".", "merge", "(", "environment", ".", "get", "(", "'.'", ")", ")", ".", "freeze", "(", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, 2, null, null, null, null, 87, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, 2, null, null, null, null, 87, null, null, null, null, null, null, 87, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
16
[ "/**\n * houston/src/lib/app.ts\n * IOC container for houston. This is the entrypoint to anything and everything\n * sweat in life.\n */", "import", "{", "Container", ",", "ContainerModule", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'./config'", ";", "/**\n * App\n * A houston IOC container\n */", "export", "class", "App", "extends", "Container", "{", "var", "protected", "static", "providers", ":", "ContainerModule", "[", "]", "=", "[", "require", "(", "'../repo/provider'", ")", ".", "provider", ",", "require", "(", "'../worker/provider'", ")", ".", "provider", ",", "require", "(", "'./cache/provider'", ")", ".", "provider", ",", "require", "(", "'./database/provider'", ")", ".", "provider", ",", "require", "(", "'./log/provider'", ")", ".", "provider", ",", "require", "(", "'./queue/provider'", ")", ".", "provider", ",", "require", "(", "'./service/provider'", ")", ".", "provider", "]", ";", "param", "{", "Config", "}", "config", "public", "constructor", "(", "config", ")", "{", "super", "(", ")", ";", "this", ".", "bind", "<", "App", ">", "(", "App", ")", ".", "toConstantValue", "(", "this", ")", ";", "this", ".", "bind", "<", "Config", ">", "(", "Config", ")", ".", "toConstantValue", "(", "config", ")", ";", "this", ".", "setupProviders", "(", ")", ";", "}", "return", "{", "void", "}", "public", "setupProviders", "(", ")", "{", "this", ".", "load", "(", "...", "App", ".", "providers", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
17
[ "/**\n * houston/src/lib/log/level.ts\n * Some log levels\n */", "var", "export", "const", "DEBUG", "=", "Symbol", "(", ")", ";", "var", "export", "const", "INFO", "=", "Symbol", "(", ")", ";", "var", "export", "const", "WARN", "=", "Symbol", "(", ")", ";", "var", "export", "const", "ERROR", "=", "Symbol", "(", ")", ";", "var", "export", "enum", "Level", "{", "DEBUG", ",", "INFO", ",", "WARN", ",", "ERROR", "}", "param", "{", "string", "}", "level", "return", "{", "Level", "}", "export", "function", "parseLevel", "(", "level", ")", "{", "switch", "(", "level", ".", "toLowerCase", "(", ")", ".", "trim", "(", ")", ")", "{", "case", "(", "'debug'", ")", ":", "return", "Level", ".", "DEBUG", ";", "case", "(", "'info'", ")", ":", "return", "Level", ".", "INFO", ";", "case", "(", "'warn'", ")", ":", "return", "Level", ".", "WARN", ";", "case", "(", "'error'", ")", ":", "return", "Level", ".", "ERROR", ";", "default", ":", "return", "Level", ".", "INFO", ";", "}", "}", "param", "{", "Level", "}", "level", "return", "{", "string", "}", "export", "function", "levelString", "(", "level", ")", "{", "switch", "(", "level", ")", "{", "case", "(", "Level", ".", "DEBUG", ")", ":", "return", "'debug'", ";", "case", "(", "Level", ".", "INFO", ")", ":", "return", "'info'", ";", "case", "(", "Level", ".", "WARN", ")", ":", "return", "'warn'", ";", "case", "(", "Level", ".", "ERROR", ")", ":", "return", "'error'", ";", "default", ":", "return", "'info'", ";", "}", "}", "param", "{", "Level", "}", "level", "return", "{", "Number", "}", "export", "function", "levelIndex", "(", "level", ")", "{", "switch", "(", "level", ")", "{", "case", "(", "Level", ".", "DEBUG", ")", ":", "return", "0", ";", "case", "(", "Level", ".", "INFO", ")", ":", "return", "1", ";", "case", "(", "Level", ".", "WARN", ")", ":", "return", "2", ";", "case", "(", "Level", ".", "ERROR", ")", ":", "return", "3", ";", "default", ":", "return", "1", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1228, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 1228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 1228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
18
[ "/**\n * houston/src/lib/log/output.ts\n * An abstract class for sending logs somewhere.\n */", "import", "{", "injectable", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "Log", "}", "from", "'./log'", ";", "/**\n * A generic abstract class for handling logs.\n */", "@", "injectable", "(", ")", "export", "abstract", "class", "Output", "{", "param", "{", "Config", "}", "config", "return", "{", "boolean", "}", "public", "static", "enabled", "(", "config", ")", "{", "return", "true", ";", "}", "param", "{", "Config", "}", "config", "public", "constructor", "(", "config", ")", "{", "return", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "debug", "(", "log", ")", "{", "return", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "info", "(", "log", ")", "{", "return", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "warn", "(", "log", ")", "{", "return", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "error", "(", "log", ")", "{", "return", ";", "}", "}", "/**\n * An interface of the Output class as a constructor.\n * This is kinda pointless, but it keeps typescript happy when hinting.\n */", "export", "interface", "OutputConstructor", "{", "new", "(", "config", ")", ";", "enabled", "(", "config", ")", ":", "boolean", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, 87, null, null, null, null, null ]
19
[ "/**\n * houston/src/lib/log/services/console.ts\n * Outputs logs to the console\n */", "import", "{", "Config", "}", "from", "'../../config'", ";", "import", "{", "Level", ",", "parseLevel", "}", "from", "'../level'", ";", "import", "{", "Log", "}", "from", "'../log'", ";", "import", "{", "Output", "}", "from", "'../output'", ";", "export", "class", "Console", "extends", "Output", "{", "var", "protected", "config", ":", "Config", ";", "param", "{", "Config", "}", "config", "return", "{", "boolean", "}", "public", "static", "enabled", "(", "config", ")", "{", "if", "(", "config", ".", "has", "(", "'log.console'", ")", "===", "false", ")", "{", "return", "false", ";", "}", "return", "(", "config", ".", "get", "(", "'log.console'", ")", "!==", "'never'", ")", ";", "}", "param", "{", "Config", "}", "config", "public", "constructor", "(", "config", ")", "{", "super", "(", "config", ")", ";", "this", ".", "config", "=", "config", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "debug", "(", "log", ")", "{", "console", ".", "info", "(", "log", ".", "message", ")", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "info", "(", "log", ")", "{", "console", ".", "info", "(", "log", ".", "message", ")", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "warn", "(", "log", ")", "{", "console", ".", "warn", "(", "log", ".", "message", ")", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "error", "(", "log", ")", "{", "console", ".", "error", "(", "log", ".", "message", ")", ";", "}", "param", "{", "Level", "}", "level", "return", "{", "Boolean", "}", "protected", "allows", "(", "level", ")", "{", "if", "(", "this", ".", "config", ".", "has", "(", "'log.console'", ")", "===", "false", ")", "{", "return", "false", ";", "}", "const", "configLevel", "=", "parseLevel", "(", "this", ".", "config", ".", "get", "(", "'log.console'", ")", ")", ";", "if", "(", "level", ">=", "configLevel", ")", "{", "return", "true", ";", "}", "return", "false", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 1228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
20
[ "/**\n * houston/src/lib/log/services/sentry.ts\n * Handles logging errors to sentry\n */", "import", "{", "Config", "}", "from", "'../../config'", ";", "import", "{", "Log", "}", "from", "'../log'", ";", "import", "{", "Output", "}", "from", "'../output'", ";", "export", "class", "Sentry", "extends", "Output", "{", "var", "protected", "config", ":", "Config", ";", "var", "protected", "dns", ":", "string", ";", "var", "protected", "raven", ";", "return", "{", "boolean", "}", "public", "static", "enabled", "(", "config", ")", "{", "if", "(", "config", ".", "has", "(", "'log.sentry'", ")", "===", "false", ")", "{", "return", "false", ";", "}", "else", "if", "(", "config", ".", "has", "(", "'service.sentry.secret'", ")", "===", "false", ")", "{", "return", "false", ";", "}", "try", "{", "require", ".", "resolve", "(", "'raven'", ")", ";", "}", "catch", "(", "e", ")", "{", "return", "false", ";", "}", "return", "(", "config", ".", "get", "(", "'log.sentry'", ")", "!==", "'never'", ")", ";", "}", "param", "{", "Config", "}", "config", "public", "constructor", "(", "config", ")", "{", "super", "(", "config", ")", ";", "this", ".", "config", "=", "config", ";", "this", ".", "dns", "=", "config", ".", "get", "(", "'service.sentry.secret'", ")", ";", "this", ".", "raven", "=", "this", ".", "setup", "(", ")", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "void", "}", "public", "error", "(", "log", ")", "{", "this", ".", "raven", ".", "captureException", "(", "this", ".", "toError", "(", "log", ")", ")", ";", "}", "param", "{", "Log", "}", "log", "return", "{", "Error", "}", "public", "toError", "(", "log", ")", "{", "const", "error", "=", "new", "Error", "(", "log", ".", "message", ")", ";", "Error", ".", "captureStackTrace", "(", "error", ",", "this", ".", "toError", ")", ";", "Object", ".", "assign", "(", "error", ",", "log", ".", "data", ",", "{", "error", ":", "log", ".", "error", "}", ")", ";", "return", "error", ";", "}", "return", "{", "Raven", "}", "protected", "setup", "(", ")", "{", "return", "require", "(", "'raven'", ")", ".", "config", "(", "this", ".", "dns", ")", ".", "install", "(", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, 735, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
21
[ "/**\n * houston/src/lib/log/logger.ts\n * A manager of logs and third party logging services.\n */", "import", "{", "inject", ",", "injectable", ",", "multiInject", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "Level", ",", "levelString", "}", "from", "'./level'", ";", "import", "{", "Log", "}", "from", "'./log'", ";", "import", "{", "Output", ",", "OutputConstructor", "}", "from", "'./output'", ";", "import", "*", "as", "outputs", "from", "'./outputs'", ";", "/**\n * Log\n * A manager of logs and third party logging services\n */", "@", "injectable", "(", ")", "export", "class", "Logger", "{", "var", "protected", "config", ":", "Config", ";", "var", "protected", "outputs", ":", "Output", "[", "]", "=", "[", "]", ";", "param", "{", "Config", "}", "config", "public", "constructor", "(", "@", "inject", "(", "Config", ")", "config", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "setupOutputs", "(", "Object", ".", "keys", "(", "outputs", ")", ".", "map", "(", "(", "key", ")", "=>", "outputs", "[", "key", "]", ")", ")", ";", "}", "return", "{", "Log", "}", "public", "create", "(", ")", "{", "return", "new", "Log", "(", "this", ")", ";", "}", "param", "{", "String", "}", "message", "return", "{", "Log", "}", "public", "debug", "(", "message", ")", "{", "return", "this", ".", "create", "(", ")", ".", "setLevel", "(", "Level", ".", "DEBUG", ")", ".", "setMessage", "(", "message", ")", ";", "}", "param", "{", "String", "}", "message", "return", "{", "Log", "}", "public", "info", "(", "message", ")", "{", "return", "this", ".", "create", "(", ")", ".", "setLevel", "(", "Level", ".", "INFO", ")", ".", "setMessage", "(", "message", ")", ";", "}", "param", "{", "String", "}", "message", "return", "{", "Log", "}", "public", "warn", "(", "message", ")", "{", "return", "this", ".", "create", "(", ")", ".", "setLevel", "(", "Level", ".", "WARN", ")", ".", "setMessage", "(", "message", ")", ";", "}", "param", "{", "String", "}", "message", "return", "{", "Log", "}", "public", "error", "(", "message", ")", "{", "return", "this", ".", "create", "(", ")", ".", "setLevel", "(", "Level", ".", "ERROR", ")", ".", "setMessage", "(", "message", ")", ";", "}", "param", "{", "Log", "}", "log", "public", "send", "(", "log", ")", "{", "this", ".", "outputs", ".", "forEach", "(", "(", "output", ")", "=>", "{", "output", "[", "levelString", "(", "log", ".", "level", ")", "]", "(", "log", ")", ";", "}", ")", ";", "}", "param", "{", "OutputConstructor", "}", "outputter", "return", "{", "Logger", "}", "protected", "setupOutput", "(", "outputter", ")", "{", "if", "(", "outputter", ".", "enabled", "(", "this", ".", "config", ")", ")", "{", "this", ".", "outputs", ".", "push", "(", "new", "outputter", "(", "this", ".", "config", ")", ")", ";", "}", "return", "this", ";", "}", "param", "{", "OutputConstructor", "[", "]", "}", "outputters", "return", "{", "Logger", "}", "protected", "setupOutputs", "(", "outputters", ")", "{", "outputters", ".", "forEach", "(", "(", "outputter", ")", "=>", "{", "this", ".", "setupOutput", "(", "outputter", ")", ";", "}", ")", ";", "return", "this", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 735, null, null, null, null, null, null, null, null, null, 632, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
22
[ "exports", "import", "{", "injectable", "}", "from", "'inversify'", ";", "import", "{", "Level", "}", "from", "'./level'", ";", "import", "{", "Logger", "}", "from", "'./logger'", ";", "/**\n * Log\n * A single log line.\n */", "@", "injectable", "(", ")", "export", "class", "Log", "{", "var", "public", "level", ":", "Level", ";", "var", "public", "message", "?", ":", "string", ";", "var", "public", "data", ":", "object", ";", "var", "public", "error", "?", ":", "Error", ";", "var", "protected", "date", ":", "Date", ";", "var", "protected", "logger", ":", "Logger", ";", "param", "{", "Logger", "}", "logger", "public", "constructor", "(", "logger", ")", "{", "this", ".", "level", "=", "Level", ".", "DEBUG", ";", "this", ".", "data", "=", "{", "}", ";", "this", ".", "date", "=", "new", "Date", "(", ")", ";", "this", ".", "logger", "=", "logger", ";", "}", "param", "{", "Level", "}", "level", "return", "{", "Log", "}", "public", "setLevel", "(", "level", ")", "{", "this", ".", "level", "=", "level", ";", "return", "this", ";", "}", "param", "{", "String", "}", "message", "return", "{", "Log", "}", "public", "setMessage", "(", "message", ")", "{", "this", ".", "message", "=", "message", ";", "return", "this", ";", "}", "param", "{", "String", "}", "key", "param", "{", "*", "}", "value", "return", "{", "Log", "}", "public", "setData", "(", "key", ",", "value", ")", "{", "this", ".", "data", "[", "key", "]", "=", "value", ";", "return", "this", ";", "}", "param", "{", "Error", "}", "err", "return", "{", "Log", "}", "public", "setError", "(", "err", ")", "{", "this", ".", "error", "=", "err", ";", "return", "this", ";", "}", "return", "{", "Date", "}", "public", "getDate", "(", ")", "{", "return", "this", ".", "date", ";", "}", "return", "{", "void", "}", "public", "send", "(", ")", "{", "return", "this", ".", "logger", ".", "send", "(", "this", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1228, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 26, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
23
[ "/**\n * houston/src/lib/cache/type.d.ts\n * Types for the cache utility\n */", "export", "const", "Cache", "=", "Symbol", ".", "for", "(", "'Cache'", ")", ";", "export", "interface", "ICacheOptions", "{", "tty", "?", ":", "number", ";", "}", "export", "interface", "ICache", "{", "get", "(", "key", ")", ":", "Promise", "<", "string", "|", "null", ">", ";", "set", "(", "key", ",", "value", ")", ":", "Promise", "<", "void", ">", ";", "}", "export", "type", "ICacheFactory", "=", "(", "namespace", ":", "string", ",", "options", "?", ":", "ICacheOptions", ")", "=>", "ICache", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
24
[ "/**\n * houston/src/lib/utility/rdnn.ts\n * Some higher level RDNN functions\n */", "see", "https", "param", "{", "string", "}", "rdnn", "param", "{", "string", "}", "normalizer", "return", "{", "string", "}", "export", "function", "sanitize", "(", "rdnn", ",", "normalizer", "=", "'_'", ")", "{", "return", "rdnn", ".", "replace", "(", "/\\s/gi", ",", "normalizer", ")", ".", "replace", "(", "/\\.([0-9])/gi", ",", "`.${", "normalizer", "}$1`", ")", ".", "replace", "(", "/\\_|\\-/gi", ",", "normalizer", ")", ".", "toLowerCase", "(", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
25
[ "/**\n * houston/src/lib/service/github.ts\n * Handles interaction with GitHub repositories.\n *\n * NOTE: If you are using a personal auth token, the url should be like so:\n * \"https://x-access-token:asdf1234@github.com/elementary/houston\"\n */", "import", "*", "as", "fileType", "from", "'file-type'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "{", "inject", ",", "injectable", ",", "LazyServiceIdentifer", "}", "from", "'inversify'", ";", "import", "*", "as", "jsonwebtoken", "from", "'jsonwebtoken'", ";", "import", "*", "as", "Git", "from", "'nodegit'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "agent", "from", "'superagent'", ";", "import", "*", "as", "URL", "from", "'url'", ";", "import", "*", "as", "uuid", "from", "'uuid/v4'", ";", "import", "{", "App", "}", "from", "'../app'", ";", "import", "{", "Cache", ",", "ICache", ",", "ICacheFactory", "}", "from", "'../cache'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "sanitize", "}", "from", "'../utility/rdnn'", ";", "import", "*", "as", "type", "from", "'./type'", ";", "export", "const", "github", "=", "Symbol", "(", "'GitHub'", ")", ";", "export", "type", "IGitHubFactory", "=", "(", "url", ":", "string", ")", "=>", "GitHub", ";", "@", "injectable", "(", ")", "export", "class", "GitHub", "implements", "type", ".", "ICodeRepository", ",", "type", ".", "IPackageRepository", ",", "type", ".", "ILogRepository", "{", "var", "public", "tmpFolder", "=", "path", ".", "resolve", "(", "os", ".", "tmpdir", "(", ")", ",", "'houston'", ")", ";", "var", "public", "serviceName", "=", "'GitHub'", ";", "var", "public", "host", "=", "'github.com'", ";", "var", "public", "username", ":", "string", ";", "var", "public", "repository", ":", "string", ";", "var", "public", "authUsername", "?", ":", "string", ";", "var", "public", "authPassword", "?", ":", "string", ";", "var", "public", "reference", "=", "'refs/heads/master'", ";", "var", "protected", "config", ":", "Config", ";", "var", "protected", "cache", ":", "ICache", ";", "async", "param", "{", "String", "}", "p", "return", "{", "String", "}", "protected", "static", "async", "getFileType", "(", "p", ")", "{", "const", "buffer", "=", "await", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "fs", ".", "open", "(", "p", ",", "'r'", ",", "(", "openErr", ",", "fd", ")", "=>", "{", "if", "(", "openErr", "!=", "null", ")", "{", "return", "reject", "(", "openErr", ")", ";", "}", "fs", ".", "read", "(", "fd", ",", "Buffer", ".", "alloc", "(", "4100", ")", ",", "0", ",", "4100", ",", "0", ",", "(", "readErr", ",", "bytesRead", ",", "buff", ")", "=>", "{", "fs", ".", "close", "(", "fd", ")", ";", "if", "(", "readErr", "!=", "null", ")", "{", "return", "reject", "(", "readErr", ")", ";", "}", "if", "(", "bytesRead", "<", "4100", ")", "{", "return", "resolve", "(", "buff", ".", "slice", "(", "0", ",", "bytesRead", ")", ")", ";", "}", "else", "{", "return", "resolve", "(", "buff", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", ")", ";", "return", "fileType", "(", "buffer", ")", ".", "mime", ";", "}", "param", "{", "App", "}", "app", "constructor", "(", "@", "inject", "(", "new", "LazyServiceIdentifer", "(", "(", ")", "=>", "App", ")", ")", "app", ")", "{", "this", ".", "config", "=", "app", ".", "get", "(", "Config", ")", ";", "this", ".", "cache", "=", "app", ".", "get", "<", "ICacheFactory", ">", "(", "Cache", ")", "(", "'lib/service/github'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "rdnn", "(", ")", "{", "return", "sanitize", "(", "`com.github.${", "this", ".", "username", "}.${", "this", ".", "repository", "}`", ")", ";", "}", "return", "{", "string", "}", "public", "get", "url", "(", ")", ":", "string", "{", "let", "auth", "=", "null", ";", "if", "(", "this", ".", "authUsername", "!==", "'installation'", ")", "{", "if", "(", "this", ".", "authUsername", "!=", "null", "||", "this", ".", "authPassword", "!=", "null", ")", "{", "auth", "=", "`${", "this", ".", "authUsername", "}:${", "this", ".", "authPassword", "}`", ";", "}", "}", "return", "URL", ".", "format", "(", "{", "auth", ",", "host", ":", "this", ".", "host", ",", "pathname", ":", "`/${", "this", ".", "username", "}/${", "this", ".", "repository", "}.git`", ",", "protocol", ":", "'https'", "}", ")", ";", "}", "return", "{", "string", "}", "public", "set", "url", "(", "p", ")", "{", "if", "(", "p", ".", "indexOf", "(", "'github'", ")", "===", "-", "1", ")", "{", "throw", "new", "Error", "(", "'Given URL is not a GitHub repository'", ")", ";", "}", "const", "httpPath", "=", "(", "p", ".", "startsWith", "(", "'git@'", ")", "?", "p", ".", "replace", "(", "'git@'", ",", "'https://'", ")", ":", "p", ")", ".", "replace", "(", "'://github.com:'", ",", "'://github.com/'", ")", ".", "replace", "(", "/\\.git$/", ",", "''", ")", ";", "const", "url", "=", "new", "URL", ".", "URL", "(", "httpPath", ")", ";", "const", "[", "host", ",", "username", ",", "repository", "]", "=", "url", ".", "pathname", ".", "split", "(", "'/'", ")", ";", "this", ".", "host", "=", "url", ".", "host", ";", "this", ".", "username", "=", "username", ";", "this", ".", "repository", "=", "repository", ";", "this", ".", "authUsername", "=", "(", "url", ".", "username", "!==", "''", ")", "?", "url", ".", "username", ":", "null", ";", "this", ".", "authPassword", "=", "(", "url", ".", "password", "!==", "''", ")", "?", "url", ".", "password", ":", "null", ";", "if", "(", "this", ".", "authUsername", "!=", "null", "&&", "this", ".", "authPassword", "==", "null", ")", "{", "this", ".", "authPassword", "=", "this", ".", "authUsername", ";", "this", ".", "authUsername", "=", "'x-access-token'", ";", "}", "}", "async", "param", "{", "string", "}", "p", "param", "{", "string", "}", "reference", "return", "{", "void", "}", "public", "async", "clone", "(", "p", ",", "reference", "=", "this", ".", "reference", ")", "{", "const", "repo", "=", "await", "Git", ".", "Clone", "(", "this", ".", "url", ",", "p", ")", ";", "const", "ref", "=", "await", "repo", ".", "getReference", "(", "reference", ")", ";", "const", "commit", "=", "await", "ref", ".", "peel", "(", "Git", ".", "Object", ".", "TYPE", ".", "COMMIT", ")", ";", "const", "branch", "=", "await", "repo", ".", "createBranch", "(", "'houston'", ",", "commit", ",", "true", ")", ";", "await", "repo", ".", "checkoutBranch", "(", "branch", ",", "{", "}", ")", ";", "await", "this", ".", "recursiveClone", "(", "p", ")", ";", "await", "fs", ".", "remove", "(", "path", ".", "resolve", "(", "p", ",", "'.git'", ")", ")", ";", "}", "async", "return", "{", "string", "[", "]", "}", "public", "async", "references", "(", ")", "{", "const", "p", "=", "path", ".", "resolve", "(", "this", ".", "tmpFolder", ",", "uuid", "(", ")", ")", ";", "const", "repo", "=", "await", "Git", ".", "Clone", "(", "this", ".", "url", ",", "p", ")", ";", "const", "branches", "=", "await", "repo", ".", "getReferenceNames", "(", "Git", ".", "Reference", ".", "TYPE", ".", "LISTALL", ")", ";", "await", "fs", ".", "remove", "(", "p", ")", ";", "return", "branches", ";", "}", "async", "param", "{", "IPackage", "}", "pkg", "param", "{", "IStage", "}", "stage", "param", "{", "string", "}", "reference", "return", "{", "IPackage", "}", "public", "async", "uploadPackage", "(", "pkg", ",", "stage", ",", "reference", "?", ")", "{", "if", "(", "pkg", ".", "githubId", "!=", "null", ")", "{", "return", "pkg", ";", "}", "return", "pkg", ";", "const", "auth", "=", "await", "this", ".", "getAuthorization", "(", ")", ";", "const", "url", "=", "`${", "this", ".", "username", "}/${", "this", ".", "repository", "}/releases/tags/${", "reference", "}`", ";", "const", "{", "body", "}", "=", "await", "agent", ".", "get", "(", "`https://api.github.com/repos/${", "url", "}`", ")", ".", "set", "(", "'accept'", ",", "'application/vnd.github.v3+json'", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "auth", ")", ";", "if", "(", "body", ".", "upload_url", "==", "null", ")", "{", "throw", "new", "Error", "(", "'No Upload URL for GitHub release'", ")", ";", "}", "const", "mime", "=", "await", "GitHub", ".", "getFileType", "(", "pkg", ".", "path", ")", ";", "const", "stat", "=", "await", "fs", ".", "stat", "(", "pkg", ".", "path", ")", ";", "const", "file", "=", "await", "fs", ".", "createReadStream", "(", "pkg", ".", "path", ")", ";", "const", "res", "=", "await", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "let", "data", "=", "''", ";", "const", "req", "=", "agent", ".", "post", "(", "body", ".", "upload_url", ".", "replace", "(", "'{?name,label}'", ",", "''", ")", ")", ".", "set", "(", "'content-type'", ",", "mime", ")", ".", "set", "(", "'content-length'", ",", "stat", ".", "size", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "auth", ")", ".", "query", "(", "{", "name", ":", "pkg", ".", "name", "}", ")", ".", "query", "(", "(", "pkg", ".", "description", "!=", "null", ")", "?", "{", "label", ":", "pkg", ".", "description", "}", ":", "{", "}", ")", ".", "parse", "(", "(", "response", ",", "fn", ")", "=>", "{", "response", ".", "on", "(", "'data'", ",", "(", "chunk", ")", "=>", "{", "data", "+=", "chunk", ";", "}", ")", ";", "response", ".", "on", "(", "'end'", ",", "fn", ")", ";", "}", ")", ".", "on", "(", "'error'", ",", "reject", ")", ".", "on", "(", "'end'", ",", "(", "err", ",", "response", ")", "=>", "{", "if", "(", "err", "!=", "null", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "try", "{", "return", "resolve", "(", "JSON", ".", "parse", "(", "data", ")", ")", ";", "}", "catch", "(", "err", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "}", ")", ";", "file", ".", "pipe", "(", "req", ")", ".", "on", "(", "'error'", ",", "reject", ")", ".", "on", "(", "'close'", ",", "(", ")", "=>", "resolve", "(", "data", ")", ")", ";", "}", ")", ";", "return", "{", "...", "pkg", "}", ";", "}", "async", "param", "{", "ILog", "}", "log", "param", "{", "IStage", "}", "stage", "param", "{", "string", "}", "reference", "return", "{", "ILog", "}", "public", "async", "uploadLog", "(", "log", ",", "stage", ",", "reference", "?", ")", "{", "if", "(", "log", ".", "githubId", "!=", "null", ")", "{", "return", ";", "}", "const", "auth", "=", "await", "this", ".", "getAuthorization", "(", ")", ";", "const", "hasLabel", "=", "await", "agent", ".", "get", "(", "`https://api.github.com/repos/${", "this", ".", "username", "}/${", "this", ".", "repository", "}/labels/AppCenter`", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "auth", ")", ".", "then", "(", "(", ")", "=>", "true", ")", ".", "catch", "(", "(", ")", "=>", "false", ")", ";", "if", "(", "!", "hasLabel", ")", "{", "await", "agent", ".", "post", "(", "`https://api.github.com/repos/${", "this", ".", "username", "}/${", "this", ".", "repository", "}/labels`", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "auth", ")", ".", "send", "(", "{", "color", ":", "'4c158a'", ",", "description", ":", "'Issues related to releasing on AppCenter'", ",", "name", ":", "'AppCenter'", "}", ")", ";", "}", "const", "{", "body", "}", "=", "await", "agent", ".", "post", "(", "`https://api.github.com/repos/${", "this", ".", "username", "}/${", "this", ".", "repository", "}/issues`", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "auth", ")", ".", "send", "(", "{", "body", ":", "log", ".", "body", ",", "labels", ":", "[", "'AppCenter'", "]", ",", "title", ":", "log", ".", "title", "}", ")", ";", "return", "{", "...", "log", ",", "githubId", ":", "body", ".", "id", "}", ";", "}", "async", "return", "{", "string", "}", "public", "async", "getAuthorization", "(", ")", "{", "if", "(", "this", ".", "authUsername", "!==", "'installation'", ")", "{", "return", "`Bearer ${", "this", ".", "authPassword", "}`", ";", "}", "else", "{", "const", "cachedToken", "=", "await", "this", ".", "cache", ".", "get", "(", "this", ".", "authPassword", ")", ";", "if", "(", "cachedToken", "==", "null", ")", "{", "const", "token", "=", "await", "this", ".", "generateToken", "(", "Number", "(", "this", ".", "authPassword", ")", ")", ";", "await", "this", ".", "cache", ".", "set", "(", "this", ".", "authPassword", ",", "token", ")", ";", "return", "`token ${", "token", "}`", ";", "}", "else", "{", "return", "`token ${", "cachedToken", "}`", ";", "}", "}", "}", "async", "return", "{", "string", "}", "protected", "async", "generateJwt", "(", ")", "{", "const", "keyPath", "=", "this", ".", "config", ".", "get", "(", "'service.github.key'", ")", ";", "const", "key", "=", "await", "fs", ".", "readFile", "(", "keyPath", ",", "'utf-8'", ")", ";", "const", "payload", "=", "{", "iat", ":", "Math", ".", "floor", "(", "Date", ".", "now", "(", ")", "/", "1000", ")", ",", "iss", ":", "this", ".", "config", ".", "get", "(", "'service.github.app'", ")", "}", ";", "const", "options", "=", "{", "algorithm", ":", "'RS256'", ",", "expiresIn", ":", "'1m'", "}", ";", "return", "new", "Promise", "<", "string", ">", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "jsonwebtoken", ".", "sign", "(", "payload", ",", "key", ",", "options", ",", "(", "err", ",", "token", ")", "=>", "{", "if", "(", "err", "!=", "null", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "else", "{", "return", "resolve", "(", "token", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}", "async", "param", "{", "number", "}", "installation", "return", "{", "string", "}", "protected", "async", "generateToken", "(", "installation", ")", "{", "const", "jwt", "=", "await", "this", ".", "generateJwt", "(", ")", ";", "return", "agent", ".", "post", "(", "`https://api.github.com/app/installations/${", "installation", "}/access_tokens`", ")", ".", "set", "(", "'accept'", ",", "'application/vnd.github.machine-man-preview+json'", ")", ".", "set", "(", "'user-agent'", ",", "'elementary-houston'", ")", ".", "set", "(", "'authorization'", ",", "`Bearer ${", "jwt", "}`", ")", ".", "then", "(", "(", "res", ")", "=>", "res", ".", "body", ".", "token", ")", ";", "}", "async", "param", "{", "String", "}", "clonePath", "return", "{", "void", "}", "protected", "async", "recursiveClone", "(", "clonePath", ")", "{", "const", "repo", "=", "await", "Git", ".", "Repository", ".", "open", "(", "clonePath", ")", ";", "await", "Git", ".", "Submodule", ".", "foreach", "(", "repo", ",", "async", "(", "submodule", ")", "=>", "{", "await", "submodule", ".", "update", "(", "1", ",", "new", "Git", ".", "SubmoduleUpdateOptions", "(", ")", ")", ";", "await", "this", ".", "recursiveClone", "(", "path", ".", "join", "(", "clonePath", ",", "submodule", ".", "path", "(", ")", ")", ")", ";", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 189, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 113, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, 0, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, 0, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
26
[ "/**\n * houston/src/lib/service/aptly/package-repo.ts\n * Class for aptly package stuff\n */", "import", "*", "as", "crypto", "from", "'crypto'", ";", "import", "{", "inject", ",", "injectable", "}", "from", "'inversify'", ";", "import", "*", "as", "agent", "from", "'superagent'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "Logger", "}", "from", "'../log'", ";", "import", "*", "as", "type", "from", "'./type'", ";", "var", "const", "DEFAULT_ARCHITECTURES", "=", "[", "'amd64'", "]", ";", "var", "const", "DEFAULT_DISTRIBUTION", "=", "'bionic'", ";", "export", "interface", "IAptlyDetails", "{", "prefix", "?", ":", "string", ";", "distribution", ":", "string", ";", "architectures", ":", "string", "[", "]", ";", "}", "param", "{", "...", "String", "}", "args", "return", "{", "String", "}", "export", "function", "createUrl", "(", "...", "args", ")", "{", "return", "args", ".", "filter", "(", "(", "arg", ")", "=>", "(", "arg", "!=", "null", "&&", "arg", "!==", "undefined", ")", ")", ".", "join", "(", "'/'", ")", ".", "replace", "(", "/(?<!:)\\/{2,}/", ",", "'/'", ")", ";", "}", "@", "injectable", "(", ")", "export", "class", "Aptly", "implements", "type", ".", "IPackageRepository", "{", "var", "public", "serviceName", "=", "'elementary Package Repository'", ";", "var", "protected", "config", ":", "Config", ";", "var", "protected", "logger", ":", "Logger", ";", "param", "{", "Config", "}", "config", "constructor", "(", "@", "inject", "(", "Config", ")", "config", ",", "@", "inject", "(", "Logger", ")", "logger", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "logger", "=", "logger", ";", "}", "async", "param", "{", "IPackage", "}", "pkg", "param", "{", "IStage", "}", "stage", "param", "{", "String", "}", "reference", "return", "{", "IPackage", "}", "public", "async", "uploadPackage", "(", "pkg", ",", "stage", "?", ",", "reference", "?", ")", "{", "const", "rootUrl", "=", "this", ".", "config", ".", "get", "(", "'service.aptly.url'", ")", ";", "const", "details", "=", "this", ".", "getAptlyDetails", "(", "pkg", ",", "stage", ")", ";", "if", "(", "pkg", ".", "aptlyId", "==", "null", ")", "{", "const", "fileHash", "=", "crypto", ".", "createHash", "(", "'md5'", ")", ".", "update", "(", "JSON", ".", "stringify", "(", "pkg", ")", ")", ".", "digest", "(", "'hex'", ")", ".", "substring", "(", "0", ",", "6", ")", ";", "const", "filePkgName", "=", "pkg", ".", "name", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/[^0-9a-z-\\.]/gi", ",", "''", ")", ";", "const", "fileName", "=", "`${", "filePkgName", "}-${", "fileHash", "}.${", "pkg", ".", "type", "}`", ";", "await", "agent", ".", "post", "(", "createUrl", "(", "rootUrl", ",", "'files'", ",", "fileName", ")", ")", ".", "attach", "(", "'file'", ",", "pkg", ".", "path", ",", "fileName", ")", ";", "const", "aptlyFileName", "=", "await", "agent", ".", "post", "(", "createUrl", "(", "rootUrl", ",", "'repos'", ",", "details", ".", "prefix", ",", "'file'", ",", "fileName", ")", ")", ".", "then", "(", "(", "data", ")", "=>", "{", "if", "(", "data", ".", "body", ".", "FailedFiles", "!=", "null", "&&", "data", ".", "body", ".", "FailedFiles", ".", "length", ">", "0", ")", "{", "throw", "new", "Error", "(", "'Unable to add package to Aptly'", ")", ";", "}", "else", "{", "return", "data", ".", "body", ".", "Report", ".", "Added", "[", "0", "]", ".", "split", "(", "' '", ")", "[", "0", "]", ";", "}", "}", ")", ";", "pkg", ".", "aptlyId", "=", "await", "agent", ".", "get", "(", "createUrl", "(", "rootUrl", ",", "'repos'", ",", "details", ".", "prefix", ",", "'packages'", ")", ")", ".", "query", "(", "{", "q", ":", "aptlyFileName", "}", ")", ".", "then", "(", "(", "data", ")", "=>", "{", "if", "(", "data", ".", "body", "==", "null", "||", "data", ".", "body", ".", "length", "<", "1", ")", "{", "throw", "new", "Error", "(", "'Unable to find uploaded Aptly package'", ")", ";", "}", "else", "{", "return", "data", ".", "body", "[", "0", "]", ";", "}", "}", ")", ";", "await", "agent", ".", "delete", "(", "createUrl", "(", "rootUrl", ",", "'files'", ",", "fileName", ")", ")", ";", "}", "await", "agent", ".", "post", "(", "createUrl", "(", "rootUrl", ",", "'repos'", ",", "details", ".", "prefix", ",", "'packages'", ")", ")", ".", "send", "(", "{", "PackageRefs", ":", "[", "pkg", ".", "aptlyId", "]", "}", ")", ";", "return", "pkg", ";", "}", "param", "{", "IPackage", "}", "pkg", "param", "{", "IStage", "}", "stage", "return", "{", "IAptlyDetails", "}", "public", "getAptlyDetails", "(", "pkg", ",", "stage", ")", "{", "const", "resolveFn", "=", "(", "value", ")", "=>", "{", "const", "defaultValue", "=", "{", "architectures", ":", "(", "(", "value", "||", "{", "}", ")", ".", "architectures", "||", "DEFAULT_ARCHITECTURES", ")", ",", "distribution", ":", "(", "(", "value", "||", "{", "}", ")", ".", "distribution", "||", "pkg", ".", "distribution", "||", "DEFAULT_DISTRIBUTION", ")", ",", "prefix", ":", "(", "value", "||", "{", "}", ")", ".", "prefix", "}", ";", "switch", "(", "typeof", "value", ")", "{", "case", "(", "'string'", ")", ":", "return", "{", "...", "defaultValue", ",", "prefix", ":", "value", "}", ";", "case", "(", "'function'", ")", ":", "return", "resolveFn", "(", "value", "(", "pkg", ")", ")", ";", "case", "(", "'object'", ")", ":", "case", "(", "'undefined'", ")", ":", "return", "defaultValue", ";", "default", ":", "throw", "new", "Error", "(", "'Aptly settings returned unknown value.'", ")", ";", "}", "}", ";", "return", "resolveFn", "(", "this", ".", "config", ".", "get", "(", "`service.aptly.${", "stage", "}`", ")", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, 0, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
27
[ "/**\n * houston/src/lib/service/index.ts\n * Entry file to all of the fun third party services we interact with\n */", "import", "*", "as", "type", "from", "'./type'", ";", "import", "{", "GitHub", "}", "from", "'./github'", ";", "export", "function", "isCodeRepository", "(", "value", ")", "{", "return", "(", "value", "!=", "null", "&&", "typeof", "value", ".", "clone", "===", "'function'", ")", ";", "}", "export", "function", "isPackageRepository", "(", "value", ")", "{", "return", "(", "value", "!=", "null", "&&", "typeof", "value", ".", "uploadPackage", "===", "'function'", ")", ";", "}", "export", "function", "isLogRepository", "(", "value", ")", "{", "return", "(", "value", "!=", "null", "&&", "typeof", "value", ".", "uploadLog", "===", "'function'", ")", ";", "}", "export", "{", "ICodeRepository", ",", "ICodeRepositoryFactory", ",", "ILog", ",", "IPackage", ",", "IPackageRepository", ",", "IServiceIds", "}", "from", "'./type'", ";", "export", "{", "Aptly", "}", "from", "'./aptly'", ";", "export", "{", "github", ",", "IGitHubFactory", "}", "from", "'./github'", ";", "export", "const", "codeRepository", "=", "Symbol", "(", "'codeRepository'", ")", ";", "export", "const", "packageRepository", "=", "Symbol", "(", "'packageRepository'", ")", ";", "export", "const", "logRepository", "=", "Symbol", "(", "'logRepository'", ")", ";", "export", "const", "codeRepositoryFactory", "=", "Symbol", "(", "'codeRepositoryFactory'", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
28
[ "/**\n * houston/src/lib/utility/eventemitter.ts\n * An event emitter based on eventemitter2 with some nice added features\n */", "import", "{", "EventEmitter2", "}", "from", "'eventemitter2'", ";", "import", "*", "as", "defaultsDeep", "from", "'lodash/defaultsDeep'", ";", "const", "DEFAULT_OPTS", "=", "{", "delimiter", ":", "':'", ",", "maxListeners", ":", "10", ",", "newListener", ":", "false", ",", "verboseMemoryLeak", ":", "true", ",", "wildcard", ":", "true", "}", ";", "export", "class", "EventEmitter", "extends", "EventEmitter2", "{", "param", "{", "Object", "}", "opts", "public", "constructor", "(", "opts", "=", "{", "}", ")", "{", "super", "(", "defaultsDeep", "(", "{", "}", ",", "DEFAULT_OPTS", ",", "opts", ")", ")", ";", "}", "param", "{", "string", "}", "event", "param", "{", "*", "}", "arg", "return", "{", "*", "}", "public", "async", "emitAsyncChain", "<", "T", ">", "(", "event", ",", "arg", ")", "{", "const", "listeners", "=", "this", ".", "listeners", "(", "event", ")", ";", "let", "value", "=", "arg", ";", "for", "(", "const", "listener", "of", "listeners", ")", "{", "await", "Promise", ".", "resolve", "(", "listener", "(", "value", ")", ")", ".", "then", "(", "(", "result", ")", "=>", "(", "value", "=", "result", ")", ")", ";", "}", "return", "value", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 601, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
29
[ "/**\n * houston/src/worker/type.ts\n * A bunch of type definitions for the worker process\n */", "import", "{", "App", "}", "from", "'../lib/app'", ";", "import", "{", "Level", "}", "from", "'../lib/log/level'", ";", "import", "*", "as", "service", "from", "'../lib/service'", ";", "import", "{", "EventEmitter", "}", "from", "'../lib/utility/eventemitter'", ";", "export", "type", "Type", "=", "'app'", "|", "'system-app'", "|", "'library'", "|", "'system-library'", "|", "'debug'", ";", "export", "{", "IPackage", "}", "from", "'../lib/service'", ";", "export", "interface", "IResult", "{", "failed", ":", "boolean", ";", "packages", ":", "service", ".", "IPackage", "[", "]", ";", "appcenter", "?", ":", "object", ";", "appstream", "?", ":", "string", ";", "logs", ":", "ILog", "[", "]", ";", "}", "export", "interface", "ILog", "extends", "service", ".", "ILog", "{", "level", ":", "Level", ";", "}", "export", "interface", "IChange", "{", "version", ":", "string", ";", "author", ":", "string", ";", "changes", ":", "string", ";", "date", ":", "Date", ";", "}", "export", "interface", "IContext", "{", "type", ":", "Type", ";", "nameDeveloper", ":", "string", ";", "nameDomain", ":", "string", ";", "nameHuman", ":", "string", ";", "version", ":", "string", ";", "architecture", ":", "string", ";", "distribution", ":", "string", ";", "references", ":", "string", "[", "]", ";", "changelog", ":", "IChange", "[", "]", ";", "package", "?", ":", "service", ".", "IPackage", ";", "appcenter", "?", ":", "object", ";", "appstream", "?", ":", "string", ";", "stripe", "?", ":", "string", ";", "logs", ":", "ILog", "[", "]", ";", "}", "export", "interface", "ITaskConstructor", "{", "new", "(", "worker", ")", ":", "ITask", ";", "}", "export", "interface", "ITask", "{", "run", "(", ")", ":", "Promise", "<", "void", ">", ";", "}", "export", "interface", "IWorker", "extends", "EventEmitter", "{", "app", ":", "App", ";", "context", ":", "IContext", ";", "fails", ":", "boolean", ";", "passes", ":", "boolean", ";", "postTasks", ":", "ITaskConstructor", "[", "]", ";", "repository", ":", "service", ".", "ICodeRepository", ";", "result", ":", "IResult", ";", "tasks", ":", "ITaskConstructor", "[", "]", ";", "workspace", ":", "string", ";", "setup", "(", ")", ";", "run", "(", ")", ";", "teardown", "(", ")", ";", "stop", "(", ")", ";", "report", "(", "err", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 37593, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null ]
30
[ "/**\n * houston/src/worker/log.ts\n * A log to be passed around during a worker role\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "{", "Level", "}", "from", "'../lib/log/level'", ";", "import", "render", "from", "'../lib/utility/template'", ";", "import", "{", "ILog", "}", "from", "'./type'", ";", "export", "class", "Log", "extends", "Error", "implements", "ILog", "{", "var", "public", "static", "Level", "=", "Level", ";", "var", "public", "title", ":", "string", ";", "var", "public", "body", "?", ":", "string", ";", "var", "public", "level", ":", "Level", ";", "var", "public", "error", "?", ":", "Error", ";", "param", "{", "Level", "}", "level", "param", "{", "string", "}", "path", "param", "{", "object", "}", "data", "return", "{", "Log", "}", "public", "static", "template", "(", "level", ",", "path", ",", "data", "=", "{", "}", ")", "{", "const", "template", "=", "fs", ".", "readFileSync", "(", "path", ",", "'utf8'", ")", ";", "const", "raw", "=", "render", "(", "template", ",", "data", ")", ";", "let", "title", "=", "raw", ".", "trim", "(", ")", ".", "split", "(", "'\\n'", ")", "[", "0", "]", ".", "trim", "(", ")", ";", "if", "(", "title", ".", "startsWith", "(", "'#'", ")", ")", "{", "title", "=", "title", ".", "substring", "(", "2", ")", ";", "}", "const", "body", "=", "raw", ".", "trim", "(", ")", ".", "split", "(", "'\\n'", ")", ".", "slice", "(", "1", ")", ".", "join", "(", "'\\n'", ")", ".", "trim", "(", ")", ";", "return", "new", "Log", "(", "level", ",", "title", ",", "body", ")", ";", "}", "param", "{", "Level", "}", "level", "param", "{", "string", "}", "title", "param", "{", "string", "}", "body", "constructor", "(", "level", ",", "title", ",", "body", "?", ")", "{", "super", "(", "title", ")", ";", "Object", ".", "setPrototypeOf", "(", "this", ",", "Log", ".", "prototype", ")", ";", "this", ".", "name", "=", "this", ".", "constructor", ".", "name", ";", "Error", ".", "captureStackTrace", "(", "this", ",", "this", ".", "constructor", ")", ";", "this", ".", "level", "=", "level", ";", "this", ".", "title", "=", "title", ";", "this", ".", "body", "=", "body", ";", "}", "param", "{", "Error", "}", "error", "return", "{", "Log", "}", "public", "setError", "(", "error", ")", "{", "this", ".", "message", "=", "error", ".", "message", ";", "this", ".", "error", "=", "error", ";", "return", "this", ";", "}", "return", "{", "string", "}", "public", "toString", "(", ")", "{", "const", "out", "=", "[", "`# ${", "this", ".", "title", "}`", ",", "''", "]", ";", "if", "(", "this", ".", "body", "!=", "null", ")", "{", "out", ".", "push", "(", "...", "this", ".", "body", ".", "split", "(", "'\\n'", ")", ")", ";", "}", "else", "if", "(", "this", ".", "error", "!=", "null", ")", "{", "out", ".", "push", "(", "this", ".", "error", ".", "message", ")", ";", "out", ".", "push", "(", "...", "this", ".", "error", ".", "stack", ".", "split", "(", "'\\n'", ")", ")", ";", "}", "else", "if", "(", "this", ".", "stack", "!=", "null", ")", "{", "out", ".", "push", "(", "...", "this", ".", "stack", ".", "split", "(", "'\\n'", ")", ")", ";", "}", "return", "out", ".", "join", "(", "'\\n'", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 1228, null, 2, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 1228, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
31
[ "exports", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "{", "clone", "}", "from", "'lodash'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "uuid", "from", "'uuid/v4'", ";", "import", "{", "App", "}", "from", "'../lib/app'", ";", "import", "{", "Config", "}", "from", "'../lib/config'", ";", "import", "{", "ICodeRepository", "}", "from", "'../lib/service'", ";", "import", "{", "EventEmitter", "}", "from", "'../lib/utility/eventemitter'", ";", "import", "{", "Log", "}", "from", "'./log'", ";", "import", "*", "as", "type", "from", "'./type'", ";", "const", "tempDir", "=", "path", ".", "resolve", "(", "os", ".", "tmpdir", "(", ")", ",", "'houston'", ")", ";", "export", "class", "Worker", "extends", "EventEmitter", "implements", "type", ".", "IWorker", "{", "var", "public", "app", ":", "App", ";", "var", "public", "get", "config", "(", ")", ":", "Config", "{", "return", "this", ".", "app", ".", "get", "<", "Config", ">", "(", "Config", ")", ";", "}", "var", "public", "repository", ":", "ICodeRepository", ";", "var", "public", "context", ":", "type", ".", "IContext", ";", "var", "public", "workspace", ":", "string", ";", "var", "public", "tasks", ":", "type", ".", "ITaskConstructor", "[", "]", "=", "[", "]", ";", "var", "public", "postTasks", ":", "type", ".", "ITaskConstructor", "[", "]", "=", "[", "]", ";", "var", "public", "forks", ":", "Worker", "[", "]", "=", "[", "]", ";", "var", "public", "running", ":", "type", ".", "ITask", "|", "null", ";", "param", "{", "App", "}", "app", "param", "{", "ICodeRepository", "}", "repository", "param", "{", "IContext", "}", "context", "constructor", "(", "app", ",", "repository", ",", "context", ")", "{", "super", "(", ")", ";", "this", ".", "app", "=", "app", ";", "this", ".", "repository", "=", "repository", ";", "this", ".", "context", "=", "context", ";", "this", ".", "workspace", "=", "path", ".", "resolve", "(", "tempDir", ",", "uuid", "(", ")", ")", ";", "}", "return", "{", "boolean", "}", "public", "get", "fails", "(", ")", ":", "boolean", "{", "return", "this", ".", "result", ".", "failed", ";", "}", "return", "{", "boolean", "}", "public", "get", "passes", "(", ")", ":", "boolean", "{", "return", "(", "this", ".", "fails", "===", "false", ")", ";", "}", "return", "{", "IContext", "[", "]", "}", "public", "get", "contexts", "(", ")", ":", "type", ".", "IContext", "[", "]", "{", "return", "[", "this", ".", "context", ",", "...", "this", ".", "forks", ".", "map", "(", "(", "worker", ")", "=>", "worker", ".", "contexts", ")", ".", "reduce", "(", "(", "a", ",", "b", ")", "=>", "[", "...", "a", ",", "...", "b", "]", ",", "[", "]", ")", "]", ";", "}", "return", "{", "Number", "}", "protected", "get", "runningIndex", "(", ")", ":", "number", "{", "if", "(", "this", ".", "running", "!=", "null", ")", "{", "const", "tI", "=", "this", ".", "tasks", ".", "findIndex", "(", "(", "task", ")", "=>", "{", "return", "(", "this", ".", "running", "instanceof", "task", ")", ";", "}", ")", ";", "if", "(", "tI", "!==", "-", "1", ")", "{", "return", "tI", ";", "}", "else", "{", "return", "this", ".", "postTasks", ".", "findIndex", "(", "(", "task", ")", "=>", "{", "return", "(", "this", ".", "running", "instanceof", "task", ")", ";", "}", ")", ";", "}", "}", "}", "return", "{", "ILog", "[", "]", "}", "protected", "get", "resultLogs", "(", ")", ":", "type", ".", "ILog", "[", "]", "{", "return", "this", ".", "contexts", ".", "map", "(", "(", "ctx", ")", "=>", "ctx", ".", "logs", ")", ".", "reduce", "(", "(", "a", ",", "b", ")", "=>", "[", "...", "a", ",", "...", "b", "]", ",", "[", "]", ")", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", "!=", "null", ")", ")", ".", "reduce", "(", "(", "currentLogs", ",", "log", ",", "i", ",", "allLogs", ")", "=>", "{", "const", "allSimilarLogs", "=", "allLogs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "title", "===", "log", ".", "title", ")", ")", ";", "const", "contexts", "=", "[", "...", "allSimilarLogs", ",", "log", "]", ".", "map", "(", "(", "l", ")", "=>", "this", ".", "getContextForLog", "(", "l", ")", ")", ".", "filter", "(", "(", "c", ")", "=>", "(", "c", "!=", "null", ")", ")", ";", "log", ".", "body", "=", "this", ".", "getContextLogBody", "(", "log", ",", "contexts", ")", ";", "const", "similarLogs", "=", "currentLogs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "title", "===", "log", ".", "title", ")", ")", ";", "if", "(", "similarLogs", ".", "length", "===", "0", ")", "{", "return", "[", "...", "currentLogs", ",", "log", "]", ";", "}", "else", "{", "return", "currentLogs", ";", "}", "}", ",", "[", "]", ")", ";", "}", "return", "{", "IResult", "}", "public", "get", "result", "(", ")", ":", "type", ".", "IResult", "{", "const", "packages", "=", "this", ".", "contexts", ".", "map", "(", "(", "ctx", ")", "=>", "ctx", ".", "package", ")", ".", "filter", "(", "(", "p", ")", "=>", "(", "p", "!=", "null", ")", ")", ";", "const", "appcenters", "=", "this", ".", "contexts", ".", "map", "(", "(", "ctx", ")", "=>", "ctx", ".", "appcenter", ")", ".", "filter", "(", "(", "a", ")", "=>", "(", "a", "!=", "null", ")", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "JSON", ".", "stringify", "(", "b", ")", ".", "length", "-", "JSON", ".", "stringify", "(", "a", ")", ".", "length", ")", ")", ";", "const", "appstreams", "=", "this", ".", "contexts", ".", "map", "(", "(", "ctx", ")", "=>", "ctx", ".", "appstream", ")", ".", "filter", "(", "(", "a", ")", "=>", "(", "a", "!=", "null", ")", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "b", ".", "length", "-", "a", ".", "length", ")", ")", ";", "const", "logs", "=", "this", ".", "resultLogs", ";", "const", "failed", "=", "logs", ".", "some", "(", "(", "l", ")", "=>", "(", "l", ".", "level", "===", "Log", ".", "Level", ".", "ERROR", ")", ")", ";", "return", "{", "appcenter", ":", "appcenters", "[", "0", "]", ",", "appstream", ":", "appstreams", "[", "0", "]", ",", "failed", ",", "logs", ":", "(", "logs", "||", "[", "]", ")", ",", "packages", "}", ";", "}", "async", "return", "{", "void", "}", "public", "async", "setup", "(", ")", "{", "await", "this", ".", "emitAsync", "(", "'setup:start'", ")", ";", "await", "fs", ".", "ensureDir", "(", "this", ".", "workspace", ")", ";", "await", "this", ".", "emitAsync", "(", "'setup:end'", ")", ";", "}", "async", "public", "async", "run", "(", ")", "{", "await", "this", ".", "emitAsync", "(", "'run:start'", ")", ";", "for", "(", "const", "task", "of", "this", ".", "tasks", ")", "{", "try", "{", "const", "taskConstructor", "=", "await", "this", ".", "emitAsyncChain", "<", "type", ".", "ITaskConstructor", ">", "(", "'task:start'", ",", "task", ")", ";", "this", ".", "running", "=", "new", "taskConstructor", "(", "this", ")", ";", "await", "this", ".", "running", ".", "run", "(", ")", ";", "}", "catch", "(", "err", ")", "{", "this", ".", "report", "(", "err", ")", ";", "}", "if", "(", "this", ".", "running", "==", "null", ")", "{", "break", ";", "}", "if", "(", "this", ".", "forks", ".", "length", ">", "0", ")", "{", "const", "todoTasks", "=", "this", ".", "tasks", ".", "splice", "(", "this", ".", "runningIndex", "+", "1", ")", ";", "this", ".", "forks", ".", "forEach", "(", "(", "fork", ")", "=>", "{", "fork", ".", "tasks", "=", "todoTasks", ";", "}", ")", ";", "await", "Promise", ".", "all", "(", "this", ".", "forks", ".", "map", "(", "(", "fork", ")", "=>", "fork", ".", "run", "(", ")", ")", ")", ";", "}", "}", "for", "(", "const", "task", "of", "this", ".", "postTasks", ")", "{", "try", "{", "const", "taskConstructor", "=", "await", "this", ".", "emitAsyncChain", "<", "type", ".", "ITaskConstructor", ">", "(", "'task:start'", ",", "task", ")", ";", "this", ".", "running", "=", "new", "taskConstructor", "(", "this", ")", ";", "await", "this", ".", "running", ".", "run", "(", ")", ";", "}", "catch", "(", "err", ")", "{", "this", ".", "report", "(", "err", ")", ";", "}", "}", "await", "this", ".", "emitAsync", "(", "'run:end'", ")", ";", "this", ".", "stop", "(", ")", ";", "}", "example", "async", "param", "{", "Object", "}", "context", "return", "{", "Worker", "}", "public", "async", "fork", "(", "context", "=", "{", "}", ")", "{", "const", "newContext", "=", "Object", ".", "assign", "(", "{", "}", ",", "this", ".", "context", ",", "context", ",", "{", "logs", ":", "[", "]", "}", ")", ";", "const", "fork", "=", "new", "Worker", "(", "this", ".", "app", ",", "this", ".", "repository", ",", "newContext", ")", ";", "this", ".", "forks", ".", "push", "(", "fork", ")", ";", "return", "fork", ";", "}", "async", "return", "{", "void", "}", "public", "async", "teardown", "(", ")", "{", "await", "this", ".", "emitAsync", "(", "'teardown:start'", ")", ";", "await", "fs", ".", "remove", "(", "this", ".", "workspace", ")", ";", "await", "this", ".", "emitAsync", "(", "'teardown:end'", ")", ";", "}", "param", "{", "Error", "}", "err", "return", "{", "Worker", "}", "public", "report", "(", "err", ")", "{", "if", "(", "!", "(", "err", "instanceof", "Log", ")", ")", "{", "this", ".", "emit", "(", "'run:error'", ",", "err", ")", ";", "const", "log", "=", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Internal error while running'", ")", ".", "setError", "(", "err", ")", ";", "this", ".", "context", ".", "logs", ".", "push", "(", "log", ")", ";", "this", ".", "stop", "(", ")", ";", "}", "else", "{", "this", ".", "context", ".", "logs", ".", "push", "(", "err", ")", ";", "if", "(", "err", ".", "level", "===", "Log", ".", "Level", ".", "ERROR", ")", "{", "this", ".", "stop", "(", ")", ";", "}", "}", "return", "this", ";", "}", "return", "{", "IResult", "}", "public", "stop", "(", ")", "{", "this", ".", "running", "=", "null", ";", "return", "this", ".", "result", ";", "}", "param", "{", "ILog", "}", "log", "return", "{", "IContext", "|", "null", "}", "protected", "getContextForLog", "(", "log", ")", "{", "for", "(", "const", "l", "of", "this", ".", "context", ".", "logs", ")", "{", "if", "(", "l", "===", "log", ")", "{", "return", "this", ".", "context", ";", "}", "}", "for", "(", "const", "fork", "of", "this", ".", "forks", ")", "{", "const", "foundChildForkContext", "=", "fork", ".", "getContextForLog", "(", "log", ")", ";", "if", "(", "foundChildForkContext", "!=", "null", ")", "{", "return", "foundChildForkContext", ";", "}", "}", "return", "null", ";", "}", "param", "{", "type", ".", "ILog", "}", "log", "param", "{", "type", ".", "IContext", "[", "]", "}", "contexts", "return", "{", "string", "}", "protected", "getContextLogBody", "(", "log", ",", "contexts", ")", "{", "if", "(", "log", ".", "body", "==", "null", "||", "log", ".", "body", ".", "includes", "(", "'### Build Information'", ")", ")", "{", "return", "log", ".", "body", ";", "}", "const", "architectures", "=", "Array", ".", "from", "(", "new", "Set", "(", "contexts", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "architecture", ")", ")", ")", ".", "filter", "(", "(", "a", ")", "=>", "(", "a", "!=", "null", ")", ")", ";", "const", "distributions", "=", "Array", ".", "from", "(", "new", "Set", "(", "contexts", ".", "map", "(", "(", "c", ")", "=>", "c", ".", "distribution", ")", ")", ")", ".", "filter", "(", "(", "d", ")", "=>", "(", "d", "!=", "null", ")", ")", ";", "const", "references", "=", "Array", ".", "from", "(", "new", "Set", "(", "this", ".", "getContextForLog", "(", "log", ")", ".", "references", ")", ")", ".", "filter", "(", "(", "r", ")", "=>", "(", "r", "!=", "null", ")", ")", ";", "let", "body", "=", "(", "log", ".", "body", "||", "''", ")", ".", "trim", "(", ")", ";", "body", "+=", "'\\n\\n### Build Information'", ";", "if", "(", "architectures", ".", "length", ">", "1", ")", "{", "body", "+=", "`\\nAffects Architectures: ${", "architectures", ".", "join", "(", "', '", ")", "}`", ";", "}", "else", "if", "(", "architectures", ".", "length", "===", "1", ")", "{", "body", "+=", "`\\nAffects Architecture: ${", "architectures", "[", "0", "]", "}`", ";", "}", "if", "(", "distributions", ".", "length", ">", "1", ")", "{", "body", "+=", "`\\nAffects Distributions: ${", "distributions", ".", "join", "(", "', '", ")", "}`", ";", "}", "else", "if", "(", "distributions", ".", "length", "===", "1", ")", "{", "body", "+=", "`\\nAffects Distribution: ${", "distributions", "[", "0", "]", "}`", ";", "}", "if", "(", "references", ".", "length", ">", "0", ")", "{", "body", "+=", "'\\nBuilt with the following references:'", ";", "for", "(", "const", "reference", "of", "references", ")", "{", "body", "+=", "`\\n- ${", "reference", "}`", ";", "}", "}", "return", "body", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 189, null, 0, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, 5, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5992, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 5992, null, 3, null, 5, null, null, null, null, 5, null, null, null, null, null, null, 5992, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, 5992, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, 10980, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 8, null, null, null, null, null, null, 5992, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 0, null, null, null, null, null, 5992, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 0, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
32
[ "exports", "import", "{", "Log", "}", "from", "'../log'", ";", "import", "{", "ITask", ",", "ITaskConstructor", "}", "from", "'../type'", ";", "import", "{", "Worker", "}", "from", "'../worker'", ";", "export", "class", "Task", "implements", "ITask", "{", "var", "public", "worker", ":", "Worker", ";", "param", "{", "Worker", "}", "worker", "constructor", "(", "worker", ")", "{", "this", ".", "worker", "=", "worker", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "this", ".", "worker", ".", "emit", "(", "`task:${", "this", ".", "constructor", ".", "name", "}:start`", ")", ";", "this", ".", "worker", ".", "emit", "(", "`task:${", "this", ".", "constructor", ".", "name", "}:end`", ")", ";", "}", "param", "{", "Error", "}", "e", "return", "{", "Task", "}", "public", "report", "(", "e", ")", "{", "if", "(", "!", "(", "e", "instanceof", "Log", ")", ")", "{", "const", "log", "=", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Internal error while running'", ")", ".", "setError", "(", "e", ")", ";", "this", ".", "worker", ".", "report", "(", "log", ")", ";", "this", ".", "worker", ".", "stop", "(", ")", ";", "}", "else", "{", "this", ".", "worker", ".", "report", "(", "e", ")", ";", "if", "(", "e", ".", "level", "===", "Log", ".", "Level", ".", "ERROR", ")", "{", "this", ".", "worker", ".", "stop", "(", ")", ";", "}", "}", "return", "this", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
33
[ "/**\n * houston/src/worker/task/wrapperTask.ts\n * Runs a bunch of tasks in a row, collecting errors for later.\n */", "import", "{", "Log", "}", "from", "'../log'", ";", "import", "{", "ITaskConstructor", "}", "from", "'../type'", ";", "import", "{", "Task", "}", "from", "'./task'", ";", "export", "class", "WrapperTask", "extends", "Task", "{", "var", "public", "get", "tasks", "(", ")", ":", "ITaskConstructor", "[", "]", "{", "return", "[", "]", ";", "}", "public", "set", "tasks", "(", "tasks", ")", "{", "return", ";", "}", "var", "public", "logs", ":", "Log", "[", "]", "=", "[", "]", ";", "return", "{", "Log", "[", "]", "}", "protected", "get", "errorLogs", "(", ")", ":", "Log", "[", "]", "{", "return", "this", ".", "logs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "level", "===", "Log", ".", "Level", ".", "ERROR", ")", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "await", "this", ".", "runTasks", "(", ")", ";", "this", ".", "logs", ".", "forEach", "(", "(", "l", ")", "=>", "this", ".", "worker", ".", "report", "(", "l", ")", ")", ";", "if", "(", "this", ".", "errorLogs", ".", "length", ">", "0", ")", "{", "this", ".", "worker", ".", "stop", "(", ")", ";", "}", "}", "async", "return", "{", "void", "}", "protected", "async", "runTasks", "(", ")", "{", "for", "(", "const", "T", "of", "this", ".", "tasks", ")", "{", "const", "task", "=", "new", "T", "(", "this", ".", "worker", ")", ";", "await", "task", ".", "run", "(", ")", ".", "catch", "(", "(", "e", ")", "=>", "this", ".", "catchError", "(", "e", ")", ")", ";", "}", "}", "param", "{", "Error", "}", "e", "return", "{", "void", "}", "throws", "protected", "catchError", "(", "e", ")", "{", "if", "(", "e", "instanceof", "Log", ")", "{", "this", ".", "logs", ".", "push", "(", "e", ")", ";", "}", "else", "{", "throw", "e", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, 1896, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
34
[ "/**\n * houston/src/worker/task/appstream/description.ts\n * Checks we have a description.\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamDescription", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "const", "description", "=", "$", "(", "'component > description'", ")", ";", "if", "(", "description", ".", "length", "===", "0", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing \"description\" field'", ")", ";", "}", "const", "text", "=", "description", ".", "text", "(", ")", ";", "if", "(", "text", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/\\W/", ",", "''", ")", ".", "indexOf", "(", "'elementaryos'", ")", "!==", "-", "1", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'\"description\" field calls out elementary OS'", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
35
[ "/**\n * houston/src/worker/task/appstream/id.ts\n * Tests the appstream ID matches correctly\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamId", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "const", "id", "=", "$", "(", "'component > id'", ")", ";", "if", "(", "id", ".", "length", "===", "0", ")", "{", "$", "(", "'component'", ")", ".", "prepend", "(", "`<id>${", "this", ".", "name", "}</id>`", ")", ";", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "$", ".", "xml", "(", ")", ")", ";", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "WARN", ",", "'Missing \"id\" field'", ")", ";", "}", "else", "if", "(", "id", ".", "text", "(", ")", "!==", "this", ".", "name", ")", "{", "id", ".", "text", "(", "this", ".", "name", ")", ";", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "$", ".", "xml", "(", ")", ")", ";", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "WARN", ",", "`\"id\" field should be \"${", "this", ".", "name", "}\"`", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
36
[ "/**\n * houston/src/worker/task/appstream/license.ts\n * Checks that a project_license is in the appstream file\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamLicense", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "const", "license", "=", "$", "(", "'component > project_license'", ")", ";", "if", "(", "license", ".", "length", "===", "0", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "WARN", ",", "'Missing \"project_license\" field'", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
37
[ "/**\n * houston/src/worker/task/appstream/name.ts\n * Checks that a name field exists in the appstream file\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamName", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "const", "name", "=", "$", "(", "'component > name'", ")", ";", "if", "(", "name", ".", "length", "===", "0", ")", "{", "$", "(", "'component'", ")", ".", "prepend", "(", "`<name>${", "this", ".", "worker", ".", "context", ".", "nameHuman", "}</name>`", ")", ";", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "$", ".", "xml", "(", ")", ")", ";", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "WARN", ",", "'Missing \"name\" field'", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
38
[ "example", "import", "{", "defaultsDeep", "}", "from", "'lodash'", ";", "import", "*", "as", "Markdown", "from", "'markdown-it'", ";", "const", "DEFAULT_OPTS", "=", "{", "breaks", ":", "true", ",", "html", ":", "false", ",", "linkify", ":", "true", ",", "quotes", ":", "'“”‘’'", ",", "typographer", ":", "true", ",", "xhtmlOut", ":", "true", "}", ";", "param", "{", "String", "}", "str", "param", "{", "Object", "}", "opts", "return", "{", "string", "}", "export", "default", "function", "(", "str", ",", "opts", "=", "{", "}", ")", "{", "const", "markdown", "=", "new", "Markdown", "(", "defaultsDeep", "(", "{", "}", ",", "DEFAULT_OPTS", ",", "opts", ")", ")", ";", "return", "markdown", ".", "render", "(", "str", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
39
[ "/**\n * houston/src/worker/task/appstream/release.ts\n * Checks and updates the appstream releases section\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "sanitizeHtml", "from", "'sanitize-html'", ";", "import", "*", "as", "semver", "from", "'semver'", ";", "import", "markdown", "from", "'../../../lib/utility/markdown'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamRelease", "extends", "Task", "{", "var", "protected", "static", "WHITELISTED_TAGS", "=", "[", "'p'", ",", "'ul'", ",", "'li'", "]", ";", "var", "protected", "static", "CHEERIO_OPTS", "=", "{", "useHtmlParser2", ":", "true", ",", "xmlMode", ":", "true", "}", ";", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "AppstreamRelease", ".", "CHEERIO_OPTS", ")", ";", "const", "releases", "=", "$", "(", "'component > releases'", ")", ";", "if", "(", "releases", ".", "length", "===", "0", ")", "{", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "this", ".", "fill", "(", "$", ")", ")", ";", "}", "}", "param", "{", "Object", "}", "$", "return", "{", "string", "}", "protected", "fill", "(", "$", ")", "{", "if", "(", "$", "(", "'component > releases'", ")", ".", "length", "===", "0", ")", "{", "$", "(", "'component'", ")", ".", "append", "(", "'<releases></releases>'", ")", ";", "}", "this", ".", "worker", ".", "context", ".", "changelog", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "semver", ".", "rcompare", "(", "a", ".", "version", ",", "b", ".", "version", ")", ")", ".", "forEach", "(", "(", "change", ")", "=>", "{", "$", "(", "'component > releases'", ")", ".", "prepend", "(", "'<release></release>'", ")", ";", "const", "release", "=", "$", "(", "'component > releases > release:last-of-type'", ")", ";", "release", ".", "attr", "(", "'version'", ",", "change", ".", "version", ")", ";", "release", ".", "attr", "(", "'date'", ",", "change", ".", "date", ".", "toISOString", "(", ")", ")", ";", "release", ".", "attr", "(", "'urgency'", ",", "this", ".", "urgency", "(", "change", ".", "changes", ")", ")", ";", "release", ".", "html", "(", "`<description>${", "this", ".", "html", "(", "change", ".", "changes", ")", "}</description>`", ")", ";", "}", ")", ";", "return", "$", ".", "xml", "(", ")", ";", "}", "param", "{", "String", "}", "change", "return", "{", "String", "}", "protected", "urgency", "(", "change", ")", "{", "const", "grepable", "=", "change", ".", "toLowerCase", "(", ")", ".", "replace", "(", "/\\W\\s/img", ",", "''", ")", ".", "replace", "(", "/\\s+/img", ",", "' '", ")", ";", "const", "CRITICAL_WORDS", "=", "[", "'security'", ",", "'critical'", "]", ";", "CRITICAL_WORDS", ".", "forEach", "(", "(", "word", ")", "=>", "{", "if", "(", "grepable", ".", "indexOf", "(", "word", ")", "!==", "-", "1", ")", "{", "return", "'critical'", ";", "}", "}", ")", ";", "return", "'medium'", ";", "}", "param", "{", "String", "}", "change", "return", "{", "String", "}", "protected", "html", "(", "change", ")", "{", "const", "html", "=", "markdown", "(", "change", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "html", ",", "AppstreamRelease", ".", "CHEERIO_OPTS", ")", ";", "const", "lists", "=", "$", "(", "'ul'", ")", ";", "const", "paragraphs", "=", "$", "(", "'p'", ")", ";", "if", "(", "lists", ".", "length", "===", "0", "&&", "paragraphs", ".", "length", "===", "1", ")", "{", "const", "items", "=", "paragraphs", ".", "text", "(", ")", ".", "split", "(", "'\\n'", ")", ".", "join", "(", "'</li><li>'", ")", ";", "$", ".", "root", "(", ")", ".", "html", "(", "`<ul><li>${", "items", "}</li></ul>`", ")", ";", "}", "return", "this", ".", "sanitize", "(", "$", ".", "xml", "(", ")", ")", ";", "}", "param", "{", "String", "}", "change", "return", "{", "String", "}", "protected", "sanitize", "(", "change", ")", "{", "const", "$el", "=", "cheerio", ".", "load", "(", "change", ",", "AppstreamRelease", ".", "CHEERIO_OPTS", ")", ";", "const", "sanitized", "=", "sanitizeHtml", "(", "$el", ".", "xml", "(", ")", ",", "{", "allowedTags", ":", "AppstreamRelease", ".", "WHITELISTED_TAGS", ",", "parser", ":", "AppstreamRelease", ".", "CHEERIO_OPTS", "}", ")", ";", "return", "cheerio", ".", "load", "(", "sanitized", ",", "AppstreamRelease", ".", "CHEERIO_OPTS", ")", ".", "xml", "(", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24279, null, 24279, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24279, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
40
[ "/**\n * houston/src/worker/task/appstream/screenshot.ts\n * Ensures the developer includes a screenshot\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamScreenshot", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "const", "screenshots", "=", "$", "(", "'component > screenshots > screenshot'", ")", ";", "if", "(", "screenshots", ".", "length", "<", "1", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing screenshots'", ")", ";", "}", "screenshots", ".", "each", "(", "(", "i", ",", "elem", ")", "=>", "this", ".", "checkTag", "(", "$", ",", "elem", ")", ")", ";", "}", "param", "{", "Object", "}", "elem", "return", "{", "void", "}", "protected", "checkTag", "(", "$", ",", "elem", ")", "{", "const", "screenshot", "=", "$", "(", "elem", ")", ";", "const", "image", "=", "$", "(", "'image'", ",", "screenshot", ")", ";", "if", "(", "image", ".", "length", "<", "1", ")", "{", "this", ".", "worker", ".", "report", "(", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing image tag in screenshot'", ")", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, 9, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
41
[ "/**\n * houston/src/worker/task/appstream/stripe.ts\n * Adds stripe data to appstream file\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamStripe", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "if", "(", "this", ".", "worker", ".", "context", ".", "stripe", "==", "null", ")", "{", "return", ";", "}", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "raw", ",", "{", "xmlMode", ":", "true", "}", ")", ";", "if", "(", "$", "(", "'component > custom'", ")", ".", "length", "===", "0", ")", "{", "$", "(", "'component'", ")", ".", "append", "(", "'<custom></custom>'", ")", ";", "}", "$", "(", "'component > custom'", ")", ".", "append", "(", "'<value></value>'", ")", ";", "const", "$el", "=", "$", "(", "'component > custom > value:last-of-type'", ")", ";", "$el", ".", "attr", "(", "'key'", ",", "'x-appcenter-stripe'", ")", ";", "$el", ".", "text", "(", "this", ".", "worker", ".", "context", ".", "stripe", ")", ";", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "$", ".", "xml", "(", ")", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 587, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
42
[ "exports", "import", "*", "as", "Dockerode", "from", "'dockerode'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "Stream", "from", "'stream'", ";", "import", "{", "Config", "}", "from", "'../lib/config'", ";", "export", "class", "Docker", "{", "var", "public", "log", "?", ":", "string", ";", "var", "protected", "config", ":", "Config", ";", "var", "protected", "docker", ":", "Dockerode", ";", "var", "protected", "name", ":", "string", ";", "/**\n * tag\n * The docker image tag\n */", "protected", "tag", "=", "'latest'", ";", "var", "protected", "mounts", "=", "{", "}", ";", "param", "{", "Config", "}", "config", "param", "{", "string", "}", "name", "constructor", "(", "config", ",", "name", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "docker", "=", "new", "Dockerode", "(", "config", ".", "get", "(", "'docker'", ")", ")", ";", "this", ".", "name", "=", "`houston-${", "name", "}`", ";", "}", "return", "{", "object", "}", "public", "get", "options", "(", ")", "{", "const", "options", "=", "{", "Binds", ":", "[", "]", "as", "string", "[", "]", "}", ";", "Object", ".", "keys", "(", "this", ".", "mounts", ")", ".", "forEach", "(", "(", "local", ")", "=>", "{", "options", ".", "Binds", ".", "push", "(", "`${", "local", "}:${", "this", ".", "mounts", "[", "local", "]", "}:rw`", ")", ";", "}", ")", ";", "return", "options", ";", "}", "param", "{", "string", "}", "from", "param", "{", "string", "}", "to", "return", "{", "Docker", "}", "public", "mount", "(", "from", ",", "to", ")", "{", "this", ".", "mounts", "[", "from", "]", "=", "to", ";", "return", "this", ";", "}", "async", "param", "{", "string", "}", "tag", "return", "{", "boolean", "}", "public", "async", "exists", "(", "tag", "=", "this", ".", "tag", ")", "{", "const", "images", "=", "await", "this", ".", "docker", ".", "listImages", "(", ")", ";", "const", "foundImages", "=", "images", ".", "filter", "(", "(", "image", ")", "=>", "{", "if", "(", "image", ".", "RepoTags", "==", "null", ")", "{", "return", "false", ";", "}", "let", "found", "=", "false", ";", "image", ".", "RepoTags", ".", "forEach", "(", "(", "imageTag", ")", "=>", "{", "if", "(", "imageTag", "===", "`${", "this", ".", "name", "}:${", "tag", "}`", ")", "{", "found", "=", "true", ";", "}", "}", ")", ";", "return", "found", ";", "}", ")", ";", "return", "(", "foundImages", ".", "length", "!==", "0", ")", ";", "}", "async", "param", "{", "string", "}", "folder", "return", "{", "void", "}", "public", "async", "create", "(", "folder", ")", "{", "const", "files", "=", "await", "fs", ".", "readdir", "(", "folder", ")", ";", "await", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "this", ".", "docker", ".", "buildImage", "(", "{", "context", ":", "folder", ",", "src", ":", "files", "}", ",", "{", "t", ":", "this", ".", "name", "}", ",", "(", "err", ",", "stream", ")", "=>", "{", "if", "(", "err", "!=", "null", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "this", ".", "docker", ".", "modem", ".", "followProgress", "(", "stream", ",", "resolve", ")", ";", "}", ")", ";", "}", ")", ";", "}", "param", "{", "string", "}", "cmd", "param", "{", "object", "}", "opts", "return", "{", "number", "}", "public", "async", "run", "(", "cmd", ",", "opts", "=", "{", "}", ")", "{", "const", "log", "=", "await", "this", ".", "setupLog", "(", ")", ";", "const", "commands", "=", "cmd", ".", "split", "(", "' '", ")", ";", "const", "options", "=", "Object", ".", "assign", "(", "{", "}", ",", "this", ".", "options", ",", "opts", ")", ";", "const", "container", "=", "await", "this", ".", "docker", ".", "run", "(", "this", ".", "name", ",", "commands", ",", "log", ",", "options", ")", ";", "await", "container", ".", "remove", "(", ")", ";", "return", "container", ".", "output", ".", "StatusCode", ";", "}", "async", "return", "{", "Stream", "|", "null", "}", "protected", "async", "setupLog", "(", ")", "{", "if", "(", "this", ".", "log", "==", "null", ")", "{", "return", "null", ";", "}", "await", "fs", ".", "ensureFile", "(", "this", ".", "log", ")", ";", "return", "fs", ".", "createWriteStream", "(", "this", ".", "log", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, 6, null, null, null, null, null, null, 46474, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
43
[ "/**\n * houston/src/worker/task/appstream/validate.ts\n * Runs appstreamcli to validate appstream file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Docker", "}", "from", "'../../docker'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "AppstreamValidate", "extends", "Task", "{", "return", "{", "string", "}", "protected", "get", "logPath", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'appstream.log'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "docker", "=", "await", "this", ".", "docker", "(", ")", ";", "const", "file", "=", "`${", "this", ".", "name", "}.appdata.xml`", ";", "const", "cmd", "=", "`validate ${", "file", "} --no-color`", ";", "const", "exit", "=", "await", "docker", ".", "run", "(", "cmd", ")", ";", "if", "(", "exit", "!==", "0", ")", "{", "throw", "await", "this", ".", "log", "(", ")", ";", "}", "}", "async", "return", "{", "Log", "}", "protected", "async", "log", "(", ")", "{", "const", "p", "=", "path", ".", "resolve", "(", "__dirname", ",", "'validate.md'", ")", ";", "const", "log", "=", "await", "fs", ".", "readFile", "(", "this", ".", "logPath", ",", "'utf8'", ")", ";", "return", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "p", ",", "{", "log", ",", "storage", ":", "this", ".", "worker", ".", "context", "}", ")", ";", "}", "async", "return", "{", "Docker", "}", "protected", "async", "docker", "(", ")", "{", "const", "docker", "=", "new", "Docker", "(", "this", ".", "worker", ".", "config", ",", "'appstream-validate'", ")", ";", "const", "exists", "=", "await", "docker", ".", "exists", "(", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "const", "folder", "=", "path", ".", "resolve", "(", "__dirname", ",", "'validate'", ")", ";", "await", "docker", ".", "create", "(", "folder", ")", ";", "}", "docker", ".", "log", "=", "this", ".", "logPath", ";", "docker", ".", "mount", "(", "this", ".", "path", ",", "'/tmp/houston'", ")", ";", "return", "docker", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
44
[ "/**\n * houston/src/worker/task/appstream/index.ts\n * Runs a bunch of appstream tests\n * TODO: Only reports error and warn logs instead of all\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "WrapperTask", "}", "from", "'../wrapperTask'", ";", "import", "{", "AppstreamDescription", "}", "from", "'./description'", ";", "import", "{", "AppstreamId", "}", "from", "'./id'", ";", "import", "{", "AppstreamLicense", "}", "from", "'./license'", ";", "import", "{", "AppstreamName", "}", "from", "'./name'", ";", "import", "{", "AppstreamRelease", "}", "from", "'./release'", ";", "import", "{", "AppstreamScreenshot", "}", "from", "'./screenshot'", ";", "import", "{", "AppstreamStripe", "}", "from", "'./stripe'", ";", "import", "{", "AppstreamSummary", "}", "from", "'./summary'", ";", "import", "{", "AppstreamValidate", "}", "from", "'./validate'", ";", "export", "class", "Appstream", "extends", "WrapperTask", "{", "var", "public", "get", "tasks", "(", ")", "{", "switch", "(", "this", ".", "worker", ".", "context", ".", "type", ")", "{", "case", "'system-app'", ":", "return", "[", "AppstreamId", ",", "AppstreamName", ",", "AppstreamDescription", ",", "AppstreamSummary", ",", "AppstreamLicense", ",", "AppstreamScreenshot", ",", "AppstreamRelease", ",", "AppstreamValidate", "]", ";", "default", ":", "return", "[", "AppstreamId", ",", "AppstreamName", ",", "AppstreamDescription", ",", "AppstreamSummary", ",", "AppstreamLicense", ",", "AppstreamScreenshot", ",", "AppstreamRelease", ",", "AppstreamStripe", ",", "AppstreamValidate", "]", ";", "}", "}", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/metainfo'", ",", "`${", "this", ".", "name", "}.appdata.xml`", ")", ";", "}", "return", "{", "Log", "[", "]", "}", "public", "get", "errorPartials", "(", ")", "{", "return", "this", ".", "logs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "level", "===", "Log", ".", "Level", ".", "ERROR", ")", ")", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "body", "==", "null", ")", ")", ";", "}", "return", "{", "Log", "[", "]", "}", "public", "get", "warnPartials", "(", ")", "{", "return", "this", ".", "logs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "level", "===", "Log", ".", "Level", ".", "WARN", ")", ")", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "body", "==", "null", ")", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "exists", "=", "await", "fs", ".", "exists", "(", "this", ".", "path", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "const", "template", "=", "path", ".", "resolve", "(", "__dirname", ",", "'exist.md'", ")", ";", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "template", ",", "{", "name", ":", "this", ".", "name", ",", "storage", ":", "this", ".", "worker", ".", "context", "}", ")", ";", "}", "await", "this", ".", "runTasks", "(", ")", ";", "if", "(", "this", ".", "errorPartials", ".", "length", ">", "0", "||", "this", ".", "warnPartials", ".", "length", ">", "0", ")", "{", "this", ".", "concatLogs", "(", ")", ";", "}", "this", ".", "logs", ".", "filter", "(", "(", "l", ")", "=>", "(", "l", ".", "body", "!=", "null", ")", ")", ".", "forEach", "(", "(", "l", ")", "=>", "this", ".", "worker", ".", "report", "(", "l", ")", ")", ";", "if", "(", "this", ".", "errorLogs", ".", "length", ">", "0", ")", "{", "this", ".", "worker", ".", "stop", "(", ")", ";", "}", "this", ".", "worker", ".", "context", ".", "appstream", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ",", "'utf-8'", ")", ";", "}", "return", "{", "void", "}", "protected", "concatLogs", "(", ")", "{", "const", "topLevel", "=", "(", "this", ".", "errorPartials", ".", "length", ">", "0", ")", "?", "Log", ".", "Level", ".", "ERROR", ":", "Log", ".", "Level", ".", "WARN", ";", "const", "template", "=", "path", ".", "resolve", "(", "__dirname", ",", "'index.md'", ")", ";", "const", "log", "=", "Log", ".", "template", "(", "topLevel", ",", "template", ",", "{", "errors", ":", "this", ".", "errorPartials", ",", "storage", ":", "this", ".", "worker", ".", "context", ",", "warnings", ":", "this", ".", "warnPartials", "}", ")", ";", "this", ".", "worker", ".", "report", "(", "log", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
45
[ "/**\n * houston/src/lib/utility/glob.ts\n * Promiseifies the glob package function\n */", "import", "*", "as", "Glob", "from", "'glob'", ";", "async", "param", "{", "String", "}", "pattern", "param", "{", "Object", "}", "options", "return", "{", "String", "[", "]", "}", "export", "function", "glob", "(", "pattern", ",", "options", "=", "{", "}", ")", "{", "return", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "Glob", "(", "pattern", ",", "options", ",", "(", "err", ",", "res", ")", "=>", "{", "if", "(", "err", "!=", "null", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "else", "{", "return", "resolve", "(", "res", ")", ";", "}", "}", ")", ";", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, 25, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
46
[ "/**\n * houston/src/worker/task/build/deb.ts\n * Builds a debian package\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "glob", "}", "from", "'../../../lib/utility/glob'", ";", "import", "render", "from", "'../../../lib/utility/template'", ";", "import", "{", "Docker", "}", "from", "'../../docker'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "IPackage", "}", "from", "'../../type'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "BuildDeb", "extends", "Task", "{", "return", "{", "string", "}", "protected", "get", "logPath", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'build.log'", ")", ";", "}", "return", "{", "string", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'build'", ")", ";", "}", "return", "{", "string", "}", "protected", "get", "distribution", "(", ")", "{", "switch", "(", "this", ".", "worker", ".", "context", ".", "distribution", ")", "{", "case", "(", "'loki'", ")", ":", "return", "'xenial'", ";", "case", "(", "'juno'", ")", ":", "case", "(", "'hera'", ")", ":", "return", "'bionic'", ";", "default", ":", "return", "this", ".", "worker", ".", "context", ".", "distribution", ";", "}", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "await", "this", ".", "setup", "(", ")", ";", "const", "docker", "=", "await", "this", ".", "docker", "(", ")", ";", "const", "arch", "=", "this", ".", "worker", ".", "context", ".", "architecture", ";", "const", "dist", "=", "this", ".", "distribution", ";", "const", "cmd", "=", "`-a ${", "arch", "} -d ${", "dist", "} -o /tmp/houston`", ";", "const", "exit", "=", "await", "docker", ".", "run", "(", "cmd", ",", "{", "Privileged", ":", "true", "}", ")", ";", "if", "(", "exit", "!==", "0", ")", "{", "throw", "await", "this", ".", "log", "(", ")", ";", "}", "await", "this", ".", "teardown", "(", ")", ";", "}", "async", "return", "{", "void", "}", "protected", "async", "setup", "(", ")", "{", "const", "from", "=", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'dirty'", ")", ";", "await", "fs", ".", "ensureDir", "(", "this", ".", "path", ")", ";", "await", "fs", ".", "copy", "(", "from", ",", "this", ".", "path", ")", ";", "}", "async", "return", "{", "IPackage", "|", "null", "}", "protected", "async", "package", "(", ")", "{", "const", "context", "=", "this", ".", "worker", ".", "context", ";", "const", "domainName", "=", "`${", "context", ".", "nameDomain", "}_${", "context", ".", "version", "}_${", "context", ".", "architecture", "}.${", "context", ".", "package", ".", "type", "}`", ";", "const", "domainNamed", "=", "await", "glob", "(", "path", ".", "resolve", "(", "this", ".", "path", ",", "domainName", ")", ")", ";", "if", "(", "domainNamed", "[", "0", "]", "!=", "null", ")", "{", "return", "{", "name", ":", "domainName", ",", "path", ":", "domainNamed", "[", "0", "]", ",", "type", ":", "'deb'", "}", ";", "}", "const", "allNames", "=", "await", "glob", "(", "path", ".", "resolve", "(", "this", ".", "path", ",", "`*.${", "context", ".", "package", ".", "type", "}`", ")", ")", ";", "const", "filteredNames", "=", "allNames", ".", "map", "(", "(", "n", ")", "=>", "path", ".", "basename", "(", "n", ")", ")", ".", "filter", "(", "(", "n", ")", "=>", "!", "n", ".", "startsWith", "(", "'lib'", ")", ")", ".", "filter", "(", "(", "n", ")", "=>", "(", "n", ".", "indexOf", "(", "'-dev'", ")", "===", "-", "1", ")", ")", ".", "filter", "(", "(", "n", ")", "=>", "(", "n", ".", "indexOf", "(", "'-dbg'", ")", "===", "-", "1", ")", ")", ";", "if", "(", "filteredNames", "[", "0", "]", "!=", "null", ")", "{", "return", "{", "name", ":", "filteredNames", "[", "0", "]", ",", "path", ":", "path", ".", "resolve", "(", "this", ".", "path", ",", "filteredNames", "[", "0", "]", ")", ",", "type", ":", "'deb'", "}", ";", "}", "const", "sortedNames", "=", "allNames", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "a", ".", "length", "-", "b", ".", "length", ")", ")", ";", "if", "(", "sortedNames", "[", "0", "]", "!=", "null", ")", "{", "return", "{", "name", ":", "path", ".", "basename", "(", "sortedNames", "[", "0", "]", ")", ",", "path", ":", "sortedNames", "[", "0", "]", ",", "type", ":", "'deb'", "}", ";", "}", "}", "async", "return", "{", "void", "}", "protected", "async", "teardown", "(", ")", "{", "const", "deb", "=", "await", "this", ".", "package", "(", ")", ";", "if", "(", "deb", "==", "null", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Build completed but no Debian package was found'", ")", ";", "}", "const", "to", "=", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package.deb'", ")", ";", "await", "fs", ".", "copy", "(", "deb", ".", "path", ",", "to", ")", ";", "this", ".", "worker", ".", "context", ".", "package", "=", "deb", ";", "this", ".", "worker", ".", "context", ".", "package", ".", "path", "=", "to", ";", "await", "fs", ".", "remove", "(", "this", ".", "path", ")", ";", "}", "async", "return", "{", "Log", "}", "protected", "async", "log", "(", ")", "{", "const", "p", "=", "path", ".", "resolve", "(", "__dirname", ",", "'deb.md'", ")", ";", "const", "log", "=", "await", "fs", ".", "readFile", "(", "this", ".", "logPath", ",", "'utf8'", ")", ";", "return", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "p", ",", "{", "log", ",", "storage", ":", "this", ".", "worker", ".", "context", "}", ")", ";", "}", "async", "return", "{", "Docker", "}", "protected", "async", "docker", "(", ")", "{", "const", "docker", "=", "new", "Docker", "(", "this", ".", "worker", ".", "config", ",", "'build-deb'", ")", ";", "const", "exists", "=", "await", "docker", ".", "exists", "(", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "const", "folder", "=", "path", ".", "resolve", "(", "__dirname", ",", "'deb'", ")", ";", "await", "docker", ".", "create", "(", "folder", ")", ";", "}", "docker", ".", "log", "=", "this", ".", "logPath", ";", "docker", ".", "mount", "(", "this", ".", "path", ",", "'/tmp/houston'", ")", ";", "return", "docker", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 726, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 10980, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
47
[ "/**\n * houston/src/worker/task/debian/changelog.ts\n * Updates, lints, and validates the Debian changelog file.\n */", "import", "*", "as", "cheerio", "from", "'cheerio'", ";", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "markdown", "from", "'../../../lib/utility/markdown'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "template", "from", "'../../../lib/utility/template'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "IChange", ",", "IContext", "}", "from", "'../../type'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "DebianChangelog", "extends", "Task", "{", "var", "public", "static", "path", "=", "'debian/changelog'", ";", "var", "public", "static", "templatePath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'changelogTemplate.ejs'", ")", ";", "async", "param", "{", "IContext", "}", "context", "return", "{", "string", "}", "public", "static", "async", "template", "(", "context", ")", "{", "const", "changelogs", "=", "context", ".", "changelog", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "b", ".", "date", ".", "getTime", "(", ")", "-", "a", ".", "date", ".", "getTime", "(", ")", ")", ")", ";", "const", "changes", "=", "(", "await", "this", ".", "getChanges", "(", "changelogs", ")", ")", ";", "const", "name", "=", "sanitize", "(", "context", ".", "nameDomain", ",", "'-'", ")", ";", "const", "file", "=", "await", "fs", ".", "readFile", "(", "this", ".", "templatePath", ",", "'utf8'", ")", ";", "const", "changelog", "=", "template", "(", "file", ",", "{", "changelogs", ",", "context", ",", "changes", ",", "name", "}", ")", ";", "return", "changelog", ".", "replace", "(", "/^\\s*$/img", ",", "''", ")", ".", "trim", "(", ")", ";", "}", "async", "param", "{", "Object", "[", "]", "}", "changelogs", "return", "{", "Array", "[", "]", "}", "protected", "static", "async", "getChanges", "(", "changelogs", "=", "[", "]", ")", "{", "const", "changes", "=", "[", "]", ";", "for", "(", "const", "version", "of", "changelogs", ")", "{", "changes", ".", "push", "(", "await", "this", ".", "parseMarkdown", "(", "version", ".", "changes", ")", ")", ";", "}", "return", "changes", ";", "}", "param", "{", "string", "}", "changes", "return", "{", "string", "[", "]", "}", "protected", "static", "async", "parseMarkdown", "(", "changes", ")", "{", "const", "html", "=", "markdown", "(", "changes", ")", ";", "const", "$", "=", "cheerio", ".", "load", "(", "html", ")", ";", "const", "values", "=", "[", "]", ";", "if", "(", "$", "(", "'ul'", ")", ".", "length", ">", "0", ")", "{", "$", "(", "'ul > li'", ")", ".", "each", "(", "function", "(", ")", "{", "values", ".", "push", "(", "$", "(", "this", ")", ".", "text", "(", ")", ")", ";", "}", ")", ";", "}", "else", "if", "(", "$", "(", "'p'", ")", ".", "length", ">", "0", ")", "{", "$", "(", "'p'", ")", ".", "each", "(", "function", "(", ")", "{", "values", ".", "push", "(", "$", "(", "this", ")", ".", "text", "(", ")", ")", ";", "}", ")", ";", "}", "if", "(", "values", ".", "length", "<", "1", ")", "{", "values", ".", "push", "(", "'Version Bump'", ")", ";", "}", "return", "values", ";", "}", "return", "{", "String", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'dirty'", ",", "DebianChangelog", ".", "path", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "await", "this", ".", "fill", "(", ")", ";", "}", "return", "{", "void", "}", "public", "async", "fill", "(", ")", "{", "await", "fs", ".", "ensureFile", "(", "this", ".", "path", ")", ";", "if", "(", "this", ".", "worker", ".", "context", ".", "changelog", ".", "length", "===", "0", ")", "{", "this", ".", "worker", ".", "context", ".", "changelog", ".", "push", "(", "this", ".", "noopChange", "(", ")", ")", ";", "}", "const", "changelog", "=", "await", "DebianChangelog", ".", "template", "(", "this", ".", "worker", ".", "context", ")", ";", "await", "fs", ".", "writeFile", "(", "this", ".", "path", ",", "changelog", ",", "'utf8'", ")", ";", "}", "return", "{", "Object", "}", "protected", "noopChange", "(", ")", "{", "return", "{", "author", ":", "this", ".", "worker", ".", "context", ".", "nameDeveloper", ",", "changes", ":", "'Version Bump'", ",", "date", ":", "new", "Date", "(", ")", ",", "version", ":", "this", ".", "worker", ".", "context", ".", "version", "}", "as", "IChange", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 726, null, null, null, 5, null, null, null, null, null, null, null, null, 24279, null, 24279, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, 2904, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 24279, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
48
[ "/**\n * houston/src/worker/task/debian/control.ts\n * Updates, lints, and validates the Debian control file.\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "{", "get", ",", "set", "}", "from", "'lodash'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "DebianControl", "extends", "Task", "{", "var", "public", "static", "path", "=", "'debian/control'", ";", "return", "{", "String", "}", "protected", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "String", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'dirty'", ",", "DebianControl", ".", "path", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "exists", "=", "fs", ".", "pathExists", "(", "this", ".", "path", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing debian control file'", ")", ";", "}", "const", "file", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ",", "'utf8'", ")", ";", "const", "errors", "=", "[", "]", "as", "string", "[", "]", ";", "if", "(", "file", ".", "indexOf", "(", "`Source: ${", "this", ".", "name", "}`", ")", "===", "-", "1", ")", "{", "errors", ".", "push", "(", "`Source should be \"${", "this", ".", "name", "}\"`", ")", ";", "}", "if", "(", "file", ".", "indexOf", "(", "`Package: ${", "this", ".", "name", "}`", ")", "===", "-", "1", ")", "{", "errors", ".", "push", "(", "`Package should be \"${", "this", ".", "name", "}\"`", ")", ";", "}", "if", "(", "!", "file", ".", "match", "(", "/^Maintainer: .* <.*@.*>$/gm", ")", ")", "{", "errors", ".", "push", "(", "'Maintainer should be in the form of \"name <email@example.com\"'", ")", ";", "}", "if", "(", "errors", ".", "length", ">", "0", ")", "{", "const", "template", "=", "path", ".", "resolve", "(", "__dirname", ",", "'control.md'", ")", ";", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "template", ",", "{", "context", ":", "this", ".", "worker", ".", "context", ",", "errors", "}", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
49
[ "/**\n * houston/src/worker/task/appstream/exec.ts\n * Checks that a exec field starts with app name in the desktop file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "ini", "from", "'ini'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "DesktopExec", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/applications'", ",", "`${", "this", ".", "name", "}.desktop`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ",", "'utf8'", ")", ";", "const", "data", "=", "ini", ".", "parse", "(", "raw", ")", ";", "if", "(", "data", "[", "'Desktop Entry'", "]", "==", "null", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing application data'", ")", ";", "}", "const", "execValue", "=", "(", "typeof", "data", "[", "'Desktop Entry'", "]", ".", "Exec", "===", "'string'", ")", "?", "data", "[", "'Desktop Entry'", "]", ".", "Exec", ":", "''", ";", "if", "(", "execValue", ".", "startsWith", "(", "this", ".", "name", ")", "===", "false", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Exec field does not start with binary name'", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
50
[ "/**\n * houston/src/worker/task/appstream/icon.ts\n * Checks that a icon field is matches app name in the desktop file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "ini", "from", "'ini'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "DesktopIcon", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/applications'", ",", "`${", "this", ".", "name", "}.desktop`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "raw", "=", "await", "fs", ".", "readFile", "(", "this", ".", "path", ",", "'utf8'", ")", ";", "const", "data", "=", "ini", ".", "parse", "(", "raw", ")", ";", "if", "(", "data", "[", "'Desktop Entry'", "]", "==", "null", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Missing application data'", ")", ";", "}", "if", "(", "data", "[", "'Desktop Entry'", "]", ".", "Icon", "!==", "this", ".", "name", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Incorrect desktop file icon value'", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
51
[ "/**\n * houston/src/worker/task/appstream/validate.ts\n * Runs desktop files through the `desktop-file-validate` command\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "glob", "}", "from", "'../../../lib/utility/glob'", ";", "import", "{", "Docker", "}", "from", "'../../docker'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "DesktopValidate", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/applications'", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "files", "=", "await", "glob", "(", "path", ".", "resolve", "(", "this", ".", "path", ",", "'*'", ")", ")", ";", "const", "logFiles", "=", "[", "]", ";", "for", "(", "const", "file", "of", "files", ")", "{", "const", "fileName", "=", "path", ".", "basename", "(", "file", ")", ";", "const", "docker", "=", "await", "this", ".", "docker", "(", "fileName", ")", ";", "const", "localFile", "=", "path", ".", "relative", "(", "this", ".", "path", ",", "file", ")", ";", "const", "exit", "=", "await", "docker", ".", "run", "(", "localFile", ")", ";", "if", "(", "exit", "!==", "0", ")", "{", "logFiles", ".", "push", "(", "fileName", ")", ";", "}", "}", "if", "(", "logFiles", ".", "length", ">", "0", ")", "{", "throw", "await", "this", ".", "log", "(", "logFiles", ")", ";", "}", "}", "return", "{", "string", "}", "protected", "logPath", "(", "file", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "`appstream-${", "file", "}.log`", ")", ";", "}", "async", "param", "{", "string", "[", "]", "}", "files", "return", "{", "Log", "}", "protected", "async", "log", "(", "files", ")", "{", "const", "p", "=", "path", ".", "resolve", "(", "__dirname", ",", "'validate.md'", ")", ";", "const", "logs", "=", "{", "}", ";", "for", "(", "const", "file", "of", "files", ")", "{", "logs", "[", "file", "]", "=", "await", "fs", ".", "readFile", "(", "this", ".", "logPath", "(", "file", ")", ",", "'utf8'", ")", ";", "}", "return", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "p", ",", "{", "logs", ",", "storage", ":", "this", ".", "worker", ".", "context", "}", ")", ";", "}", "async", "param", "{", "string", "}", "file", "return", "{", "Docker", "}", "protected", "async", "docker", "(", "file", ")", "{", "const", "docker", "=", "new", "Docker", "(", "this", ".", "worker", ".", "config", ",", "'desktop-validate'", ")", ";", "const", "exists", "=", "await", "docker", ".", "exists", "(", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "const", "folder", "=", "path", ".", "resolve", "(", "__dirname", ",", "'validate'", ")", ";", "await", "docker", ".", "create", "(", "folder", ")", ";", "}", "docker", ".", "log", "=", "this", ".", "logPath", "(", "file", ")", ";", "docker", ".", "mount", "(", "this", ".", "path", ",", "'/tmp/houston'", ")", ";", "return", "docker", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 5, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
52
[ "/**\n * houston/src/worker/task/desktop/index.ts\n * Runs a bunch of tests around the desktop file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "WrapperTask", "}", "from", "'../wrapperTask'", ";", "import", "{", "DesktopExec", "}", "from", "'./exec'", ";", "import", "{", "DesktopIcon", "}", "from", "'./icon'", ";", "import", "{", "DesktopValidate", "}", "from", "'./validate'", ";", "export", "class", "Desktop", "extends", "WrapperTask", "{", "var", "public", "get", "tasks", "(", ")", "{", "switch", "(", "this", ".", "worker", ".", "context", ".", "type", ")", "{", "case", "'system-app'", ":", "return", "[", "DesktopExec", ",", "DesktopValidate", "]", ";", "default", ":", "return", "[", "DesktopExec", ",", "DesktopIcon", ",", "DesktopValidate", "]", ";", "}", "}", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "public", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/share/applications'", ",", "`${", "this", ".", "name", "}.desktop`", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "exists", "=", "await", "fs", ".", "exists", "(", "this", ".", "path", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Desktop file does not exist'", ")", ";", "}", "await", "this", ".", "runTasks", "(", ")", ";", "this", ".", "logs", ".", "forEach", "(", "(", "l", ")", "=>", "this", ".", "worker", ".", "report", "(", "l", ")", ")", ";", "if", "(", "this", ".", "errorLogs", ".", "length", ">", "0", ")", "{", "this", ".", "worker", ".", "stop", "(", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 735, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
53
[ "/**\n * houston/src/worker/task/file/deb/binary.ts\n * Tests debian packages for needed binary file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "glob", "}", "from", "'../../../../lib/utility/glob'", ";", "import", "{", "sanitize", "}", "from", "'../../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../../log'", ";", "import", "{", "Task", "}", "from", "'../../task'", ";", "export", "class", "FileDebBinary", "extends", "Task", "{", "return", "{", "string", "}", "public", "get", "name", "(", ")", "{", "return", "sanitize", "(", "this", ".", "worker", ".", "context", ".", "nameDomain", ",", "'-'", ")", ";", "}", "return", "{", "string", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package/usr/bin'", ",", "this", ".", "name", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "exists", "=", "await", "fs", ".", "exists", "(", "this", ".", "path", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "path", ".", "resolve", "(", "__dirname", ",", "'binary.md'", ")", ",", "{", "context", ":", "this", ".", "worker", ".", "context", ",", "files", ":", "await", "this", ".", "files", "(", ")", ",", "name", ":", "this", ".", "name", "}", ")", ";", "}", "}", "async", "return", "{", "string", "[", "]", "}", "protected", "async", "files", "(", ")", "{", "const", "root", "=", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package'", ")", ";", "const", "files", "=", "await", "glob", "(", "path", ".", "resolve", "(", "root", ",", "'**/*'", ")", ",", "{", "nodir", ":", "true", "}", ")", ";", "return", "files", ".", "filter", "(", "(", "p", ")", "=>", "!", "p", ".", "startsWith", "(", "path", ".", "resolve", "(", "root", ",", "'DEBIAN'", ")", ")", ")", ".", "filter", "(", "(", "p", ")", "=>", "(", "p", "!==", "path", ".", "resolve", "(", "root", ",", "'FILES'", ")", ")", ")", ".", "map", "(", "(", "p", ")", "=>", "p", ".", "substring", "(", "root", ".", "length", ")", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
54
[ "/**\n * houston/src/worker/task/file/deb/binary.ts\n * Tests debian packages for needed binary file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "glob", "}", "from", "'../../../../lib/utility/glob'", ";", "import", "{", "Log", "}", "from", "'../../../log'", ";", "import", "{", "Task", "}", "from", "'../../task'", ";", "export", "class", "FileDebNonexistent", "extends", "Task", "{", "return", "{", "string", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package'", ")", ";", "}", "return", "{", "string", "}", "protected", "get", "files", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "path", ",", "'package/nonexistent/**/*'", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "files", "=", "await", "glob", "(", "this", ".", "files", ")", ";", "if", "(", "files", ".", "length", "<", "1", ")", "{", "return", ";", "}", "const", "relativePaths", "=", "files", ".", "map", "(", "(", "file", ")", "=>", "file", ".", "replace", "(", "`${", "this", ".", "path", "}/`", ",", "''", ")", ")", ";", "const", "p", "=", "path", ".", "resolve", "(", "__dirname", ",", "'nonexistentLog.md'", ")", ";", "const", "log", "=", "await", "fs", ".", "readFile", "(", "p", ",", "'utf8'", ")", ";", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "p", ",", "{", "files", ":", "relativePaths", ",", "storage", ":", "this", ".", "worker", ".", "context", "}", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
55
[ "/**\n * houston/src/worker/task/pack/deb.ts\n * Packages up an extracted deb file\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "Docker", "}", "from", "'../../docker'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "PackDeb", "extends", "Task", "{", "return", "{", "string", "}", "protected", "get", "path", "(", ")", "{", "return", "path", ".", "resolve", "(", "this", ".", "worker", ".", "workspace", ",", "'package'", ")", ";", "}", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "docker", "=", "await", "this", ".", "docker", "(", "this", ".", "worker", ".", "workspace", ")", ";", "const", "exit", "=", "await", "docker", ".", "run", "(", "'pack-deb'", ",", "{", "Privileged", ":", "true", "}", ")", ";", "if", "(", "exit", "!==", "0", ")", "{", "throw", "new", "Log", "(", "Log", ".", "Level", ".", "ERROR", ",", "'Unable to pack Debian package'", ")", ";", "}", "}", "async", "param", "{", "string", "}", "p", "return", "{", "Docker", "}", "protected", "async", "docker", "(", "p", ")", "{", "const", "docker", "=", "new", "Docker", "(", "this", ".", "worker", ".", "config", ",", "'pack-deb'", ")", ";", "const", "exists", "=", "await", "docker", ".", "exists", "(", ")", ";", "if", "(", "exists", "===", "false", ")", "{", "const", "folder", "=", "path", ".", "resolve", "(", "__dirname", ",", "'deb'", ")", ";", "await", "docker", ".", "create", "(", "folder", ")", ";", "}", "docker", ".", "mount", "(", "this", ".", "worker", ".", "workspace", ",", "'/tmp/houston'", ")", ";", "return", "docker", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, 18787, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
56
[ "/**\n * houston/src/worker/task/workspace/setup.ts\n * Fills the workspace with files from git\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "{", "get", ",", "isEqual", ",", "set", "}", "from", "'lodash'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "uuid", "from", "'uuid/v4'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "IWorker", "}", "from", "'../../type'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "/**\n * Everything that makes a build unique. All of these can be derived from\n * reference names in the repository.\n */", "export", "interface", "IBuildConfiguration", "{", "architecture", ":", "string", ";", "distribution", ":", "string", ";", "packageType", ":", "string", ";", "}", "var", "const", "POSSIBLE_ARCHITECTURES", "=", "[", "'amd64'", "]", ";", "const", "POSSIBLE_DISTRIBUTIONS", "=", "[", "'loki'", ",", "'juno'", ",", "'hera'", "]", ";", "const", "POSSIBLE_PACKAGE_TYPES", "=", "[", "'deb'", "]", ";", "var", "const", "DEFAULT_BUILDS", "=", "[", "{", "architecture", ":", "'amd64'", ",", "distribution", ":", "'hera'", ",", "packageType", ":", "'deb'", "}", "]", ";", "export", "class", "WorkspaceSetup", "extends", "Task", "{", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "await", "this", ".", "worker", ".", "emitAsync", "(", "`task:WorkspaceSetup:start`", ")", ";", "for", "(", "const", "build", "of", "await", "this", ".", "possibleBuilds", "(", ")", ")", "{", "await", "this", ".", "setupBuild", "(", "build", ")", ";", "}", "await", "this", ".", "worker", ".", "emitAsync", "(", "`task:WorkspaceSetup:end`", ")", ";", "}", "async", "return", "{", "IBuildConfiguration", "[", "]", "}", "public", "async", "possibleBuilds", "(", ")", "{", "const", "repositoryReferences", "=", "await", "this", ".", "worker", ".", "repository", ".", "references", "(", ")", ";", "const", "referenceShorthands", "=", "repositoryReferences", ".", "map", "(", "(", "ref", ")", "=>", "ref", ".", "split", "(", "'/'", ")", ".", "reverse", "(", ")", "[", "0", "]", ")", ";", "const", "builds", "=", "[", "]", ";", "for", "(", "const", "packageType", "of", "POSSIBLE_PACKAGE_TYPES", ")", "{", "for", "(", "const", "architecture", "of", "POSSIBLE_ARCHITECTURES", ")", "{", "for", "(", "const", "distribution", "of", "POSSIBLE_DISTRIBUTIONS", ")", "{", "const", "foundExactReference", "=", "referenceShorthands", ".", "find", "(", "(", "ref", ")", "=>", "(", "ref", "===", "`${", "packageType", "}-packaging-${", "distribution", "}`", ")", ")", ";", "if", "(", "foundExactReference", "!=", "null", ")", "{", "builds", ".", "push", "(", "{", "architecture", ",", "distribution", ",", "packageType", "}", ")", ";", "}", "}", "}", "const", "foundShortReference", "=", "referenceShorthands", ".", "find", "(", "(", "ref", ")", "=>", "(", "ref", "===", "`${", "packageType", "}-packaging`", ")", ")", ";", "if", "(", "foundShortReference", "!=", "null", ")", "{", "const", "latestDistro", "=", "[", "...", "POSSIBLE_DISTRIBUTIONS", "]", ".", "reverse", "(", ")", "[", "0", "]", ";", "const", "shortBuild", "=", "{", "architecture", ":", "'amd64'", ",", "distribution", ":", "latestDistro", ",", "packageType", "}", ";", "if", "(", "builds", ".", "find", "(", "(", "b", ")", "=>", "(", "isEqual", "(", "b", ",", "shortBuild", ")", ")", ")", "==", "null", ")", "{", "builds", ".", "push", "(", "shortBuild", ")", ";", "}", "}", "}", "if", "(", "builds", ".", "length", "===", "0", ")", "{", "builds", ".", "push", "(", "...", "DEFAULT_BUILDS", ")", ";", "}", "return", "builds", ";", "}", "async", "param", "{", "IBuildConfiguration", "}", "build", "return", "{", "String", "[", "]", "}", "public", "async", "buildReferences", "(", "build", ")", "{", "const", "repositoryReferences", "=", "await", "this", ".", "worker", ".", "repository", ".", "references", "(", ")", ";", "const", "mergableReferences", "=", "[", "`${", "build", ".", "distribution", "}`", ",", "`${", "build", ".", "packageType", "}-packaging`", ",", "`${", "build", ".", "packageType", "}-packaging-${", "build", ".", "distribution", "}`", "]", ";", "this", ".", "worker", ".", "context", ".", "references", ".", "map", "(", "(", "ref", ")", "=>", "ref", ".", "split", "(", "'/'", ")", ".", "reverse", "(", ")", "[", "0", "]", ")", ".", "filter", "(", "(", "ref", ")", "=>", "(", "ref", "!=", "null", "&&", "ref", "!==", "''", ")", ")", ".", "forEach", "(", "(", "shortRef", ")", "=>", "{", "mergableReferences", ".", "push", "(", "`${", "build", ".", "packageType", "}-packaging-${", "shortRef", "}`", ")", ";", "mergableReferences", ".", "push", "(", "`${", "build", ".", "packageType", "}-packaging-${", "build", ".", "distribution", "}-${", "shortRef", "}`", ")", ";", "}", ")", ";", "return", "repositoryReferences", ".", "filter", "(", "(", "rref", ")", "=>", "mergableReferences", ".", "some", "(", "(", "ref", ")", "=>", "rref", ".", "endsWith", "(", "ref", ")", ")", ")", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "{", "const", "aIndex", "=", "mergableReferences", ".", "findIndex", "(", "(", "ref", ")", "=>", "(", "a", ".", "indexOf", "(", "ref", ")", "!==", "-", "1", ")", ")", ";", "const", "bIndex", "=", "mergableReferences", ".", "findIndex", "(", "(", "ref", ")", "=>", "(", "b", ".", "indexOf", "(", "ref", ")", "!==", "-", "1", ")", ")", ";", "return", "(", "aIndex", "-", "bIndex", ")", ";", "}", ")", ";", "}", "async", "param", "{", "IBuildConfiguration", "}", "build", "return", "{", "void", "}", "protected", "async", "setupBuild", "(", "build", ")", "{", "const", "basicFork", "=", "await", "this", ".", "worker", ".", "fork", "(", "{", "architecture", ":", "build", ".", "architecture", ",", "distribution", ":", "build", ".", "distribution", ",", "package", ":", "{", "type", ":", "build", ".", "packageType", "}", "}", ")", ";", "const", "worker", "=", "await", "this", ".", "worker", ".", "emitAsyncChain", "<", "IWorker", ">", "(", "`task:WorkspaceSetup:fork`", ",", "basicFork", ")", ";", "await", "fs", ".", "ensureDir", "(", "worker", ".", "workspace", ")", ";", "const", "references", "=", "[", "...", "worker", ".", "context", ".", "references", ",", "...", "(", "await", "this", ".", "buildReferences", "(", "build", ")", ")", "]", ";", "for", "(", "let", "i", "=", "0", ";", "i", "<", "references", ".", "length", ";", "i", "++", ")", "{", "const", "gitFolder", "=", "path", ".", "resolve", "(", "worker", ".", "workspace", ",", "'repository'", ",", "`${", "i", "}`", ")", ";", "await", "worker", ".", "repository", ".", "clone", "(", "gitFolder", ",", "references", "[", "i", "]", ")", ";", "}", "for", "(", "let", "i", "=", "0", ";", "i", "<", "references", ".", "length", ";", "i", "++", ")", "{", "const", "from", "=", "path", ".", "resolve", "(", "worker", ".", "workspace", ",", "'repository'", ",", "`${", "i", "}`", ")", ";", "const", "to", "=", "path", ".", "resolve", "(", "worker", ".", "workspace", ",", "'clean'", ")", ";", "await", "fs", ".", "copy", "(", "from", ",", "to", ",", "{", "overwrite", ":", "true", "}", ")", ";", "}", "const", "clean", "=", "path", ".", "resolve", "(", "worker", ".", "workspace", ",", "'clean'", ")", ";", "const", "dirty", "=", "path", ".", "resolve", "(", "worker", ".", "workspace", ",", "'dirty'", ")", ";", "await", "fs", ".", "ensureDir", "(", "clean", ")", ";", "await", "fs", ".", "ensureDir", "(", "dirty", ")", ";", "await", "fs", ".", "copy", "(", "clean", ",", "dirty", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, 3, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
57
[ "/**\n * houston/src/worker/preset/build.ts\n * Builds a package and edits contents for appcenter.\n */", "import", "{", "App", "}", "from", "'../../lib/app'", ";", "import", "{", "ICodeRepository", "}", "from", "'../../lib/service'", ";", "import", "*", "as", "type", "from", "'../type'", ";", "import", "{", "Worker", "}", "from", "'../worker'", ";", "import", "{", "Appstream", "}", "from", "'../task/appstream'", ";", "import", "{", "BuildDeb", "}", "from", "'../task/build/deb'", ";", "import", "{", "DebianChangelog", "}", "from", "'../task/debian/changelog'", ";", "import", "{", "DebianControl", "}", "from", "'../task/debian/control'", ";", "import", "{", "Desktop", "}", "from", "'../task/desktop'", ";", "import", "{", "ExtractDeb", "}", "from", "'../task/extract/deb'", ";", "import", "{", "FileDeb", "}", "from", "'../task/file/deb'", ";", "import", "{", "PackDeb", "}", "from", "'../task/pack/deb'", ";", "import", "{", "WorkspaceSetup", "}", "from", "'../task/workspace/setup'", ";", "function", "buildTasks", "(", "t", ")", "{", "switch", "(", "t", ")", "{", "case", "'library'", ":", "case", "'system-library'", ":", "return", "[", "WorkspaceSetup", ",", "DebianChangelog", ",", "DebianControl", ",", "BuildDeb", "]", ";", "case", "'system-app'", ":", "return", "[", "WorkspaceSetup", ",", "BuildDeb", "]", ";", "default", ":", "return", "[", "WorkspaceSetup", ",", "DebianChangelog", ",", "DebianControl", ",", "BuildDeb", ",", "ExtractDeb", ",", "FileDeb", ",", "Appstream", ",", "Desktop", ",", "PackDeb", "]", ";", "}", "}", "export", "function", "Build", "(", "app", ",", "repository", ",", "context", ")", "{", "const", "worker", "=", "new", "Worker", "(", "app", ",", "repository", ",", "context", ")", ";", "for", "(", "const", "task", "of", "buildTasks", "(", "context", ".", "type", ")", ")", "{", "worker", ".", "tasks", ".", "push", "(", "task", ")", ";", "}", "return", "worker", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 189, null, 0, null, 0, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
58
[ "/**\n * houston/src/worker/task/upload/log.ts\n * Uploads end error logs to third party services\n */", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "Logger", "}", "from", "'../../../lib/log'", ";", "import", "{", "isLogRepository", "}", "from", "'../../../lib/service'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "ILog", "}", "from", "'../../type'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "export", "class", "UploadLog", "extends", "Task", "{", "var", "protected", "errors", ":", "{", "error", ":", "Error", ";", "service", ":", "string", ";", "}", "[", "]", "=", "[", "]", ";", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "let", "logs", "=", "this", ".", "worker", ".", "result", ".", "logs", ";", "const", "ref", "=", "this", ".", "worker", ".", "context", ".", "references", "[", "this", ".", "worker", ".", "context", ".", "references", ".", "length", "-", "1", "]", ";", "logs", "=", "await", "this", ".", "uploadToCodeRepository", "(", "logs", ",", "ref", ")", ";", "this", ".", "worker", ".", "context", ".", "logs", "=", "logs", ";", "if", "(", "this", ".", "errors", ".", "length", "!==", "0", ")", "{", "this", ".", "reportErrors", "(", ")", ";", "}", "}", "async", "param", "{", "ILog", "[", "]", "}", "logs", "param", "{", "string", "}", "ref", "return", "{", "ILog", "[", "]", "}", "protected", "async", "uploadToCodeRepository", "(", "logs", ",", "ref", ")", "{", "if", "(", "!", "isLogRepository", "(", "this", ".", "worker", ".", "repository", ")", ")", "{", "return", ";", "}", "const", "newLogs", "=", "[", "]", ";", "try", "{", "for", "(", "const", "log", "of", "logs", ")", "{", "newLogs", ".", "push", "(", "await", "this", ".", "worker", ".", "repository", ".", "uploadLog", "(", "log", ",", "'review'", ",", "ref", ")", ")", ";", "}", "}", "catch", "(", "error", ")", "{", "this", ".", "errors", ".", "push", "(", "{", "error", ",", "service", ":", "this", ".", "worker", ".", "repository", ".", "serviceName", "}", ")", ";", "}", "return", "newLogs", ";", "}", "throws", "protected", "reportErrors", "(", ")", "{", "const", "logger", "=", "this", ".", "worker", ".", "app", ".", "get", "<", "Logger", ">", "(", "Logger", ")", ";", "this", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "logger", ".", "error", "(", "'Error uploading logs'", ")", ".", "setError", "(", "e", ".", "error", ")", ")", ";", "if", "(", "this", ".", "errors", ".", "length", "!==", "0", ")", "{", "const", "logPath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'log.md'", ")", ";", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "logPath", ",", "{", "services", ":", "this", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "service", ")", "}", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null ]
59
[ "/**\n * houston/src/worker/task/upload/package.ts\n * Responsible for uploading all the end results to third party services\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "Logger", "}", "from", "'../../../lib/log'", ";", "import", "{", "sanitize", "}", "from", "'../../../lib/utility/rdnn'", ";", "import", "{", "Log", "}", "from", "'../../log'", ";", "import", "{", "Task", "}", "from", "'../task'", ";", "import", "{", "IPackage", ",", "IPackageRepository", ",", "isPackageRepository", ",", "packageRepository", "}", "from", "'../../../lib/service'", ";", "export", "class", "UploadPackage", "extends", "Task", "{", "var", "protected", "errors", ":", "{", "error", ":", "Error", ";", "service", ":", "string", ";", "}", "[", "]", "=", "[", "]", ";", "async", "return", "{", "void", "}", "public", "async", "run", "(", ")", "{", "const", "packages", "=", "this", ".", "worker", ".", "result", ".", "packages", ";", "for", "(", "const", "context", "of", "this", ".", "worker", ".", "contexts", ")", "{", "if", "(", "context", ".", "package", "==", "null", "||", "context", ".", "package", ".", "path", "==", "null", ")", "{", "continue", ";", "}", "if", "(", "!", "(", "await", "fs", ".", "pathExists", "(", "context", ".", "package", ".", "path", ")", ")", ")", "{", "continue", ";", "}", "const", "ref", "=", "context", ".", "references", "[", "context", ".", "references", ".", "length", "-", "1", "]", ";", "context", ".", "package", ".", "name", "=", "`${", "context", ".", "nameHuman", "} ${", "context", ".", "version", "}`", ";", "context", ".", "package", ".", "description", "=", "[", "sanitize", "(", "context", ".", "nameDomain", ",", "'-'", ")", ",", "context", ".", "architecture", ",", "context", ".", "distribution", ",", "context", ".", "version", "]", ".", "join", "(", "' '", ")", ";", "if", "(", "context", ".", "architecture", ")", "{", "context", ".", "package", ".", "architecture", "=", "context", ".", "architecture", ";", "}", "switch", "(", "context", ".", "distribution", ")", "{", "case", "(", "null", ")", ":", "break", ";", "case", "(", "'loki'", ")", ":", "context", ".", "package", ".", "distribution", "=", "'loki'", ";", "break", ";", "case", "(", "'juno'", ")", ":", "case", "(", "'hera'", ")", ":", "context", ".", "package", ".", "distribution", "=", "'juno'", ";", "break", ";", "default", ":", "context", ".", "package", ".", "distribution", "=", "context", ".", "distribution", ";", "break", ";", "}", "context", ".", "package", "=", "await", "this", ".", "uploadToCodeRepository", "(", "context", ".", "package", ",", "ref", ")", ";", "context", ".", "package", "=", "await", "this", ".", "uploadToPackageRepositories", "(", "context", ".", "package", ",", "ref", ")", ";", "}", "if", "(", "this", ".", "errors", ".", "length", "!==", "0", ")", "{", "this", ".", "reportErrors", "(", ")", ";", "}", "}", "async", "param", "{", "IPackage", "}", "pkg", "param", "{", "string", "}", "ref", "return", "{", "IPackage", "}", "protected", "async", "uploadToCodeRepository", "(", "pkg", ",", "ref", ")", "{", "if", "(", "!", "isPackageRepository", "(", "this", ".", "worker", ".", "repository", ")", ")", "{", "return", ";", "}", "try", "{", "pkg", "=", "await", "this", ".", "worker", ".", "repository", ".", "uploadPackage", "(", "pkg", ",", "'review'", ",", "ref", ")", ";", "}", "catch", "(", "error", ")", "{", "this", ".", "errors", ".", "push", "(", "{", "error", ",", "service", ":", "this", ".", "worker", ".", "repository", ".", "serviceName", "}", ")", ";", "}", "return", "pkg", ";", "}", "async", "param", "{", "IPackage", "}", "pkg", "param", "{", "string", "}", "ref", "return", "{", "IPackage", "}", "protected", "async", "uploadToPackageRepositories", "(", "pkg", ",", "ref", ")", "{", "if", "(", "!", "this", ".", "worker", ".", "app", ".", "isBound", "(", "packageRepository", ")", ")", "{", "return", ";", "}", "const", "packageRepositories", "=", "this", ".", "worker", ".", "app", ".", "getAll", "<", "IPackageRepository", ">", "(", "packageRepository", ")", ";", "for", "(", "const", "repo", "of", "packageRepositories", ")", "{", "try", "{", "pkg", "=", "await", "repo", ".", "uploadPackage", "(", "pkg", ",", "'review'", ",", "ref", ")", ";", "}", "catch", "(", "error", ")", "{", "this", ".", "errors", ".", "push", "(", "{", "error", ",", "service", ":", "repo", ".", "serviceName", "}", ")", ";", "}", "}", "return", "pkg", ";", "}", "throws", "protected", "reportErrors", "(", ")", "{", "const", "logger", "=", "this", ".", "worker", ".", "app", ".", "get", "<", "Logger", ">", "(", "Logger", ")", ";", "this", ".", "errors", ".", "forEach", "(", "(", "e", ")", "=>", "{", "logger", ".", "error", "(", "'Error uploading package'", ")", ".", "setError", "(", "e", ".", "error", ")", ".", "send", "(", ")", ";", "}", ")", ";", "if", "(", "this", ".", "errors", ".", "length", "!==", "0", ")", "{", "const", "logPath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'package.md'", ")", ";", "throw", "Log", ".", "template", "(", "Log", ".", "Level", ".", "ERROR", ",", "logPath", ",", "{", "services", ":", "this", ".", "errors", ".", "map", "(", "(", "e", ")", "=>", "e", ".", "service", ")", "}", ")", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null ]
60
[ "/**\n * houston/src/worker/preset/release.ts\n * Releases a package to all able endpoints.\n */", "import", "{", "App", "}", "from", "'../../lib/app'", ";", "import", "{", "ICodeRepository", "}", "from", "'../../lib/service'", ";", "import", "*", "as", "type", "from", "'../type'", ";", "import", "{", "Build", "}", "from", "'./build'", ";", "import", "{", "Upload", "}", "from", "'../task/upload'", ";", "export", "function", "Release", "(", "app", ",", "repository", ",", "context", ")", "{", "const", "worker", "=", "Build", "(", "app", ",", "repository", ",", "context", ")", ";", "worker", ".", "postTasks", ".", "push", "(", "Upload", ")", ";", "return", "worker", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, 189, null, 0, null, 0, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
61
[ "/**\n * houston/src/cli/cli.ts\n * Entry point to houston CLI\n */", "import", "*", "as", "yargs", "from", "'yargs'", ";", "import", "commands", "from", "'./commands'", ";", "yargs", ".", "version", "(", "false", ")", ";", "yargs", ".", "help", "(", "'h'", ")", ".", "alias", "(", "'h'", ",", "'help'", ")", ";", "for", "(", "const", "c", "of", "commands", ")", "{", "yargs", ".", "command", "(", "c", ")", ";", "}", "yargs", ".", "option", "(", "'config'", ",", "{", "alias", ":", "'c'", ",", "describe", ":", "'Path to configuration file'", ",", "type", ":", "'string'", "}", ")", ";", "yargs", ".", "recommendCommands", "(", ")", ";", "yargs", ".", "showHelpOnFail", "(", "true", ")", ";", "const", "argv", "=", "yargs", ".", "argv", ";", "if", "(", "argv", ".", "_", ".", "length", "===", "0", ")", "{", "yargs", ".", "showHelp", "(", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
62
[ "/**\n * houston/src/cli/utilities.ts\n * Some utilities for command line stuff\n */", "import", "{", "App", "}", "from", "'../lib/app'", ";", "import", "{", "Config", ",", "getConfig", "}", "from", "'../lib/config'", ";", "import", "{", "Logger", "}", "from", "'../lib/log'", ";", "param", "{", "Object", "}", "argv", "return", "{", "Object", "}", "export", "function", "setup", "(", "argv", ")", "{", "const", "config", "=", "getConfig", "(", "argv", ".", "config", ")", ";", "const", "app", "=", "new", "App", "(", "config", ")", ";", "const", "logger", "=", "app", ".", "get", "(", "Logger", ")", ";", "process", ".", "on", "(", "'unhandledRejection'", ",", "(", "reason", ")", "=>", "console", ".", "error", "(", "reason", ")", ")", ";", "return", "{", "app", ",", "config", ",", "logger", "}", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, 87, null, null, null, null, null, null, null, null, null, 189, null, null, null, null, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
63
[ "/**\n * houston/src/cli/commands/build.ts\n * Builds a project with the worker\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "isEqual", "from", "'lodash/isEqual'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "semver", "from", "'semver'", ";", "import", "{", "Config", "}", "from", "'../../lib/config'", ";", "import", "{", "levelIndex", "}", "from", "'../../lib/log/level'", ";", "import", "{", "codeRepositoryFactory", ",", "ICodeRepositoryFactory", "}", "from", "'../../lib/service'", ";", "import", "{", "sanitize", "}", "from", "'../../lib/utility/rdnn'", ";", "import", "{", "Build", "}", "from", "'../../worker/preset/build'", ";", "import", "{", "IContext", "}", "from", "'../../worker/type'", ";", "import", "{", "Worker", "}", "from", "'../../worker/worker'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'build <repo> <version>'", ";", "export", "const", "describe", "=", "'Builds a repository with the worker process'", ";", "export", "const", "builder", "=", "(", "yargs", ")", "=>", "{", "return", "yargs", ".", "positional", "(", "'repo'", ",", "{", "describe", ":", "'Full repository URL'", ",", "type", ":", "'string'", "}", ")", ".", "positional", "(", "'version'", ",", "{", "coerce", ":", "semver", ".", "valid", ",", "default", ":", "'0.0.1'", ",", "describe", ":", "'Semver version to build for'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'type'", ",", "{", "choices", ":", "[", "'app'", ",", "'system-app'", ",", "'library'", "]", ",", "default", ":", "'app'", ",", "describe", ":", "'The type of project'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-developer'", ",", "{", "describe", ":", "'Developer\\'s name'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-domain'", ",", "{", "alias", ":", "'n'", ",", "coerce", ":", "sanitize", ",", "describe", ":", "'Reverse Domain Name Notation'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-human'", ",", "{", "describe", ":", "'Human readable name'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'references'", ",", "{", "describe", ":", "'References to pull'", ",", "type", ":", "'array'", "}", ")", ";", "}", ";", "param", "{", "object", "}", "argv", "param", "{", "Repository", "}", "repository", "return", "{", "IContext", "}", "function", "buildContext", "(", "argv", ",", "repository", ")", "{", "const", "nameDomain", "=", "argv", "[", "'name-domain'", "]", "||", "repository", ".", "rdnn", ";", "const", "nameDeveloper", "=", "argv", "[", "'name-developer'", "]", "||", "'Rabbitbot'", ";", "const", "nameHuman", "=", "argv", "[", "'name-human'", "]", "||", "'Application'", ";", "const", "references", "=", "argv", ".", "references", "||", "[", "`refs/tags/${", "argv", ".", "version", "}`", "]", ";", "const", "obj", "=", "{", "appcenter", ":", "{", "}", ",", "appstream", ":", "''", ",", "architecture", ":", "''", ",", "changelog", ":", "[", "]", ",", "distribution", ":", "''", ",", "logs", ":", "[", "]", ",", "nameDeveloper", ",", "nameDomain", ",", "nameHuman", ",", "references", ",", "type", ":", "argv", ".", "type", ",", "version", ":", "argv", ".", "version", "}", ";", "return", "obj", ";", "}", "function", "logSpacer", "(", ")", "{", "console", ".", "log", "(", "''", ")", ";", "console", ".", "log", "(", "'='", ".", "repeat", "(", "80", ")", ")", ";", "console", ".", "log", "(", "''", ")", ";", "}", "param", "{", "Log", "[", "]", "}", "logs", "return", "{", "void", "}", "function", "logLogs", "(", "logs", ")", "{", "for", "(", "const", "log", "of", "logs", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "b", ".", "level", "-", "a", ".", "level", ")", ")", ")", "{", "logSpacer", "(", ")", ";", "console", ".", "log", "(", "log", ".", "toString", "(", ")", ")", ";", "}", "}", "param", "{", "Object", "}", "argv", "param", "{", "Worker", "}", "worker", "return", "{", "void", "}", "function", "logResult", "(", "argv", ",", "worker", ")", "{", "if", "(", "worker", ".", "fails", ")", "{", "console", ".", "error", "(", "`Error while running build for ${", "argv", ".", "repo", "} for ${", "argv", ".", "version", "}`", ")", ";", "logLogs", "(", "worker", ".", "result", ".", "logs", ")", ";", "logSpacer", "(", ")", ";", "}", "else", "{", "console", ".", "log", "(", "`Built ${", "argv", ".", "repo", "} for version ${", "argv", ".", "version", "}`", ")", ";", "const", "builds", "=", "worker", ".", "contexts", ".", "map", "(", "(", "{", "architecture", ",", "distribution", "}", ")", "=>", "(", "{", "architecture", ",", "distribution", "}", ")", ")", ".", "filter", "(", "(", "{", "architecture", "}", ")", "=>", "(", "architecture", "!==", "''", ")", ")", ".", "filter", "(", "(", "{", "distribution", "}", ")", "=>", "(", "distribution", "!==", "''", ")", ")", ".", "filter", "(", "(", "b", ",", "i", ",", "a", ")", "=>", "(", "a", ".", "findIndex", "(", "(", "mb", ")", "=>", "isEqual", "(", "b", ",", "mb", ")", ")", "===", "i", ")", ")", ";", "for", "(", "const", "build", "of", "builds", ")", "{", "console", ".", "log", "(", "`Built ${", "build", ".", "architecture", "} ${", "build", ".", "distribution", "}`", ")", ";", "}", "logLogs", "(", "worker", ".", "result", ".", "logs", ")", ";", "logSpacer", "(", ")", ";", "}", "}", "export", "async", "function", "handler", "(", "argv", ")", "{", "const", "{", "app", "}", "=", "setup", "(", "argv", ")", ";", "const", "repoFactory", "=", "app", ".", "get", "<", "ICodeRepositoryFactory", ">", "(", "codeRepositoryFactory", ")", ";", "const", "repository", "=", "await", "repoFactory", "(", "argv", ".", "repo", ")", ";", "const", "context", "=", "buildContext", "(", "argv", ",", "repository", ")", ";", "const", "worker", "=", "Build", "(", "app", ",", "repository", ",", "context", ")", ";", "console", ".", "log", "(", "`Running build for ${", "argv", ".", "repo", "} version ${", "argv", ".", "version", "}`", ")", ";", "await", "worker", ".", "setup", "(", ")", ";", "await", "worker", ".", "run", "(", ")", ";", "for", "(", "const", "pkg", "of", "worker", ".", "result", ".", "packages", ")", "{", "if", "(", "pkg", ".", "path", "!=", "null", "&&", "await", "fs", ".", "exists", "(", "pkg", ".", "path", ")", ")", "{", "const", "fileName", "=", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "path", ".", "basename", "(", "pkg", ".", "path", ")", ")", ";", "await", "fs", ".", "copy", "(", "pkg", ".", "path", ",", "fileName", ",", "{", "overwrite", ":", "true", "}", ")", ";", "}", "}", "logResult", "(", "argv", ",", "worker", ")", ";", "if", "(", "worker", ".", "fails", ")", "{", "process", ".", "exit", "(", "1", ")", ";", "}", "else", "{", "process", ".", "exit", "(", "0", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10980, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
64
[ "/**\n * houston/src/cli/commands/ci.ts\n * Tests a project with the worker. Used when a code base is local.\n */", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "isEqual", "from", "'lodash/isEqual'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "semver", "from", "'semver'", ";", "import", "{", "Config", "}", "from", "'../../lib/config'", ";", "import", "{", "levelIndex", "}", "from", "'../../lib/log/level'", ";", "import", "{", "codeRepositoryFactory", ",", "ICodeRepositoryFactory", "}", "from", "'../../lib/service'", ";", "import", "{", "sanitize", "}", "from", "'../../lib/utility/rdnn'", ";", "import", "{", "Build", "}", "from", "'../../worker/preset/build'", ";", "import", "{", "IContext", "}", "from", "'../../worker/type'", ";", "import", "{", "Worker", "}", "from", "'../../worker/worker'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'ci [directory]'", ";", "export", "const", "describe", "=", "'Tests a local project with the worker process'", ";", "const", "SLUG", "=", "process", ".", "env", ".", "TRAVIS_REPO_SLUG", ";", "const", "REPO", "=", "`https://github.com/${", "SLUG", "}`", ";", "const", "BRANCH", "=", "process", ".", "env", ".", "TRAVIS_BRANCH", ";", "export", "const", "builder", "=", "(", "yargs", ")", "=>", "{", "return", "yargs", ".", "positional", "(", "'directory'", ",", "{", "coerce", ":", "(", "v", ")", "=>", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "v", ")", ",", "default", ":", "'.'", ",", "describe", ":", "'The project directory to build'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'type'", ",", "{", "choices", ":", "[", "'app'", ",", "'system-app'", ",", "'library'", "]", ",", "default", ":", "'app'", ",", "describe", ":", "'The type of project'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'repo'", ",", "{", "...", "(", "SLUG", "!=", "null", ")", "?", "{", "default", ":", "REPO", "}", ":", "{", "}", ",", "demandOption", ":", "true", ",", "describe", ":", "'Full repository URL'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'version'", ",", "{", "coerce", ":", "semver", ".", "valid", ",", "default", ":", "'0.0.1'", ",", "describe", ":", "'Semver version to build for'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-developer'", ",", "{", "describe", ":", "'Developer\\'s name'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-domain'", ",", "{", "alias", ":", "'n'", ",", "coerce", ":", "sanitize", ",", "describe", ":", "'Reverse Domain Name Notation'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'name-human'", ",", "{", "describe", ":", "'Human readable name'", ",", "type", ":", "'string'", "}", ")", ".", "option", "(", "'references'", ",", "{", "default", ":", "[", "]", ",", "describe", ":", "'References to pull'", ",", "type", ":", "'array'", "}", ")", ";", "}", ";", "param", "{", "object", "}", "argv", "param", "{", "Repository", "}", "repository", "return", "{", "object", "}", "function", "buildStorage", "(", "argv", ",", "repository", ")", "{", "const", "nameDomain", "=", "argv", "[", "'name-domain'", "]", "||", "repository", ".", "rdnn", ";", "const", "nameDeveloper", "=", "argv", "[", "'name-developer'", "]", "||", "'Rabbitbot'", ";", "const", "nameHuman", "=", "argv", "[", "'name-human'", "]", "||", "'Application'", ";", "const", "obj", "=", "{", "appcenter", ":", "{", "}", ",", "appstream", ":", "''", ",", "architecture", ":", "''", ",", "changelog", ":", "[", "]", ",", "distribution", ":", "''", ",", "logs", ":", "[", "]", ",", "nameDeveloper", ",", "nameDomain", ",", "nameHuman", ",", "references", ":", "argv", ".", "references", ",", "type", ":", "argv", ".", "type", ",", "version", ":", "argv", ".", "version", "}", ";", "return", "obj", ";", "}", "function", "logSpacer", "(", ")", "{", "console", ".", "log", "(", "''", ")", ";", "console", ".", "log", "(", "'='", ".", "repeat", "(", "80", ")", ")", ";", "console", ".", "log", "(", "''", ")", ";", "}", "param", "{", "Log", "[", "]", "}", "logs", "return", "{", "void", "}", "function", "logLogs", "(", "logs", ")", "{", "for", "(", "const", "log", "of", "logs", ".", "sort", "(", "(", "a", ",", "b", ")", "=>", "(", "b", ".", "level", "-", "a", ".", "level", ")", ")", ")", "{", "logSpacer", "(", ")", ";", "console", ".", "log", "(", "log", ".", "toString", "(", ")", ")", ";", "}", "}", "param", "{", "Object", "}", "argv", "param", "{", "Worker", "}", "worker", "return", "{", "void", "}", "function", "logResult", "(", "argv", ",", "worker", ")", "{", "if", "(", "worker", ".", "fails", ")", "{", "console", ".", "error", "(", "`Error while running build for ${", "argv", ".", "repo", "} for ${", "argv", ".", "version", "}`", ")", ";", "logLogs", "(", "worker", ".", "result", ".", "logs", ")", ";", "logSpacer", "(", ")", ";", "}", "else", "{", "console", ".", "log", "(", "`Built ${", "argv", ".", "repo", "} for version ${", "argv", ".", "version", "}`", ")", ";", "const", "builds", "=", "worker", ".", "contexts", ".", "map", "(", "(", "{", "architecture", ",", "distribution", "}", ")", "=>", "(", "{", "architecture", ",", "distribution", "}", ")", ")", ".", "filter", "(", "(", "{", "architecture", "}", ")", "=>", "(", "architecture", "!==", "''", ")", ")", ".", "filter", "(", "(", "{", "distribution", "}", ")", "=>", "(", "distribution", "!==", "''", ")", ")", ".", "filter", "(", "(", "b", ",", "i", ",", "a", ")", "=>", "(", "a", ".", "findIndex", "(", "(", "mb", ")", "=>", "isEqual", "(", "b", ",", "mb", ")", ")", "===", "i", ")", ")", ";", "for", "(", "const", "build", "of", "builds", ")", "{", "console", ".", "log", "(", "`Built ${", "build", ".", "architecture", "} ${", "build", ".", "distribution", "}`", ")", ";", "}", "logLogs", "(", "worker", ".", "result", ".", "logs", ")", ";", "logSpacer", "(", ")", ";", "}", "}", "export", "async", "function", "handler", "(", "argv", ")", "{", "console", ".", "warn", "(", "'THIS COMMAND IS NOT FULLY COMPLETE'", ")", ";", "console", ".", "warn", "(", "'IT ONLY WORKS ON GITHUB WITH TRAVIS AT THIS TIME'", ")", ";", "const", "{", "app", "}", "=", "setup", "(", "argv", ")", ";", "const", "repoFactory", "=", "app", ".", "get", "<", "ICodeRepositoryFactory", ">", "(", "codeRepositoryFactory", ")", ";", "const", "repository", "=", "await", "repoFactory", "(", "argv", ".", "repo", ")", ";", "const", "context", "=", "buildStorage", "(", "argv", ",", "repository", ")", ";", "const", "worker", "=", "Build", "(", "app", ",", "repository", ",", "context", ")", ";", "const", "projectDir", "=", "path", ".", "resolve", "(", "process", ".", "cwd", "(", ")", ",", "argv", ".", "directory", ")", ";", "console", ".", "log", "(", "`Testing \"${", "projectDir", "}\" project for \"${", "argv", ".", "repo", "}\"`", ")", ";", "worker", ".", "on", "(", "'task:WorkspaceSetup:fork'", ",", "async", "(", "w", ")", "=>", "{", "await", "fs", ".", "copy", "(", "projectDir", ",", "path", ".", "resolve", "(", "w", ".", "workspace", ",", "'clean'", ")", ",", "{", "overwrite", ":", "true", "}", ")", ";", "await", "fs", ".", "copy", "(", "projectDir", ",", "path", ".", "resolve", "(", "w", ".", "workspace", ",", "'dirty'", ")", ",", "{", "overwrite", ":", "true", "}", ")", ";", "return", "w", ";", "}", ")", ";", "const", "interval", "=", "setInterval", "(", "(", ")", "=>", "process", ".", "stdout", ".", "write", "(", "'.'", ")", ",", "10000", ")", ";", "await", "worker", ".", "setup", "(", ")", ";", "await", "worker", ".", "run", "(", ")", ";", "clearInterval", "(", "interval", ")", ";", "console", ".", "log", "(", "'.'", ")", ";", "logResult", "(", "argv", ",", "worker", ")", ";", "if", "(", "worker", ".", "fails", ")", "{", "process", ".", "exit", "(", "1", ")", ";", "}", "else", "{", "process", ".", "exit", "(", "0", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, 2, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, 592, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 244, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
65
[ "exports", "import", "{", "inject", ",", "injectable", "}", "from", "'inversify'", ";", "import", "*", "as", "Knex", "from", "'knex'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "Log", "}", "from", "'../log'", ";", "property", "@", "injectable", "(", ")", "export", "class", "Database", "{", "public", "knex", ":", "Knex", ";", "protected", "config", ":", "Config", ";", "protected", "log", ":", "Log", ";", "param", "{", "Config", "}", "config", "param", "{", "Log", "}", "log", "constructor", "(", "@", "inject", "(", "Config", ")", "config", ",", "@", "inject", "(", "Log", ")", "log", ")", "{", "const", "migrationPath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'migration'", ")", ";", "const", "seedPath", "=", "path", ".", "resolve", "(", "__dirname", ",", "'seed'", ")", ";", "const", "databaseConfig", "=", "Object", ".", "assign", "(", "{", "}", ",", "config", ".", "get", "(", "'database'", ")", ",", "{", "migrations", ":", "{", "directory", ":", "migrationPath", ",", "tableName", ":", "'migrations'", "}", ",", "seeds", ":", "{", "directory", ":", "seedPath", "}", ",", "useNullAsDefault", ":", "false", "}", ")", ";", "this", ".", "config", "=", "config", ";", "this", ".", "log", "=", "log", ";", "this", ".", "knex", "=", "Knex", "(", "databaseConfig", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, 735, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
66
[ "/**\n * houston/src/cli/commands/migrate.ts\n * Runs database migration scripts\n */", "import", "{", "Database", "}", "from", "'../../lib/database'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'migrate'", ";", "export", "const", "describe", "=", "'Changes database tables based on houston schemas'", ";", "export", "const", "builder", "=", "(", "yargs", ")", "=>", "{", "return", "yargs", ".", "option", "(", "'direction'", ",", "{", "describe", ":", "'The direction to migrate'", ",", "type", ":", "'string'", ",", "default", ":", "'up'", "}", ")", ";", "}", ";", "export", "async", "function", "handler", "(", "argv", ")", "{", "const", "{", "app", ",", "config", "}", "=", "setup", "(", "argv", ")", ";", "const", "database", "=", "app", ".", "get", "<", "Database", ">", "(", "Database", ")", ";", "if", "(", "argv", ".", "direction", "===", "'up'", ")", "{", "const", "version", "=", "config", ".", "get", "(", "'houston.version'", ",", "'latest'", ")", ";", "console", ".", "log", "(", "`Updating database tables to ${", "version", "} version`", ")", ";", "}", "else", "if", "(", "argv", ".", "direction", "===", "'down'", ")", "{", "console", ".", "log", "(", "`Downgrading database tables 1 version`", ")", ";", "}", "else", "{", "console", ".", "error", "(", "`Incorrect non-option arguments: got ${", "argv", ".", "direction", "}, need at be up or down`", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", "try", "{", "if", "(", "argv", ".", "direction", "===", "'up'", ")", "{", "await", "database", ".", "knex", ".", "migrate", ".", "latest", "(", ")", ";", "}", "else", "if", "(", "argv", ".", "direction", "===", "'down'", ")", "{", "await", "database", ".", "knex", ".", "migrate", ".", "rollback", "(", ")", ";", "}", "}", "catch", "(", "e", ")", "{", "console", ".", "error", "(", "'Error updating database tables'", ")", ";", "console", ".", "error", "(", "e", ".", "message", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", "console", ".", "log", "(", "'Updated database tables'", ")", ";", "process", ".", "exit", "(", "0", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 551, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
67
[ "exports", "import", "*", "as", "dgram", "from", "'dgram'", ";", "import", "{", "inject", ",", "injectable", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'../lib/config'", ";", "import", "{", "Database", "}", "from", "'../lib/database/database'", ";", "import", "{", "Logger", "}", "from", "'../lib/log'", ";", "property", "property", "@", "injectable", "(", ")", "export", "class", "Repo", "{", "public", "server", ":", "dgram", ".", "Socket", ";", "public", "port", ":", "number", ";", "protected", "config", ":", "Config", ";", "protected", "database", ":", "Database", ";", "protected", "logger", ":", "Logger", ";", "param", "{", "Config", "}", "config", "param", "{", "Database", "}", "database", "param", "{", "Logger", "}", "logger", "constructor", "(", "@", "inject", "(", "Config", ")", "config", ",", "@", "inject", "(", "Database", ")", "database", ",", "@", "inject", "(", "Logger", ")", "logger", ")", "{", "this", ".", "config", "=", "config", ";", "this", ".", "database", "=", "database", ";", "this", ".", "logger", "=", "logger", ";", "}", "param", "{", "Error", "}", "err", "return", "{", "void", "}", "public", "onError", "(", "err", ")", "{", "this", ".", "logger", ".", "error", "(", "'Internal server error'", ")", ".", "setError", "(", "err", ")", ".", "send", "(", ")", ";", "}", "async", "param", "{", "Buffer", "}", "buf", "return", "{", "void", "}", "public", "async", "onMessage", "(", "buf", ")", "{", "const", "message", "=", "buf", ".", "toString", "(", "'utf8'", ")", ".", "split", "(", "': '", ")", "[", "1", "]", ";", "if", "(", "message", "==", "null", "||", "message", "===", "''", ")", "{", "return", ";", "}", "const", "[", ",", "status", "]", "=", "message", ".", "split", "(", "'|'", ")", ";", "if", "(", "Number", "(", "status", ")", ">=", "400", ")", "{", "return", ";", "}", "}", "async", "param", "{", "number", "}", "port", "throws", "return", "{", "Server", "}", "public", "async", "listen", "(", "port", "=", "0", ")", "{", "const", "env", "=", "this", ".", "config", ".", "get", "(", "'environment'", ")", ";", "this", ".", "server", "=", "dgram", ".", "createSocket", "(", "'udp4'", ")", ";", "this", ".", "server", ".", "on", "(", "'error'", ",", "(", "err", ")", "=>", "this", ".", "onError", "(", "err", ")", ")", ";", "this", ".", "server", ".", "on", "(", "'message'", ",", "(", "msg", ")", "=>", "this", ".", "onMessage", "(", "msg", ")", ")", ";", "try", "{", "await", "new", "Promise", "(", "(", "resolve", ",", "reject", ")", "=>", "{", "this", ".", "server", ".", "bind", "(", "{", "port", "}", ",", "(", "err", ")", "=>", "{", "if", "(", "err", ")", "{", "return", "reject", "(", "err", ")", ";", "}", "return", "resolve", "(", ")", ";", "}", ")", ";", "}", ")", ";", "}", "catch", "(", "err", ")", "{", "this", ".", "logger", ".", "error", "(", "`Server unable to listen on port ${", "port", "} with ${", "env", "} configuration`", ")", ".", "setError", "(", "err", ")", ".", "send", "(", ")", ";", "throw", "err", ";", "}", "const", "address", "=", "this", ".", "server", ".", "address", "(", ")", ";", "if", "(", "typeof", "address", "!==", "'string'", ")", "{", "this", ".", "port", "=", "address", ".", "port", ";", "}", "this", ".", "logger", ".", "info", "(", "`Server listening on port ${", "this", ".", "port", "} with ${", "env", "} configuration`", ")", ".", "send", "(", ")", ";", "return", "this", ";", "}", "async", "throws", "return", "{", "Server", "}", "public", "async", "close", "(", ")", "{", "if", "(", "this", ".", "server", "!=", "null", ")", "{", "await", "new", "Promise", "(", "(", "resolve", ")", "=>", "{", "this", ".", "server", ".", "close", "(", "(", ")", "=>", "resolve", "(", ")", ")", ";", "}", ")", ";", "this", ".", "port", "=", "0", ";", "}", "return", "this", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, null, null, null, null, null, 551, null, null, null, null, null, null, 70, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 12, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 3, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 12, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 25, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
68
[ "/**\n * houston/src/cli/commands/repo.ts\n * Runs the repository syslogd server\n */", "import", "{", "Repo", "as", "Server", "}", "from", "'../../repo/repo'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'repo'", ";", "export", "const", "describe", "=", "'Starts the repository syslogd server'", ";", "export", "const", "builder", "=", "(", "yargs", ")", "=>", "{", "return", "yargs", ".", "option", "(", "'port'", ",", "{", "alias", ":", "'p'", ",", "describe", ":", "'The port to run the server on'", ",", "type", ":", "'number'", ",", "default", ":", "0", "}", ")", ";", "}", ";", "export", "async", "function", "handler", "(", "argv", ")", "{", "const", "{", "app", "}", "=", "setup", "(", "argv", ")", ";", "const", "server", "=", "app", ".", "get", "<", "Server", ">", "(", "Server", ")", ";", "await", "server", ".", "listen", "(", "argv", ".", "port", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2692, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
69
[ "/**\n * houston/src/cli/commands/seed.ts\n * Runs database seed scripts\n */", "import", "{", "Database", "}", "from", "'../../lib/database/database'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'seed'", ";", "export", "const", "describe", "=", "'Seeds the database tables with fake data'", ";", "export", "async", "function", "handler", "(", "argv", ")", "{", "const", "{", "app", "}", "=", "setup", "(", "argv", ")", ";", "const", "database", "=", "app", ".", "get", "<", "Database", ">", "(", "Database", ")", ";", "console", ".", "log", "(", "`Seeding database tables`", ")", ";", "try", "{", "await", "database", ".", "knex", ".", "seed", ".", "run", "(", ")", ";", "}", "catch", "(", "e", ")", "{", "console", ".", "error", "(", "'Error seeding database tables'", ")", ";", "console", ".", "error", "(", "e", ".", "message", ")", ";", "process", ".", "exit", "(", "1", ")", ";", "}", "console", ".", "log", "(", "'Seeded database tables'", ")", ";", "process", ".", "exit", "(", "0", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 551, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
70
[ "/**\n * houston/src/cli/commands/seed.ts\n * Runs database seed scripts\n */", "import", "{", "Database", "}", "from", "'../../lib/database/database'", ";", "import", "{", "setup", "}", "from", "'../utilities'", ";", "export", "const", "command", "=", "'version'", ";", "export", "const", "describe", "=", "'Displays Houston version information'", ";", "export", "async", "function", "handler", "(", "argv", ")", "{", "const", "{", "config", "}", "=", "setup", "(", "argv", ")", ";", "console", ".", "log", "(", "`Release: ${", "config", ".", "get", "(", "'houston.version'", ")", "}`", ")", ";", "if", "(", "config", ".", "has", "(", "'houston.commit'", ")", ")", "{", "console", ".", "log", "(", "`Commit: ${", "config", ".", "get", "(", "'houston.commit'", ")", "}`", ")", ";", "}", "else", "{", "console", ".", "log", "(", "'Commit: Unknown'", ")", ";", "}", "process", ".", "exit", "(", "0", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
71
[ "/**\n * houston/src/lib/cache/provider.ts\n * Registers a basic cache factory.\n * TODO: Build this out a bit more with redis support\n */", "import", "{", "ContainerModule", ",", "interfaces", "}", "from", "'inversify'", ";", "import", "*", "as", "Cache", "from", "'lru-cache'", ";", "import", "*", "as", "type", "from", "'./type'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "const", "instances", "=", "{", "}", ";", "bind", "<", "interfaces", ".", "Factory", "<", "type", ".", "ICacheFactory", ">", ">", "(", "type", ".", "Cache", ")", ".", "toFactory", "(", "(", "context", ")", "=>", "(", "namespace", ",", "options", "=", "{", "}", ")", "=>", "{", "if", "(", "instances", "[", "namespace", "]", ")", "{", "return", "instances", "[", "namespace", "]", ";", "}", "else", "{", "instances", "[", "namespace", "]", "=", "new", "Cache", "(", "{", "maxAge", ":", "(", "options", ".", "maxAge", "||", "3600", ")", "}", ")", ";", "return", "instances", "[", "namespace", "]", ";", "}", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, 6, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
72
[ "/**\n * houston/src/lib/database/provider.ts\n * Provides the app with the needed Log classes\n */", "import", "{", "ContainerModule", "}", "from", "'inversify'", ";", "import", "{", "Database", "}", "from", "'./database'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "Database", ">", "(", "Database", ")", ".", "toSelf", "(", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
73
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'github_releases'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "integer", "(", "'key'", ")", ".", "notNullable", "(", ")", ".", "unique", "(", ")", ";", "table", ".", "string", "(", "'tag'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "uuid", "(", "'github_repository'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "foreign", "(", "'github_repository'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'github_repositories'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'github_releases'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
74
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'github_users'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "integer", "(", "'key'", ")", ".", "notNullable", "(", ")", ".", "unique", "(", ")", ";", "table", ".", "string", "(", "'login'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'name'", ")", ".", "nullable", "(", ")", ";", "table", ".", "string", "(", "'email'", ")", ".", "nullable", "(", ")", ";", "table", ".", "string", "(", "'company'", ")", ".", "nullable", "(", ")", ";", "table", ".", "string", "(", "'avatar'", ")", ".", "nullable", "(", ")", ";", "table", ".", "string", "(", "'access_key'", ")", ".", "nullable", "(", ")", ";", "table", ".", "string", "(", "'scopes'", ")", ".", "nullable", "(", ")", ";", "table", ".", "uuid", "(", "'user_id'", ")", ".", "nullable", "(", ")", ";", "table", ".", "foreign", "(", "'user_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'users'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'github_users'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
75
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'github_repositories_github_users'", ",", "(", "table", ")", "=>", "{", "table", ".", "increments", "(", ")", ";", "table", ".", "uuid", "(", "'github_repository_id'", ")", ".", "nullable", "(", ")", ";", "table", ".", "foreign", "(", "'github_repository_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'github_repositories'", ")", ";", "table", ".", "uuid", "(", "'github_user_id'", ")", ".", "nullable", "(", ")", ";", "table", ".", "foreign", "(", "'github_user_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'github_users'", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'github_repositories_github_users'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
76
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'projects'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "string", "(", "'name_domain'", ")", ".", "unique", "(", ")", ".", "index", "(", ")", ";", "table", ".", "string", "(", "'name_human'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'name_developer'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "enu", "(", "'type'", ",", "[", "'application'", "]", ")", ".", "defaultTo", "(", "'application'", ")", ";", "table", ".", "uuid", "(", "'projectable_id'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'projectable_type'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "uuid", "(", "'stripe_id'", ")", ".", "nullable", "(", ")", ";", "table", ".", "foreign", "(", "'stripe_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'stripe_accounts'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'projects'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
77
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'releases'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "string", "(", "'version'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "integer", "(", "'version_major'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "integer", "(", "'version_minor'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "integer", "(", "'version_patch'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "integer", "(", "'version_build'", ")", ".", "nullable", "(", ")", ";", "table", ".", "boolean", "(", "'is_prerelease'", ")", ".", "defaultTo", "(", "false", ")", ";", "table", ".", "uuid", "(", "'releaseable_id'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'releaseable_type'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "uuid", "(", "'project_id'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "foreign", "(", "'project_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'projects'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'releases'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
78
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'builds'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "enum", "(", "'status'", ",", "[", "'queue'", ",", "'build'", ",", "'test'", ",", "'review'", ",", "'publish'", ",", "'fail'", ",", "'error'", "]", ")", ".", "nullable", "(", ")", ";", "table", ".", "json", "(", "'appcenter'", ")", ".", "nullable", "(", ")", ";", "table", ".", "json", "(", "'appstream'", ")", ".", "nullable", "(", ")", ";", "table", ".", "uuid", "(", "'release_id'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "foreign", "(", "'release_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'releases'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'builds'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
79
[ "exports", "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "up", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "createTable", "(", "'build_logs'", ",", "(", "table", ")", "=>", "{", "table", ".", "uuid", "(", "'id'", ")", ".", "primary", "(", ")", ";", "table", ".", "string", "(", "'title'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'body'", ")", ".", "notNullable", "(", ")", ";", "table", ".", "string", "(", "'test'", ")", ".", "nullable", "(", ")", ";", "table", ".", "json", "(", "'metadata'", ")", ".", "nullable", "(", ")", ";", "table", ".", "uuid", "(", "'build_id'", ")", ".", "nullable", "(", ")", ";", "table", ".", "foreign", "(", "'build_id'", ")", ".", "references", "(", "'id'", ")", ".", "inTable", "(", "'builds'", ")", ";", "table", ".", "timestamp", "(", "'created_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'updated_at'", ")", ".", "notNullable", "(", ")", ".", "defaultTo", "(", "knex", ".", "fn", ".", "now", "(", ")", ")", ";", "table", ".", "timestamp", "(", "'deleted_at'", ")", ".", "nullable", "(", ")", ";", "}", ")", ";", "}", "param", "{", "Object", "}", "knex", "return", "{", "Promise", "}", "export", "function", "down", "(", "knex", ")", "{", "return", "knex", ".", "schema", ".", "dropTable", "(", "'build_logs'", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, 1351, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2659, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null ]
80
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'github_repositories'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'github_repositories'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "is_private", ":", "false", ",", "key", ":", "891357", ",", "name", ":", "'keymaker'", ",", "owner", ":", "'btkostner'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_repositories'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "is_private", ":", "false", ",", "key", ":", "8234623", ",", "name", ":", "'appcenter'", ",", "owner", ":", "'elementary'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_repositories'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'b353ee74-596a-4ec8-8b1c-11589bb8eb36'", ",", "is_private", ":", "false", ",", "key", ":", "48913751", ",", "name", ":", "'code'", ",", "owner", ":", "'elementary'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_repositories'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'274b1d3e-85bd-4ee4-88d9-5ec18f4e87c4'", ",", "is_private", ":", "false", ",", "key", ":", "49876157", ",", "name", ":", "'terminal'", ",", "owner", ":", "'elementary'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
81
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'github_releases'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "id", ":", "'fed7651d-be81-4035-98bd-efa08e95a948'", ",", "key", ":", "946542", ",", "tag", ":", "'0.0.1'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "id", ":", "'b1a4e61c-d10b-4bcd-b18a-f7469bfd4df1'", ",", "key", ":", "102154", ",", "tag", ":", "'0.0.2'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "id", ":", "'01645e34-1f00-4416-9734-030ea5dd9b48'", ",", "key", ":", "121548", ",", "tag", ":", "'0.0.3'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'2f9b8637-de48-4c84-a2dc-2149f4bc8c89'", ",", "key", ":", "324815", ",", "tag", ":", "'0.0.1'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'65294735-5f37-414f-ba38-8e91fa3bfb3d'", ",", "key", ":", "354861", ",", "tag", ":", "'0.0.2'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'b8a76b76-a559-4d48-893c-8781a4f9d043'", ",", "key", ":", "356124", ",", "tag", ":", "'0.3'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'9c521021-ff54-4b5b-a51c-ddc86906afe8'", ",", "key", ":", "384576", ",", "tag", ":", "'0.4.0'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'97f6303e-ea3b-4bf9-b3cc-025ed3476be2'", ",", "key", ":", "458942", ",", "tag", ":", "'0.4.5'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'f21db1fe-938a-47c9-81dd-3049d671f80a'", ",", "key", ":", "481245", ",", "tag", ":", "'0.5'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'34683670-b589-49d2-923d-857e753bc76e'", ",", "key", ":", "532486", ",", "tag", ":", "'0.55'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "id", ":", "'e364398a-8604-4601-8ab8-079816624653'", ",", "key", ":", "541867", ",", "tag", ":", "'1.0.0'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'b353ee74-596a-4ec8-8b1c-11589bb8eb36'", ",", "id", ":", "'ad09512f-91a3-451e-8b9c-462f4a42df88'", ",", "key", ":", "451874", ",", "tag", ":", "'0.1'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'274b1d3e-85bd-4ee4-88d9-5ec18f4e87c4'", ",", "id", ":", "'0876e8a5-6f23-4c3e-a061-5eb3c8da5d33'", ",", "key", ":", "381275", ",", "tag", ":", "'1.0.0'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'github_releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "github_repository", ":", "'274b1d3e-85bd-4ee4-88d9-5ec18f4e87c4'", ",", "id", ":", "'99b0b6ac-bdce-4ad6-aea0-7e471719d616'", ",", "key", ":", "687512", ",", "tag", ":", "'2.0.0'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
82
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'users'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'users'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", ")", ",", "deleted_at", ":", "null", ",", "email", ":", "'blake@elementary.io'", ",", "id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", ",", "name", ":", "'Blake Kostner'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
83
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'github_users'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'github_users'", ")", ".", "insert", "(", "{", "access_key", ":", "'u9r0nuq083ru880589rnyq29nyvaw4etbaw34vtr'", ",", "company", ":", "'elementary'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "email", ":", "'blake@elementary.io'", ",", "id", ":", "'da527f7e-b865-46e1-a47e-99542d838298'", ",", "key", ":", "6423154", ",", "login", ":", "'btkostner'", ",", "name", ":", "'Blake Kostner'", ",", "scopes", ":", "'public_repo,repo'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "user_id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
84
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'github_repositories_github_users'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'github_repositories_github_users'", ")", ".", "insert", "(", "{", "github_repository_id", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "github_user_id", ":", "'da527f7e-b865-46e1-a47e-99542d838298'", "}", ")", ";", "await", "knex", "(", "'github_repositories_github_users'", ")", ".", "insert", "(", "{", "github_repository_id", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "github_user_id", ":", "'da527f7e-b865-46e1-a47e-99542d838298'", "}", ")", ";", "await", "knex", "(", "'github_repositories_github_users'", ")", ".", "insert", "(", "{", "github_repository_id", ":", "'b353ee74-596a-4ec8-8b1c-11589bb8eb36'", ",", "github_user_id", ":", "'da527f7e-b865-46e1-a47e-99542d838298'", "}", ")", ";", "await", "knex", "(", "'github_repositories_github_users'", ")", ".", "insert", "(", "{", "github_repository_id", ":", "'274b1d3e-85bd-4ee4-88d9-5ec18f4e87c4'", ",", "github_user_id", ":", "'da527f7e-b865-46e1-a47e-99542d838298'", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
85
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'stripe_accounts'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'stripe_accounts'", ")", ".", "insert", "(", "{", "color", ":", "'FFA500'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'326599e7-97ed-455a-9c38-122651a12be6'", ",", "key", ":", "4235823", ",", "name", ":", "'btkostner'", ",", "public_key", ":", "'pk_test_uj0fjv0a9u9302fawfa2rasd'", ",", "secret_key", ":", "'sk_test_j89j2098vah803cnb83v298r'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "url", ":", "'https://btkostner.io'", ",", "user_id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
86
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'projects'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'projects'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "1", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", ",", "name_developer", ":", "'Blake Kostner'", ",", "name_domain", ":", "'com.github.btkostner.keymaker'", ",", "name_human", ":", "'Keymaker'", ",", "projectable_id", ":", "'b272a75e-5263-4133-b2e1-c8894b29493c'", ",", "projectable_type", ":", "'github'", ",", "stripe_id", ":", "'326599e7-97ed-455a-9c38-122651a12be6'", ",", "type", ":", "'application'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'projects'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "2", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "name_developer", ":", "'elementary LLC'", ",", "name_domain", ":", "'com.github.elementary.appcenter'", ",", "name_human", ":", "'AppCenter'", ",", "projectable_id", ":", "'14f2dc0d-9648-498e-b06e-a8479e0a7b26'", ",", "projectable_type", ":", "'github'", ",", "stripe_id", ":", "null", ",", "type", ":", "'application'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'projects'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "3", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'0086b0d2-be43-45fc-8619-989104705c8a'", ",", "name_developer", ":", "'elementary LLC'", ",", "name_domain", ":", "'com.github.elementary.code'", ",", "name_human", ":", "'Code'", ",", "projectable_id", ":", "'b353ee74-596a-4ec8-8b1c-11589bb8eb36'", ",", "projectable_type", ":", "'github'", ",", "stripe_id", ":", "null", ",", "type", ":", "'application'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'projects'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "4", ")", ",", "deleted_at", ":", "null", ",", "id", ":", "'4a9e027d-c27e-483a-a0fc-b2724a19491b'", ",", "name_developer", ":", "'elementary LLC'", ",", "name_domain", ":", "'com.github.elementary.terminal'", ",", "name_human", ":", "'Terminal'", ",", "projectable_id", ":", "'274b1d3e-85bd-4ee4-88d9-5ec18f4e87c4'", ",", "projectable_type", ":", "'github'", ",", "stripe_id", ":", "null", ",", "type", ":", "'application'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
87
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'releases'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "1", ")", ",", "id", ":", "'6fea3714-60cb-45f8-b56e-760745cfd95c'", ",", "project_id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", ",", "releaseable_id", ":", "'fed7651d-be81-4035-98bd-efa08e95a948'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.0.1'", ",", "version_major", ":", "0", ",", "version_minor", ":", "0", ",", "version_patch", ":", "1", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "4", ")", ",", "id", ":", "'acc81084-5759-493a-b9d7-969edc69d913'", ",", "project_id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", ",", "releaseable_id", ":", "'b1a4e61c-d10b-4bcd-b18a-f7469bfd4df1'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.0.2'", ",", "version_major", ":", "0", ",", "version_minor", ":", "0", ",", "version_patch", ":", "2", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "8", ")", ",", "id", ":", "'6f3b3345-1b6d-457a-b6ca-5b5a067c4d6c'", ",", "project_id", ":", "'24ef2115-67e7-4ea9-8e18-ae6c44b63a71'", ",", "releaseable_id", ":", "'01645e34-1f00-4416-9734-030ea5dd9b48'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.0.3'", ",", "version_major", ":", "0", ",", "version_minor", ":", "0", ",", "version_patch", ":", "3", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "2", ")", ",", "id", ":", "'3d49def5-779a-4e2b-9e8e-2ededdbd9bbe'", ",", "project_id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "releaseable_id", ":", "'2f9b8637-de48-4c84-a2dc-2149f4bc8c89'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.0.1'", ",", "version_major", ":", "0", ",", "version_minor", ":", "0", ",", "version_patch", ":", "1", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "3", ")", ",", "id", ":", "'762b072f-2c15-4413-9ab8-8e878a9e47ed'", ",", "project_id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "releaseable_id", ":", "'65294735-5f37-414f-ba38-8e91fa3bfb3d'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.0.2'", ",", "version_major", ":", "0", ",", "version_minor", ":", "0", ",", "version_patch", ":", "2", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "9", ")", ",", "id", ":", "'393c3985-f743-4daf-b868-73ce6458f4e0'", ",", "project_id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "releaseable_id", ":", "'9c521021-ff54-4b5b-a51c-ddc86906afe8'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.4.0'", ",", "version_major", ":", "0", ",", "version_minor", ":", "4", ",", "version_patch", ":", "0", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "5", ")", ",", "id", ":", "'9e889f37-370f-4929-a12d-50faa53bb225'", ",", "project_id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "releaseable_id", ":", "'97f6303e-ea3b-4bf9-b3cc-025ed3476be2'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'0.4.5'", ",", "version_major", ":", "0", ",", "version_minor", ":", "4", ",", "version_patch", ":", "5", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "10", ")", ",", "id", ":", "'79988df7-60c8-4356-acef-745b8108dfa4'", ",", "project_id", ":", "'75fa37dc-888d-4905-97bd-73cc9e39be2a'", ",", "releaseable_id", ":", "'e364398a-8604-4601-8ab8-079816624653'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'1.0.0'", ",", "version_major", ":", "1", ",", "version_minor", ":", "0", ",", "version_patch", ":", "0", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "6", ")", ",", "id", ":", "'1dc97f10-9de5-4c99-808a-0364939d6a96'", ",", "project_id", ":", "'4a9e027d-c27e-483a-a0fc-b2724a19491b'", ",", "releaseable_id", ":", "'0876e8a5-6f23-4c3e-a061-5eb3c8da5d33'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'1.0.0'", ",", "version_major", ":", "1", ",", "version_minor", ":", "0", ",", "version_patch", ":", "0", "}", ")", ";", "await", "knex", "(", "'releases'", ")", ".", "insert", "(", "{", "created_at", ":", "new", "Date", "(", "7", ")", ",", "id", ":", "'877b86e8-9b96-4bf7-8243-fe1905cdd00f'", ",", "project_id", ":", "'4a9e027d-c27e-483a-a0fc-b2724a19491b'", ",", "releaseable_id", ":", "'99b0b6ac-bdce-4ad6-aea0-7e471719d616'", ",", "releaseable_type", ":", "'github'", ",", "updated_at", ":", "new", "Date", "(", ")", ",", "version", ":", "'2.0.0'", ",", "version_major", ":", "2", ",", "version_minor", ":", "0", ",", "version_patch", ":", "0", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
88
[ "exports", "import", "*", "as", "Knex", "from", "'knex'", ";", "param", "{", "Object", "}", "knex", "export", "async", "function", "seed", "(", "knex", ")", "{", "await", "knex", "(", "'builds'", ")", ".", "del", "(", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'dd792007-489f-4742-9f22-bf3eea9c1794'", ",", "release_id", ":", "'6f3b3345-1b6d-457a-b6ca-5b5a067c4d6c'", ",", "status", ":", "'publish'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'c575d74a-1402-41ed-85a3-de4ebc5f557c'", ",", "release_id", ":", "'3d49def5-779a-4e2b-9e8e-2ededdbd9bbe'", ",", "status", ":", "'fail'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'67dc9947-0519-4471-8951-a89426c63963'", ",", "release_id", ":", "'393c3985-f743-4daf-b868-73ce6458f4e0'", ",", "status", ":", "'error'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'d63120d9-405e-48e2-91d1-9986730c7ff0'", ",", "release_id", ":", "'79988df7-60c8-4356-acef-745b8108dfa4'", ",", "status", ":", "'publish'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'3dc34b70-521c-46fd-990f-3f4c9ad17e4b'", ",", "release_id", ":", "'1dc97f10-9de5-4c99-808a-0364939d6a96'", ",", "status", ":", "'publish'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "await", "knex", "(", "'builds'", ")", ".", "insert", "(", "{", "appcenter", ":", "'{}'", ",", "appstream", ":", "'{}'", ",", "created_at", ":", "new", "Date", "(", ")", ",", "id", ":", "'fb2ab4e9-1596-40fd-8453-92bd4cc7965c'", ",", "release_id", ":", "'877b86e8-9b96-4bf7-8243-fe1905cdd00f'", ",", "status", ":", "'review'", ",", "updated_at", ":", "new", "Date", "(", ")", "}", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 676, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
89
[ "/**\n * houston/src/lib/log/provider.ts\n * Provides the app with the needed Log classes\n */", "import", "{", "ContainerModule", "}", "from", "'inversify'", ";", "import", "{", "Log", "}", "from", "'./log'", ";", "import", "{", "Logger", "}", "from", "'./logger'", ";", "import", "{", "Output", "}", "from", "'./output'", ";", "import", "{", "Console", "}", "from", "'./outputs/console'", ";", "import", "{", "Sentry", "}", "from", "'./outputs/sentry'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "Output", ">", "(", "Output", ")", ".", "toConstructor", "(", "Console", ")", ";", "bind", "<", "Output", ">", "(", "Output", ")", ".", "toConstructor", "(", "Sentry", ")", ";", "bind", "<", "Log", ">", "(", "Log", ")", ".", "toConstructor", "(", "Log", ")", ";", "bind", "<", "Logger", ">", "(", "Logger", ")", ".", "toSelf", "(", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
90
[ "/**\n * houston/src/lib/queue/type.ts\n * Some typescript types for a queue system.\n */", "import", "{", "EventEmitter", "}", "from", "'events'", ";", "export", "type", "Status", "=", "'waiting'", "|", "'active'", "|", "'completed'", "|", "'failed'", "|", "'delayed'", ";", "export", "type", "HandleCallback", "=", "(", "job", ":", "IJob", ")", "=>", "Promise", "<", "object", ">", ";", "export", "type", "OnActiveCallback", "=", "(", "job", ":", "IJob", ")", "=>", "void", ";", "export", "type", "OnProgressCallback", "=", "(", "job", ":", "IJob", ",", "amount", ":", "number", ")", "=>", "void", ";", "export", "type", "OnFailedCallback", "=", "(", "job", ":", "IJob", ",", "error", ":", "Error", ")", "=>", "void", ";", "export", "type", "OnCompletedCallback", "=", "(", "job", ":", "IJob", ",", "result", ":", "object", ")", "=>", "void", ";", "export", "type", "IQueueConstructor", "=", "(", "name", ":", "string", ")", "=>", "IQueue", ";", "export", "interface", "IQueue", "{", "send", "(", "data", ",", "opts", "?", ")", ":", "Promise", "<", "IJob", ">", ";", "handle", "(", "fn", ")", ";", "pause", "(", "local", ")", ":", "Promise", "<", "void", ">", ";", "resume", "(", "local", ")", ":", "Promise", "<", "void", ">", ";", "empty", "(", ")", ":", "Promise", "<", "void", ">", ";", "close", "(", ")", ":", "Promise", "<", "void", ">", ";", "count", "(", "state", "?", ")", ":", "Promise", "<", "number", ">", ";", "jobs", "(", "state", ")", ":", "Promise", "<", "IJob", "[", "]", ">", ";", "onActive", "(", "fn", ")", ";", "onProgress", "(", "fn", ")", ";", "onFailed", "(", "fn", ")", ";", "onCompleted", "(", "fn", ")", ";", "}", "export", "interface", "IJobOptions", "{", "priority", "?", ":", "number", ";", "delay", "?", ":", "number", ";", "attempts", "?", ":", "number", ";", "timeout", "?", ":", "number", ";", "}", "export", "interface", "IJob", "{", "status", "(", ")", ":", "Promise", "<", "Status", ">", ";", "progress", "(", "amount", ")", ";", "remove", "(", ")", ":", "Promise", "<", "void", ">", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, 0, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, 8, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 756, null, null, null, null, null, null, null, null, null, null, 756, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 3, null, null, null, null, null, null, null, null, null, null, null, null ]
91
[ "/**\n * houston/src/lib/queue/index.ts\n * Exports all you need to get started with the queue system.\n */", "export", "{", "IQueue", ",", "IQueueConstructor", ",", "Status", "}", "from", "'./type'", ";", "export", "const", "Queue", "=", "Symbol", ".", "for", "(", "'Queue'", ")", ";", "export", "const", "workerQueue", "=", "Symbol", ".", "for", "(", "'workerQueue'", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
92
[ "/**\n * houston/src/lib/queue/providers/redis/job.ts\n * Wraps `bull` package in types for use in our queue system.\n */", "import", "*", "as", "BaseBull", "from", "'bull'", ";", "import", "{", "EventEmitter", "}", "from", "'events'", ";", "import", "*", "as", "type", "from", "'../../type'", ";", "export", "class", "Job", "extends", "EventEmitter", "implements", "type", ".", "IJob", "{", "var", "protected", "bull", ":", "BaseBull", ".", "Job", ";", "param", "{", "String", "}", "name", "constructor", "(", "job", ")", "{", "super", "(", ")", ";", "this", ".", "bull", "=", "job", ";", "}", "public", "async", "status", "(", ")", "{", "const", "state", "=", "await", "this", ".", "bull", ".", "getState", "(", ")", ";", "switch", "(", "state", ")", "{", "case", "(", "'waiting'", ")", ":", "return", "'waiting'", ";", "case", "(", "'active'", ")", ":", "return", "'active'", ";", "case", "(", "'completed'", ")", ":", "return", "'completed'", ";", "case", "(", "'failed'", ")", ":", "return", "'failed'", ";", "case", "(", "'delayed'", ")", ":", "return", "'delayed'", ";", "default", ":", "return", "'failed'", ";", "}", "}", "public", "async", "progress", "(", "amount", ")", "{", "return", "this", ".", "bull", ".", "progress", "(", "amount", ")", ";", "}", "public", "async", "remove", "(", ")", "{", "return", "this", ".", "bull", ".", "remove", "(", ")", ";", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
93
[ "/**\n * houston/src/lib/queue/providers/redis/queue.ts\n * Wraps `bull` package in types for use in our queue system.\n */", "import", "*", "as", "BaseBull", "from", "'bull'", ";", "import", "{", "inject", ",", "injectable", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'../../../config'", ";", "import", "*", "as", "type", "from", "'../../type'", ";", "import", "{", "Job", "}", "from", "'./job'", ";", "@", "injectable", "(", ")", "export", "class", "Queue", "implements", "type", ".", "IQueue", "{", "var", "protected", "bull", ":", "BaseBull", ".", "Queue", ";", "param", "{", "String", "}", "name", "constructor", "(", "@", "inject", "(", "Config", ")", "config", ",", "name", ")", "{", "const", "connection", "=", "config", ".", "get", "(", "'queue.connection'", ")", ";", "if", "(", "typeof", "config", "===", "'object'", ")", "{", "this", ".", "bull", "=", "new", "BaseBull", "(", "name", ",", "{", "redis", ":", "connection", "}", ")", ";", "}", "else", "{", "this", ".", "bull", "=", "new", "BaseBull", "(", "name", ",", "config", ")", ";", "}", "}", "public", "async", "send", "(", "data", ",", "opts", ")", "{", "const", "job", "=", "await", "this", ".", "bull", ".", "add", "(", "data", ",", "opts", ")", ";", "return", "new", "Job", "(", "job", ")", ";", "}", "public", "async", "handle", "(", "fn", ")", "{", "return", "this", ".", "bull", ".", "process", "(", "fn", ")", ";", "}", "public", "async", "pause", "(", "local", ")", "{", "return", "this", ".", "bull", ".", "pause", "(", "local", ")", ";", "}", "public", "async", "resume", "(", "local", ")", "{", "return", "this", ".", "bull", ".", "resume", "(", "local", ")", ";", "}", "public", "async", "empty", "(", ")", "{", "return", "this", ".", "bull", ".", "empty", "(", ")", ";", "}", "public", "async", "close", "(", ")", "{", "return", "this", ".", "bull", ".", "close", "(", ")", ";", "}", "public", "async", "count", "(", "state", "=", "null", ")", "{", "switch", "(", "state", ")", "{", "case", "(", "null", ")", ":", "return", "this", ".", "bull", ".", "count", "(", ")", ";", "case", "(", "'waiting'", ")", ":", "return", "this", ".", "bull", ".", "getWaitingCount", "(", ")", ";", "case", "(", "'active'", ")", ":", "return", "this", ".", "bull", ".", "getActiveCount", "(", ")", ";", "case", "(", "'completed'", ")", ":", "return", "this", ".", "bull", ".", "getCompletedCount", "(", ")", ";", "case", "(", "'failed'", ")", ":", "return", "this", ".", "bull", ".", "getFailedCount", "(", ")", ";", "case", "(", "'delayed'", ")", ":", "return", "this", ".", "bull", ".", "getDelayedCount", "(", ")", ";", "default", ":", "return", "0", ";", "}", "}", "public", "async", "jobs", "(", "state", ")", "{", "const", "bullJobs", "=", "await", "this", ".", "bullJobs", "(", "state", ")", ";", "return", "bullJobs", ".", "map", "(", "(", "j", ")", "=>", "new", "Job", "(", "j", ")", ")", ";", "}", "public", "onActive", "(", "fn", ")", "{", "this", ".", "bull", ".", "on", "(", "'active'", ",", "fn", ")", ";", "}", "public", "onProgress", "(", "fn", ")", "{", "this", ".", "bull", ".", "on", "(", "'progress'", ",", "fn", ")", ";", "}", "public", "onFailed", "(", "fn", ")", "{", "this", ".", "bull", ".", "on", "(", "'failed'", ",", "fn", ")", ";", "}", "public", "onCompleted", "(", "fn", ")", "{", "this", ".", "bull", ".", "on", "(", "'completed'", ",", "fn", ")", ";", "}", "protected", "async", "bullJobs", "(", "state", ")", "{", "switch", "(", "state", ")", "{", "case", "(", "'waiting'", ")", ":", "return", "this", ".", "bull", ".", "getWaiting", "(", ")", ";", "case", "(", "'active'", ")", ":", "return", "this", ".", "bull", ".", "getActive", "(", ")", ";", "case", "(", "'completed'", ")", ":", "return", "this", ".", "bull", ".", "getCompleted", "(", ")", ";", "case", "(", "'failed'", ")", ":", "return", "this", ".", "bull", ".", "getFailed", "(", ")", ";", "case", "(", "'delayed'", ")", ":", "return", "this", ".", "bull", ".", "getDelayed", "(", ")", ";", "default", ":", "return", "[", "]", ";", "}", "}", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 87, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, 705, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, 5, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 705, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
94
[ "/**\n * houston/src/lib/queue/provider.ts\n * Sets up the needed providers for the Queue system\n */", "import", "{", "ContainerModule", ",", "interfaces", "}", "from", "'inversify'", ";", "import", "{", "Config", "}", "from", "'../config'", ";", "import", "{", "Queue", ",", "workerQueue", "}", "from", "'./index'", ";", "import", "{", "Queue", "as", "RedisQueue", "}", "from", "'./providers/redis'", ";", "import", "{", "IQueue", ",", "IQueueConstructor", "}", "from", "'./type'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "IQueueConstructor", ">", "(", "Queue", ")", ".", "toFactory", "<", "IQueue", ">", "(", "(", "context", ")", "=>", "{", "return", "function", "QueueFactory", "(", "name", ")", "{", "const", "config", "=", "context", ".", "container", ".", "get", "<", "Config", ">", "(", "Config", ")", ";", "if", "(", "config", ".", "get", "(", "'queue.client'", ")", "===", "'redis'", ")", "{", "try", "{", "require", ".", "resolve", "(", "'bull'", ")", ";", "}", "catch", "(", "e", ")", "{", "throw", "new", "Error", "(", "'Package \"bull\" is not installed. Please install it.'", ")", ";", "}", "return", "new", "RedisQueue", "(", "config", ",", "name", ")", ";", "}", "if", "(", "config", ".", "has", "(", "'queue.client'", ")", "===", "false", ")", "{", "throw", "new", "Error", "(", "'No queue client configured'", ")", ";", "}", "else", "{", "throw", "new", "Error", "(", "`Unknown queue client of \"${", "config", ".", "get", "(", "'queue.client'", ")", "}\" configured`", ")", ";", "}", "}", ";", "}", ")", ";", "bind", "<", "IQueue", ">", "(", "workerQueue", ")", ".", "toDynamicValue", "(", "(", "context", ")", "=>", "{", "const", "queueConstructor", "=", "context", ".", "container", ".", "get", "<", "IQueueConstructor", ">", "(", "Queue", ")", ";", "return", "queueConstructor", "(", "'WorkerQueue'", ")", ";", "}", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10704, null, null, null, null, null, null, null, 2, null, null, null, 87, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 10704, null, null, null, null, 0, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
95
[ "/**\n * houston/src/lib/service/provider.ts\n * Registers all the fun third party services that require the IoC container\n */", "import", "{", "ContainerModule", ",", "interfaces", "}", "from", "'inversify'", ";", "import", "{", "codeRepository", ",", "codeRepositoryFactory", ",", "logRepository", ",", "packageRepository", "}", "from", "'./index'", ";", "import", "{", "Aptly", "}", "from", "'./aptly'", ";", "import", "{", "GitHub", ",", "github", ",", "IGitHubFactory", "}", "from", "'./github'", ";", "import", "*", "as", "type", "from", "'./type'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "interfaces", ".", "Factory", "<", "GitHub", ">", ">", "(", "github", ")", ".", "toFactory", "(", "(", "context", ")", "=>", "(", "url", ")", "=>", "{", "const", "instance", "=", "context", ".", "container", ".", "resolve", "(", "GitHub", ")", ";", "instance", ".", "url", "=", "url", ";", "return", "instance", ";", "}", ")", ";", "bind", "(", "codeRepositoryFactory", ")", ".", "toProvider", "(", "(", "context", ")", "=>", "(", "url", ")", "=>", "{", "return", "new", "Promise", "<", "type", ".", "ICodeRepository", ">", "(", "(", "resolve", ")", "=>", "{", "return", "resolve", "(", "context", ".", "container", ".", "get", "<", "IGitHubFactory", ">", "(", "github", ")", "(", "url", ")", ")", ";", "}", ")", ";", "}", ")", ";", "bind", "<", "Aptly", ">", "(", "Aptly", ")", ".", "toSelf", "(", ")", ";", "bind", "<", "Aptly", ">", "(", "packageRepository", ")", ".", "to", "(", "Aptly", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31, null, null, null, null, null, null, null, null, 4219, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 31, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 4, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
96
[ "/**\n * houston/src/repo/provider.ts\n * Provides the app with the needed Repo server classes\n */", "import", "{", "ContainerModule", "}", "from", "'inversify'", ";", "import", "{", "Repo", "}", "from", "'./repo'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "Repo", ">", "(", "Repo", ")", ".", "toSelf", "(", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
97
[ "/**\n * houston/src/worker/provider.ts\n * Provides the app with the main worker classes\n */", "import", "{", "ContainerModule", "}", "from", "'inversify'", ";", "import", "{", "Worker", "}", "from", "'./index'", ";", "export", "const", "provider", "=", "new", "ContainerModule", "(", "(", "bind", ")", "=>", "{", "bind", "<", "Worker", ">", "(", "Worker", ")", ".", "toConstructor", "(", "Worker", ")", ";", "}", ")", ";" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 8715, null, null, null, null, null, 7513, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
98
[ "exports", "import", "*", "as", "fs", "from", "'fs-extra'", ";", "import", "*", "as", "os", "from", "'os'", ";", "import", "*", "as", "path", "from", "'path'", ";", "import", "*", "as", "uuid", "from", "'uuid/v4'", ";", "param", "{", "string", "}", "file", "return", "{", "string", "}", "export", "function", "fixture", "(", "file", "=", "''", ")", "{", "return", "path", ".", "resolve", "(", "__dirname", ",", "'../fixture'", ",", "file", ")", ";", "}", "async", "param", "{", "string", "}", "dir", "return", "{", "string", "}", "export", "async", "function", "tmp", "(", "dir", "=", "''", ")", "{", "const", "directory", "=", "path", ".", "resolve", "(", "os", ".", "tmpdir", "(", ")", ",", "'houston-test'", ",", "dir", ",", "uuid", "(", ")", ")", ";", "await", "fs", ".", "ensureDir", "(", "directory", ")", ";", "return", "directory", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 2, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 7, null, 2, null, null, null, null, null, 2, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]
99
[ "/**\n * houston/test/utililty/worker/context.ts\n * Helpful functions to test the worker process context\n */", "import", "{", "defaultsDeep", "}", "from", "'lodash'", ";", "import", "{", "IContext", "}", "from", "'../../../src/worker/type'", ";", "param", "{", "Object", "}", "override", "return", "{", "IContext", "}", "export", "function", "context", "(", "override", "=", "{", "}", ")", "{", "const", "def", "=", "{", "appcenter", ":", "{", "}", ",", "appstream", ":", "''", ",", "architecture", ":", "'amd64'", ",", "changelog", ":", "[", "]", ",", "distribution", ":", "'loki'", ",", "logs", ":", "[", "]", ",", "nameDeveloper", ":", "'elementary'", ",", "nameDomain", ":", "'io.elementary.houston'", ",", "nameHuman", ":", "'Houston'", ",", "references", ":", "[", "'refs/heads/master'", "]", ",", "type", ":", "'app'", ",", "version", ":", "'0.0.1'", "}", ";", "return", "defaultsDeep", "(", "{", "}", ",", "override", ",", "def", ")", ";", "}" ]
[ null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, 6, null, null, null, null, null, null, 726, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null ]