You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by sc...@apache.org on 2018/06/06 15:55:04 UTC
[43/59] [abbrv] [partial] nifi-fds git commit: update gh-pages
http://git-wip-us.apache.org/repos/asf/nifi-fds/blob/eec354e6/node_modules/@angular/animations/bundles/animations-browser.umd.js
----------------------------------------------------------------------
diff --git a/node_modules/@angular/animations/bundles/animations-browser.umd.js b/node_modules/@angular/animations/bundles/animations-browser.umd.js
new file mode 100644
index 0000000..a4a5e7f
--- /dev/null
+++ b/node_modules/@angular/animations/bundles/animations-browser.umd.js
@@ -0,0 +1,6144 @@
+/**
+ * @license Angular v5.2.0
+ * (c) 2010-2018 Google, Inc. https://angular.io/
+ * License: MIT
+ */
+(function (global, factory) {
+ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular/animations')) :
+ typeof define === 'function' && define.amd ? define('@angular/animations/browser', ['exports', '@angular/animations'], factory) :
+ (factory((global.ng = global.ng || {}, global.ng.animations = global.ng.animations || {}, global.ng.animations.browser = {}),global.ng.animations));
+}(this, (function (exports,_angular_animations) { 'use strict';
+
+/*! *****************************************************************************
+Copyright (c) Microsoft Corporation. All rights reserved.
+Licensed under the Apache License, Version 2.0 (the "License"); you may not use
+this file except in compliance with the License. You may obtain a copy of the
+License at http://www.apache.org/licenses/LICENSE-2.0
+
+THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
+WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
+MERCHANTABLITY OR NON-INFRINGEMENT.
+
+See the Apache Version 2.0 License for specific language governing permissions
+and limitations under the License.
+***************************************************************************** */
+/* global Reflect, Promise */
+
+var extendStatics = Object.setPrototypeOf ||
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
+ function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
+
+function __extends(d, b) {
+ extendStatics(d, b);
+ function __() { this.constructor = d; }
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
+}
+
+var __assign = Object.assign || function __assign(t) {
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
+ s = arguments[i];
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
+ }
+ return t;
+};
+
+/**
+ * @license Angular v5.2.0
+ * (c) 2010-2018 Google, Inc. https://angular.io/
+ * License: MIT
+ */
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+/**
+ * @param {?} players
+ * @return {?}
+ */
+function optimizeGroupPlayer(players) {
+ switch (players.length) {
+ case 0:
+ return new _angular_animations.NoopAnimationPlayer();
+ case 1:
+ return players[0];
+ default:
+ return new _angular_animations.ɵAnimationGroupPlayer(players);
+ }
+}
+/**
+ * @param {?} driver
+ * @param {?} normalizer
+ * @param {?} element
+ * @param {?} keyframes
+ * @param {?=} preStyles
+ * @param {?=} postStyles
+ * @return {?}
+ */
+function normalizeKeyframes(driver, normalizer, element, keyframes, preStyles, postStyles) {
+ if (preStyles === void 0) { preStyles = {}; }
+ if (postStyles === void 0) { postStyles = {}; }
+ var /** @type {?} */ errors = [];
+ var /** @type {?} */ normalizedKeyframes = [];
+ var /** @type {?} */ previousOffset = -1;
+ var /** @type {?} */ previousKeyframe = null;
+ keyframes.forEach(function (kf) {
+ var /** @type {?} */ offset = /** @type {?} */ (kf['offset']);
+ var /** @type {?} */ isSameOffset = offset == previousOffset;
+ var /** @type {?} */ normalizedKeyframe = (isSameOffset && previousKeyframe) || {};
+ Object.keys(kf).forEach(function (prop) {
+ var /** @type {?} */ normalizedProp = prop;
+ var /** @type {?} */ normalizedValue = kf[prop];
+ if (prop !== 'offset') {
+ normalizedProp = normalizer.normalizePropertyName(normalizedProp, errors);
+ switch (normalizedValue) {
+ case _angular_animations.ɵPRE_STYLE:
+ normalizedValue = preStyles[prop];
+ break;
+ case _angular_animations.AUTO_STYLE:
+ normalizedValue = postStyles[prop];
+ break;
+ default:
+ normalizedValue =
+ normalizer.normalizeStyleValue(prop, normalizedProp, normalizedValue, errors);
+ break;
+ }
+ }
+ normalizedKeyframe[normalizedProp] = normalizedValue;
+ });
+ if (!isSameOffset) {
+ normalizedKeyframes.push(normalizedKeyframe);
+ }
+ previousKeyframe = normalizedKeyframe;
+ previousOffset = offset;
+ });
+ if (errors.length) {
+ var /** @type {?} */ LINE_START = '\n - ';
+ throw new Error("Unable to animate due to the following errors:" + LINE_START + errors.join(LINE_START));
+ }
+ return normalizedKeyframes;
+}
+/**
+ * @param {?} player
+ * @param {?} eventName
+ * @param {?} event
+ * @param {?} callback
+ * @return {?}
+ */
+function listenOnPlayer(player, eventName, event, callback) {
+ switch (eventName) {
+ case 'start':
+ player.onStart(function () { return callback(event && copyAnimationEvent(event, 'start', player.totalTime)); });
+ break;
+ case 'done':
+ player.onDone(function () { return callback(event && copyAnimationEvent(event, 'done', player.totalTime)); });
+ break;
+ case 'destroy':
+ player.onDestroy(function () { return callback(event && copyAnimationEvent(event, 'destroy', player.totalTime)); });
+ break;
+ }
+}
+/**
+ * @param {?} e
+ * @param {?=} phaseName
+ * @param {?=} totalTime
+ * @return {?}
+ */
+function copyAnimationEvent(e, phaseName, totalTime) {
+ var /** @type {?} */ event = makeAnimationEvent(e.element, e.triggerName, e.fromState, e.toState, phaseName || e.phaseName, totalTime == undefined ? e.totalTime : totalTime);
+ var /** @type {?} */ data = (/** @type {?} */ (e))['_data'];
+ if (data != null) {
+ (/** @type {?} */ (event))['_data'] = data;
+ }
+ return event;
+}
+/**
+ * @param {?} element
+ * @param {?} triggerName
+ * @param {?} fromState
+ * @param {?} toState
+ * @param {?=} phaseName
+ * @param {?=} totalTime
+ * @return {?}
+ */
+function makeAnimationEvent(element, triggerName, fromState, toState, phaseName, totalTime) {
+ if (phaseName === void 0) { phaseName = ''; }
+ if (totalTime === void 0) { totalTime = 0; }
+ return { element: element, triggerName: triggerName, fromState: fromState, toState: toState, phaseName: phaseName, totalTime: totalTime };
+}
+/**
+ * @param {?} map
+ * @param {?} key
+ * @param {?} defaultValue
+ * @return {?}
+ */
+function getOrSetAsInMap(map, key, defaultValue) {
+ var /** @type {?} */ value;
+ if (map instanceof Map) {
+ value = map.get(key);
+ if (!value) {
+ map.set(key, value = defaultValue);
+ }
+ }
+ else {
+ value = map[key];
+ if (!value) {
+ value = map[key] = defaultValue;
+ }
+ }
+ return value;
+}
+/**
+ * @param {?} command
+ * @return {?}
+ */
+function parseTimelineCommand(command) {
+ var /** @type {?} */ separatorPos = command.indexOf(':');
+ var /** @type {?} */ id = command.substring(1, separatorPos);
+ var /** @type {?} */ action = command.substr(separatorPos + 1);
+ return [id, action];
+}
+var _contains = function (elm1, elm2) { return false; };
+var _matches = function (element, selector) {
+ return false;
+};
+var _query = function (element, selector, multi) {
+ return [];
+};
+if (typeof Element != 'undefined') {
+ // this is well supported in all browsers
+ _contains = function (elm1, elm2) { return /** @type {?} */ (elm1.contains(elm2)); };
+ if (Element.prototype.matches) {
+ _matches = function (element, selector) { return element.matches(selector); };
+ }
+ else {
+ var /** @type {?} */ proto = /** @type {?} */ (Element.prototype);
+ var /** @type {?} */ fn_1 = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector ||
+ proto.oMatchesSelector || proto.webkitMatchesSelector;
+ if (fn_1) {
+ _matches = function (element, selector) { return fn_1.apply(element, [selector]); };
+ }
+ }
+ _query = function (element, selector, multi) {
+ var /** @type {?} */ results = [];
+ if (multi) {
+ results.push.apply(results, element.querySelectorAll(selector));
+ }
+ else {
+ var /** @type {?} */ elm = element.querySelector(selector);
+ if (elm) {
+ results.push(elm);
+ }
+ }
+ return results;
+ };
+}
+/**
+ * @param {?} prop
+ * @return {?}
+ */
+function containsVendorPrefix(prop) {
+ // Webkit is the only real popular vendor prefix nowadays
+ // cc: http://shouldiprefix.com/
+ return prop.substring(1, 6) == 'ebkit'; // webkit or Webkit
+}
+var _CACHED_BODY = null;
+var _IS_WEBKIT = false;
+/**
+ * @param {?} prop
+ * @return {?}
+ */
+function validateStyleProperty(prop) {
+ if (!_CACHED_BODY) {
+ _CACHED_BODY = getBodyNode() || {};
+ _IS_WEBKIT = /** @type {?} */ ((_CACHED_BODY)).style ? ('WebkitAppearance' in /** @type {?} */ ((_CACHED_BODY)).style) : false;
+ }
+ var /** @type {?} */ result = true;
+ if (/** @type {?} */ ((_CACHED_BODY)).style && !containsVendorPrefix(prop)) {
+ result = prop in /** @type {?} */ ((_CACHED_BODY)).style;
+ if (!result && _IS_WEBKIT) {
+ var /** @type {?} */ camelProp = 'Webkit' + prop.charAt(0).toUpperCase() + prop.substr(1);
+ result = camelProp in /** @type {?} */ ((_CACHED_BODY)).style;
+ }
+ }
+ return result;
+}
+/**
+ * @return {?}
+ */
+function getBodyNode() {
+ if (typeof document != 'undefined') {
+ return document.body;
+ }
+ return null;
+}
+var matchesElement = _matches;
+var containsElement = _contains;
+var invokeQuery = _query;
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+/**
+ * \@experimental
+ */
+var NoopAnimationDriver = /** @class */ (function () {
+ function NoopAnimationDriver() {
+ }
+ /**
+ * @param {?} prop
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.validateStyleProperty = /**
+ * @param {?} prop
+ * @return {?}
+ */
+ function (prop) { return validateStyleProperty(prop); };
+ /**
+ * @param {?} element
+ * @param {?} selector
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.matchesElement = /**
+ * @param {?} element
+ * @param {?} selector
+ * @return {?}
+ */
+ function (element, selector) {
+ return matchesElement(element, selector);
+ };
+ /**
+ * @param {?} elm1
+ * @param {?} elm2
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.containsElement = /**
+ * @param {?} elm1
+ * @param {?} elm2
+ * @return {?}
+ */
+ function (elm1, elm2) { return containsElement(elm1, elm2); };
+ /**
+ * @param {?} element
+ * @param {?} selector
+ * @param {?} multi
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.query = /**
+ * @param {?} element
+ * @param {?} selector
+ * @param {?} multi
+ * @return {?}
+ */
+ function (element, selector, multi) {
+ return invokeQuery(element, selector, multi);
+ };
+ /**
+ * @param {?} element
+ * @param {?} prop
+ * @param {?=} defaultValue
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.computeStyle = /**
+ * @param {?} element
+ * @param {?} prop
+ * @param {?=} defaultValue
+ * @return {?}
+ */
+ function (element, prop, defaultValue) {
+ return defaultValue || '';
+ };
+ /**
+ * @param {?} element
+ * @param {?} keyframes
+ * @param {?} duration
+ * @param {?} delay
+ * @param {?} easing
+ * @param {?=} previousPlayers
+ * @return {?}
+ */
+ NoopAnimationDriver.prototype.animate = /**
+ * @param {?} element
+ * @param {?} keyframes
+ * @param {?} duration
+ * @param {?} delay
+ * @param {?} easing
+ * @param {?=} previousPlayers
+ * @return {?}
+ */
+ function (element, keyframes, duration, delay, easing, previousPlayers) {
+ if (previousPlayers === void 0) { previousPlayers = []; }
+ return new _angular_animations.NoopAnimationPlayer();
+ };
+ return NoopAnimationDriver;
+}());
+/**
+ * \@experimental
+ * @abstract
+ */
+var AnimationDriver = /** @class */ (function () {
+ function AnimationDriver() {
+ }
+ AnimationDriver.NOOP = new NoopAnimationDriver();
+ return AnimationDriver;
+}());
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+var ONE_SECOND = 1000;
+var SUBSTITUTION_EXPR_START = '{{';
+var SUBSTITUTION_EXPR_END = '}}';
+var ENTER_CLASSNAME = 'ng-enter';
+var LEAVE_CLASSNAME = 'ng-leave';
+
+
+var NG_TRIGGER_CLASSNAME = 'ng-trigger';
+var NG_TRIGGER_SELECTOR = '.ng-trigger';
+var NG_ANIMATING_CLASSNAME = 'ng-animating';
+var NG_ANIMATING_SELECTOR = '.ng-animating';
+/**
+ * @param {?} value
+ * @return {?}
+ */
+function resolveTimingValue(value) {
+ if (typeof value == 'number')
+ return value;
+ var /** @type {?} */ matches = (/** @type {?} */ (value)).match(/^(-?[\.\d]+)(m?s)/);
+ if (!matches || matches.length < 2)
+ return 0;
+ return _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
+}
+/**
+ * @param {?} value
+ * @param {?} unit
+ * @return {?}
+ */
+function _convertTimeValueToMS(value, unit) {
+ switch (unit) {
+ case 's':
+ return value * ONE_SECOND;
+ default:
+ // ms or something else
+ return value;
+ }
+}
+/**
+ * @param {?} timings
+ * @param {?} errors
+ * @param {?=} allowNegativeValues
+ * @return {?}
+ */
+function resolveTiming(timings, errors, allowNegativeValues) {
+ return timings.hasOwnProperty('duration') ? /** @type {?} */ (timings) :
+ parseTimeExpression(/** @type {?} */ (timings), errors, allowNegativeValues);
+}
+/**
+ * @param {?} exp
+ * @param {?} errors
+ * @param {?=} allowNegativeValues
+ * @return {?}
+ */
+function parseTimeExpression(exp, errors, allowNegativeValues) {
+ var /** @type {?} */ regex = /^(-?[\.\d]+)(m?s)(?:\s+(-?[\.\d]+)(m?s))?(?:\s+([-a-z]+(?:\(.+?\))?))?$/i;
+ var /** @type {?} */ duration;
+ var /** @type {?} */ delay = 0;
+ var /** @type {?} */ easing = '';
+ if (typeof exp === 'string') {
+ var /** @type {?} */ matches = exp.match(regex);
+ if (matches === null) {
+ errors.push("The provided timing value \"" + exp + "\" is invalid.");
+ return { duration: 0, delay: 0, easing: '' };
+ }
+ duration = _convertTimeValueToMS(parseFloat(matches[1]), matches[2]);
+ var /** @type {?} */ delayMatch = matches[3];
+ if (delayMatch != null) {
+ delay = _convertTimeValueToMS(Math.floor(parseFloat(delayMatch)), matches[4]);
+ }
+ var /** @type {?} */ easingVal = matches[5];
+ if (easingVal) {
+ easing = easingVal;
+ }
+ }
+ else {
+ duration = /** @type {?} */ (exp);
+ }
+ if (!allowNegativeValues) {
+ var /** @type {?} */ containsErrors = false;
+ var /** @type {?} */ startIndex = errors.length;
+ if (duration < 0) {
+ errors.push("Duration values below 0 are not allowed for this animation step.");
+ containsErrors = true;
+ }
+ if (delay < 0) {
+ errors.push("Delay values below 0 are not allowed for this animation step.");
+ containsErrors = true;
+ }
+ if (containsErrors) {
+ errors.splice(startIndex, 0, "The provided timing value \"" + exp + "\" is invalid.");
+ }
+ }
+ return { duration: duration, delay: delay, easing: easing };
+}
+/**
+ * @param {?} obj
+ * @param {?=} destination
+ * @return {?}
+ */
+function copyObj(obj, destination) {
+ if (destination === void 0) { destination = {}; }
+ Object.keys(obj).forEach(function (prop) { destination[prop] = obj[prop]; });
+ return destination;
+}
+/**
+ * @param {?} styles
+ * @return {?}
+ */
+function normalizeStyles(styles) {
+ var /** @type {?} */ normalizedStyles = {};
+ if (Array.isArray(styles)) {
+ styles.forEach(function (data) { return copyStyles(data, false, normalizedStyles); });
+ }
+ else {
+ copyStyles(styles, false, normalizedStyles);
+ }
+ return normalizedStyles;
+}
+/**
+ * @param {?} styles
+ * @param {?} readPrototype
+ * @param {?=} destination
+ * @return {?}
+ */
+function copyStyles(styles, readPrototype, destination) {
+ if (destination === void 0) { destination = {}; }
+ if (readPrototype) {
+ // we make use of a for-in loop so that the
+ // prototypically inherited properties are
+ // revealed from the backFill map
+ for (var /** @type {?} */ prop in styles) {
+ destination[prop] = styles[prop];
+ }
+ }
+ else {
+ copyObj(styles, destination);
+ }
+ return destination;
+}
+/**
+ * @param {?} element
+ * @param {?} styles
+ * @return {?}
+ */
+function setStyles(element, styles) {
+ if (element['style']) {
+ Object.keys(styles).forEach(function (prop) {
+ var /** @type {?} */ camelProp = dashCaseToCamelCase(prop);
+ element.style[camelProp] = styles[prop];
+ });
+ }
+}
+/**
+ * @param {?} element
+ * @param {?} styles
+ * @return {?}
+ */
+function eraseStyles(element, styles) {
+ if (element['style']) {
+ Object.keys(styles).forEach(function (prop) {
+ var /** @type {?} */ camelProp = dashCaseToCamelCase(prop);
+ element.style[camelProp] = '';
+ });
+ }
+}
+/**
+ * @param {?} steps
+ * @return {?}
+ */
+function normalizeAnimationEntry(steps) {
+ if (Array.isArray(steps)) {
+ if (steps.length == 1)
+ return steps[0];
+ return _angular_animations.sequence(steps);
+ }
+ return /** @type {?} */ (steps);
+}
+/**
+ * @param {?} value
+ * @param {?} options
+ * @param {?} errors
+ * @return {?}
+ */
+function validateStyleParams(value, options, errors) {
+ var /** @type {?} */ params = options.params || {};
+ var /** @type {?} */ matches = extractStyleParams(value);
+ if (matches.length) {
+ matches.forEach(function (varName) {
+ if (!params.hasOwnProperty(varName)) {
+ errors.push("Unable to resolve the local animation param " + varName + " in the given list of values");
+ }
+ });
+ }
+}
+var PARAM_REGEX = new RegExp(SUBSTITUTION_EXPR_START + "\\s*(.+?)\\s*" + SUBSTITUTION_EXPR_END, 'g');
+/**
+ * @param {?} value
+ * @return {?}
+ */
+function extractStyleParams(value) {
+ var /** @type {?} */ params = [];
+ if (typeof value === 'string') {
+ var /** @type {?} */ val = value.toString();
+ var /** @type {?} */ match = void 0;
+ while (match = PARAM_REGEX.exec(val)) {
+ params.push(/** @type {?} */ (match[1]));
+ }
+ PARAM_REGEX.lastIndex = 0;
+ }
+ return params;
+}
+/**
+ * @param {?} value
+ * @param {?} params
+ * @param {?} errors
+ * @return {?}
+ */
+function interpolateParams(value, params, errors) {
+ var /** @type {?} */ original = value.toString();
+ var /** @type {?} */ str = original.replace(PARAM_REGEX, function (_, varName) {
+ var /** @type {?} */ localVal = params[varName];
+ // this means that the value was never overidden by the data passed in by the user
+ if (!params.hasOwnProperty(varName)) {
+ errors.push("Please provide a value for the animation param " + varName);
+ localVal = '';
+ }
+ return localVal.toString();
+ });
+ // we do this to assert that numeric values stay as they are
+ return str == original ? value : str;
+}
+/**
+ * @param {?} iterator
+ * @return {?}
+ */
+function iteratorToArray(iterator) {
+ var /** @type {?} */ arr = [];
+ var /** @type {?} */ item = iterator.next();
+ while (!item.done) {
+ arr.push(item.value);
+ item = iterator.next();
+ }
+ return arr;
+}
+/**
+ * @param {?} source
+ * @param {?} destination
+ * @return {?}
+ */
+
+var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
+/**
+ * @param {?} input
+ * @return {?}
+ */
+function dashCaseToCamelCase(input) {
+ return input.replace(DASH_CASE_REGEXP, function () {
+ var m = [];
+ for (var _i = 0; _i < arguments.length; _i++) {
+ m[_i] = arguments[_i];
+ }
+ return m[1].toUpperCase();
+ });
+}
+/**
+ * @param {?} duration
+ * @param {?} delay
+ * @return {?}
+ */
+function allowPreviousPlayerStylesMerge(duration, delay) {
+ return duration === 0 || delay === 0;
+}
+/**
+ * @param {?} visitor
+ * @param {?} node
+ * @param {?} context
+ * @return {?}
+ */
+function visitDslNode(visitor, node, context) {
+ switch (node.type) {
+ case 7 /* Trigger */:
+ return visitor.visitTrigger(node, context);
+ case 0 /* State */:
+ return visitor.visitState(node, context);
+ case 1 /* Transition */:
+ return visitor.visitTransition(node, context);
+ case 2 /* Sequence */:
+ return visitor.visitSequence(node, context);
+ case 3 /* Group */:
+ return visitor.visitGroup(node, context);
+ case 4 /* Animate */:
+ return visitor.visitAnimate(node, context);
+ case 5 /* Keyframes */:
+ return visitor.visitKeyframes(node, context);
+ case 6 /* Style */:
+ return visitor.visitStyle(node, context);
+ case 8 /* Reference */:
+ return visitor.visitReference(node, context);
+ case 9 /* AnimateChild */:
+ return visitor.visitAnimateChild(node, context);
+ case 10 /* AnimateRef */:
+ return visitor.visitAnimateRef(node, context);
+ case 11 /* Query */:
+ return visitor.visitQuery(node, context);
+ case 12 /* Stagger */:
+ return visitor.visitStagger(node, context);
+ default:
+ throw new Error("Unable to resolve animation metadata node #" + node.type);
+ }
+}
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+/**
+ * @license
+ * Copyright Google Inc. All Rights Reserved.
+ *
+ * Use of this source code is governed by an MIT-style license that can be
+ * found in the LICENSE file at https://angular.io/license
+ */
+var ANY_STATE = '*';
+/**
+ * @param {?} transitionValue
+ * @param {?} errors
+ * @return {?}
+ */
+function parseTransitionExpr(transitionValue, errors) {
+ var /** @type {?} */ expressions = [];
+ if (typeof transitionValue == 'string') {
+ (/** @type {?} */ (transitionValue))
+ .split(/\s*,\s*/)
+ .forEach(function (str) { return parseInnerTransitionStr(str, expressions, errors); });
+ }
+ else {
+ expressions.push(/** @type {?} */ (transitionValue));
+ }
+ return expressions;
+}
+/**
+ * @param {?} eventStr
+ * @param {?} expressions
+ * @param {?} errors
+ * @return {?}
+ */
+function parseInnerTransitionStr(eventStr, expressions, errors) {
+ if (eventStr[0] == ':') {
+ var /** @type {?} */ result = parseAnimationAlias(eventStr, errors);
+ if (typeof result == 'function') {
+ expressions.push(result);
+ return;
+ }
+ eventStr = /** @type {?} */ (result);
+ }
+ var /** @type {?} */ match = eventStr.match(/^(\*|[-\w]+)\s*(<?[=-]>)\s*(\*|[-\w]+)$/);
+ if (match == null || match.length < 4) {
+ errors.push("The provided transition expression \"" + eventStr + "\" is not supported");
+ return expressions;
+ }
+ var /** @type {?} */ fromState = match[1];
+ var /** @type {?} */ separator = match[2];
+ var /** @type {?} */ toState = match[3];
+ expressions.push(makeLambdaFromStates(fromState, toState));
+ var /** @type {?} */ isFullAnyStateExpr = fromState == ANY_STATE && toState == ANY_STATE;
+ if (separator[0] == '<' && !isFullAnyStateExpr) {
+ expressions.push(makeLambdaFromStates(toState, fromState));
+ }
+}
+/**
+ * @param {?} alias
+ * @param {?} errors
+ * @return {?}
+ */
+function parseAnimationAlias(alias, errors) {
+ switch (alias) {
+ case ':enter':
+ return 'void => *';
+ case ':leave':
+ return '* => void';
+ case ':increment':
+ return function (fromState, toState) { return parseFloat(toState) > parseFloat(fromState); };
+ case ':decrement':
+ return function (fromState, toState) { return parseFloat(toState) < parseFloat(fromState); };
+ default:
+ errors.push("The transition alias value \"" + alias + "\" is not supported");
+ return '* => *';
+ }
+}
+// DO NOT REFACTOR ... keep the follow set instantiations
+// with the values intact (closure compiler for some reason
+// removes follow-up lines that add the values outside of
+// the constructor...
+var TRUE_BOOLEAN_VALUES = new Set(['true', '1']);
+var FALSE_BOOLEAN_VALUES = new Set(['false', '0']);
+/**
+ * @param {?} lhs
+ * @param {?} rhs
+ * @return {?}
+ */
+function makeLambdaFromStates(lhs, rhs) {
+ var /** @type {?} */ LHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(lhs) || FALSE_BOOLEAN_VALUES.has(lhs);
+ var /** @type {?} */ RHS_MATCH_BOOLEAN = TRUE_BOOLEAN_VALUES.has(rhs) || FALSE_BOOLEAN_VALUES.has(rhs);
+ return function (fromState, toState) {
+ var /** @type {?} */ lhsMatch = lhs == ANY_STATE || lhs == fromState;
+ var /** @type {?} */ rhsMatch = rhs == ANY_STATE || rhs == toState;
+ if (!lhsMatch && LHS_MATCH_BOOLEAN && typeof fromState === 'boolean') {
+ lhsMatch = fromState ? TRUE_BOOLEAN_VALUES.has(lhs) : FALSE_BOOLEAN_VALUES.has(lhs);
+ }
+ if (!rhsMatch && RHS_MATCH_BOOLEAN && typeof toState === 'boolean') {
+ rhsMatch = toState ? TRUE_BOOLEAN_VALUES.has(rhs) : FALSE_BOOLEAN_VALUES.has(rhs);
+ }
+ return lhsMatch && rhsMatch;
+ };
+}
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+var SELF_TOKEN = ':self';
+var SELF_TOKEN_REGEX = new RegExp("s*" + SELF_TOKEN + "s*,?", 'g');
+/**
+ * @param {?} driver
+ * @param {?} metadata
+ * @param {?} errors
+ * @return {?}
+ */
+function buildAnimationAst(driver, metadata, errors) {
+ return new AnimationAstBuilderVisitor(driver).build(metadata, errors);
+}
+var ROOT_SELECTOR = '';
+var AnimationAstBuilderVisitor = /** @class */ (function () {
+ function AnimationAstBuilderVisitor(_driver) {
+ this._driver = _driver;
+ }
+ /**
+ * @param {?} metadata
+ * @param {?} errors
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.build = /**
+ * @param {?} metadata
+ * @param {?} errors
+ * @return {?}
+ */
+ function (metadata, errors) {
+ var /** @type {?} */ context = new AnimationAstBuilderContext(errors);
+ this._resetContextStyleTimingState(context);
+ return /** @type {?} */ (visitDslNode(this, normalizeAnimationEntry(metadata), context));
+ };
+ /**
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype._resetContextStyleTimingState = /**
+ * @param {?} context
+ * @return {?}
+ */
+ function (context) {
+ context.currentQuerySelector = ROOT_SELECTOR;
+ context.collectedStyles = {};
+ context.collectedStyles[ROOT_SELECTOR] = {};
+ context.currentTime = 0;
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitTrigger = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var _this = this;
+ var /** @type {?} */ queryCount = context.queryCount = 0;
+ var /** @type {?} */ depCount = context.depCount = 0;
+ var /** @type {?} */ states = [];
+ var /** @type {?} */ transitions = [];
+ if (metadata.name.charAt(0) == '@') {
+ context.errors.push('animation triggers cannot be prefixed with an `@` sign (e.g. trigger(\'@foo\', [...]))');
+ }
+ metadata.definitions.forEach(function (def) {
+ _this._resetContextStyleTimingState(context);
+ if (def.type == 0 /* State */) {
+ var /** @type {?} */ stateDef_1 = /** @type {?} */ (def);
+ var /** @type {?} */ name_1 = stateDef_1.name;
+ name_1.split(/\s*,\s*/).forEach(function (n) {
+ stateDef_1.name = n;
+ states.push(_this.visitState(stateDef_1, context));
+ });
+ stateDef_1.name = name_1;
+ }
+ else if (def.type == 1 /* Transition */) {
+ var /** @type {?} */ transition = _this.visitTransition(/** @type {?} */ (def), context);
+ queryCount += transition.queryCount;
+ depCount += transition.depCount;
+ transitions.push(transition);
+ }
+ else {
+ context.errors.push('only state() and transition() definitions can sit inside of a trigger()');
+ }
+ });
+ return {
+ type: 7 /* Trigger */,
+ name: metadata.name, states: states, transitions: transitions, queryCount: queryCount, depCount: depCount,
+ options: null
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitState = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var /** @type {?} */ styleAst = this.visitStyle(metadata.styles, context);
+ var /** @type {?} */ astParams = (metadata.options && metadata.options.params) || null;
+ if (styleAst.containsDynamicStyles) {
+ var /** @type {?} */ missingSubs_1 = new Set();
+ var /** @type {?} */ params_1 = astParams || {};
+ styleAst.styles.forEach(function (value) {
+ if (isObject(value)) {
+ var /** @type {?} */ stylesObj_1 = /** @type {?} */ (value);
+ Object.keys(stylesObj_1).forEach(function (prop) {
+ extractStyleParams(stylesObj_1[prop]).forEach(function (sub) {
+ if (!params_1.hasOwnProperty(sub)) {
+ missingSubs_1.add(sub);
+ }
+ });
+ });
+ }
+ });
+ if (missingSubs_1.size) {
+ var /** @type {?} */ missingSubsArr = iteratorToArray(missingSubs_1.values());
+ context.errors.push("state(\"" + metadata.name + "\", ...) must define default values for all the following style substitutions: " + missingSubsArr.join(', '));
+ }
+ }
+ return {
+ type: 0 /* State */,
+ name: metadata.name,
+ style: styleAst,
+ options: astParams ? { params: astParams } : null
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitTransition = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ context.queryCount = 0;
+ context.depCount = 0;
+ var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);
+ var /** @type {?} */ matchers = parseTransitionExpr(metadata.expr, context.errors);
+ return {
+ type: 1 /* Transition */,
+ matchers: matchers,
+ animation: animation,
+ queryCount: context.queryCount,
+ depCount: context.depCount,
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitSequence = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var _this = this;
+ return {
+ type: 2 /* Sequence */,
+ steps: metadata.steps.map(function (s) { return visitDslNode(_this, s, context); }),
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitGroup = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var _this = this;
+ var /** @type {?} */ currentTime = context.currentTime;
+ var /** @type {?} */ furthestTime = 0;
+ var /** @type {?} */ steps = metadata.steps.map(function (step) {
+ context.currentTime = currentTime;
+ var /** @type {?} */ innerAst = visitDslNode(_this, step, context);
+ furthestTime = Math.max(furthestTime, context.currentTime);
+ return innerAst;
+ });
+ context.currentTime = furthestTime;
+ return {
+ type: 3 /* Group */,
+ steps: steps,
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitAnimate = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var /** @type {?} */ timingAst = constructTimingAst(metadata.timings, context.errors);
+ context.currentAnimateTimings = timingAst;
+ var /** @type {?} */ styleAst;
+ var /** @type {?} */ styleMetadata = metadata.styles ? metadata.styles : _angular_animations.style({});
+ if (styleMetadata.type == 5 /* Keyframes */) {
+ styleAst = this.visitKeyframes(/** @type {?} */ (styleMetadata), context);
+ }
+ else {
+ var /** @type {?} */ styleMetadata_1 = /** @type {?} */ (metadata.styles);
+ var /** @type {?} */ isEmpty = false;
+ if (!styleMetadata_1) {
+ isEmpty = true;
+ var /** @type {?} */ newStyleData = {};
+ if (timingAst.easing) {
+ newStyleData['easing'] = timingAst.easing;
+ }
+ styleMetadata_1 = _angular_animations.style(newStyleData);
+ }
+ context.currentTime += timingAst.duration + timingAst.delay;
+ var /** @type {?} */ _styleAst = this.visitStyle(styleMetadata_1, context);
+ _styleAst.isEmptyStep = isEmpty;
+ styleAst = _styleAst;
+ }
+ context.currentAnimateTimings = null;
+ return {
+ type: 4 /* Animate */,
+ timings: timingAst,
+ style: styleAst,
+ options: null
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitStyle = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var /** @type {?} */ ast = this._makeStyleAst(metadata, context);
+ this._validateStyleAst(ast, context);
+ return ast;
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype._makeStyleAst = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var /** @type {?} */ styles = [];
+ if (Array.isArray(metadata.styles)) {
+ (/** @type {?} */ (metadata.styles)).forEach(function (styleTuple) {
+ if (typeof styleTuple == 'string') {
+ if (styleTuple == _angular_animations.AUTO_STYLE) {
+ styles.push(/** @type {?} */ (styleTuple));
+ }
+ else {
+ context.errors.push("The provided style string value " + styleTuple + " is not allowed.");
+ }
+ }
+ else {
+ styles.push(/** @type {?} */ (styleTuple));
+ }
+ });
+ }
+ else {
+ styles.push(metadata.styles);
+ }
+ var /** @type {?} */ containsDynamicStyles = false;
+ var /** @type {?} */ collectedEasing = null;
+ styles.forEach(function (styleData) {
+ if (isObject(styleData)) {
+ var /** @type {?} */ styleMap = /** @type {?} */ (styleData);
+ var /** @type {?} */ easing = styleMap['easing'];
+ if (easing) {
+ collectedEasing = /** @type {?} */ (easing);
+ delete styleMap['easing'];
+ }
+ if (!containsDynamicStyles) {
+ for (var /** @type {?} */ prop in styleMap) {
+ var /** @type {?} */ value = styleMap[prop];
+ if (value.toString().indexOf(SUBSTITUTION_EXPR_START) >= 0) {
+ containsDynamicStyles = true;
+ break;
+ }
+ }
+ }
+ }
+ });
+ return {
+ type: 6 /* Style */,
+ styles: styles,
+ easing: collectedEasing,
+ offset: metadata.offset, containsDynamicStyles: containsDynamicStyles,
+ options: null
+ };
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype._validateStyleAst = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var _this = this;
+ var /** @type {?} */ timings = context.currentAnimateTimings;
+ var /** @type {?} */ endTime = context.currentTime;
+ var /** @type {?} */ startTime = context.currentTime;
+ if (timings && startTime > 0) {
+ startTime -= timings.duration + timings.delay;
+ }
+ ast.styles.forEach(function (tuple) {
+ if (typeof tuple == 'string')
+ return;
+ Object.keys(tuple).forEach(function (prop) {
+ if (!_this._driver.validateStyleProperty(prop)) {
+ context.errors.push("The provided animation property \"" + prop + "\" is not a supported CSS property for animations");
+ return;
+ }
+ var /** @type {?} */ collectedStyles = context.collectedStyles[/** @type {?} */ ((context.currentQuerySelector))];
+ var /** @type {?} */ collectedEntry = collectedStyles[prop];
+ var /** @type {?} */ updateCollectedStyle = true;
+ if (collectedEntry) {
+ if (startTime != endTime && startTime >= collectedEntry.startTime &&
+ endTime <= collectedEntry.endTime) {
+ context.errors.push("The CSS property \"" + prop + "\" that exists between the times of \"" + collectedEntry.startTime + "ms\" and \"" + collectedEntry.endTime + "ms\" is also being animated in a parallel animation between the times of \"" + startTime + "ms\" and \"" + endTime + "ms\"");
+ updateCollectedStyle = false;
+ }
+ // we always choose the smaller start time value since we
+ // want to have a record of the entire animation window where
+ // the style property is being animated in between
+ startTime = collectedEntry.startTime;
+ }
+ if (updateCollectedStyle) {
+ collectedStyles[prop] = { startTime: startTime, endTime: endTime };
+ }
+ if (context.options) {
+ validateStyleParams(tuple[prop], context.options, context.errors);
+ }
+ });
+ });
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitKeyframes = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var _this = this;
+ var /** @type {?} */ ast = { type: 5 /* Keyframes */, styles: [], options: null };
+ if (!context.currentAnimateTimings) {
+ context.errors.push("keyframes() must be placed inside of a call to animate()");
+ return ast;
+ }
+ var /** @type {?} */ MAX_KEYFRAME_OFFSET = 1;
+ var /** @type {?} */ totalKeyframesWithOffsets = 0;
+ var /** @type {?} */ offsets = [];
+ var /** @type {?} */ offsetsOutOfOrder = false;
+ var /** @type {?} */ keyframesOutOfRange = false;
+ var /** @type {?} */ previousOffset = 0;
+ var /** @type {?} */ keyframes = metadata.steps.map(function (styles) {
+ var /** @type {?} */ style$$1 = _this._makeStyleAst(styles, context);
+ var /** @type {?} */ offsetVal = style$$1.offset != null ? style$$1.offset : consumeOffset(style$$1.styles);
+ var /** @type {?} */ offset = 0;
+ if (offsetVal != null) {
+ totalKeyframesWithOffsets++;
+ offset = style$$1.offset = offsetVal;
+ }
+ keyframesOutOfRange = keyframesOutOfRange || offset < 0 || offset > 1;
+ offsetsOutOfOrder = offsetsOutOfOrder || offset < previousOffset;
+ previousOffset = offset;
+ offsets.push(offset);
+ return style$$1;
+ });
+ if (keyframesOutOfRange) {
+ context.errors.push("Please ensure that all keyframe offsets are between 0 and 1");
+ }
+ if (offsetsOutOfOrder) {
+ context.errors.push("Please ensure that all keyframe offsets are in order");
+ }
+ var /** @type {?} */ length = metadata.steps.length;
+ var /** @type {?} */ generatedOffset = 0;
+ if (totalKeyframesWithOffsets > 0 && totalKeyframesWithOffsets < length) {
+ context.errors.push("Not all style() steps within the declared keyframes() contain offsets");
+ }
+ else if (totalKeyframesWithOffsets == 0) {
+ generatedOffset = MAX_KEYFRAME_OFFSET / (length - 1);
+ }
+ var /** @type {?} */ limit = length - 1;
+ var /** @type {?} */ currentTime = context.currentTime;
+ var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings));
+ var /** @type {?} */ animateDuration = currentAnimateTimings.duration;
+ keyframes.forEach(function (kf, i) {
+ var /** @type {?} */ offset = generatedOffset > 0 ? (i == limit ? 1 : (generatedOffset * i)) : offsets[i];
+ var /** @type {?} */ durationUpToThisFrame = offset * animateDuration;
+ context.currentTime = currentTime + currentAnimateTimings.delay + durationUpToThisFrame;
+ currentAnimateTimings.duration = durationUpToThisFrame;
+ _this._validateStyleAst(kf, context);
+ kf.offset = offset;
+ ast.styles.push(kf);
+ });
+ return ast;
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitReference = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ return {
+ type: 8 /* Reference */,
+ animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context),
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitAnimateChild = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ context.depCount++;
+ return {
+ type: 9 /* AnimateChild */,
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitAnimateRef = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ return {
+ type: 10 /* AnimateRef */,
+ animation: this.visitReference(metadata.animation, context),
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitQuery = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ var /** @type {?} */ parentSelector = /** @type {?} */ ((context.currentQuerySelector));
+ var /** @type {?} */ options = /** @type {?} */ ((metadata.options || {}));
+ context.queryCount++;
+ context.currentQuery = metadata;
+ var _a = normalizeSelector(metadata.selector), selector = _a[0], includeSelf = _a[1];
+ context.currentQuerySelector =
+ parentSelector.length ? (parentSelector + ' ' + selector) : selector;
+ getOrSetAsInMap(context.collectedStyles, context.currentQuerySelector, {});
+ var /** @type {?} */ animation = visitDslNode(this, normalizeAnimationEntry(metadata.animation), context);
+ context.currentQuery = null;
+ context.currentQuerySelector = parentSelector;
+ return {
+ type: 11 /* Query */,
+ selector: selector,
+ limit: options.limit || 0,
+ optional: !!options.optional, includeSelf: includeSelf, animation: animation,
+ originalSelector: metadata.selector,
+ options: normalizeAnimationOptions(metadata.options)
+ };
+ };
+ /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationAstBuilderVisitor.prototype.visitStagger = /**
+ * @param {?} metadata
+ * @param {?} context
+ * @return {?}
+ */
+ function (metadata, context) {
+ if (!context.currentQuery) {
+ context.errors.push("stagger() can only be used inside of query()");
+ }
+ var /** @type {?} */ timings = metadata.timings === 'full' ?
+ { duration: 0, delay: 0, easing: 'full' } :
+ resolveTiming(metadata.timings, context.errors, true);
+ return {
+ type: 12 /* Stagger */,
+ animation: visitDslNode(this, normalizeAnimationEntry(metadata.animation), context), timings: timings,
+ options: null
+ };
+ };
+ return AnimationAstBuilderVisitor;
+}());
+/**
+ * @param {?} selector
+ * @return {?}
+ */
+function normalizeSelector(selector) {
+ var /** @type {?} */ hasAmpersand = selector.split(/\s*,\s*/).find(function (token) { return token == SELF_TOKEN; }) ? true : false;
+ if (hasAmpersand) {
+ selector = selector.replace(SELF_TOKEN_REGEX, '');
+ }
+ // the :enter and :leave selectors are filled in at runtime during timeline building
+ selector = selector.replace(/@\*/g, NG_TRIGGER_SELECTOR)
+ .replace(/@\w+/g, function (match) { return NG_TRIGGER_SELECTOR + '-' + match.substr(1); })
+ .replace(/:animating/g, NG_ANIMATING_SELECTOR);
+ return [selector, hasAmpersand];
+}
+/**
+ * @param {?} obj
+ * @return {?}
+ */
+function normalizeParams(obj) {
+ return obj ? copyObj(obj) : null;
+}
+var AnimationAstBuilderContext = /** @class */ (function () {
+ function AnimationAstBuilderContext(errors) {
+ this.errors = errors;
+ this.queryCount = 0;
+ this.depCount = 0;
+ this.currentTransition = null;
+ this.currentQuery = null;
+ this.currentQuerySelector = null;
+ this.currentAnimateTimings = null;
+ this.currentTime = 0;
+ this.collectedStyles = {};
+ this.options = null;
+ }
+ return AnimationAstBuilderContext;
+}());
+/**
+ * @param {?} styles
+ * @return {?}
+ */
+function consumeOffset(styles) {
+ if (typeof styles == 'string')
+ return null;
+ var /** @type {?} */ offset = null;
+ if (Array.isArray(styles)) {
+ styles.forEach(function (styleTuple) {
+ if (isObject(styleTuple) && styleTuple.hasOwnProperty('offset')) {
+ var /** @type {?} */ obj = /** @type {?} */ (styleTuple);
+ offset = parseFloat(/** @type {?} */ (obj['offset']));
+ delete obj['offset'];
+ }
+ });
+ }
+ else if (isObject(styles) && styles.hasOwnProperty('offset')) {
+ var /** @type {?} */ obj = /** @type {?} */ (styles);
+ offset = parseFloat(/** @type {?} */ (obj['offset']));
+ delete obj['offset'];
+ }
+ return offset;
+}
+/**
+ * @param {?} value
+ * @return {?}
+ */
+function isObject(value) {
+ return !Array.isArray(value) && typeof value == 'object';
+}
+/**
+ * @param {?} value
+ * @param {?} errors
+ * @return {?}
+ */
+function constructTimingAst(value, errors) {
+ var /** @type {?} */ timings = null;
+ if (value.hasOwnProperty('duration')) {
+ timings = /** @type {?} */ (value);
+ }
+ else if (typeof value == 'number') {
+ var /** @type {?} */ duration = resolveTiming(/** @type {?} */ (value), errors).duration;
+ return makeTimingAst(/** @type {?} */ (duration), 0, '');
+ }
+ var /** @type {?} */ strValue = /** @type {?} */ (value);
+ var /** @type {?} */ isDynamic = strValue.split(/\s+/).some(function (v) { return v.charAt(0) == '{' && v.charAt(1) == '{'; });
+ if (isDynamic) {
+ var /** @type {?} */ ast = /** @type {?} */ (makeTimingAst(0, 0, ''));
+ ast.dynamic = true;
+ ast.strValue = strValue;
+ return /** @type {?} */ (ast);
+ }
+ timings = timings || resolveTiming(strValue, errors);
+ return makeTimingAst(timings.duration, timings.delay, timings.easing);
+}
+/**
+ * @param {?} options
+ * @return {?}
+ */
+function normalizeAnimationOptions(options) {
+ if (options) {
+ options = copyObj(options);
+ if (options['params']) {
+ options['params'] = /** @type {?} */ ((normalizeParams(options['params'])));
+ }
+ }
+ else {
+ options = {};
+ }
+ return options;
+}
+/**
+ * @param {?} duration
+ * @param {?} delay
+ * @param {?} easing
+ * @return {?}
+ */
+function makeTimingAst(duration, delay, easing) {
+ return { duration: duration, delay: delay, easing: easing };
+}
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+/**
+ * @record
+ */
+
+/**
+ * @param {?} element
+ * @param {?} keyframes
+ * @param {?} preStyleProps
+ * @param {?} postStyleProps
+ * @param {?} duration
+ * @param {?} delay
+ * @param {?=} easing
+ * @param {?=} subTimeline
+ * @return {?}
+ */
+function createTimelineInstruction(element, keyframes, preStyleProps, postStyleProps, duration, delay, easing, subTimeline) {
+ if (easing === void 0) { easing = null; }
+ if (subTimeline === void 0) { subTimeline = false; }
+ return {
+ type: 1 /* TimelineAnimation */,
+ element: element,
+ keyframes: keyframes,
+ preStyleProps: preStyleProps,
+ postStyleProps: postStyleProps,
+ duration: duration,
+ delay: delay,
+ totalTime: duration + delay, easing: easing, subTimeline: subTimeline
+ };
+}
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+var ElementInstructionMap = /** @class */ (function () {
+ function ElementInstructionMap() {
+ this._map = new Map();
+ }
+ /**
+ * @param {?} element
+ * @return {?}
+ */
+ ElementInstructionMap.prototype.consume = /**
+ * @param {?} element
+ * @return {?}
+ */
+ function (element) {
+ var /** @type {?} */ instructions = this._map.get(element);
+ if (instructions) {
+ this._map.delete(element);
+ }
+ else {
+ instructions = [];
+ }
+ return instructions;
+ };
+ /**
+ * @param {?} element
+ * @param {?} instructions
+ * @return {?}
+ */
+ ElementInstructionMap.prototype.append = /**
+ * @param {?} element
+ * @param {?} instructions
+ * @return {?}
+ */
+ function (element, instructions) {
+ var /** @type {?} */ existingInstructions = this._map.get(element);
+ if (!existingInstructions) {
+ this._map.set(element, existingInstructions = []);
+ }
+ existingInstructions.push.apply(existingInstructions, instructions);
+ };
+ /**
+ * @param {?} element
+ * @return {?}
+ */
+ ElementInstructionMap.prototype.has = /**
+ * @param {?} element
+ * @return {?}
+ */
+ function (element) { return this._map.has(element); };
+ /**
+ * @return {?}
+ */
+ ElementInstructionMap.prototype.clear = /**
+ * @return {?}
+ */
+ function () { this._map.clear(); };
+ return ElementInstructionMap;
+}());
+
+/**
+ * @fileoverview added by tsickle
+ * @suppress {checkTypes} checked by tsc
+ */
+var ONE_FRAME_IN_MILLISECONDS = 1;
+var ENTER_TOKEN = ':enter';
+var ENTER_TOKEN_REGEX = new RegExp(ENTER_TOKEN, 'g');
+var LEAVE_TOKEN = ':leave';
+var LEAVE_TOKEN_REGEX = new RegExp(LEAVE_TOKEN, 'g');
+/**
+ * @param {?} driver
+ * @param {?} rootElement
+ * @param {?} ast
+ * @param {?} enterClassName
+ * @param {?} leaveClassName
+ * @param {?=} startingStyles
+ * @param {?=} finalStyles
+ * @param {?=} options
+ * @param {?=} subInstructions
+ * @param {?=} errors
+ * @return {?}
+ */
+function buildAnimationTimelines(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) {
+ if (startingStyles === void 0) { startingStyles = {}; }
+ if (finalStyles === void 0) { finalStyles = {}; }
+ if (errors === void 0) { errors = []; }
+ return new AnimationTimelineBuilderVisitor().buildKeyframes(driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors);
+}
+var AnimationTimelineBuilderVisitor = /** @class */ (function () {
+ function AnimationTimelineBuilderVisitor() {
+ }
+ /**
+ * @param {?} driver
+ * @param {?} rootElement
+ * @param {?} ast
+ * @param {?} enterClassName
+ * @param {?} leaveClassName
+ * @param {?} startingStyles
+ * @param {?} finalStyles
+ * @param {?} options
+ * @param {?=} subInstructions
+ * @param {?=} errors
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.buildKeyframes = /**
+ * @param {?} driver
+ * @param {?} rootElement
+ * @param {?} ast
+ * @param {?} enterClassName
+ * @param {?} leaveClassName
+ * @param {?} startingStyles
+ * @param {?} finalStyles
+ * @param {?} options
+ * @param {?=} subInstructions
+ * @param {?=} errors
+ * @return {?}
+ */
+ function (driver, rootElement, ast, enterClassName, leaveClassName, startingStyles, finalStyles, options, subInstructions, errors) {
+ if (errors === void 0) { errors = []; }
+ subInstructions = subInstructions || new ElementInstructionMap();
+ var /** @type {?} */ context = new AnimationTimelineContext(driver, rootElement, subInstructions, enterClassName, leaveClassName, errors, []);
+ context.options = options;
+ context.currentTimeline.setStyles([startingStyles], null, context.errors, options);
+ visitDslNode(this, ast, context);
+ // this checks to see if an actual animation happened
+ var /** @type {?} */ timelines = context.timelines.filter(function (timeline) { return timeline.containsAnimation(); });
+ if (timelines.length && Object.keys(finalStyles).length) {
+ var /** @type {?} */ tl = timelines[timelines.length - 1];
+ if (!tl.allowOnlyTimelineStyles()) {
+ tl.setStyles([finalStyles], null, context.errors, options);
+ }
+ }
+ return timelines.length ? timelines.map(function (timeline) { return timeline.buildKeyframes(); }) :
+ [createTimelineInstruction(rootElement, [], [], [], 0, 0, '', false)];
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitTrigger = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ // these values are not visited in this AST
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitState = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ // these values are not visited in this AST
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitTransition = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ // these values are not visited in this AST
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitAnimateChild = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ elementInstructions = context.subInstructions.consume(context.element);
+ if (elementInstructions) {
+ var /** @type {?} */ innerContext = context.createSubContext(ast.options);
+ var /** @type {?} */ startTime = context.currentTimeline.currentTime;
+ var /** @type {?} */ endTime = this._visitSubInstructions(elementInstructions, innerContext, /** @type {?} */ (innerContext.options));
+ if (startTime != endTime) {
+ // we do this on the upper context because we created a sub context for
+ // the sub child animations
+ context.transformIntoNewTimeline(endTime);
+ }
+ }
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitAnimateRef = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ innerContext = context.createSubContext(ast.options);
+ innerContext.transformIntoNewTimeline();
+ this.visitReference(ast.animation, innerContext);
+ context.transformIntoNewTimeline(innerContext.currentTimeline.currentTime);
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} instructions
+ * @param {?} context
+ * @param {?} options
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype._visitSubInstructions = /**
+ * @param {?} instructions
+ * @param {?} context
+ * @param {?} options
+ * @return {?}
+ */
+ function (instructions, context, options) {
+ var /** @type {?} */ startTime = context.currentTimeline.currentTime;
+ var /** @type {?} */ furthestTime = startTime;
+ // this is a special-case for when a user wants to skip a sub
+ // animation from being fired entirely.
+ var /** @type {?} */ duration = options.duration != null ? resolveTimingValue(options.duration) : null;
+ var /** @type {?} */ delay = options.delay != null ? resolveTimingValue(options.delay) : null;
+ if (duration !== 0) {
+ instructions.forEach(function (instruction) {
+ var /** @type {?} */ instructionTimings = context.appendInstructionToTimeline(instruction, duration, delay);
+ furthestTime =
+ Math.max(furthestTime, instructionTimings.duration + instructionTimings.delay);
+ });
+ }
+ return furthestTime;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitReference = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ context.updateOptions(ast.options, true);
+ visitDslNode(this, ast.animation, context);
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitSequence = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var _this = this;
+ var /** @type {?} */ subContextCount = context.subContextCount;
+ var /** @type {?} */ ctx = context;
+ var /** @type {?} */ options = ast.options;
+ if (options && (options.params || options.delay)) {
+ ctx = context.createSubContext(options);
+ ctx.transformIntoNewTimeline();
+ if (options.delay != null) {
+ if (ctx.previousNode.type == 6 /* Style */) {
+ ctx.currentTimeline.snapshotCurrentStyles();
+ ctx.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;
+ }
+ var /** @type {?} */ delay = resolveTimingValue(options.delay);
+ ctx.delayNextStep(delay);
+ }
+ }
+ if (ast.steps.length) {
+ ast.steps.forEach(function (s) { return visitDslNode(_this, s, ctx); });
+ // this is here just incase the inner steps only contain or end with a style() call
+ ctx.currentTimeline.applyStylesToKeyframe();
+ // this means that some animation function within the sequence
+ // ended up creating a sub timeline (which means the current
+ // timeline cannot overlap with the contents of the sequence)
+ if (ctx.subContextCount > subContextCount) {
+ ctx.transformIntoNewTimeline();
+ }
+ }
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitGroup = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var _this = this;
+ var /** @type {?} */ innerTimelines = [];
+ var /** @type {?} */ furthestTime = context.currentTimeline.currentTime;
+ var /** @type {?} */ delay = ast.options && ast.options.delay ? resolveTimingValue(ast.options.delay) : 0;
+ ast.steps.forEach(function (s) {
+ var /** @type {?} */ innerContext = context.createSubContext(ast.options);
+ if (delay) {
+ innerContext.delayNextStep(delay);
+ }
+ visitDslNode(_this, s, innerContext);
+ furthestTime = Math.max(furthestTime, innerContext.currentTimeline.currentTime);
+ innerTimelines.push(innerContext.currentTimeline);
+ });
+ // this operation is run after the AST loop because otherwise
+ // if the parent timeline's collected styles were updated then
+ // it would pass in invalid data into the new-to-be forked items
+ innerTimelines.forEach(function (timeline) { return context.currentTimeline.mergeTimelineCollectedStyles(timeline); });
+ context.transformIntoNewTimeline(furthestTime);
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype._visitTiming = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ if ((/** @type {?} */ (ast)).dynamic) {
+ var /** @type {?} */ strValue = (/** @type {?} */ (ast)).strValue;
+ var /** @type {?} */ timingValue = context.params ? interpolateParams(strValue, context.params, context.errors) : strValue;
+ return resolveTiming(timingValue, context.errors);
+ }
+ else {
+ return { duration: ast.duration, delay: ast.delay, easing: ast.easing };
+ }
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitAnimate = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ timings = context.currentAnimateTimings = this._visitTiming(ast.timings, context);
+ var /** @type {?} */ timeline = context.currentTimeline;
+ if (timings.delay) {
+ context.incrementTime(timings.delay);
+ timeline.snapshotCurrentStyles();
+ }
+ var /** @type {?} */ style$$1 = ast.style;
+ if (style$$1.type == 5 /* Keyframes */) {
+ this.visitKeyframes(style$$1, context);
+ }
+ else {
+ context.incrementTime(timings.duration);
+ this.visitStyle(/** @type {?} */ (style$$1), context);
+ timeline.applyStylesToKeyframe();
+ }
+ context.currentAnimateTimings = null;
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitStyle = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ timeline = context.currentTimeline;
+ var /** @type {?} */ timings = /** @type {?} */ ((context.currentAnimateTimings));
+ // this is a special case for when a style() call
+ // directly follows an animate() call (but not inside of an animate() call)
+ if (!timings && timeline.getCurrentStyleProperties().length) {
+ timeline.forwardFrame();
+ }
+ var /** @type {?} */ easing = (timings && timings.easing) || ast.easing;
+ if (ast.isEmptyStep) {
+ timeline.applyEmptyStep(easing);
+ }
+ else {
+ timeline.setStyles(ast.styles, easing, context.errors, context.options);
+ }
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitKeyframes = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ currentAnimateTimings = /** @type {?} */ ((context.currentAnimateTimings));
+ var /** @type {?} */ startTime = (/** @type {?} */ ((context.currentTimeline))).duration;
+ var /** @type {?} */ duration = currentAnimateTimings.duration;
+ var /** @type {?} */ innerContext = context.createSubContext();
+ var /** @type {?} */ innerTimeline = innerContext.currentTimeline;
+ innerTimeline.easing = currentAnimateTimings.easing;
+ ast.styles.forEach(function (step) {
+ var /** @type {?} */ offset = step.offset || 0;
+ innerTimeline.forwardTime(offset * duration);
+ innerTimeline.setStyles(step.styles, step.easing, context.errors, context.options);
+ innerTimeline.applyStylesToKeyframe();
+ });
+ // this will ensure that the parent timeline gets all the styles from
+ // the child even if the new timeline below is not used
+ context.currentTimeline.mergeTimelineCollectedStyles(innerTimeline);
+ // we do this because the window between this timeline and the sub timeline
+ // should ensure that the styles within are exactly the same as they were before
+ context.transformIntoNewTimeline(startTime + duration);
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitQuery = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var _this = this;
+ // in the event that the first step before this is a style step we need
+ // to ensure the styles are applied before the children are animated
+ var /** @type {?} */ startTime = context.currentTimeline.currentTime;
+ var /** @type {?} */ options = /** @type {?} */ ((ast.options || {}));
+ var /** @type {?} */ delay = options.delay ? resolveTimingValue(options.delay) : 0;
+ if (delay && (context.previousNode.type === 6 /* Style */ ||
+ (startTime == 0 && context.currentTimeline.getCurrentStyleProperties().length))) {
+ context.currentTimeline.snapshotCurrentStyles();
+ context.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;
+ }
+ var /** @type {?} */ furthestTime = startTime;
+ var /** @type {?} */ elms = context.invokeQuery(ast.selector, ast.originalSelector, ast.limit, ast.includeSelf, options.optional ? true : false, context.errors);
+ context.currentQueryTotal = elms.length;
+ var /** @type {?} */ sameElementTimeline = null;
+ elms.forEach(function (element, i) {
+ context.currentQueryIndex = i;
+ var /** @type {?} */ innerContext = context.createSubContext(ast.options, element);
+ if (delay) {
+ innerContext.delayNextStep(delay);
+ }
+ if (element === context.element) {
+ sameElementTimeline = innerContext.currentTimeline;
+ }
+ visitDslNode(_this, ast.animation, innerContext);
+ // this is here just incase the inner steps only contain or end
+ // with a style() call (which is here to signal that this is a preparatory
+ // call to style an element before it is animated again)
+ innerContext.currentTimeline.applyStylesToKeyframe();
+ var /** @type {?} */ endTime = innerContext.currentTimeline.currentTime;
+ furthestTime = Math.max(furthestTime, endTime);
+ });
+ context.currentQueryIndex = 0;
+ context.currentQueryTotal = 0;
+ context.transformIntoNewTimeline(furthestTime);
+ if (sameElementTimeline) {
+ context.currentTimeline.mergeTimelineCollectedStyles(sameElementTimeline);
+ context.currentTimeline.snapshotCurrentStyles();
+ }
+ context.previousNode = ast;
+ };
+ /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ AnimationTimelineBuilderVisitor.prototype.visitStagger = /**
+ * @param {?} ast
+ * @param {?} context
+ * @return {?}
+ */
+ function (ast, context) {
+ var /** @type {?} */ parentContext = /** @type {?} */ ((context.parentContext));
+ var /** @type {?} */ tl = context.currentTimeline;
+ var /** @type {?} */ timings = ast.timings;
+ var /** @type {?} */ duration = Math.abs(timings.duration);
+ var /** @type {?} */ maxTime = duration * (context.currentQueryTotal - 1);
+ var /** @type {?} */ delay = duration * context.currentQueryIndex;
+ var /** @type {?} */ staggerTransformer = timings.duration < 0 ? 'reverse' : timings.easing;
+ switch (staggerTransformer) {
+ case 'reverse':
+ delay = maxTime - delay;
+ break;
+ case 'full':
+ delay = parentContext.currentStaggerTime;
+ break;
+ }
+ var /** @type {?} */ timeline = context.currentTimeline;
+ if (delay) {
+ timeline.delayNextStep(delay);
+ }
+ var /** @type {?} */ startingTime = timeline.currentTime;
+ visitDslNode(this, ast.animation, context);
+ context.previousNode = ast;
+ // time = duration + delay
+ // the reason why this computation is so complex is because
+ // the inner timeline may either have a delay value or a stretched
+ // keyframe depending on if a subtimeline is not used or is used.
+ parentContext.currentStaggerTime =
+ (tl.currentTime - startingTime) + (tl.startTime - parentContext.currentTimeline.startTime);
+ };
+ return AnimationTimelineBuilderVisitor;
+}());
+var DEFAULT_NOOP_PREVIOUS_NODE = /** @type {?} */ ({});
+var AnimationTimelineContext = /** @class */ (function () {
+ function AnimationTimelineContext(_driver, element, subInstructions, _enterClassName, _leaveClassName, errors, timelines, initialTimeline) {
+ this._driver = _driver;
+ this.element = element;
+ this.subInstructions = subInstructions;
+ this._enterClassName = _enterClassName;
+ this._leaveClassName = _leaveClassName;
+ this.errors = errors;
+ this.timelines = timelines;
+ this.parentContext = null;
+ this.currentAnimateTimings = null;
+ this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;
+ this.subContextCount = 0;
+ this.options = {};
+ this.currentQueryIndex = 0;
+ this.currentQueryTotal = 0;
+ this.currentStaggerTime = 0;
+ this.currentTimeline = initialTimeline || new TimelineBuilder(this._driver, element, 0);
+ timelines.push(this.currentTimeline);
+ }
+ Object.defineProperty(AnimationTimelineContext.prototype, "params", {
+ get: /**
+ * @return {?}
+ */
+ function () { return this.options.params; },
+ enumerable: true,
+ configurable: true
+ });
+ /**
+ * @param {?} options
+ * @param {?=} skipIfExists
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.updateOptions = /**
+ * @param {?} options
+ * @param {?=} skipIfExists
+ * @return {?}
+ */
+ function (options, skipIfExists) {
+ var _this = this;
+ if (!options)
+ return;
+ var /** @type {?} */ newOptions = /** @type {?} */ (options);
+ var /** @type {?} */ optionsToUpdate = this.options;
+ // NOTE: this will get patched up when other animation methods support duration overrides
+ if (newOptions.duration != null) {
+ (/** @type {?} */ (optionsToUpdate)).duration = resolveTimingValue(newOptions.duration);
+ }
+ if (newOptions.delay != null) {
+ optionsToUpdate.delay = resolveTimingValue(newOptions.delay);
+ }
+ var /** @type {?} */ newParams = newOptions.params;
+ if (newParams) {
+ var /** @type {?} */ paramsToUpdate_1 = /** @type {?} */ ((optionsToUpdate.params));
+ if (!paramsToUpdate_1) {
+ paramsToUpdate_1 = this.options.params = {};
+ }
+ Object.keys(newParams).forEach(function (name) {
+ if (!skipIfExists || !paramsToUpdate_1.hasOwnProperty(name)) {
+ paramsToUpdate_1[name] = interpolateParams(newParams[name], paramsToUpdate_1, _this.errors);
+ }
+ });
+ }
+ };
+ /**
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype._copyOptions = /**
+ * @return {?}
+ */
+ function () {
+ var /** @type {?} */ options = {};
+ if (this.options) {
+ var /** @type {?} */ oldParams_1 = this.options.params;
+ if (oldParams_1) {
+ var /** @type {?} */ params_1 = options['params'] = {};
+ Object.keys(oldParams_1).forEach(function (name) { params_1[name] = oldParams_1[name]; });
+ }
+ }
+ return options;
+ };
+ /**
+ * @param {?=} options
+ * @param {?=} element
+ * @param {?=} newTime
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.createSubContext = /**
+ * @param {?=} options
+ * @param {?=} element
+ * @param {?=} newTime
+ * @return {?}
+ */
+ function (options, element, newTime) {
+ if (options === void 0) { options = null; }
+ var /** @type {?} */ target = element || this.element;
+ var /** @type {?} */ context = new AnimationTimelineContext(this._driver, target, this.subInstructions, this._enterClassName, this._leaveClassName, this.errors, this.timelines, this.currentTimeline.fork(target, newTime || 0));
+ context.previousNode = this.previousNode;
+ context.currentAnimateTimings = this.currentAnimateTimings;
+ context.options = this._copyOptions();
+ context.updateOptions(options);
+ context.currentQueryIndex = this.currentQueryIndex;
+ context.currentQueryTotal = this.currentQueryTotal;
+ context.parentContext = this;
+ this.subContextCount++;
+ return context;
+ };
+ /**
+ * @param {?=} newTime
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.transformIntoNewTimeline = /**
+ * @param {?=} newTime
+ * @return {?}
+ */
+ function (newTime) {
+ this.previousNode = DEFAULT_NOOP_PREVIOUS_NODE;
+ this.currentTimeline = this.currentTimeline.fork(this.element, newTime);
+ this.timelines.push(this.currentTimeline);
+ return this.currentTimeline;
+ };
+ /**
+ * @param {?} instruction
+ * @param {?} duration
+ * @param {?} delay
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.appendInstructionToTimeline = /**
+ * @param {?} instruction
+ * @param {?} duration
+ * @param {?} delay
+ * @return {?}
+ */
+ function (instruction, duration, delay) {
+ var /** @type {?} */ updatedTimings = {
+ duration: duration != null ? duration : instruction.duration,
+ delay: this.currentTimeline.currentTime + (delay != null ? delay : 0) + instruction.delay,
+ easing: ''
+ };
+ var /** @type {?} */ builder = new SubTimelineBuilder(this._driver, instruction.element, instruction.keyframes, instruction.preStyleProps, instruction.postStyleProps, updatedTimings, instruction.stretchStartingKeyframe);
+ this.timelines.push(builder);
+ return updatedTimings;
+ };
+ /**
+ * @param {?} time
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.incrementTime = /**
+ * @param {?} time
+ * @return {?}
+ */
+ function (time) {
+ this.currentTimeline.forwardTime(this.currentTimeline.duration + time);
+ };
+ /**
+ * @param {?} delay
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.delayNextStep = /**
+ * @param {?} delay
+ * @return {?}
+ */
+ function (delay) {
+ // negative delays are not yet supported
+ if (delay > 0) {
+ this.currentTimeline.delayNextStep(delay);
+ }
+ };
+ /**
+ * @param {?} selector
+ * @param {?} originalSelector
+ * @param {?} limit
+ * @param {?} includeSelf
+ * @param {?} optional
+ * @param {?} errors
+ * @return {?}
+ */
+ AnimationTimelineContext.prototype.invokeQuery = /**
+ * @param {?} selector
+ * @param {?} originalSelector
+ * @param {?} limit
+ * @param {?} includeSelf
+ * @param {?} optional
+ * @param {?} errors
+ * @return {?}
+ */
+ function (selector, originalSelector, limit, includeSelf, optional, errors) {
+ var /** @type {?} */ results = [];
+ if (includeSelf) {
+ results.push(this.element);
+ }
+ if (selector.length > 0) {
+ // if :self is only used then the selector is empty
+ selector = selector.replace(ENTER_TOKEN_REGEX, '.' + this._enterClassName);
+ selector = selector.replace(LEAVE_TOKEN_REGEX, '.' + this._leaveClassName);
+ var /** @type {?} */ multi = limit != 1;
+ var /** @type {?} */ elements = this._driver.query(this.element, selector, multi);
+ if (limit !== 0) {
+ elements = limit < 0 ? elements.slice(elements.length + limit, elements.length) :
+ elements.slice(0, limit);
+ }
+ results.push.apply(results, elements);
+ }
+ if (!optional && results.length == 0) {
+ errors.push("`query(\"" + originalSelector + "\")` returned zero elements. (Use `query(\"" + originalSelector + "\", { optional: true })` if you wish to allow this.)");
+ }
+ return results;
+ };
+ return AnimationTimelineContext;
+}());
+var TimelineBuilder = /** @class */ (function () {
+ function TimelineBuilder(_driver, element, startTime, _elementTimelineStylesLookup) {
+ this._driver = _driver;
+ this.element = element;
+ this.startTime = startTime;
+ this._elementTimelineStylesLookup = _elementTimelineStylesLookup;
+ this.duration = 0;
+ this._previousKeyframe = {};
+ this._currentKeyframe = {};
+ this._keyframes = new Map();
+ this._styleSummary = {};
+ this._pendingStyles = {};
+ this._backFill = {};
+ this._currentEmptyStepKeyframe = null;
+ if (!this._elementTimelineStylesLookup) {
+ this._elementTimelineStylesLookup = new Map();
+ }
+ this._localTimelineStyles = Object.create(this._backFill, {});
+ this._globalTimelineStyles = /** @type {?} */ ((this._elementTimelineStylesLookup.get(element)));
+ if (!this._globalTimelineStyles) {
+ this._globalTimelineStyles = this._localTimelineStyles;
+ this._elementTimelineStylesLookup.set(element, this._localTimelineStyles);
+ }
+ this._loadKeyframe();
+ }
+ /**
+ * @return {?}
+ */
+ TimelineBuilder.prototype.containsAnimation = /**
+ * @return {?}
+ */
+ function () {
+ switch (this._keyframes.size) {
+ case 0:
+ return false;
+ case 1:
+ return this.getCurrentStyleProperties().length > 0;
+ default:
+ return true;
+ }
+ };
+ /**
+ * @return {?}
+ */
+ TimelineBuilder.prototype.getCurrentStyleProperties = /**
+ * @return {?}
+ */
+ function () { return Object.keys(this._currentKeyframe); };
+ Object.defineProperty(TimelineBuilder.prototype, "currentTime", {
+ get: /**
+ * @return {?}
+ */
+ function () { return this.startTime + this.duration; },
+ enumerable: true,
+ configurable: true
+ });
+ /**
+ * @param {?} delay
+ * @return {?}
+ */
+ TimelineBuilder.prototype.delayNextStep = /**
+ * @param {?} delay
+ * @return {?}
+ */
+ function (delay) {
+ // in the event that a style() step is placed right before a stagger()
+ // and that style() step is the very first style() value in the animation
+ // then we need to make a copy of the keyframe [0, copy, 1] so that the delay
+ // properly applies the style() values to work with the stagger...
+ var /** @type {?} */ hasPreStyleStep = this._keyframes.size == 1 && Object.keys(this._pendingStyles).length;
+ if (this.duration || hasPreStyleStep) {
+ this.forwardTime(this.currentTime + delay);
+ if (hasPreStyleStep) {
+ this.snapshotCurrentStyles();
+ }
+ }
+ else {
+ this.startTime += delay;
+ }
+ };
+ /**
+ * @param {?} element
+ * @param {?=} currentTime
+ * @return {?}
+ */
+ TimelineBuilder.prototype.fork = /**
+ * @param {?} element
+ * @param {?=} currentTime
+ * @return {?}
+ */
+ function (element, currentTime) {
+ this.applyStylesToKeyframe();
+ return new TimelineBuilder(this._driver, element, currentTime || this.currentTime, this._elementTimelineStylesLookup);
+ };
+ /**
+ * @return {?}
+ */
+ TimelineBuilder.prototype._loadKeyframe = /**
+ * @return {?}
+ */
+ function () {
+ if (this._currentKeyframe) {
+ this._previousKeyframe = this._currentKeyframe;
+ }
+ this._currentKeyframe = /** @type {?} */ ((this._keyframes.get(this.duration)));
+ if (!this._currentKeyframe) {
+ this._currentKeyframe = Object.create(this._backFill, {});
+ this._keyframes.set(this.duration, this._currentKeyframe);
+ }
+ };
+ /**
+ * @return {?}
+ */
+ TimelineBuilder.prototype.forwardFrame = /**
+ * @return {?}
+ */
+ function () {
+ this.duration += ONE_FRAME_IN_MILLISECONDS;
+ this._loadKeyframe();
+ };
+ /**
+ * @param {?} time
+ * @return {?}
+ */
+ TimelineBuilder.prototype.forwardTime = /**
+ * @param {?} time
+ * @return {?}
+ */
+ function (time) {
+ this.applyStylesToKeyframe();
+ this.duration = time;
+ this._loadKeyframe();
+ };
+ /**
+ * @param {?} prop
+ * @param {?} value
+ * @return {?}
+ */
+ TimelineBuilder.prototype._updateStyle = /**
+ * @param {?} prop
+ * @param {?} value
+ * @return {?}
+ */
+ function (prop, value) {
+ this._localTimelineStyles[prop] = value;
+ this._globalTimelineStyles[prop] = value;
+ this._styleSummary[prop] = { time: this.currentTime, value: value };
+ };
+ /**
+ * @return {?}
+ */
+ TimelineBuilder.prototype.allowOnlyTimelineStyles = /**
+ * @return {?}
+ */
+ function () { return this._currentEmptyStepKeyframe !== this._currentKeyframe; };
+ /**
+ * @param {?} easing
+ * @return {?}
+ */
+ TimelineBuilder.prototype.applyEmptyStep = /**
+ * @param {?} easing
+ * @return {?}
+ */
+ function (easing) {
+ var _this = this;
+ if (easing) {
+ this._previousKeyframe['easing'] = easing;
+ }
+ // special case for animate(duration):
+ // all missing styles are filled with a `*` value then
+ // if any destination styles are filled in later on the same
+ // keyframe then they will override the overridden styles
+ // We use `_globalTimelineStyles` here because there may be
+ // styles in previous keyframes that are not present in this timeline
+ Object.keys(this._globalTimelineStyles).forEach(function (prop) {
+ _this._backFill[prop] = _this._globalTimelineStyles[prop] || _angular_animations.AUTO_STYLE;
+ _this._currentKeyframe[prop] = _angular_animations.AUTO_STYLE;
+ });
+ this._currentEmptyStepKeyframe = this._currentKeyframe;
+ };
+ /**
+ * @param {?} input
+ * @param {?} easing
+ * @param {?} errors
+ * @param {?=} options
+ * @return {?}
+ */
+ TimelineBuilder.prototype.setStyles = /**
+ * @param {?} input
+ * @param {?} easing
+ * @param {?} errors
+ * @param {?=} options
+ * @return {?}
+ */
+ function (input, easing, errors, options) {
+ var _this = this;
+ if (easing) {
+ this._previousKeyframe['easing'] = easing;
+ }
+ var /** @type {?} */ params = (options && options.params) || {};
+ var /** @type {?} */ styles = flattenStyles(input, this._globalTimelineStyles);
+ Object.keys(styles).forEach(function (prop) {
+ var /** @type {?} */ val = interpolateParams(styles[prop], params, errors);
+ _t
<TRUNCATED>