UNPKG

@player-ui/player

Version:

1,315 lines 378 kB
"use strict"; function _array_like_to_array(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; } function _array_with_holes(arr) { if (Array.isArray(arr)) return arr; } function _array_without_holes(arr) { if (Array.isArray(arr)) return _array_like_to_array(arr); } function _assert_this_initialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } function _async_to_generator(fn) { return function() { var self = this, args = arguments; return new Promise(function(resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } function _class_call_check(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _construct(Parent, args, Class) { if (_is_native_reflect_construct()) { _construct = Reflect.construct; } else { _construct = function construct(Parent, args, Class) { var a = [ null ]; a.push.apply(a, args); var Constructor = Function.bind.apply(Parent, a); var instance = new Constructor(); if (Class) _set_prototype_of(instance, Class.prototype); return instance; }; } return _construct.apply(null, arguments); } function _defineProperties(target, props) { for(var i = 0; i < props.length; i++){ var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _create_class(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _define_property(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; } function _get_prototype_of(o) { _get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _get_prototype_of(o); } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _set_prototype_of(subClass, superClass); } function _instanceof(left, right) { if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) { return !!right[Symbol.hasInstance](left); } else { return left instanceof right; } } function _is_native_function(fn) { return Function.toString.call(fn).indexOf("[native code]") !== -1; } function _iterable_to_array(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _iterable_to_array_limit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){ _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally{ try { if (!_n && _i["return"] != null) _i["return"](); } finally{ if (_d) throw _e; } } return _arr; } function _non_iterable_rest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _non_iterable_spread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _object_spread(target) { for(var i = 1; i < arguments.length; i++){ var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === "function") { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function(key) { _define_property(target, key, source[key]); }); } return target; } function 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; } function _object_spread_props(target, source) { source = source != null ? source : {}; 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; } function _object_without_properties(source, excluded) { if (source == null) return {}; var target = _object_without_properties_loose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for(i = 0; i < sourceSymbolKeys.length; i++){ key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _object_without_properties_loose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for(i = 0; i < sourceKeys.length; i++){ key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _possible_constructor_return(self, call) { if (call && (_type_of(call) === "object" || typeof call === "function")) { return call; } return _assert_this_initialized(self); } function _set_prototype_of(o, p) { _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _set_prototype_of(o, p); } function _sliced_to_array(arr, i) { return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest(); } function _to_array(arr) { return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest(); } function _to_consumable_array(arr) { return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread(); } function _type_of(obj) { "@swc/helpers - typeof"; return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj; } function _unsupported_iterable_to_array(o, minLen) { if (!o) return; if (typeof o === "string") return _array_like_to_array(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(n); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen); } function _wrap_native_super(Class) { var _cache = typeof Map === "function" ? new Map() : undefined; _wrap_native_super = function wrapNativeSuper(Class) { if (Class === null || !_is_native_function(Class)) return Class; if (typeof Class !== "function") { throw new TypeError("Super expression must either be null or a function"); } if (typeof _cache !== "undefined") { if (_cache.has(Class)) return _cache.get(Class); _cache.set(Class, Wrapper); } function Wrapper() { return _construct(Class, arguments, _get_prototype_of(this).constructor); } Wrapper.prototype = Object.create(Class.prototype, { constructor: { value: Wrapper, enumerable: false, writable: true, configurable: true } }); return _set_prototype_of(Wrapper, Class); }; return _wrap_native_super(Class); } function _is_native_reflect_construct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {})); return true; } catch (e) { return false; } } function _create_super(Derived) { var hasNativeReflectConstruct = _is_native_reflect_construct(); return function _createSuperInternal() { var Super = _get_prototype_of(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _get_prototype_of(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possible_constructor_return(this, result); }; } function _ts_generator(thisArg, body) { var f, y, t, g, _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function(v) { return step([ n, v ]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while(_)try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [ op[0] & 2, t.value ]; switch(op[0]){ case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [ 0 ]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [ 6, e ]; y = 0; } finally{ f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } var Player = function() { var equalToOrIn = // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/tapable-ts@0.2.4/node_modules/tapable-ts/dist/hooks.mjs function equalToOrIn(value, check) { if (Array.isArray(check)) { return check.includes(value); } return check === value; }; var callTap = function callTap(tap, args, ctx) { var _tap; if (tap.context) { var _tap1; return (_tap1 = tap).callback.apply(_tap1, [ ctx ].concat(_to_consumable_array(args))); } return (_tap = tap).callback.apply(_tap, _to_consumable_array(args)); }; var isBinding = // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/binding/utils.ts function isBinding(binding) { return !(typeof binding === "string" || Array.isArray(binding)); }; var maybeConvertToNum = function maybeConvertToNum(i) { var asInt = parseInt(i, 10); if (isNaN(asInt)) { return i; } return asInt; }; var getBindingSegments = function getBindingSegments(binding) { if (Array.isArray(binding)) { return binding; } if (typeof binding === "string") { return binding.split("."); } return binding.asArray(); }; var findInArray = function findInArray(array, key, value) { return array.findIndex(function(obj) { if (obj && typeof obj === "object") { return obj[key] == value; } return false; }); }; var withParser = function withParser(model, parseBinding) { function maybeParse(binding, readOnly) { var parsed = isBinding(binding) ? binding : parseBinding(binding, { get: model.get, set: model.set, readOnly: readOnly }); if (!parsed) { throw new Error("Unable to parse binding"); } return parsed; } return { get: function get(binding, options) { return model.get(maybeParse(binding, true), options); }, set: function set(transaction, options) { return model.set(transaction.map(function(param) { var _param = _sliced_to_array(param, 2), key = _param[0], val = _param[1]; return [ maybeParse(key, false), val ]; }), options); }, delete: function _delete(binding, options) { return model.delete(maybeParse(binding, false), options); } }; }; var toModel = function toModel(middleware, defaultOptions, next) { if (!next) { return middleware; } return { get: function(binding, options) { var resolvedOptions = options !== null && options !== void 0 ? options : defaultOptions; if (middleware.get) { return middleware.get(binding, resolvedOptions, next); } return next === null || next === void 0 ? void 0 : next.get(binding, resolvedOptions); }, set: function(transaction, options) { var resolvedOptions = options !== null && options !== void 0 ? options : defaultOptions; if (middleware.set) { return middleware.set(transaction, resolvedOptions, next); } return next === null || next === void 0 ? void 0 : next.set(transaction, resolvedOptions); }, delete: function(binding, options) { var resolvedOptions = options !== null && options !== void 0 ? options : defaultOptions; if (middleware.delete) { return middleware.delete(binding, resolvedOptions, next); } return next === null || next === void 0 ? void 0 : next.delete(binding, resolvedOptions); } }; }; var constructModelForPipeline = function constructModelForPipeline(pipeline) { if (pipeline.length === 0) { return NOOP_MODEL; } if (pipeline.length === 1) { return toModel(pipeline[0]); } function createModelWithOptions(options) { var _pipeline_reduce; var model = (_pipeline_reduce = pipeline.reduce(function(nextModel, middleware) { return toModel(middleware, options, nextModel); }, void 0)) !== null && _pipeline_reduce !== void 0 ? _pipeline_reduce : NOOP_MODEL; return model; } return { get: function(binding, options) { var _createModelWithOptions; return (_createModelWithOptions = createModelWithOptions(options)) === null || _createModelWithOptions === void 0 ? void 0 : _createModelWithOptions.get(binding, options); }, set: function(transaction, options) { var _createModelWithOptions; return (_createModelWithOptions = createModelWithOptions(options)) === null || _createModelWithOptions === void 0 ? void 0 : _createModelWithOptions.set(transaction, options); }, delete: function(binding, options) { var _createModelWithOptions; return (_createModelWithOptions = createModelWithOptions(options)) === null || _createModelWithOptions === void 0 ? void 0 : _createModelWithOptions.delete(binding, options); } }; }; var dlv_es_default = // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/node_modules/.aspect_rules_js/dlv@1.1.3/node_modules/dlv/dist/dlv.es.js function dlv_es_default(t2, e, l, n, r) { for(e = e.split ? e.split(".") : e, n = 0; n < e.length; n++)t2 = t2 ? t2[e[n]] : r; return t2 === r ? l : t2; }; var isExpressionNode = function isExpressionNode(x) { return typeof x === "object" && x !== null && !Array.isArray(x) && x.__id === ExpNodeOpaqueIdentifier; }; var throwError = function throwError(message, index) { var err = new Error("".concat(message, " at character ").concat(index)); err.index = index; err.description = message; throw err; }; var createSpanningLocation = function createSpanningLocation(start, end) { if (!start || !end) { return; } return { start: start.start, end: end.end }; }; var getMaxKeyLen = function getMaxKeyLen(obj) { var maxLen = 0; Object.keys(obj).forEach(function(key) { if (key.length > maxLen && Object.prototype.hasOwnProperty.call(obj, key)) { maxLen = key.length; } }); return maxLen; }; var binaryPrecedence = function binaryPrecedence(opVal) { return binaryOps[opVal] || 0; }; var createBinaryExpression = function createBinaryExpression(operator, left, right, location) { var type; if (operator === "||" || operator === "&&") { type = "LogicalExpression"; } else if (operator === "=") { type = "Assignment"; } else if (operator === "+=" || operator === "-=" || operator === "&=" || operator === "|=") { type = "Modification"; } else { type = "BinaryExpression"; } return { __id: ExpNodeOpaqueIdentifier, type: type, operator: operator, left: left, right: right, location: location }; }; var isDecimalDigit = function isDecimalDigit(ch) { return ch >= 48 && ch <= 57; }; var isIdentifierStart = function isIdentifierStart(ch) { return ch === 36 || ch === 95 || // `$` and `_` ch >= 65 && ch <= 90 || // A...Z ch >= 97 && ch <= 122; }; var isIdentifierPart = function isIdentifierPart(ch) { return ch === 36 || ch === 95 || // `$` and `_` ch >= 65 && ch <= 90 || // A...Z ch >= 97 && ch <= 122 || // A...z ch >= 48 && ch <= 57; }; var isModelRefStart = function isModelRefStart(ch0, ch1) { return ch0 === OCURL_CODE && ch1 === OCURL_CODE; }; var parseExpression = function parseExpression(expr, options) { var _options_strict; var strictMode = (_options_strict = options === null || options === void 0 ? void 0 : options.strict) !== null && _options_strict !== void 0 ? _options_strict : true; var charAtFunc = expr.charAt; var charCodeAtFunc = expr.charCodeAt; var length = expr.length; var index = 0; var getLocation = function(startChar) { return { start: { character: startChar }, end: { character: index } }; }; function exprI(i) { return charAtFunc.call(expr, i); } function exprICode(i) { return charCodeAtFunc.call(expr, i); } function gobbleObjects() { var attributes = []; var closed = false; var shouldDefineKey = true; var key; var value; var chCode; var startCharIndex = index; ++index; while(index < length){ gobbleSpaces(); chCode = exprICode(index); if (chCode === CCURL_CODE) { if (key) { throwError("A key was defined but a value was not", index); } index++; closed = true; break; } else if (shouldDefineKey) { if (chCode !== SQUOTE_CODE && chCode !== DQUOTE_CODE) { throwError("An object must start wtih a key", index); } key = gobbleStringLiteral(); gobbleSpaces(); if (exprICode(index) === COLON_CODE) { index++; shouldDefineKey = false; } else { throwError("A colon must follow an object key", index); } } else { value = gobbleExpression(); attributes.push({ key: key, value: value }); gobbleSpaces(); chCode = exprICode(index); if (chCode === COMMA_CODE) { index++; } else if (chCode !== CCURL_CODE) { throwError("Please add a comma to add another key", index); } shouldDefineKey = true; key = void 0; value = void 0; } chCode = exprICode(index); } if (!closed) { throwError("Unclosed brace in object", index); } return { __id: ExpNodeOpaqueIdentifier, type: "Object", attributes: attributes, location: getLocation(startCharIndex) }; } function gobbleSpaces() { var ch = exprICode(index); while(ch === 32 || ch === 9){ ch = exprICode(++index); } } function gobbleExpression() { var test = gobbleBinaryExpression(); gobbleSpaces(); var startCharIndex = index; if (index < length && exprICode(index) === QUMARK_CODE) { index++; var consequent = gobbleExpression(); if (!consequent) { throwError("Expected expression", index); } gobbleSpaces(); if (exprICode(index) === COLON_CODE) { index++; var alternate = gobbleExpression(); if (!alternate) { throwError("Expected expression", index); } return { __id: ExpNodeOpaqueIdentifier, type: "ConditionalExpression", test: test, consequent: consequent, alternate: alternate, location: getLocation(startCharIndex) }; } throwError("Expected :", index); } return test; } function gobbleBinaryOp() { gobbleSpaces(); var toCheck = expr.substr(index, maxBinopLen); var tcLen = toCheck.length; while(tcLen > 0){ if (Object.prototype.hasOwnProperty.call(binaryOps, toCheck)) { index += tcLen; return toCheck; } toCheck = toCheck.substr(0, --tcLen); } return false; } function gobbleBinaryExpression() { var node; var prec; var i; var left = gobbleToken(); var biop = gobbleBinaryOp(); if (!biop) { return left; } var biopInfo = { value: biop, prec: binaryPrecedence(biop) }; var right = gobbleToken(); if (!right) { throwError("Expected expression after ".concat(biop), index); } var stack = [ left, biopInfo, right ]; biop = gobbleBinaryOp(); while(biop){ prec = binaryPrecedence(biop); if (prec === 0) { break; } biopInfo = { value: biop, prec: prec }; while(stack.length > 2 && prec <= stack[stack.length - 2].prec){ right = stack.pop(); biop = stack.pop().value; left = stack.pop(); node = createBinaryExpression(biop, left, right, createSpanningLocation(left.location, right.location)); stack.push(node); } node = gobbleToken(); if (!node) { throwError("Expected expression after ".concat(biop), index); } stack.push(biopInfo, node); biop = gobbleBinaryOp(); } i = stack.length - 1; node = stack[i]; while(i > 1){ node = createBinaryExpression(stack[i - 1].value, stack[i - 2], node, createSpanningLocation(stack[i - 2].location, node.location)); i -= 2; } return node; } function gobbleToken() { gobbleSpaces(); var ch = exprICode(index); var startCharIndex = index; if (isDecimalDigit(ch) || ch === PERIOD_CODE) { return gobbleNumericLiteral(); } if (ch === SQUOTE_CODE || ch === DQUOTE_CODE) { return gobbleStringLiteral(); } if (isIdentifierStart(ch) || ch === OPAREN_CODE) { return gobbleVariable(); } if (ch === OBRACK_CODE) { return gobbleArray(); } if (isModelRefStart(ch, exprICode(index + 1))) { return gobbleModelRef(); } if (ch === OCURL_CODE) { return gobbleObjects(); } var toCheck = expr.substr(index, maxUnopLen); var tcLen = toCheck.length; while(tcLen > 0){ if (Object.prototype.hasOwnProperty.call(unaryOps, toCheck)) { index += tcLen; return { __id: ExpNodeOpaqueIdentifier, type: "UnaryExpression", operator: toCheck, argument: gobbleToken(), prefix: true, location: getLocation(startCharIndex) }; } toCheck = toCheck.substr(0, --tcLen); } return false; } function gobbleNumericLiteral() { var num = ""; var startCharIndex = index; while(isDecimalDigit(exprICode(index))){ num += exprI(index++); } if (exprICode(index) === PERIOD_CODE) { num += exprI(index++); while(isDecimalDigit(exprICode(index))){ num += exprI(index++); } } var ch = exprI(index); if (ch === "e" || ch === "E") { num += exprI(index++); ch = exprI(index); if (ch === "+" || ch === "-") { num += exprI(index++); } while(isDecimalDigit(exprICode(index))){ num += exprI(index++); } if (!isDecimalDigit(exprICode(index - 1))) { throwError("Expected exponent (".concat(num).concat(exprI(index), ")"), index); } } var chCode = exprICode(index); if (isIdentifierStart(chCode)) { throwError("Variable names cannot start with a number (".concat(num).concat(exprI(index), ")"), index); } else if (chCode === PERIOD_CODE) { throwError("Unexpected period", index); } return { __id: ExpNodeOpaqueIdentifier, type: "Literal", value: parseFloat(num), raw: num, location: getLocation(startCharIndex) }; } function gobbleStringLiteral() { var quote = exprI(index++); var str = ""; var closed = false; var startCharIndex = index; while(index < length){ var ch = exprI(index++); if (ch === quote) { closed = true; break; } if (ch !== "\\") { str += ch; continue; } ch = exprI(index++); switch(ch){ case "n": str += "\n"; break; case "r": str += "\r"; break; case "t": str += " "; break; case "b": str += "\b"; break; case "f": str += "\f"; break; case "v": str += "\v"; break; default: } } if (!closed) { throwError('Unclosed quote after "'.concat(str, '"'), index); } return { __id: ExpNodeOpaqueIdentifier, type: "Literal", value: str, raw: "".concat(quote).concat(str).concat(quote), location: getLocation(startCharIndex) }; } function gobbleModelRef() { var str = ""; var closed = false; var openBraceCount = 1; var startCharIndex = index; index += 2; while(index < length){ var ch = exprI(index++); if (ch === "}" && exprICode(index) === CCURL_CODE) { index++; openBraceCount--; if (openBraceCount === 0) { closed = true; break; } str += "}}"; } else if (ch === "{" && exprICode(index) === OCURL_CODE) { openBraceCount++; str += "{{"; index++; } else { str += ch; } } if (!closed) { throwError('Unclosed brace after "'.concat(str, '"'), index); } return { __id: ExpNodeOpaqueIdentifier, type: "ModelRef", ref: str, location: getLocation(startCharIndex) }; } function gobbleIdentifier() { var start = index; var ch = exprICode(start); if (isIdentifierStart(ch)) { index++; } else { throwError("Unexpected ".concat(exprI(index)), index); } while(index < length){ ch = exprICode(index); if (isIdentifierPart(ch)) { index++; } else { break; } } var identifier = expr.slice(start, index); if (Object.prototype.hasOwnProperty.call(literals, identifier)) { return { __id: ExpNodeOpaqueIdentifier, type: "Literal", value: literals[identifier], raw: identifier, location: getLocation(start) }; } if (identifier === thisStr) { return { __id: ExpNodeOpaqueIdentifier, type: "ThisExpression", location: getLocation(start) }; } return { __id: ExpNodeOpaqueIdentifier, type: "Identifier", name: identifier, location: getLocation(start) }; } function gobbleArguments(termination) { var args = []; var charIndex; var node; while(index < length){ gobbleSpaces(); charIndex = exprICode(index); if (charIndex === termination) { index++; break; } if (charIndex === COMMA_CODE) { index++; continue; } node = gobbleExpression(); if (!node || node.type === "Compound") { throwError("Expected comma", index); } args.push(node); } if (strictMode && charIndex !== termination) { throwError("Expected ".concat(String.fromCharCode(termination)), index); } return args; } function gobbleVariable() { var charIndex = exprICode(index); var node = charIndex === OPAREN_CODE ? gobbleGroup() : gobbleIdentifier(); var startCharIndex = index; gobbleSpaces(); charIndex = exprICode(index); while(charIndex === PERIOD_CODE || charIndex === OBRACK_CODE || charIndex === OPAREN_CODE){ index++; if (charIndex === PERIOD_CODE) { gobbleSpaces(); node = { __id: ExpNodeOpaqueIdentifier, type: "MemberExpression", computed: false, object: node, property: gobbleIdentifier(), location: getLocation(startCharIndex) }; } else if (charIndex === OBRACK_CODE) { node = { __id: ExpNodeOpaqueIdentifier, type: "MemberExpression", computed: true, object: node, property: gobbleExpression(), location: getLocation(startCharIndex) }; gobbleSpaces(); charIndex = exprICode(index); if (charIndex !== CBRACK_CODE) { throwError("Unclosed [", index); } index++; } else if (charIndex === OPAREN_CODE) { node = { __id: ExpNodeOpaqueIdentifier, type: "CallExpression", args: gobbleArguments(CPAREN_CODE), callTarget: node, location: getLocation(startCharIndex) }; } gobbleSpaces(); charIndex = exprICode(index); } return node; } function gobbleGroup() { index++; var node = gobbleExpression(); gobbleSpaces(); if (exprICode(index) === CPAREN_CODE) { index++; return node; } throwError("Unclosed (", index); } function gobbleArray() { var startCharIndex = index; index++; return { __id: ExpNodeOpaqueIdentifier, type: "ArrayExpression", elements: gobbleArguments(CBRACK_CODE), location: getLocation(startCharIndex) }; } var nodes = []; try { while(index < length){ var chIndex = exprICode(index); if (chIndex === SEMCOL_CODE || chIndex === COMMA_CODE) { index++; continue; } var node = gobbleExpression(); if (node) { nodes.push(node); } else if (strictMode && index < length) { throwError('Unexpected "'.concat(exprI(index), '"'), index); } } if (nodes.length === 1) { return nodes[0]; } return { __id: ExpNodeOpaqueIdentifier, type: "Compound", body: nodes, location: getLocation(0) }; } catch (e) { if (strictMode || !_instanceof(e, Error)) { throw e; } return { __id: ExpNodeOpaqueIdentifier, type: "Compound", body: nodes, location: getLocation(0), error: e }; } }; var withoutContext = // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/expressions/utils.ts function withoutContext(fn) { return function(_context) { for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){ args[_key - 1] = arguments[_key]; } return fn.apply(void 0, _to_consumable_array(args)); }; }; var isInRange = function isInRange(position, location) { return position.character >= location.start.character && position.character <= location.end.character; }; var isObjectExpression = function isObjectExpression(expr) { if (isExpressionNode(expr)) { return false; } return typeof expr === "object" && expr !== null && !Array.isArray(expr) && "value" in expr; }; var isErrorWithLocation = function isErrorWithLocation(error) { return error.index !== void 0 && error.description !== void 0; }; var parse2 = function parse2(schema) { var _loop = function() { var next = parseQueue.shift(); if (!next) { return "break"; } var node = next.node, path = next.path, visited = next.visited; Object.entries(node).forEach(function(param) { var _param = _sliced_to_array(param, 2), prop = _param[0], type = _param[1]; var nestedPath = _to_consumable_array(path).concat([ prop ]); var nestedPathStr = nestedPath.join("."); if (expandedPaths.has(nestedPathStr)) { throw new Error("Path has already been processed. There's either a loop somewhere or a bug"); } if (visited.has(type.type)) { throw new Error("Path already contained type: ".concat(type.type, ". This likely indicates a loop in the schema")); } expandedPaths.set(nestedPathStr, type); if (type.isArray) { nestedPath.push("[]"); } if (type.isRecord) { nestedPath.push("{}"); } if (type.type && schema[type.type]) { parseQueue.push({ path: nestedPath, node: schema[type.type], visited: /* @__PURE__ */ new Set(_to_consumable_array(visited).concat([ type.type ])) }); } }); }; var expandedPaths = /* @__PURE__ */ new Map(); if (!schema.ROOT) { return expandedPaths; } var parseQueue = [ { node: schema.ROOT, path: [], visited: /* @__PURE__ */ new Set() } ]; while(parseQueue.length > 0){ var _ret = _loop(); if (_ret === "break") break; } return expandedPaths; }; var findNextExp = function findNextExp(str) { var expStart = str.indexOf(DOUBLE_OPEN_CURLY); if (expStart === -1) { return void 0; } var count = 1; var offset = expStart + DOUBLE_OPEN_CURLY.length; var workingString = str.substring(expStart + DOUBLE_OPEN_CURLY.length); while(count > 0 && workingString.length > 0){ var nextCloseCurly = workingString.indexOf(DOUBLE_CLOSE_CURLY); if (nextCloseCurly === -1) { break; } var nextOpenCurly = workingString.indexOf(DOUBLE_OPEN_CURLY); if (nextOpenCurly !== -1 && nextOpenCurly < nextCloseCurly) { count++; workingString = workingString.substring(nextOpenCurly + DOUBLE_OPEN_CURLY.length); offset += nextOpenCurly + DOUBLE_OPEN_CURLY.length; } else { count--; workingString = workingString.substring(nextCloseCurly + DOUBLE_CLOSE_CURLY.length); offset += nextCloseCurly + DOUBLE_CLOSE_CURLY.length; } } if (count !== 0) { throw new Error("Unbalanced {{ and }} in exp: ".concat(str)); } return { start: expStart, end: offset }; }; var resolveExpressionsInString = function resolveExpressionsInString(val, param) { var evaluate = param.evaluate; if (!evaluate) { return val; } var expMatch = /@\[.*?\]@/; var newVal = val; var match = newVal.match(expMatch); while(match !== null){ var expStrWithBrackets = match[0]; var matchStart = newVal.indexOf(expStrWithBrackets); var expString = expStrWithBrackets.substr("@[".length, expStrWithBrackets.length - "@[".length - "]@".length); var expValue = evaluate(expString); if (matchStart === 0 && expStrWithBrackets === val && typeof expValue !== "string") { return expValue; } newVal = newVal.substr(0, matchStart) + expValue + newVal.substr(matchStart + expStrWithBrackets.length); match = newVal.match(expMatch); } return newVal; }; var resolveDataRefsInString = function resolveDataRefsInString(val, options) { var model = options.model, _options_formatted = options.formatted, formatted = _options_formatted === void 0 ? true : _options_formatted; var workingString = resolveExpressionsInString(val, options); if (!model || typeof workingString !== "string" || workingString.indexOf(DOUBLE_OPEN_CURLY) === -1) { return workingString; } while(workingString.indexOf(DOUBLE_OPEN_CURLY) !== -1){ var expLocation = findNextExp(workingString); if (!expLocation) { return workingString; } var start = expLocation.start, end = expLocation.end; var binding = workingString.substring(start + DOUBLE_OPEN_CURLY.length, end - DOUBLE_OPEN_CURLY.length).trim(); var evaledVal = model.get(binding, { formatted: formatted }); if (start === 0 && end === workingString.length && typeof evaledVal !== "string") { return evaledVal; } workingString = workingString.substr(0, start) + evaledVal + workingString.substr(end); } return workingString; }; var resolveDataRefs = function resolveDataRefs(val, options) { return traverseObject(val, options); }; var removeBindingAndChildrenFromMap = // ../../../../../../../../../../execroot/_main/bazel-out/k8-fastbuild/bin/core/player/src/validator/binding-map-splice.ts function removeBindingAndChildrenFromMap(sourceMap, binding) { var targetMap = new Map(sourceMap); var parentBinding = binding.parent(); var property = binding.key(); targetMap.forEach(function(_value, trackedBinding) { if (binding === trackedBinding || binding.contains(trackedBinding)) { targetMap.delete(trackedBinding); } }); if (typeof property === "number") { var bindingsToRewrite = Array.from(sourceMap.keys()).filter(function(b) { if (parentBinding.contains(b)) { var _b_relative = _sliced_to_array(b.relative(parentBinding), 1), childIndex = _b_relative[0]; return typeof childIndex === "number" && childIndex > property; } return false; }).sort(); bindingsToRewrite.forEach(function(trackedBinding) { var _trackedBinding_relative = _to_array(trackedBinding.relative(parentBinding)), childIndex = _trackedBinding_relative[0], childPath = _trackedBinding_relative.slice(1); if (typeof childIndex === "number") { var newSegments = [ childIndex - 1 ].concat(_to_consumable_array(childPath)); var newChildBinding = parentBinding.descendent(newSegments); targetMap.set(newChildBinding, targetMap.get(trackedBinding)); targetMap.delete(trackedBinding); } }); } return targetMap; }; var find = function find(iter, tar, key) { var _iteratorNormalCompletion = true, _didIteratorError = false