diff --git a/server/gui/index.html b/server/gui/index.html index 4d657d0d..de600b34 100644 --- a/server/gui/index.html +++ b/server/gui/index.html @@ -1 +1 @@ -
\n// This implementation prints messages to {@link System//err} containing the\n// values of {@code line}, {@code charPositionInLine}, and {@code msg} using\n// the following format.
\n//\n//\n// line line:charPositionInLine msg\n//\n//\nConsoleErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {\n console.error(\"line \" + line + \":\" + column + \" \" + msg);\n};\n\nfunction ProxyErrorListener(delegates) {\n\tErrorListener.call(this);\n if (delegates===null) {\n throw \"delegates\";\n }\n this.delegates = delegates;\n\treturn this;\n}\n\nProxyErrorListener.prototype = Object.create(ErrorListener.prototype);\nProxyErrorListener.prototype.constructor = ProxyErrorListener;\n\nProxyErrorListener.prototype.syntaxError = function(recognizer, offendingSymbol, line, column, msg, e) {\n this.delegates.map(function(d) { d.syntaxError(recognizer, offendingSymbol, line, column, msg, e); });\n};\n\nProxyErrorListener.prototype.reportAmbiguity = function(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs) {\n this.delegates.map(function(d) { d.reportAmbiguity(recognizer, dfa, startIndex, stopIndex, exact, ambigAlts, configs); });\n};\n\nProxyErrorListener.prototype.reportAttemptingFullContext = function(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs) {\n\tthis.delegates.map(function(d) { d.reportAttemptingFullContext(recognizer, dfa, startIndex, stopIndex, conflictingAlts, configs); });\n};\n\nProxyErrorListener.prototype.reportContextSensitivity = function(recognizer, dfa, startIndex, stopIndex, prediction, configs) {\n\tthis.delegates.map(function(d) { d.reportContextSensitivity(recognizer, dfa, startIndex, stopIndex, prediction, configs); });\n};\n\nexports.ErrorListener = ErrorListener;\nexports.ConsoleErrorListener = ConsoleErrorListener;\nexports.ProxyErrorListener = ProxyErrorListener;\n\n","'use strict';\nvar $ = require('../internals/export');\nvar flattenIntoArray = require('../internals/flatten-into-array');\nvar toObject = require('../internals/to-object');\nvar lengthOfArrayLike = require('../internals/length-of-array-like');\nvar toIntegerOrInfinity = require('../internals/to-integer-or-infinity');\nvar arraySpeciesCreate = require('../internals/array-species-create');\n\n// `Array.prototype.flat` method\n// https://tc39.es/ecma262/#sec-array.prototype.flat\n$({ target: 'Array', proto: true }, {\n flat: function flat(/* depthArg = 1 */) {\n var depthArg = arguments.length ? arguments[0] : undefined;\n var O = toObject(this);\n var sourceLen = lengthOfArrayLike(O);\n var A = arraySpeciesCreate(O, 0);\n A.length = flattenIntoArray(A, O, O, sourceLen, 0, depthArg === undefined ? 1 : toIntegerOrInfinity(depthArg));\n return A;\n }\n});\n","var userAgent = require('../internals/engine-user-agent');\n\nvar firefox = userAgent.match(/firefox\\/(\\d+)/i);\n\nmodule.exports = !!firefox && +firefox[1];\n","'use strict';\nvar global = require('../internals/global');\nvar uncurryThis = require('../internals/function-uncurry-this');\nvar aCallable = require('../internals/a-callable');\nvar isObject = require('../internals/is-object');\nvar hasOwn = require('../internals/has-own-property');\nvar arraySlice = require('../internals/array-slice');\nvar NATIVE_BIND = require('../internals/function-bind-native');\n\nvar Function = global.Function;\nvar concat = uncurryThis([].concat);\nvar join = uncurryThis([].join);\nvar factories = {};\n\nvar construct = function (C, argsLength, args) {\n if (!hasOwn(factories, argsLength)) {\n for (var list = [], i = 0; i < argsLength; i++) list[i] = 'a[' + i + ']';\n factories[argsLength] = Function('C,a', 'return new C(' + join(list, ',') + ')');\n } return factories[argsLength](C, args);\n};\n\n// `Function.prototype.bind` method implementation\n// https://tc39.es/ecma262/#sec-function.prototype.bind\nmodule.exports = NATIVE_BIND ? Function.bind : function bind(that /* , ...args */) {\n var F = aCallable(this);\n var Prototype = F.prototype;\n var partArgs = arraySlice(arguments, 1);\n var boundFunction = function bound(/* args... */) {\n var args = concat(partArgs, arraySlice(arguments));\n return this instanceof boundFunction ? construct(F, args.length, args) : F.apply(that, args);\n };\n if (isObject(Prototype)) boundFunction.prototype = Prototype;\n return boundFunction;\n};\n","// This is fhirpath interpreter\n// everything starts at evaluate function,\n// which is passed fhirpath AST and resource.\n//\n// We reduce/eval recursively each node in AST\n// passing the context and current data\n//\n// each AST node has eval function, which should be registered in evalTable\n// and named after node type\n// if node needs to eval father it's children it has to call `doEval` function\n//\n// most of nodes do function or operator invocation at the end\n//\n// For invocation's and operator's there is one lookup table -\n// invocationTable and two helper functions doInvoke and infixInvoke for\n// operators\n// 1. operator or function is looked up in table\n// 2. using signature (in .arity property) unpack parameters\n// 3. check params types\n// 4. do call function\n// 5. wrap result by util.arraify\n//\n// if function is nullable\n// and one of parameters is empty/null - function will not be invoked and empty\n// result returned\n//\n// Not solved problem is overloading functions by types - for example + operator defined\n// for strings and numbers\n// we can make dispatching params type dependent - let see\n\nconst parser = require(\"./parser\");\nconst util = require(\"./utilities\");\nrequire(\"./polyfill\");\nconst constants = require('./constants');\n\nlet engine = {}; // the object with all FHIRPath functions and operations\nlet existence = require(\"./existence\");\nlet filtering = require(\"./filtering\");\nlet aggregate = require(\"./aggregate\");\nlet combining = require(\"./combining\");\nlet misc = require(\"./misc\");\nlet equality = require(\"./equality\");\nlet collections = require(\"./collections\");\nlet math = require(\"./math\");\nlet strings = require(\"./strings\");\nlet navigation= require(\"./navigation\");\nlet datetime = require(\"./datetime\");\nlet logic = require(\"./logic\");\nconst types = require(\"./types\");\nconst {\n FP_DateTime, FP_Time, FP_Quantity,\n FP_Type, ResourceNode, TypeInfo\n} = types;\nlet makeResNode = ResourceNode.makeResNode;\n\n// * fn: handler\n// * arity: is index map with type signature\n// if type is in array (like [Boolean]) - this means\n// function accepts value of this type or empty value {}\n// * nullable - means propagate empty result, i.e. instead\n// calling function if one of params is empty return empty\n\nengine.invocationTable = {\n empty: {fn: existence.emptyFn},\n not: {fn: existence.notFn},\n exists: {fn: existence.existsMacro, arity: {0: [], 1: [\"Expr\"]}},\n all: {fn: existence.allMacro, arity: {1: [\"Expr\"]}},\n allTrue: {fn: existence.allTrueFn},\n anyTrue: {fn: existence.anyTrueFn},\n allFalse: {fn: existence.allFalseFn},\n anyFalse: {fn: existence.anyFalseFn},\n subsetOf: {fn: existence.subsetOfFn, arity: {1: [\"AnyAtRoot\"]}},\n supersetOf: {fn: existence.supersetOfFn, arity: {1: [\"AnyAtRoot\"]}},\n isDistinct: {fn: existence.isDistinctFn},\n distinct: {fn: existence.distinctFn},\n count: {fn: existence.countFn},\n where: {fn: filtering.whereMacro, arity: {1: [\"Expr\"]}},\n extension: {fn: filtering.extension, arity: {1: [\"String\"]}},\n select: {fn: filtering.selectMacro, arity: {1: [\"Expr\"]}},\n aggregate: {fn: aggregate.aggregateMacro, arity: {1: [\"Expr\"], 2: [\"Expr\", \"Integer\"]}},\n single: {fn: filtering.singleFn},\n first: {fn: filtering.firstFn},\n last: {fn: filtering.lastFn},\n type: {fn: types.typeFn, arity: {0: []}},\n ofType: {fn: filtering.ofTypeFn, arity: {1: [\"TypeSpecifier\"]}},\n is: {fn: types.isFn, arity: {1: [\"TypeSpecifier\"]}},\n tail: {fn: filtering.tailFn},\n take: {fn: filtering.takeFn, arity: {1: [\"Integer\"]}},\n skip: {fn: filtering.skipFn, arity: {1: [\"Integer\"]}},\n combine: {fn: combining.combineFn, arity: {1: [\"AnyAtRoot\"]}},\n union: {fn: combining.union, arity: {1: [\"AnyAtRoot\"]}},\n iif: {fn: misc.iifMacro, arity: {2: [\"Expr\", \"Expr\"], 3: [\"Expr\", \"Expr\", \"Expr\"]}},\n trace: {fn: misc.traceFn, arity: {0: [], 1: [\"String\"]}},\n toInteger: {fn: misc.toInteger},\n toDecimal: {fn: misc.toDecimal},\n toString: {fn: misc.toString},\n toDateTime: {fn: misc.toDateTime},\n toTime: {fn: misc.toTime},\n toBoolean: {fn: misc.toBoolean},\n toQuantity: {fn: misc.toQuantity, arity: {0: [], 1: [\"String\"]}},\n convertsToBoolean: {fn: misc.createConvertsToFn(misc.toBoolean, 'boolean')},\n convertsToInteger: {fn: misc.createConvertsToFn(misc.toInteger, 'number')},\n convertsToDecimal: {fn: misc.createConvertsToFn(misc.toDecimal, 'number')},\n convertsToString: {fn: misc.createConvertsToFn(misc.toString, 'string')},\n convertsToDateTime: {fn: misc.createConvertsToFn(misc.toDateTime, FP_DateTime)},\n convertsToTime: {fn: misc.createConvertsToFn(misc.toTime, FP_Time)},\n convertsToQuantity: {fn: misc.createConvertsToFn(misc.toQuantity, FP_Quantity)},\n\n indexOf: {fn: strings.indexOf, arity: {1: [\"String\"]}},\n substring: {fn: strings.substring, arity: {1: [\"Integer\"], 2: [\"Integer\",\"Integer\"]}},\n startsWith: {fn: strings.startsWith, arity: {1: [\"String\"]}},\n endsWith: {fn: strings.endsWith, arity: {1: [\"String\"]}},\n contains: {fn: strings.containsFn, arity: {1: [\"String\"]}},\n upper: {fn: strings.upper},\n lower: {fn: strings.lower},\n replace: {fn: strings.replace, arity: {2: [\"String\", \"String\"]}},\n matches: {fn: strings.matches, arity: {1: [\"String\"]}},\n replaceMatches: {fn: strings.replaceMatches, arity: {2: [\"String\", \"String\"]}},\n length: {fn: strings.length },\n toChars: {fn: strings.toChars },\n\n abs: {fn: math.abs},\n ceiling: {fn: math.ceiling},\n exp: {fn: math.exp},\n floor: {fn: math.floor},\n ln: {fn: math.ln},\n log: {fn: math.log, arity: {1: [\"Number\"]}, nullable: true},\n power: {fn: math.power, arity: {1: [\"Number\"]}, nullable: true},\n round: {fn: math.round, arity: {1: [\"Number\"]}},\n sqrt: {fn: math.sqrt},\n truncate: {fn: math.truncate},\n\n now: {fn: datetime.now },\n today: {fn: datetime.today },\n\n repeat: {fn: filtering.repeatMacro, arity: {1: [\"Expr\"]}},\n children: {fn: navigation.children },\n descendants: {fn: navigation.descendants },\n\n \"|\": {fn: combining.union, arity: {2: [\"Any\", \"Any\"]}},\n \"=\": {fn: equality.equal, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"!=\": {fn: equality.unequal, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"~\": {fn: equality.equival, arity: {2: [\"Any\", \"Any\"]}},\n \"!~\": {fn: equality.unequival, arity: {2: [\"Any\", \"Any\"]}},\n \"<\": {fn: equality.lt, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \">\": {fn: equality.gt, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"<=\": {fn: equality.lte, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \">=\": {fn: equality.gte, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"containsOp\": {fn: collections.contains, arity: {2: [\"Any\", \"Any\"]}},\n \"inOp\": {fn: collections.in, arity: {2: [\"Any\", \"Any\"]}},\n \"isOp\": {fn: types.isFn, arity: {2: [\"Any\", \"TypeSpecifier\"]}},\n \"&\": {fn: math.amp, arity: {2: [\"String\", \"String\"]}},\n \"+\": {fn: math.plus, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"-\": {fn: math.minus, arity: {2: [\"Any\", \"Any\"]}, nullable: true},\n \"*\": {fn: math.mul, arity: {2: [\"Number\", \"Number\"]}, nullable: true},\n \"/\": {fn: math.div, arity: {2: [\"Number\", \"Number\"]}, nullable: true},\n \"mod\": {fn: math.mod, arity: {2: [\"Number\", \"Number\"]}, nullable: true},\n \"div\": {fn: math.intdiv, arity: {2: [\"Number\", \"Number\"]}, nullable: true},\n\n \"or\": {fn: logic.orOp, arity: {2: [[\"Boolean\"], [\"Boolean\"]]}},\n \"and\": {fn: logic.andOp, arity: {2: [[\"Boolean\"], [\"Boolean\"]]}},\n \"xor\": {fn: logic.xorOp, arity: {2: [[\"Boolean\"], [\"Boolean\"]]}},\n \"implies\": {fn: logic.impliesOp, arity: {2: [[\"Boolean\"], [\"Boolean\"]]}},\n};\n\nengine.InvocationExpression = function(ctx, parentData, node) {\n return node.children.reduce(function(acc, ch) {\n return engine.doEval(ctx, acc, ch);\n }, parentData);\n};\n\nengine.TermExpression = function(ctx, parentData, node) {\n if (parentData) {\n parentData = parentData.map((x) => {\n if (x instanceof Object && x.resourceType) {\n return makeResNode(x, x.resourceType);\n }\n return x;\n });\n }\n\n return engine.doEval(ctx,parentData, node.children[0]);\n};\n\nengine.PolarityExpression = function(ctx, parentData, node) {\n var sign = node.terminalNodeText[0]; // either - or + per grammar\n var rtn = engine.doEval(ctx,parentData, node.children[0]);\n if (rtn.length != 1) { // not yet in spec, but per Bryn Rhodes\n throw new Error('Unary ' + sign +\n ' can only be applied to an individual number.');\n }\n if (typeof rtn[0] != 'number' || isNaN(rtn[0]))\n throw new Error('Unary ' + sign + ' can only be applied to a number.');\n if (sign === '-')\n rtn[0] = -rtn[0];\n return rtn;\n};\n\nengine.TypeSpecifier = function(ctx, parentData, node) {\n let namespace, name;\n const identifiers = node.text.split('.').map(i => i.replace(/(^`|`$)/g, \"\"));\n switch (identifiers.length) {\n case 2:\n [namespace, name] = identifiers;\n break;\n case 1:\n [name] = identifiers;\n break;\n default:\n throw new Error(\"Expected TypeSpecifier node, got \" + JSON.stringify(node));\n }\n\n return new TypeInfo({ namespace, name });\n};\n\nengine.ExternalConstantTerm = function(ctx, parentData, node) {\n var extConstant = node.children[0];\n var identifier = extConstant.children[0];\n var varName = engine.Identifier(ctx, parentData, identifier)[0];\n var value = ctx.vars[varName];\n if (!(varName in ctx.vars)) {\n throw new Error(\n \"Attempting to access an undefined environment variable: \" + varName\n );\n }\n // For convenience, we all variable values to be passed in without their array\n // wrapper. However, when evaluating, we need to put the array back in.\n return value === undefined || value === null\n ? []\n : value instanceof Array ? value : [value];\n};\n\nengine.LiteralTerm = function(ctx, parentData, node) {\n var term = node.children[0];\n if(term){\n return engine.doEval(ctx, parentData, term);\n } else {\n return [node.text];\n }\n};\n\nengine.StringLiteral = function(ctx, parentData, node) {\n // Remove the beginning and ending quotes.\n var rtn = node.text.replace(/(^'|'$)/g, \"\");\n rtn = rtn.replace(/\\\\(u\\d{4}|.)/g, function(match, submatch) {\n switch(match) {\n case '\\\\r':\n return '\\r';\n case '\\\\n':\n return \"\\n\";\n case '\\\\t':\n return '\\t';\n case '\\\\f':\n return '\\f';\n default:\n if (submatch.length > 1)\n return String.fromCharCode('0x'+submatch.slice(1));\n else\n return submatch;\n }\n });\n return [rtn];\n};\n\nengine.BooleanLiteral = function(ctx, parentData, node) {\n if(node.text === \"true\") {\n return [true];\n } else {\n return [false];\n }\n};\n\nengine.QuantityLiteral = function(ctx, parentData, node) {\n var valueNode = node.children[0];\n var value = Number(valueNode.terminalNodeText[0]);\n var unitNode = valueNode.children[0];\n var unit = unitNode.terminalNodeText[0];\n // Sometimes the unit is in a child node of the child\n if (!unit && unitNode.children)\n unit = unitNode.children[0].terminalNodeText[0];\n\n return [new FP_Quantity(value, unit)];\n};\n\nengine.DateTimeLiteral = function(ctx, parentData, node) {\n var dateStr = node.text.slice(1); // Remove the @\n return [new FP_DateTime(dateStr)];\n};\n\nengine.TimeLiteral = function(ctx, parentData, node) {\n var timeStr = node.text.slice(1); // Remove the @\n return [new FP_Time(timeStr)];\n};\n\nengine.NumberLiteral = function(ctx, parentData, node) {\n return [Number(node.text)];\n};\n\nengine.Identifier = function(ctx, parentData, node) {\n return [node.text.replace(/(^`|`$)/g, \"\")];\n};\n\nengine.InvocationTerm = function(ctx, parentData, node) {\n return engine.doEval(ctx,parentData, node.children[0]);\n};\n\n\nengine.MemberInvocation = function(ctx, parentData, node ) {\n const key = engine.doEval(ctx, parentData, node.children[0])[0];\n const model = ctx.model;\n\n if (parentData) {\n if(util.isCapitalized(key)) {\n return parentData\n .filter((x) => x instanceof ResourceNode && x.path === key);\n } else {\n return parentData.reduce(function(acc, res) {\n res = makeResNode(res);\n var childPath = res.path + '.' + key;\n if (model) {\n let defPath = model.pathsDefinedElsewhere[childPath];\n if (defPath)\n childPath = defPath;\n }\n let toAdd, _toAdd;\n let actualTypes = model && model.choiceTypePaths[childPath];\n if (actualTypes) {\n // Use actualTypes to find the field's value\n for (let t of actualTypes) {\n let field = key + t;\n toAdd = res.data[field];\n if (toAdd !== undefined) {\n childPath = t;\n _toAdd = res.data['_' + key];\n break;\n } else {\n toAdd = res._data[key];\n }\n }\n }\n else {\n toAdd = res.data[key];\n if (toAdd !== undefined) {\n _toAdd = res.data['_' + key];\n } else {\n toAdd = res._data[key];\n }\n if (key === 'extension') {\n childPath = 'Extension';\n }\n }\n\n if (util.isSome(toAdd)) {\n if(Array.isArray(toAdd)) {\n acc = acc.concat(toAdd.map((x, i)=>\n makeResNode(x, childPath, _toAdd && _toAdd[i])));\n } else {\n acc.push(makeResNode(toAdd, childPath, _toAdd));\n }\n return acc;\n } else {\n return acc;\n }\n }, []);\n }\n } else {\n return [];\n }\n};\n\nengine.IndexerExpression = function(ctx, parentData, node) {\n const coll_node = node.children[0];\n const idx_node = node.children[1];\n var coll = engine.doEval(ctx, parentData, coll_node);\n var idx = engine.doEval(ctx, parentData, idx_node);\n\n if(util.isEmpty(idx)) {\n return [];\n }\n\n var idxNum = parseInt(idx[0]);\n if(coll && util.isSome(idxNum) && coll.length>idxNum && idxNum>=0) {\n return [coll[idxNum]];\n } else {\n return [];\n }\n};\n\nengine.Functn = function(ctx, parentData, node) {\n return node.children.map(function(x) {\n return engine.doEval(ctx, parentData, x);\n });\n};\n\nengine.realizeParams = function(ctx, parentData, args) {\n if(args && args[0] && args[0].children) {\n return args[0].children.map(function(x) {\n return engine.doEval(ctx, parentData, x);\n });\n } else {\n return [];\n }\n};\n\nfunction makeParam(ctx, parentData, type, param) {\n if(type === \"Expr\"){\n return function(data) {\n ctx.$this = data;\n return engine.doEval(ctx, util.arraify(data), param);\n };\n }\n if(type === \"AnyAtRoot\"){\n ctx.$this = ctx.dataRoot;\n return engine.doEval(ctx, ctx.dataRoot, param);\n }\n if(type === \"Identifier\"){\n if(param.type == \"TermExpression\"){\n return param.text;\n } else {\n throw new Error(\"Expected identifier node, got \" + JSON.stringify(param));\n }\n }\n\n if(type === \"TypeSpecifier\") {\n return engine.TypeSpecifier(ctx, parentData, param);\n }\n\n ctx.$this = parentData;\n var res = engine.doEval(ctx, parentData, param);\n if(type === \"Any\") {\n return res;\n }\n if(Array.isArray(type)){\n if(res.length == 0){\n return [];\n } else {\n type = type[0];\n }\n }\n return misc.singleton(res, type);\n}\n\nfunction doInvoke(ctx, fnName, data, rawParams){\n var invoc = engine.invocationTable[fnName];\n var res;\n if(invoc) {\n if(!invoc.arity){\n if(!rawParams){\n res = invoc.fn.call(ctx, util.arraify(data));\n return util.arraify(res);\n } else {\n throw new Error(fnName + \" expects no params\");\n }\n } else {\n var paramsNumber = rawParams ? rawParams.length : 0;\n var argTypes = invoc.arity[paramsNumber];\n if(argTypes){\n var params = [];\n for(var i = 0; i < paramsNumber; i++){\n var tp = argTypes[i];\n var pr = rawParams[i];\n params.push(makeParam(ctx, data, tp, pr));\n }\n params.unshift(data);\n if(invoc.nullable) {\n if(params.some(isNullable)){\n return [];\n }\n }\n res = invoc.fn.apply(ctx, params);\n return util.arraify(res);\n } else {\n console.log(fnName + \" wrong arity: got \" + paramsNumber );\n return [];\n }\n }\n } else {\n throw new Error(\"Not implemented: \" + fnName);\n }\n}\nfunction isNullable(x) {\n var res = x=== null || x=== undefined || util.isEmpty(x);\n return res;\n}\n\nfunction infixInvoke(ctx, fnName, data, rawParams){\n var invoc = engine.invocationTable[fnName];\n if(invoc && invoc.fn) {\n var paramsNumber = rawParams ? rawParams.length : 0;\n if(paramsNumber != 2) { throw new Error(\"Infix invoke should have arity 2\"); }\n var argTypes = invoc.arity[paramsNumber];\n if(argTypes){\n var params = [];\n for(var i = 0; i < paramsNumber; i++){\n var tp = argTypes[i];\n var pr = rawParams[i];\n params.push(makeParam(ctx, data, tp, pr));\n }\n if(invoc.nullable) {\n if(params.some(isNullable)){\n return [];\n }\n }\n var res = invoc.fn.apply(ctx, params);\n return util.arraify(res);\n } else {\n console.log(fnName + \" wrong arity: got \" + paramsNumber );\n return [];\n }\n } else {\n throw new Error(\"Not impl \" + fnName);\n }\n}\n\nengine.FunctionInvocation = function(ctx, parentData, node) {\n var args = engine.doEval(ctx, parentData, node.children[0]);\n const fnName = args[0];\n args.shift();\n var rawParams = args && args[0] && args[0].children;\n return doInvoke(ctx, fnName, parentData, rawParams);\n};\n\nengine.ParamList = function(ctx, parentData, node) {\n // we do not eval param list because sometimes it should be passed as\n // lambda/macro (for example in case of where(...)\n return node;\n};\n\n\nengine.UnionExpression = function(ctx, parentData, node) {\n return infixInvoke(ctx, '|', parentData, node.children);\n};\n\nengine.ThisInvocation = function(ctx) {\n return util.arraify(ctx.$this);\n};\n\nengine.TotalInvocation = function(ctx) {\n return util.arraify(ctx.$total);\n};\n\nengine.IndexInvocation = function(ctx) {\n return util.arraify(ctx.$index);\n};\n\nengine.OpExpression = function(ctx, parentData, node) {\n var op = node.terminalNodeText[0];\n return infixInvoke(ctx, op, parentData, node.children);\n};\n\nengine.AliasOpExpression = function(map){\n return function(ctx, parentData, node) {\n var op = node.terminalNodeText[0];\n var alias = map[op];\n if(!alias) { throw new Error(\"Do not know how to alias \" + op + \" by \" + JSON.stringify(map)); }\n return infixInvoke(ctx, alias, parentData, node.children);\n };\n};\n\nengine.NullLiteral = function() {\n return [];\n};\n\nengine.ParenthesizedTerm = function(ctx, parentData, node) {\n return engine.doEval(ctx, parentData, node.children[0]);\n};\n\n\nengine.evalTable = { // not every evaluator is listed if they are defined on engine\n BooleanLiteral: engine.BooleanLiteral,\n EqualityExpression: engine.OpExpression,\n FunctionInvocation: engine.FunctionInvocation,\n Functn: engine.Functn,\n Identifier: engine.Identifier,\n IndexerExpression: engine.IndexerExpression,\n InequalityExpression: engine.OpExpression,\n InvocationExpression: engine.InvocationExpression,\n AdditiveExpression: engine.OpExpression,\n MultiplicativeExpression: engine.OpExpression,\n TypeExpression: engine.AliasOpExpression({\"is\": \"isOp\"}),\n MembershipExpression: engine.AliasOpExpression({\"contains\": \"containsOp\", \"in\": \"inOp\"}),\n NullLiteral: engine.NullLiteral,\n EntireExpression: engine.InvocationTerm,\n InvocationTerm: engine.InvocationTerm,\n LiteralTerm: engine.LiteralTerm,\n MemberInvocation: engine.MemberInvocation,\n NumberLiteral: engine.NumberLiteral,\n ParamList: engine.ParamList,\n ParenthesizedTerm: engine.ParenthesizedTerm,\n StringLiteral: engine.StringLiteral,\n TermExpression: engine.TermExpression,\n ThisInvocation: engine.ThisInvocation,\n TotalInvocation: engine.TotalInvocation,\n IndexInvocation: engine.IndexInvocation,\n UnionExpression: engine.UnionExpression,\n OrExpression: engine.OpExpression,\n ImpliesExpression: engine.OpExpression,\n AndExpression: engine.OpExpression,\n XorExpression: engine.OpExpression\n};\n\n\nengine.doEval = function(ctx, parentData, node) {\n const evaluator = engine.evalTable[node.type] || engine[node.type];\n if(evaluator){\n return evaluator.call(engine, ctx, parentData, node);\n } else {\n throw new Error(\"No \" + node.type + \" evaluator \");\n }\n};\n\nvar parse = function(path) {\n return parser.parse(path);\n};\n\n\n/**\n * Applies the given parsed FHIRPath expression to the given resource,\n * returning the result of doEval.\n * @param {(object|object[])} resource - FHIR resource, bundle as js object or array of resources\n * This resource will be modified by this function to add type information.\n * @param {string} parsedPath - fhirpath expression, sample 'Patient.name.given'\n * @param {object} context - a hash of variable name/value pairs.\n * @param {object} model - The \"model\" data object specific to a domain, e.g. R4.\n * For example, you could pass in the result of require(\"fhirpath/fhir-context/r4\");\n */\nfunction applyParsedPath(resource, parsedPath, context, model) {\n constants.reset();\n let dataRoot = util.arraify(resource);\n // doEval takes a \"ctx\" object, and we store things in that as we parse, so we\n // need to put user-provided variable data in a sub-object, ctx.vars.\n // Set up default standard variables, and allow override from the variables.\n // However, we'll keep our own copy of dataRoot for internal processing.\n let vars = {context: resource, ucum: 'http://unitsofmeasure.org'};\n let ctx = {dataRoot, vars: Object.assign(vars, context), model};\n let rtn = engine.doEval(ctx, dataRoot, parsedPath.children[0]);\n // Resolve any internal \"ResourceNode\" instances. Continue to let FP_Type\n // subclasses through.\n rtn = (function visit(n) {\n n = util.valData(n);\n if (Array.isArray(n)) {\n for (let i=0, len=n.length; i
The executor tracks position information for position-dependent lexer actions\n// efficiently, ensuring that actions appearing only at the end of the rule do\n// not cause bloating of the {@link DFA} created for the lexer.
\n\nvar hashStuff = require(\"../Utils\").hashStuff;\nvar LexerIndexedCustomAction = require('./LexerAction').LexerIndexedCustomAction;\n\nfunction LexerActionExecutor(lexerActions) {\n\tthis.lexerActions = lexerActions === null ? [] : lexerActions;\n\t// Caches the result of {@link //hashCode} since the hash code is an element\n\t// of the performance-critical {@link LexerATNConfig//hashCode} operation.\n\tthis.cachedHashCode = hashStuff(lexerActions); // \"\".join([str(la) for la in\n\t// lexerActions]))\n\treturn this;\n}\n\n// Creates a {@link LexerActionExecutor} which executes the actions for\n// the input {@code lexerActionExecutor} followed by a specified\n// {@code lexerAction}.\n//\n// @param lexerActionExecutor The executor for actions already traversed by\n// the lexer while matching a token within a particular\n// {@link LexerATNConfig}. If this is {@code null}, the method behaves as\n// though it were an empty executor.\n// @param lexerAction The lexer action to execute after the actions\n// specified in {@code lexerActionExecutor}.\n//\n// @return A {@link LexerActionExecutor} for executing the combine actions\n// of {@code lexerActionExecutor} and {@code lexerAction}.\nLexerActionExecutor.append = function(lexerActionExecutor, lexerAction) {\n\tif (lexerActionExecutor === null) {\n\t\treturn new LexerActionExecutor([ lexerAction ]);\n\t}\n\tvar lexerActions = lexerActionExecutor.lexerActions.concat([ lexerAction ]);\n\treturn new LexerActionExecutor(lexerActions);\n};\n\n// Creates a {@link LexerActionExecutor} which encodes the current offset\n// for position-dependent lexer actions.\n//\n//Normally, when the executor encounters lexer actions where\n// {@link LexerAction//isPositionDependent} returns {@code true}, it calls\n// {@link IntStream//seek} on the input {@link CharStream} to set the input\n// position to the end of the current token. This behavior provides\n// for efficient DFA representation of lexer actions which appear at the end\n// of a lexer rule, even when the lexer rule matches a variable number of\n// characters.
\n//\n//Prior to traversing a match transition in the ATN, the current offset\n// from the token start index is assigned to all position-dependent lexer\n// actions which have not already been assigned a fixed offset. By storing\n// the offsets relative to the token start index, the DFA representation of\n// lexer actions which appear in the middle of tokens remains efficient due\n// to sharing among tokens of the same length, regardless of their absolute\n// position in the input stream.
\n//\n//If the current executor already has offsets assigned to all\n// position-dependent lexer actions, the method returns {@code this}.
\n//\n// @param offset The current offset to assign to all position-dependent\n// lexer actions which do not already have offsets assigned.\n//\n// @return A {@link LexerActionExecutor} which stores input stream offsets\n// for all position-dependent lexer actions.\n// /\nLexerActionExecutor.prototype.fixOffsetBeforeMatch = function(offset) {\n\tvar updatedLexerActions = null;\n\tfor (var i = 0; i < this.lexerActions.length; i++) {\n\t\tif (this.lexerActions[i].isPositionDependent &&\n\t\t\t\t!(this.lexerActions[i] instanceof LexerIndexedCustomAction)) {\n\t\t\tif (updatedLexerActions === null) {\n\t\t\t\tupdatedLexerActions = this.lexerActions.concat([]);\n\t\t\t}\n\t\t\tupdatedLexerActions[i] = new LexerIndexedCustomAction(offset,\n\t\t\t\t\tthis.lexerActions[i]);\n\t\t}\n\t}\n\tif (updatedLexerActions === null) {\n\t\treturn this;\n\t} else {\n\t\treturn new LexerActionExecutor(updatedLexerActions);\n\t}\n};\n\n// Execute the actions encapsulated by this executor within the context of a\n// particular {@link Lexer}.\n//\n//This method calls {@link IntStream//seek} to set the position of the\n// {@code input} {@link CharStream} prior to calling\n// {@link LexerAction//execute} on a position-dependent action. Before the\n// method returns, the input position will be restored to the same position\n// it was in when the method was invoked.
\n//\n// @param lexer The lexer instance.\n// @param input The input stream which is the source for the current token.\n// When this method is called, the current {@link IntStream//index} for\n// {@code input} should be the start of the following token, i.e. 1\n// character past the end of the current token.\n// @param startIndex The token start index. This value may be passed to\n// {@link IntStream//seek} to set the {@code input} position to the beginning\n// of the token.\n// /\nLexerActionExecutor.prototype.execute = function(lexer, input, startIndex) {\n\tvar requiresSeek = false;\n\tvar stopIndex = input.index;\n\ttry {\n\t\tfor (var i = 0; i < this.lexerActions.length; i++) {\n\t\t\tvar lexerAction = this.lexerActions[i];\n\t\t\tif (lexerAction instanceof LexerIndexedCustomAction) {\n\t\t\t\tvar offset = lexerAction.offset;\n\t\t\t\tinput.seek(startIndex + offset);\n\t\t\t\tlexerAction = lexerAction.action;\n\t\t\t\trequiresSeek = (startIndex + offset) !== stopIndex;\n\t\t\t} else if (lexerAction.isPositionDependent) {\n\t\t\t\tinput.seek(stopIndex);\n\t\t\t\trequiresSeek = false;\n\t\t\t}\n\t\t\tlexerAction.execute(lexer);\n\t\t}\n\t} finally {\n\t\tif (requiresSeek) {\n\t\t\tinput.seek(stopIndex);\n\t\t}\n\t}\n};\n\nLexerActionExecutor.prototype.hashCode = function() {\n\treturn this.cachedHashCode;\n};\n\nLexerActionExecutor.prototype.updateHashCode = function(hash) {\n hash.update(this.cachedHashCode);\n};\n\n\nLexerActionExecutor.prototype.equals = function(other) {\n\tif (this === other) {\n\t\treturn true;\n\t} else if (!(other instanceof LexerActionExecutor)) {\n\t\treturn false;\n\t} else if (this.cachedHashCode != other.cachedHashCode) {\n\t\treturn false;\n\t} else if (this.lexerActions.length != other.lexerActions.length) {\n\t\treturn false;\n\t} else {\n\t\tvar numActions = this.lexerActions.length\n\t\tfor (var idx = 0; idx < numActions; ++idx) {\n\t\t\tif (!this.lexerActions[idx].equals(other.lexerActions[idx])) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n};\n\nexports.LexerActionExecutor = LexerActionExecutor;\n","var global = require('../internals/global');\n\nvar String = global.String;\n\nmodule.exports = function (argument) {\n try {\n return String(argument);\n } catch (error) {\n return 'Object';\n }\n};\n","//\n/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.\n * Use of this file is governed by the BSD 3-clause license that\n * can be found in the LICENSE.txt file in the project root.\n */\n///\n\nvar RuleContext = require('./RuleContext').RuleContext;\nvar Hash = require('./Utils').Hash;\nvar Map = require('./Utils').Map;\n\nfunction PredictionContext(cachedHashCode) {\n\tthis.cachedHashCode = cachedHashCode;\n}\n\n// Represents {@code $} in local context prediction, which means wildcard.\n// {@code//+x =//}.\n// /\nPredictionContext.EMPTY = null;\n\n// Represents {@code $} in an array in full context mode, when {@code $}\n// doesn't mean wildcard: {@code $ + x = [$,x]}. Here,\n// {@code $} = {@link //EMPTY_RETURN_STATE}.\n// /\nPredictionContext.EMPTY_RETURN_STATE = 0x7FFFFFFF;\n\nPredictionContext.globalNodeCount = 1;\nPredictionContext.id = PredictionContext.globalNodeCount;\n\n// Stores the computed hash code of this {@link PredictionContext}. The hash\n// code is computed in parts to match the following reference algorithm.\n//\n//\n// private int referenceHashCode() {\n// int hash = {@link MurmurHash//initialize MurmurHash.initialize}({@link\n// //INITIAL_HASH});\n//\n// for (int i = 0; i < {@link //size()}; i++) {\n// hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link //getParent\n// getParent}(i));\n// }\n//\n// for (int i = 0; i < {@link //size()}; i++) {\n// hash = {@link MurmurHash//update MurmurHash.update}(hash, {@link\n// //getReturnState getReturnState}(i));\n// }\n//\n// hash = {@link MurmurHash//finish MurmurHash.finish}(hash, 2// {@link\n// //size()});\n// return hash;\n// }\n//\n// /\n\n// This means only the {@link //EMPTY} context is in set.\nPredictionContext.prototype.isEmpty = function() {\n\treturn this === PredictionContext.EMPTY;\n};\n\nPredictionContext.prototype.hasEmptyPath = function() {\n\treturn this.getReturnState(this.length - 1) === PredictionContext.EMPTY_RETURN_STATE;\n};\n\nPredictionContext.prototype.hashCode = function() {\n\treturn this.cachedHashCode;\n};\n\n\nPredictionContext.prototype.updateHashCode = function(hash) {\n hash.update(this.cachedHashCode);\n};\n/*\nfunction calculateHashString(parent, returnState) {\n\treturn \"\" + parent + returnState;\n}\n*/\n\n// Used to cache {@link PredictionContext} objects. Its used for the shared\n// context cash associated with contexts in DFA states. This cache\n// can be used for both lexers and parsers.\n\nfunction PredictionContextCache() {\n\tthis.cache = new Map();\n\treturn this;\n}\n\n// Add a context to the cache and return it. If the context already exists,\n// return that one instead and do not add a new context to the cache.\n// Protect shared cache from unsafe thread access.\n//\nPredictionContextCache.prototype.add = function(ctx) {\n\tif (ctx === PredictionContext.EMPTY) {\n\t\treturn PredictionContext.EMPTY;\n\t}\n\tvar existing = this.cache.get(ctx) || null;\n\tif (existing !== null) {\n\t\treturn existing;\n\t}\n\tthis.cache.put(ctx, ctx);\n\treturn ctx;\n};\n\nPredictionContextCache.prototype.get = function(ctx) {\n\treturn this.cache.get(ctx) || null;\n};\n\nObject.defineProperty(PredictionContextCache.prototype, \"length\", {\n\tget : function() {\n\t\treturn this.cache.length;\n\t}\n});\n\nfunction SingletonPredictionContext(parent, returnState) {\n\tvar hashCode = 0;\n\tvar hash = new Hash();\n\tif(parent !== null) {\n\t\thash.update(parent, returnState);\n\t} else {\n\t\thash.update(1);\n\t}\n\thashCode = hash.finish();\n\tPredictionContext.call(this, hashCode);\n\tthis.parentCtx = parent;\n\tthis.returnState = returnState;\n}\n\nSingletonPredictionContext.prototype = Object.create(PredictionContext.prototype);\nSingletonPredictionContext.prototype.contructor = SingletonPredictionContext;\n\nSingletonPredictionContext.create = function(parent, returnState) {\n\tif (returnState === PredictionContext.EMPTY_RETURN_STATE && parent === null) {\n\t\t// someone can pass in the bits of an array ctx that mean $\n\t\treturn PredictionContext.EMPTY;\n\t} else {\n\t\treturn new SingletonPredictionContext(parent, returnState);\n\t}\n};\n\nObject.defineProperty(SingletonPredictionContext.prototype, \"length\", {\n\tget : function() {\n\t\treturn 1;\n\t}\n});\n\nSingletonPredictionContext.prototype.getParent = function(index) {\n\treturn this.parentCtx;\n};\n\nSingletonPredictionContext.prototype.getReturnState = function(index) {\n\treturn this.returnState;\n};\n\nSingletonPredictionContext.prototype.equals = function(other) {\n\tif (this === other) {\n\t\treturn true;\n\t} else if (!(other instanceof SingletonPredictionContext)) {\n\t\treturn false;\n\t} else if (this.hashCode() !== other.hashCode()) {\n\t\treturn false; // can't be same if hash is different\n\t} else {\n\t\tif(this.returnState !== other.returnState)\n return false;\n else if(this.parentCtx==null)\n return other.parentCtx==null\n\t\telse\n return this.parentCtx.equals(other.parentCtx);\n\t}\n};\n\nSingletonPredictionContext.prototype.toString = function() {\n\tvar up = this.parentCtx === null ? \"\" : this.parentCtx.toString();\n\tif (up.length === 0) {\n\t\tif (this.returnState === PredictionContext.EMPTY_RETURN_STATE) {\n\t\t\treturn \"$\";\n\t\t} else {\n\t\t\treturn \"\" + this.returnState;\n\t\t}\n\t} else {\n\t\treturn \"\" + this.returnState + \" \" + up;\n\t}\n};\n\nfunction EmptyPredictionContext() {\n\tSingletonPredictionContext.call(this, null, PredictionContext.EMPTY_RETURN_STATE);\n\treturn this;\n}\n\nEmptyPredictionContext.prototype = Object.create(SingletonPredictionContext.prototype);\nEmptyPredictionContext.prototype.constructor = EmptyPredictionContext;\n\nEmptyPredictionContext.prototype.isEmpty = function() {\n\treturn true;\n};\n\nEmptyPredictionContext.prototype.getParent = function(index) {\n\treturn null;\n};\n\nEmptyPredictionContext.prototype.getReturnState = function(index) {\n\treturn this.returnState;\n};\n\nEmptyPredictionContext.prototype.equals = function(other) {\n\treturn this === other;\n};\n\nEmptyPredictionContext.prototype.toString = function() {\n\treturn \"$\";\n};\n\nPredictionContext.EMPTY = new EmptyPredictionContext();\n\nfunction ArrayPredictionContext(parents, returnStates) {\n\t// Parent can be null only if full ctx mode and we make an array\n\t// from {@link //EMPTY} and non-empty. We merge {@link //EMPTY} by using\n\t// null parent and\n\t// returnState == {@link //EMPTY_RETURN_STATE}.\n\tvar h = new Hash();\n\th.update(parents, returnStates);\n\tvar hashCode = h.finish();\n\tPredictionContext.call(this, hashCode);\n\tthis.parents = parents;\n\tthis.returnStates = returnStates;\n\treturn this;\n}\n\nArrayPredictionContext.prototype = Object.create(PredictionContext.prototype);\nArrayPredictionContext.prototype.constructor = ArrayPredictionContext;\n\nArrayPredictionContext.prototype.isEmpty = function() {\n\t// since EMPTY_RETURN_STATE can only appear in the last position, we\n\t// don't need to verify that size==1\n\treturn this.returnStates[0] === PredictionContext.EMPTY_RETURN_STATE;\n};\n\nObject.defineProperty(ArrayPredictionContext.prototype, \"length\", {\n\tget : function() {\n\t\treturn this.returnStates.length;\n\t}\n});\n\nArrayPredictionContext.prototype.getParent = function(index) {\n\treturn this.parents[index];\n};\n\nArrayPredictionContext.prototype.getReturnState = function(index) {\n\treturn this.returnStates[index];\n};\n\nArrayPredictionContext.prototype.equals = function(other) {\n\tif (this === other) {\n\t\treturn true;\n\t} else if (!(other instanceof ArrayPredictionContext)) {\n\t\treturn false;\n\t} else if (this.hashCode() !== other.hashCode()) {\n\t\treturn false; // can't be same if hash is different\n\t} else {\n\t\treturn this.returnStates === other.returnStates &&\n\t\t\t\tthis.parents === other.parents;\n\t}\n};\n\nArrayPredictionContext.prototype.toString = function() {\n\tif (this.isEmpty()) {\n\t\treturn \"[]\";\n\t} else {\n\t\tvar s = \"[\";\n\t\tfor (var i = 0; i < this.returnStates.length; i++) {\n\t\t\tif (i > 0) {\n\t\t\t\ts = s + \", \";\n\t\t\t}\n\t\t\tif (this.returnStates[i] === PredictionContext.EMPTY_RETURN_STATE) {\n\t\t\t\ts = s + \"$\";\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\ts = s + this.returnStates[i];\n\t\t\tif (this.parents[i] !== null) {\n\t\t\t\ts = s + \" \" + this.parents[i];\n\t\t\t} else {\n\t\t\t\ts = s + \"null\";\n\t\t\t}\n\t\t}\n\t\treturn s + \"]\";\n\t}\n};\n\n// Convert a {@link RuleContext} tree to a {@link PredictionContext} graph.\n// Return {@link //EMPTY} if {@code outerContext} is empty or null.\n// /\nfunction predictionContextFromRuleContext(atn, outerContext) {\n\tif (outerContext === undefined || outerContext === null) {\n\t\touterContext = RuleContext.EMPTY;\n\t}\n\t// if we are in RuleContext of start rule, s, then PredictionContext\n\t// is EMPTY. Nobody called us. (if we are empty, return empty)\n\tif (outerContext.parentCtx === null || outerContext === RuleContext.EMPTY) {\n\t\treturn PredictionContext.EMPTY;\n\t}\n\t// If we have a parent, convert it to a PredictionContext graph\n\tvar parent = predictionContextFromRuleContext(atn, outerContext.parentCtx);\n\tvar state = atn.states[outerContext.invokingState];\n\tvar transition = state.transitions[0];\n\treturn SingletonPredictionContext.create(parent, transition.followState.stateNumber);\n}\n/*\nfunction calculateListsHashString(parents, returnStates) {\n\tvar s = \"\";\n\tparents.map(function(p) {\n\t\ts = s + p;\n\t});\n\treturnStates.map(function(r) {\n\t\ts = s + r;\n\t});\n\treturn s;\n}\n*/\nfunction merge(a, b, rootIsWildcard, mergeCache) {\n\t// share same graph if both same\n\tif (a === b) {\n\t\treturn a;\n\t}\n\tif (a instanceof SingletonPredictionContext && b instanceof SingletonPredictionContext) {\n\t\treturn mergeSingletons(a, b, rootIsWildcard, mergeCache);\n\t}\n\t// At least one of a or b is array\n\t// If one is $ and rootIsWildcard, return $ as// wildcard\n\tif (rootIsWildcard) {\n\t\tif (a instanceof EmptyPredictionContext) {\n\t\t\treturn a;\n\t\t}\n\t\tif (b instanceof EmptyPredictionContext) {\n\t\t\treturn b;\n\t\t}\n\t}\n\t// convert singleton so both are arrays to normalize\n\tif (a instanceof SingletonPredictionContext) {\n\t\ta = new ArrayPredictionContext([a.getParent()], [a.returnState]);\n\t}\n\tif (b instanceof SingletonPredictionContext) {\n\t\tb = new ArrayPredictionContext([b.getParent()], [b.returnState]);\n\t}\n\treturn mergeArrays(a, b, rootIsWildcard, mergeCache);\n}\n\n//\n// Merge two {@link SingletonPredictionContext} instances.\n//\n//
Stack tops equal, parents merge is same; return left graph.
\n//
Same stack top, parents differ; merge parents giving array node, then\n// remainders of those graphs. A new root node is created to point to the\n// merged parents.
\n//
Different stack tops pointing to same parent. Make array node for the\n// root where both element in the root point to the same (original)\n// parent.
\n//
Different stack tops pointing to different parents. Make array node for\n// the root where each element points to the corresponding original\n// parent.
\n//
These local-context merge operations are used when {@code rootIsWildcard}\n// is true.
\n//\n//{@link //EMPTY} is superset of any graph; return {@link //EMPTY}.
\n//
{@link //EMPTY} and anything is {@code //EMPTY}, so merged parent is\n// {@code //EMPTY}; return left graph.
\n//
Special case of last merge if local context.
\n//
These full-context merge operations are used when {@code rootIsWildcard}\n// is false.
\n//\n// \n//\n//Must keep all contexts; {@link //EMPTY} in array is a special value (and\n// null parent).
\n//
Different tops, different parents.
\n//
Shared top, same parents.
\n//
Shared top, different parents.
\n//
Shared top, all shared parents.
\n//
Equal tops, merge parents and reduce top to\n// {@link SingletonPredictionContext}.
\n//
We track these variables separately for the DFA and ATN simulation\n// because the DFA simulation often has to fail over to the ATN\n// simulation. If the ATN simulation fails, we need the DFA to fall\n// back to its previously accepted state, if any. If the ATN succeeds,\n// then the ATN does the accept and the DFA simulator that invoked it\n// can simply return the predicted token type.
\n///\n\nvar Token = require('./../Token').Token;\nvar Lexer = require('./../Lexer').Lexer;\nvar ATN = require('./ATN').ATN;\nvar ATNSimulator = require('./ATNSimulator').ATNSimulator;\nvar DFAState = require('./../dfa/DFAState').DFAState;\nvar ATNConfigSet = require('./ATNConfigSet').ATNConfigSet;\nvar OrderedATNConfigSet = require('./ATNConfigSet').OrderedATNConfigSet;\nvar PredictionContext = require('./../PredictionContext').PredictionContext;\nvar SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext;\nvar RuleStopState = require('./ATNState').RuleStopState;\nvar LexerATNConfig = require('./ATNConfig').LexerATNConfig;\nvar Transition = require('./Transition').Transition;\nvar LexerActionExecutor = require('./LexerActionExecutor').LexerActionExecutor;\nvar LexerNoViableAltException = require('./../error/Errors').LexerNoViableAltException;\n\nfunction resetSimState(sim) {\n\tsim.index = -1;\n\tsim.line = 0;\n\tsim.column = -1;\n\tsim.dfaState = null;\n}\n\nfunction SimState() {\n\tresetSimState(this);\n\treturn this;\n}\n\nSimState.prototype.reset = function() {\n\tresetSimState(this);\n};\n\nfunction LexerATNSimulator(recog, atn, decisionToDFA, sharedContextCache) {\n\tATNSimulator.call(this, atn, sharedContextCache);\n\tthis.decisionToDFA = decisionToDFA;\n\tthis.recog = recog;\n\t// The current token's starting index into the character stream.\n\t// Shared across DFA to ATN simulation in case the ATN fails and the\n\t// DFA did not have a previous accept state. In this case, we use the\n\t// ATN-generated exception object.\n\tthis.startIndex = -1;\n\t// line number 1..n within the input///\n\tthis.line = 1;\n\t// The index of the character relative to the beginning of the line\n\t// 0..n-1///\n\tthis.column = 0;\n\tthis.mode = Lexer.DEFAULT_MODE;\n\t// Used during DFA/ATN exec to record the most recent accept configuration\n\t// info\n\tthis.prevAccept = new SimState();\n\t// done\n\treturn this;\n}\n\nLexerATNSimulator.prototype = Object.create(ATNSimulator.prototype);\nLexerATNSimulator.prototype.constructor = LexerATNSimulator;\n\nLexerATNSimulator.debug = false;\nLexerATNSimulator.dfa_debug = false;\n\nLexerATNSimulator.MIN_DFA_EDGE = 0;\nLexerATNSimulator.MAX_DFA_EDGE = 127; // forces unicode to stay in ATN\n\nLexerATNSimulator.match_calls = 0;\n\nLexerATNSimulator.prototype.copyState = function(simulator) {\n\tthis.column = simulator.column;\n\tthis.line = simulator.line;\n\tthis.mode = simulator.mode;\n\tthis.startIndex = simulator.startIndex;\n};\n\nLexerATNSimulator.prototype.match = function(input, mode) {\n\tthis.match_calls += 1;\n\tthis.mode = mode;\n\tvar mark = input.mark();\n\ttry {\n\t\tthis.startIndex = input.index;\n\t\tthis.prevAccept.reset();\n\t\tvar dfa = this.decisionToDFA[mode];\n\t\tif (dfa.s0 === null) {\n\t\t\treturn this.matchATN(input);\n\t\t} else {\n\t\t\treturn this.execATN(input, dfa.s0);\n\t\t}\n\t} finally {\n\t\tinput.release(mark);\n\t}\n};\n\nLexerATNSimulator.prototype.reset = function() {\n\tthis.prevAccept.reset();\n\tthis.startIndex = -1;\n\tthis.line = 1;\n\tthis.column = 0;\n\tthis.mode = Lexer.DEFAULT_MODE;\n};\n\nLexerATNSimulator.prototype.matchATN = function(input) {\n\tvar startState = this.atn.modeToStartState[this.mode];\n\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"matchATN mode \" + this.mode + \" start: \" + startState);\n\t}\n\tvar old_mode = this.mode;\n\tvar s0_closure = this.computeStartState(input, startState);\n\tvar suppressEdge = s0_closure.hasSemanticContext;\n\ts0_closure.hasSemanticContext = false;\n\n\tvar next = this.addDFAState(s0_closure);\n\tif (!suppressEdge) {\n\t\tthis.decisionToDFA[this.mode].s0 = next;\n\t}\n\n\tvar predict = this.execATN(input, next);\n\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"DFA after matchATN: \" + this.decisionToDFA[old_mode].toLexerString());\n\t}\n\treturn predict;\n};\n\nLexerATNSimulator.prototype.execATN = function(input, ds0) {\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"start state closure=\" + ds0.configs);\n\t}\n\tif (ds0.isAcceptState) {\n\t\t// allow zero-length tokens\n\t\tthis.captureSimState(this.prevAccept, input, ds0);\n\t}\n\tvar t = input.LA(1);\n\tvar s = ds0; // s is current/from DFA state\n\n\twhile (true) { // while more work\n\t\tif (LexerATNSimulator.debug) {\n\t\t\tconsole.log(\"execATN loop starting closure: \" + s.configs);\n\t\t}\n\n\t\t// As we move src->trg, src->trg, we keep track of the previous trg to\n\t\t// avoid looking up the DFA state again, which is expensive.\n\t\t// If the previous target was already part of the DFA, we might\n\t\t// be able to avoid doing a reach operation upon t. If s!=null,\n\t\t// it means that semantic predicates didn't prevent us from\n\t\t// creating a DFA state. Once we know s!=null, we check to see if\n\t\t// the DFA state has an edge already for t. If so, we can just reuse\n\t\t// it's configuration set; there's no point in re-computing it.\n\t\t// This is kind of like doing DFA simulation within the ATN\n\t\t// simulation because DFA simulation is really just a way to avoid\n\t\t// computing reach/closure sets. Technically, once we know that\n\t\t// we have a previously added DFA state, we could jump over to\n\t\t// the DFA simulator. But, that would mean popping back and forth\n\t\t// a lot and making things more complicated algorithmically.\n\t\t// This optimization makes a lot of sense for loops within DFA.\n\t\t// A character will take us back to an existing DFA state\n\t\t// that already has lots of edges out of it. e.g., .* in comments.\n\t\t// print(\"Target for:\" + str(s) + \" and:\" + str(t))\n\t\tvar target = this.getExistingTargetState(s, t);\n\t\t// print(\"Existing:\" + str(target))\n\t\tif (target === null) {\n\t\t\ttarget = this.computeTargetState(input, s, t);\n\t\t\t// print(\"Computed:\" + str(target))\n\t\t}\n\t\tif (target === ATNSimulator.ERROR) {\n\t\t\tbreak;\n\t\t}\n\t\t// If this is a consumable input element, make sure to consume before\n\t\t// capturing the accept state so the input index, line, and char\n\t\t// position accurately reflect the state of the interpreter at the\n\t\t// end of the token.\n\t\tif (t !== Token.EOF) {\n\t\t\tthis.consume(input);\n\t\t}\n\t\tif (target.isAcceptState) {\n\t\t\tthis.captureSimState(this.prevAccept, input, target);\n\t\t\tif (t === Token.EOF) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tt = input.LA(1);\n\t\ts = target; // flip; current DFA target becomes new src/from state\n\t}\n\treturn this.failOrAccept(this.prevAccept, input, s.configs, t);\n};\n\n// Get an existing target state for an edge in the DFA. If the target state\n// for the edge has not yet been computed or is otherwise not available,\n// this method returns {@code null}.\n//\n// @param s The current DFA state\n// @param t The next input symbol\n// @return The existing target DFA state for the given input symbol\n// {@code t}, or {@code null} if the target state for this edge is not\n// already cached\nLexerATNSimulator.prototype.getExistingTargetState = function(s, t) {\n\tif (s.edges === null || t < LexerATNSimulator.MIN_DFA_EDGE || t > LexerATNSimulator.MAX_DFA_EDGE) {\n\t\treturn null;\n\t}\n\n\tvar target = s.edges[t - LexerATNSimulator.MIN_DFA_EDGE];\n\tif(target===undefined) {\n\t\ttarget = null;\n\t}\n\tif (LexerATNSimulator.debug && target !== null) {\n\t\tconsole.log(\"reuse state \" + s.stateNumber + \" edge to \" + target.stateNumber);\n\t}\n\treturn target;\n};\n\n// Compute a target state for an edge in the DFA, and attempt to add the\n// computed state and corresponding edge to the DFA.\n//\n// @param input The input stream\n// @param s The current DFA state\n// @param t The next input symbol\n//\n// @return The computed target DFA state for the given input symbol\n// {@code t}. If {@code t} does not lead to a valid DFA state, this method\n// returns {@link //ERROR}.\nLexerATNSimulator.prototype.computeTargetState = function(input, s, t) {\n\tvar reach = new OrderedATNConfigSet();\n\t// if we don't find an existing DFA state\n\t// Fill reach starting from closure, following t transitions\n\tthis.getReachableConfigSet(input, s.configs, reach, t);\n\n\tif (reach.items.length === 0) { // we got nowhere on t from s\n\t\tif (!reach.hasSemanticContext) {\n\t\t\t// we got nowhere on t, don't throw out this knowledge; it'd\n\t\t\t// cause a failover from DFA later.\n\t\t\tthis.addDFAEdge(s, t, ATNSimulator.ERROR);\n\t\t}\n\t\t// stop when we can't match any more char\n\t\treturn ATNSimulator.ERROR;\n\t}\n\t// Add an edge from s to target DFA found/created for reach\n\treturn this.addDFAEdge(s, t, null, reach);\n};\n\nLexerATNSimulator.prototype.failOrAccept = function(prevAccept, input, reach, t) {\n\tif (this.prevAccept.dfaState !== null) {\n\t\tvar lexerActionExecutor = prevAccept.dfaState.lexerActionExecutor;\n\t\tthis.accept(input, lexerActionExecutor, this.startIndex,\n\t\t\t\tprevAccept.index, prevAccept.line, prevAccept.column);\n\t\treturn prevAccept.dfaState.prediction;\n\t} else {\n\t\t// if no accept and EOF is first char, return EOF\n\t\tif (t === Token.EOF && input.index === this.startIndex) {\n\t\t\treturn Token.EOF;\n\t\t}\n\t\tthrow new LexerNoViableAltException(this.recog, input, this.startIndex, reach);\n\t}\n};\n\n// Given a starting configuration set, figure out all ATN configurations\n// we can reach upon input {@code t}. Parameter {@code reach} is a return\n// parameter.\nLexerATNSimulator.prototype.getReachableConfigSet = function(input, closure,\n\t\treach, t) {\n\t// this is used to skip processing for configs which have a lower priority\n\t// than a config that already reached an accept state for the same rule\n\tvar skipAlt = ATN.INVALID_ALT_NUMBER;\n\tfor (var i = 0; i < closure.items.length; i++) {\n\t\tvar cfg = closure.items[i];\n\t\tvar currentAltReachedAcceptState = (cfg.alt === skipAlt);\n\t\tif (currentAltReachedAcceptState && cfg.passedThroughNonGreedyDecision) {\n\t\t\tcontinue;\n\t\t}\n\t\tif (LexerATNSimulator.debug) {\n\t\t\tconsole.log(\"testing %s at %s\\n\", this.getTokenName(t), cfg\n\t\t\t\t\t.toString(this.recog, true));\n\t\t}\n\t\tfor (var j = 0; j < cfg.state.transitions.length; j++) {\n\t\t\tvar trans = cfg.state.transitions[j]; // for each transition\n\t\t\tvar target = this.getReachableTarget(trans, t);\n\t\t\tif (target !== null) {\n\t\t\t\tvar lexerActionExecutor = cfg.lexerActionExecutor;\n\t\t\t\tif (lexerActionExecutor !== null) {\n\t\t\t\t\tlexerActionExecutor = lexerActionExecutor.fixOffsetBeforeMatch(input.index - this.startIndex);\n\t\t\t\t}\n\t\t\t\tvar treatEofAsEpsilon = (t === Token.EOF);\n\t\t\t\tvar config = new LexerATNConfig({state:target, lexerActionExecutor:lexerActionExecutor}, cfg);\n\t\t\t\tif (this.closure(input, config, reach,\n\t\t\t\t\t\tcurrentAltReachedAcceptState, true, treatEofAsEpsilon)) {\n\t\t\t\t\t// any remaining configs for this alt have a lower priority\n\t\t\t\t\t// than the one that just reached an accept state.\n\t\t\t\t\tskipAlt = cfg.alt;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n};\n\nLexerATNSimulator.prototype.accept = function(input, lexerActionExecutor,\n\t\tstartIndex, index, line, charPos) {\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"ACTION %s\\n\", lexerActionExecutor);\n\t}\n\t// seek to after last char in token\n\tinput.seek(index);\n\tthis.line = line;\n\tthis.column = charPos;\n\tif (lexerActionExecutor !== null && this.recog !== null) {\n\t\tlexerActionExecutor.execute(this.recog, input, startIndex);\n\t}\n};\n\nLexerATNSimulator.prototype.getReachableTarget = function(trans, t) {\n\tif (trans.matches(t, 0, Lexer.MAX_CHAR_VALUE)) {\n\t\treturn trans.target;\n\t} else {\n\t\treturn null;\n\t}\n};\n\nLexerATNSimulator.prototype.computeStartState = function(input, p) {\n\tvar initialContext = PredictionContext.EMPTY;\n\tvar configs = new OrderedATNConfigSet();\n\tfor (var i = 0; i < p.transitions.length; i++) {\n\t\tvar target = p.transitions[i].target;\n var cfg = new LexerATNConfig({state:target, alt:i+1, context:initialContext}, null);\n\t\tthis.closure(input, cfg, configs, false, false, false);\n\t}\n\treturn configs;\n};\n\n// Since the alternatives within any lexer decision are ordered by\n// preference, this method stops pursuing the closure as soon as an accept\n// state is reached. After the first accept state is reached by depth-first\n// search from {@code config}, all other (potentially reachable) states for\n// this rule would have a lower priority.\n//\n// @return {@code true} if an accept state is reached, otherwise\n// {@code false}.\nLexerATNSimulator.prototype.closure = function(input, config, configs,\n\t\tcurrentAltReachedAcceptState, speculative, treatEofAsEpsilon) {\n\tvar cfg = null;\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"closure(\" + config.toString(this.recog, true) + \")\");\n\t}\n\tif (config.state instanceof RuleStopState) {\n\t\tif (LexerATNSimulator.debug) {\n\t\t\tif (this.recog !== null) {\n\t\t\t\tconsole.log(\"closure at %s rule stop %s\\n\", this.recog.ruleNames[config.state.ruleIndex], config);\n\t\t\t} else {\n\t\t\t\tconsole.log(\"closure at rule stop %s\\n\", config);\n\t\t\t}\n\t\t}\n\t\tif (config.context === null || config.context.hasEmptyPath()) {\n\t\t\tif (config.context === null || config.context.isEmpty()) {\n\t\t\t\tconfigs.add(config);\n\t\t\t\treturn true;\n\t\t\t} else {\n\t\t\t\tconfigs.add(new LexerATNConfig({ state:config.state, context:PredictionContext.EMPTY}, config));\n\t\t\t\tcurrentAltReachedAcceptState = true;\n\t\t\t}\n\t\t}\n\t\tif (config.context !== null && !config.context.isEmpty()) {\n\t\t\tfor (var i = 0; i < config.context.length; i++) {\n\t\t\t\tif (config.context.getReturnState(i) !== PredictionContext.EMPTY_RETURN_STATE) {\n\t\t\t\t\tvar newContext = config.context.getParent(i); // \"pop\" return state\n\t\t\t\t\tvar returnState = this.atn.states[config.context.getReturnState(i)];\n\t\t\t\t\tcfg = new LexerATNConfig({ state:returnState, context:newContext }, config);\n\t\t\t\t\tcurrentAltReachedAcceptState = this.closure(input, cfg,\n\t\t\t\t\t\t\tconfigs, currentAltReachedAcceptState, speculative,\n\t\t\t\t\t\t\ttreatEofAsEpsilon);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn currentAltReachedAcceptState;\n\t}\n\t// optimization\n\tif (!config.state.epsilonOnlyTransitions) {\n\t\tif (!currentAltReachedAcceptState || !config.passedThroughNonGreedyDecision) {\n\t\t\tconfigs.add(config);\n\t\t}\n\t}\n\tfor (var j = 0; j < config.state.transitions.length; j++) {\n\t\tvar trans = config.state.transitions[j];\n\t\tcfg = this.getEpsilonTarget(input, config, trans, configs, speculative, treatEofAsEpsilon);\n\t\tif (cfg !== null) {\n\t\t\tcurrentAltReachedAcceptState = this.closure(input, cfg, configs,\n\t\t\t\t\tcurrentAltReachedAcceptState, speculative, treatEofAsEpsilon);\n\t\t}\n\t}\n\treturn currentAltReachedAcceptState;\n};\n\n// side-effect: can alter configs.hasSemanticContext\nLexerATNSimulator.prototype.getEpsilonTarget = function(input, config, trans,\n\t\tconfigs, speculative, treatEofAsEpsilon) {\n\tvar cfg = null;\n\tif (trans.serializationType === Transition.RULE) {\n\t\tvar newContext = SingletonPredictionContext.create(config.context, trans.followState.stateNumber);\n\t\tcfg = new LexerATNConfig( { state:trans.target, context:newContext}, config);\n\t} else if (trans.serializationType === Transition.PRECEDENCE) {\n\t\tthrow \"Precedence predicates are not supported in lexers.\";\n\t} else if (trans.serializationType === Transition.PREDICATE) {\n\t\t// Track traversing semantic predicates. If we traverse,\n\t\t// we cannot add a DFA state for this \"reach\" computation\n\t\t// because the DFA would not test the predicate again in the\n\t\t// future. Rather than creating collections of semantic predicates\n\t\t// like v3 and testing them on prediction, v4 will test them on the\n\t\t// fly all the time using the ATN not the DFA. This is slower but\n\t\t// semantically it's not used that often. One of the key elements to\n\t\t// this predicate mechanism is not adding DFA states that see\n\t\t// predicates immediately afterwards in the ATN. For example,\n\n\t\t// a : ID {p1}? | ID {p2}? ;\n\n\t\t// should create the start state for rule 'a' (to save start state\n\t\t// competition), but should not create target of ID state. The\n\t\t// collection of ATN states the following ID references includes\n\t\t// states reached by traversing predicates. Since this is when we\n\t\t// test them, we cannot cash the DFA state target of ID.\n\n\t\tif (LexerATNSimulator.debug) {\n\t\t\tconsole.log(\"EVAL rule \" + trans.ruleIndex + \":\" + trans.predIndex);\n\t\t}\n\t\tconfigs.hasSemanticContext = true;\n\t\tif (this.evaluatePredicate(input, trans.ruleIndex, trans.predIndex, speculative)) {\n\t\t\tcfg = new LexerATNConfig({ state:trans.target}, config);\n\t\t}\n\t} else if (trans.serializationType === Transition.ACTION) {\n\t\tif (config.context === null || config.context.hasEmptyPath()) {\n\t\t\t// execute actions anywhere in the start rule for a token.\n\t\t\t//\n\t\t\t// TODO: if the entry rule is invoked recursively, some\n\t\t\t// actions may be executed during the recursive call. The\n\t\t\t// problem can appear when hasEmptyPath() is true but\n\t\t\t// isEmpty() is false. In this case, the config needs to be\n\t\t\t// split into two contexts - one with just the empty path\n\t\t\t// and another with everything but the empty path.\n\t\t\t// Unfortunately, the current algorithm does not allow\n\t\t\t// getEpsilonTarget to return two configurations, so\n\t\t\t// additional modifications are needed before we can support\n\t\t\t// the split operation.\n\t\t\tvar lexerActionExecutor = LexerActionExecutor.append(config.lexerActionExecutor,\n\t\t\t\t\tthis.atn.lexerActions[trans.actionIndex]);\n\t\t\tcfg = new LexerATNConfig({ state:trans.target, lexerActionExecutor:lexerActionExecutor }, config);\n\t\t} else {\n\t\t\t// ignore actions in referenced rules\n\t\t\tcfg = new LexerATNConfig( { state:trans.target}, config);\n\t\t}\n\t} else if (trans.serializationType === Transition.EPSILON) {\n\t\tcfg = new LexerATNConfig({ state:trans.target}, config);\n\t} else if (trans.serializationType === Transition.ATOM ||\n\t\t\t\ttrans.serializationType === Transition.RANGE ||\n\t\t\t\ttrans.serializationType === Transition.SET) {\n\t\tif (treatEofAsEpsilon) {\n\t\t\tif (trans.matches(Token.EOF, 0, Lexer.MAX_CHAR_VALUE)) {\n\t\t\t\tcfg = new LexerATNConfig( { state:trans.target }, config);\n\t\t\t}\n\t\t}\n\t}\n\treturn cfg;\n};\n\n// Evaluate a predicate specified in the lexer.\n//\n//If {@code speculative} is {@code true}, this method was called before\n// {@link //consume} for the matched character. This method should call\n// {@link //consume} before evaluating the predicate to ensure position\n// sensitive values, including {@link Lexer//getText}, {@link Lexer//getLine},\n// and {@link Lexer//getcolumn}, properly reflect the current\n// lexer state. This method should restore {@code input} and the simulator\n// to the original state before returning (i.e. undo the actions made by the\n// call to {@link //consume}.
\n//\n// @param input The input stream.\n// @param ruleIndex The rule containing the predicate.\n// @param predIndex The index of the predicate within the rule.\n// @param speculative {@code true} if the current index in {@code input} is\n// one character before the predicate's location.\n//\n// @return {@code true} if the specified predicate evaluates to\n// {@code true}.\n// /\nLexerATNSimulator.prototype.evaluatePredicate = function(input, ruleIndex,\n\t\tpredIndex, speculative) {\n\t// assume true if no recognizer was provided\n\tif (this.recog === null) {\n\t\treturn true;\n\t}\n\tif (!speculative) {\n\t\treturn this.recog.sempred(null, ruleIndex, predIndex);\n\t}\n\tvar savedcolumn = this.column;\n\tvar savedLine = this.line;\n\tvar index = input.index;\n\tvar marker = input.mark();\n\ttry {\n\t\tthis.consume(input);\n\t\treturn this.recog.sempred(null, ruleIndex, predIndex);\n\t} finally {\n\t\tthis.column = savedcolumn;\n\t\tthis.line = savedLine;\n\t\tinput.seek(index);\n\t\tinput.release(marker);\n\t}\n};\n\nLexerATNSimulator.prototype.captureSimState = function(settings, input, dfaState) {\n\tsettings.index = input.index;\n\tsettings.line = this.line;\n\tsettings.column = this.column;\n\tsettings.dfaState = dfaState;\n};\n\nLexerATNSimulator.prototype.addDFAEdge = function(from_, tk, to, cfgs) {\n\tif (to === undefined) {\n\t\tto = null;\n\t}\n\tif (cfgs === undefined) {\n\t\tcfgs = null;\n\t}\n\tif (to === null && cfgs !== null) {\n\t\t// leading to this call, ATNConfigSet.hasSemanticContext is used as a\n\t\t// marker indicating dynamic predicate evaluation makes this edge\n\t\t// dependent on the specific input sequence, so the static edge in the\n\t\t// DFA should be omitted. The target DFAState is still created since\n\t\t// execATN has the ability to resynchronize with the DFA state cache\n\t\t// following the predicate evaluation step.\n\t\t//\n\t\t// TJP notes: next time through the DFA, we see a pred again and eval.\n\t\t// If that gets us to a previously created (but dangling) DFA\n\t\t// state, we can continue in pure DFA mode from there.\n\t\t// /\n\t\tvar suppressEdge = cfgs.hasSemanticContext;\n\t\tcfgs.hasSemanticContext = false;\n\n\t\tto = this.addDFAState(cfgs);\n\n\t\tif (suppressEdge) {\n\t\t\treturn to;\n\t\t}\n\t}\n\t// add the edge\n\tif (tk < LexerATNSimulator.MIN_DFA_EDGE || tk > LexerATNSimulator.MAX_DFA_EDGE) {\n\t\t// Only track edges within the DFA bounds\n\t\treturn to;\n\t}\n\tif (LexerATNSimulator.debug) {\n\t\tconsole.log(\"EDGE \" + from_ + \" -> \" + to + \" upon \" + tk);\n\t}\n\tif (from_.edges === null) {\n\t\t// make room for tokens 1..n and -1 masquerading as index 0\n\t\tfrom_.edges = [];\n\t}\n\tfrom_.edges[tk - LexerATNSimulator.MIN_DFA_EDGE] = to; // connect\n\n\treturn to;\n};\n\n// Add a new DFA state if there isn't one with this set of\n// configurations already. This method also detects the first\n// configuration containing an ATN rule stop state. Later, when\n// traversing the DFA, we will know which rule to accept.\nLexerATNSimulator.prototype.addDFAState = function(configs) {\n\tvar proposed = new DFAState(null, configs);\n\tvar firstConfigWithRuleStopState = null;\n\tfor (var i = 0; i < configs.items.length; i++) {\n\t\tvar cfg = configs.items[i];\n\t\tif (cfg.state instanceof RuleStopState) {\n\t\t\tfirstConfigWithRuleStopState = cfg;\n\t\t\tbreak;\n\t\t}\n\t}\n\tif (firstConfigWithRuleStopState !== null) {\n\t\tproposed.isAcceptState = true;\n\t\tproposed.lexerActionExecutor = firstConfigWithRuleStopState.lexerActionExecutor;\n\t\tproposed.prediction = this.atn.ruleToTokenType[firstConfigWithRuleStopState.state.ruleIndex];\n\t}\n\tvar dfa = this.decisionToDFA[this.mode];\n\tvar existing = dfa.states.get(proposed);\n\tif (existing!==null) {\n\t\treturn existing;\n\t}\n\tvar newState = proposed;\n\tnewState.stateNumber = dfa.states.length;\n\tconfigs.setReadonly(true);\n\tnewState.configs = configs;\n\tdfa.states.add(newState);\n\treturn newState;\n};\n\nLexerATNSimulator.prototype.getDFA = function(mode) {\n\treturn this.decisionToDFA[mode];\n};\n\n// Get the text matched so far for the current token.\nLexerATNSimulator.prototype.getText = function(input) {\n\t// index is first lookahead char, don't include.\n\treturn input.getText(this.startIndex, input.index - 1);\n};\n\nLexerATNSimulator.prototype.consume = function(input) {\n\tvar curChar = input.LA(1);\n\tif (curChar === \"\\n\".charCodeAt(0)) {\n\t\tthis.line += 1;\n\t\tthis.column = 0;\n\t} else {\n\t\tthis.column += 1;\n\t}\n\tinput.consume();\n};\n\nLexerATNSimulator.prototype.getTokenName = function(tt) {\n\tif (tt === -1) {\n\t\treturn \"EOF\";\n\t} else {\n\t\treturn \"'\" + String.fromCharCode(tt) + \"'\";\n\t}\n};\n\nexports.LexerATNSimulator = LexerATNSimulator;\n","// Styles\nimport './VDialog.sass'\n\n// Components\nimport { VThemeProvider } from '../VThemeProvider'\n\n// Mixins\nimport Activatable from '../../mixins/activatable'\nimport Dependent from '../../mixins/dependent'\nimport Detachable from '../../mixins/detachable'\nimport Overlayable from '../../mixins/overlayable'\nimport Returnable from '../../mixins/returnable'\nimport Stackable from '../../mixins/stackable'\n\n// Directives\nimport ClickOutside from '../../directives/click-outside'\n\n// Helpers\nimport mixins from '../../util/mixins'\nimport { removed } from '../../util/console'\nimport {\n convertToUnit,\n keyCodes,\n} from '../../util/helpers'\n\n// Types\nimport { VNode, VNodeData } from 'vue'\n\nconst baseMixins = mixins(\n Dependent,\n Detachable,\n Overlayable,\n Returnable,\n Stackable,\n Activatable,\n)\n\n/* @vue/component */\nexport default baseMixins.extend({\n name: 'v-dialog',\n\n directives: { ClickOutside },\n\n props: {\n dark: Boolean,\n disabled: Boolean,\n fullscreen: Boolean,\n light: Boolean,\n maxWidth: [String, Number],\n noClickAnimation: Boolean,\n origin: {\n type: String,\n default: 'center center',\n },\n persistent: Boolean,\n retainFocus: {\n type: Boolean,\n default: true,\n },\n scrollable: Boolean,\n transition: {\n type: [String, Boolean],\n default: 'dialog-transition',\n },\n width: [String, Number],\n },\n\n data () {\n return {\n activatedBy: null as EventTarget | null,\n animate: false,\n animateTimeout: -1,\n stackMinZIndex: 200,\n previousActiveElement: null as HTMLElement | null,\n }\n },\n\n computed: {\n classes (): object {\n return {\n [(`v-dialog ${this.contentClass}`).trim()]: true,\n 'v-dialog--active': this.isActive,\n 'v-dialog--persistent': this.persistent,\n 'v-dialog--fullscreen': this.fullscreen,\n 'v-dialog--scrollable': this.scrollable,\n 'v-dialog--animated': this.animate,\n }\n },\n contentClasses (): object {\n return {\n 'v-dialog__content': true,\n 'v-dialog__content--active': this.isActive,\n }\n },\n hasActivator (): boolean {\n return Boolean(\n !!this.$slots.activator ||\n !!this.$scopedSlots.activator\n )\n },\n },\n\n watch: {\n isActive (val) {\n if (val) {\n this.show()\n this.hideScroll()\n } else {\n this.removeOverlay()\n this.unbind()\n this.previousActiveElement?.focus()\n }\n },\n fullscreen (val) {\n if (!this.isActive) return\n\n if (val) {\n this.hideScroll()\n this.removeOverlay(false)\n } else {\n this.showScroll()\n this.genOverlay()\n }\n },\n },\n\n created () {\n /* istanbul ignore next */\n if (this.$attrs.hasOwnProperty('full-width')) {\n removed('full-width', this)\n }\n },\n\n beforeMount () {\n this.$nextTick(() => {\n this.isBooted = this.isActive\n this.isActive && this.show()\n })\n },\n\n beforeDestroy () {\n if (typeof window !== 'undefined') this.unbind()\n },\n\n methods: {\n animateClick () {\n this.animate = false\n // Needed for when clicking very fast\n // outside of the dialog\n this.$nextTick(() => {\n this.animate = true\n window.clearTimeout(this.animateTimeout)\n this.animateTimeout = window.setTimeout(() => (this.animate = false), 150)\n })\n },\n closeConditional (e: Event) {\n const target = e.target as HTMLElement\n // Ignore the click if the dialog is closed or destroyed,\n // if it was on an element inside the content,\n // if it was dragged onto the overlay (#6969),\n // or if this isn't the topmost dialog (#9907)\n return !(\n this._isDestroyed ||\n !this.isActive ||\n this.$refs.content.contains(target) ||\n (this.overlay && target && !this.overlay.$el.contains(target))\n ) && this.activeZIndex >= this.getMaxZIndex()\n },\n hideScroll () {\n if (this.fullscreen) {\n document.documentElement.classList.add('overflow-y-hidden')\n } else {\n Overlayable.options.methods.hideScroll.call(this)\n }\n },\n show () {\n !this.fullscreen && !this.hideOverlay && this.genOverlay()\n // Double nextTick to wait for lazy content to be generated\n this.$nextTick(() => {\n this.$nextTick(() => {\n if (!this.$refs.content.contains(document.activeElement)) {\n this.previousActiveElement = document.activeElement as HTMLElement\n this.$refs.content.focus()\n }\n this.bind()\n })\n })\n },\n bind () {\n window.addEventListener('focusin', this.onFocusin)\n },\n unbind () {\n window.removeEventListener('focusin', this.onFocusin)\n },\n onClickOutside (e: Event) {\n this.$emit('click:outside', e)\n\n if (this.persistent) {\n this.noClickAnimation || this.animateClick()\n } else {\n this.isActive = false\n }\n },\n onKeydown (e: KeyboardEvent) {\n if (e.keyCode === keyCodes.esc && !this.getOpenDependents().length) {\n if (!this.persistent) {\n this.isActive = false\n const activator = this.getActivator()\n this.$nextTick(() => activator && (activator as HTMLElement).focus())\n } else if (!this.noClickAnimation) {\n this.animateClick()\n }\n }\n this.$emit('keydown', e)\n },\n // On focus change, wrap focus to stay inside the dialog\n // https://github.com/vuetifyjs/vuetify/issues/6892\n onFocusin (e: Event) {\n if (!e || !this.retainFocus) return\n\n const target = e.target as HTMLElement\n\n if (\n !!target &&\n // It isn't the document or the dialog body\n ![document, this.$refs.content].includes(target) &&\n // It isn't inside the dialog body\n !this.$refs.content.contains(target) &&\n // We're the topmost dialog\n this.activeZIndex >= this.getMaxZIndex() &&\n // It isn't inside a dependent element (like a menu)\n !this.getOpenDependentElements().some(el => el.contains(target))\n // So we must have focused something outside the dialog and its children\n ) {\n // Find and focus the first available element inside the dialog\n const focusable = this.$refs.content.querySelectorAll('button, [href], input, select, textarea, [tabindex]:not([tabindex=\"-1\"])')\n const el = [...focusable].find(el => !el.hasAttribute('disabled')) as HTMLElement | undefined\n el && el.focus()\n }\n },\n genContent () {\n return this.showLazyContent(() => [\n this.$createElement(VThemeProvider, {\n props: {\n root: true,\n light: this.light,\n dark: this.dark,\n },\n }, [\n this.$createElement('div', {\n class: this.contentClasses,\n attrs: {\n role: 'dialog',\n tabindex: this.isActive ? 0 : undefined,\n 'aria-modal': this.hideOverlay ? undefined : 'true',\n ...this.getScopeIdAttrs(),\n },\n on: { keydown: this.onKeydown },\n style: { zIndex: this.activeZIndex },\n ref: 'content',\n }, [this.genTransition()]),\n ]),\n ])\n },\n genTransition () {\n const content = this.genInnerContent()\n\n if (!this.transition) return content\n\n return this.$createElement('transition', {\n props: {\n name: this.transition,\n origin: this.origin,\n appear: true,\n },\n }, [content])\n },\n genInnerContent () {\n const data: VNodeData = {\n class: this.classes,\n ref: 'dialog',\n directives: [\n {\n name: 'click-outside',\n value: {\n handler: this.onClickOutside,\n closeConditional: this.closeConditional,\n include: this.getOpenDependentElements,\n },\n },\n { name: 'show', value: this.isActive },\n ],\n style: {\n transformOrigin: this.origin,\n },\n }\n\n if (!this.fullscreen) {\n data.style = {\n ...data.style as object,\n maxWidth: convertToUnit(this.maxWidth),\n width: convertToUnit(this.width),\n }\n }\n\n return this.$createElement('div', data, this.getContentSlot())\n },\n },\n\n render (h): VNode {\n return h('div', {\n staticClass: 'v-dialog__container',\n class: {\n 'v-dialog__container--attached':\n this.attach === '' ||\n this.attach === true ||\n this.attach === 'attach',\n },\n }, [\n this.genActivator(),\n this.genContent(),\n ])\n },\n})\n","//\n/* Copyright (c) 2012-2017 The ANTLR Project. All rights reserved.\n * Use of this file is governed by the BSD 3-clause license that\n * can be found in the LICENSE.txt file in the project root.\n */\n//\n\n//\n// The embodiment of the adaptive LL(*), ALL(*), parsing strategy.\n//\n//\n// The basic complexity of the adaptive strategy makes it harder to understand.\n// We begin with ATN simulation to build paths in a DFA. Subsequent prediction\n// requests go through the DFA first. If they reach a state without an edge for\n// the current symbol, the algorithm fails over to the ATN simulation to\n// complete the DFA path for the current input (until it finds a conflict state\n// or uniquely predicting state).
\n//\n//\n// All of that is done without using the outer context because we want to create\n// a DFA that is not dependent upon the rule invocation stack when we do a\n// prediction. One DFA works in all contexts. We avoid using context not\n// necessarily because it's slower, although it can be, but because of the DFA\n// caching problem. The closure routine only considers the rule invocation stack\n// created during prediction beginning in the decision rule. For example, if\n// prediction occurs without invoking another rule's ATN, there are no context\n// stacks in the configurations. When lack of context leads to a conflict, we\n// don't know if it's an ambiguity or a weakness in the strong LL(*) parsing\n// strategy (versus full LL(*)).
\n//\n//\n// When SLL yields a configuration set with conflict, we rewind the input and\n// retry the ATN simulation, this time using full outer context without adding\n// to the DFA. Configuration context stacks will be the full invocation stacks\n// from the start rule. If we get a conflict using full context, then we can\n// definitively say we have a true ambiguity for that input sequence. If we\n// don't get a conflict, it implies that the decision is sensitive to the outer\n// context. (It is not context-sensitive in the sense of context-sensitive\n// grammars.)
\n//\n//\n// The next time we reach this DFA state with an SLL conflict, through DFA\n// simulation, we will again retry the ATN simulation using full context mode.\n// This is slow because we can't save the results and have to \"interpret\" the\n// ATN each time we get that input.
\n//\n//\n// CACHING FULL CONTEXT PREDICTIONS
\n//\n//\n// We could cache results from full context to predicted alternative easily and\n// that saves a lot of time but doesn't work in presence of predicates. The set\n// of visible predicates from the ATN start state changes depending on the\n// context, because closure can fall off the end of a rule. I tried to cache\n// tuples (stack context, semantic context, predicted alt) but it was slower\n// than interpreting and much more complicated. Also required a huge amount of\n// memory. The goal is not to create the world's fastest parser anyway. I'd like\n// to keep this algorithm simple. By launching multiple threads, we can improve\n// the speed of parsing across a large number of files.
\n//\n//\n// There is no strict ordering between the amount of input used by SLL vs LL,\n// which makes it really hard to build a cache for full context. Let's say that\n// we have input A B C that leads to an SLL conflict with full context X. That\n// implies that using X we might only use A B but we could also use A B C D to\n// resolve conflict. Input A B C D could predict alternative 1 in one position\n// in the input and A B C E could predict alternative 2 in another position in\n// input. The conflicting SLL configurations could still be non-unique in the\n// full context prediction, which would lead us to requiring more input than the\n// original A B C.\tTo make a\tprediction cache work, we have to track\tthe exact\n// input\tused during the previous prediction. That amounts to a cache that maps\n// X to a specific DFA for that context.
\n//\n//\n// Something should be done for left-recursive expression predictions. They are\n// likely LL(1) + pred eval. Easier to do the whole SLL unless error and retry\n// with full LL thing Sam does.
\n//\n//\n// AVOIDING FULL CONTEXT PREDICTION
\n//\n//\n// We avoid doing full context retry when the outer context is empty, we did not\n// dip into the outer context by falling off the end of the decision state rule,\n// or when we force SLL mode.
\n//\n//\n// As an example of the not dip into outer context case, consider as super\n// constructor calls versus function calls. One grammar might look like\n// this:
\n//\n//\n// ctorBody\n// : '{' superCall? stat* '}'\n// ;\n//\n//\n//
\n// Or, you might see something like
\n//\n//\n// stat\n// : superCall ';'\n// | expression ';'\n// | ...\n// ;\n//\n//\n//
\n// In both cases I believe that no closure operations will dip into the outer\n// context. In the first case ctorBody in the worst case will stop at the '}'.\n// In the 2nd case it should stop at the ';'. Both cases should stay within the\n// entry rule and not dip into the outer context.
\n//\n//\n// PREDICATES
\n//\n//\n// Predicates are always evaluated if present in either SLL or LL both. SLL and\n// LL simulation deals with predicates differently. SLL collects predicates as\n// it performs closure operations like ANTLR v3 did. It delays predicate\n// evaluation until it reaches and accept state. This allows us to cache the SLL\n// ATN simulation whereas, if we had evaluated predicates on-the-fly during\n// closure, the DFA state configuration sets would be different and we couldn't\n// build up a suitable DFA.
\n//\n//\n// When building a DFA accept state during ATN simulation, we evaluate any\n// predicates and return the sole semantically valid alternative. If there is\n// more than 1 alternative, we report an ambiguity. If there are 0 alternatives,\n// we throw an exception. Alternatives without predicates act like they have\n// true predicates. The simple way to think about it is to strip away all\n// alternatives with false predicates and choose the minimum alternative that\n// remains.
\n//\n//\n// When we start in the DFA and reach an accept state that's predicated, we test\n// those and return the minimum semantically viable alternative. If no\n// alternatives are viable, we throw an exception.
\n//\n//\n// During full LL ATN simulation, closure always evaluates predicates and\n// on-the-fly. This is crucial to reducing the configuration set size during\n// closure. It hits a landmine when parsing with the Java grammar, for example,\n// without this on-the-fly evaluation.
\n//\n//\n// SHARING DFA
\n//\n//\n// All instances of the same parser share the same decision DFAs through a\n// static field. Each instance gets its own ATN simulator but they share the\n// same {@link //decisionToDFA} field. They also share a\n// {@link PredictionContextCache} object that makes sure that all\n// {@link PredictionContext} objects are shared among the DFA states. This makes\n// a big size difference.
\n//\n//\n// THREAD SAFETY
\n//\n//\n// The {@link ParserATNSimulator} locks on the {@link //decisionToDFA} field when\n// it adds a new DFA object to that array. {@link //addDFAEdge}\n// locks on the DFA for the current decision when setting the\n// {@link DFAState//edges} field. {@link //addDFAState} locks on\n// the DFA for the current decision when looking up a DFA state to see if it\n// already exists. We must make sure that all requests to add DFA states that\n// are equivalent result in the same shared DFA object. This is because lots of\n// threads will be trying to update the DFA at once. The\n// {@link //addDFAState} method also locks inside the DFA lock\n// but this time on the shared context cache when it rebuilds the\n// configurations' {@link PredictionContext} objects using cached\n// subgraphs/nodes. No other locking occurs, even during DFA simulation. This is\n// safe as long as we can guarantee that all threads referencing\n// {@code s.edge[t]} get the same physical target {@link DFAState}, or\n// {@code null}. Once into the DFA, the DFA simulation does not reference the\n// {@link DFA//states} map. It follows the {@link DFAState//edges} field to new\n// targets. The DFA simulator will either find {@link DFAState//edges} to be\n// {@code null}, to be non-{@code null} and {@code dfa.edges[t]} null, or\n// {@code dfa.edges[t]} to be non-null. The\n// {@link //addDFAEdge} method could be racing to set the field\n// but in either case the DFA simulator works; if {@code null}, and requests ATN\n// simulation. It could also race trying to get {@code dfa.edges[t]}, but either\n// way it will work because it's not doing a test and set operation.
\n//\n//\n// Starting with SLL then failing to combined SLL/LL (Two-Stage\n// Parsing)
\n//\n//\n// Sam pointed out that if SLL does not give a syntax error, then there is no\n// point in doing full LL, which is slower. We only have to try LL if we get a\n// syntax error. For maximum speed, Sam starts the parser set to pure SLL\n// mode with the {@link BailErrorStrategy}:
\n//\n//\n// parser.{@link Parser//getInterpreter() getInterpreter()}.{@link //setPredictionMode setPredictionMode}{@code (}{@link PredictionMode//SLL}{@code )};\n// parser.{@link Parser//setErrorHandler setErrorHandler}(new {@link BailErrorStrategy}());\n//\n//\n//
\n// If it does not get a syntax error, then we're done. If it does get a syntax\n// error, we need to retry with the combined SLL/LL strategy.
\n//\n//\n// The reason this works is as follows. If there are no SLL conflicts, then the\n// grammar is SLL (at least for that input set). If there is an SLL conflict,\n// the full LL analysis must yield a set of viable alternatives which is a\n// subset of the alternatives reported by SLL. If the LL set is a singleton,\n// then the grammar is LL but not SLL. If the LL set is the same size as the SLL\n// set, the decision is SLL. If the LL set has size > 1, then that decision\n// is truly ambiguous on the current input. If the LL set is smaller, then the\n// SLL conflict resolution might choose an alternative that the full LL would\n// rule out as a possibility based upon better context information. If that's\n// the case, then the SLL parse will definitely get an error because the full LL\n// analysis says it's not viable. If SLL conflict resolution chooses an\n// alternative within the LL set, them both SLL and LL would choose the same\n// alternative because they both choose the minimum of multiple conflicting\n// alternatives.
\n//\n//\n// Let's say we have a set of SLL conflicting alternatives {@code {1, 2, 3}} and\n// a smaller LL set called s. If s is {@code {2, 3}}, then SLL\n// parsing will get an error because SLL will pursue alternative 1. If\n// s is {@code {1, 2}} or {@code {1, 3}} then both SLL and LL will\n// choose the same alternative because alternative one is the minimum of either\n// set. If s is {@code {2}} or {@code {3}} then SLL will get a syntax\n// error. If s is {@code {1}} then SLL will succeed.
\n//\n//\n// Of course, if the input is invalid, then we will get an error for sure in\n// both SLL and LL parsing. Erroneous input will therefore require 2 passes over\n// the input.
\n//\n\nvar Utils = require('./../Utils');\nvar Set = Utils.Set;\nvar BitSet = Utils.BitSet;\nvar DoubleDict = Utils.DoubleDict;\nvar ATN = require('./ATN').ATN;\nvar ATNState = require('./ATNState').ATNState;\nvar ATNConfig = require('./ATNConfig').ATNConfig;\nvar ATNConfigSet = require('./ATNConfigSet').ATNConfigSet;\nvar Token = require('./../Token').Token;\nvar DFAState = require('./../dfa/DFAState').DFAState;\nvar PredPrediction = require('./../dfa/DFAState').PredPrediction;\nvar ATNSimulator = require('./ATNSimulator').ATNSimulator;\nvar PredictionMode = require('./PredictionMode').PredictionMode;\nvar RuleContext = require('./../RuleContext').RuleContext;\nvar ParserRuleContext = require('./../ParserRuleContext').ParserRuleContext;\nvar SemanticContext = require('./SemanticContext').SemanticContext;\nvar StarLoopEntryState = require('./ATNState').StarLoopEntryState;\nvar RuleStopState = require('./ATNState').RuleStopState;\nvar PredictionContext = require('./../PredictionContext').PredictionContext;\nvar Interval = require('./../IntervalSet').Interval;\nvar Transitions = require('./Transition');\nvar Transition = Transitions.Transition;\nvar SetTransition = Transitions.SetTransition;\nvar NotSetTransition = Transitions.NotSetTransition;\nvar RuleTransition = Transitions.RuleTransition;\nvar ActionTransition = Transitions.ActionTransition;\nvar NoViableAltException = require('./../error/Errors').NoViableAltException;\n\nvar SingletonPredictionContext = require('./../PredictionContext').SingletonPredictionContext;\nvar predictionContextFromRuleContext = require('./../PredictionContext').predictionContextFromRuleContext;\n\nfunction ParserATNSimulator(parser, atn, decisionToDFA, sharedContextCache) {\n\tATNSimulator.call(this, atn, sharedContextCache);\n this.parser = parser;\n this.decisionToDFA = decisionToDFA;\n // SLL, LL, or LL + exact ambig detection?//\n this.predictionMode = PredictionMode.LL;\n // LAME globals to avoid parameters!!!!! I need these down deep in predTransition\n this._input = null;\n this._startIndex = 0;\n this._outerContext = null;\n this._dfa = null;\n // Each prediction operation uses a cache for merge of prediction contexts.\n // Don't keep around as it wastes huge amounts of memory. DoubleKeyMap\n // isn't synchronized but we're ok since two threads shouldn't reuse same\n // parser/atnsim object because it can only handle one input at a time.\n // This maps graphs a and b to merged result c. (a,b)→c. We can avoid\n // the merge if we ever see a and b again. Note that (b,a)→c should\n // also be examined during cache lookup.\n //\n this.mergeCache = null;\n return this;\n}\n\nParserATNSimulator.prototype = Object.create(ATNSimulator.prototype);\nParserATNSimulator.prototype.constructor = ParserATNSimulator;\n\nParserATNSimulator.prototype.debug = false;\nParserATNSimulator.prototype.debug_closure = false;\nParserATNSimulator.prototype.debug_add = false;\nParserATNSimulator.prototype.debug_list_atn_decisions = false;\nParserATNSimulator.prototype.dfa_debug = false;\nParserATNSimulator.prototype.retry_debug = false;\n\n\nParserATNSimulator.prototype.reset = function() {\n};\n\nParserATNSimulator.prototype.adaptivePredict = function(input, decision, outerContext) {\n if (this.debug || this.debug_list_atn_decisions) {\n console.log(\"adaptivePredict decision \" + decision +\n \" exec LA(1)==\" + this.getLookaheadName(input) +\n \" line \" + input.LT(1).line + \":\" +\n input.LT(1).column);\n }\n this._input = input;\n this._startIndex = input.index;\n this._outerContext = outerContext;\n\n var dfa = this.decisionToDFA[decision];\n this._dfa = dfa;\n var m = input.mark();\n var index = input.index;\n\n // Now we are certain to have a specific decision's DFA\n // But, do we still need an initial state?\n try {\n var s0;\n if (dfa.precedenceDfa) {\n // the start state for a precedence DFA depends on the current\n // parser precedence, and is provided by a DFA method.\n s0 = dfa.getPrecedenceStartState(this.parser.getPrecedence());\n } else {\n // the start state for a \"regular\" DFA is just s0\n s0 = dfa.s0;\n }\n if (s0===null) {\n if (outerContext===null) {\n outerContext = RuleContext.EMPTY;\n }\n if (this.debug || this.debug_list_atn_decisions) {\n console.log(\"predictATN decision \" + dfa.decision +\n \" exec LA(1)==\" + this.getLookaheadName(input) +\n \", outerContext=\" + outerContext.toString(this.parser.ruleNames));\n }\n\n var fullCtx = false;\n var s0_closure = this.computeStartState(dfa.atnStartState, RuleContext.EMPTY, fullCtx);\n\n if( dfa.precedenceDfa) {\n // If this is a precedence DFA, we use applyPrecedenceFilter\n // to convert the computed start state to a precedence start\n // state. We then use DFA.setPrecedenceStartState to set the\n // appropriate start state for the precedence level rather\n // than simply setting DFA.s0.\n //\n dfa.s0.configs = s0_closure; // not used for prediction but useful to know start configs anyway\n s0_closure = this.applyPrecedenceFilter(s0_closure);\n s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));\n dfa.setPrecedenceStartState(this.parser.getPrecedence(), s0);\n } else {\n s0 = this.addDFAState(dfa, new DFAState(null, s0_closure));\n dfa.s0 = s0;\n }\n }\n var alt = this.execATN(dfa, s0, input, index, outerContext);\n if (this.debug) {\n console.log(\"DFA after predictATN: \" + dfa.toString(this.parser.literalNames));\n }\n return alt;\n } finally {\n this._dfa = null;\n this.mergeCache = null; // wack cache after each prediction\n input.seek(index);\n input.release(m);\n }\n};\n// Performs ATN simulation to compute a predicted alternative based\n// upon the remaining input, but also updates the DFA cache to avoid\n// having to traverse the ATN again for the same input sequence.\n\n// There are some key conditions we're looking for after computing a new\n// set of ATN configs (proposed DFA state):\n // if the set is empty, there is no viable alternative for current symbol\n // does the state uniquely predict an alternative?\n // does the state have a conflict that would prevent us from\n // putting it on the work list?\n\n// We also have some key operations to do:\n // add an edge from previous DFA state to potentially new DFA state, D,\n // upon current symbol but only if adding to work list, which means in all\n // cases except no viable alternative (and possibly non-greedy decisions?)\n // collecting predicates and adding semantic context to DFA accept states\n // adding rule context to context-sensitive DFA accept states\n // consuming an input symbol\n // reporting a conflict\n // reporting an ambiguity\n // reporting a context sensitivity\n // reporting insufficient predicates\n\n// cover these cases:\n// dead end\n// single alt\n// single alt + preds\n// conflict\n// conflict + preds\n//\nParserATNSimulator.prototype.execATN = function(dfa, s0, input, startIndex, outerContext ) {\n if (this.debug || this.debug_list_atn_decisions) {\n console.log(\"execATN decision \" + dfa.decision +\n \" exec LA(1)==\" + this.getLookaheadName(input) +\n \" line \" + input.LT(1).line + \":\" + input.LT(1).column);\n }\n var alt;\n var previousD = s0;\n\n if (this.debug) {\n console.log(\"s0 = \" + s0);\n }\n var t = input.LA(1);\n while(true) { // while more work\n var D = this.getExistingTargetState(previousD, t);\n if(D===null) {\n D = this.computeTargetState(dfa, previousD, t);\n }\n if(D===ATNSimulator.ERROR) {\n // if any configs in previous dipped into outer context, that\n // means that input up to t actually finished entry rule\n // at least for SLL decision. Full LL doesn't dip into outer\n // so don't need special case.\n // We will get an error no matter what so delay until after\n // decision; better error message. Also, no reachable target\n // ATN states in SLL implies LL will also get nowhere.\n // If conflict in states that dip out, choose min since we\n // will get error no matter what.\n var e = this.noViableAlt(input, outerContext, previousD.configs, startIndex);\n input.seek(startIndex);\n alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previousD.configs, outerContext);\n if(alt!==ATN.INVALID_ALT_NUMBER) {\n return alt;\n } else {\n throw e;\n }\n }\n if(D.requiresFullContext && this.predictionMode !== PredictionMode.SLL) {\n // IF PREDS, MIGHT RESOLVE TO SINGLE ALT => SLL (or syntax error)\n var conflictingAlts = null;\n if (D.predicates!==null) {\n if (this.debug) {\n console.log(\"DFA state has preds in DFA sim LL failover\");\n }\n var conflictIndex = input.index;\n if(conflictIndex !== startIndex) {\n input.seek(startIndex);\n }\n conflictingAlts = this.evalSemanticContext(D.predicates, outerContext, true);\n if (conflictingAlts.length===1) {\n if(this.debug) {\n console.log(\"Full LL avoided\");\n }\n return conflictingAlts.minValue();\n }\n if (conflictIndex !== startIndex) {\n // restore the index so reporting the fallback to full\n // context occurs with the index at the correct spot\n input.seek(conflictIndex);\n }\n }\n if (this.dfa_debug) {\n console.log(\"ctx sensitive state \" + outerContext +\" in \" + D);\n }\n var fullCtx = true;\n var s0_closure = this.computeStartState(dfa.atnStartState, outerContext, fullCtx);\n this.reportAttemptingFullContext(dfa, conflictingAlts, D.configs, startIndex, input.index);\n alt = this.execATNWithFullContext(dfa, D, s0_closure, input, startIndex, outerContext);\n return alt;\n }\n if (D.isAcceptState) {\n if (D.predicates===null) {\n return D.prediction;\n }\n var stopIndex = input.index;\n input.seek(startIndex);\n var alts = this.evalSemanticContext(D.predicates, outerContext, true);\n if (alts.length===0) {\n throw this.noViableAlt(input, outerContext, D.configs, startIndex);\n } else if (alts.length===1) {\n return alts.minValue();\n } else {\n // report ambiguity after predicate evaluation to make sure the correct set of ambig alts is reported.\n this.reportAmbiguity(dfa, D, startIndex, stopIndex, false, alts, D.configs);\n return alts.minValue();\n }\n }\n previousD = D;\n\n if (t !== Token.EOF) {\n input.consume();\n t = input.LA(1);\n }\n }\n};\n//\n// Get an existing target state for an edge in the DFA. If the target state\n// for the edge has not yet been computed or is otherwise not available,\n// this method returns {@code null}.\n//\n// @param previousD The current DFA state\n// @param t The next input symbol\n// @return The existing target DFA state for the given input symbol\n// {@code t}, or {@code null} if the target state for this edge is not\n// already cached\n//\nParserATNSimulator.prototype.getExistingTargetState = function(previousD, t) {\n var edges = previousD.edges;\n if (edges===null) {\n return null;\n } else {\n return edges[t + 1] || null;\n }\n};\n//\n// Compute a target state for an edge in the DFA, and attempt to add the\n// computed state and corresponding edge to the DFA.\n//\n// @param dfa The DFA\n// @param previousD The current DFA state\n// @param t The next input symbol\n//\n// @return The computed target DFA state for the given input symbol\n// {@code t}. If {@code t} does not lead to a valid DFA state, this method\n// returns {@link //ERROR}.\n//\nParserATNSimulator.prototype.computeTargetState = function(dfa, previousD, t) {\n var reach = this.computeReachSet(previousD.configs, t, false);\n if(reach===null) {\n this.addDFAEdge(dfa, previousD, t, ATNSimulator.ERROR);\n return ATNSimulator.ERROR;\n }\n // create new target state; we'll add to DFA after it's complete\n var D = new DFAState(null, reach);\n\n var predictedAlt = this.getUniqueAlt(reach);\n\n if (this.debug) {\n var altSubSets = PredictionMode.getConflictingAltSubsets(reach);\n console.log(\"SLL altSubSets=\" + Utils.arrayToString(altSubSets) +\n \", previous=\" + previousD.configs +\n \", configs=\" + reach +\n \", predict=\" + predictedAlt +\n \", allSubsetsConflict=\" +\n PredictionMode.allSubsetsConflict(altSubSets) + \", conflictingAlts=\" +\n this.getConflictingAlts(reach));\n }\n if (predictedAlt!==ATN.INVALID_ALT_NUMBER) {\n // NO CONFLICT, UNIQUELY PREDICTED ALT\n D.isAcceptState = true;\n D.configs.uniqueAlt = predictedAlt;\n D.prediction = predictedAlt;\n } else if (PredictionMode.hasSLLConflictTerminatingPrediction(this.predictionMode, reach)) {\n // MORE THAN ONE VIABLE ALTERNATIVE\n D.configs.conflictingAlts = this.getConflictingAlts(reach);\n D.requiresFullContext = true;\n // in SLL-only mode, we will stop at this state and return the minimum alt\n D.isAcceptState = true;\n D.prediction = D.configs.conflictingAlts.minValue();\n }\n if (D.isAcceptState && D.configs.hasSemanticContext) {\n this.predicateDFAState(D, this.atn.getDecisionState(dfa.decision));\n if( D.predicates!==null) {\n D.prediction = ATN.INVALID_ALT_NUMBER;\n }\n }\n // all adds to dfa are done after we've created full D state\n D = this.addDFAEdge(dfa, previousD, t, D);\n return D;\n};\n\nParserATNSimulator.prototype.predicateDFAState = function(dfaState, decisionState) {\n // We need to test all predicates, even in DFA states that\n // uniquely predict alternative.\n var nalts = decisionState.transitions.length;\n // Update DFA so reach becomes accept state with (predicate,alt)\n // pairs if preds found for conflicting alts\n var altsToCollectPredsFrom = this.getConflictingAltsOrUniqueAlt(dfaState.configs);\n var altToPred = this.getPredsForAmbigAlts(altsToCollectPredsFrom, dfaState.configs, nalts);\n if (altToPred!==null) {\n dfaState.predicates = this.getPredicatePredictions(altsToCollectPredsFrom, altToPred);\n dfaState.prediction = ATN.INVALID_ALT_NUMBER; // make sure we use preds\n } else {\n // There are preds in configs but they might go away\n // when OR'd together like {p}? || NONE == NONE. If neither\n // alt has preds, resolve to min alt\n dfaState.prediction = altsToCollectPredsFrom.minValue();\n }\n};\n\n// comes back with reach.uniqueAlt set to a valid alt\nParserATNSimulator.prototype.execATNWithFullContext = function(dfa, D, // how far we got before failing over\n s0,\n input,\n startIndex,\n outerContext) {\n if (this.debug || this.debug_list_atn_decisions) {\n console.log(\"execATNWithFullContext \"+s0);\n }\n var fullCtx = true;\n var foundExactAmbig = false;\n var reach = null;\n var previous = s0;\n input.seek(startIndex);\n var t = input.LA(1);\n var predictedAlt = -1;\n while (true) { // while more work\n reach = this.computeReachSet(previous, t, fullCtx);\n if (reach===null) {\n // if any configs in previous dipped into outer context, that\n // means that input up to t actually finished entry rule\n // at least for LL decision. Full LL doesn't dip into outer\n // so don't need special case.\n // We will get an error no matter what so delay until after\n // decision; better error message. Also, no reachable target\n // ATN states in SLL implies LL will also get nowhere.\n // If conflict in states that dip out, choose min since we\n // will get error no matter what.\n var e = this.noViableAlt(input, outerContext, previous, startIndex);\n input.seek(startIndex);\n var alt = this.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule(previous, outerContext);\n if(alt!==ATN.INVALID_ALT_NUMBER) {\n return alt;\n } else {\n throw e;\n }\n }\n var altSubSets = PredictionMode.getConflictingAltSubsets(reach);\n if(this.debug) {\n console.log(\"LL altSubSets=\" + altSubSets + \", predict=\" +\n PredictionMode.getUniqueAlt(altSubSets) + \", resolvesToJustOneViableAlt=\" +\n PredictionMode.resolvesToJustOneViableAlt(altSubSets));\n }\n reach.uniqueAlt = this.getUniqueAlt(reach);\n // unique prediction?\n if(reach.uniqueAlt!==ATN.INVALID_ALT_NUMBER) {\n predictedAlt = reach.uniqueAlt;\n break;\n } else if (this.predictionMode !== PredictionMode.LL_EXACT_AMBIG_DETECTION) {\n predictedAlt = PredictionMode.resolvesToJustOneViableAlt(altSubSets);\n if(predictedAlt !== ATN.INVALID_ALT_NUMBER) {\n break;\n }\n } else {\n // In exact ambiguity mode, we never try to terminate early.\n // Just keeps scarfing until we know what the conflict is\n if (PredictionMode.allSubsetsConflict(altSubSets) && PredictionMode.allSubsetsEqual(altSubSets)) {\n foundExactAmbig = true;\n predictedAlt = PredictionMode.getSingleViableAlt(altSubSets);\n break;\n }\n // else there are multiple non-conflicting subsets or\n // we're not sure what the ambiguity is yet.\n // So, keep going.\n }\n previous = reach;\n if( t !== Token.EOF) {\n input.consume();\n t = input.LA(1);\n }\n }\n // If the configuration set uniquely predicts an alternative,\n // without conflict, then we know that it's a full LL decision\n // not SLL.\n if (reach.uniqueAlt !== ATN.INVALID_ALT_NUMBER ) {\n this.reportContextSensitivity(dfa, predictedAlt, reach, startIndex, input.index);\n return predictedAlt;\n }\n // We do not check predicates here because we have checked them\n // on-the-fly when doing full context prediction.\n\n //\n // In non-exact ambiguity detection mode, we might\tactually be able to\n // detect an exact ambiguity, but I'm not going to spend the cycles\n // needed to check. We only emit ambiguity warnings in exact ambiguity\n // mode.\n //\n // For example, we might know that we have conflicting configurations.\n // But, that does not mean that there is no way forward without a\n // conflict. It's possible to have nonconflicting alt subsets as in:\n\n // altSubSets=[{1, 2}, {1, 2}, {1}, {1, 2}]\n\n // from\n //\n // [(17,1,[5 $]), (13,1,[5 10 $]), (21,1,[5 10 $]), (11,1,[$]),\n // (13,2,[5 10 $]), (21,2,[5 10 $]), (11,2,[$])]\n //\n // In this case, (17,1,[5 $]) indicates there is some next sequence that\n // would resolve this without conflict to alternative 1. Any other viable\n // next sequence, however, is associated with a conflict. We stop\n // looking for input because no amount of further lookahead will alter\n // the fact that we should predict alternative 1. We just can't say for\n // sure that there is an ambiguity without looking further.\n\n this.reportAmbiguity(dfa, D, startIndex, input.index, foundExactAmbig, null, reach);\n\n return predictedAlt;\n};\n\nParserATNSimulator.prototype.computeReachSet = function(closure, t, fullCtx) {\n if (this.debug) {\n console.log(\"in computeReachSet, starting closure: \" + closure);\n }\n if( this.mergeCache===null) {\n this.mergeCache = new DoubleDict();\n }\n var intermediate = new ATNConfigSet(fullCtx);\n\n // Configurations already in a rule stop state indicate reaching the end\n // of the decision rule (local context) or end of the start rule (full\n // context). Once reached, these configurations are never updated by a\n // closure operation, so they are handled separately for the performance\n // advantage of having a smaller intermediate set when calling closure.\n //\n // For full-context reach operations, separate handling is required to\n // ensure that the alternative matching the longest overall sequence is\n // chosen when multiple such configurations can match the input.\n\n var skippedStopStates = null;\n\n // First figure out where we can reach on input t\n for (var i=0; i\n// The prediction context must be considered by this filter to address\n// situations like the following.\n//
\n//\n// \n// grammar TA;\n// prog: statement* EOF;\n// statement: letterA | statement letterA 'b' ;\n// letterA: 'a';\n//
\n//
\n// \n// If the above grammar, the ATN state immediately before the token\n// reference {@code 'a'} in {@code letterA} is reachable from the left edge\n// of both the primary and closure blocks of the left-recursive rule\n// {@code statement}. The prediction context associated with each of these\n// configurations distinguishes between them, and prevents the alternative\n// which stepped out to {@code prog} (and then back in to {@code statement}\n// from being eliminated by the filter.\n//
\n//\n// @param configs The configuration set computed by\n// {@link //computeStartState} as the start state for the DFA.\n// @return The transformed configuration set representing the start state\n// for a precedence DFA at a particular precedence level (determined by\n// calling {@link Parser//getPrecedence}).\n//\nParserATNSimulator.prototype.applyPrecedenceFilter = function(configs) {\n\tvar config;\n\tvar statesFromAlt1 = [];\n var configSet = new ATNConfigSet(configs.fullCtx);\n for(var i=0; i\n// In some scenarios, the algorithm described above could predict an\n// alternative which will result in a {@link FailedPredicateException} in\n// the parser. Specifically, this could occur if the only configuration\n// capable of successfully parsing to the end of the decision rule is\n// blocked by a semantic predicate. By choosing this alternative within\n// {@link //adaptivePredict} instead of throwing a\n// {@link NoViableAltException}, the resulting\n// {@link FailedPredicateException} in the parser will identify the specific\n// predicate which is preventing the parser from successfully parsing the\n// decision rule, which helps developers identify and correct logic errors\n// in semantic predicates.\n//
\n//\n// @param configs The ATN configurations which were valid immediately before\n// the {@link //ERROR} state was reached\n// @param outerContext The is the \\gamma_0 initial parser context from the paper\n// or the parser stack at the instant before prediction commences.\n//\n// @return The value to return from {@link //adaptivePredict}, or\n// {@link ATN//INVALID_ALT_NUMBER} if a suitable alternative was not\n// identified and {@link //adaptivePredict} should report an error instead.\n//\nParserATNSimulator.prototype.getSynValidOrSemInvalidAltThatFinishedDecisionEntryRule = function(configs, outerContext) {\n var cfgs = this.splitAccordingToSemanticValidity(configs, outerContext);\n var semValidConfigs = cfgs[0];\n var semInvalidConfigs = cfgs[1];\n var alt = this.getAltThatFinishedDecisionEntryRule(semValidConfigs);\n if (alt!==ATN.INVALID_ALT_NUMBER) { // semantically/syntactically viable path exists\n return alt;\n }\n // Is there a syntactically valid path with a failed pred?\n if (semInvalidConfigs.items.length>0) {\n alt = this.getAltThatFinishedDecisionEntryRule(semInvalidConfigs);\n if (alt!==ATN.INVALID_ALT_NUMBER) { // syntactically viable path exists\n return alt;\n }\n }\n return ATN.INVALID_ALT_NUMBER;\n};\n\nParserATNSimulator.prototype.getAltThatFinishedDecisionEntryRule = function(configs) {\n var alts = [];\n for(var i=0;iIf {@code D} is {@link //ERROR}, this method returns {@link //ERROR} and\n// does not change the DFA.
\n//\n// @param dfa The dfa\n// @param D The DFA state to add\n// @return The state stored in the DFA. This will be either the existing\n// state if {@code D} is already in the DFA, or {@code D} itself if the\n// state was not already present.\n//\nParserATNSimulator.prototype.addDFAState = function(dfa, D) {\n if (D == ATNSimulator.ERROR) {\n return D;\n }\n var existing = dfa.states.get(D);\n if(existing!==null) {\n return existing;\n }\n D.stateNumber = dfa.states.length;\n if (! D.configs.readOnly) {\n D.configs.optimizeConfigs(this);\n D.configs.setReadonly(true);\n }\n dfa.states.add(D);\n if (this.debug) {\n console.log(\"adding new DFA state: \" + D);\n }\n return D;\n};\n\nParserATNSimulator.prototype.reportAttemptingFullContext = function(dfa, conflictingAlts, configs, startIndex, stopIndex) {\n if (this.debug || this.retry_debug) {\n var interval = new Interval(startIndex, stopIndex + 1);\n console.log(\"reportAttemptingFullContext decision=\" + dfa.decision + \":\" + configs +\n \", input=\" + this.parser.getTokenStream().getText(interval));\n }\n if (this.parser!==null) {\n this.parser.getErrorListenerDispatch().reportAttemptingFullContext(this.parser, dfa, startIndex, stopIndex, conflictingAlts, configs);\n }\n};\n\nParserATNSimulator.prototype.reportContextSensitivity = function(dfa, prediction, configs, startIndex, stopIndex) {\n if (this.debug || this.retry_debug) {\n var interval = new Interval(startIndex, stopIndex + 1);\n console.log(\"reportContextSensitivity decision=\" + dfa.decision + \":\" + configs +\n \", input=\" + this.parser.getTokenStream().getText(interval));\n }\n if (this.parser!==null) {\n this.parser.getErrorListenerDispatch().reportContextSensitivity(this.parser, dfa, startIndex, stopIndex, prediction, configs);\n }\n};\n\n// If context sensitive parsing, we know it's ambiguity not conflict//\nParserATNSimulator.prototype.reportAmbiguity = function(dfa, D, startIndex, stopIndex,\n exact, ambigAlts, configs ) {\n if (this.debug || this.retry_debug) {\n var interval = new Interval(startIndex, stopIndex + 1);\n console.log(\"reportAmbiguity \" + ambigAlts + \":\" + configs +\n \", input=\" + this.parser.getTokenStream().getText(interval));\n }\n if (this.parser!==null) {\n this.parser.getErrorListenerDispatch().reportAmbiguity(this.parser, dfa, startIndex, stopIndex, exact, ambigAlts, configs);\n }\n};\n\nexports.ParserATNSimulator = ParserATNSimulator;","import Vue from 'vue'\n\n/**\n * Delayable\n *\n * @mixin\n *\n * Changes the open or close delay time for elements\n */\nexport default Vue.extendIf the symbol type does not match,\n// {@link ANTLRErrorStrategy//recoverInline} is called on the current error\n// strategy to attempt recovery. If {@link //getBuildParseTree} is\n// {@code true} and the token index of the symbol returned by\n// {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to\n// the parse tree by calling {@link ParserRuleContext//addErrorNode}.
\n//\n// @param ttype the token type to match\n// @return the matched symbol\n// @throws RecognitionException if the current input symbol did not match\n// {@code ttype} and the error strategy could not recover from the\n// mismatched symbol\n\nParser.prototype.match = function(ttype) {\n\tvar t = this.getCurrentToken();\n\tif (t.type === ttype) {\n\t\tthis._errHandler.reportMatch(this);\n\t\tthis.consume();\n\t} else {\n\t\tt = this._errHandler.recoverInline(this);\n\t\tif (this.buildParseTrees && t.tokenIndex === -1) {\n\t\t\t// we must have conjured up a new token during single token\n\t\t\t// insertion\n\t\t\t// if it's not the current symbol\n\t\t\tthis._ctx.addErrorNode(t);\n\t\t}\n\t}\n\treturn t;\n};\n// Match current input symbol as a wildcard. If the symbol type matches\n// (i.e. has a value greater than 0), {@link ANTLRErrorStrategy//reportMatch}\n// and {@link //consume} are called to complete the match process.\n//\n//If the symbol type does not match,\n// {@link ANTLRErrorStrategy//recoverInline} is called on the current error\n// strategy to attempt recovery. If {@link //getBuildParseTree} is\n// {@code true} and the token index of the symbol returned by\n// {@link ANTLRErrorStrategy//recoverInline} is -1, the symbol is added to\n// the parse tree by calling {@link ParserRuleContext//addErrorNode}.
\n//\n// @return the matched symbol\n// @throws RecognitionException if the current input symbol did not match\n// a wildcard and the error strategy could not recover from the mismatched\n// symbol\n\nParser.prototype.matchWildcard = function() {\n\tvar t = this.getCurrentToken();\n\tif (t.type > 0) {\n\t\tthis._errHandler.reportMatch(this);\n\t\tthis.consume();\n\t} else {\n\t\tt = this._errHandler.recoverInline(this);\n\t\tif (this._buildParseTrees && t.tokenIndex === -1) {\n\t\t\t// we must have conjured up a new token during single token\n\t\t\t// insertion\n\t\t\t// if it's not the current symbol\n\t\t\tthis._ctx.addErrorNode(t);\n\t\t}\n\t}\n\treturn t;\n};\n\nParser.prototype.getParseListeners = function() {\n\treturn this._parseListeners || [];\n};\n\n// Registers {@code listener} to receive events during the parsing process.\n//\n//To support output-preserving grammar transformations (including but not\n// limited to left-recursion removal, automated left-factoring, and\n// optimized code generation), calls to listener methods during the parse\n// may differ substantially from calls made by\n// {@link ParseTreeWalker//DEFAULT} used after the parse is complete. In\n// particular, rule entry and exit events may occur in a different order\n// during the parse than after the parser. In addition, calls to certain\n// rule entry methods may be omitted.
\n//\n//With the following specific exceptions, calls to listener events are\n// deterministic, i.e. for identical input the calls to listener\n// methods will be the same.
\n//\n//If {@code listener} is {@code null} or has not been added as a parse\n// listener, this method does nothing.
\n// @param listener the listener to remove\n//\nParser.prototype.removeParseListener = function(listener) {\n\tif (this._parseListeners !== null) {\n\t\tvar idx = this._parseListeners.indexOf(listener);\n\t\tif (idx >= 0) {\n\t\t\tthis._parseListeners.splice(idx, 1);\n\t\t}\n\t\tif (this._parseListeners.length === 0) {\n\t\t\tthis._parseListeners = null;\n\t\t}\n\t}\n};\n\n// Remove all parse listeners.\nParser.prototype.removeParseListeners = function() {\n\tthis._parseListeners = null;\n};\n\n// Notify any parse listeners of an enter rule event.\nParser.prototype.triggerEnterRuleEvent = function() {\n\tif (this._parseListeners !== null) {\n var ctx = this._ctx;\n\t\tthis._parseListeners.map(function(listener) {\n\t\t\tlistener.enterEveryRule(ctx);\n\t\t\tctx.enterRule(listener);\n\t\t});\n\t}\n};\n\n//\n// Notify any parse listeners of an exit rule event.\n//\n// @see //addParseListener\n//\nParser.prototype.triggerExitRuleEvent = function() {\n\tif (this._parseListeners !== null) {\n\t\t// reverse order walk of listeners\n var ctx = this._ctx;\n\t\tthis._parseListeners.slice(0).reverse().map(function(listener) {\n\t\t\tctx.exitRule(listener);\n\t\t\tlistener.exitEveryRule(ctx);\n\t\t});\n\t}\n};\n\nParser.prototype.getTokenFactory = function() {\n\treturn this._input.tokenSource._factory;\n};\n\n// Tell our token source and error strategy about a new way to create tokens.//\nParser.prototype.setTokenFactory = function(factory) {\n\tthis._input.tokenSource._factory = factory;\n};\n\n// The ATN with bypass alternatives is expensive to create so we create it\n// lazily.\n//\n// @throws UnsupportedOperationException if the current parser does not\n// implement the {@link //getSerializedATN()} method.\n//\nParser.prototype.getATNWithBypassAlts = function() {\n\tvar serializedAtn = this.getSerializedATN();\n\tif (serializedAtn === null) {\n\t\tthrow \"The current parser does not support an ATN with bypass alternatives.\";\n\t}\n\tvar result = this.bypassAltsAtnCache[serializedAtn];\n\tif (result === null) {\n\t\tvar deserializationOptions = new ATNDeserializationOptions();\n\t\tdeserializationOptions.generateRuleBypassTransitions = true;\n\t\tresult = new ATNDeserializer(deserializationOptions)\n\t\t\t\t.deserialize(serializedAtn);\n\t\tthis.bypassAltsAtnCache[serializedAtn] = result;\n\t}\n\treturn result;\n};\n\n// The preferred method of getting a tree pattern. For example, here's a\n// sample use:\n//\n//\n// ParseTree t = parser.expr();\n// ParseTreePattern p = parser.compileParseTreePattern(\"<ID>+0\",\n// MyParser.RULE_expr);\n// ParseTreeMatch m = p.match(t);\n// String id = m.get(\"ID\");\n//\n\nvar Lexer = require('./Lexer').Lexer;\n\nParser.prototype.compileParseTreePattern = function(pattern, patternRuleIndex, lexer) {\n\tlexer = lexer || null;\n\tif (lexer === null) {\n\t\tif (this.getTokenStream() !== null) {\n\t\t\tvar tokenSource = this.getTokenStream().tokenSource;\n\t\t\tif (tokenSource instanceof Lexer) {\n\t\t\t\tlexer = tokenSource;\n\t\t\t}\n\t\t}\n\t}\n\tif (lexer === null) {\n\t\tthrow \"Parser can't discover a lexer to use\";\n\t}\n\tvar m = new ParseTreePatternMatcher(lexer, this);\n\treturn m.compile(pattern, patternRuleIndex);\n};\n\nParser.prototype.getInputStream = function() {\n\treturn this.getTokenStream();\n};\n\nParser.prototype.setInputStream = function(input) {\n\tthis.setTokenStream(input);\n};\n\nParser.prototype.getTokenStream = function() {\n\treturn this._input;\n};\n\n// Set the token stream and reset the parser.//\nParser.prototype.setTokenStream = function(input) {\n\tthis._input = null;\n\tthis.reset();\n\tthis._input = input;\n};\n\n// Match needs to return the current input symbol, which gets put\n// into the label for the associated token ref; e.g., x=ID.\n//\nParser.prototype.getCurrentToken = function() {\n\treturn this._input.LT(1);\n};\n\nParser.prototype.notifyErrorListeners = function(msg, offendingToken, err) {\n\toffendingToken = offendingToken || null;\n\terr = err || null;\n\tif (offendingToken === null) {\n\t\toffendingToken = this.getCurrentToken();\n\t}\n\tthis._syntaxErrors += 1;\n\tvar line = offendingToken.line;\n\tvar column = offendingToken.column;\n\tvar listener = this.getErrorListenerDispatch();\n\tlistener.syntaxError(this, offendingToken, line, column, msg, err);\n};\n\n//\n// Consume and return the {@linkplain //getCurrentToken current symbol}.\n//\n//
E.g., given the following input with {@code A} being the current\n// lookahead symbol, this function moves the cursor to {@code B} and returns\n// {@code A}.
\n//\n//\n// A B\n// ^\n//\n//\n// If the parser is not in error recovery mode, the consumed symbol is added\n// to the parse tree using {@link ParserRuleContext//addChild(Token)}, and\n// {@link ParseTreeListener//visitTerminal} is called on any parse listeners.\n// If the parser is in error recovery mode, the consumed symbol is\n// added to the parse tree using\n// {@link ParserRuleContext//addErrorNode(Token)}, and\n// {@link ParseTreeListener//visitErrorNode} is called on any parse\n// listeners.\n//\nParser.prototype.consume = function() {\n\tvar o = this.getCurrentToken();\n\tif (o.type !== Token.EOF) {\n\t\tthis.getInputStream().consume();\n\t}\n\tvar hasListener = this._parseListeners !== null && this._parseListeners.length > 0;\n\tif (this.buildParseTrees || hasListener) {\n\t\tvar node;\n\t\tif (this._errHandler.inErrorRecoveryMode(this)) {\n\t\t\tnode = this._ctx.addErrorNode(o);\n\t\t} else {\n\t\t\tnode = this._ctx.addTokenNode(o);\n\t\t}\n node.invokingState = this.state;\n\t\tif (hasListener) {\n\t\t\tthis._parseListeners.map(function(listener) {\n\t\t\t\tif (node instanceof ErrorNode || (node.isErrorNode !== undefined && node.isErrorNode())) {\n\t\t\t\t\tlistener.visitErrorNode(node);\n\t\t\t\t} else if (node instanceof TerminalNode) {\n\t\t\t\t\tlistener.visitTerminal(node);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\treturn o;\n};\n\nParser.prototype.addContextToParseTree = function() {\n\t// add current context to parent if we have a parent\n\tif (this._ctx.parentCtx !== null) {\n\t\tthis._ctx.parentCtx.addChild(this._ctx);\n\t}\n};\n\n// Always called by generated parsers upon entry to a rule. Access field\n// {@link //_ctx} get the current context.\n\nParser.prototype.enterRule = function(localctx, state, ruleIndex) {\n\tthis.state = state;\n\tthis._ctx = localctx;\n\tthis._ctx.start = this._input.LT(1);\n\tif (this.buildParseTrees) {\n\t\tthis.addContextToParseTree();\n\t}\n\tif (this._parseListeners !== null) {\n\t\tthis.triggerEnterRuleEvent();\n\t}\n};\n\nParser.prototype.exitRule = function() {\n\tthis._ctx.stop = this._input.LT(-1);\n\t// trigger event on _ctx, before it reverts to parent\n\tif (this._parseListeners !== null) {\n\t\tthis.triggerExitRuleEvent();\n\t}\n\tthis.state = this._ctx.invokingState;\n\tthis._ctx = this._ctx.parentCtx;\n};\n\nParser.prototype.enterOuterAlt = function(localctx, altNum) {\n \tlocalctx.setAltNumber(altNum);\n\t// if we have new localctx, make sure we replace existing ctx\n\t// that is previous child of parse tree\n\tif (this.buildParseTrees && this._ctx !== localctx) {\n\t\tif (this._ctx.parentCtx !== null) {\n\t\t\tthis._ctx.parentCtx.removeLastChild();\n\t\t\tthis._ctx.parentCtx.addChild(localctx);\n\t\t}\n\t}\n\tthis._ctx = localctx;\n};\n\n// Get the precedence level for the top-most precedence rule.\n//\n// @return The precedence level for the top-most precedence rule, or -1 if\n// the parser context is not nested within a precedence rule.\n\nParser.prototype.getPrecedence = function() {\n\tif (this._precedenceStack.length === 0) {\n\t\treturn -1;\n\t} else {\n\t\treturn this._precedenceStack[this._precedenceStack.length-1];\n\t}\n};\n\nParser.prototype.enterRecursionRule = function(localctx, state, ruleIndex,\n\t\tprecedence) {\n\tthis.state = state;\n\tthis._precedenceStack.push(precedence);\n\tthis._ctx = localctx;\n\tthis._ctx.start = this._input.LT(1);\n\tif (this._parseListeners !== null) {\n\t\tthis.triggerEnterRuleEvent(); // simulates rule entry for\n\t\t\t\t\t\t\t\t\t\t// left-recursive rules\n\t}\n};\n\n//\n// Like {@link //enterRule} but for recursive rules.\n\nParser.prototype.pushNewRecursionContext = function(localctx, state, ruleIndex) {\n\tvar previous = this._ctx;\n\tprevious.parentCtx = localctx;\n\tprevious.invokingState = state;\n\tprevious.stop = this._input.LT(-1);\n\n\tthis._ctx = localctx;\n\tthis._ctx.start = previous.start;\n\tif (this.buildParseTrees) {\n\t\tthis._ctx.addChild(previous);\n\t}\n\tif (this._parseListeners !== null) {\n\t\tthis.triggerEnterRuleEvent(); // simulates rule entry for\n\t\t\t\t\t\t\t\t\t\t// left-recursive rules\n\t}\n};\n\nParser.prototype.unrollRecursionContexts = function(parentCtx) {\n\tthis._precedenceStack.pop();\n\tthis._ctx.stop = this._input.LT(-1);\n\tvar retCtx = this._ctx; // save current ctx (return value)\n\t// unroll so _ctx is as it was before call to recursive method\n\tif (this._parseListeners !== null) {\n\t\twhile (this._ctx !== parentCtx) {\n\t\t\tthis.triggerExitRuleEvent();\n\t\t\tthis._ctx = this._ctx.parentCtx;\n\t\t}\n\t} else {\n\t\tthis._ctx = parentCtx;\n\t}\n\t// hook into tree\n\tretCtx.parentCtx = parentCtx;\n\tif (this.buildParseTrees && parentCtx !== null) {\n\t\t// add return ctx into invoking rule's tree\n\t\tparentCtx.addChild(retCtx);\n\t}\n};\n\nParser.prototype.getInvokingContext = function(ruleIndex) {\n\tvar ctx = this._ctx;\n\twhile (ctx !== null) {\n\t\tif (ctx.ruleIndex === ruleIndex) {\n\t\t\treturn ctx;\n\t\t}\n\t\tctx = ctx.parentCtx;\n\t}\n\treturn null;\n};\n\nParser.prototype.precpred = function(localctx, precedence) {\n\treturn precedence >= this._precedenceStack[this._precedenceStack.length-1];\n};\n\nParser.prototype.inContext = function(context) {\n\t// TODO: useful in parser?\n\treturn false;\n};\n\n//\n// Checks whether or not {@code symbol} can follow the current state in the\n// ATN. The behavior of this method is equivalent to the following, but is\n// implemented such that the complete context-sensitive follow set does not\n// need to be explicitly constructed.\n//\n//
\n// return getExpectedTokens().contains(symbol);\n//\n//\n// @param symbol the symbol type to check\n// @return {@code true} if {@code symbol} can follow the current state in\n// the ATN, otherwise {@code false}.\n\nParser.prototype.isExpectedToken = function(symbol) {\n\tvar atn = this._interp.atn;\n\tvar ctx = this._ctx;\n\tvar s = atn.states[this.state];\n\tvar following = atn.nextTokens(s);\n\tif (following.contains(symbol)) {\n\t\treturn true;\n\t}\n\tif (!following.contains(Token.EPSILON)) {\n\t\treturn false;\n\t}\n\twhile (ctx !== null && ctx.invokingState >= 0 && following.contains(Token.EPSILON)) {\n\t\tvar invokingState = atn.states[ctx.invokingState];\n\t\tvar rt = invokingState.transitions[0];\n\t\tfollowing = atn.nextTokens(rt.followState);\n\t\tif (following.contains(symbol)) {\n\t\t\treturn true;\n\t\t}\n\t\tctx = ctx.parentCtx;\n\t}\n\tif (following.contains(Token.EPSILON) && symbol === Token.EOF) {\n\t\treturn true;\n\t} else {\n\t\treturn false;\n\t}\n};\n\n// Computes the set of input symbols which could follow the current parser\n// state and context, as given by {@link //getState} and {@link //getContext},\n// respectively.\n//\n// @see ATN//getExpectedTokens(int, RuleContext)\n//\nParser.prototype.getExpectedTokens = function() {\n\treturn this._interp.atn.getExpectedTokens(this.state, this._ctx);\n};\n\nParser.prototype.getExpectedTokensWithinCurrentRule = function() {\n\tvar atn = this._interp.atn;\n\tvar s = atn.states[this.state];\n\treturn atn.nextTokens(s);\n};\n\n// Get a rule's index (i.e., {@code RULE_ruleName} field) or -1 if not found.//\nParser.prototype.getRuleIndex = function(ruleName) {\n\tvar ruleIndex = this.getRuleIndexMap()[ruleName];\n\tif (ruleIndex !== null) {\n\t\treturn ruleIndex;\n\t} else {\n\t\treturn -1;\n\t}\n};\n\n// Return List<String> of the rule names in your parser instance\n// leading up to a call to the current rule. You could override if\n// you want more details such as the file/line info of where\n// in the ATN a rule is invoked.\n//\n// this is very useful for error messages.\n//\nParser.prototype.getRuleInvocationStack = function(p) {\n\tp = p || null;\n\tif (p === null) {\n\t\tp = this._ctx;\n\t}\n\tvar stack = [];\n\twhile (p !== null) {\n\t\t// compute what follows who invoked us\n\t\tvar ruleIndex = p.ruleIndex;\n\t\tif (ruleIndex < 0) {\n\t\t\tstack.push(\"n/a\");\n\t\t} else {\n\t\t\tstack.push(this.ruleNames[ruleIndex]);\n\t\t}\n\t\tp = p.parentCtx;\n\t}\n\treturn stack;\n};\n\n// For debugging and other purposes.//\nParser.prototype.getDFAStrings = function() {\n\treturn this._interp.decisionToDFA.toString();\n};\n// For debugging and other purposes.//\nParser.prototype.dumpDFA = function() {\n\tvar seenOne = false;\n\tfor (var i = 0; i < this._interp.decisionToDFA.length; i++) {\n\t\tvar dfa = this._interp.decisionToDFA[i];\n\t\tif (dfa.states.length > 0) {\n\t\t\tif (seenOne) {\n\t\t\t\tconsole.log();\n\t\t\t}\n\t\t\tthis.printer.println(\"Decision \" + dfa.decision + \":\");\n\t\t\tthis.printer.print(dfa.toString(this.literalNames, this.symbolicNames));\n\t\t\tseenOne = true;\n\t\t}\n\t}\n};\n\n/*\n\"\t\t\tprinter = function() {\\r\\n\" +\n\"\t\t\t\tthis.println = function(s) { document.getElementById('output') += s + '\\\\n'; }\\r\\n\" +\n\"\t\t\t\tthis.print = function(s) { document.getElementById('output') += s; }\\r\\n\" +\n\"\t\t\t};\\r\\n\" +\n*/\n\nParser.prototype.getSourceName = function() {\n\treturn this._input.sourceName;\n};\n\n// During a parse is sometimes useful to listen in on the rule entry and exit\n// events as well as token matches. this is for quick and dirty debugging.\n//\nParser.prototype.setTrace = function(trace) {\n\tif (!trace) {\n\t\tthis.removeParseListener(this._tracer);\n\t\tthis._tracer = null;\n\t} else {\n\t\tif (this._tracer !== null) {\n\t\t\tthis.removeParseListener(this._tracer);\n\t\t}\n\t\tthis._tracer = new TraceListener(this);\n\t\tthis.addParseListener(this._tracer);\n\t}\n};\n\nexports.Parser = Parser;","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Vuelidate = Vuelidate;\nexports.validationMixin = exports.default = void 0;\nObject.defineProperty(exports, \"withParams\", {\n enumerable: true,\n get: function get() {\n return _params.withParams;\n }\n});\n\nvar _vval = require(\"./vval\");\n\nvar _params = require(\"./params\");\n\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _iterableToArray(iter) { if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) { symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); } keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }\n\nfunction _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }\n\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar NIL = function NIL() {\n return null;\n};\n\nvar buildFromKeys = function buildFromKeys(keys, fn, keyFn) {\n return keys.reduce(function (build, key) {\n build[keyFn ? keyFn(key) : key] = fn(key);\n return build;\n }, {});\n};\n\nfunction isFunction(val) {\n return typeof val === 'function';\n}\n\nfunction isObject(val) {\n return val !== null && (_typeof(val) === 'object' || isFunction(val));\n}\n\nfunction isPromise(object) {\n return isObject(object) && isFunction(object.then);\n}\n\nvar getPath = function getPath(ctx, obj, path, fallback) {\n if (typeof path === 'function') {\n return path.call(ctx, obj, fallback);\n }\n\n path = Array.isArray(path) ? path : path.split('.');\n\n for (var i = 0; i < path.length; i++) {\n if (obj && _typeof(obj) === 'object') {\n obj = obj[path[i]];\n } else {\n return fallback;\n }\n }\n\n return typeof obj === 'undefined' ? fallback : obj;\n};\n\nvar __isVuelidateAsyncVm = '__isVuelidateAsyncVm';\n\nfunction makePendingAsyncVm(Vue, promise) {\n var asyncVm = new Vue({\n data: {\n p: true,\n v: false\n }\n });\n promise.then(function (value) {\n asyncVm.p = false;\n asyncVm.v = value;\n }, function (error) {\n asyncVm.p = false;\n asyncVm.v = false;\n throw error;\n });\n asyncVm[__isVuelidateAsyncVm] = true;\n return asyncVm;\n}\n\nvar validationGetters = {\n $invalid: function $invalid() {\n var _this = this;\n\n var proxy = this.proxy;\n return this.nestedKeys.some(function (nested) {\n return _this.refProxy(nested).$invalid;\n }) || this.ruleKeys.some(function (rule) {\n return !proxy[rule];\n });\n },\n $dirty: function $dirty() {\n var _this2 = this;\n\n if (this.dirty) {\n return true;\n }\n\n if (this.nestedKeys.length === 0) {\n return false;\n }\n\n return this.nestedKeys.every(function (key) {\n return _this2.refProxy(key).$dirty;\n });\n },\n $anyDirty: function $anyDirty() {\n var _this3 = this;\n\n if (this.dirty) {\n return true;\n }\n\n if (this.nestedKeys.length === 0) {\n return false;\n }\n\n return this.nestedKeys.some(function (key) {\n return _this3.refProxy(key).$anyDirty;\n });\n },\n $error: function $error() {\n return this.$dirty && !this.$pending && this.$invalid;\n },\n $anyError: function $anyError() {\n var _this4 = this;\n\n if (this.$error) return true;\n return this.nestedKeys.some(function (key) {\n return _this4.refProxy(key).$anyError;\n });\n },\n $pending: function $pending() {\n var _this5 = this;\n\n return this.ruleKeys.some(function (key) {\n return _this5.getRef(key).$pending;\n }) || this.nestedKeys.some(function (key) {\n return _this5.refProxy(key).$pending;\n });\n },\n $params: function $params() {\n var _this6 = this;\n\n var vals = this.validations;\n return _objectSpread(_objectSpread({}, buildFromKeys(this.nestedKeys, function (key) {\n return vals[key] && vals[key].$params || null;\n })), buildFromKeys(this.ruleKeys, function (key) {\n return _this6.getRef(key).$params;\n }));\n }\n};\n\nfunction setDirtyRecursive(newState) {\n this.dirty = newState;\n var proxy = this.proxy;\n var method = newState ? '$touch' : '$reset';\n this.nestedKeys.forEach(function (key) {\n proxy[key][method]();\n });\n}\n\nvar validationMethods = {\n $touch: function $touch() {\n setDirtyRecursive.call(this, true);\n },\n $reset: function $reset() {\n setDirtyRecursive.call(this, false);\n },\n $flattenParams: function $flattenParams() {\n var proxy = this.proxy;\n var params = [];\n\n for (var key in this.$params) {\n if (this.isNested(key)) {\n var childParams = proxy[key].$flattenParams();\n\n for (var j = 0; j < childParams.length; j++) {\n childParams[j].path.unshift(key);\n }\n\n params = params.concat(childParams);\n } else {\n params.push({\n path: [],\n name: key,\n params: this.$params[key]\n });\n }\n }\n\n return params;\n }\n};\nvar getterNames = Object.keys(validationGetters);\nvar methodNames = Object.keys(validationMethods);\nvar _cachedComponent = null;\n\nvar getComponent = function getComponent(Vue) {\n if (_cachedComponent) {\n return _cachedComponent;\n }\n\n var VBase = Vue.extend({\n computed: {\n refs: function refs() {\n var oldVval = this._vval;\n this._vval = this.children;\n (0, _vval.patchChildren)(oldVval, this._vval);\n var refs = {};\n\n this._vval.forEach(function (c) {\n refs[c.key] = c.vm;\n });\n\n return refs;\n }\n },\n beforeCreate: function beforeCreate() {\n this._vval = null;\n },\n beforeDestroy: function beforeDestroy() {\n if (this._vval) {\n (0, _vval.patchChildren)(this._vval);\n this._vval = null;\n }\n },\n methods: {\n getModel: function getModel() {\n return this.lazyModel ? this.lazyModel(this.prop) : this.model;\n },\n getModelKey: function getModelKey(key) {\n var model = this.getModel();\n\n if (model) {\n return model[key];\n }\n },\n hasIter: function hasIter() {\n return false;\n }\n }\n });\n var ValidationRule = VBase.extend({\n data: function data() {\n return {\n rule: null,\n lazyModel: null,\n model: null,\n lazyParentModel: null,\n rootModel: null\n };\n },\n methods: {\n runRule: function runRule(parent) {\n var model = this.getModel();\n (0, _params.pushParams)();\n var rawOutput = this.rule.call(this.rootModel, model, parent);\n var output = isPromise(rawOutput) ? makePendingAsyncVm(Vue, rawOutput) : rawOutput;\n var rawParams = (0, _params.popParams)();\n var params = rawParams && rawParams.$sub ? rawParams.$sub.length > 1 ? rawParams : rawParams.$sub[0] : null;\n return {\n output: output,\n params: params\n };\n }\n },\n computed: {\n run: function run() {\n var _this7 = this;\n\n var parent = this.lazyParentModel();\n\n var isArrayDependant = Array.isArray(parent) && parent.__ob__;\n\n if (isArrayDependant) {\n var arrayDep = parent.__ob__.dep;\n arrayDep.depend();\n var target = arrayDep.constructor.target;\n\n if (!this._indirectWatcher) {\n var Watcher = target.constructor;\n this._indirectWatcher = new Watcher(this, function () {\n return _this7.runRule(parent);\n }, null, {\n lazy: true\n });\n }\n\n var model = this.getModel();\n\n if (!this._indirectWatcher.dirty && this._lastModel === model) {\n this._indirectWatcher.depend();\n\n return target.value;\n }\n\n this._lastModel = model;\n\n this._indirectWatcher.evaluate();\n\n this._indirectWatcher.depend();\n } else if (this._indirectWatcher) {\n this._indirectWatcher.teardown();\n\n this._indirectWatcher = null;\n }\n\n return this._indirectWatcher ? this._indirectWatcher.value : this.runRule(parent);\n },\n $params: function $params() {\n return this.run.params;\n },\n proxy: function proxy() {\n var output = this.run.output;\n\n if (output[__isVuelidateAsyncVm]) {\n return !!output.v;\n }\n\n return !!output;\n },\n $pending: function $pending() {\n var output = this.run.output;\n\n if (output[__isVuelidateAsyncVm]) {\n return output.p;\n }\n\n return false;\n }\n },\n destroyed: function destroyed() {\n if (this._indirectWatcher) {\n this._indirectWatcher.teardown();\n\n this._indirectWatcher = null;\n }\n }\n });\n var Validation = VBase.extend({\n data: function data() {\n return {\n dirty: false,\n validations: null,\n lazyModel: null,\n model: null,\n prop: null,\n lazyParentModel: null,\n rootModel: null\n };\n },\n methods: _objectSpread(_objectSpread({}, validationMethods), {}, {\n refProxy: function refProxy(key) {\n return this.getRef(key).proxy;\n },\n getRef: function getRef(key) {\n return this.refs[key];\n },\n isNested: function isNested(key) {\n return typeof this.validations[key] !== 'function';\n }\n }),\n computed: _objectSpread(_objectSpread({}, validationGetters), {}, {\n nestedKeys: function nestedKeys() {\n return this.keys.filter(this.isNested);\n },\n ruleKeys: function ruleKeys() {\n var _this8 = this;\n\n return this.keys.filter(function (k) {\n return !_this8.isNested(k);\n });\n },\n keys: function keys() {\n return Object.keys(this.validations).filter(function (k) {\n return k !== '$params';\n });\n },\n proxy: function proxy() {\n var _this9 = this;\n\n var keyDefs = buildFromKeys(this.keys, function (key) {\n return {\n enumerable: true,\n configurable: true,\n get: function get() {\n return _this9.refProxy(key);\n }\n };\n });\n var getterDefs = buildFromKeys(getterNames, function (key) {\n return {\n enumerable: true,\n configurable: true,\n get: function get() {\n return _this9[key];\n }\n };\n });\n var methodDefs = buildFromKeys(methodNames, function (key) {\n return {\n enumerable: false,\n configurable: true,\n get: function get() {\n return _this9[key];\n }\n };\n });\n var iterDefs = this.hasIter() ? {\n $iter: {\n enumerable: true,\n value: Object.defineProperties({}, _objectSpread({}, keyDefs))\n }\n } : {};\n return Object.defineProperties({}, _objectSpread(_objectSpread(_objectSpread(_objectSpread({}, keyDefs), iterDefs), {}, {\n $model: {\n enumerable: true,\n get: function get() {\n var parent = _this9.lazyParentModel();\n\n if (parent != null) {\n return parent[_this9.prop];\n } else {\n return null;\n }\n },\n set: function set(value) {\n var parent = _this9.lazyParentModel();\n\n if (parent != null) {\n parent[_this9.prop] = value;\n\n _this9.$touch();\n }\n }\n }\n }, getterDefs), methodDefs));\n },\n children: function children() {\n var _this10 = this;\n\n return [].concat(_toConsumableArray(this.nestedKeys.map(function (key) {\n return renderNested(_this10, key);\n })), _toConsumableArray(this.ruleKeys.map(function (key) {\n return renderRule(_this10, key);\n }))).filter(Boolean);\n }\n })\n });\n var GroupValidation = Validation.extend({\n methods: {\n isNested: function isNested(key) {\n return typeof this.validations[key]() !== 'undefined';\n },\n getRef: function getRef(key) {\n var vm = this;\n return {\n get proxy() {\n return vm.validations[key]() || false;\n }\n\n };\n }\n }\n });\n var EachValidation = Validation.extend({\n computed: {\n keys: function keys() {\n var model = this.getModel();\n\n if (isObject(model)) {\n return Object.keys(model);\n } else {\n return [];\n }\n },\n tracker: function tracker() {\n var _this11 = this;\n\n var trackBy = this.validations.$trackBy;\n return trackBy ? function (key) {\n return \"\".concat(getPath(_this11.rootModel, _this11.getModelKey(key), trackBy));\n } : function (x) {\n return \"\".concat(x);\n };\n },\n getModelLazy: function getModelLazy() {\n var _this12 = this;\n\n return function () {\n return _this12.getModel();\n };\n },\n children: function children() {\n var _this13 = this;\n\n var def = this.validations;\n var model = this.getModel();\n\n var validations = _objectSpread({}, def);\n\n delete validations['$trackBy'];\n var usedTracks = {};\n return this.keys.map(function (key) {\n var track = _this13.tracker(key);\n\n if (usedTracks.hasOwnProperty(track)) {\n return null;\n }\n\n usedTracks[track] = true;\n return (0, _vval.h)(Validation, track, {\n validations: validations,\n prop: key,\n lazyParentModel: _this13.getModelLazy,\n model: model[key],\n rootModel: _this13.rootModel\n });\n }).filter(Boolean);\n }\n },\n methods: {\n isNested: function isNested() {\n return true;\n },\n getRef: function getRef(key) {\n return this.refs[this.tracker(key)];\n },\n hasIter: function hasIter() {\n return true;\n }\n }\n });\n\n var renderNested = function renderNested(vm, key) {\n if (key === '$each') {\n return (0, _vval.h)(EachValidation, key, {\n validations: vm.validations[key],\n lazyParentModel: vm.lazyParentModel,\n prop: key,\n lazyModel: vm.getModel,\n rootModel: vm.rootModel\n });\n }\n\n var validations = vm.validations[key];\n\n if (Array.isArray(validations)) {\n var root = vm.rootModel;\n var refVals = buildFromKeys(validations, function (path) {\n return function () {\n return getPath(root, root.$v, path);\n };\n }, function (v) {\n return Array.isArray(v) ? v.join('.') : v;\n });\n return (0, _vval.h)(GroupValidation, key, {\n validations: refVals,\n lazyParentModel: NIL,\n prop: key,\n lazyModel: NIL,\n rootModel: root\n });\n }\n\n return (0, _vval.h)(Validation, key, {\n validations: validations,\n lazyParentModel: vm.getModel,\n prop: key,\n lazyModel: vm.getModelKey,\n rootModel: vm.rootModel\n });\n };\n\n var renderRule = function renderRule(vm, key) {\n return (0, _vval.h)(ValidationRule, key, {\n rule: vm.validations[key],\n lazyParentModel: vm.lazyParentModel,\n lazyModel: vm.getModel,\n rootModel: vm.rootModel\n });\n };\n\n _cachedComponent = {\n VBase: VBase,\n Validation: Validation\n };\n return _cachedComponent;\n};\n\nvar _cachedVue = null;\n\nfunction getVue(rootVm) {\n if (_cachedVue) return _cachedVue;\n var Vue = rootVm.constructor;\n\n while (Vue.super) {\n Vue = Vue.super;\n }\n\n _cachedVue = Vue;\n return Vue;\n}\n\nvar validateModel = function validateModel(model, validations) {\n var Vue = getVue(model);\n\n var _getComponent = getComponent(Vue),\n Validation = _getComponent.Validation,\n VBase = _getComponent.VBase;\n\n var root = new VBase({\n computed: {\n children: function children() {\n var vals = typeof validations === 'function' ? validations.call(model) : validations;\n return [(0, _vval.h)(Validation, '$v', {\n validations: vals,\n lazyParentModel: NIL,\n prop: '$v',\n model: model,\n rootModel: model\n })];\n }\n }\n });\n return root;\n};\n\nvar validationMixin = {\n data: function data() {\n var vals = this.$options.validations;\n\n if (vals) {\n this._vuelidate = validateModel(this, vals);\n }\n\n return {};\n },\n beforeCreate: function beforeCreate() {\n var options = this.$options;\n var vals = options.validations;\n if (!vals) return;\n if (!options.computed) options.computed = {};\n if (options.computed.$v) return;\n\n options.computed.$v = function () {\n return this._vuelidate ? this._vuelidate.refs.$v.proxy : null;\n };\n },\n beforeDestroy: function beforeDestroy() {\n if (this._vuelidate) {\n this._vuelidate.$destroy();\n\n this._vuelidate = null;\n }\n }\n};\nexports.validationMixin = validationMixin;\n\nfunction Vuelidate(Vue) {\n Vue.mixin(validationMixin);\n}\n\nvar _default = Vuelidate;\nexports.default = _default;","var fails = require('../internals/fails');\nvar wellKnownSymbol = require('../internals/well-known-symbol');\nvar V8_VERSION = require('../internals/engine-v8-version');\n\nvar SPECIES = wellKnownSymbol('species');\n\nmodule.exports = function (METHOD_NAME) {\n // We can't use this feature detection in V8 since it causes\n // deoptimization and serious performance degradation\n // https://github.com/zloirock/core-js/issues/677\n return V8_VERSION >= 51 || !fails(function () {\n var array = [];\n var constructor = array.constructor = {};\n constructor[SPECIES] = function () {\n return { foo: 1 };\n };\n return array[METHOD_NAME](Boolean).foo !== 1;\n });\n};\n","// Components\nimport VWindow from './VWindow'\n\n// Mixins\nimport Bootable from '../../mixins/bootable'\nimport { factory as GroupableFactory } from '../../mixins/groupable'\n\n// Directives\nimport Touch from '../../directives/touch'\n\n// Utilities\nimport { convertToUnit } from '../../util/helpers'\nimport mixins, { ExtractVue } from '../../util/mixins'\n\n// Types\nimport { VNode } from 'vue'\n\nconst baseMixins = mixins(\n Bootable,\n GroupableFactory('windowGroup', 'v-window-item', 'v-window')\n)\n\ninterface options extends ExtractVue
If the state number is not known, this method returns -1.
\n\n//\n// Gets the set of input symbols which could potentially follow the\n// previously matched symbol at the time this exception was thrown.\n//\n//If the set of expected tokens is not known and could not be computed,\n// this method returns {@code null}.
\n//\n// @return The set of token types that could potentially follow the current\n// state in the ATN, or {@code null} if the information is not available.\n// /\nRecognitionException.prototype.getExpectedTokens = function() {\n if (this.recognizer!==null) {\n return this.recognizer.atn.getExpectedTokens(this.offendingState, this.ctx);\n } else {\n return null;\n }\n};\n\nRecognitionException.prototype.toString = function() {\n return this.message;\n};\n\nfunction LexerNoViableAltException(lexer, input, startIndex, deadEndConfigs) {\n\tRecognitionException.call(this, {message:\"\", recognizer:lexer, input:input, ctx:null});\n this.startIndex = startIndex;\n this.deadEndConfigs = deadEndConfigs;\n return this;\n}\n\nLexerNoViableAltException.prototype = Object.create(RecognitionException.prototype);\nLexerNoViableAltException.prototype.constructor = LexerNoViableAltException;\n\nLexerNoViableAltException.prototype.toString = function() {\n var symbol = \"\";\n if (this.startIndex >= 0 && this.startIndex < this.input.size) {\n symbol = this.input.getText((this.startIndex,this.startIndex));\n }\n return \"LexerNoViableAltException\" + symbol;\n};\n\n// Indicates that the parser could not decide which of two or more paths\n// to take based upon the remaining input. It tracks the starting token\n// of the offending input and also knows where the parser was\n// in the various paths when the error. Reported by reportNoViableAlternative()\n//\nfunction NoViableAltException(recognizer, input, startToken, offendingToken, deadEndConfigs, ctx) {\n\tctx = ctx || recognizer._ctx;\n\toffendingToken = offendingToken || recognizer.getCurrentToken();\n\tstartToken = startToken || recognizer.getCurrentToken();\n\tinput = input || recognizer.getInputStream();\n\tRecognitionException.call(this, {message:\"\", recognizer:recognizer, input:input, ctx:ctx});\n // Which configurations did we try at input.index() that couldn't match\n\t// input.LT(1)?//\n this.deadEndConfigs = deadEndConfigs;\n // The token object at the start index; the input stream might\n // not be buffering tokens so get a reference to it. (At the\n // time the error occurred, of course the stream needs to keep a\n // buffer all of the tokens but later we might not have access to those.)\n this.startToken = startToken;\n this.offendingToken = offendingToken;\n}\n\nNoViableAltException.prototype = Object.create(RecognitionException.prototype);\nNoViableAltException.prototype.constructor = NoViableAltException;\n\n// This signifies any kind of mismatched input exceptions such as\n// when the current input does not match the expected token.\n//\nfunction InputMismatchException(recognizer) {\n\tRecognitionException.call(this, {message:\"\", recognizer:recognizer, input:recognizer.getInputStream(), ctx:recognizer._ctx});\n this.offendingToken = recognizer.getCurrentToken();\n}\n\nInputMismatchException.prototype = Object.create(RecognitionException.prototype);\nInputMismatchException.prototype.constructor = InputMismatchException;\n\n// A semantic predicate failed during validation. Validation of predicates\n// occurs when normally parsing the alternative just like matching a token.\n// Disambiguating predicate evaluation occurs when we test a predicate during\n// prediction.\n\nfunction FailedPredicateException(recognizer, predicate, message) {\n\tRecognitionException.call(this, {message:this.formatMessage(predicate,message || null), recognizer:recognizer,\n input:recognizer.getInputStream(), ctx:recognizer._ctx});\n var s = recognizer._interp.atn.states[recognizer.state];\n var trans = s.transitions[0];\n if (trans instanceof PredicateTransition) {\n this.ruleIndex = trans.ruleIndex;\n this.predicateIndex = trans.predIndex;\n } else {\n this.ruleIndex = 0;\n this.predicateIndex = 0;\n }\n this.predicate = predicate;\n this.offendingToken = recognizer.getCurrentToken();\n return this;\n}\n\nFailedPredicateException.prototype = Object.create(RecognitionException.prototype);\nFailedPredicateException.prototype.constructor = FailedPredicateException;\n\nFailedPredicateException.prototype.formatMessage = function(predicate, message) {\n if (message !==null) {\n return message;\n } else {\n return \"failed predicate: {\" + predicate + \"}?\";\n }\n};\n\nfunction ParseCancellationException() {\n\tError.call(this);\n\tError.captureStackTrace(this, ParseCancellationException);\n\treturn this;\n}\n\nParseCancellationException.prototype = Object.create(Error.prototype);\nParseCancellationException.prototype.constructor = ParseCancellationException;\n\nexports.RecognitionException = RecognitionException;\nexports.NoViableAltException = NoViableAltException;\nexports.LexerNoViableAltException = LexerNoViableAltException;\nexports.InputMismatchException = InputMismatchException;\nexports.FailedPredicateException = FailedPredicateException;\nexports.ParseCancellationException = ParseCancellationException;\n","/* globals __VUE_SSR_CONTEXT__ */\n\n// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).\n// This module is a runtime utility for cleaner component module output and will\n// be included in the final webpack user bundle.\n\nexport default function normalizeComponent (\n scriptExports,\n render,\n staticRenderFns,\n functionalTemplate,\n injectStyles,\n scopeId,\n moduleIdentifier, /* server only */\n shadowMode /* vue-cli only */\n) {\n // Vue.extend constructor export interop\n var options = typeof scriptExports === 'function'\n ? scriptExports.options\n : scriptExports\n\n // render functions\n if (render) {\n options.render = render\n options.staticRenderFns = staticRenderFns\n options._compiled = true\n }\n\n // functional template\n if (functionalTemplate) {\n options.functional = true\n }\n\n // scopedId\n if (scopeId) {\n options._scopeId = 'data-v-' + scopeId\n }\n\n var hook\n if (moduleIdentifier) { // server build\n hook = function (context) {\n // 2.3 injection\n context =\n context || // cached call\n (this.$vnode && this.$vnode.ssrContext) || // stateful\n (this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional\n // 2.2 with runInNewContext: true\n if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {\n context = __VUE_SSR_CONTEXT__\n }\n // inject component styles\n if (injectStyles) {\n injectStyles.call(this, context)\n }\n // register component module identifier for async chunk inferrence\n if (context && context._registeredComponents) {\n context._registeredComponents.add(moduleIdentifier)\n }\n }\n // used by ssr in case component is cached and beforeCreate\n // never gets called\n options._ssrRegister = hook\n } else if (injectStyles) {\n hook = shadowMode\n ? function () {\n injectStyles.call(\n this,\n (options.functional ? this.parent : this).$root.$options.shadowRoot\n )\n }\n : injectStyles\n }\n\n if (hook) {\n if (options.functional) {\n // for template-only hot-reload because in that case the render fn doesn't\n // go through the normalizer\n options._injectStyles = hook\n // register for functional component in vue file\n var originalRender = options.render\n options.render = function renderWithStyleInjection (h, context) {\n hook.call(context)\n return originalRender(h, context)\n }\n } else {\n // inject component registration as beforeCreate hook\n var existing = options.beforeCreate\n options.beforeCreate = existing\n ? [].concat(existing, hook)\n : [hook]\n }\n }\n\n return {\n exports: scriptExports,\n options: options\n }\n}\n","import arrayLikeToArray from \"./arrayLikeToArray.js\";\nexport default function _arrayWithoutHoles(arr) {\n if (Array.isArray(arr)) return arrayLikeToArray(arr);\n}","export default function _iterableToArray(iter) {\n if (typeof Symbol !== \"undefined\" && iter[Symbol.iterator] != null || iter[\"@@iterator\"] != null) return Array.from(iter);\n}","export default function _nonIterableSpread() {\n throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\");\n}","import arrayWithoutHoles from \"./arrayWithoutHoles.js\";\nimport iterableToArray from \"./iterableToArray.js\";\nimport unsupportedIterableToArray from \"./unsupportedIterableToArray.js\";\nimport nonIterableSpread from \"./nonIterableSpread.js\";\nexport default function _toConsumableArray(arr) {\n return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();\n}","\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n value: true\n});\nexports.Prefix = void 0;\n\n/**\n * Prefix objects are defined in this file.\n */\n\n/**\n * This class implements the prefix object. Prefixes are used as multipliers\n * for units, e.g., km for kilometers\n *\n * @author Lee Mericle, based on java version by Gunther Schadow\n *\n */\nvar Ucum = require('./config.js');\n\nclass Prefix {\n /**\n * Creates a single prefix object.\n *\n * @param attrs a hash of the values to use in creating the prefix object.\n * They should be:\n * code_ - which is the case-sensitive code used for the prefix,\n * e.g., k for kilo\n * ciCode_ - which is the case-insensitive code used for the prefix,\n * e.g., K for kilo\n * name_ - which is the name of the prefix, e.g., kilo\n * printSymbol_ - which is the print symbol for the prefix, e.g., k for kilo\n * value_ - which is teh value to use in multiplying the magnitude of\n * a unit, e.g., for a prefix of c the value will be .01.\n * exp_ - which is the exponent used to get the value. For decimal based\n * prefixes the base is 10 and the exp_ is applied to 10, e.g., for a\n * prefix of c, the exponent will be -2. For prefixes that are not\n * decimal based, this will be null (but must not be undefined).\n *\n * @throws an error if the not all required parameters are provided\n */\n constructor(attrs) {\n if (attrs['code_'] === undefined || attrs['code_'] === null || attrs['name_'] === undefined || attrs['name_'] === null || attrs['value_'] === undefined || attrs['value_'] === null || attrs['exp_'] === undefined) {\n throw new Error('Prefix constructor called missing one or more parameters. ' + 'Prefix codes (cs or ci), name, value and exponent must all be specified ' + 'and all but the exponent must not be null.');\n }\n /**\n * The prefix code, e.g., k for kilo. This should be the case-sensitive\n * code. Since there's no way to check to see if it's the case-sensitive\n * one as opposed to the case-insensitive one (because although\n * case-insensitive codes all seem to be uppercase, some case-sensitive\n * codes are also all uppercase), we'll just have to believe that the\n * right one was passed in.\n */\n\n\n this.code_ = attrs['code_'];\n /**\n * The case-insensitive code, e.g., K for kilo\n */\n\n this.ciCode_ = attrs['ciCode_'];\n /**\n * The prefix name, e.g., kilo\n */\n\n this.name_ = attrs['name_'];\n /**\n * The printSymbol for the prefix, e.g., k for kilo\n */\n\n this.printSymbol_ = attrs['printSymbol_'];\n /**\n * The value to use in multiplying the magnitude of a unit\n */\n\n if (typeof attrs['value_'] === 'string') this.value_ = parseFloat(attrs['value_']);else this.value_ = attrs['value_'];\n /**\n * The exponent used to create the value from 10. For prefixes that are\n * not based on 10, this will be null.\n */\n\n this.exp_ = attrs['exp_'];\n } // end constructor\n\n /**\n * Returns the value for the current prefix object\n * @return the value for the prefix object with the specified code\n * */\n\n\n getValue() {\n return this.value_;\n }\n /**\n * Returns the prefix code for the current prefix object\n * @return the code for the current prefix object\n */\n\n\n getCode() {\n return this.code_;\n }\n /**\n * Returns the case-insensitive code for the current prefix object\n * @return the case_insensitive code for the current prefix object\n */\n\n\n getCiCode() {\n return this.ciCode_;\n }\n /**\n * Returns the prefix name for the current prefix object\n * @return the name for the current prefix object\n */\n\n\n getName() {\n return this.name_;\n }\n /**\n * Returns the print symbol for the current prefix object\n * @return the print symbol for the current prefix object\n */\n\n\n getPrintSymbol() {\n return this.printSymbol_;\n }\n /**\n * Returns the exponent for the current prefix object\n * @return the exponent for the current prefix object\n */\n\n\n getExp() {\n return this.exp_;\n }\n /**\n * Provides way to tell if one prefix equals another. The second prefix\n * must match all attribute values.\n *\n * @param prefix2 prefix object to check for a match\n * @return true for a match; false if one or more attributes don't match\n */\n\n\n equals(prefix2) {\n return this.code_ === prefix2.code_ && this.ciCode_ === prefix2.ciCode_ && this.name_ === prefix2.name_ && this.printSymbol_ === prefix2.printSymbol_ && this.value_ === prefix2.value_ && this.exp_ === prefix2.exp_;\n }\n\n} // end Prefix class\n\n\nexports.Prefix = Prefix;\n//# sourceMappingURL=prefix.js.map\n","import Vue, { VNode } from 'vue'\nimport VProgressLinear from '../../components/VProgressLinear'\n\ninterface colorable extends Vue {\n color?: string\n}\n\n/**\n * Loadable\n *\n * @mixin\n *\n * Used to add linear progress bar to components\n * Can use a default bar with a specific color\n * or designate a custom progress linear bar\n */\n/* @vue/component */\nexport default Vue.extend, or missing
. Bailing hydration and performing ' +\n 'full client-side render.'\n );\n }\n }\n // either not server-rendered, or hydration failed.\n // create an empty node and replace it\n oldVnode = emptyNodeAt(oldVnode);\n }\n\n // replacing existing element\n var oldElm = oldVnode.elm;\n var parentElm = nodeOps.parentNode(oldElm);\n\n // create new node\n createElm(\n vnode,\n insertedVnodeQueue,\n // extremely rare edge case: do not insert if old element is in a\n // leaving transition. Only happens when combining transition +\n // keep-alive + HOCs. (#4590)\n oldElm._leaveCb ? null : parentElm,\n nodeOps.nextSibling(oldElm)\n );\n\n // update parent placeholder node element, recursively\n if (isDef(vnode.parent)) {\n var ancestor = vnode.parent;\n var patchable = isPatchable(vnode);\n while (ancestor) {\n for (var i = 0; i < cbs.destroy.length; ++i) {\n cbs.destroy[i](ancestor);\n }\n ancestor.elm = vnode.elm;\n if (patchable) {\n for (var i$1 = 0; i$1 < cbs.create.length; ++i$1) {\n cbs.create[i$1](emptyNode, ancestor);\n }\n // #6513\n // invoke insert hooks that may have been merged by create hooks.\n // e.g. for directives that uses the \"inserted\" hook.\n var insert = ancestor.data.hook.insert;\n if (insert.merged) {\n // start at index 1 to avoid re-invoking component mounted hook\n for (var i$2 = 1; i$2 < insert.fns.length; i$2++) {\n insert.fns[i$2]();\n }\n }\n } else {\n registerRef(ancestor);\n }\n ancestor = ancestor.parent;\n }\n }\n\n // destroy old node\n if (isDef(parentElm)) {\n removeVnodes([oldVnode], 0, 0);\n } else if (isDef(oldVnode.tag)) {\n invokeDestroyHook(oldVnode);\n }\n }\n }\n\n invokeInsertHook(vnode, insertedVnodeQueue, isInitialPatch);\n return vnode.elm\n }\n}\n\n/* */\n\nvar directives = {\n create: updateDirectives,\n update: updateDirectives,\n destroy: function unbindDirectives (vnode) {\n updateDirectives(vnode, emptyNode);\n }\n};\n\nfunction updateDirectives (oldVnode, vnode) {\n if (oldVnode.data.directives || vnode.data.directives) {\n _update(oldVnode, vnode);\n }\n}\n\nfunction _update (oldVnode, vnode) {\n var isCreate = oldVnode === emptyNode;\n var isDestroy = vnode === emptyNode;\n var oldDirs = normalizeDirectives$1(oldVnode.data.directives, oldVnode.context);\n var newDirs = normalizeDirectives$1(vnode.data.directives, vnode.context);\n\n var dirsWithInsert = [];\n var dirsWithPostpatch = [];\n\n var key, oldDir, dir;\n for (key in newDirs) {\n oldDir = oldDirs[key];\n dir = newDirs[key];\n if (!oldDir) {\n // new directive, bind\n callHook$1(dir, 'bind', vnode, oldVnode);\n if (dir.def && dir.def.inserted) {\n dirsWithInsert.push(dir);\n }\n } else {\n // existing directive, update\n dir.oldValue = oldDir.value;\n dir.oldArg = oldDir.arg;\n callHook$1(dir, 'update', vnode, oldVnode);\n if (dir.def && dir.def.componentUpdated) {\n dirsWithPostpatch.push(dir);\n }\n }\n }\n\n if (dirsWithInsert.length) {\n var callInsert = function () {\n for (var i = 0; i < dirsWithInsert.length; i++) {\n callHook$1(dirsWithInsert[i], 'inserted', vnode, oldVnode);\n }\n };\n if (isCreate) {\n mergeVNodeHook(vnode, 'insert', callInsert);\n } else {\n callInsert();\n }\n }\n\n if (dirsWithPostpatch.length) {\n mergeVNodeHook(vnode, 'postpatch', function () {\n for (var i = 0; i < dirsWithPostpatch.length; i++) {\n callHook$1(dirsWithPostpatch[i], 'componentUpdated', vnode, oldVnode);\n }\n });\n }\n\n if (!isCreate) {\n for (key in oldDirs) {\n if (!newDirs[key]) {\n // no longer present, unbind\n callHook$1(oldDirs[key], 'unbind', oldVnode, oldVnode, isDestroy);\n }\n }\n }\n}\n\nvar emptyModifiers = Object.create(null);\n\nfunction normalizeDirectives$1 (\n dirs,\n vm\n) {\n var res = Object.create(null);\n if (!dirs) {\n // $flow-disable-line\n return res\n }\n var i, dir;\n for (i = 0; i < dirs.length; i++) {\n dir = dirs[i];\n if (!dir.modifiers) {\n // $flow-disable-line\n dir.modifiers = emptyModifiers;\n }\n res[getRawDirName(dir)] = dir;\n dir.def = resolveAsset(vm.$options, 'directives', dir.name, true);\n }\n // $flow-disable-line\n return res\n}\n\nfunction getRawDirName (dir) {\n return dir.rawName || ((dir.name) + \".\" + (Object.keys(dir.modifiers || {}).join('.')))\n}\n\nfunction callHook$1 (dir, hook, vnode, oldVnode, isDestroy) {\n var fn = dir.def && dir.def[hook];\n if (fn) {\n try {\n fn(vnode.elm, dir, vnode, oldVnode, isDestroy);\n } catch (e) {\n handleError(e, vnode.context, (\"directive \" + (dir.name) + \" \" + hook + \" hook\"));\n }\n }\n}\n\nvar baseModules = [\n ref,\n directives\n];\n\n/* */\n\nfunction updateAttrs (oldVnode, vnode) {\n var opts = vnode.componentOptions;\n if (isDef(opts) && opts.Ctor.options.inheritAttrs === false) {\n return\n }\n if (isUndef(oldVnode.data.attrs) && isUndef(vnode.data.attrs)) {\n return\n }\n var key, cur, old;\n var elm = vnode.elm;\n var oldAttrs = oldVnode.data.attrs || {};\n var attrs = vnode.data.attrs || {};\n // clone observed objects, as the user probably wants to mutate it\n if (isDef(attrs.__ob__)) {\n attrs = vnode.data.attrs = extend({}, attrs);\n }\n\n for (key in attrs) {\n cur = attrs[key];\n old = oldAttrs[key];\n if (old !== cur) {\n setAttr(elm, key, cur, vnode.data.pre);\n }\n }\n // #4391: in IE9, setting type can reset value for input[type=radio]\n // #6666: IE/Edge forces progress value down to 1 before setting a max\n /* istanbul ignore if */\n if ((isIE || isEdge) && attrs.value !== oldAttrs.value) {\n setAttr(elm, 'value', attrs.value);\n }\n for (key in oldAttrs) {\n if (isUndef(attrs[key])) {\n if (isXlink(key)) {\n elm.removeAttributeNS(xlinkNS, getXlinkProp(key));\n } else if (!isEnumeratedAttr(key)) {\n elm.removeAttribute(key);\n }\n }\n }\n}\n\nfunction setAttr (el, key, value, isInPre) {\n if (isInPre || el.tagName.indexOf('-') > -1) {\n baseSetAttr(el, key, value);\n } else if (isBooleanAttr(key)) {\n // set attribute for blank value\n // e.g. \n if (isFalsyAttrValue(value)) {\n el.removeAttribute(key);\n } else {\n // technically allowfullscreen is a boolean attribute for