Created
April 16, 2017 14:53
-
-
Save dancancro/40f535fdb249427809cdd2613f611fa7 to your computer and use it in GitHub Desktop.
This file has been truncated, but you can view the full file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var vendor_lib = | |
/******/ (function(modules) { // webpackBootstrap | |
/******/ // The module cache | |
/******/ var installedModules = {}; | |
/******/ | |
/******/ // The require function | |
/******/ function __webpack_require__(moduleId) { | |
/******/ | |
/******/ // Check if module is in cache | |
/******/ if(installedModules[moduleId]) | |
/******/ return installedModules[moduleId].exports; | |
/******/ | |
/******/ // Create a new module (and put it into the cache) | |
/******/ var module = installedModules[moduleId] = { | |
/******/ i: moduleId, | |
/******/ l: false, | |
/******/ exports: {} | |
/******/ }; | |
/******/ | |
/******/ // Execute the module function | |
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); | |
/******/ | |
/******/ // Flag the module as loaded | |
/******/ module.l = true; | |
/******/ | |
/******/ // Return the exports of the module | |
/******/ return module.exports; | |
/******/ } | |
/******/ | |
/******/ | |
/******/ // expose the modules object (__webpack_modules__) | |
/******/ __webpack_require__.m = modules; | |
/******/ | |
/******/ // expose the module cache | |
/******/ __webpack_require__.c = installedModules; | |
/******/ | |
/******/ // identity function for calling harmony imports with the correct context | |
/******/ __webpack_require__.i = function(value) { return value; }; | |
/******/ | |
/******/ // define getter function for harmony exports | |
/******/ __webpack_require__.d = function(exports, name, getter) { | |
/******/ if(!__webpack_require__.o(exports, name)) { | |
/******/ Object.defineProperty(exports, name, { | |
/******/ configurable: false, | |
/******/ enumerable: true, | |
/******/ get: getter | |
/******/ }); | |
/******/ } | |
/******/ }; | |
/******/ | |
/******/ // getDefaultExport function for compatibility with non-harmony modules | |
/******/ __webpack_require__.n = function(module) { | |
/******/ var getter = module && module.__esModule ? | |
/******/ function getDefault() { return module['default']; } : | |
/******/ function getModuleExports() { return module; }; | |
/******/ __webpack_require__.d(getter, 'a', getter); | |
/******/ return getter; | |
/******/ }; | |
/******/ | |
/******/ // Object.prototype.hasOwnProperty.call | |
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; | |
/******/ | |
/******/ // __webpack_public_path__ | |
/******/ __webpack_require__.p = ""; | |
/******/ | |
/******/ // Load entry module and return exports | |
/******/ return __webpack_require__(__webpack_require__.s = 744); | |
/******/ }) | |
/************************************************************************/ | |
/******/ ([ | |
/* 0 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var root_1 = __webpack_require__(18); | |
var toSubscriber_1 = __webpack_require__(737); | |
var observable_1 = __webpack_require__(97); | |
/** | |
* A representation of any set of values over any amount of time. This the most basic building block | |
* of RxJS. | |
* | |
* @class Observable<T> | |
*/ | |
var Observable = (function () { | |
/** | |
* @constructor | |
* @param {Function} subscribe the function that is called when the Observable is | |
* initially subscribed to. This function is given a Subscriber, to which new values | |
* can be `next`ed, or an `error` method can be called to raise an error, or | |
* `complete` can be called to notify of a successful completion. | |
*/ | |
function Observable(subscribe) { | |
this._isScalar = false; | |
if (subscribe) { | |
this._subscribe = subscribe; | |
} | |
} | |
/** | |
* Creates a new Observable, with this Observable as the source, and the passed | |
* operator defined as the new observable's operator. | |
* @method lift | |
* @param {Operator} operator the operator defining the operation to take on the observable | |
* @return {Observable} a new observable with the Operator applied | |
*/ | |
Observable.prototype.lift = function (operator) { | |
var observable = new Observable(); | |
observable.source = this; | |
observable.operator = operator; | |
return observable; | |
}; | |
Observable.prototype.subscribe = function (observerOrNext, error, complete) { | |
var operator = this.operator; | |
var sink = toSubscriber_1.toSubscriber(observerOrNext, error, complete); | |
if (operator) { | |
operator.call(sink, this.source); | |
} | |
else { | |
sink.add(this._trySubscribe(sink)); | |
} | |
if (sink.syncErrorThrowable) { | |
sink.syncErrorThrowable = false; | |
if (sink.syncErrorThrown) { | |
throw sink.syncErrorValue; | |
} | |
} | |
return sink; | |
}; | |
Observable.prototype._trySubscribe = function (sink) { | |
try { | |
return this._subscribe(sink); | |
} | |
catch (err) { | |
sink.syncErrorThrown = true; | |
sink.syncErrorValue = err; | |
sink.error(err); | |
} | |
}; | |
/** | |
* @method forEach | |
* @param {Function} next a handler for each value emitted by the observable | |
* @param {PromiseConstructor} [PromiseCtor] a constructor function used to instantiate the Promise | |
* @return {Promise} a promise that either resolves on observable completion or | |
* rejects with the handled error | |
*/ | |
Observable.prototype.forEach = function (next, PromiseCtor) { | |
var _this = this; | |
if (!PromiseCtor) { | |
if (root_1.root.Rx && root_1.root.Rx.config && root_1.root.Rx.config.Promise) { | |
PromiseCtor = root_1.root.Rx.config.Promise; | |
} | |
else if (root_1.root.Promise) { | |
PromiseCtor = root_1.root.Promise; | |
} | |
} | |
if (!PromiseCtor) { | |
throw new Error('no Promise impl found'); | |
} | |
return new PromiseCtor(function (resolve, reject) { | |
var subscription = _this.subscribe(function (value) { | |
if (subscription) { | |
// if there is a subscription, then we can surmise | |
// the next handling is asynchronous. Any errors thrown | |
// need to be rejected explicitly and unsubscribe must be | |
// called manually | |
try { | |
next(value); | |
} | |
catch (err) { | |
reject(err); | |
subscription.unsubscribe(); | |
} | |
} | |
else { | |
// if there is NO subscription, then we're getting a nexted | |
// value synchronously during subscription. We can just call it. | |
// If it errors, Observable's `subscribe` will ensure the | |
// unsubscription logic is called, then synchronously rethrow the error. | |
// After that, Promise will trap the error and send it | |
// down the rejection path. | |
next(value); | |
} | |
}, reject, resolve); | |
}); | |
}; | |
Observable.prototype._subscribe = function (subscriber) { | |
return this.source.subscribe(subscriber); | |
}; | |
/** | |
* An interop point defined by the es7-observable spec https://github.com/zenparsing/es-observable | |
* @method Symbol.observable | |
* @return {Observable} this instance of the observable | |
*/ | |
Observable.prototype[observable_1.$$observable] = function () { | |
return this; | |
}; | |
// HACK: Since TypeScript inherits static properties too, we have to | |
// fight against TypeScript here so Subject can have a different static create signature | |
/** | |
* Creates a new cold Observable by calling the Observable constructor | |
* @static true | |
* @owner Observable | |
* @method create | |
* @param {Function} subscribe? the subscriber function to be passed to the Observable constructor | |
* @return {Observable} a new cold observable | |
*/ | |
Observable.create = function (subscribe) { | |
return new Observable(subscribe); | |
}; | |
return Observable; | |
}()); | |
exports.Observable = Observable; | |
//# sourceMappingURL=Observable.js.map | |
/***/ }), | |
/* 1 */, | |
/* 2 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var isFunction_1 = __webpack_require__(102); | |
var Subscription_1 = __webpack_require__(14); | |
var Observer_1 = __webpack_require__(188); | |
var rxSubscriber_1 = __webpack_require__(98); | |
/** | |
* Implements the {@link Observer} interface and extends the | |
* {@link Subscription} class. While the {@link Observer} is the public API for | |
* consuming the values of an {@link Observable}, all Observers get converted to | |
* a Subscriber, in order to provide Subscription-like capabilities such as | |
* `unsubscribe`. Subscriber is a common type in RxJS, and crucial for | |
* implementing operators, but it is rarely used as a public API. | |
* | |
* @class Subscriber<T> | |
*/ | |
var Subscriber = (function (_super) { | |
__extends(Subscriber, _super); | |
/** | |
* @param {Observer|function(value: T): void} [destinationOrNext] A partially | |
* defined Observer or a `next` callback function. | |
* @param {function(e: ?any): void} [error] The `error` callback of an | |
* Observer. | |
* @param {function(): void} [complete] The `complete` callback of an | |
* Observer. | |
*/ | |
function Subscriber(destinationOrNext, error, complete) { | |
_super.call(this); | |
this.syncErrorValue = null; | |
this.syncErrorThrown = false; | |
this.syncErrorThrowable = false; | |
this.isStopped = false; | |
switch (arguments.length) { | |
case 0: | |
this.destination = Observer_1.empty; | |
break; | |
case 1: | |
if (!destinationOrNext) { | |
this.destination = Observer_1.empty; | |
break; | |
} | |
if (typeof destinationOrNext === 'object') { | |
if (destinationOrNext instanceof Subscriber) { | |
this.destination = destinationOrNext; | |
this.destination.add(this); | |
} | |
else { | |
this.syncErrorThrowable = true; | |
this.destination = new SafeSubscriber(this, destinationOrNext); | |
} | |
break; | |
} | |
default: | |
this.syncErrorThrowable = true; | |
this.destination = new SafeSubscriber(this, destinationOrNext, error, complete); | |
break; | |
} | |
} | |
Subscriber.prototype[rxSubscriber_1.$$rxSubscriber] = function () { return this; }; | |
/** | |
* A static factory for a Subscriber, given a (potentially partial) definition | |
* of an Observer. | |
* @param {function(x: ?T): void} [next] The `next` callback of an Observer. | |
* @param {function(e: ?any): void} [error] The `error` callback of an | |
* Observer. | |
* @param {function(): void} [complete] The `complete` callback of an | |
* Observer. | |
* @return {Subscriber<T>} A Subscriber wrapping the (partially defined) | |
* Observer represented by the given arguments. | |
*/ | |
Subscriber.create = function (next, error, complete) { | |
var subscriber = new Subscriber(next, error, complete); | |
subscriber.syncErrorThrowable = false; | |
return subscriber; | |
}; | |
/** | |
* The {@link Observer} callback to receive notifications of type `next` from | |
* the Observable, with a value. The Observable may call this method 0 or more | |
* times. | |
* @param {T} [value] The `next` value. | |
* @return {void} | |
*/ | |
Subscriber.prototype.next = function (value) { | |
if (!this.isStopped) { | |
this._next(value); | |
} | |
}; | |
/** | |
* The {@link Observer} callback to receive notifications of type `error` from | |
* the Observable, with an attached {@link Error}. Notifies the Observer that | |
* the Observable has experienced an error condition. | |
* @param {any} [err] The `error` exception. | |
* @return {void} | |
*/ | |
Subscriber.prototype.error = function (err) { | |
if (!this.isStopped) { | |
this.isStopped = true; | |
this._error(err); | |
} | |
}; | |
/** | |
* The {@link Observer} callback to receive a valueless notification of type | |
* `complete` from the Observable. Notifies the Observer that the Observable | |
* has finished sending push-based notifications. | |
* @return {void} | |
*/ | |
Subscriber.prototype.complete = function () { | |
if (!this.isStopped) { | |
this.isStopped = true; | |
this._complete(); | |
} | |
}; | |
Subscriber.prototype.unsubscribe = function () { | |
if (this.closed) { | |
return; | |
} | |
this.isStopped = true; | |
_super.prototype.unsubscribe.call(this); | |
}; | |
Subscriber.prototype._next = function (value) { | |
this.destination.next(value); | |
}; | |
Subscriber.prototype._error = function (err) { | |
this.destination.error(err); | |
this.unsubscribe(); | |
}; | |
Subscriber.prototype._complete = function () { | |
this.destination.complete(); | |
this.unsubscribe(); | |
}; | |
Subscriber.prototype._unsubscribeAndRecycle = function () { | |
var _a = this, _parent = _a._parent, _parents = _a._parents; | |
this._parent = null; | |
this._parents = null; | |
this.unsubscribe(); | |
this.closed = false; | |
this.isStopped = false; | |
this._parent = _parent; | |
this._parents = _parents; | |
return this; | |
}; | |
return Subscriber; | |
}(Subscription_1.Subscription)); | |
exports.Subscriber = Subscriber; | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var SafeSubscriber = (function (_super) { | |
__extends(SafeSubscriber, _super); | |
function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) { | |
_super.call(this); | |
this._parentSubscriber = _parentSubscriber; | |
var next; | |
var context = this; | |
if (isFunction_1.isFunction(observerOrNext)) { | |
next = observerOrNext; | |
} | |
else if (observerOrNext) { | |
context = observerOrNext; | |
next = observerOrNext.next; | |
error = observerOrNext.error; | |
complete = observerOrNext.complete; | |
if (isFunction_1.isFunction(context.unsubscribe)) { | |
this.add(context.unsubscribe.bind(context)); | |
} | |
context.unsubscribe = this.unsubscribe.bind(this); | |
} | |
this._context = context; | |
this._next = next; | |
this._error = error; | |
this._complete = complete; | |
} | |
SafeSubscriber.prototype.next = function (value) { | |
if (!this.isStopped && this._next) { | |
var _parentSubscriber = this._parentSubscriber; | |
if (!_parentSubscriber.syncErrorThrowable) { | |
this.__tryOrUnsub(this._next, value); | |
} | |
else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) { | |
this.unsubscribe(); | |
} | |
} | |
}; | |
SafeSubscriber.prototype.error = function (err) { | |
if (!this.isStopped) { | |
var _parentSubscriber = this._parentSubscriber; | |
if (this._error) { | |
if (!_parentSubscriber.syncErrorThrowable) { | |
this.__tryOrUnsub(this._error, err); | |
this.unsubscribe(); | |
} | |
else { | |
this.__tryOrSetError(_parentSubscriber, this._error, err); | |
this.unsubscribe(); | |
} | |
} | |
else if (!_parentSubscriber.syncErrorThrowable) { | |
this.unsubscribe(); | |
throw err; | |
} | |
else { | |
_parentSubscriber.syncErrorValue = err; | |
_parentSubscriber.syncErrorThrown = true; | |
this.unsubscribe(); | |
} | |
} | |
}; | |
SafeSubscriber.prototype.complete = function () { | |
if (!this.isStopped) { | |
var _parentSubscriber = this._parentSubscriber; | |
if (this._complete) { | |
if (!_parentSubscriber.syncErrorThrowable) { | |
this.__tryOrUnsub(this._complete); | |
this.unsubscribe(); | |
} | |
else { | |
this.__tryOrSetError(_parentSubscriber, this._complete); | |
this.unsubscribe(); | |
} | |
} | |
else { | |
this.unsubscribe(); | |
} | |
} | |
}; | |
SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) { | |
try { | |
fn.call(this._context, value); | |
} | |
catch (err) { | |
this.unsubscribe(); | |
throw err; | |
} | |
}; | |
SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) { | |
try { | |
fn.call(this._context, value); | |
} | |
catch (err) { | |
parent.syncErrorValue = err; | |
parent.syncErrorThrown = true; | |
return true; | |
} | |
return false; | |
}; | |
SafeSubscriber.prototype._unsubscribe = function () { | |
var _parentSubscriber = this._parentSubscriber; | |
this._context = null; | |
this._parentSubscriber = null; | |
_parentSubscriber.unsubscribe(); | |
}; | |
return SafeSubscriber; | |
}(Subscriber)); | |
//# sourceMappingURL=Subscriber.js.map | |
/***/ }), | |
/* 3 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subscriber_1 = __webpack_require__(2); | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var OuterSubscriber = (function (_super) { | |
__extends(OuterSubscriber, _super); | |
function OuterSubscriber() { | |
_super.apply(this, arguments); | |
} | |
OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { | |
this.destination.next(innerValue); | |
}; | |
OuterSubscriber.prototype.notifyError = function (error, innerSub) { | |
this.destination.error(error); | |
}; | |
OuterSubscriber.prototype.notifyComplete = function (innerSub) { | |
this.destination.complete(); | |
}; | |
return OuterSubscriber; | |
}(Subscriber_1.Subscriber)); | |
exports.OuterSubscriber = OuterSubscriber; | |
//# sourceMappingURL=OuterSubscriber.js.map | |
/***/ }), | |
/* 4 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var root_1 = __webpack_require__(18); | |
var isArrayLike_1 = __webpack_require__(221); | |
var isPromise_1 = __webpack_require__(223); | |
var isObject_1 = __webpack_require__(222); | |
var Observable_1 = __webpack_require__(0); | |
var iterator_1 = __webpack_require__(77); | |
var InnerSubscriber_1 = __webpack_require__(476); | |
var observable_1 = __webpack_require__(97); | |
function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) { | |
var destination = new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex); | |
if (destination.closed) { | |
return null; | |
} | |
if (result instanceof Observable_1.Observable) { | |
if (result._isScalar) { | |
destination.next(result.value); | |
destination.complete(); | |
return null; | |
} | |
else { | |
return result.subscribe(destination); | |
} | |
} | |
else if (isArrayLike_1.isArrayLike(result)) { | |
for (var i = 0, len = result.length; i < len && !destination.closed; i++) { | |
destination.next(result[i]); | |
} | |
if (!destination.closed) { | |
destination.complete(); | |
} | |
} | |
else if (isPromise_1.isPromise(result)) { | |
result.then(function (value) { | |
if (!destination.closed) { | |
destination.next(value); | |
destination.complete(); | |
} | |
}, function (err) { return destination.error(err); }) | |
.then(null, function (err) { | |
// Escaping the Promise trap: globally throw unhandled errors | |
root_1.root.setTimeout(function () { throw err; }); | |
}); | |
return destination; | |
} | |
else if (result && typeof result[iterator_1.$$iterator] === 'function') { | |
var iterator = result[iterator_1.$$iterator](); | |
do { | |
var item = iterator.next(); | |
if (item.done) { | |
destination.complete(); | |
break; | |
} | |
destination.next(item.value); | |
if (destination.closed) { | |
break; | |
} | |
} while (true); | |
} | |
else if (result && typeof result[observable_1.$$observable] === 'function') { | |
var obs = result[observable_1.$$observable](); | |
if (typeof obs.subscribe !== 'function') { | |
destination.error(new TypeError('Provided object does not correctly implement Symbol.observable')); | |
} | |
else { | |
return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex)); | |
} | |
} | |
else { | |
var value = isObject_1.isObject(result) ? 'an invalid object' : "'" + result + "'"; | |
var msg = ("You provided " + value + " where a stream was expected.") | |
+ ' You can provide an Observable, Promise, Array, or Iterable.'; | |
destination.error(new TypeError(msg)); | |
} | |
return null; | |
} | |
exports.subscribeToResult = subscribeToResult; | |
//# sourceMappingURL=subscribeToResult.js.map | |
/***/ }), | |
/* 5 */, | |
/* 6 */, | |
/* 7 */, | |
/* 8 */, | |
/* 9 */, | |
/* 10 */, | |
/* 11 */, | |
/* 12 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Observable_1 = __webpack_require__(0); | |
var Subscriber_1 = __webpack_require__(2); | |
var Subscription_1 = __webpack_require__(14); | |
var ObjectUnsubscribedError_1 = __webpack_require__(100); | |
var SubjectSubscription_1 = __webpack_require__(189); | |
var rxSubscriber_1 = __webpack_require__(98); | |
/** | |
* @class SubjectSubscriber<T> | |
*/ | |
var SubjectSubscriber = (function (_super) { | |
__extends(SubjectSubscriber, _super); | |
function SubjectSubscriber(destination) { | |
_super.call(this, destination); | |
this.destination = destination; | |
} | |
return SubjectSubscriber; | |
}(Subscriber_1.Subscriber)); | |
exports.SubjectSubscriber = SubjectSubscriber; | |
/** | |
* @class Subject<T> | |
*/ | |
var Subject = (function (_super) { | |
__extends(Subject, _super); | |
function Subject() { | |
_super.call(this); | |
this.observers = []; | |
this.closed = false; | |
this.isStopped = false; | |
this.hasError = false; | |
this.thrownError = null; | |
} | |
Subject.prototype[rxSubscriber_1.$$rxSubscriber] = function () { | |
return new SubjectSubscriber(this); | |
}; | |
Subject.prototype.lift = function (operator) { | |
var subject = new AnonymousSubject(this, this); | |
subject.operator = operator; | |
return subject; | |
}; | |
Subject.prototype.next = function (value) { | |
if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
if (!this.isStopped) { | |
var observers = this.observers; | |
var len = observers.length; | |
var copy = observers.slice(); | |
for (var i = 0; i < len; i++) { | |
copy[i].next(value); | |
} | |
} | |
}; | |
Subject.prototype.error = function (err) { | |
if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
this.hasError = true; | |
this.thrownError = err; | |
this.isStopped = true; | |
var observers = this.observers; | |
var len = observers.length; | |
var copy = observers.slice(); | |
for (var i = 0; i < len; i++) { | |
copy[i].error(err); | |
} | |
this.observers.length = 0; | |
}; | |
Subject.prototype.complete = function () { | |
if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
this.isStopped = true; | |
var observers = this.observers; | |
var len = observers.length; | |
var copy = observers.slice(); | |
for (var i = 0; i < len; i++) { | |
copy[i].complete(); | |
} | |
this.observers.length = 0; | |
}; | |
Subject.prototype.unsubscribe = function () { | |
this.isStopped = true; | |
this.closed = true; | |
this.observers = null; | |
}; | |
Subject.prototype._trySubscribe = function (subscriber) { | |
if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
else { | |
return _super.prototype._trySubscribe.call(this, subscriber); | |
} | |
}; | |
Subject.prototype._subscribe = function (subscriber) { | |
if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
else if (this.hasError) { | |
subscriber.error(this.thrownError); | |
return Subscription_1.Subscription.EMPTY; | |
} | |
else if (this.isStopped) { | |
subscriber.complete(); | |
return Subscription_1.Subscription.EMPTY; | |
} | |
else { | |
this.observers.push(subscriber); | |
return new SubjectSubscription_1.SubjectSubscription(this, subscriber); | |
} | |
}; | |
Subject.prototype.asObservable = function () { | |
var observable = new Observable_1.Observable(); | |
observable.source = this; | |
return observable; | |
}; | |
Subject.create = function (destination, source) { | |
return new AnonymousSubject(destination, source); | |
}; | |
return Subject; | |
}(Observable_1.Observable)); | |
exports.Subject = Subject; | |
/** | |
* @class AnonymousSubject<T> | |
*/ | |
var AnonymousSubject = (function (_super) { | |
__extends(AnonymousSubject, _super); | |
function AnonymousSubject(destination, source) { | |
_super.call(this); | |
this.destination = destination; | |
this.source = source; | |
} | |
AnonymousSubject.prototype.next = function (value) { | |
var destination = this.destination; | |
if (destination && destination.next) { | |
destination.next(value); | |
} | |
}; | |
AnonymousSubject.prototype.error = function (err) { | |
var destination = this.destination; | |
if (destination && destination.error) { | |
this.destination.error(err); | |
} | |
}; | |
AnonymousSubject.prototype.complete = function () { | |
var destination = this.destination; | |
if (destination && destination.complete) { | |
this.destination.complete(); | |
} | |
}; | |
AnonymousSubject.prototype._subscribe = function (subscriber) { | |
var source = this.source; | |
if (source) { | |
return this.source.subscribe(subscriber); | |
} | |
else { | |
return Subscription_1.Subscription.EMPTY; | |
} | |
}; | |
return AnonymousSubject; | |
}(Subject)); | |
exports.AnonymousSubject = AnonymousSubject; | |
//# sourceMappingURL=Subject.js.map | |
/***/ }), | |
/* 13 */ | |
/***/ (function(module, exports) { | |
var g; | |
// This works in non-strict mode | |
g = (function() { | |
return this; | |
})(); | |
try { | |
// This works if eval is allowed (see CSP) | |
g = g || Function("return this")() || (1,eval)("this"); | |
} catch(e) { | |
// This works if the window reference is available | |
if(typeof window === "object") | |
g = window; | |
} | |
// g can still be undefined, but nothing to do about it... | |
// We return undefined, instead of nothing here, so it's | |
// easier to handle this case. if(!global) { ...} | |
module.exports = g; | |
/***/ }), | |
/* 14 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var isArray_1 = __webpack_require__(43); | |
var isObject_1 = __webpack_require__(222); | |
var isFunction_1 = __webpack_require__(102); | |
var tryCatch_1 = __webpack_require__(19); | |
var errorObject_1 = __webpack_require__(16); | |
var UnsubscriptionError_1 = __webpack_require__(219); | |
/** | |
* Represents a disposable resource, such as the execution of an Observable. A | |
* Subscription has one important method, `unsubscribe`, that takes no argument | |
* and just disposes the resource held by the subscription. | |
* | |
* Additionally, subscriptions may be grouped together through the `add()` | |
* method, which will attach a child Subscription to the current Subscription. | |
* When a Subscription is unsubscribed, all its children (and its grandchildren) | |
* will be unsubscribed as well. | |
* | |
* @class Subscription | |
*/ | |
var Subscription = (function () { | |
/** | |
* @param {function(): void} [unsubscribe] A function describing how to | |
* perform the disposal of resources when the `unsubscribe` method is called. | |
*/ | |
function Subscription(unsubscribe) { | |
/** | |
* A flag to indicate whether this Subscription has already been unsubscribed. | |
* @type {boolean} | |
*/ | |
this.closed = false; | |
this._parent = null; | |
this._parents = null; | |
this._subscriptions = null; | |
if (unsubscribe) { | |
this._unsubscribe = unsubscribe; | |
} | |
} | |
/** | |
* Disposes the resources held by the subscription. May, for instance, cancel | |
* an ongoing Observable execution or cancel any other type of work that | |
* started when the Subscription was created. | |
* @return {void} | |
*/ | |
Subscription.prototype.unsubscribe = function () { | |
var hasErrors = false; | |
var errors; | |
if (this.closed) { | |
return; | |
} | |
var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; | |
this.closed = true; | |
this._parent = null; | |
this._parents = null; | |
// null out _subscriptions first so any child subscriptions that attempt | |
// to remove themselves from this subscription will noop | |
this._subscriptions = null; | |
var index = -1; | |
var len = _parents ? _parents.length : 0; | |
// if this._parent is null, then so is this._parents, and we | |
// don't have to remove ourselves from any parent subscriptions. | |
while (_parent) { | |
_parent.remove(this); | |
// if this._parents is null or index >= len, | |
// then _parent is set to null, and the loop exits | |
_parent = ++index < len && _parents[index] || null; | |
} | |
if (isFunction_1.isFunction(_unsubscribe)) { | |
var trial = tryCatch_1.tryCatch(_unsubscribe).call(this); | |
if (trial === errorObject_1.errorObject) { | |
hasErrors = true; | |
errors = errors || (errorObject_1.errorObject.e instanceof UnsubscriptionError_1.UnsubscriptionError ? | |
flattenUnsubscriptionErrors(errorObject_1.errorObject.e.errors) : [errorObject_1.errorObject.e]); | |
} | |
} | |
if (isArray_1.isArray(_subscriptions)) { | |
index = -1; | |
len = _subscriptions.length; | |
while (++index < len) { | |
var sub = _subscriptions[index]; | |
if (isObject_1.isObject(sub)) { | |
var trial = tryCatch_1.tryCatch(sub.unsubscribe).call(sub); | |
if (trial === errorObject_1.errorObject) { | |
hasErrors = true; | |
errors = errors || []; | |
var err = errorObject_1.errorObject.e; | |
if (err instanceof UnsubscriptionError_1.UnsubscriptionError) { | |
errors = errors.concat(flattenUnsubscriptionErrors(err.errors)); | |
} | |
else { | |
errors.push(err); | |
} | |
} | |
} | |
} | |
} | |
if (hasErrors) { | |
throw new UnsubscriptionError_1.UnsubscriptionError(errors); | |
} | |
}; | |
/** | |
* Adds a tear down to be called during the unsubscribe() of this | |
* Subscription. | |
* | |
* If the tear down being added is a subscription that is already | |
* unsubscribed, is the same reference `add` is being called on, or is | |
* `Subscription.EMPTY`, it will not be added. | |
* | |
* If this subscription is already in an `closed` state, the passed | |
* tear down logic will be executed immediately. | |
* | |
* @param {TeardownLogic} teardown The additional logic to execute on | |
* teardown. | |
* @return {Subscription} Returns the Subscription used or created to be | |
* added to the inner subscriptions list. This Subscription can be used with | |
* `remove()` to remove the passed teardown logic from the inner subscriptions | |
* list. | |
*/ | |
Subscription.prototype.add = function (teardown) { | |
if (!teardown || (teardown === Subscription.EMPTY)) { | |
return Subscription.EMPTY; | |
} | |
if (teardown === this) { | |
return this; | |
} | |
var subscription = teardown; | |
switch (typeof teardown) { | |
case 'function': | |
subscription = new Subscription(teardown); | |
case 'object': | |
if (subscription.closed || typeof subscription.unsubscribe !== 'function') { | |
return subscription; | |
} | |
else if (this.closed) { | |
subscription.unsubscribe(); | |
return subscription; | |
} | |
else if (typeof subscription._addParent !== 'function' /* quack quack */) { | |
var tmp = subscription; | |
subscription = new Subscription(); | |
subscription._subscriptions = [tmp]; | |
} | |
break; | |
default: | |
throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); | |
} | |
var subscriptions = this._subscriptions || (this._subscriptions = []); | |
subscriptions.push(subscription); | |
subscription._addParent(this); | |
return subscription; | |
}; | |
/** | |
* Removes a Subscription from the internal list of subscriptions that will | |
* unsubscribe during the unsubscribe process of this Subscription. | |
* @param {Subscription} subscription The subscription to remove. | |
* @return {void} | |
*/ | |
Subscription.prototype.remove = function (subscription) { | |
var subscriptions = this._subscriptions; | |
if (subscriptions) { | |
var subscriptionIndex = subscriptions.indexOf(subscription); | |
if (subscriptionIndex !== -1) { | |
subscriptions.splice(subscriptionIndex, 1); | |
} | |
} | |
}; | |
Subscription.prototype._addParent = function (parent) { | |
var _a = this, _parent = _a._parent, _parents = _a._parents; | |
if (!_parent || _parent === parent) { | |
// If we don't have a parent, or the new parent is the same as the | |
// current parent, then set this._parent to the new parent. | |
this._parent = parent; | |
} | |
else if (!_parents) { | |
// If there's already one parent, but not multiple, allocate an Array to | |
// store the rest of the parent Subscriptions. | |
this._parents = [parent]; | |
} | |
else if (_parents.indexOf(parent) === -1) { | |
// Only add the new parent to the _parents list if it's not already there. | |
_parents.push(parent); | |
} | |
}; | |
Subscription.EMPTY = (function (empty) { | |
empty.closed = true; | |
return empty; | |
}(new Subscription())); | |
return Subscription; | |
}()); | |
exports.Subscription = Subscription; | |
function flattenUnsubscriptionErrors(errors) { | |
return errors.reduce(function (errs, err) { return errs.concat((err instanceof UnsubscriptionError_1.UnsubscriptionError) ? err.errors : err); }, []); | |
} | |
//# sourceMappingURL=Subscription.js.map | |
/***/ }), | |
/* 15 */, | |
/* 16 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
// typeof any so that it we don't have to cast when comparing a result to the error object | |
exports.errorObject = { e: {} }; | |
//# sourceMappingURL=errorObject.js.map | |
/***/ }), | |
/* 17 */, | |
/* 18 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(global) { | |
/** | |
* window: browser in DOM main thread | |
* self: browser in WebWorker | |
* global: Node.js/other | |
*/ | |
exports.root = (typeof window == 'object' && window.window === window && window | |
|| typeof self == 'object' && self.self === self && self | |
|| typeof global == 'object' && global.global === global && global); | |
if (!exports.root) { | |
throw new Error('RxJS could not find any global context (window, self, global)'); | |
} | |
//# sourceMappingURL=root.js.map | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) | |
/***/ }), | |
/* 19 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var errorObject_1 = __webpack_require__(16); | |
var tryCatchTarget; | |
function tryCatcher() { | |
try { | |
return tryCatchTarget.apply(this, arguments); | |
} | |
catch (e) { | |
errorObject_1.errorObject.e = e; | |
return errorObject_1.errorObject; | |
} | |
} | |
function tryCatch(fn) { | |
tryCatchTarget = fn; | |
return tryCatcher; | |
} | |
exports.tryCatch = tryCatch; | |
; | |
//# sourceMappingURL=tryCatch.js.map | |
/***/ }), | |
/* 20 */, | |
/* 21 */, | |
/* 22 */, | |
/* 23 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var AsyncAction_1 = __webpack_require__(75); | |
var AsyncScheduler_1 = __webpack_require__(76); | |
/** | |
* | |
* Async Scheduler | |
* | |
* <span class="informal">Schedule task as if you used setTimeout(task, duration)</span> | |
* | |
* `async` scheduler schedules tasks asynchronously, by putting them on the JavaScript | |
* event loop queue. It is best used to delay tasks in time or to schedule tasks repeating | |
* in intervals. | |
* | |
* If you just want to "defer" task, that is to perform it right after currently | |
* executing synchronous code ends (commonly achieved by `setTimeout(deferredTask, 0)`), | |
* better choice will be the {@link asap} scheduler. | |
* | |
* @example <caption>Use async scheduler to delay task</caption> | |
* const task = () => console.log('it works!'); | |
* | |
* Rx.Scheduler.async.schedule(task, 2000); | |
* | |
* // After 2 seconds logs: | |
* // "it works!" | |
* | |
* | |
* @example <caption>Use async scheduler to repeat task in intervals</caption> | |
* function task(state) { | |
* console.log(state); | |
* this.schedule(state + 1, 1000); // `this` references currently executing Action, | |
* // which we reschedule with new state and delay | |
* } | |
* | |
* Rx.Scheduler.async.schedule(task, 3000, 0); | |
* | |
* // Logs: | |
* // 0 after 3s | |
* // 1 after 4s | |
* // 2 after 5s | |
* // 3 after 6s | |
* | |
* @static true | |
* @name async | |
* @owner Scheduler | |
*/ | |
exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction); | |
//# sourceMappingURL=async.js.map | |
/***/ }), | |
/* 24 */, | |
/* 25 */, | |
/* 26 */, | |
/* 27 */, | |
/* 28 */, | |
/* 29 */, | |
/* 30 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(process) {/** | |
* This is the web browser implementation of `debug()`. | |
* | |
* Expose `debug()` as the module. | |
*/ | |
exports = module.exports = __webpack_require__(439); | |
exports.log = log; | |
exports.formatArgs = formatArgs; | |
exports.save = save; | |
exports.load = load; | |
exports.useColors = useColors; | |
exports.storage = 'undefined' != typeof chrome | |
&& 'undefined' != typeof chrome.storage | |
? chrome.storage.local | |
: localstorage(); | |
/** | |
* Colors. | |
*/ | |
exports.colors = [ | |
'lightseagreen', | |
'forestgreen', | |
'goldenrod', | |
'dodgerblue', | |
'darkorchid', | |
'crimson' | |
]; | |
/** | |
* Currently only WebKit-based Web Inspectors, Firefox >= v31, | |
* and the Firebug extension (any Firefox version) are known | |
* to support "%c" CSS customizations. | |
* | |
* TODO: add a `localStorage` variable to explicitly enable/disable colors | |
*/ | |
function useColors() { | |
// NB: In an Electron preload script, document will be defined but not fully | |
// initialized. Since we know we're in Chrome, we'll just detect this case | |
// explicitly | |
if (typeof window !== 'undefined' && window && typeof window.process !== 'undefined' && window.process.type === 'renderer') { | |
return true; | |
} | |
// is webkit? http://stackoverflow.com/a/16459606/376773 | |
// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632 | |
return (typeof document !== 'undefined' && document && 'WebkitAppearance' in document.documentElement.style) || | |
// is firebug? http://stackoverflow.com/a/398120/376773 | |
(typeof window !== 'undefined' && window && window.console && (console.firebug || (console.exception && console.table))) || | |
// is firefox >= v31? | |
// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages | |
(typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/) && parseInt(RegExp.$1, 10) >= 31) || | |
// double check webkit in userAgent just in case we are in a worker | |
(typeof navigator !== 'undefined' && navigator && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)); | |
} | |
/** | |
* Map %j to `JSON.stringify()`, since no Web Inspectors do that by default. | |
*/ | |
exports.formatters.j = function(v) { | |
try { | |
return JSON.stringify(v); | |
} catch (err) { | |
return '[UnexpectedJSONParseError]: ' + err.message; | |
} | |
}; | |
/** | |
* Colorize log arguments if enabled. | |
* | |
* @api public | |
*/ | |
function formatArgs(args) { | |
var useColors = this.useColors; | |
args[0] = (useColors ? '%c' : '') | |
+ this.namespace | |
+ (useColors ? ' %c' : ' ') | |
+ args[0] | |
+ (useColors ? '%c ' : ' ') | |
+ '+' + exports.humanize(this.diff); | |
if (!useColors) return; | |
var c = 'color: ' + this.color; | |
args.splice(1, 0, c, 'color: inherit') | |
// the final "%c" is somewhat tricky, because there could be other | |
// arguments passed either before or after the %c, so we need to | |
// figure out the correct index to insert the CSS into | |
var index = 0; | |
var lastC = 0; | |
args[0].replace(/%[a-zA-Z%]/g, function(match) { | |
if ('%%' === match) return; | |
index++; | |
if ('%c' === match) { | |
// we only are interested in the *last* %c | |
// (the user may have provided their own) | |
lastC = index; | |
} | |
}); | |
args.splice(lastC, 0, c); | |
} | |
/** | |
* Invokes `console.log()` when available. | |
* No-op when `console.log` is not a "function". | |
* | |
* @api public | |
*/ | |
function log() { | |
// this hackery is required for IE8/9, where | |
// the `console.log` function doesn't have 'apply' | |
return 'object' === typeof console | |
&& console.log | |
&& Function.prototype.apply.call(console.log, console, arguments); | |
} | |
/** | |
* Save `namespaces`. | |
* | |
* @param {String} namespaces | |
* @api private | |
*/ | |
function save(namespaces) { | |
try { | |
if (null == namespaces) { | |
exports.storage.removeItem('debug'); | |
} else { | |
exports.storage.debug = namespaces; | |
} | |
} catch(e) {} | |
} | |
/** | |
* Load `namespaces`. | |
* | |
* @return {String} returns the previously persisted debug modes | |
* @api private | |
*/ | |
function load() { | |
try { | |
return exports.storage.debug; | |
} catch(e) {} | |
// If debug isn't set in LS, and we're in Electron, try to load $DEBUG | |
if (typeof process !== 'undefined' && 'env' in process) { | |
return process.env.DEBUG; | |
} | |
} | |
/** | |
* Enable namespaces listed in `localStorage.debug` initially. | |
*/ | |
exports.enable(load()); | |
/** | |
* Localstorage attempts to return the localstorage. | |
* | |
* This is necessary because safari throws | |
* when a user disables cookies/localstorage | |
* and you attempt to access it. | |
* | |
* @return {LocalStorage} | |
* @api private | |
*/ | |
function localstorage() { | |
try { | |
return window.localStorage; | |
} catch (e) {} | |
} | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(66))) | |
/***/ }), | |
/* 31 */, | |
/* 32 */, | |
/* 33 */, | |
/* 34 */, | |
/* 35 */, | |
/* 36 */, | |
/* 37 */, | |
/* 38 */, | |
/* 39 */, | |
/* 40 */, | |
/* 41 */, | |
/* 42 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Observable_1 = __webpack_require__(0); | |
var ScalarObservable_1 = __webpack_require__(139); | |
var EmptyObservable_1 = __webpack_require__(49); | |
var isScheduler_1 = __webpack_require__(44); | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @extends {Ignored} | |
* @hide true | |
*/ | |
var ArrayObservable = (function (_super) { | |
__extends(ArrayObservable, _super); | |
function ArrayObservable(array, scheduler) { | |
_super.call(this); | |
this.array = array; | |
this.scheduler = scheduler; | |
if (!scheduler && array.length === 1) { | |
this._isScalar = true; | |
this.value = array[0]; | |
} | |
} | |
ArrayObservable.create = function (array, scheduler) { | |
return new ArrayObservable(array, scheduler); | |
}; | |
/** | |
* Creates an Observable that emits some values you specify as arguments, | |
* immediately one after the other, and then emits a complete notification. | |
* | |
* <span class="informal">Emits the arguments you provide, then completes. | |
* </span> | |
* | |
* <img src="./img/of.png" width="100%"> | |
* | |
* This static operator is useful for creating a simple Observable that only | |
* emits the arguments given, and the complete notification thereafter. It can | |
* be used for composing with other Observables, such as with {@link concat}. | |
* By default, it uses a `null` IScheduler, which means the `next` | |
* notifications are sent synchronously, although with a different IScheduler | |
* it is possible to determine when those notifications will be delivered. | |
* | |
* @example <caption>Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second.</caption> | |
* var numbers = Rx.Observable.of(10, 20, 30); | |
* var letters = Rx.Observable.of('a', 'b', 'c'); | |
* var interval = Rx.Observable.interval(1000); | |
* var result = numbers.concat(letters).concat(interval); | |
* result.subscribe(x => console.log(x)); | |
* | |
* @see {@link create} | |
* @see {@link empty} | |
* @see {@link never} | |
* @see {@link throw} | |
* | |
* @param {...T} values Arguments that represent `next` values to be emitted. | |
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling | |
* the emissions of the `next` notifications. | |
* @return {Observable<T>} An Observable that emits each given input value. | |
* @static true | |
* @name of | |
* @owner Observable | |
*/ | |
ArrayObservable.of = function () { | |
var array = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
array[_i - 0] = arguments[_i]; | |
} | |
var scheduler = array[array.length - 1]; | |
if (isScheduler_1.isScheduler(scheduler)) { | |
array.pop(); | |
} | |
else { | |
scheduler = null; | |
} | |
var len = array.length; | |
if (len > 1) { | |
return new ArrayObservable(array, scheduler); | |
} | |
else if (len === 1) { | |
return new ScalarObservable_1.ScalarObservable(array[0], scheduler); | |
} | |
else { | |
return new EmptyObservable_1.EmptyObservable(scheduler); | |
} | |
}; | |
ArrayObservable.dispatch = function (state) { | |
var array = state.array, index = state.index, count = state.count, subscriber = state.subscriber; | |
if (index >= count) { | |
subscriber.complete(); | |
return; | |
} | |
subscriber.next(array[index]); | |
if (subscriber.closed) { | |
return; | |
} | |
state.index = index + 1; | |
this.schedule(state); | |
}; | |
ArrayObservable.prototype._subscribe = function (subscriber) { | |
var index = 0; | |
var array = this.array; | |
var count = array.length; | |
var scheduler = this.scheduler; | |
if (scheduler) { | |
return scheduler.schedule(ArrayObservable.dispatch, 0, { | |
array: array, index: index, count: count, subscriber: subscriber | |
}); | |
} | |
else { | |
for (var i = 0; i < count && !subscriber.closed; i++) { | |
subscriber.next(array[i]); | |
} | |
subscriber.complete(); | |
} | |
}; | |
return ArrayObservable; | |
}(Observable_1.Observable)); | |
exports.ArrayObservable = ArrayObservable; | |
//# sourceMappingURL=ArrayObservable.js.map | |
/***/ }), | |
/* 43 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); | |
//# sourceMappingURL=isArray.js.map | |
/***/ }), | |
/* 44 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function isScheduler(value) { | |
return value && typeof value.schedule === 'function'; | |
} | |
exports.isScheduler = isScheduler; | |
//# sourceMappingURL=isScheduler.js.map | |
/***/ }), | |
/* 45 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
/* WEBPACK VAR INJECTION */(function(global) {Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__ = __webpack_require__(0); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__ = __webpack_require__(196); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__ = __webpack_require__(210); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__ = __webpack_require__(12); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_3_rxjs_Subject___default = __webpack_require__.n(__WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Class", function() { return Class; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatform", function() { return createPlatform; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertPlatform", function() { return assertPlatform; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyPlatform", function() { return destroyPlatform; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlatform", function() { return getPlatform; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformRef", function() { return PlatformRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationRef", function() { return ApplicationRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableProdMode", function() { return enableProdMode; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDevMode", function() { return isDevMode; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatformFactory", function() { return createPlatformFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgProbeToken", function() { return NgProbeToken; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_ID", function() { return APP_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PACKAGE_ROOT_URL", function() { return PACKAGE_ROOT_URL; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_INITIALIZER", function() { return PLATFORM_INITIALIZER; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_ID", function() { return PLATFORM_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BOOTSTRAP_LISTENER", function() { return APP_BOOTSTRAP_LISTENER; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_INITIALIZER", function() { return APP_INITIALIZER; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationInitStatus", function() { return ApplicationInitStatus; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugElement", function() { return DebugElement; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugNode", function() { return DebugNode; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asNativeElements", function() { return asNativeElements; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDebugNode", function() { return getDebugNode; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Testability", function() { return Testability; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TestabilityRegistry", function() { return TestabilityRegistry; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTestabilityGetter", function() { return setTestabilityGetter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS", function() { return TRANSLATIONS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS_FORMAT", function() { return TRANSLATIONS_FORMAT; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCALE_ID", function() { return LOCALE_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MissingTranslationStrategy", function() { return MissingTranslationStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationModule", function() { return ApplicationModule; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfCreateScope", function() { return wtfCreateScope; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfLeave", function() { return wtfLeave; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfStartTimeRange", function() { return wtfStartTimeRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfEndTimeRange", function() { return wtfEndTimeRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventEmitter", function() { return EventEmitter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return ErrorHandler; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function() { return Sanitizer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SecurityContext", function() { return SecurityContext; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ANALYZE_FOR_ENTRY_COMPONENTS", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function() { return Attribute; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChild", function() { return ContentChild; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChildren", function() { return ContentChildren; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function() { return Query; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChild", function() { return ViewChild; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChildren", function() { return ViewChildren; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return Component; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Directive", function() { return Directive; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostBinding", function() { return HostBinding; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostListener", function() { return HostListener; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pipe", function() { return Pipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CUSTOM_ELEMENTS_SCHEMA", function() { return CUSTOM_ELEMENTS_SCHEMA; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_ERRORS_SCHEMA", function() { return NO_ERRORS_SCHEMA; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModule", function() { return NgModule; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewEncapsulation", function() { return ViewEncapsulation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function() { return Version; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return forwardRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveForwardRef", function() { return resolveForwardRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injector", function() { return Injector; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveInjector", function() { return ReflectiveInjector; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedReflectiveFactory", function() { return ResolvedReflectiveFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveKey", function() { return ReflectiveKey; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectionToken", function() { return InjectionToken; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OpaqueToken", function() { return OpaqueToken; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Inject", function() { return Inject; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Optional", function() { return Optional; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injectable", function() { return Injectable; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Self", function() { return Self; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SkipSelf", function() { return SkipSelf; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Host", function() { return Host; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgZone", function() { return NgZone; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderComponentType", function() { return RenderComponentType; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return Renderer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer2", function() { return Renderer2; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory2", function() { return RendererFactory2; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererStyleFlags2", function() { return RendererStyleFlags2; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RootRenderer", function() { return RootRenderer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPILER_OPTIONS", function() { return COMPILER_OPTIONS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Compiler", function() { return Compiler; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerFactory", function() { return CompilerFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModuleWithComponentFactories", function() { return ModuleWithComponentFactories; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactory", function() { return ComponentFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentRef", function() { return ComponentRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactoryResolver", function() { return ComponentFactoryResolver; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementRef", function() { return ElementRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactory", function() { return NgModuleFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleRef", function() { return NgModuleRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactoryLoader", function() { return NgModuleFactoryLoader; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getModuleFactory", function() { return getModuleFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueryList", function() { return QueryList; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoader", function() { return SystemJsNgModuleLoader; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoaderConfig", function() { return SystemJsNgModuleLoaderConfig; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateRef", function() { return TemplateRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewContainerRef", function() { return ViewContainerRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedViewRef", function() { return EmbeddedViewRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewRef", function() { return ViewRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectionStrategy", function() { return ChangeDetectionStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectorRef", function() { return ChangeDetectorRef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultIterableDiffer", function() { return DefaultIterableDiffer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IterableDiffers", function() { return IterableDiffers; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValueDiffers", function() { return KeyValueDiffers; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleChange", function() { return SimpleChange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedValue", function() { return WrappedValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformCore", function() { return platformCore; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵALLOW_MULTIPLE_PLATFORMS", function() { return ALLOW_MULTIPLE_PLATFORMS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ID_RANDOM_PROVIDER", function() { return APP_ID_RANDOM_PROVIDER; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵValueUnwrapper", function() { return ValueUnwrapper; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdevModeEqual", function() { return devModeEqual; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisListLikeIterable", function() { return isListLikeIterable; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵChangeDetectorStatus", function() { return ChangeDetectorStatus; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisDefaultChangeDetectionStrategy", function() { return isDefaultChangeDetectionStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵConsole", function() { return Console; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵERROR_COMPONENT_TYPE", function() { return ERROR_COMPONENT_TYPE; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵComponentFactory", function() { return ComponentFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCodegenComponentFactoryResolver", function() { return CodegenComponentFactoryResolver; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵLIFECYCLE_HOOKS_VALUES", function() { return LIFECYCLE_HOOKS_VALUES; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵLifecycleHooks", function() { return LifecycleHooks; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵViewMetadata", function() { return ViewMetadata; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflector", function() { return Reflector; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵreflector", function() { return reflector; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflectionCapabilities", function() { return ReflectionCapabilities; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflectorReader", function() { return ReflectorReader; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRenderDebugInfo", function() { return RenderDebugInfo; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵglobal", function() { return _global; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵlooseIdentical", function() { return looseIdentical; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵstringify", function() { return stringify; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmakeDecorator", function() { return makeDecorator; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisObservable", function() { return isObservable; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisPromise", function() { return isPromise; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR", function() { return NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgModuleInjector", function() { return NgModuleInjector; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterModuleFactory", function() { return registerModuleFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_ARRAY", function() { return EMPTY_ARRAY; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_MAP", function() { return EMPTY_MAP; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵand", function() { return anchorDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵccf", function() { return createComponentFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcrt", function() { return createRendererType2; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdid", function() { return directiveDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵeld", function() { return elementDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵelementEventFullName", function() { return elementEventFullName; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetComponentViewDefinitionFactory", function() { return getComponentViewDefinitionFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinlineInterpolate", function() { return inlineInterpolate; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinterpolate", function() { return interpolate; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵncd", function() { return ngContentDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵnov", function() { return nodeValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpid", function() { return pipeDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵprd", function() { return providerDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpad", function() { return pureArrayDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpod", function() { return pureObjectDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵppd", function() { return purePipeDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵqud", function() { return queryDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵted", function() { return textDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵunv", function() { return unwrapValue; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvid", function() { return viewDef; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AUTO_STYLE", function() { return AUTO_STYLE$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "trigger", function() { return trigger$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animate", function() { return animate$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "group", function() { return group$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequence", function() { return sequence$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "style", function() { return style$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "state", function() { return state$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "keyframes", function() { return keyframes$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "transition", function() { return transition$$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵba", function() { return animate$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbb", function() { return group$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbf", function() { return keyframes$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbc", function() { return sequence$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbe", function() { return state$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbd", function() { return style$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbg", function() { return transition$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵz", function() { return trigger$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵo", function() { return _initViewEngine; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵl", function() { return _iterableDiffersFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵm", function() { return _keyValueDiffersFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵn", function() { return _localeFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return ApplicationRef_; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return _appIdRandomProviderFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵh", function() { return defaultIterableDiffers; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi", function() { return defaultKeyValueDiffers; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵj", function() { return DefaultIterableDifferFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵk", function() { return DefaultKeyValueDifferFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵc", function() { return ReflectiveInjector_; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return ReflectiveDependency; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return resolveReflectiveProviders; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵp", function() { return wtfEnabled; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵr", function() { return createScope$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵq", function() { return detectWTF; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵu", function() { return endTimeRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵs", function() { return leave; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵt", function() { return startTimeRange; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return makeParamDecorator; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return makePropDecorator; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵw", function() { return _def; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵx", function() { return DebugContext; }); | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* @license Angular v4.0.1 | |
* (c) 2010-2017 Google, Inc. https://angular.io/ | |
* License: MIT | |
*/ | |
/** | |
* Creates a token that can be used in a DI Provider. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/Ys9ezXpj2Mnoy3Uc8KBp?p=preview)) | |
* | |
* ```typescript | |
* var t = new OpaqueToken("value"); | |
* | |
* var injector = Injector.resolveAndCreate([ | |
* {provide: t, useValue: "bindingValue"} | |
* ]); | |
* | |
* expect(injector.get(t)).toEqual("bindingValue"); | |
* ``` | |
* | |
* Using an `OpaqueToken` is preferable to using strings as tokens because of possible collisions | |
* caused by multiple providers using the same string as two different tokens. | |
* | |
* Using an `OpaqueToken` is preferable to using an `Object` as tokens because it provides better | |
* error messages. | |
* @deprecated since v4.0.0 because it does not support type information, use `InjectionToken<?>` | |
* instead. | |
*/ | |
var OpaqueToken = (function () { | |
/** | |
* @param {?} _desc | |
*/ | |
function OpaqueToken(_desc) { | |
this._desc = _desc; | |
} | |
/** | |
* @return {?} | |
*/ | |
OpaqueToken.prototype.toString = function () { return "Token " + this._desc; }; | |
return OpaqueToken; | |
}()); | |
/** | |
* Creates a token that can be used in a DI Provider. | |
* | |
* Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a | |
* runtime representation) such as when injecting an interface, callable type, array or | |
* parametrized type. | |
* | |
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by | |
* the `Injector`. This provides additional level of type safety. | |
* | |
* ``` | |
* interface MyInterface {...} | |
* var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken')); | |
* // myInterface is inferred to be MyInterface. | |
* ``` | |
* | |
* ### Example | |
* | |
* {\@example core/di/ts/injector_spec.ts region='InjectionToken'} | |
* | |
* \@stable | |
*/ | |
var InjectionToken = (function (_super) { | |
__extends(InjectionToken, _super); | |
/** | |
* @param {?} desc | |
*/ | |
function InjectionToken(desc) { | |
return _super.call(this, desc) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; }; | |
return InjectionToken; | |
}(OpaqueToken)); | |
/** | |
* @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 __window = typeof window !== 'undefined' && window; | |
var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' && | |
self instanceof WorkerGlobalScope && self; | |
var __global = typeof global !== 'undefined' && global; | |
var _global = __window || __global || __self; | |
var _symbolIterator = null; | |
/** | |
* @return {?} | |
*/ | |
function getSymbolIterator() { | |
if (!_symbolIterator) { | |
var /** @type {?} */ Symbol = _global['Symbol']; | |
if (Symbol && Symbol.iterator) { | |
_symbolIterator = Symbol.iterator; | |
} | |
else { | |
// es6-shim specific logic | |
var /** @type {?} */ keys = Object.getOwnPropertyNames(Map.prototype); | |
for (var /** @type {?} */ i = 0; i < keys.length; ++i) { | |
var /** @type {?} */ key = keys[i]; | |
if (key !== 'entries' && key !== 'size' && | |
((Map)).prototype[key] === Map.prototype['entries']) { | |
_symbolIterator = key; | |
} | |
} | |
} | |
} | |
return _symbolIterator; | |
} | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
function scheduleMicroTask(fn) { | |
Zone.current.scheduleMicroTask('scheduleMicrotask', fn); | |
} | |
/** | |
* @param {?} a | |
* @param {?} b | |
* @return {?} | |
*/ | |
function looseIdentical(a, b) { | |
return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b); | |
} | |
/** | |
* @param {?} token | |
* @return {?} | |
*/ | |
function stringify(token) { | |
if (typeof token === 'string') { | |
return token; | |
} | |
if (token == null) { | |
return '' + token; | |
} | |
if (token.overriddenName) { | |
return "" + token.overriddenName; | |
} | |
if (token.name) { | |
return "" + token.name; | |
} | |
var /** @type {?} */ res = token.toString(); | |
if (res == null) { | |
return '' + res; | |
} | |
var /** @type {?} */ newLineIndex = res.indexOf('\n'); | |
return newLineIndex === -1 ? res : res.substring(0, newLineIndex); | |
} | |
/** | |
* @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 _nextClassId = 0; | |
var Reflect = _global['Reflect']; | |
/** | |
* @param {?} annotation | |
* @return {?} | |
*/ | |
function extractAnnotation(annotation) { | |
if (typeof annotation === 'function' && annotation.hasOwnProperty('annotation')) { | |
// it is a decorator, extract annotation | |
annotation = annotation.annotation; | |
} | |
return annotation; | |
} | |
/** | |
* @param {?} fnOrArray | |
* @param {?} key | |
* @return {?} | |
*/ | |
function applyParams(fnOrArray, key) { | |
if (fnOrArray === Object || fnOrArray === String || fnOrArray === Function || | |
fnOrArray === Number || fnOrArray === Array) { | |
throw new Error("Can not use native " + stringify(fnOrArray) + " as constructor"); | |
} | |
if (typeof fnOrArray === 'function') { | |
return fnOrArray; | |
} | |
if (Array.isArray(fnOrArray)) { | |
var /** @type {?} */ annotations = (fnOrArray); | |
var /** @type {?} */ annoLength = annotations.length - 1; | |
var /** @type {?} */ fn = fnOrArray[annoLength]; | |
if (typeof fn !== 'function') { | |
throw new Error("Last position of Class method array must be Function in key " + key + " was '" + stringify(fn) + "'"); | |
} | |
if (annoLength != fn.length) { | |
throw new Error("Number of annotations (" + annoLength + ") does not match number of arguments (" + fn.length + ") in the function: " + stringify(fn)); | |
} | |
var /** @type {?} */ paramsAnnotations = []; | |
for (var /** @type {?} */ i = 0, /** @type {?} */ ii = annotations.length - 1; i < ii; i++) { | |
var /** @type {?} */ paramAnnotations = []; | |
paramsAnnotations.push(paramAnnotations); | |
var /** @type {?} */ annotation = annotations[i]; | |
if (Array.isArray(annotation)) { | |
for (var /** @type {?} */ j = 0; j < annotation.length; j++) { | |
paramAnnotations.push(extractAnnotation(annotation[j])); | |
} | |
} | |
else if (typeof annotation === 'function') { | |
paramAnnotations.push(extractAnnotation(annotation)); | |
} | |
else { | |
paramAnnotations.push(annotation); | |
} | |
} | |
Reflect.defineMetadata('parameters', paramsAnnotations, fn); | |
return fn; | |
} | |
throw new Error("Only Function or Array is supported in Class definition for key '" + key + "' is '" + stringify(fnOrArray) + "'"); | |
} | |
/** | |
* Provides a way for expressing ES6 classes with parameter annotations in ES5. | |
* | |
* ## Basic Example | |
* | |
* ``` | |
* var Greeter = ng.Class({ | |
* constructor: function(name) { | |
* this.name = name; | |
* }, | |
* | |
* greet: function() { | |
* alert('Hello ' + this.name + '!'); | |
* } | |
* }); | |
* ``` | |
* | |
* is equivalent to ES6: | |
* | |
* ``` | |
* class Greeter { | |
* constructor(name) { | |
* this.name = name; | |
* } | |
* | |
* greet() { | |
* alert('Hello ' + this.name + '!'); | |
* } | |
* } | |
* ``` | |
* | |
* or equivalent to ES5: | |
* | |
* ``` | |
* var Greeter = function (name) { | |
* this.name = name; | |
* } | |
* | |
* Greeter.prototype.greet = function () { | |
* alert('Hello ' + this.name + '!'); | |
* } | |
* ``` | |
* | |
* ### Example with parameter annotations | |
* | |
* ``` | |
* var MyService = ng.Class({ | |
* constructor: [String, [new Optional(), Service], function(name, myService) { | |
* ... | |
* }] | |
* }); | |
* ``` | |
* | |
* is equivalent to ES6: | |
* | |
* ``` | |
* class MyService { | |
* constructor(name: string, \@Optional() myService: Service) { | |
* ... | |
* } | |
* } | |
* ``` | |
* | |
* ### Example with inheritance | |
* | |
* ``` | |
* var Shape = ng.Class({ | |
* constructor: (color) { | |
* this.color = color; | |
* } | |
* }); | |
* | |
* var Square = ng.Class({ | |
* extends: Shape, | |
* constructor: function(color, size) { | |
* Shape.call(this, color); | |
* this.size = size; | |
* } | |
* }); | |
* ``` | |
* @suppress {globalThis} | |
* \@stable | |
* @param {?} clsDef | |
* @return {?} | |
*/ | |
function Class(clsDef) { | |
var /** @type {?} */ constructor = applyParams(clsDef.hasOwnProperty('constructor') ? clsDef.constructor : undefined, 'constructor'); | |
var /** @type {?} */ proto = constructor.prototype; | |
if (clsDef.hasOwnProperty('extends')) { | |
if (typeof clsDef.extends === 'function') { | |
((constructor)).prototype = proto = | |
Object.create(((clsDef.extends)).prototype); | |
} | |
else { | |
throw new Error("Class definition 'extends' property must be a constructor function was: " + stringify(clsDef.extends)); | |
} | |
} | |
for (var /** @type {?} */ key in clsDef) { | |
if (key !== 'extends' && key !== 'prototype' && clsDef.hasOwnProperty(key)) { | |
proto[key] = applyParams(clsDef[key], key); | |
} | |
} | |
if (this && this.annotations instanceof Array) { | |
Reflect.defineMetadata('annotations', this.annotations, constructor); | |
} | |
var /** @type {?} */ constructorName = constructor['name']; | |
if (!constructorName || constructorName === 'constructor') { | |
((constructor))['overriddenName'] = "class" + _nextClassId++; | |
} | |
return (constructor); | |
} | |
/** | |
* @suppress {globalThis} | |
* @param {?} name | |
* @param {?} props | |
* @param {?=} parentClass | |
* @param {?=} chainFn | |
* @return {?} | |
*/ | |
function makeDecorator(name, props, parentClass, chainFn) { | |
var /** @type {?} */ metaCtor = makeMetadataCtor([props]); | |
/** | |
* @param {?} objOrType | |
* @return {?} | |
*/ | |
function DecoratorFactory(objOrType) { | |
if (!(Reflect && Reflect.getOwnMetadata)) { | |
throw 'reflect-metadata shim is required when using class decorators'; | |
} | |
if (this instanceof DecoratorFactory) { | |
metaCtor.call(this, objOrType); | |
return this; | |
} | |
var /** @type {?} */ annotationInstance = new ((DecoratorFactory))(objOrType); | |
var /** @type {?} */ chainAnnotation = typeof this === 'function' && Array.isArray(this.annotations) ? this.annotations : []; | |
chainAnnotation.push(annotationInstance); | |
var /** @type {?} */ TypeDecorator = (function TypeDecorator(cls) { | |
var /** @type {?} */ annotations = Reflect.getOwnMetadata('annotations', cls) || []; | |
annotations.push(annotationInstance); | |
Reflect.defineMetadata('annotations', annotations, cls); | |
return cls; | |
}); | |
TypeDecorator.annotations = chainAnnotation; | |
TypeDecorator.Class = Class; | |
if (chainFn) | |
chainFn(TypeDecorator); | |
return TypeDecorator; | |
} | |
if (parentClass) { | |
DecoratorFactory.prototype = Object.create(parentClass.prototype); | |
} | |
DecoratorFactory.prototype.toString = function () { return "@" + name; }; | |
((DecoratorFactory)).annotationCls = DecoratorFactory; | |
return DecoratorFactory; | |
} | |
/** | |
* @param {?} props | |
* @return {?} | |
*/ | |
function makeMetadataCtor(props) { | |
return function ctor() { | |
var _this = this; | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i] = arguments[_i]; | |
} | |
props.forEach(function (prop, i) { | |
var /** @type {?} */ argVal = args[i]; | |
if (Array.isArray(prop)) { | |
// plain parameter | |
_this[prop[0]] = argVal === undefined ? prop[1] : argVal; | |
} | |
else { | |
for (var /** @type {?} */ propName in prop) { | |
_this[propName] = | |
argVal && argVal.hasOwnProperty(propName) ? argVal[propName] : prop[propName]; | |
} | |
} | |
}); | |
}; | |
} | |
/** | |
* @param {?} name | |
* @param {?} props | |
* @param {?=} parentClass | |
* @return {?} | |
*/ | |
function makeParamDecorator(name, props, parentClass) { | |
var /** @type {?} */ metaCtor = makeMetadataCtor(props); | |
/** | |
* @param {...?} args | |
* @return {?} | |
*/ | |
function ParamDecoratorFactory() { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i] = arguments[_i]; | |
} | |
if (this instanceof ParamDecoratorFactory) { | |
metaCtor.apply(this, args); | |
return this; | |
} | |
var /** @type {?} */ annotationInstance = new (((ParamDecoratorFactory)).bind.apply(((ParamDecoratorFactory)), [void 0].concat(args)))(); | |
((ParamDecorator)).annotation = annotationInstance; | |
return ParamDecorator; | |
/** | |
* @param {?} cls | |
* @param {?} unusedKey | |
* @param {?} index | |
* @return {?} | |
*/ | |
function ParamDecorator(cls, unusedKey, index) { | |
var /** @type {?} */ parameters = Reflect.getOwnMetadata('parameters', cls) || []; | |
// there might be gaps if some in between parameters do not have annotations. | |
// we pad with nulls. | |
while (parameters.length <= index) { | |
parameters.push(null); | |
} | |
parameters[index] = parameters[index] || []; /** @type {?} */ | |
((parameters[index])).push(annotationInstance); | |
Reflect.defineMetadata('parameters', parameters, cls); | |
return cls; | |
} | |
} | |
if (parentClass) { | |
ParamDecoratorFactory.prototype = Object.create(parentClass.prototype); | |
} | |
ParamDecoratorFactory.prototype.toString = function () { return "@" + name; }; | |
((ParamDecoratorFactory)).annotationCls = ParamDecoratorFactory; | |
return ParamDecoratorFactory; | |
} | |
/** | |
* @param {?} name | |
* @param {?} props | |
* @param {?=} parentClass | |
* @return {?} | |
*/ | |
function makePropDecorator(name, props, parentClass) { | |
var /** @type {?} */ metaCtor = makeMetadataCtor(props); | |
/** | |
* @param {...?} args | |
* @return {?} | |
*/ | |
function PropDecoratorFactory() { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i] = arguments[_i]; | |
} | |
if (this instanceof PropDecoratorFactory) { | |
metaCtor.apply(this, args); | |
return this; | |
} | |
var /** @type {?} */ decoratorInstance = new (((PropDecoratorFactory)).bind.apply(((PropDecoratorFactory)), [void 0].concat(args)))(); | |
return function PropDecorator(target, name) { | |
var /** @type {?} */ meta = Reflect.getOwnMetadata('propMetadata', target.constructor) || {}; | |
meta[name] = meta.hasOwnProperty(name) && meta[name] || []; | |
meta[name].unshift(decoratorInstance); | |
Reflect.defineMetadata('propMetadata', meta, target.constructor); | |
}; | |
} | |
if (parentClass) { | |
PropDecoratorFactory.prototype = Object.create(parentClass.prototype); | |
} | |
PropDecoratorFactory.prototype.toString = function () { return "@" + name; }; | |
((PropDecoratorFactory)).annotationCls = PropDecoratorFactory; | |
return PropDecoratorFactory; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* This token can be used to create a virtual provider that will populate the | |
* `entryComponents` fields of components and ng modules based on its `useValue`. | |
* All components that are referenced in the `useValue` value (either directly | |
* or in a nested array or map) will be added to the `entryComponents` property. | |
* | |
* ### Example | |
* The following example shows how the router can populate the `entryComponents` | |
* field of an NgModule based on the router configuration which refers | |
* to components. | |
* | |
* ```typescript | |
* // helper function inside the router | |
* function provideRoutes(routes) { | |
* return [ | |
* {provide: ROUTES, useValue: routes}, | |
* {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true} | |
* ]; | |
* } | |
* | |
* // user code | |
* let routes = [ | |
* {path: '/root', component: RootComp}, | |
* {path: '/teams', component: TeamsComp} | |
* ]; | |
* | |
* \@NgModule({ | |
* providers: [provideRoutes(routes)] | |
* }) | |
* class ModuleWithRoutes {} | |
* ``` | |
* | |
* \@experimental | |
*/ | |
var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents'); | |
/** | |
* Attribute decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Attribute = makeParamDecorator('Attribute', [['attributeName', undefined]]); | |
/** | |
* Base class for query metadata. | |
* | |
* See {\@link ContentChildren}, {\@link ContentChild}, {\@link ViewChildren}, {\@link ViewChild} for | |
* more information. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var Query = (function () { | |
function Query() { | |
} | |
return Query; | |
}()); | |
/** | |
* ContentChildren decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var ContentChildren = makePropDecorator('ContentChildren', [ | |
['selector', undefined], { | |
first: false, | |
isViewQuery: false, | |
descendants: false, | |
read: undefined, | |
} | |
], Query); | |
/** | |
* ContentChild decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var ContentChild = makePropDecorator('ContentChild', [ | |
['selector', undefined], { | |
first: true, | |
isViewQuery: false, | |
descendants: true, | |
read: undefined, | |
} | |
], Query); | |
/** | |
* ViewChildren decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var ViewChildren = makePropDecorator('ViewChildren', [ | |
['selector', undefined], { | |
first: false, | |
isViewQuery: true, | |
descendants: true, | |
read: undefined, | |
} | |
], Query); | |
/** | |
* ViewChild decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var ViewChild = makePropDecorator('ViewChild', [ | |
['selector', undefined], { | |
first: true, | |
isViewQuery: true, | |
descendants: true, | |
read: undefined, | |
} | |
], Query); | |
var ChangeDetectionStrategy = {}; | |
ChangeDetectionStrategy.OnPush = 0; | |
ChangeDetectionStrategy.Default = 1; | |
ChangeDetectionStrategy[ChangeDetectionStrategy.OnPush] = "OnPush"; | |
ChangeDetectionStrategy[ChangeDetectionStrategy.Default] = "Default"; | |
var ChangeDetectorStatus = {}; | |
ChangeDetectorStatus.CheckOnce = 0; | |
ChangeDetectorStatus.Checked = 1; | |
ChangeDetectorStatus.CheckAlways = 2; | |
ChangeDetectorStatus.Detached = 3; | |
ChangeDetectorStatus.Errored = 4; | |
ChangeDetectorStatus.Destroyed = 5; | |
ChangeDetectorStatus[ChangeDetectorStatus.CheckOnce] = "CheckOnce"; | |
ChangeDetectorStatus[ChangeDetectorStatus.Checked] = "Checked"; | |
ChangeDetectorStatus[ChangeDetectorStatus.CheckAlways] = "CheckAlways"; | |
ChangeDetectorStatus[ChangeDetectorStatus.Detached] = "Detached"; | |
ChangeDetectorStatus[ChangeDetectorStatus.Errored] = "Errored"; | |
ChangeDetectorStatus[ChangeDetectorStatus.Destroyed] = "Destroyed"; | |
/** | |
* @param {?} changeDetectionStrategy | |
* @return {?} | |
*/ | |
function isDefaultChangeDetectionStrategy(changeDetectionStrategy) { | |
return changeDetectionStrategy == null || | |
changeDetectionStrategy === ChangeDetectionStrategy.Default; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Directive decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Directive = makeDecorator('Directive', { | |
selector: undefined, | |
inputs: undefined, | |
outputs: undefined, | |
host: undefined, | |
providers: undefined, | |
exportAs: undefined, | |
queries: undefined | |
}); | |
/** | |
* Component decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Component = makeDecorator('Component', { | |
selector: undefined, | |
inputs: undefined, | |
outputs: undefined, | |
host: undefined, | |
exportAs: undefined, | |
moduleId: undefined, | |
providers: undefined, | |
viewProviders: undefined, | |
changeDetection: ChangeDetectionStrategy.Default, | |
queries: undefined, | |
templateUrl: undefined, | |
template: undefined, | |
styleUrls: undefined, | |
styles: undefined, | |
animations: undefined, | |
encapsulation: undefined, | |
interpolation: undefined, | |
entryComponents: undefined | |
}, Directive); | |
/** | |
* Pipe decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Pipe = makeDecorator('Pipe', { | |
name: undefined, | |
pure: true, | |
}); | |
/** | |
* Input decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Input = makePropDecorator('Input', [['bindingPropertyName', undefined]]); | |
/** | |
* Output decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Output = makePropDecorator('Output', [['bindingPropertyName', undefined]]); | |
/** | |
* HostBinding decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var HostBinding = makePropDecorator('HostBinding', [['hostPropertyName', undefined]]); | |
/** | |
* HostListener decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var HostListener = makePropDecorator('HostListener', [['eventName', undefined], ['args', []]]); | |
/** | |
* @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 | |
*/ | |
/** | |
* Defines a schema that will allow: | |
* - any non-Angular elements with a `-` in their name, | |
* - any properties on elements with a `-` in their name which is the common rule for custom | |
* elements. | |
* | |
* \@stable | |
*/ | |
var CUSTOM_ELEMENTS_SCHEMA = { | |
name: 'custom-elements' | |
}; | |
/** | |
* Defines a schema that will allow any property on any element. | |
* | |
* \@experimental | |
*/ | |
var NO_ERRORS_SCHEMA = { | |
name: 'no-errors-schema' | |
}; | |
/** | |
* NgModule decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var NgModule = makeDecorator('NgModule', { | |
providers: undefined, | |
declarations: undefined, | |
imports: undefined, | |
exports: undefined, | |
entryComponents: undefined, | |
bootstrap: undefined, | |
schemas: undefined, | |
id: undefined, | |
}); | |
var ViewEncapsulation = {}; | |
ViewEncapsulation.Emulated = 0; | |
ViewEncapsulation.Native = 1; | |
ViewEncapsulation.None = 2; | |
ViewEncapsulation[ViewEncapsulation.Emulated] = "Emulated"; | |
ViewEncapsulation[ViewEncapsulation.Native] = "Native"; | |
ViewEncapsulation[ViewEncapsulation.None] = "None"; | |
/** | |
* Metadata properties available for configuring Views. | |
* | |
* For details on the `\@Component` annotation, see {\@link Component}. | |
* | |
* ### Example | |
* | |
* ``` | |
* \@Component({ | |
* selector: 'greet', | |
* template: 'Hello {{name}}!', | |
* }) | |
* class Greet { | |
* name: string; | |
* | |
* constructor() { | |
* this.name = 'World'; | |
* } | |
* } | |
* ``` | |
* | |
* @deprecated Use Component instead. | |
* | |
* {\@link Component} | |
*/ | |
var ViewMetadata = (function () { | |
/** | |
* @param {?=} __0 | |
*/ | |
function ViewMetadata(_a) { | |
var _b = _a === void 0 ? {} : _a, templateUrl = _b.templateUrl, template = _b.template, encapsulation = _b.encapsulation, styles = _b.styles, styleUrls = _b.styleUrls, animations = _b.animations, interpolation = _b.interpolation; | |
this.templateUrl = templateUrl; | |
this.template = template; | |
this.styleUrls = styleUrls; | |
this.styles = styles; | |
this.encapsulation = encapsulation; | |
this.animations = animations; | |
this.interpolation = interpolation; | |
} | |
return ViewMetadata; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* \@whatItDoes Represents the version of Angular | |
* | |
* \@stable | |
*/ | |
var Version = (function () { | |
/** | |
* @param {?} full | |
*/ | |
function Version(full) { | |
this.full = full; | |
} | |
Object.defineProperty(Version.prototype, "major", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.full.split('.')[0]; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(Version.prototype, "minor", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.full.split('.')[1]; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(Version.prototype, "patch", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.full.split('.').slice(2).join('.'); }, | |
enumerable: true, | |
configurable: true | |
}); | |
return Version; | |
}()); | |
/** | |
* \@stable | |
*/ | |
var VERSION = new Version('4.0.1'); | |
/** | |
* @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 | |
*/ | |
/** | |
* Inject decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Inject = makeParamDecorator('Inject', [['token', undefined]]); | |
/** | |
* Optional decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Optional = makeParamDecorator('Optional', []); | |
/** | |
* Injectable decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Injectable = makeDecorator('Injectable', []); | |
/** | |
* Self decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Self = makeParamDecorator('Self', []); | |
/** | |
* SkipSelf decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var SkipSelf = makeParamDecorator('SkipSelf', []); | |
/** | |
* Host decorator and metadata. | |
* | |
* \@stable | |
* \@Annotation | |
*/ | |
var Host = makeParamDecorator('Host', []); | |
/** | |
* @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 | |
*/ | |
/** | |
* Allows to refer to references which are not yet defined. | |
* | |
* For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of | |
* DI is declared, | |
* but not yet defined. It is also used when the `token` which we use when creating a query is not | |
* yet defined. | |
* | |
* ### Example | |
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'} | |
* \@experimental | |
* @param {?} forwardRefFn | |
* @return {?} | |
*/ | |
function forwardRef(forwardRefFn) { | |
((forwardRefFn)).__forward_ref__ = forwardRef; | |
((forwardRefFn)).toString = function () { return stringify(this()); }; | |
return (((forwardRefFn))); | |
} | |
/** | |
* Lazily retrieves the reference value from a forwardRef. | |
* | |
* Acts as the identity function when given a non-forward-ref value. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/GU72mJrk1fiodChcmiDR?p=preview)) | |
* | |
* {\@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'} | |
* | |
* See: {\@link forwardRef} | |
* \@experimental | |
* @param {?} type | |
* @return {?} | |
*/ | |
function resolveForwardRef(type) { | |
if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') && | |
type.__forward_ref__ === forwardRef) { | |
return ((type))(); | |
} | |
else { | |
return type; | |
} | |
} | |
/** | |
* @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 _THROW_IF_NOT_FOUND = new Object(); | |
var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; | |
var _NullInjector = (function () { | |
function _NullInjector() { | |
} | |
/** | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
_NullInjector.prototype.get = function (token, notFoundValue) { | |
if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; } | |
if (notFoundValue === _THROW_IF_NOT_FOUND) { | |
throw new Error("No provider for " + stringify(token) + "!"); | |
} | |
return notFoundValue; | |
}; | |
return _NullInjector; | |
}()); | |
/** | |
* \@whatItDoes Injector interface | |
* \@howToUse | |
* ``` | |
* const injector: Injector = ...; | |
* injector.get(...); | |
* ``` | |
* | |
* \@description | |
* For more details, see the {\@linkDocs guide/dependency-injection "Dependency Injection Guide"}. | |
* | |
* ### Example | |
* | |
* {\@example core/di/ts/injector_spec.ts region='Injector'} | |
* | |
* `Injector` returns itself when given `Injector` as a token: | |
* {\@example core/di/ts/injector_spec.ts region='injectInjector'} | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var Injector = (function () { | |
function Injector() { | |
} | |
/** | |
* Retrieves an instance from the injector based on the provided token. | |
* If not found: | |
* - Throws {\@link NoProviderError} if no `notFoundValue` that is not equal to | |
* Injector.THROW_IF_NOT_FOUND is given | |
* - Returns the `notFoundValue` otherwise | |
* @abstract | |
* @template T | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
Injector.prototype.get = function (token, notFoundValue) { }; | |
/** | |
* @deprecated from v4.0.0 use Type<T> or InjectionToken<T> | |
* @suppress {duplicate} | |
* @abstract | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
Injector.prototype.get = function (token, notFoundValue) { }; | |
return Injector; | |
}()); | |
Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND; | |
Injector.NULL = new _NullInjector(); | |
/** | |
* @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 ERROR_COMPONENT_TYPE = 'ngComponentType'; | |
var ERROR_DEBUG_CONTEXT = 'ngDebugContext'; | |
var ERROR_ORIGINAL_ERROR = 'ngOriginalError'; | |
var ERROR_LOGGER = 'ngErrorLogger'; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
function getDebugContext(error) { | |
return ((error))[ERROR_DEBUG_CONTEXT]; | |
} | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
function getOriginalError(error) { | |
return ((error))[ERROR_ORIGINAL_ERROR]; | |
} | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
function getErrorLogger(error) { | |
return ((error))[ERROR_LOGGER] || defaultErrorLogger; | |
} | |
/** | |
* @param {?} console | |
* @param {...?} values | |
* @return {?} | |
*/ | |
function defaultErrorLogger(console) { | |
var values = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
values[_i - 1] = arguments[_i]; | |
} | |
console.error.apply(console, values); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* \@whatItDoes Provides a hook for centralized exception handling. | |
* | |
* \@description | |
* | |
* The default implementation of `ErrorHandler` prints error messages to the `console`. To | |
* intercept error handling, write a custom exception handler that replaces this default as | |
* appropriate for your app. | |
* | |
* ### Example | |
* | |
* ``` | |
* class MyErrorHandler implements ErrorHandler { | |
* handleError(error) { | |
* // do something with the exception | |
* } | |
* } | |
* | |
* \@NgModule({ | |
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}] | |
* }) | |
* class MyModule {} | |
* ``` | |
* | |
* \@stable | |
*/ | |
var ErrorHandler = (function () { | |
/** | |
* @param {?=} deprecatedParameter | |
*/ | |
function ErrorHandler( | |
/** | |
* @deprecated since v4.0 parameter no longer has an effect, as ErrorHandler will never | |
* rethrow. | |
*/ | |
deprecatedParameter) { | |
/** | |
* \@internal | |
*/ | |
this._console = console; | |
} | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
ErrorHandler.prototype.handleError = function (error) { | |
var /** @type {?} */ originalError = this._findOriginalError(error); | |
var /** @type {?} */ context = this._findContext(error); | |
// Note: Browser consoles show the place from where console.error was called. | |
// We can use this to give users additional information about the error. | |
var /** @type {?} */ errorLogger = getErrorLogger(error); | |
errorLogger(this._console, "ERROR", error); | |
if (originalError) { | |
errorLogger(this._console, "ORIGINAL ERROR", originalError); | |
} | |
if (context) { | |
errorLogger(this._console, 'ERROR CONTEXT', context); | |
} | |
}; | |
/** | |
* \@internal | |
* @param {?} error | |
* @return {?} | |
*/ | |
ErrorHandler.prototype._findContext = function (error) { | |
if (error) { | |
return getDebugContext(error) ? getDebugContext(error) : | |
this._findContext(getOriginalError(error)); | |
} | |
return null; | |
}; | |
/** | |
* \@internal | |
* @param {?} error | |
* @return {?} | |
*/ | |
ErrorHandler.prototype._findOriginalError = function (error) { | |
var /** @type {?} */ e = getOriginalError(error); | |
while (e && getOriginalError(e)) { | |
e = getOriginalError(e); | |
} | |
return e; | |
}; | |
return ErrorHandler; | |
}()); | |
/** | |
* @param {?} message | |
* @param {?} originalError | |
* @return {?} | |
*/ | |
function wrappedError(message, originalError) { | |
var /** @type {?} */ msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError); | |
var /** @type {?} */ error = Error(msg); | |
((error))[ERROR_ORIGINAL_ERROR] = originalError; | |
return error; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} keys | |
* @return {?} | |
*/ | |
function findFirstClosedCycle(keys) { | |
var /** @type {?} */ res = []; | |
for (var /** @type {?} */ i = 0; i < keys.length; ++i) { | |
if (res.indexOf(keys[i]) > -1) { | |
res.push(keys[i]); | |
return res; | |
} | |
res.push(keys[i]); | |
} | |
return res; | |
} | |
/** | |
* @param {?} keys | |
* @return {?} | |
*/ | |
function constructResolvingPath(keys) { | |
if (keys.length > 1) { | |
var /** @type {?} */ reversed = findFirstClosedCycle(keys.slice().reverse()); | |
var /** @type {?} */ tokenStrs = reversed.map(function (k) { return stringify(k.token); }); | |
return ' (' + tokenStrs.join(' -> ') + ')'; | |
} | |
return ''; | |
} | |
/** | |
* @param {?} injector | |
* @param {?} key | |
* @param {?} constructResolvingMessage | |
* @param {?=} originalError | |
* @return {?} | |
*/ | |
function injectionError(injector, key, constructResolvingMessage, originalError) { | |
var /** @type {?} */ error = ((originalError ? wrappedError('', originalError) : Error())); | |
error.addKey = addKey; | |
error.keys = [key]; | |
error.injectors = [injector]; | |
error.constructResolvingMessage = constructResolvingMessage; | |
error.message = error.constructResolvingMessage(); | |
((error))[ERROR_ORIGINAL_ERROR] = originalError; | |
return error; | |
} | |
/** | |
* @this {?} | |
* @param {?} injector | |
* @param {?} key | |
* @return {?} | |
*/ | |
function addKey(injector, key) { | |
this.injectors.push(injector); | |
this.keys.push(key); | |
this.message = this.constructResolvingMessage(); | |
} | |
/** | |
* Thrown when trying to retrieve a dependency by key from {\@link Injector}, but the | |
* {\@link Injector} does not have a {\@link Provider} for the given key. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/vq8D3FRB9aGbnWJqtEPE?p=preview)) | |
* | |
* ```typescript | |
* class A { | |
* constructor(b:B) {} | |
* } | |
* | |
* expect(() => Injector.resolveAndCreate([A])).toThrowError(); | |
* ``` | |
* @param {?} injector | |
* @param {?} key | |
* @return {?} | |
*/ | |
function noProviderError(injector, key) { | |
return injectionError(injector, key, function () { | |
var /** @type {?} */ first = stringify(this.keys[0].token); | |
return "No provider for " + first + "!" + constructResolvingPath(this.keys); | |
}); | |
} | |
/** | |
* Thrown when dependencies form a cycle. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/wYQdNos0Tzql3ei1EV9j?p=info)) | |
* | |
* ```typescript | |
* var injector = Injector.resolveAndCreate([ | |
* {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]}, | |
* {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]} | |
* ]); | |
* | |
* expect(() => injector.get("one")).toThrowError(); | |
* ``` | |
* | |
* Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed. | |
* @param {?} injector | |
* @param {?} key | |
* @return {?} | |
*/ | |
function cyclicDependencyError(injector, key) { | |
return injectionError(injector, key, function () { | |
return "Cannot instantiate cyclic dependency!" + constructResolvingPath(this.keys); | |
}); | |
} | |
/** | |
* Thrown when a constructing type returns with an Error. | |
* | |
* The `InstantiationError` class contains the original error plus the dependency graph which caused | |
* this object to be instantiated. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/7aWYdcqTQsP0eNqEdUAf?p=preview)) | |
* | |
* ```typescript | |
* class A { | |
* constructor() { | |
* throw new Error('message'); | |
* } | |
* } | |
* | |
* var injector = Injector.resolveAndCreate([A]); | |
* try { | |
* injector.get(A); | |
* } catch (e) { | |
* expect(e instanceof InstantiationError).toBe(true); | |
* expect(e.originalException.message).toEqual("message"); | |
* expect(e.originalStack).toBeDefined(); | |
* } | |
* ``` | |
* @param {?} injector | |
* @param {?} originalException | |
* @param {?} originalStack | |
* @param {?} key | |
* @return {?} | |
*/ | |
function instantiationError(injector, originalException, originalStack, key) { | |
return injectionError(injector, key, function () { | |
var /** @type {?} */ first = stringify(this.keys[0].token); | |
return getOriginalError(this).message + ": Error during instantiation of " + first + "!" + constructResolvingPath(this.keys) + "."; | |
}, originalException); | |
} | |
/** | |
* Thrown when an object other then {\@link Provider} (or `Type`) is passed to {\@link Injector} | |
* creation. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/YatCFbPAMCL0JSSQ4mvH?p=preview)) | |
* | |
* ```typescript | |
* expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError(); | |
* ``` | |
* @param {?} provider | |
* @return {?} | |
*/ | |
function invalidProviderError(provider) { | |
return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider); | |
} | |
/** | |
* Thrown when the class has no annotation information. | |
* | |
* Lack of annotation information prevents the {\@link Injector} from determining which dependencies | |
* need to be injected into the constructor. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/rHnZtlNS7vJOPQ6pcVkm?p=preview)) | |
* | |
* ```typescript | |
* class A { | |
* constructor(b) {} | |
* } | |
* | |
* expect(() => Injector.resolveAndCreate([A])).toThrowError(); | |
* ``` | |
* | |
* This error is also thrown when the class not marked with {\@link Injectable} has parameter types. | |
* | |
* ```typescript | |
* class B {} | |
* | |
* class A { | |
* constructor(b:B) {} // no information about the parameter types of A is available at runtime. | |
* } | |
* | |
* expect(() => Injector.resolveAndCreate([A,B])).toThrowError(); | |
* ``` | |
* \@stable | |
* @param {?} typeOrFunc | |
* @param {?} params | |
* @return {?} | |
*/ | |
function noAnnotationError(typeOrFunc, params) { | |
var /** @type {?} */ signature = []; | |
for (var /** @type {?} */ i = 0, /** @type {?} */ ii = params.length; i < ii; i++) { | |
var /** @type {?} */ parameter = params[i]; | |
if (!parameter || parameter.length == 0) { | |
signature.push('?'); | |
} | |
else { | |
signature.push(parameter.map(stringify).join(' ')); | |
} | |
} | |
return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' + | |
signature.join(', ') + '). ' + | |
'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' + | |
stringify(typeOrFunc) + '\' is decorated with Injectable.'); | |
} | |
/** | |
* Thrown when getting an object by index. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/bRs0SX2OTQiJzqvjgl8P?p=preview)) | |
* | |
* ```typescript | |
* class A {} | |
* | |
* var injector = Injector.resolveAndCreate([A]); | |
* | |
* expect(() => injector.getAt(100)).toThrowError(); | |
* ``` | |
* \@stable | |
* @param {?} index | |
* @return {?} | |
*/ | |
function outOfBoundsError(index) { | |
return Error("Index " + index + " is out-of-bounds."); | |
} | |
/** | |
* Thrown when a multi provider and a regular provider are bound to the same token. | |
* | |
* ### Example | |
* | |
* ```typescript | |
* expect(() => Injector.resolveAndCreate([ | |
* { provide: "Strings", useValue: "string1", multi: true}, | |
* { provide: "Strings", useValue: "string2", multi: false} | |
* ])).toThrowError(); | |
* ``` | |
* @param {?} provider1 | |
* @param {?} provider2 | |
* @return {?} | |
*/ | |
function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) { | |
return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* A unique object used for retrieving items from the {\@link ReflectiveInjector}. | |
* | |
* Keys have: | |
* - a system-wide unique `id`. | |
* - a `token`. | |
* | |
* `Key` is used internally by {\@link ReflectiveInjector} because its system-wide unique `id` allows | |
* the | |
* injector to store created objects in a more efficient way. | |
* | |
* `Key` should not be created directly. {\@link ReflectiveInjector} creates keys automatically when | |
* resolving | |
* providers. | |
* \@experimental | |
*/ | |
var ReflectiveKey = (function () { | |
/** | |
* Private | |
* @param {?} token | |
* @param {?} id | |
*/ | |
function ReflectiveKey(token, id) { | |
this.token = token; | |
this.id = id; | |
if (!token) { | |
throw new Error('Token must be defined!'); | |
} | |
} | |
Object.defineProperty(ReflectiveKey.prototype, "displayName", { | |
/** | |
* Returns a stringified token. | |
* @return {?} | |
*/ | |
get: function () { return stringify(this.token); }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* Retrieves a `Key` for a token. | |
* @param {?} token | |
* @return {?} | |
*/ | |
ReflectiveKey.get = function (token) { | |
return _globalKeyRegistry.get(resolveForwardRef(token)); | |
}; | |
Object.defineProperty(ReflectiveKey, "numberOfKeys", { | |
/** | |
* @return {?} the number of keys registered in the system. | |
*/ | |
get: function () { return _globalKeyRegistry.numberOfKeys; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return ReflectiveKey; | |
}()); | |
/** | |
* \@internal | |
*/ | |
var KeyRegistry = (function () { | |
function KeyRegistry() { | |
this._allKeys = new Map(); | |
} | |
/** | |
* @param {?} token | |
* @return {?} | |
*/ | |
KeyRegistry.prototype.get = function (token) { | |
if (token instanceof ReflectiveKey) | |
return token; | |
if (this._allKeys.has(token)) { | |
return ((this._allKeys.get(token))); | |
} | |
var /** @type {?} */ newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys); | |
this._allKeys.set(token, newKey); | |
return newKey; | |
}; | |
Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._allKeys.size; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return KeyRegistry; | |
}()); | |
var _globalKeyRegistry = new KeyRegistry(); | |
/** | |
* \@whatItDoes Represents a type that a Component or other object is instances of. | |
* | |
* \@description | |
* | |
* An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by | |
* the `MyCustomComponent` constructor function. | |
* | |
* \@stable | |
*/ | |
var Type = Function; | |
/** | |
* @param {?} v | |
* @return {?} | |
*/ | |
function isType(v) { | |
return typeof v === 'function'; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Attention: This regex has to hold even if the code is minified! | |
*/ | |
var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/; | |
var ReflectionCapabilities = (function () { | |
/** | |
* @param {?=} reflect | |
*/ | |
function ReflectionCapabilities(reflect) { | |
this._reflect = reflect || _global['Reflect']; | |
} | |
/** | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; }; | |
/** | |
* @template T | |
* @param {?} t | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.factory = function (t) { return function () { | |
var args = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
args[_i] = arguments[_i]; | |
} | |
return new (t.bind.apply(t, [void 0].concat(args)))(); | |
}; }; | |
/** | |
* \@internal | |
* @param {?} paramTypes | |
* @param {?} paramAnnotations | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) { | |
var /** @type {?} */ result; | |
if (typeof paramTypes === 'undefined') { | |
result = new Array(paramAnnotations.length); | |
} | |
else { | |
result = new Array(paramTypes.length); | |
} | |
for (var /** @type {?} */ i = 0; i < result.length; i++) { | |
// TS outputs Object for parameters without types, while Traceur omits | |
// the annotations. For now we preserve the Traceur behavior to aid | |
// migration, but this can be revisited. | |
if (typeof paramTypes === 'undefined') { | |
result[i] = []; | |
} | |
else if (paramTypes[i] != Object) { | |
result[i] = [paramTypes[i]]; | |
} | |
else { | |
result[i] = []; | |
} | |
if (paramAnnotations && paramAnnotations[i] != null) { | |
result[i] = result[i].concat(paramAnnotations[i]); | |
} | |
} | |
return result; | |
}; | |
/** | |
* @param {?} type | |
* @param {?} parentCtor | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) { | |
// If we have no decorators, we only have function.length as metadata. | |
// In that case, to detect whether a child class declared an own constructor or not, | |
// we need to look inside of that constructor to check whether it is | |
// just calling the parent. | |
// This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439 | |
// that sets 'design:paramtypes' to [] | |
// if a class inherits from another class but has no ctor declared itself. | |
if (DELEGATE_CTOR.exec(type.toString())) { | |
return null; | |
} | |
// Prefer the direct API. | |
if (((type)).parameters && ((type)).parameters !== parentCtor.parameters) { | |
return ((type)).parameters; | |
} | |
// API of tsickle for lowering decorators to properties on the class. | |
var /** @type {?} */ tsickleCtorParams = ((type)).ctorParameters; | |
if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) { | |
// Newer tsickle uses a function closure | |
// Retain the non-function case for compatibility with older tsickle | |
var /** @type {?} */ ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams; | |
var /** @type {?} */ paramTypes = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; }); | |
var /** @type {?} */ paramAnnotations = ctorParameters.map(function (ctorParam) { return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators); }); | |
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); | |
} | |
// API for metadata created by invoking the decorators. | |
if (this._reflect != null && this._reflect.getOwnMetadata != null) { | |
var /** @type {?} */ paramAnnotations = this._reflect.getOwnMetadata('parameters', type); | |
var /** @type {?} */ paramTypes = this._reflect.getOwnMetadata('design:paramtypes', type); | |
if (paramTypes || paramAnnotations) { | |
return this._zipTypesAndAnnotations(paramTypes, paramAnnotations); | |
} | |
} | |
// If a class has no decorators, at least create metadata | |
// based on function.length. | |
// Note: We know that this is a real constructor as we checked | |
// the content of the constructor above. | |
return new Array(((type.length))).fill(undefined); | |
}; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.parameters = function (type) { | |
// Note: only report metadata if we have at least one class decorator | |
// to stay in sync with the static reflector. | |
if (!isType(type)) { | |
return []; | |
} | |
var /** @type {?} */ parentCtor = getParentCtor(type); | |
var /** @type {?} */ parameters = this._ownParameters(type, parentCtor); | |
if (!parameters && parentCtor !== Object) { | |
parameters = this.parameters(parentCtor); | |
} | |
return parameters || []; | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @param {?} parentCtor | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) { | |
// Prefer the direct API. | |
if (((typeOrFunc)).annotations && ((typeOrFunc)).annotations !== parentCtor.annotations) { | |
var /** @type {?} */ annotations = ((typeOrFunc)).annotations; | |
if (typeof annotations === 'function' && annotations.annotations) { | |
annotations = annotations.annotations; | |
} | |
return annotations; | |
} | |
// API of tsickle for lowering decorators to properties on the class. | |
if (((typeOrFunc)).decorators && ((typeOrFunc)).decorators !== parentCtor.decorators) { | |
return convertTsickleDecoratorIntoMetadata(((typeOrFunc)).decorators); | |
} | |
// API for metadata created by invoking the decorators. | |
if (this._reflect && this._reflect.getOwnMetadata) { | |
return this._reflect.getOwnMetadata('annotations', typeOrFunc); | |
} | |
return null; | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.annotations = function (typeOrFunc) { | |
if (!isType(typeOrFunc)) { | |
return []; | |
} | |
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); | |
var /** @type {?} */ ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || []; | |
var /** @type {?} */ parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : []; | |
return parentAnnotations.concat(ownAnnotations); | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @param {?} parentCtor | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) { | |
// Prefer the direct API. | |
if (((typeOrFunc)).propMetadata && | |
((typeOrFunc)).propMetadata !== parentCtor.propMetadata) { | |
var /** @type {?} */ propMetadata = ((typeOrFunc)).propMetadata; | |
if (typeof propMetadata === 'function' && propMetadata.propMetadata) { | |
propMetadata = propMetadata.propMetadata; | |
} | |
return propMetadata; | |
} | |
// API of tsickle for lowering decorators to properties on the class. | |
if (((typeOrFunc)).propDecorators && | |
((typeOrFunc)).propDecorators !== parentCtor.propDecorators) { | |
var /** @type {?} */ propDecorators_1 = ((typeOrFunc)).propDecorators; | |
var /** @type {?} */ propMetadata_1 = ({}); | |
Object.keys(propDecorators_1).forEach(function (prop) { | |
propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]); | |
}); | |
return propMetadata_1; | |
} | |
// API for metadata created by invoking the decorators. | |
if (this._reflect && this._reflect.getOwnMetadata) { | |
return this._reflect.getOwnMetadata('propMetadata', typeOrFunc); | |
} | |
return null; | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) { | |
if (!isType(typeOrFunc)) { | |
return {}; | |
} | |
var /** @type {?} */ parentCtor = getParentCtor(typeOrFunc); | |
var /** @type {?} */ propMetadata = {}; | |
if (parentCtor !== Object) { | |
var /** @type {?} */ parentPropMetadata_1 = this.propMetadata(parentCtor); | |
Object.keys(parentPropMetadata_1).forEach(function (propName) { | |
propMetadata[propName] = parentPropMetadata_1[propName]; | |
}); | |
} | |
var /** @type {?} */ ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor); | |
if (ownPropMetadata) { | |
Object.keys(ownPropMetadata).forEach(function (propName) { | |
var /** @type {?} */ decorators = []; | |
if (propMetadata.hasOwnProperty(propName)) { | |
decorators.push.apply(decorators, propMetadata[propName]); | |
} | |
decorators.push.apply(decorators, ownPropMetadata[propName]); | |
propMetadata[propName] = decorators; | |
}); | |
} | |
return propMetadata; | |
}; | |
/** | |
* @param {?} type | |
* @param {?} lcProperty | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) { | |
return type instanceof Type && lcProperty in type.prototype; | |
}; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.getter = function (name) { return (new Function('o', 'return o.' + name + ';')); }; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.setter = function (name) { | |
return (new Function('o', 'v', 'return o.' + name + ' = v;')); | |
}; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.method = function (name) { | |
var /** @type {?} */ functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);"; | |
return (new Function('o', 'args', functionBody)); | |
}; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.importUri = function (type) { | |
// StaticSymbol | |
if (typeof type === 'object' && type['filePath']) { | |
return type['filePath']; | |
} | |
// Runtime type | |
return "./" + stringify(type); | |
}; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); }; | |
/** | |
* @param {?} name | |
* @param {?} moduleUrl | |
* @param {?} members | |
* @param {?} runtime | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { | |
return runtime; | |
}; | |
/** | |
* @param {?} enumIdentifier | |
* @param {?} name | |
* @return {?} | |
*/ | |
ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; }; | |
return ReflectionCapabilities; | |
}()); | |
/** | |
* @param {?} decoratorInvocations | |
* @return {?} | |
*/ | |
function convertTsickleDecoratorIntoMetadata(decoratorInvocations) { | |
if (!decoratorInvocations) { | |
return []; | |
} | |
return decoratorInvocations.map(function (decoratorInvocation) { | |
var /** @type {?} */ decoratorType = decoratorInvocation.type; | |
var /** @type {?} */ annotationCls = decoratorType.annotationCls; | |
var /** @type {?} */ annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : []; | |
return new (annotationCls.bind.apply(annotationCls, [void 0].concat(annotationArgs)))(); | |
}); | |
} | |
/** | |
* @param {?} ctor | |
* @return {?} | |
*/ | |
function getParentCtor(ctor) { | |
var /** @type {?} */ parentProto = Object.getPrototypeOf(ctor.prototype); | |
var /** @type {?} */ parentCtor = parentProto ? parentProto.constructor : null; | |
// Note: We always use `Object` as the null value | |
// to simplify checking later on. | |
return parentCtor || Object; | |
} | |
/** | |
* Provides read-only access to reflection data about symbols. Used internally by Angular | |
* to power dependency injection and compilation. | |
* @abstract | |
*/ | |
var ReflectorReader = (function () { | |
function ReflectorReader() { | |
} | |
/** | |
* @abstract | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.parameters = function (typeOrFunc) { }; | |
/** | |
* @abstract | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.annotations = function (typeOrFunc) { }; | |
/** | |
* @abstract | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.propMetadata = function (typeOrFunc) { }; | |
/** | |
* @abstract | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.importUri = function (typeOrFunc) { }; | |
/** | |
* @abstract | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.resourceUri = function (typeOrFunc) { }; | |
/** | |
* @abstract | |
* @param {?} name | |
* @param {?} moduleUrl | |
* @param {?} members | |
* @param {?} runtime | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { }; | |
/** | |
* @abstract | |
* @param {?} identifier | |
* @param {?} name | |
* @return {?} | |
*/ | |
ReflectorReader.prototype.resolveEnum = function (identifier, name) { }; | |
return ReflectorReader; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Provides access to reflection data about symbols. Used internally by Angular | |
* to power dependency injection and compilation. | |
*/ | |
var Reflector = (function (_super) { | |
__extends(Reflector, _super); | |
/** | |
* @param {?} reflectionCapabilities | |
*/ | |
function Reflector(reflectionCapabilities) { | |
var _this = _super.call(this) || this; | |
_this.reflectionCapabilities = reflectionCapabilities; | |
return _this; | |
} | |
/** | |
* @param {?} caps | |
* @return {?} | |
*/ | |
Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; }; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); }; | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
Reflector.prototype.parameters = function (typeOrFunc) { | |
return this.reflectionCapabilities.parameters(typeOrFunc); | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
Reflector.prototype.annotations = function (typeOrFunc) { | |
return this.reflectionCapabilities.annotations(typeOrFunc); | |
}; | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
Reflector.prototype.propMetadata = function (typeOrFunc) { | |
return this.reflectionCapabilities.propMetadata(typeOrFunc); | |
}; | |
/** | |
* @param {?} type | |
* @param {?} lcProperty | |
* @return {?} | |
*/ | |
Reflector.prototype.hasLifecycleHook = function (type, lcProperty) { | |
return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty); | |
}; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); }; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); }; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); }; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); }; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); }; | |
/** | |
* @param {?} name | |
* @param {?} moduleUrl | |
* @param {?} members | |
* @param {?} runtime | |
* @return {?} | |
*/ | |
Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) { | |
return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime); | |
}; | |
/** | |
* @param {?} identifier | |
* @param {?} name | |
* @return {?} | |
*/ | |
Reflector.prototype.resolveEnum = function (identifier, name) { | |
return this.reflectionCapabilities.resolveEnum(identifier, name); | |
}; | |
return Reflector; | |
}(ReflectorReader)); | |
/** | |
* @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 | |
*/ | |
/** | |
* The {@link Reflector} used internally in Angular to access metadata | |
* about symbols. | |
*/ | |
var reflector = new Reflector(new ReflectionCapabilities()); | |
/** | |
* @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 | |
*/ | |
/** | |
* `Dependency` is used by the framework to extend DI. | |
* This is internal to Angular and should not be used directly. | |
*/ | |
var ReflectiveDependency = (function () { | |
/** | |
* @param {?} key | |
* @param {?} optional | |
* @param {?} visibility | |
*/ | |
function ReflectiveDependency(key, optional, visibility) { | |
this.key = key; | |
this.optional = optional; | |
this.visibility = visibility; | |
} | |
/** | |
* @param {?} key | |
* @return {?} | |
*/ | |
ReflectiveDependency.fromKey = function (key) { | |
return new ReflectiveDependency(key, false, null); | |
}; | |
return ReflectiveDependency; | |
}()); | |
var _EMPTY_LIST = []; | |
var ResolvedReflectiveProvider_ = (function () { | |
/** | |
* @param {?} key | |
* @param {?} resolvedFactories | |
* @param {?} multiProvider | |
*/ | |
function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) { | |
this.key = key; | |
this.resolvedFactories = resolvedFactories; | |
this.multiProvider = multiProvider; | |
} | |
Object.defineProperty(ResolvedReflectiveProvider_.prototype, "resolvedFactory", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.resolvedFactories[0]; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return ResolvedReflectiveProvider_; | |
}()); | |
/** | |
* An internal resolved representation of a factory function created by resolving {\@link | |
* Provider}. | |
* \@experimental | |
*/ | |
var ResolvedReflectiveFactory = (function () { | |
/** | |
* @param {?} factory | |
* @param {?} dependencies | |
*/ | |
function ResolvedReflectiveFactory(factory, dependencies) { | |
this.factory = factory; | |
this.dependencies = dependencies; | |
} | |
return ResolvedReflectiveFactory; | |
}()); | |
/** | |
* Resolve a single provider. | |
* @param {?} provider | |
* @return {?} | |
*/ | |
function resolveReflectiveFactory(provider) { | |
var /** @type {?} */ factoryFn; | |
var /** @type {?} */ resolvedDeps; | |
if (provider.useClass) { | |
var /** @type {?} */ useClass = resolveForwardRef(provider.useClass); | |
factoryFn = reflector.factory(useClass); | |
resolvedDeps = _dependenciesFor(useClass); | |
} | |
else if (provider.useExisting) { | |
factoryFn = function (aliasInstance) { return aliasInstance; }; | |
resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))]; | |
} | |
else if (provider.useFactory) { | |
factoryFn = provider.useFactory; | |
resolvedDeps = constructDependencies(provider.useFactory, provider.deps); | |
} | |
else { | |
factoryFn = function () { return provider.useValue; }; | |
resolvedDeps = _EMPTY_LIST; | |
} | |
return new ResolvedReflectiveFactory(factoryFn, resolvedDeps); | |
} | |
/** | |
* Converts the {\@link Provider} into {\@link ResolvedProvider}. | |
* | |
* {\@link Injector} internally only uses {\@link ResolvedProvider}, {\@link Provider} contains | |
* convenience provider syntax. | |
* @param {?} provider | |
* @return {?} | |
*/ | |
function resolveReflectiveProvider(provider) { | |
return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false); | |
} | |
/** | |
* Resolve a list of Providers. | |
* @param {?} providers | |
* @return {?} | |
*/ | |
function resolveReflectiveProviders(providers) { | |
var /** @type {?} */ normalized = _normalizeProviders(providers, []); | |
var /** @type {?} */ resolved = normalized.map(resolveReflectiveProvider); | |
var /** @type {?} */ resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map()); | |
return Array.from(resolvedProviderMap.values()); | |
} | |
/** | |
* Merges a list of ResolvedProviders into a list where | |
* each key is contained exactly once and multi providers | |
* have been merged. | |
* @param {?} providers | |
* @param {?} normalizedProvidersMap | |
* @return {?} | |
*/ | |
function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) { | |
for (var /** @type {?} */ i = 0; i < providers.length; i++) { | |
var /** @type {?} */ provider = providers[i]; | |
var /** @type {?} */ existing = normalizedProvidersMap.get(provider.key.id); | |
if (existing) { | |
if (provider.multiProvider !== existing.multiProvider) { | |
throw mixingMultiProvidersWithRegularProvidersError(existing, provider); | |
} | |
if (provider.multiProvider) { | |
for (var /** @type {?} */ j = 0; j < provider.resolvedFactories.length; j++) { | |
existing.resolvedFactories.push(provider.resolvedFactories[j]); | |
} | |
} | |
else { | |
normalizedProvidersMap.set(provider.key.id, provider); | |
} | |
} | |
else { | |
var /** @type {?} */ resolvedProvider = void 0; | |
if (provider.multiProvider) { | |
resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider); | |
} | |
else { | |
resolvedProvider = provider; | |
} | |
normalizedProvidersMap.set(provider.key.id, resolvedProvider); | |
} | |
} | |
return normalizedProvidersMap; | |
} | |
/** | |
* @param {?} providers | |
* @param {?} res | |
* @return {?} | |
*/ | |
function _normalizeProviders(providers, res) { | |
providers.forEach(function (b) { | |
if (b instanceof Type) { | |
res.push({ provide: b, useClass: b }); | |
} | |
else if (b && typeof b == 'object' && ((b)).provide !== undefined) { | |
res.push(/** @type {?} */ (b)); | |
} | |
else if (b instanceof Array) { | |
_normalizeProviders(b, res); | |
} | |
else { | |
throw invalidProviderError(b); | |
} | |
}); | |
return res; | |
} | |
/** | |
* @param {?} typeOrFunc | |
* @param {?=} dependencies | |
* @return {?} | |
*/ | |
function constructDependencies(typeOrFunc, dependencies) { | |
if (!dependencies) { | |
return _dependenciesFor(typeOrFunc); | |
} | |
else { | |
var /** @type {?} */ params_1 = dependencies.map(function (t) { return [t]; }); | |
return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); }); | |
} | |
} | |
/** | |
* @param {?} typeOrFunc | |
* @return {?} | |
*/ | |
function _dependenciesFor(typeOrFunc) { | |
var /** @type {?} */ params = reflector.parameters(typeOrFunc); | |
if (!params) | |
return []; | |
if (params.some(function (p) { return p == null; })) { | |
throw noAnnotationError(typeOrFunc, params); | |
} | |
return params.map(function (p) { return _extractToken(typeOrFunc, p, params); }); | |
} | |
/** | |
* @param {?} typeOrFunc | |
* @param {?} metadata | |
* @param {?} params | |
* @return {?} | |
*/ | |
function _extractToken(typeOrFunc, metadata, params) { | |
var /** @type {?} */ token = null; | |
var /** @type {?} */ optional = false; | |
if (!Array.isArray(metadata)) { | |
if (metadata instanceof Inject) { | |
return _createDependency(metadata['token'], optional, null); | |
} | |
else { | |
return _createDependency(metadata, optional, null); | |
} | |
} | |
var /** @type {?} */ visibility = null; | |
for (var /** @type {?} */ i = 0; i < metadata.length; ++i) { | |
var /** @type {?} */ paramMetadata = metadata[i]; | |
if (paramMetadata instanceof Type) { | |
token = paramMetadata; | |
} | |
else if (paramMetadata instanceof Inject) { | |
token = paramMetadata['token']; | |
} | |
else if (paramMetadata instanceof Optional) { | |
optional = true; | |
} | |
else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) { | |
visibility = paramMetadata; | |
} | |
else if (paramMetadata instanceof InjectionToken) { | |
token = paramMetadata; | |
} | |
} | |
token = resolveForwardRef(token); | |
if (token != null) { | |
return _createDependency(token, optional, visibility); | |
} | |
else { | |
throw noAnnotationError(typeOrFunc, params); | |
} | |
} | |
/** | |
* @param {?} token | |
* @param {?} optional | |
* @param {?} visibility | |
* @return {?} | |
*/ | |
function _createDependency(token, optional, visibility) { | |
return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility); | |
} | |
/** | |
* @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 | |
*/ | |
// Threshold for the dynamic version | |
var UNDEFINED = new Object(); | |
/** | |
* A ReflectiveDependency injection container used for instantiating objects and resolving | |
* dependencies. | |
* | |
* An `Injector` is a replacement for a `new` operator, which can automatically resolve the | |
* constructor dependencies. | |
* | |
* In typical use, application code asks for the dependencies in the constructor and they are | |
* resolved by the `Injector`. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/jzjec0?p=preview)) | |
* | |
* The following example creates an `Injector` configured to create `Engine` and `Car`. | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); | |
* var car = injector.get(Car); | |
* expect(car instanceof Car).toBe(true); | |
* expect(car.engine instanceof Engine).toBe(true); | |
* ``` | |
* | |
* Notice, we don't use the `new` operator because we explicitly want to have the `Injector` | |
* resolve all of the object's dependencies automatically. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var ReflectiveInjector = (function () { | |
function ReflectiveInjector() { | |
} | |
/** | |
* Turns an array of provider definitions into an array of resolved providers. | |
* | |
* A resolution is a process of flattening multiple nested arrays and converting individual | |
* providers into an array of {\@link ResolvedReflectiveProvider}s. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/AiXTHi?p=preview)) | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var providers = ReflectiveInjector.resolve([Car, [[Engine]]]); | |
* | |
* expect(providers.length).toEqual(2); | |
* | |
* expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true); | |
* expect(providers[0].key.displayName).toBe("Car"); | |
* expect(providers[0].dependencies.length).toEqual(1); | |
* expect(providers[0].factory).toBeDefined(); | |
* | |
* expect(providers[1].key.displayName).toBe("Engine"); | |
* }); | |
* ``` | |
* | |
* See {\@link ReflectiveInjector#fromResolvedProviders} for more info. | |
* @param {?} providers | |
* @return {?} | |
*/ | |
ReflectiveInjector.resolve = function (providers) { | |
return resolveReflectiveProviders(providers); | |
}; | |
/** | |
* Resolves an array of providers and creates an injector from those providers. | |
* | |
* The passed-in providers can be an array of `Type`, {\@link Provider}, | |
* or a recursive array of more providers. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/ePOccA?p=preview)) | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]); | |
* expect(injector.get(Car) instanceof Car).toBe(true); | |
* ``` | |
* | |
* This function is slower than the corresponding `fromResolvedProviders` | |
* because it needs to resolve the passed-in providers first. | |
* See {\@link Injector#resolve} and {\@link Injector#fromResolvedProviders}. | |
* @param {?} providers | |
* @param {?=} parent | |
* @return {?} | |
*/ | |
ReflectiveInjector.resolveAndCreate = function (providers, parent) { | |
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); | |
return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent); | |
}; | |
/** | |
* Creates an injector from previously resolved providers. | |
* | |
* This API is the recommended way to construct injectors in performance-sensitive parts. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/KrSMci?p=preview)) | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var providers = ReflectiveInjector.resolve([Car, Engine]); | |
* var injector = ReflectiveInjector.fromResolvedProviders(providers); | |
* expect(injector.get(Car) instanceof Car).toBe(true); | |
* ``` | |
* \@experimental | |
* @param {?} providers | |
* @param {?=} parent | |
* @return {?} | |
*/ | |
ReflectiveInjector.fromResolvedProviders = function (providers, parent) { | |
return new ReflectiveInjector_(providers, parent); | |
}; | |
/** | |
* Parent of this injector. | |
* | |
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection. | |
* --> | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/eosMGo?p=preview)) | |
* | |
* ```typescript | |
* var parent = ReflectiveInjector.resolveAndCreate([]); | |
* var child = parent.resolveAndCreateChild([]); | |
* expect(child.parent).toBe(parent); | |
* ``` | |
* @abstract | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.parent = function () { }; | |
/** | |
* Resolves an array of providers and creates a child injector from those providers. | |
* | |
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection. | |
* --> | |
* | |
* The passed-in providers can be an array of `Type`, {\@link Provider}, | |
* or a recursive array of more providers. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/opB3T4?p=preview)) | |
* | |
* ```typescript | |
* class ParentProvider {} | |
* class ChildProvider {} | |
* | |
* var parent = ReflectiveInjector.resolveAndCreate([ParentProvider]); | |
* var child = parent.resolveAndCreateChild([ChildProvider]); | |
* | |
* expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); | |
* expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); | |
* expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); | |
* ``` | |
* | |
* This function is slower than the corresponding `createChildFromResolved` | |
* because it needs to resolve the passed-in providers first. | |
* See {\@link Injector#resolve} and {\@link Injector#createChildFromResolved}. | |
* @abstract | |
* @param {?} providers | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.resolveAndCreateChild = function (providers) { }; | |
/** | |
* Creates a child injector from previously resolved providers. | |
* | |
* <!-- TODO: Add a link to the section of the user guide talking about hierarchical injection. | |
* --> | |
* | |
* This API is the recommended way to construct injectors in performance-sensitive parts. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/VhyfjN?p=preview)) | |
* | |
* ```typescript | |
* class ParentProvider {} | |
* class ChildProvider {} | |
* | |
* var parentProviders = ReflectiveInjector.resolve([ParentProvider]); | |
* var childProviders = ReflectiveInjector.resolve([ChildProvider]); | |
* | |
* var parent = ReflectiveInjector.fromResolvedProviders(parentProviders); | |
* var child = parent.createChildFromResolved(childProviders); | |
* | |
* expect(child.get(ParentProvider) instanceof ParentProvider).toBe(true); | |
* expect(child.get(ChildProvider) instanceof ChildProvider).toBe(true); | |
* expect(child.get(ParentProvider)).toBe(parent.get(ParentProvider)); | |
* ``` | |
* @abstract | |
* @param {?} providers | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.createChildFromResolved = function (providers) { }; | |
/** | |
* Resolves a provider and instantiates an object in the context of the injector. | |
* | |
* The created object does not get cached by the injector. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/yvVXoB?p=preview)) | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var injector = ReflectiveInjector.resolveAndCreate([Engine]); | |
* | |
* var car = injector.resolveAndInstantiate(Car); | |
* expect(car.engine).toBe(injector.get(Engine)); | |
* expect(car).not.toBe(injector.resolveAndInstantiate(Car)); | |
* ``` | |
* @abstract | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.resolveAndInstantiate = function (provider) { }; | |
/** | |
* Instantiates an object using a resolved provider in the context of the injector. | |
* | |
* The created object does not get cached by the injector. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/ptCImQ?p=preview)) | |
* | |
* ```typescript | |
* \@Injectable() | |
* class Engine { | |
* } | |
* | |
* \@Injectable() | |
* class Car { | |
* constructor(public engine:Engine) {} | |
* } | |
* | |
* var injector = ReflectiveInjector.resolveAndCreate([Engine]); | |
* var carProvider = ReflectiveInjector.resolve([Car])[0]; | |
* var car = injector.instantiateResolved(carProvider); | |
* expect(car.engine).toBe(injector.get(Engine)); | |
* expect(car).not.toBe(injector.instantiateResolved(carProvider)); | |
* ``` | |
* @abstract | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.instantiateResolved = function (provider) { }; | |
/** | |
* @abstract | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
ReflectiveInjector.prototype.get = function (token, notFoundValue) { }; | |
return ReflectiveInjector; | |
}()); | |
var ReflectiveInjector_ = (function () { | |
/** | |
* Private | |
* @param {?} _providers | |
* @param {?=} _parent | |
*/ | |
function ReflectiveInjector_(_providers, _parent) { | |
/** | |
* \@internal | |
*/ | |
this._constructionCounter = 0; | |
this._providers = _providers; | |
this._parent = _parent || null; | |
var len = _providers.length; | |
this.keyIds = new Array(len); | |
this.objs = new Array(len); | |
for (var i = 0; i < len; i++) { | |
this.keyIds[i] = _providers[i].key.id; | |
this.objs[i] = UNDEFINED; | |
} | |
} | |
/** | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.get = function (token, notFoundValue) { | |
if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; } | |
return this._getByKey(ReflectiveKey.get(token), null, notFoundValue); | |
}; | |
Object.defineProperty(ReflectiveInjector_.prototype, "parent", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._parent; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} providers | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) { | |
var /** @type {?} */ ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers); | |
return this.createChildFromResolved(ResolvedReflectiveProviders); | |
}; | |
/** | |
* @param {?} providers | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.createChildFromResolved = function (providers) { | |
var /** @type {?} */ inj = new ReflectiveInjector_(providers); | |
inj._parent = this; | |
return inj; | |
}; | |
/** | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) { | |
return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]); | |
}; | |
/** | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.instantiateResolved = function (provider) { | |
return this._instantiateProvider(provider); | |
}; | |
/** | |
* @param {?} index | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.getProviderAtIndex = function (index) { | |
if (index < 0 || index >= this._providers.length) { | |
throw outOfBoundsError(index); | |
} | |
return this._providers[index]; | |
}; | |
/** | |
* \@internal | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._new = function (provider) { | |
if (this._constructionCounter++ > this._getMaxNumberOfObjects()) { | |
throw cyclicDependencyError(this, provider.key); | |
} | |
return this._instantiateProvider(provider); | |
}; | |
/** | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; }; | |
/** | |
* @param {?} provider | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._instantiateProvider = function (provider) { | |
if (provider.multiProvider) { | |
var /** @type {?} */ res = new Array(provider.resolvedFactories.length); | |
for (var /** @type {?} */ i = 0; i < provider.resolvedFactories.length; ++i) { | |
res[i] = this._instantiate(provider, provider.resolvedFactories[i]); | |
} | |
return res; | |
} | |
else { | |
return this._instantiate(provider, provider.resolvedFactories[0]); | |
} | |
}; | |
/** | |
* @param {?} provider | |
* @param {?} ResolvedReflectiveFactory | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) { | |
var _this = this; | |
var /** @type {?} */ factory = ResolvedReflectiveFactory$$1.factory; | |
var /** @type {?} */ deps; | |
try { | |
deps = | |
ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); }); | |
} | |
catch (e) { | |
if (e.addKey) { | |
e.addKey(this, provider.key); | |
} | |
throw e; | |
} | |
var /** @type {?} */ obj; | |
try { | |
obj = factory.apply(void 0, deps); | |
} | |
catch (e) { | |
throw instantiationError(this, e, e.stack, provider.key); | |
} | |
return obj; | |
}; | |
/** | |
* @param {?} dep | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) { | |
return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND); | |
}; | |
/** | |
* @param {?} key | |
* @param {?} visibility | |
* @param {?} notFoundValue | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) { | |
if (key === INJECTOR_KEY) { | |
return this; | |
} | |
if (visibility instanceof Self) { | |
return this._getByKeySelf(key, notFoundValue); | |
} | |
else { | |
return this._getByKeyDefault(key, notFoundValue, visibility); | |
} | |
}; | |
/** | |
* @param {?} keyId | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) { | |
for (var /** @type {?} */ i = 0; i < this.keyIds.length; i++) { | |
if (this.keyIds[i] === keyId) { | |
if (this.objs[i] === UNDEFINED) { | |
this.objs[i] = this._new(this._providers[i]); | |
} | |
return this.objs[i]; | |
} | |
} | |
return UNDEFINED; | |
}; | |
/** | |
* \@internal | |
* @param {?} key | |
* @param {?} notFoundValue | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) { | |
if (notFoundValue !== THROW_IF_NOT_FOUND) { | |
return notFoundValue; | |
} | |
else { | |
throw noProviderError(this, key); | |
} | |
}; | |
/** | |
* \@internal | |
* @param {?} key | |
* @param {?} notFoundValue | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) { | |
var /** @type {?} */ obj = this._getObjByKeyId(key.id); | |
return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue); | |
}; | |
/** | |
* \@internal | |
* @param {?} key | |
* @param {?} notFoundValue | |
* @param {?} visibility | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) { | |
var /** @type {?} */ inj; | |
if (visibility instanceof SkipSelf) { | |
inj = this._parent; | |
} | |
else { | |
inj = this; | |
} | |
while (inj instanceof ReflectiveInjector_) { | |
var /** @type {?} */ inj_ = (inj); | |
var /** @type {?} */ obj = inj_._getObjByKeyId(key.id); | |
if (obj !== UNDEFINED) | |
return obj; | |
inj = inj_._parent; | |
} | |
if (inj !== null) { | |
return inj.get(key.token, notFoundValue); | |
} | |
else { | |
return this._throwOrNull(key, notFoundValue); | |
} | |
}; | |
Object.defineProperty(ReflectiveInjector_.prototype, "displayName", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; }) | |
.join(', '); | |
return "ReflectiveInjector(providers: [" + providers + "])"; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
ReflectiveInjector_.prototype.toString = function () { return this.displayName; }; | |
return ReflectiveInjector_; | |
}()); | |
var INJECTOR_KEY = ReflectiveKey.get(Injector); | |
/** | |
* @param {?} injector | |
* @param {?} fn | |
* @return {?} | |
*/ | |
function _mapProviders(injector, fn) { | |
var /** @type {?} */ res = new Array(injector._providers.length); | |
for (var /** @type {?} */ i = 0; i < injector._providers.length; ++i) { | |
res[i] = fn(injector.getProviderAtIndex(i)); | |
} | |
return res; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* The `di` module provides dependency injection container services. | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* Determine if the argument is shaped like a Promise | |
* @param {?} obj | |
* @return {?} | |
*/ | |
function isPromise(obj) { | |
// allow any Promise/A+ compliant thenable. | |
// It's up to the caller to ensure that obj.then conforms to the spec | |
return !!obj && typeof obj.then === 'function'; | |
} | |
/** | |
* Determine if the argument is an Observable | |
* @param {?} obj | |
* @return {?} | |
*/ | |
function isObservable(obj) { | |
// TODO use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved | |
return !!obj && typeof obj.subscribe === 'function'; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* A function that will be executed when an application is initialized. | |
* \@experimental | |
*/ | |
var APP_INITIALIZER = new InjectionToken('Application Initializer'); | |
/** | |
* A class that reflects the state of running {\@link APP_INITIALIZER}s. | |
* | |
* \@experimental | |
*/ | |
var ApplicationInitStatus = (function () { | |
/** | |
* @param {?} appInits | |
*/ | |
function ApplicationInitStatus(appInits) { | |
var _this = this; | |
this._done = false; | |
var asyncInitPromises = []; | |
if (appInits) { | |
for (var i = 0; i < appInits.length; i++) { | |
var initResult = appInits[i](); | |
if (isPromise(initResult)) { | |
asyncInitPromises.push(initResult); | |
} | |
} | |
} | |
this._donePromise = Promise.all(asyncInitPromises).then(function () { _this._done = true; }); | |
if (asyncInitPromises.length === 0) { | |
this._done = true; | |
} | |
} | |
Object.defineProperty(ApplicationInitStatus.prototype, "done", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._done; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ApplicationInitStatus.prototype, "donePromise", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._donePromise; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return ApplicationInitStatus; | |
}()); | |
ApplicationInitStatus.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
ApplicationInitStatus.ctorParameters = function () { return [ | |
{ type: Array, decorators: [{ type: Inject, args: [APP_INITIALIZER,] }, { type: Optional },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* A DI Token representing a unique string id assigned to the application by Angular and used | |
* primarily for prefixing application attributes and CSS styles when | |
* {\@link ViewEncapsulation#Emulated} is being used. | |
* | |
* If you need to avoid randomly generated value to be used as an application id, you can provide | |
* a custom value via a DI provider <!-- TODO: provider --> configuring the root {\@link Injector} | |
* using this token. | |
* \@experimental | |
*/ | |
var APP_ID = new InjectionToken('AppId'); | |
/** | |
* @return {?} | |
*/ | |
function _appIdRandomProviderFactory() { | |
return "" + _randomChar() + _randomChar() + _randomChar(); | |
} | |
/** | |
* Providers that will generate a random APP_ID_TOKEN. | |
* \@experimental | |
*/ | |
var APP_ID_RANDOM_PROVIDER = { | |
provide: APP_ID, | |
useFactory: _appIdRandomProviderFactory, | |
deps: [], | |
}; | |
/** | |
* @return {?} | |
*/ | |
function _randomChar() { | |
return String.fromCharCode(97 + Math.floor(Math.random() * 25)); | |
} | |
/** | |
* A function that will be executed when a platform is initialized. | |
* \@experimental | |
*/ | |
var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer'); | |
/** | |
* A token that indicates an opaque platform id. | |
* \@experimental | |
*/ | |
var PLATFORM_ID = new InjectionToken('Platform ID'); | |
/** | |
* All callbacks provided via this token will be called for every component that is bootstrapped. | |
* Signature of the callback: | |
* | |
* `(componentRef: ComponentRef) => void`. | |
* | |
* \@experimental | |
*/ | |
var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener'); | |
/** | |
* A token which indicates the root directory of the application | |
* \@experimental | |
*/ | |
var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL'); | |
/** | |
* @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 Console = (function () { | |
function Console() { | |
} | |
/** | |
* @param {?} message | |
* @return {?} | |
*/ | |
Console.prototype.log = function (message) { | |
// tslint:disable-next-line:no-console | |
console.log(message); | |
}; | |
/** | |
* @param {?} message | |
* @return {?} | |
*/ | |
Console.prototype.warn = function (message) { | |
// tslint:disable-next-line:no-console | |
console.warn(message); | |
}; | |
return Console; | |
}()); | |
Console.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Console.ctorParameters = function () { return []; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* Combination of NgModuleFactory and ComponentFactorys. | |
* | |
* \@experimental | |
*/ | |
var ModuleWithComponentFactories = (function () { | |
/** | |
* @param {?} ngModuleFactory | |
* @param {?} componentFactories | |
*/ | |
function ModuleWithComponentFactories(ngModuleFactory, componentFactories) { | |
this.ngModuleFactory = ngModuleFactory; | |
this.componentFactories = componentFactories; | |
} | |
return ModuleWithComponentFactories; | |
}()); | |
/** | |
* @return {?} | |
*/ | |
function _throwError() { | |
throw new Error("Runtime compiler is not loaded"); | |
} | |
/** | |
* Low-level service for running the angular compiler during runtime | |
* to create {\@link ComponentFactory}s, which | |
* can later be used to create and render a Component instance. | |
* | |
* Each `\@NgModule` provides an own `Compiler` to its injector, | |
* that will use the directives/pipes of the ng module for compilation | |
* of components. | |
* \@stable | |
*/ | |
var Compiler = (function () { | |
function Compiler() { | |
} | |
/** | |
* Compiles the given NgModule and all of its components. All templates of the components listed | |
* in `entryComponents` have to be inlined. | |
* @template T | |
* @param {?} moduleType | |
* @return {?} | |
*/ | |
Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); }; | |
/** | |
* Compiles the given NgModule and all of its components | |
* @template T | |
* @param {?} moduleType | |
* @return {?} | |
*/ | |
Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); }; | |
/** | |
* Same as {\@link compileModuleSync} but also creates ComponentFactories for all components. | |
* @template T | |
* @param {?} moduleType | |
* @return {?} | |
*/ | |
Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) { | |
throw _throwError(); | |
}; | |
/** | |
* Same as {\@link compileModuleAsync} but also creates ComponentFactories for all components. | |
* @template T | |
* @param {?} moduleType | |
* @return {?} | |
*/ | |
Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) { | |
throw _throwError(); | |
}; | |
/** | |
* Exposes the CSS-style selectors that have been used in `ngContent` directives within | |
* the template of the given component. | |
* This is used by the `upgrade` library to compile the appropriate transclude content | |
* in the AngularJS wrapper component. | |
* | |
* @deprecated since v4. Use ComponentFactory.ngContentSelectors instead. | |
* @param {?} component | |
* @return {?} | |
*/ | |
Compiler.prototype.getNgContentSelectors = function (component) { throw _throwError(); }; | |
/** | |
* Clears all caches. | |
* @return {?} | |
*/ | |
Compiler.prototype.clearCache = function () { }; | |
/** | |
* Clears the cache for the given component/ngModule. | |
* @param {?} type | |
* @return {?} | |
*/ | |
Compiler.prototype.clearCacheFor = function (type) { }; | |
return Compiler; | |
}()); | |
Compiler.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Compiler.ctorParameters = function () { return []; }; | |
/** | |
* Token to provide CompilerOptions in the platform injector. | |
* | |
* \@experimental | |
*/ | |
var COMPILER_OPTIONS = new InjectionToken('compilerOptions'); | |
/** | |
* A factory for creating a Compiler | |
* | |
* \@experimental | |
* @abstract | |
*/ | |
var CompilerFactory = (function () { | |
function CompilerFactory() { | |
} | |
/** | |
* @abstract | |
* @param {?=} options | |
* @return {?} | |
*/ | |
CompilerFactory.prototype.createCompiler = function (options) { }; | |
return CompilerFactory; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Represents an instance of a Component created via a {\@link ComponentFactory}. | |
* | |
* `ComponentRef` provides access to the Component Instance as well other objects related to this | |
* Component Instance and allows you to destroy the Component Instance via the {\@link #destroy} | |
* method. | |
* \@stable | |
* @abstract | |
*/ | |
var ComponentRef = (function () { | |
function ComponentRef() { | |
} | |
/** | |
* Location of the Host Element of this Component Instance. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.location = function () { }; | |
/** | |
* The injector on which the component instance exists. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.injector = function () { }; | |
/** | |
* The instance of the Component. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.instance = function () { }; | |
/** | |
* The {\@link ViewRef} of the Host View of this Component instance. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.hostView = function () { }; | |
/** | |
* The {\@link ChangeDetectorRef} of the Component instance. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.changeDetectorRef = function () { }; | |
/** | |
* The component type. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.componentType = function () { }; | |
/** | |
* Destroys the component instance and all of the data structures associated with it. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentRef.prototype.destroy = function () { }; | |
/** | |
* Allows to register a callback that will be called when the component is destroyed. | |
* @abstract | |
* @param {?} callback | |
* @return {?} | |
*/ | |
ComponentRef.prototype.onDestroy = function (callback) { }; | |
return ComponentRef; | |
}()); | |
/** | |
* \@stable | |
* @abstract | |
*/ | |
var ComponentFactory = (function () { | |
function ComponentFactory() { | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.selector = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.componentType = function () { }; | |
/** | |
* selector for all <ng-content> elements in the component. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.ngContentSelectors = function () { }; | |
/** | |
* the inputs of the component. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.inputs = function () { }; | |
/** | |
* the outputs of the component. | |
* @abstract | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.outputs = function () { }; | |
/** | |
* Creates a new component. | |
* @abstract | |
* @param {?} injector | |
* @param {?=} projectableNodes | |
* @param {?=} rootSelectorOrNode | |
* @param {?=} ngModule | |
* @return {?} | |
*/ | |
ComponentFactory.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { }; | |
return ComponentFactory; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} component | |
* @return {?} | |
*/ | |
function noComponentFactoryError(component) { | |
var /** @type {?} */ error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?"); | |
((error))[ERROR_COMPONENT] = component; | |
return error; | |
} | |
var ERROR_COMPONENT = 'ngComponent'; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
var _NullComponentFactoryResolver = (function () { | |
function _NullComponentFactoryResolver() { | |
} | |
/** | |
* @template T | |
* @param {?} component | |
* @return {?} | |
*/ | |
_NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { | |
throw noComponentFactoryError(component); | |
}; | |
return _NullComponentFactoryResolver; | |
}()); | |
/** | |
* \@stable | |
* @abstract | |
*/ | |
var ComponentFactoryResolver = (function () { | |
function ComponentFactoryResolver() { | |
} | |
/** | |
* @abstract | |
* @template T | |
* @param {?} component | |
* @return {?} | |
*/ | |
ComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { }; | |
return ComponentFactoryResolver; | |
}()); | |
ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver(); | |
var CodegenComponentFactoryResolver = (function () { | |
/** | |
* @param {?} factories | |
* @param {?} _parent | |
* @param {?} _ngModule | |
*/ | |
function CodegenComponentFactoryResolver(factories, _parent, _ngModule) { | |
this._parent = _parent; | |
this._ngModule = _ngModule; | |
this._factories = new Map(); | |
for (var i = 0; i < factories.length; i++) { | |
var factory = factories[i]; | |
this._factories.set(factory.componentType, factory); | |
} | |
} | |
/** | |
* @template T | |
* @param {?} component | |
* @return {?} | |
*/ | |
CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) { | |
var /** @type {?} */ factory = this._factories.get(component) || this._parent.resolveComponentFactory(component); | |
return new ComponentFactoryBoundToModule(factory, this._ngModule); | |
}; | |
return CodegenComponentFactoryResolver; | |
}()); | |
var ComponentFactoryBoundToModule = (function (_super) { | |
__extends(ComponentFactoryBoundToModule, _super); | |
/** | |
* @param {?} factory | |
* @param {?} ngModule | |
*/ | |
function ComponentFactoryBoundToModule(factory, ngModule) { | |
var _this = _super.call(this) || this; | |
_this.factory = factory; | |
_this.ngModule = ngModule; | |
return _this; | |
} | |
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "selector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.factory.selector; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "componentType", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.factory.componentType; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "ngContentSelectors", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.factory.ngContentSelectors; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "inputs", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.factory.inputs; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentFactoryBoundToModule.prototype, "outputs", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.factory.outputs; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} injector | |
* @param {?=} projectableNodes | |
* @param {?=} rootSelectorOrNode | |
* @param {?=} ngModule | |
* @return {?} | |
*/ | |
ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { | |
return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule); | |
}; | |
return ComponentFactoryBoundToModule; | |
}(ComponentFactory)); | |
/** | |
* @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 | |
*/ | |
/** | |
* Represents an instance of an NgModule created via a {\@link NgModuleFactory}. | |
* | |
* `NgModuleRef` provides access to the NgModule Instance as well other objects related to this | |
* NgModule Instance. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var NgModuleRef = (function () { | |
function NgModuleRef() { | |
} | |
/** | |
* The injector that contains all of the providers of the NgModule. | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleRef.prototype.injector = function () { }; | |
/** | |
* The ComponentFactoryResolver to get hold of the ComponentFactories | |
* declared in the `entryComponents` property of the module. | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleRef.prototype.componentFactoryResolver = function () { }; | |
/** | |
* The NgModule instance. | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleRef.prototype.instance = function () { }; | |
/** | |
* Destroys the module instance and all of the data structures associated with it. | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleRef.prototype.destroy = function () { }; | |
/** | |
* Allows to register a callback that will be called when the module is destroyed. | |
* @abstract | |
* @param {?} callback | |
* @return {?} | |
*/ | |
NgModuleRef.prototype.onDestroy = function (callback) { }; | |
return NgModuleRef; | |
}()); | |
/** | |
* \@experimental | |
*/ | |
var NgModuleFactory = (function () { | |
/** | |
* @param {?} _injectorClass | |
* @param {?} _moduleType | |
*/ | |
function NgModuleFactory(_injectorClass, _moduleType) { | |
this._injectorClass = _injectorClass; | |
this._moduleType = _moduleType; | |
} | |
Object.defineProperty(NgModuleFactory.prototype, "moduleType", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._moduleType; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} parentInjector | |
* @return {?} | |
*/ | |
NgModuleFactory.prototype.create = function (parentInjector) { | |
var /** @type {?} */ instance = new this._injectorClass(parentInjector || Injector.NULL); | |
instance.create(); | |
return instance; | |
}; | |
return NgModuleFactory; | |
}()); | |
var _UNDEFINED = new Object(); | |
/** | |
* @abstract | |
*/ | |
var NgModuleInjector = (function () { | |
/** | |
* @param {?} parent | |
* @param {?} factories | |
* @param {?} bootstrapFactories | |
*/ | |
function NgModuleInjector(parent, factories, bootstrapFactories) { | |
var _this = this; | |
this.parent = parent; | |
this._destroyListeners = []; | |
this._destroyed = false; | |
this.bootstrapFactories = | |
bootstrapFactories.map(function (f) { return new ComponentFactoryBoundToModule(f, _this); }); | |
this._cmpFactoryResolver = new CodegenComponentFactoryResolver(factories, parent.get(ComponentFactoryResolver, ComponentFactoryResolver.NULL), this); | |
} | |
/** | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.create = function () { this.instance = this.createInternal(); }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.createInternal = function () { }; | |
/** | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.get = function (token, notFoundValue) { | |
if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; } | |
if (token === Injector || token === NgModuleRef) { | |
return this; | |
} | |
if (token === ComponentFactoryResolver) { | |
return this._cmpFactoryResolver; | |
} | |
var /** @type {?} */ result = this.getInternal(token, _UNDEFINED); | |
return result === _UNDEFINED ? this.parent.get(token, notFoundValue) : result; | |
}; | |
/** | |
* @abstract | |
* @param {?} token | |
* @param {?} notFoundValue | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.getInternal = function (token, notFoundValue) { }; | |
Object.defineProperty(NgModuleInjector.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgModuleInjector.prototype, "componentFactoryResolver", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._cmpFactoryResolver; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.destroy = function () { | |
if (this._destroyed) { | |
throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed."); | |
} | |
this._destroyed = true; | |
this.destroyInternal(); | |
this._destroyListeners.forEach(function (listener) { return listener(); }); | |
}; | |
/** | |
* @param {?} callback | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
NgModuleInjector.prototype.destroyInternal = function () { }; | |
return NgModuleInjector; | |
}()); | |
/** | |
* @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 trace; | |
var events; | |
/** | |
* @return {?} | |
*/ | |
function detectWTF() { | |
var /** @type {?} */ wtf = ((_global) /** TODO #9100 */)['wtf']; | |
if (wtf) { | |
trace = wtf['trace']; | |
if (trace) { | |
events = trace['events']; | |
return true; | |
} | |
} | |
return false; | |
} | |
/** | |
* @param {?} signature | |
* @param {?=} flags | |
* @return {?} | |
*/ | |
function createScope$1(signature, flags) { | |
if (flags === void 0) { flags = null; } | |
return events.createScope(signature, flags); | |
} | |
/** | |
* @template T | |
* @param {?} scope | |
* @param {?=} returnValue | |
* @return {?} | |
*/ | |
function leave(scope, returnValue) { | |
trace.leaveScope(scope, returnValue); | |
return returnValue; | |
} | |
/** | |
* @param {?} rangeType | |
* @param {?} action | |
* @return {?} | |
*/ | |
function startTimeRange(rangeType, action) { | |
return trace.beginTimeRange(rangeType, action); | |
} | |
/** | |
* @param {?} range | |
* @return {?} | |
*/ | |
function endTimeRange(range) { | |
trace.endTimeRange(range); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* True if WTF is enabled. | |
*/ | |
var wtfEnabled = detectWTF(); | |
/** | |
* @param {?=} arg0 | |
* @param {?=} arg1 | |
* @return {?} | |
*/ | |
function noopScope(arg0, arg1) { | |
return null; | |
} | |
/** | |
* Create trace scope. | |
* | |
* Scopes must be strictly nested and are analogous to stack frames, but | |
* do not have to follow the stack frames. Instead it is recommended that they follow logical | |
* nesting. You may want to use | |
* [Event | |
* Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events) | |
* as they are defined in WTF. | |
* | |
* Used to mark scope entry. The return value is used to leave the scope. | |
* | |
* var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)'); | |
* | |
* someMethod() { | |
* var s = myScope('Foo'); // 'Foo' gets stored in tracing UI | |
* // DO SOME WORK HERE | |
* return wtfLeave(s, 123); // Return value 123 | |
* } | |
* | |
* Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can | |
* negatively impact the performance of your application. For this reason we recommend that | |
* you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and | |
* so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to | |
* exception, will produce incorrect trace, but presence of exception signifies logic error which | |
* needs to be fixed before the app should be profiled. Add try-finally only when you expect that | |
* an exception is expected during normal execution while profiling. | |
* | |
* \@experimental | |
*/ | |
var wtfCreateScope = wtfEnabled ? createScope$1 : function (signature, flags) { return noopScope; }; | |
/** | |
* Used to mark end of Scope. | |
* | |
* - `scope` to end. | |
* - `returnValue` (optional) to be passed to the WTF. | |
* | |
* Returns the `returnValue for easy chaining. | |
* \@experimental | |
*/ | |
var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; }; | |
/** | |
* Used to mark Async start. Async are similar to scope but they don't have to be strictly nested. | |
* The return value is used in the call to [endAsync]. Async ranges only work if WTF has been | |
* enabled. | |
* | |
* someMethod() { | |
* var s = wtfStartTimeRange('HTTP:GET', 'some.url'); | |
* var future = new Future.delay(5).then((_) { | |
* wtfEndTimeRange(s); | |
* }); | |
* } | |
* \@experimental | |
*/ | |
var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; }; | |
/** | |
* Ends a async time range operation. | |
* [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been | |
* enabled. | |
* \@experimental | |
*/ | |
var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* Use by directives and components to emit custom Events. | |
* | |
* ### Examples | |
* | |
* In the following example, `Zippy` alternatively emits `open` and `close` events when its | |
* title gets clicked: | |
* | |
* ``` | |
* \@Component({ | |
* selector: 'zippy', | |
* template: ` | |
* <div class="zippy"> | |
* <div (click)="toggle()">Toggle</div> | |
* <div [hidden]="!visible"> | |
* <ng-content></ng-content> | |
* </div> | |
* </div>`}) | |
* export class Zippy { | |
* visible: boolean = true; | |
* \@Output() open: EventEmitter<any> = new EventEmitter(); | |
* \@Output() close: EventEmitter<any> = new EventEmitter(); | |
* | |
* toggle() { | |
* this.visible = !this.visible; | |
* if (this.visible) { | |
* this.open.emit(null); | |
* } else { | |
* this.close.emit(null); | |
* } | |
* } | |
* } | |
* ``` | |
* | |
* The events payload can be accessed by the parameter `$event` on the components output event | |
* handler: | |
* | |
* ``` | |
* <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy> | |
* ``` | |
* | |
* Uses Rx.Observable but provides an adapter to make it work as specified here: | |
* https://github.com/jhusain/observable-spec | |
* | |
* Once a reference implementation of the spec is available, switch to it. | |
* \@stable | |
*/ | |
var EventEmitter = (function (_super) { | |
__extends(EventEmitter, _super); | |
/** | |
* Creates an instance of [EventEmitter], which depending on [isAsync], | |
* delivers events synchronously or asynchronously. | |
* @param {?=} isAsync | |
*/ | |
function EventEmitter(isAsync) { | |
if (isAsync === void 0) { isAsync = false; } | |
var _this = _super.call(this) || this; | |
_this.__isAsync = isAsync; | |
return _this; | |
} | |
/** | |
* @param {?=} value | |
* @return {?} | |
*/ | |
EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); }; | |
/** | |
* @param {?=} generatorOrNext | |
* @param {?=} error | |
* @param {?=} complete | |
* @return {?} | |
*/ | |
EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) { | |
var /** @type {?} */ schedulerFn; | |
var /** @type {?} */ errorFn = function (err) { return null; }; | |
var /** @type {?} */ completeFn = function () { return null; }; | |
if (generatorOrNext && typeof generatorOrNext === 'object') { | |
schedulerFn = this.__isAsync ? function (value) { | |
setTimeout(function () { return generatorOrNext.next(value); }); | |
} : function (value) { generatorOrNext.next(value); }; | |
if (generatorOrNext.error) { | |
errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } : | |
function (err) { generatorOrNext.error(err); }; | |
} | |
if (generatorOrNext.complete) { | |
completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } : | |
function () { generatorOrNext.complete(); }; | |
} | |
} | |
else { | |
schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } : | |
function (value) { generatorOrNext(value); }; | |
if (error) { | |
errorFn = | |
this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); }; | |
} | |
if (complete) { | |
completeFn = | |
this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); }; | |
} | |
} | |
return _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn); | |
}; | |
return EventEmitter; | |
}(__WEBPACK_IMPORTED_MODULE_3_rxjs_Subject__["Subject"])); | |
/** | |
* @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 | |
*/ | |
/** | |
* An injectable service for executing work inside or outside of the Angular zone. | |
* | |
* The most common use of this service is to optimize performance when starting a work consisting of | |
* one or more asynchronous tasks that don't require UI updates or error handling to be handled by | |
* Angular. Such tasks can be kicked off via {\@link runOutsideAngular} and if needed, these tasks | |
* can reenter the Angular zone via {\@link run}. | |
* | |
* <!-- TODO: add/fix links to: | |
* - docs explaining zones and the use of zones in Angular and change-detection | |
* - link to runOutsideAngular/run (throughout this file!) | |
* --> | |
* | |
* ### Example | |
* | |
* ``` | |
* import {Component, NgZone} from '\@angular/core'; | |
* import {NgIf} from '\@angular/common'; | |
* | |
* \@Component({ | |
* selector: 'ng-zone-demo'. | |
* template: ` | |
* <h2>Demo: NgZone</h2> | |
* | |
* <p>Progress: {{progress}}%</p> | |
* <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p> | |
* | |
* <button (click)="processWithinAngularZone()">Process within Angular zone</button> | |
* <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button> | |
* `, | |
* }) | |
* export class NgZoneDemo { | |
* progress: number = 0; | |
* label: string; | |
* | |
* constructor(private _ngZone: NgZone) {} | |
* | |
* // Loop inside the Angular zone | |
* // so the UI DOES refresh after each setTimeout cycle | |
* processWithinAngularZone() { | |
* this.label = 'inside'; | |
* this.progress = 0; | |
* this._increaseProgress(() => console.log('Inside Done!')); | |
* } | |
* | |
* // Loop outside of the Angular zone | |
* // so the UI DOES NOT refresh after each setTimeout cycle | |
* processOutsideOfAngularZone() { | |
* this.label = 'outside'; | |
* this.progress = 0; | |
* this._ngZone.runOutsideAngular(() => { | |
* this._increaseProgress(() => { | |
* // reenter the Angular zone and display done | |
* this._ngZone.run(() => {console.log('Outside Done!') }); | |
* }})); | |
* } | |
* | |
* _increaseProgress(doneCallback: () => void) { | |
* this.progress += 1; | |
* console.log(`Current progress: ${this.progress}%`); | |
* | |
* if (this.progress < 100) { | |
* window.setTimeout(() => this._increaseProgress(doneCallback)), 10) | |
* } else { | |
* doneCallback(); | |
* } | |
* } | |
* } | |
* ``` | |
* | |
* \@experimental | |
*/ | |
var NgZone = (function () { | |
/** | |
* @param {?} __0 | |
*/ | |
function NgZone(_a) { | |
var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b; | |
this._hasPendingMicrotasks = false; | |
this._hasPendingMacrotasks = false; | |
this._isStable = true; | |
this._nesting = 0; | |
this._onUnstable = new EventEmitter(false); | |
this._onMicrotaskEmpty = new EventEmitter(false); | |
this._onStable = new EventEmitter(false); | |
this._onErrorEvents = new EventEmitter(false); | |
if (typeof Zone == 'undefined') { | |
throw new Error('Angular requires Zone.js prolyfill.'); | |
} | |
Zone.assertZonePatched(); | |
this.outer = this.inner = Zone.current; | |
if (Zone['wtfZoneSpec']) { | |
this.inner = this.inner.fork(Zone['wtfZoneSpec']); | |
} | |
if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) { | |
this.inner = this.inner.fork(Zone['longStackTraceZoneSpec']); | |
} | |
this.forkInnerZoneWithAngularBehavior(); | |
} | |
/** | |
* @return {?} | |
*/ | |
NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; }; | |
/** | |
* @return {?} | |
*/ | |
NgZone.assertInAngularZone = function () { | |
if (!NgZone.isInAngularZone()) { | |
throw new Error('Expected to be in Angular Zone, but it is not!'); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgZone.assertNotInAngularZone = function () { | |
if (NgZone.isInAngularZone()) { | |
throw new Error('Expected to not be in Angular Zone, but it is!'); | |
} | |
}; | |
/** | |
* Executes the `fn` function synchronously within the Angular zone and returns value returned by | |
* the function. | |
* | |
* Running functions via `run` allows you to reenter Angular zone from a task that was executed | |
* outside of the Angular zone (typically started via {\@link runOutsideAngular}). | |
* | |
* Any future tasks or microtasks scheduled from within this function will continue executing from | |
* within the Angular zone. | |
* | |
* If a synchronous error happens it will be rethrown and not reported via `onError`. | |
* @param {?} fn | |
* @return {?} | |
*/ | |
NgZone.prototype.run = function (fn) { return this.inner.run(fn); }; | |
/** | |
* Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not | |
* rethrown. | |
* @param {?} fn | |
* @return {?} | |
*/ | |
NgZone.prototype.runGuarded = function (fn) { return this.inner.runGuarded(fn); }; | |
/** | |
* Executes the `fn` function synchronously in Angular's parent zone and returns value returned by | |
* the function. | |
* | |
* Running functions via `runOutsideAngular` allows you to escape Angular's zone and do work that | |
* doesn't trigger Angular change-detection or is subject to Angular's error handling. | |
* | |
* Any future tasks or microtasks scheduled from within this function will continue executing from | |
* outside of the Angular zone. | |
* | |
* Use {\@link run} to reenter the Angular zone and do work that updates the application model. | |
* @param {?} fn | |
* @return {?} | |
*/ | |
NgZone.prototype.runOutsideAngular = function (fn) { return this.outer.run(fn); }; | |
Object.defineProperty(NgZone.prototype, "onUnstable", { | |
/** | |
* Notifies when code enters Angular Zone. This gets fired first on VM Turn. | |
* @return {?} | |
*/ | |
get: function () { return this._onUnstable; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "onMicrotaskEmpty", { | |
/** | |
* Notifies when there is no more microtasks enqueue in the current VM Turn. | |
* This is a hint for Angular to do change detection, which may enqueue more microtasks. | |
* For this reason this event can fire multiple times per VM Turn. | |
* @return {?} | |
*/ | |
get: function () { return this._onMicrotaskEmpty; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "onStable", { | |
/** | |
* Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which | |
* implies we are about to relinquish VM turn. | |
* This event gets called just once. | |
* @return {?} | |
*/ | |
get: function () { return this._onStable; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "onError", { | |
/** | |
* Notify that an error has been delivered. | |
* @return {?} | |
*/ | |
get: function () { return this._onErrorEvents; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "isStable", { | |
/** | |
* Whether there are no outstanding microtasks or macrotasks. | |
* @return {?} | |
*/ | |
get: function () { return this._isStable; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "hasPendingMicrotasks", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._hasPendingMicrotasks; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgZone.prototype, "hasPendingMacrotasks", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._hasPendingMacrotasks; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
NgZone.prototype.checkStable = function () { | |
var _this = this; | |
if (this._nesting == 0 && !this._hasPendingMicrotasks && !this._isStable) { | |
try { | |
this._nesting++; | |
this._onMicrotaskEmpty.emit(null); | |
} | |
finally { | |
this._nesting--; | |
if (!this._hasPendingMicrotasks) { | |
try { | |
this.runOutsideAngular(function () { return _this._onStable.emit(null); }); | |
} | |
finally { | |
this._isStable = true; | |
} | |
} | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgZone.prototype.forkInnerZoneWithAngularBehavior = function () { | |
var _this = this; | |
this.inner = this.inner.fork({ | |
name: 'angular', | |
properties: /** @type {?} */ ({ 'isAngularZone': true }), | |
onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) { | |
try { | |
_this.onEnter(); | |
return delegate.invokeTask(target, task, applyThis, applyArgs); | |
} | |
finally { | |
_this.onLeave(); | |
} | |
}, | |
onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) { | |
try { | |
_this.onEnter(); | |
return delegate.invoke(target, callback, applyThis, applyArgs, source); | |
} | |
finally { | |
_this.onLeave(); | |
} | |
}, | |
onHasTask: function (delegate, current, target, hasTaskState) { | |
delegate.hasTask(target, hasTaskState); | |
if (current === target) { | |
// We are only interested in hasTask events which originate from our zone | |
// (A child hasTask event is not interesting to us) | |
if (hasTaskState.change == 'microTask') { | |
_this.setHasMicrotask(hasTaskState.microTask); | |
} | |
else if (hasTaskState.change == 'macroTask') { | |
_this.setHasMacrotask(hasTaskState.macroTask); | |
} | |
} | |
}, | |
onHandleError: function (delegate, current, target, error) { | |
delegate.handleError(target, error); | |
_this.triggerError(error); | |
return false; | |
} | |
}); | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgZone.prototype.onEnter = function () { | |
this._nesting++; | |
if (this._isStable) { | |
this._isStable = false; | |
this._onUnstable.emit(null); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgZone.prototype.onLeave = function () { | |
this._nesting--; | |
this.checkStable(); | |
}; | |
/** | |
* @param {?} hasMicrotasks | |
* @return {?} | |
*/ | |
NgZone.prototype.setHasMicrotask = function (hasMicrotasks) { | |
this._hasPendingMicrotasks = hasMicrotasks; | |
this.checkStable(); | |
}; | |
/** | |
* @param {?} hasMacrotasks | |
* @return {?} | |
*/ | |
NgZone.prototype.setHasMacrotask = function (hasMacrotasks) { this._hasPendingMacrotasks = hasMacrotasks; }; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
NgZone.prototype.triggerError = function (error) { this._onErrorEvents.emit(error); }; | |
return NgZone; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* The Testability service provides testing hooks that can be accessed from | |
* the browser and by services such as Protractor. Each bootstrapped Angular | |
* application on the page will have an instance of Testability. | |
* \@experimental | |
*/ | |
var Testability = (function () { | |
/** | |
* @param {?} _ngZone | |
*/ | |
function Testability(_ngZone) { | |
this._ngZone = _ngZone; | |
/** | |
* \@internal | |
*/ | |
this._pendingCount = 0; | |
/** | |
* \@internal | |
*/ | |
this._isZoneStable = true; | |
/** | |
* Whether any work was done since the last 'whenStable' callback. This is | |
* useful to detect if this could have potentially destabilized another | |
* component while it is stabilizing. | |
* \@internal | |
*/ | |
this._didWork = false; | |
/** | |
* \@internal | |
*/ | |
this._callbacks = []; | |
this._watchAngularEvents(); | |
} | |
/** | |
* \@internal | |
* @return {?} | |
*/ | |
Testability.prototype._watchAngularEvents = function () { | |
var _this = this; | |
this._ngZone.onUnstable.subscribe({ | |
next: function () { | |
_this._didWork = true; | |
_this._isZoneStable = false; | |
} | |
}); | |
this._ngZone.runOutsideAngular(function () { | |
_this._ngZone.onStable.subscribe({ | |
next: function () { | |
NgZone.assertNotInAngularZone(); | |
scheduleMicroTask(function () { | |
_this._isZoneStable = true; | |
_this._runCallbacksIfReady(); | |
}); | |
} | |
}); | |
}); | |
}; | |
/** | |
* @return {?} | |
*/ | |
Testability.prototype.increasePendingRequestCount = function () { | |
this._pendingCount += 1; | |
this._didWork = true; | |
return this._pendingCount; | |
}; | |
/** | |
* @return {?} | |
*/ | |
Testability.prototype.decreasePendingRequestCount = function () { | |
this._pendingCount -= 1; | |
if (this._pendingCount < 0) { | |
throw new Error('pending async requests below zero'); | |
} | |
this._runCallbacksIfReady(); | |
return this._pendingCount; | |
}; | |
/** | |
* @return {?} | |
*/ | |
Testability.prototype.isStable = function () { | |
return this._isZoneStable && this._pendingCount == 0 && !this._ngZone.hasPendingMacrotasks; | |
}; | |
/** | |
* \@internal | |
* @return {?} | |
*/ | |
Testability.prototype._runCallbacksIfReady = function () { | |
var _this = this; | |
if (this.isStable()) { | |
// Schedules the call backs in a new frame so that it is always async. | |
scheduleMicroTask(function () { | |
while (_this._callbacks.length !== 0) { | |
(((_this._callbacks.pop())))(_this._didWork); | |
} | |
_this._didWork = false; | |
}); | |
} | |
else { | |
// Not Ready | |
this._didWork = true; | |
} | |
}; | |
/** | |
* @param {?} callback | |
* @return {?} | |
*/ | |
Testability.prototype.whenStable = function (callback) { | |
this._callbacks.push(callback); | |
this._runCallbacksIfReady(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; }; | |
/** | |
* @deprecated use findProviders | |
* @param {?} using | |
* @param {?} provider | |
* @param {?} exactMatch | |
* @return {?} | |
*/ | |
Testability.prototype.findBindings = function (using, provider, exactMatch) { | |
// TODO(juliemr): implement. | |
return []; | |
}; | |
/** | |
* @param {?} using | |
* @param {?} provider | |
* @param {?} exactMatch | |
* @return {?} | |
*/ | |
Testability.prototype.findProviders = function (using, provider, exactMatch) { | |
// TODO(juliemr): implement. | |
return []; | |
}; | |
return Testability; | |
}()); | |
Testability.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Testability.ctorParameters = function () { return [ | |
{ type: NgZone, }, | |
]; }; | |
/** | |
* A global registry of {\@link Testability} instances for specific elements. | |
* \@experimental | |
*/ | |
var TestabilityRegistry = (function () { | |
function TestabilityRegistry() { | |
/** | |
* \@internal | |
*/ | |
this._applications = new Map(); | |
_testabilityGetter.addToWindow(this); | |
} | |
/** | |
* @param {?} token | |
* @param {?} testability | |
* @return {?} | |
*/ | |
TestabilityRegistry.prototype.registerApplication = function (token, testability) { | |
this._applications.set(token, testability); | |
}; | |
/** | |
* @param {?} elem | |
* @return {?} | |
*/ | |
TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; }; | |
/** | |
* @return {?} | |
*/ | |
TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); }; | |
/** | |
* @return {?} | |
*/ | |
TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); }; | |
/** | |
* @param {?} elem | |
* @param {?=} findInAncestors | |
* @return {?} | |
*/ | |
TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) { | |
if (findInAncestors === void 0) { findInAncestors = true; } | |
return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors); | |
}; | |
return TestabilityRegistry; | |
}()); | |
TestabilityRegistry.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
TestabilityRegistry.ctorParameters = function () { return []; }; | |
var _NoopGetTestability = (function () { | |
function _NoopGetTestability() { | |
} | |
/** | |
* @param {?} registry | |
* @return {?} | |
*/ | |
_NoopGetTestability.prototype.addToWindow = function (registry) { }; | |
/** | |
* @param {?} registry | |
* @param {?} elem | |
* @param {?} findInAncestors | |
* @return {?} | |
*/ | |
_NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) { | |
return null; | |
}; | |
return _NoopGetTestability; | |
}()); | |
/** | |
* Set the {\@link GetTestability} implementation used by the Angular testing framework. | |
* \@experimental | |
* @param {?} getter | |
* @return {?} | |
*/ | |
function setTestabilityGetter(getter) { | |
_testabilityGetter = getter; | |
} | |
var _testabilityGetter = new _NoopGetTestability(); | |
/** | |
* @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 _devMode = true; | |
var _runModeLocked = false; | |
var _platform; | |
var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken'); | |
/** | |
* Disable Angular's development mode, which turns off assertions and other | |
* checks within the framework. | |
* | |
* One important assertion this disables verifies that a change detection pass | |
* does not result in additional changes to any bindings (also known as | |
* unidirectional data flow). | |
* | |
* \@stable | |
* @return {?} | |
*/ | |
function enableProdMode() { | |
if (_runModeLocked) { | |
throw new Error('Cannot enable prod mode after platform setup.'); | |
} | |
_devMode = false; | |
} | |
/** | |
* Returns whether Angular is in development mode. After called once, | |
* the value is locked and won't change any more. | |
* | |
* By default, this is true, unless a user calls `enableProdMode` before calling this. | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @return {?} | |
*/ | |
function isDevMode() { | |
_runModeLocked = true; | |
return _devMode; | |
} | |
/** | |
* A token for third-party components that can register themselves with NgProbe. | |
* | |
* \@experimental | |
*/ | |
var NgProbeToken = (function () { | |
/** | |
* @param {?} name | |
* @param {?} token | |
*/ | |
function NgProbeToken(name, token) { | |
this.name = name; | |
this.token = token; | |
} | |
return NgProbeToken; | |
}()); | |
/** | |
* Creates a platform. | |
* Platforms have to be eagerly created via this function. | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @param {?} injector | |
* @return {?} | |
*/ | |
function createPlatform(injector) { | |
if (_platform && !_platform.destroyed && | |
!_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { | |
throw new Error('There can be only one platform. Destroy the previous one to create a new one.'); | |
} | |
_platform = injector.get(PlatformRef); | |
var /** @type {?} */ inits = injector.get(PLATFORM_INITIALIZER, null); | |
if (inits) | |
inits.forEach(function (init) { return init(); }); | |
return _platform; | |
} | |
/** | |
* Creates a factory for a platform | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @param {?} parentPlatformFactory | |
* @param {?} name | |
* @param {?=} providers | |
* @return {?} | |
*/ | |
function createPlatformFactory(parentPlatformFactory, name, providers) { | |
if (providers === void 0) { providers = []; } | |
var /** @type {?} */ marker = new InjectionToken("Platform: " + name); | |
return function (extraProviders) { | |
if (extraProviders === void 0) { extraProviders = []; } | |
var /** @type {?} */ platform = getPlatform(); | |
if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) { | |
if (parentPlatformFactory) { | |
parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true })); | |
} | |
else { | |
createPlatform(ReflectiveInjector.resolveAndCreate(providers.concat(extraProviders).concat({ provide: marker, useValue: true }))); | |
} | |
} | |
return assertPlatform(marker); | |
}; | |
} | |
/** | |
* Checks that there currently is a platform which contains the given token as a provider. | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @param {?} requiredToken | |
* @return {?} | |
*/ | |
function assertPlatform(requiredToken) { | |
var /** @type {?} */ platform = getPlatform(); | |
if (!platform) { | |
throw new Error('No platform exists!'); | |
} | |
if (!platform.injector.get(requiredToken, null)) { | |
throw new Error('A platform with a different configuration has been created. Please destroy it first.'); | |
} | |
return platform; | |
} | |
/** | |
* Destroy the existing platform. | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @return {?} | |
*/ | |
function destroyPlatform() { | |
if (_platform && !_platform.destroyed) { | |
_platform.destroy(); | |
} | |
} | |
/** | |
* Returns the current platform. | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @return {?} | |
*/ | |
function getPlatform() { | |
return _platform && !_platform.destroyed ? _platform : null; | |
} | |
/** | |
* The Angular platform is the entry point for Angular on a web page. Each page | |
* has exactly one platform, and services (such as reflection) which are common | |
* to every Angular application running on the page are bound in its scope. | |
* | |
* A page's platform is initialized implicitly when {\@link bootstrap}() is called, or | |
* explicitly by calling {\@link createPlatform}(). | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var PlatformRef = (function () { | |
function PlatformRef() { | |
} | |
/** | |
* Creates an instance of an `\@NgModule` for the given platform | |
* for offline compilation. | |
* | |
* ## Simple Example | |
* | |
* ```typescript | |
* my_module.ts: | |
* | |
* \@NgModule({ | |
* imports: [BrowserModule] | |
* }) | |
* class MyModule {} | |
* | |
* main.ts: | |
* import {MyModuleNgFactory} from './my_module.ngfactory'; | |
* import {platformBrowser} from '\@angular/platform-browser'; | |
* | |
* let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory); | |
* ``` | |
* | |
* \@experimental APIs related to application bootstrap are currently under review. | |
* @abstract | |
* @template M | |
* @param {?} moduleFactory | |
* @return {?} | |
*/ | |
PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory) { }; | |
/** | |
* Creates an instance of an `\@NgModule` for a given platform using the given runtime compiler. | |
* | |
* ## Simple Example | |
* | |
* ```typescript | |
* \@NgModule({ | |
* imports: [BrowserModule] | |
* }) | |
* class MyModule {} | |
* | |
* let moduleRef = platformBrowser().bootstrapModule(MyModule); | |
* ``` | |
* \@stable | |
* @abstract | |
* @template M | |
* @param {?} moduleType | |
* @param {?=} compilerOptions | |
* @return {?} | |
*/ | |
PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) { }; | |
/** | |
* Register a listener to be called when the platform is disposed. | |
* @abstract | |
* @param {?} callback | |
* @return {?} | |
*/ | |
PlatformRef.prototype.onDestroy = function (callback) { }; | |
/** | |
* Retrieve the platform {\@link Injector}, which is the parent injector for | |
* every Angular application on the page and provides singleton providers. | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformRef.prototype.injector = function () { }; | |
/** | |
* Destroy the Angular platform and all Angular applications on the page. | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformRef.prototype.destroy = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformRef.prototype.destroyed = function () { }; | |
return PlatformRef; | |
}()); | |
/** | |
* @param {?} errorHandler | |
* @param {?} callback | |
* @return {?} | |
*/ | |
function _callAndReportToErrorHandler(errorHandler, callback) { | |
try { | |
var /** @type {?} */ result = callback(); | |
if (isPromise(result)) { | |
return result.catch(function (e) { | |
errorHandler.handleError(e); | |
// rethrow as the exception handler might not do it | |
throw e; | |
}); | |
} | |
return result; | |
} | |
catch (e) { | |
errorHandler.handleError(e); | |
// rethrow as the exception handler might not do it | |
throw e; | |
} | |
} | |
/** | |
* workaround https://github.com/angular/tsickle/issues/350 | |
* @suppress {checkTypes} | |
*/ | |
var PlatformRef_ = (function (_super) { | |
__extends(PlatformRef_, _super); | |
/** | |
* @param {?} _injector | |
*/ | |
function PlatformRef_(_injector) { | |
var _this = _super.call(this) || this; | |
_this._injector = _injector; | |
_this._modules = []; | |
_this._destroyListeners = []; | |
_this._destroyed = false; | |
return _this; | |
} | |
/** | |
* @param {?} callback | |
* @return {?} | |
*/ | |
PlatformRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); }; | |
Object.defineProperty(PlatformRef_.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._injector; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(PlatformRef_.prototype, "destroyed", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._destroyed; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
PlatformRef_.prototype.destroy = function () { | |
if (this._destroyed) { | |
throw new Error('The platform has already been destroyed!'); | |
} | |
this._modules.slice().forEach(function (module) { return module.destroy(); }); | |
this._destroyListeners.forEach(function (listener) { return listener(); }); | |
this._destroyed = true; | |
}; | |
/** | |
* @template M | |
* @param {?} moduleFactory | |
* @return {?} | |
*/ | |
PlatformRef_.prototype.bootstrapModuleFactory = function (moduleFactory) { | |
return this._bootstrapModuleFactoryWithZone(moduleFactory); | |
}; | |
/** | |
* @template M | |
* @param {?} moduleFactory | |
* @param {?=} ngZone | |
* @return {?} | |
*/ | |
PlatformRef_.prototype._bootstrapModuleFactoryWithZone = function (moduleFactory, ngZone) { | |
var _this = this; | |
// Note: We need to create the NgZone _before_ we instantiate the module, | |
// as instantiating the module creates some providers eagerly. | |
// So we create a mini parent injector that just contains the new NgZone and | |
// pass that as parent to the NgModuleFactory. | |
if (!ngZone) | |
ngZone = new NgZone({ enableLongStackTrace: isDevMode() }); | |
// Attention: Don't use ApplicationRef.run here, | |
// as we want to be sure that all possible constructor calls are inside `ngZone.run`! | |
return ngZone.run(function () { | |
var /** @type {?} */ ngZoneInjector = ReflectiveInjector.resolveAndCreate([{ provide: NgZone, useValue: ngZone }], _this.injector); | |
var /** @type {?} */ moduleRef = (moduleFactory.create(ngZoneInjector)); | |
var /** @type {?} */ exceptionHandler = moduleRef.injector.get(ErrorHandler, null); | |
if (!exceptionHandler) { | |
throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?'); | |
} | |
moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); }); /** @type {?} */ | |
((ngZone)).onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); | |
return _callAndReportToErrorHandler(exceptionHandler, function () { | |
var /** @type {?} */ initStatus = moduleRef.injector.get(ApplicationInitStatus); | |
return initStatus.donePromise.then(function () { | |
_this._moduleDoBootstrap(moduleRef); | |
return moduleRef; | |
}); | |
}); | |
}); | |
}; | |
/** | |
* @template M | |
* @param {?} moduleType | |
* @param {?=} compilerOptions | |
* @return {?} | |
*/ | |
PlatformRef_.prototype.bootstrapModule = function (moduleType, compilerOptions) { | |
if (compilerOptions === void 0) { compilerOptions = []; } | |
return this._bootstrapModuleWithZone(moduleType, compilerOptions); | |
}; | |
/** | |
* @template M | |
* @param {?} moduleType | |
* @param {?=} compilerOptions | |
* @param {?=} ngZone | |
* @return {?} | |
*/ | |
PlatformRef_.prototype._bootstrapModuleWithZone = function (moduleType, compilerOptions, ngZone) { | |
var _this = this; | |
if (compilerOptions === void 0) { compilerOptions = []; } | |
var /** @type {?} */ compilerFactory = this.injector.get(CompilerFactory); | |
var /** @type {?} */ compiler = compilerFactory.createCompiler(Array.isArray(compilerOptions) ? compilerOptions : [compilerOptions]); | |
return compiler.compileModuleAsync(moduleType) | |
.then(function (moduleFactory) { return _this._bootstrapModuleFactoryWithZone(moduleFactory, ngZone); }); | |
}; | |
/** | |
* @param {?} moduleRef | |
* @return {?} | |
*/ | |
PlatformRef_.prototype._moduleDoBootstrap = function (moduleRef) { | |
var /** @type {?} */ appRef = moduleRef.injector.get(ApplicationRef); | |
if (moduleRef.bootstrapFactories.length > 0) { | |
moduleRef.bootstrapFactories.forEach(function (f) { return appRef.bootstrap(f); }); | |
} | |
else if (moduleRef.instance.ngDoBootstrap) { | |
moduleRef.instance.ngDoBootstrap(appRef); | |
} | |
else { | |
throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " + | |
"Please define one of these."); | |
} | |
this._modules.push(moduleRef); | |
}; | |
return PlatformRef_; | |
}(PlatformRef)); | |
PlatformRef_.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
PlatformRef_.ctorParameters = function () { return [ | |
{ type: Injector, }, | |
]; }; | |
/** | |
* A reference to an Angular application running on a page. | |
* | |
* For more about Angular applications, see the documentation for {\@link bootstrap}. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var ApplicationRef = (function () { | |
function ApplicationRef() { | |
} | |
/** | |
* Bootstrap a new component at the root level of the application. | |
* | |
* ### Bootstrap process | |
* | |
* When bootstrapping a new root component into an application, Angular mounts the | |
* specified application component onto DOM elements identified by the [componentType]'s | |
* selector and kicks off automatic change detection to finish initializing the component. | |
* | |
* ### Example | |
* {\@example core/ts/platform/platform.ts region='longform'} | |
* @abstract | |
* @template C | |
* @param {?} componentFactory | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.bootstrap = function (componentFactory) { }; | |
/** | |
* Invoke this method to explicitly process change detection and its side-effects. | |
* | |
* In development mode, `tick()` also performs a second change detection cycle to ensure that no | |
* further changes are detected. If additional changes are picked up during this second cycle, | |
* bindings in the app have side-effects that cannot be resolved in a single change detection | |
* pass. | |
* In this case, Angular throws an error, since an Angular application can only have one change | |
* detection pass during which all change detection must complete. | |
* @abstract | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.tick = function () { }; | |
/** | |
* Get a list of component types registered to this application. | |
* This list is populated even before the component is created. | |
* @abstract | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.componentTypes = function () { }; | |
/** | |
* Get a list of components registered to this application. | |
* @abstract | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.components = function () { }; | |
/** | |
* Attaches a view so that it will be dirty checked. | |
* The view will be automatically detached when it is destroyed. | |
* This will throw if the view is already attached to a ViewContainer. | |
* @abstract | |
* @param {?} view | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.attachView = function (view) { }; | |
/** | |
* Detaches a view from dirty checking again. | |
* @abstract | |
* @param {?} view | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.detachView = function (view) { }; | |
/** | |
* Returns the number of attached views. | |
* @abstract | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.viewCount = function () { }; | |
/** | |
* Returns an Observable that indicates when the application is stable or unstable. | |
* @abstract | |
* @return {?} | |
*/ | |
ApplicationRef.prototype.isStable = function () { }; | |
return ApplicationRef; | |
}()); | |
/** | |
* workaround https://github.com/angular/tsickle/issues/350 | |
* @suppress {checkTypes} | |
*/ | |
var ApplicationRef_ = (function (_super) { | |
__extends(ApplicationRef_, _super); | |
/** | |
* @param {?} _zone | |
* @param {?} _console | |
* @param {?} _injector | |
* @param {?} _exceptionHandler | |
* @param {?} _componentFactoryResolver | |
* @param {?} _initStatus | |
*/ | |
function ApplicationRef_(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) { | |
var _this = _super.call(this) || this; | |
_this._zone = _zone; | |
_this._console = _console; | |
_this._injector = _injector; | |
_this._exceptionHandler = _exceptionHandler; | |
_this._componentFactoryResolver = _componentFactoryResolver; | |
_this._initStatus = _initStatus; | |
_this._bootstrapListeners = []; | |
_this._rootComponents = []; | |
_this._rootComponentTypes = []; | |
_this._views = []; | |
_this._runningTick = false; | |
_this._enforceNoNewChanges = false; | |
_this._stable = true; | |
_this._enforceNoNewChanges = isDevMode(); | |
_this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } }); | |
var isCurrentlyStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["Observable"](function (observer) { | |
_this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks && | |
!_this._zone.hasPendingMicrotasks; | |
_this._zone.runOutsideAngular(function () { | |
observer.next(_this._stable); | |
observer.complete(); | |
}); | |
}); | |
var isStable = new __WEBPACK_IMPORTED_MODULE_0_rxjs_Observable__["Observable"](function (observer) { | |
var stableSub = _this._zone.onStable.subscribe(function () { | |
NgZone.assertNotInAngularZone(); | |
// Check whether there are no pending macro/micro tasks in the next tick | |
// to allow for NgZone to update the state. | |
scheduleMicroTask(function () { | |
if (!_this._stable && !_this._zone.hasPendingMacrotasks && | |
!_this._zone.hasPendingMicrotasks) { | |
_this._stable = true; | |
observer.next(true); | |
} | |
}); | |
}); | |
var unstableSub = _this._zone.onUnstable.subscribe(function () { | |
NgZone.assertInAngularZone(); | |
if (_this._stable) { | |
_this._stable = false; | |
_this._zone.runOutsideAngular(function () { observer.next(false); }); | |
} | |
}); | |
return function () { | |
stableSub.unsubscribe(); | |
unstableSub.unsubscribe(); | |
}; | |
}); | |
_this._isStable = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1_rxjs_observable_merge__["merge"])(isCurrentlyStable, __WEBPACK_IMPORTED_MODULE_2_rxjs_operator_share__["share"].call(isStable)); | |
return _this; | |
} | |
/** | |
* @param {?} viewRef | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype.attachView = function (viewRef) { | |
var /** @type {?} */ view = ((viewRef)); | |
this._views.push(view); | |
view.attachToAppRef(this); | |
}; | |
/** | |
* @param {?} viewRef | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype.detachView = function (viewRef) { | |
var /** @type {?} */ view = ((viewRef)); | |
remove(this._views, view); | |
view.detachFromAppRef(); | |
}; | |
/** | |
* @template C | |
* @param {?} componentOrFactory | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype.bootstrap = function (componentOrFactory) { | |
var _this = this; | |
if (!this._initStatus.done) { | |
throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.'); | |
} | |
var /** @type {?} */ componentFactory; | |
if (componentOrFactory instanceof ComponentFactory) { | |
componentFactory = componentOrFactory; | |
} | |
else { | |
componentFactory = ((this._componentFactoryResolver.resolveComponentFactory(componentOrFactory))); | |
} | |
this._rootComponentTypes.push(componentFactory.componentType); | |
// Create a factory associated with the current module if it's not bound to some other | |
var /** @type {?} */ ngModule = componentFactory instanceof ComponentFactoryBoundToModule ? | |
null : | |
this._injector.get(NgModuleRef); | |
var /** @type {?} */ compRef = componentFactory.create(Injector.NULL, [], componentFactory.selector, ngModule); | |
compRef.onDestroy(function () { _this._unloadComponent(compRef); }); | |
var /** @type {?} */ testability = compRef.injector.get(Testability, null); | |
if (testability) { | |
compRef.injector.get(TestabilityRegistry) | |
.registerApplication(compRef.location.nativeElement, testability); | |
} | |
this._loadComponent(compRef); | |
if (isDevMode()) { | |
this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode."); | |
} | |
return compRef; | |
}; | |
/** | |
* @param {?} componentRef | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype._loadComponent = function (componentRef) { | |
this.attachView(componentRef.hostView); | |
this.tick(); | |
this._rootComponents.push(componentRef); | |
// Get the listeners lazily to prevent DI cycles. | |
var /** @type {?} */ listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners); | |
listeners.forEach(function (listener) { return listener(componentRef); }); | |
}; | |
/** | |
* @param {?} componentRef | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype._unloadComponent = function (componentRef) { | |
this.detachView(componentRef.hostView); | |
remove(this._rootComponents, componentRef); | |
}; | |
/** | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype.tick = function () { | |
if (this._runningTick) { | |
throw new Error('ApplicationRef.tick is called recursively'); | |
} | |
var /** @type {?} */ scope = ApplicationRef_._tickScope(); | |
try { | |
this._runningTick = true; | |
this._views.forEach(function (view) { return view.detectChanges(); }); | |
if (this._enforceNoNewChanges) { | |
this._views.forEach(function (view) { return view.checkNoChanges(); }); | |
} | |
} | |
finally { | |
this._runningTick = false; | |
wtfLeave(scope); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
ApplicationRef_.prototype.ngOnDestroy = function () { | |
// TODO(alxhub): Dispose of the NgZone. | |
this._views.slice().forEach(function (view) { return view.destroy(); }); | |
}; | |
Object.defineProperty(ApplicationRef_.prototype, "viewCount", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._views.length; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ApplicationRef_.prototype, "componentTypes", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._rootComponentTypes; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ApplicationRef_.prototype, "components", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._rootComponents; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ApplicationRef_.prototype, "isStable", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._isStable; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return ApplicationRef_; | |
}(ApplicationRef)); | |
/** | |
* \@internal | |
*/ | |
ApplicationRef_._tickScope = wtfCreateScope('ApplicationRef#tick()'); | |
ApplicationRef_.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
ApplicationRef_.ctorParameters = function () { return [ | |
{ type: NgZone, }, | |
{ type: Console, }, | |
{ type: Injector, }, | |
{ type: ErrorHandler, }, | |
{ type: ComponentFactoryResolver, }, | |
{ type: ApplicationInitStatus, }, | |
]; }; | |
/** | |
* @template T | |
* @param {?} list | |
* @param {?} el | |
* @return {?} | |
*/ | |
function remove(list, el) { | |
var /** @type {?} */ index = list.indexOf(el); | |
if (index > -1) { | |
list.splice(index, 1); | |
} | |
} | |
/** | |
* @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 | |
*/ | |
// Public API for Zone | |
/** | |
* @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 | |
*/ | |
/** | |
* @deprecated Use `RendererType2` (and `Renderer2`) instead. | |
*/ | |
var RenderComponentType = (function () { | |
/** | |
* @param {?} id | |
* @param {?} templateUrl | |
* @param {?} slotCount | |
* @param {?} encapsulation | |
* @param {?} styles | |
* @param {?} animations | |
*/ | |
function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) { | |
this.id = id; | |
this.templateUrl = templateUrl; | |
this.slotCount = slotCount; | |
this.encapsulation = encapsulation; | |
this.styles = styles; | |
this.animations = animations; | |
} | |
return RenderComponentType; | |
}()); | |
/** | |
* @deprecated Debug info is handeled internally in the view engine now. | |
* @abstract | |
*/ | |
var RenderDebugInfo = (function () { | |
function RenderDebugInfo() { | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.injector = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.component = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.providerTokens = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.references = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.context = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
RenderDebugInfo.prototype.source = function () { }; | |
return RenderDebugInfo; | |
}()); | |
/** | |
* @deprecated Use the `Renderer2` instead. | |
* @abstract | |
*/ | |
var Renderer = (function () { | |
function Renderer() { | |
} | |
/** | |
* @abstract | |
* @param {?} selectorOrNode | |
* @param {?=} debugInfo | |
* @return {?} | |
*/ | |
Renderer.prototype.selectRootElement = function (selectorOrNode, debugInfo) { }; | |
/** | |
* @abstract | |
* @param {?} parentElement | |
* @param {?} name | |
* @param {?=} debugInfo | |
* @return {?} | |
*/ | |
Renderer.prototype.createElement = function (parentElement, name, debugInfo) { }; | |
/** | |
* @abstract | |
* @param {?} hostElement | |
* @return {?} | |
*/ | |
Renderer.prototype.createViewRoot = function (hostElement) { }; | |
/** | |
* @abstract | |
* @param {?} parentElement | |
* @param {?=} debugInfo | |
* @return {?} | |
*/ | |
Renderer.prototype.createTemplateAnchor = function (parentElement, debugInfo) { }; | |
/** | |
* @abstract | |
* @param {?} parentElement | |
* @param {?} value | |
* @param {?=} debugInfo | |
* @return {?} | |
*/ | |
Renderer.prototype.createText = function (parentElement, value, debugInfo) { }; | |
/** | |
* @abstract | |
* @param {?} parentElement | |
* @param {?} nodes | |
* @return {?} | |
*/ | |
Renderer.prototype.projectNodes = function (parentElement, nodes) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @param {?} viewRootNodes | |
* @return {?} | |
*/ | |
Renderer.prototype.attachViewAfter = function (node, viewRootNodes) { }; | |
/** | |
* @abstract | |
* @param {?} viewRootNodes | |
* @return {?} | |
*/ | |
Renderer.prototype.detachView = function (viewRootNodes) { }; | |
/** | |
* @abstract | |
* @param {?} hostElement | |
* @param {?} viewAllNodes | |
* @return {?} | |
*/ | |
Renderer.prototype.destroyView = function (hostElement, viewAllNodes) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} name | |
* @param {?} callback | |
* @return {?} | |
*/ | |
Renderer.prototype.listen = function (renderElement, name, callback) { }; | |
/** | |
* @abstract | |
* @param {?} target | |
* @param {?} name | |
* @param {?} callback | |
* @return {?} | |
*/ | |
Renderer.prototype.listenGlobal = function (target, name, callback) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} propertyName | |
* @param {?} propertyValue | |
* @return {?} | |
*/ | |
Renderer.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} attributeName | |
* @param {?} attributeValue | |
* @return {?} | |
*/ | |
Renderer.prototype.setElementAttribute = function (renderElement, attributeName, attributeValue) { }; | |
/** | |
* Used only in debug mode to serialize property changes to dom nodes as attributes. | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} propertyName | |
* @param {?} propertyValue | |
* @return {?} | |
*/ | |
Renderer.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} className | |
* @param {?} isAdd | |
* @return {?} | |
*/ | |
Renderer.prototype.setElementClass = function (renderElement, className, isAdd) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} styleName | |
* @param {?} styleValue | |
* @return {?} | |
*/ | |
Renderer.prototype.setElementStyle = function (renderElement, styleName, styleValue) { }; | |
/** | |
* @abstract | |
* @param {?} renderElement | |
* @param {?} methodName | |
* @param {?=} args | |
* @return {?} | |
*/ | |
Renderer.prototype.invokeElementMethod = function (renderElement, methodName, args) { }; | |
/** | |
* @abstract | |
* @param {?} renderNode | |
* @param {?} text | |
* @return {?} | |
*/ | |
Renderer.prototype.setText = function (renderNode, text) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} startingStyles | |
* @param {?} keyframes | |
* @param {?} duration | |
* @param {?} delay | |
* @param {?} easing | |
* @param {?=} previousPlayers | |
* @return {?} | |
*/ | |
Renderer.prototype.animate = function (element, startingStyles, keyframes, duration, delay, easing, previousPlayers) { }; | |
return Renderer; | |
}()); | |
var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor'); | |
/** | |
* Injectable service that provides a low-level interface for modifying the UI. | |
* | |
* Use this service to bypass Angular's templating and make custom UI changes that can't be | |
* expressed declaratively. For example if you need to set a property or an attribute whose name is | |
* not statically known, use {\@link #setElementProperty} or {\@link #setElementAttribute} | |
* respectively. | |
* | |
* If you are implementing a custom renderer, you must implement this interface. | |
* | |
* The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`. | |
* | |
* @deprecated Use `RendererFactory2` instead. | |
* @abstract | |
*/ | |
var RootRenderer = (function () { | |
function RootRenderer() { | |
} | |
/** | |
* @abstract | |
* @param {?} componentType | |
* @return {?} | |
*/ | |
RootRenderer.prototype.renderComponent = function (componentType) { }; | |
return RootRenderer; | |
}()); | |
/** | |
* \@experimental | |
* @abstract | |
*/ | |
var RendererFactory2 = (function () { | |
function RendererFactory2() { | |
} | |
/** | |
* @abstract | |
* @param {?} hostElement | |
* @param {?} type | |
* @return {?} | |
*/ | |
RendererFactory2.prototype.createRenderer = function (hostElement, type) { }; | |
return RendererFactory2; | |
}()); | |
var RendererStyleFlags2 = {}; | |
RendererStyleFlags2.Important = 1; | |
RendererStyleFlags2.DashCase = 2; | |
RendererStyleFlags2[RendererStyleFlags2.Important] = "Important"; | |
RendererStyleFlags2[RendererStyleFlags2.DashCase] = "DashCase"; | |
/** | |
* \@experimental | |
* @abstract | |
*/ | |
var Renderer2 = (function () { | |
function Renderer2() { | |
} | |
/** | |
* This field can be used to store arbitrary data on this renderer instance. | |
* This is useful for renderers that delegate to other renderers. | |
* @abstract | |
* @return {?} | |
*/ | |
Renderer2.prototype.data = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
Renderer2.prototype.destroy = function () { }; | |
/** | |
* @abstract | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
Renderer2.prototype.createElement = function (name, namespace) { }; | |
/** | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
Renderer2.prototype.createComment = function (value) { }; | |
/** | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
Renderer2.prototype.createText = function (value) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} newChild | |
* @return {?} | |
*/ | |
Renderer2.prototype.appendChild = function (parent, newChild) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} newChild | |
* @param {?} refChild | |
* @return {?} | |
*/ | |
Renderer2.prototype.insertBefore = function (parent, newChild, refChild) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} oldChild | |
* @return {?} | |
*/ | |
Renderer2.prototype.removeChild = function (parent, oldChild) { }; | |
/** | |
* @abstract | |
* @param {?} selectorOrNode | |
* @return {?} | |
*/ | |
Renderer2.prototype.selectRootElement = function (selectorOrNode) { }; | |
/** | |
* Attention: On WebWorkers, this will always return a value, | |
* as we are asking for a result synchronously. I.e. | |
* the caller can't rely on checking whether this is null or not. | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
Renderer2.prototype.parentNode = function (node) { }; | |
/** | |
* Attention: On WebWorkers, this will always return a value, | |
* as we are asking for a result synchronously. I.e. | |
* the caller can't rely on checking whether this is null or not. | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
Renderer2.prototype.nextSibling = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
Renderer2.prototype.setAttribute = function (el, name, value, namespace) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
Renderer2.prototype.removeAttribute = function (el, name, namespace) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
Renderer2.prototype.addClass = function (el, name) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
Renderer2.prototype.removeClass = function (el, name) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} style | |
* @param {?} value | |
* @param {?=} flags | |
* @return {?} | |
*/ | |
Renderer2.prototype.setStyle = function (el, style, value, flags) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} style | |
* @param {?=} flags | |
* @return {?} | |
*/ | |
Renderer2.prototype.removeStyle = function (el, style, flags) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
Renderer2.prototype.setProperty = function (el, name, value) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @param {?} value | |
* @return {?} | |
*/ | |
Renderer2.prototype.setValue = function (node, value) { }; | |
/** | |
* @abstract | |
* @param {?} target | |
* @param {?} eventName | |
* @param {?} callback | |
* @return {?} | |
*/ | |
Renderer2.prototype.listen = function (target, eventName, callback) { }; | |
return Renderer2; | |
}()); | |
/** | |
* @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 | |
*/ | |
// Public API for render | |
var ElementRef = (function () { | |
/** | |
* @param {?} nativeElement | |
*/ | |
function ElementRef(nativeElement) { | |
this.nativeElement = nativeElement; | |
} | |
return ElementRef; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Used to load ng module factories. | |
* \@stable | |
* @abstract | |
*/ | |
var NgModuleFactoryLoader = (function () { | |
function NgModuleFactoryLoader() { | |
} | |
/** | |
* @abstract | |
* @param {?} path | |
* @return {?} | |
*/ | |
NgModuleFactoryLoader.prototype.load = function (path) { }; | |
return NgModuleFactoryLoader; | |
}()); | |
var moduleFactories = new Map(); | |
/** | |
* Registers a loaded module. Should only be called from generated NgModuleFactory code. | |
* \@experimental | |
* @param {?} id | |
* @param {?} factory | |
* @return {?} | |
*/ | |
function registerModuleFactory(id, factory) { | |
var /** @type {?} */ existing = moduleFactories.get(id); | |
if (existing) { | |
throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name); | |
} | |
moduleFactories.set(id, factory); | |
} | |
/** | |
* @return {?} | |
*/ | |
/** | |
* Returns the NgModuleFactory with the given id, if it exists and has been loaded. | |
* Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module | |
* cannot be found. | |
* \@experimental | |
* @param {?} id | |
* @return {?} | |
*/ | |
function getModuleFactory(id) { | |
var /** @type {?} */ factory = moduleFactories.get(id); | |
if (!factory) | |
throw new Error("No module with ID " + id + " loaded"); | |
return factory; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* An unmodifiable list of items that Angular keeps up to date when the state | |
* of the application changes. | |
* | |
* The type of object that {\@link Query} and {\@link ViewQueryMetadata} provide. | |
* | |
* Implements an iterable interface, therefore it can be used in both ES6 | |
* javascript `for (var i of items)` loops as well as in Angular templates with | |
* `*ngFor="let i of myList"`. | |
* | |
* Changes can be observed by subscribing to the changes `Observable`. | |
* | |
* NOTE: In the future this class will implement an `Observable` interface. | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/RX8sJnQYl9FWuSCWme5z?p=preview)) | |
* ```typescript | |
* \@Component({...}) | |
* class Container { | |
* \@ViewChildren(Item) items:QueryList<Item>; | |
* } | |
* ``` | |
* \@stable | |
*/ | |
var QueryList = (function () { | |
function QueryList() { | |
this._dirty = true; | |
this._results = []; | |
this._emitter = new EventEmitter(); | |
} | |
Object.defineProperty(QueryList.prototype, "changes", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._emitter; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryList.prototype, "length", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._results.length; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryList.prototype, "first", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._results[0]; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(QueryList.prototype, "last", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._results[this.length - 1]; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* See | |
* [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map) | |
* @template U | |
* @param {?} fn | |
* @return {?} | |
*/ | |
QueryList.prototype.map = function (fn) { return this._results.map(fn); }; | |
/** | |
* See | |
* [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter) | |
* @param {?} fn | |
* @return {?} | |
*/ | |
QueryList.prototype.filter = function (fn) { | |
return this._results.filter(fn); | |
}; | |
/** | |
* See | |
* [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find) | |
* @param {?} fn | |
* @return {?} | |
*/ | |
QueryList.prototype.find = function (fn) { | |
return this._results.find(fn); | |
}; | |
/** | |
* See | |
* [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce) | |
* @template U | |
* @param {?} fn | |
* @param {?} init | |
* @return {?} | |
*/ | |
QueryList.prototype.reduce = function (fn, init) { | |
return this._results.reduce(fn, init); | |
}; | |
/** | |
* See | |
* [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach) | |
* @param {?} fn | |
* @return {?} | |
*/ | |
QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); }; | |
/** | |
* See | |
* [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some) | |
* @param {?} fn | |
* @return {?} | |
*/ | |
QueryList.prototype.some = function (fn) { | |
return this._results.some(fn); | |
}; | |
/** | |
* @return {?} | |
*/ | |
QueryList.prototype.toArray = function () { return this._results.slice(); }; | |
/** | |
* @return {?} | |
*/ | |
QueryList.prototype[getSymbolIterator()] = function () { return ((this._results))[getSymbolIterator()](); }; | |
/** | |
* @return {?} | |
*/ | |
QueryList.prototype.toString = function () { return this._results.toString(); }; | |
/** | |
* @param {?} res | |
* @return {?} | |
*/ | |
QueryList.prototype.reset = function (res) { | |
this._results = flatten(res); | |
this._dirty = false; | |
}; | |
/** | |
* @return {?} | |
*/ | |
QueryList.prototype.notifyOnChanges = function () { this._emitter.emit(this); }; | |
/** | |
* internal | |
* @return {?} | |
*/ | |
QueryList.prototype.setDirty = function () { this._dirty = true; }; | |
Object.defineProperty(QueryList.prototype, "dirty", { | |
/** | |
* internal | |
* @return {?} | |
*/ | |
get: function () { return this._dirty; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return QueryList; | |
}()); | |
/** | |
* @template T | |
* @param {?} list | |
* @return {?} | |
*/ | |
function flatten(list) { | |
return list.reduce(function (flat, item) { | |
var /** @type {?} */ flatItem = Array.isArray(item) ? flatten(item) : item; | |
return ((flat)).concat(flatItem); | |
}, []); | |
} | |
/** | |
* @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 _SEPARATOR = '#'; | |
var FACTORY_CLASS_SUFFIX = 'NgFactory'; | |
/** | |
* Configuration for SystemJsNgModuleLoader. | |
* token. | |
* | |
* \@experimental | |
* @abstract | |
*/ | |
var SystemJsNgModuleLoaderConfig = (function () { | |
function SystemJsNgModuleLoaderConfig() { | |
} | |
return SystemJsNgModuleLoaderConfig; | |
}()); | |
var DEFAULT_CONFIG = { | |
factoryPathPrefix: '', | |
factoryPathSuffix: '.ngfactory', | |
}; | |
/** | |
* NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory | |
* \@experimental | |
*/ | |
var SystemJsNgModuleLoader = (function () { | |
/** | |
* @param {?} _compiler | |
* @param {?=} config | |
*/ | |
function SystemJsNgModuleLoader(_compiler, config) { | |
this._compiler = _compiler; | |
this._config = config || DEFAULT_CONFIG; | |
} | |
/** | |
* @param {?} path | |
* @return {?} | |
*/ | |
SystemJsNgModuleLoader.prototype.load = function (path) { | |
var /** @type {?} */ offlineMode = this._compiler instanceof Compiler; | |
return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path); | |
}; | |
/** | |
* @param {?} path | |
* @return {?} | |
*/ | |
SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) { | |
var _this = this; | |
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1]; | |
if (exportName === undefined) { | |
exportName = 'default'; | |
} | |
return __webpack_require__(148)(module) | |
.then(function (module) { return module[exportName]; }) | |
.then(function (type) { return checkNotEmpty(type, module, exportName); }) | |
.then(function (type) { return _this._compiler.compileModuleAsync(type); }); | |
}; | |
/** | |
* @param {?} path | |
* @return {?} | |
*/ | |
SystemJsNgModuleLoader.prototype.loadFactory = function (path) { | |
var _a = path.split(_SEPARATOR), module = _a[0], exportName = _a[1]; | |
var /** @type {?} */ factoryClassSuffix = FACTORY_CLASS_SUFFIX; | |
if (exportName === undefined) { | |
exportName = 'default'; | |
factoryClassSuffix = ''; | |
} | |
return __webpack_require__(148)(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix) | |
.then(function (module) { return module[exportName + factoryClassSuffix]; }) | |
.then(function (factory) { return checkNotEmpty(factory, module, exportName); }); | |
}; | |
return SystemJsNgModuleLoader; | |
}()); | |
SystemJsNgModuleLoader.decorators = [ | |
{ type: Injectable }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
SystemJsNgModuleLoader.ctorParameters = function () { return [ | |
{ type: Compiler, }, | |
{ type: SystemJsNgModuleLoaderConfig, decorators: [{ type: Optional },] }, | |
]; }; | |
/** | |
* @param {?} value | |
* @param {?} modulePath | |
* @param {?} exportName | |
* @return {?} | |
*/ | |
function checkNotEmpty(value, modulePath, exportName) { | |
if (!value) { | |
throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'"); | |
} | |
return value; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Represents an Embedded Template that can be used to instantiate Embedded Views. | |
* | |
* You can access a `TemplateRef`, in two ways. Via a directive placed on a `<ng-template>` element | |
* (or directive prefixed with `*`) and have the `TemplateRef` for this Embedded View injected into | |
* the constructor of the directive using the `TemplateRef` Token. Alternatively you can query for | |
* the `TemplateRef` from a Component or a Directive via {\@link Query}. | |
* | |
* To instantiate Embedded Views based on a Template, use | |
* {\@link ViewContainerRef#createEmbeddedView}, which will create the View and attach it to the | |
* View Container. | |
* \@stable | |
* @abstract | |
*/ | |
var TemplateRef = (function () { | |
function TemplateRef() { | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
TemplateRef.prototype.elementRef = function () { }; | |
/** | |
* @abstract | |
* @param {?} context | |
* @return {?} | |
*/ | |
TemplateRef.prototype.createEmbeddedView = function (context) { }; | |
return TemplateRef; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Represents a container where one or more Views can be attached. | |
* | |
* The container can contain two kinds of Views. Host Views, created by instantiating a | |
* {\@link Component} via {\@link #createComponent}, and Embedded Views, created by instantiating an | |
* {\@link TemplateRef Embedded Template} via {\@link #createEmbeddedView}. | |
* | |
* The location of the View Container within the containing View is specified by the Anchor | |
* `element`. Each View Container can have only one Anchor Element and each Anchor Element can only | |
* have a single View Container. | |
* | |
* Root elements of Views attached to this container become siblings of the Anchor Element in | |
* the Rendered View. | |
* | |
* To access a `ViewContainerRef` of an Element, you can either place a {\@link Directive} injected | |
* with `ViewContainerRef` on the Element, or you obtain it via a {\@link ViewChild} query. | |
* \@stable | |
* @abstract | |
*/ | |
var ViewContainerRef = (function () { | |
function ViewContainerRef() { | |
} | |
/** | |
* Anchor element that specifies the location of this container in the containing View. | |
* <!-- TODO: rename to anchorElement --> | |
* @abstract | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.element = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.injector = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.parentInjector = function () { }; | |
/** | |
* Destroys all Views in this container. | |
* @abstract | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.clear = function () { }; | |
/** | |
* Returns the {\@link ViewRef} for the View located in this container at the specified index. | |
* @abstract | |
* @param {?} index | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.get = function (index) { }; | |
/** | |
* Returns the number of Views currently attached to this container. | |
* @abstract | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.length = function () { }; | |
/** | |
* Instantiates an Embedded View based on the {\@link TemplateRef `templateRef`} and inserts it | |
* into this container at the specified `index`. | |
* | |
* If `index` is not specified, the new View will be inserted as the last View in the container. | |
* | |
* Returns the {\@link ViewRef} for the newly created View. | |
* @abstract | |
* @template C | |
* @param {?} templateRef | |
* @param {?=} context | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) { }; | |
/** | |
* Instantiates a single {\@link Component} and inserts its Host View into this container at the | |
* specified `index`. | |
* | |
* The component is instantiated using its {\@link ComponentFactory} which can be | |
* obtained via {\@link ComponentFactoryResolver#resolveComponentFactory}. | |
* | |
* If `index` is not specified, the new View will be inserted as the last View in the container. | |
* | |
* You can optionally specify the {\@link Injector} that will be used as parent for the Component. | |
* | |
* Returns the {\@link ComponentRef} of the Host View created for the newly instantiated Component. | |
* @abstract | |
* @template C | |
* @param {?} componentFactory | |
* @param {?=} index | |
* @param {?=} injector | |
* @param {?=} projectableNodes | |
* @param {?=} ngModule | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModule) { }; | |
/** | |
* Inserts a View identified by a {\@link ViewRef} into the container at the specified `index`. | |
* | |
* If `index` is not specified, the new View will be inserted as the last View in the container. | |
* | |
* Returns the inserted {\@link ViewRef}. | |
* @abstract | |
* @param {?} viewRef | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.insert = function (viewRef, index) { }; | |
/** | |
* Moves a View identified by a {\@link ViewRef} into the container at the specified `index`. | |
* | |
* Returns the inserted {\@link ViewRef}. | |
* @abstract | |
* @param {?} viewRef | |
* @param {?} currentIndex | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.move = function (viewRef, currentIndex) { }; | |
/** | |
* Returns the index of the View, specified via {\@link ViewRef}, within the current container or | |
* `-1` if this container doesn't contain the View. | |
* @abstract | |
* @param {?} viewRef | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.indexOf = function (viewRef) { }; | |
/** | |
* Destroys a View attached to this container at the specified `index`. | |
* | |
* If `index` is not specified, the last View in the container will be removed. | |
* @abstract | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.remove = function (index) { }; | |
/** | |
* Use along with {\@link #insert} to move a View within the current container. | |
* | |
* If the `index` param is omitted, the last {\@link ViewRef} is detached. | |
* @abstract | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef.prototype.detach = function (index) { }; | |
return ViewContainerRef; | |
}()); | |
/** | |
* \@stable | |
* @abstract | |
*/ | |
var ChangeDetectorRef = (function () { | |
function ChangeDetectorRef() { | |
} | |
/** | |
* Marks all {\@link ChangeDetectionStrategy#OnPush} ancestors as to be checked. | |
* | |
* <!-- TODO: Add a link to a chapter on OnPush components --> | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/GC512b?p=preview)) | |
* | |
* ```typescript | |
* \@Component({ | |
* selector: 'cmp', | |
* changeDetection: ChangeDetectionStrategy.OnPush, | |
* template: `Number of ticks: {{numberOfTicks}}` | |
* }) | |
* class Cmp { | |
* numberOfTicks = 0; | |
* | |
* constructor(ref: ChangeDetectorRef) { | |
* setInterval(() => { | |
* this.numberOfTicks ++ | |
* // the following is required, otherwise the view will not be updated | |
* this.ref.markForCheck(); | |
* }, 1000); | |
* } | |
* } | |
* | |
* \@Component({ | |
* selector: 'app', | |
* changeDetection: ChangeDetectionStrategy.OnPush, | |
* template: ` | |
* <cmp><cmp> | |
* `, | |
* }) | |
* class App { | |
* } | |
* ``` | |
* @abstract | |
* @return {?} | |
*/ | |
ChangeDetectorRef.prototype.markForCheck = function () { }; | |
/** | |
* Detaches the change detector from the change detector tree. | |
* | |
* The detached change detector will not be checked until it is reattached. | |
* | |
* This can also be used in combination with {\@link ChangeDetectorRef#detectChanges} to implement | |
* local change | |
* detection checks. | |
* | |
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> | |
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master --> | |
* | |
* ### Example | |
* | |
* The following example defines a component with a large list of readonly data. | |
* Imagine the data changes constantly, many times per second. For performance reasons, | |
* we want to check and update the list every five seconds. We can do that by detaching | |
* the component's change detector and doing a local check every five seconds. | |
* | |
* ```typescript | |
* class DataProvider { | |
* // in a real application the returned data will be different every time | |
* get data() { | |
* return [1,2,3,4,5]; | |
* } | |
* } | |
* | |
* \@Component({ | |
* selector: 'giant-list', | |
* template: ` | |
* <li *ngFor="let d of dataProvider.data">Data {{d}}</lig> | |
* `, | |
* }) | |
* class GiantList { | |
* constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) { | |
* ref.detach(); | |
* setInterval(() => { | |
* this.ref.detectChanges(); | |
* }, 5000); | |
* } | |
* } | |
* | |
* \@Component({ | |
* selector: 'app', | |
* providers: [DataProvider], | |
* template: ` | |
* <giant-list><giant-list> | |
* `, | |
* }) | |
* class App { | |
* } | |
* ``` | |
* @abstract | |
* @return {?} | |
*/ | |
ChangeDetectorRef.prototype.detach = function () { }; | |
/** | |
* Checks the change detector and its children. | |
* | |
* This can also be used in combination with {\@link ChangeDetectorRef#detach} to implement local | |
* change detection | |
* checks. | |
* | |
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> | |
* <!-- TODO: Add a live demo once ref.detectChanges is merged into master --> | |
* | |
* ### Example | |
* | |
* The following example defines a component with a large list of readonly data. | |
* Imagine, the data changes constantly, many times per second. For performance reasons, | |
* we want to check and update the list every five seconds. | |
* | |
* We can do that by detaching the component's change detector and doing a local change detection | |
* check | |
* every five seconds. | |
* | |
* See {\@link ChangeDetectorRef#detach} for more information. | |
* @abstract | |
* @return {?} | |
*/ | |
ChangeDetectorRef.prototype.detectChanges = function () { }; | |
/** | |
* Checks the change detector and its children, and throws if any changes are detected. | |
* | |
* This is used in development mode to verify that running change detection doesn't introduce | |
* other changes. | |
* @abstract | |
* @return {?} | |
*/ | |
ChangeDetectorRef.prototype.checkNoChanges = function () { }; | |
/** | |
* Reattach the change detector to the change detector tree. | |
* | |
* This also marks OnPush ancestors as to be checked. This reattached change detector will be | |
* checked during the next change detection run. | |
* | |
* <!-- TODO: Add a link to a chapter on detach/reattach/local digest --> | |
* | |
* ### Example ([live demo](http://plnkr.co/edit/aUhZha?p=preview)) | |
* | |
* The following example creates a component displaying `live` data. The component will detach | |
* its change detector from the main change detector tree when the component's live property | |
* is set to false. | |
* | |
* ```typescript | |
* class DataProvider { | |
* data = 1; | |
* | |
* constructor() { | |
* setInterval(() => { | |
* this.data = this.data * 2; | |
* }, 500); | |
* } | |
* } | |
* | |
* \@Component({ | |
* selector: 'live-data', | |
* inputs: ['live'], | |
* template: 'Data: {{dataProvider.data}}' | |
* }) | |
* class LiveData { | |
* constructor(private ref: ChangeDetectorRef, private dataProvider:DataProvider) {} | |
* | |
* set live(value) { | |
* if (value) | |
* this.ref.reattach(); | |
* else | |
* this.ref.detach(); | |
* } | |
* } | |
* | |
* \@Component({ | |
* selector: 'app', | |
* providers: [DataProvider], | |
* template: ` | |
* Live Update: <input type="checkbox" [(ngModel)]="live"> | |
* <live-data [live]="live"><live-data> | |
* `, | |
* }) | |
* class App { | |
* live = true; | |
* } | |
* ``` | |
* @abstract | |
* @return {?} | |
*/ | |
ChangeDetectorRef.prototype.reattach = function () { }; | |
return ChangeDetectorRef; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* \@stable | |
* @abstract | |
*/ | |
var ViewRef = (function (_super) { | |
__extends(ViewRef, _super); | |
function ViewRef() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* Destroys the view and all of the data structures associated with it. | |
* @abstract | |
* @return {?} | |
*/ | |
ViewRef.prototype.destroy = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
ViewRef.prototype.destroyed = function () { }; | |
/** | |
* @abstract | |
* @param {?} callback | |
* @return {?} | |
*/ | |
ViewRef.prototype.onDestroy = function (callback) { }; | |
return ViewRef; | |
}(ChangeDetectorRef)); | |
/** | |
* Represents an Angular View. | |
* | |
* <!-- TODO: move the next two paragraphs to the dev guide --> | |
* A View is a fundamental building block of the application UI. It is the smallest grouping of | |
* Elements which are created and destroyed together. | |
* | |
* Properties of elements in a View can change, but the structure (number and order) of elements in | |
* a View cannot. Changing the structure of Elements can only be done by inserting, moving or | |
* removing nested Views via a {\@link ViewContainerRef}. Each View can contain many View Containers. | |
* <!-- /TODO --> | |
* | |
* ### Example | |
* | |
* Given this template... | |
* | |
* ``` | |
* Count: {{items.length}} | |
* <ul> | |
* <li *ngFor="let item of items">{{item}}</li> | |
* </ul> | |
* ``` | |
* | |
* We have two {\@link TemplateRef}s: | |
* | |
* Outer {\@link TemplateRef}: | |
* ``` | |
* Count: {{items.length}} | |
* <ul> | |
* <ng-template ngFor let-item [ngForOf]="items"></ng-template> | |
* </ul> | |
* ``` | |
* | |
* Inner {\@link TemplateRef}: | |
* ``` | |
* <li>{{item}}</li> | |
* ``` | |
* | |
* Notice that the original template is broken down into two separate {\@link TemplateRef}s. | |
* | |
* The outer/inner {\@link TemplateRef}s are then assembled into views like so: | |
* | |
* ``` | |
* <!-- ViewRef: outer-0 --> | |
* Count: 2 | |
* <ul> | |
* <ng-template view-container-ref></ng-template> | |
* <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 --> | |
* <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 --> | |
* </ul> | |
* <!-- /ViewRef: outer-0 --> | |
* ``` | |
* \@experimental | |
* @abstract | |
*/ | |
var EmbeddedViewRef = (function (_super) { | |
__extends(EmbeddedViewRef, _super); | |
function EmbeddedViewRef() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
EmbeddedViewRef.prototype.context = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
EmbeddedViewRef.prototype.rootNodes = function () { }; | |
return EmbeddedViewRef; | |
}(ViewRef)); | |
/** | |
* @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 | |
*/ | |
// Public API for compiler | |
/** | |
* @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 EventListener = (function () { | |
/** | |
* @param {?} name | |
* @param {?} callback | |
*/ | |
function EventListener(name, callback) { | |
this.name = name; | |
this.callback = callback; | |
} | |
; | |
return EventListener; | |
}()); | |
/** | |
* \@experimental All debugging apis are currently experimental. | |
*/ | |
var DebugNode = (function () { | |
/** | |
* @param {?} nativeNode | |
* @param {?} parent | |
* @param {?} _debugContext | |
*/ | |
function DebugNode(nativeNode, parent, _debugContext) { | |
this._debugContext = _debugContext; | |
this.nativeNode = nativeNode; | |
if (parent && parent instanceof DebugElement) { | |
parent.addChild(this); | |
} | |
else { | |
this.parent = null; | |
} | |
this.listeners = []; | |
} | |
Object.defineProperty(DebugNode.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._debugContext.injector; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugNode.prototype, "componentInstance", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._debugContext.component; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugNode.prototype, "context", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._debugContext.context; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugNode.prototype, "references", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._debugContext.references; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugNode.prototype, "providerTokens", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._debugContext.providerTokens; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugNode.prototype, "source", { | |
/** | |
* @deprecated since v4 | |
* @return {?} | |
*/ | |
get: function () { return 'Deprecated since v4'; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return DebugNode; | |
}()); | |
/** | |
* \@experimental All debugging apis are currently experimental. | |
*/ | |
var DebugElement = (function (_super) { | |
__extends(DebugElement, _super); | |
/** | |
* @param {?} nativeNode | |
* @param {?} parent | |
* @param {?} _debugContext | |
*/ | |
function DebugElement(nativeNode, parent, _debugContext) { | |
var _this = _super.call(this, nativeNode, parent, _debugContext) || this; | |
_this.properties = {}; | |
_this.attributes = {}; | |
_this.classes = {}; | |
_this.styles = {}; | |
_this.childNodes = []; | |
_this.nativeElement = nativeNode; | |
return _this; | |
} | |
/** | |
* @param {?} child | |
* @return {?} | |
*/ | |
DebugElement.prototype.addChild = function (child) { | |
if (child) { | |
this.childNodes.push(child); | |
child.parent = this; | |
} | |
}; | |
/** | |
* @param {?} child | |
* @return {?} | |
*/ | |
DebugElement.prototype.removeChild = function (child) { | |
var /** @type {?} */ childIndex = this.childNodes.indexOf(child); | |
if (childIndex !== -1) { | |
child.parent = null; | |
this.childNodes.splice(childIndex, 1); | |
} | |
}; | |
/** | |
* @param {?} child | |
* @param {?} newChildren | |
* @return {?} | |
*/ | |
DebugElement.prototype.insertChildrenAfter = function (child, newChildren) { | |
var _this = this; | |
var /** @type {?} */ siblingIndex = this.childNodes.indexOf(child); | |
if (siblingIndex !== -1) { | |
(_a = this.childNodes).splice.apply(_a, [siblingIndex + 1, 0].concat(newChildren)); | |
newChildren.forEach(function (c) { | |
if (c.parent) { | |
c.parent.removeChild(c); | |
} | |
c.parent = _this; | |
}); | |
} | |
var _a; | |
}; | |
/** | |
* @param {?} refChild | |
* @param {?} newChild | |
* @return {?} | |
*/ | |
DebugElement.prototype.insertBefore = function (refChild, newChild) { | |
var /** @type {?} */ refIndex = this.childNodes.indexOf(refChild); | |
if (refIndex === -1) { | |
this.addChild(newChild); | |
} | |
else { | |
if (newChild.parent) { | |
newChild.parent.removeChild(newChild); | |
} | |
newChild.parent = this; | |
this.childNodes.splice(refIndex, 0, newChild); | |
} | |
}; | |
/** | |
* @param {?} predicate | |
* @return {?} | |
*/ | |
DebugElement.prototype.query = function (predicate) { | |
var /** @type {?} */ results = this.queryAll(predicate); | |
return results[0] || null; | |
}; | |
/** | |
* @param {?} predicate | |
* @return {?} | |
*/ | |
DebugElement.prototype.queryAll = function (predicate) { | |
var /** @type {?} */ matches = []; | |
_queryElementChildren(this, predicate, matches); | |
return matches; | |
}; | |
/** | |
* @param {?} predicate | |
* @return {?} | |
*/ | |
DebugElement.prototype.queryAllNodes = function (predicate) { | |
var /** @type {?} */ matches = []; | |
_queryNodeChildren(this, predicate, matches); | |
return matches; | |
}; | |
Object.defineProperty(DebugElement.prototype, "children", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return (this.childNodes.filter(function (node) { return node instanceof DebugElement; })); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} eventName | |
* @param {?} eventObj | |
* @return {?} | |
*/ | |
DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) { | |
this.listeners.forEach(function (listener) { | |
if (listener.name == eventName) { | |
listener.callback(eventObj); | |
} | |
}); | |
}; | |
return DebugElement; | |
}(DebugNode)); | |
/** | |
* \@experimental | |
* @param {?} debugEls | |
* @return {?} | |
*/ | |
function asNativeElements(debugEls) { | |
return debugEls.map(function (el) { return el.nativeElement; }); | |
} | |
/** | |
* @param {?} element | |
* @param {?} predicate | |
* @param {?} matches | |
* @return {?} | |
*/ | |
function _queryElementChildren(element, predicate, matches) { | |
element.childNodes.forEach(function (node) { | |
if (node instanceof DebugElement) { | |
if (predicate(node)) { | |
matches.push(node); | |
} | |
_queryElementChildren(node, predicate, matches); | |
} | |
}); | |
} | |
/** | |
* @param {?} parentNode | |
* @param {?} predicate | |
* @param {?} matches | |
* @return {?} | |
*/ | |
function _queryNodeChildren(parentNode, predicate, matches) { | |
if (parentNode instanceof DebugElement) { | |
parentNode.childNodes.forEach(function (node) { | |
if (predicate(node)) { | |
matches.push(node); | |
} | |
if (node instanceof DebugElement) { | |
_queryNodeChildren(node, predicate, matches); | |
} | |
}); | |
} | |
} | |
// Need to keep the nodes in a global Map so that multiple angular apps are supported. | |
var _nativeNodeToDebugNode = new Map(); | |
/** | |
* \@experimental | |
* @param {?} nativeNode | |
* @return {?} | |
*/ | |
function getDebugNode(nativeNode) { | |
return _nativeNodeToDebugNode.get(nativeNode) || null; | |
} | |
/** | |
* @return {?} | |
*/ | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
function indexDebugNode(node) { | |
_nativeNodeToDebugNode.set(node.nativeNode, node); | |
} | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
function removeDebugNodeFromIndex(node) { | |
_nativeNodeToDebugNode.delete(node.nativeNode); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} a | |
* @param {?} b | |
* @return {?} | |
*/ | |
function devModeEqual(a, b) { | |
var /** @type {?} */ isListLikeIterableA = isListLikeIterable(a); | |
var /** @type {?} */ isListLikeIterableB = isListLikeIterable(b); | |
if (isListLikeIterableA && isListLikeIterableB) { | |
return areIterablesEqual(a, b, devModeEqual); | |
} | |
else { | |
var /** @type {?} */ isAObject = a && (typeof a === 'object' || typeof a === 'function'); | |
var /** @type {?} */ isBObject = b && (typeof b === 'object' || typeof b === 'function'); | |
if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) { | |
return true; | |
} | |
else { | |
return looseIdentical(a, b); | |
} | |
} | |
} | |
/** | |
* Indicates that the result of a {\@link Pipe} transformation has changed even though the | |
* reference | |
* has not changed. | |
* | |
* The wrapped value will be unwrapped by change detection, and the unwrapped value will be stored. | |
* | |
* Example: | |
* | |
* ``` | |
* if (this._latestValue === this._latestReturnedValue) { | |
* return this._latestReturnedValue; | |
* } else { | |
* this._latestReturnedValue = this._latestValue; | |
* return WrappedValue.wrap(this._latestValue); // this will force update | |
* } | |
* ``` | |
* \@stable | |
*/ | |
var WrappedValue = (function () { | |
/** | |
* @param {?} wrapped | |
*/ | |
function WrappedValue(wrapped) { | |
this.wrapped = wrapped; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
WrappedValue.wrap = function (value) { return new WrappedValue(value); }; | |
return WrappedValue; | |
}()); | |
/** | |
* Helper class for unwrapping WrappedValue s | |
*/ | |
var ValueUnwrapper = (function () { | |
function ValueUnwrapper() { | |
this.hasWrappedValue = false; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
ValueUnwrapper.prototype.unwrap = function (value) { | |
if (value instanceof WrappedValue) { | |
this.hasWrappedValue = true; | |
return value.wrapped; | |
} | |
return value; | |
}; | |
/** | |
* @return {?} | |
*/ | |
ValueUnwrapper.prototype.reset = function () { this.hasWrappedValue = false; }; | |
return ValueUnwrapper; | |
}()); | |
/** | |
* Represents a basic change from a previous to a new value. | |
* \@stable | |
*/ | |
var SimpleChange = (function () { | |
/** | |
* @param {?} previousValue | |
* @param {?} currentValue | |
* @param {?} firstChange | |
*/ | |
function SimpleChange(previousValue, currentValue, firstChange) { | |
this.previousValue = previousValue; | |
this.currentValue = currentValue; | |
this.firstChange = firstChange; | |
} | |
/** | |
* Check whether the new value is the first value assigned. | |
* @return {?} | |
*/ | |
SimpleChange.prototype.isFirstChange = function () { return this.firstChange; }; | |
return SimpleChange; | |
}()); | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
function isListLikeIterable(obj) { | |
if (!isJsObject(obj)) | |
return false; | |
return Array.isArray(obj) || | |
(!(obj instanceof Map) && | |
getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop | |
} | |
/** | |
* @param {?} a | |
* @param {?} b | |
* @param {?} comparator | |
* @return {?} | |
*/ | |
function areIterablesEqual(a, b, comparator) { | |
var /** @type {?} */ iterator1 = a[getSymbolIterator()](); | |
var /** @type {?} */ iterator2 = b[getSymbolIterator()](); | |
while (true) { | |
var /** @type {?} */ item1 = iterator1.next(); | |
var /** @type {?} */ item2 = iterator2.next(); | |
if (item1.done && item2.done) | |
return true; | |
if (item1.done || item2.done) | |
return false; | |
if (!comparator(item1.value, item2.value)) | |
return false; | |
} | |
} | |
/** | |
* @param {?} obj | |
* @param {?} fn | |
* @return {?} | |
*/ | |
function iterateListLike(obj, fn) { | |
if (Array.isArray(obj)) { | |
for (var /** @type {?} */ i = 0; i < obj.length; i++) { | |
fn(obj[i]); | |
} | |
} | |
else { | |
var /** @type {?} */ iterator = obj[getSymbolIterator()](); | |
var /** @type {?} */ item = void 0; | |
while (!((item = iterator.next()).done)) { | |
fn(item.value); | |
} | |
} | |
} | |
/** | |
* @param {?} o | |
* @return {?} | |
*/ | |
function isJsObject(o) { | |
return o !== null && (typeof o === 'function' || typeof o === 'object'); | |
} | |
/** | |
* @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 DefaultIterableDifferFactory = (function () { | |
function DefaultIterableDifferFactory() { | |
} | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); }; | |
/** | |
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter | |
* @template V | |
* @param {?=} cdRefOrTrackBy | |
* @param {?=} trackByFn | |
* @return {?} | |
*/ | |
DefaultIterableDifferFactory.prototype.create = function (cdRefOrTrackBy, trackByFn) { | |
return new DefaultIterableDiffer(trackByFn || (cdRefOrTrackBy)); | |
}; | |
return DefaultIterableDifferFactory; | |
}()); | |
var trackByIdentity = function (index, item) { return item; }; | |
/** | |
* @deprecated v4.0.0 - Should not be part of public API. | |
*/ | |
var DefaultIterableDiffer = (function () { | |
/** | |
* @param {?=} trackByFn | |
*/ | |
function DefaultIterableDiffer(trackByFn) { | |
this._length = 0; | |
this._collection = null; | |
this._linkedRecords = null; | |
this._unlinkedRecords = null; | |
this._previousItHead = null; | |
this._itHead = null; | |
this._itTail = null; | |
this._additionsHead = null; | |
this._additionsTail = null; | |
this._movesHead = null; | |
this._movesTail = null; | |
this._removalsHead = null; | |
this._removalsTail = null; | |
this._identityChangesHead = null; | |
this._identityChangesTail = null; | |
this._trackByFn = trackByFn || trackByIdentity; | |
} | |
Object.defineProperty(DefaultIterableDiffer.prototype, "collection", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._collection; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DefaultIterableDiffer.prototype, "length", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._length; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._itHead; record !== null; record = record._next) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachOperation = function (fn) { | |
var /** @type {?} */ nextIt = this._itHead; | |
var /** @type {?} */ nextRemove = this._removalsHead; | |
var /** @type {?} */ addRemoveOffset = 0; | |
var /** @type {?} */ moveOffsets = null; | |
while (nextIt || nextRemove) { | |
// Figure out which is the next record to process | |
// Order: remove, add, move | |
var /** @type {?} */ record = !nextRemove || | |
nextIt && ((nextIt.currentIndex)) < | |
getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ? ((nextIt)) : | |
nextRemove; | |
var /** @type {?} */ adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets); | |
var /** @type {?} */ currentIndex = record.currentIndex; | |
// consume the item, and adjust the addRemoveOffset and update moveDistance if necessary | |
if (record === nextRemove) { | |
addRemoveOffset--; | |
nextRemove = nextRemove._nextRemoved; | |
} | |
else { | |
nextIt = ((nextIt))._next; | |
if (record.previousIndex == null) { | |
addRemoveOffset++; | |
} | |
else { | |
// INVARIANT: currentIndex < previousIndex | |
if (!moveOffsets) | |
moveOffsets = []; | |
var /** @type {?} */ localMovePreviousIndex = adjPreviousIndex - addRemoveOffset; | |
var /** @type {?} */ localCurrentIndex = ((currentIndex)) - addRemoveOffset; | |
if (localMovePreviousIndex != localCurrentIndex) { | |
for (var /** @type {?} */ i = 0; i < localMovePreviousIndex; i++) { | |
var /** @type {?} */ offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0); | |
var /** @type {?} */ index = offset + i; | |
if (localCurrentIndex <= index && index < localMovePreviousIndex) { | |
moveOffsets[i] = offset + 1; | |
} | |
} | |
var /** @type {?} */ previousIndex = record.previousIndex; | |
moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex; | |
} | |
} | |
} | |
if (adjPreviousIndex !== currentIndex) { | |
fn(record, adjPreviousIndex, currentIndex); | |
} | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._previousItHead; record !== null; record = record._nextPrevious) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._movesHead; record !== null; record = record._nextMoved) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} collection | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.diff = function (collection) { | |
if (collection == null) | |
collection = []; | |
if (!isListLikeIterable(collection)) { | |
throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed"); | |
} | |
if (this.check(collection)) { | |
return this; | |
} | |
else { | |
return null; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.onDestroy = function () { }; | |
/** | |
* @param {?} collection | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.check = function (collection) { | |
var _this = this; | |
this._reset(); | |
var /** @type {?} */ record = this._itHead; | |
var /** @type {?} */ mayBeDirty = false; | |
var /** @type {?} */ index; | |
var /** @type {?} */ item; | |
var /** @type {?} */ itemTrackBy; | |
if (Array.isArray(collection)) { | |
this._length = collection.length; | |
for (var /** @type {?} */ index_1 = 0; index_1 < this._length; index_1++) { | |
item = collection[index_1]; | |
itemTrackBy = this._trackByFn(index_1, item); | |
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { | |
record = this._mismatch(record, item, itemTrackBy, index_1); | |
mayBeDirty = true; | |
} | |
else { | |
if (mayBeDirty) { | |
// TODO(misko): can we limit this to duplicates only? | |
record = this._verifyReinsertion(record, item, itemTrackBy, index_1); | |
} | |
if (!looseIdentical(record.item, item)) | |
this._addIdentityChange(record, item); | |
} | |
record = record._next; | |
} | |
} | |
else { | |
index = 0; | |
iterateListLike(collection, function (item) { | |
itemTrackBy = _this._trackByFn(index, item); | |
if (record === null || !looseIdentical(record.trackById, itemTrackBy)) { | |
record = _this._mismatch(record, item, itemTrackBy, index); | |
mayBeDirty = true; | |
} | |
else { | |
if (mayBeDirty) { | |
// TODO(misko): can we limit this to duplicates only? | |
record = _this._verifyReinsertion(record, item, itemTrackBy, index); | |
} | |
if (!looseIdentical(record.item, item)) | |
_this._addIdentityChange(record, item); | |
} | |
record = record._next; | |
index++; | |
}); | |
this._length = index; | |
} | |
this._truncate(record); | |
this._collection = collection; | |
return this.isDirty; | |
}; | |
Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return this._additionsHead !== null || this._movesHead !== null || | |
this._removalsHead !== null || this._identityChangesHead !== null; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* Reset the state of the change objects to show no changes. This means set previousKey to | |
* currentKey, and clear all of the queues (additions, moves, removals). | |
* Set the previousIndexes of moved and added items to their currentIndexes | |
* Reset the list of additions, moves and removals | |
* | |
* \@internal | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._reset = function () { | |
if (this.isDirty) { | |
var /** @type {?} */ record = void 0; | |
var /** @type {?} */ nextRecord = void 0; | |
for (record = this._previousItHead = this._itHead; record !== null; record = record._next) { | |
record._nextPrevious = record._next; | |
} | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
record.previousIndex = record.currentIndex; | |
} | |
this._additionsHead = this._additionsTail = null; | |
for (record = this._movesHead; record !== null; record = nextRecord) { | |
record.previousIndex = record.currentIndex; | |
nextRecord = record._nextMoved; | |
} | |
this._movesHead = this._movesTail = null; | |
this._removalsHead = this._removalsTail = null; | |
this._identityChangesHead = this._identityChangesTail = null; | |
} | |
}; | |
/** | |
* This is the core function which handles differences between collections. | |
* | |
* - `record` is the record which we saw at this position last time. If null then it is a new | |
* item. | |
* - `item` is the current item in the collection | |
* - `index` is the position of the item in the collection | |
* | |
* \@internal | |
* @param {?} record | |
* @param {?} item | |
* @param {?} itemTrackBy | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) { | |
// The previous record after which we will append the current one. | |
var /** @type {?} */ previousRecord; | |
if (record === null) { | |
previousRecord = ((this._itTail)); | |
} | |
else { | |
previousRecord = ((record._prev)); | |
// Remove the record from the collection since we know it does not match the item. | |
this._remove(record); | |
} | |
// Attempt to see if we have seen the item before. | |
record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index); | |
if (record !== null) { | |
// We have seen this before, we need to move it forward in the collection. | |
// But first we need to check if identity changed, so we can update in view if necessary | |
if (!looseIdentical(record.item, item)) | |
this._addIdentityChange(record, item); | |
this._moveAfter(record, previousRecord, index); | |
} | |
else { | |
// Never seen it, check evicted list. | |
record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); | |
if (record !== null) { | |
// It is an item which we have evicted earlier: reinsert it back into the list. | |
// But first we need to check if identity changed, so we can update in view if necessary | |
if (!looseIdentical(record.item, item)) | |
this._addIdentityChange(record, item); | |
this._reinsertAfter(record, previousRecord, index); | |
} | |
else { | |
// It is a new item: add it. | |
record = | |
this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index); | |
} | |
} | |
return record; | |
}; | |
/** | |
* This check is only needed if an array contains duplicates. (Short circuit of nothing dirty) | |
* | |
* Use case: `[a, a]` => `[b, a, a]` | |
* | |
* If we did not have this check then the insertion of `b` would: | |
* 1) evict first `a` | |
* 2) insert `b` at `0` index. | |
* 3) leave `a` at index `1` as is. <-- this is wrong! | |
* 3) reinsert `a` at index 2. <-- this is wrong! | |
* | |
* The correct behavior is: | |
* 1) evict first `a` | |
* 2) insert `b` at `0` index. | |
* 3) reinsert `a` at index 1. | |
* 3) move `a` at from `1` to `2`. | |
* | |
* | |
* Double check that we have not evicted a duplicate item. We need to check if the item type may | |
* have already been removed: | |
* The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted | |
* at the end. Which will show up as the two 'a's switching position. This is incorrect, since a | |
* better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a' | |
* at the end. | |
* | |
* \@internal | |
* @param {?} record | |
* @param {?} item | |
* @param {?} itemTrackBy | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) { | |
var /** @type {?} */ reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null); | |
if (reinsertRecord !== null) { | |
record = this._reinsertAfter(reinsertRecord, /** @type {?} */ ((record._prev)), index); | |
} | |
else if (record.currentIndex != index) { | |
record.currentIndex = index; | |
this._addToMoves(record, index); | |
} | |
return record; | |
}; | |
/** | |
* Get rid of any excess {\@link IterableChangeRecord_}s from the previous collection | |
* | |
* - `record` The first excess {\@link IterableChangeRecord_}. | |
* | |
* \@internal | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._truncate = function (record) { | |
// Anything after that needs to be removed; | |
while (record !== null) { | |
var /** @type {?} */ nextRecord = record._next; | |
this._addToRemovals(this._unlink(record)); | |
record = nextRecord; | |
} | |
if (this._unlinkedRecords !== null) { | |
this._unlinkedRecords.clear(); | |
} | |
if (this._additionsTail !== null) { | |
this._additionsTail._nextAdded = null; | |
} | |
if (this._movesTail !== null) { | |
this._movesTail._nextMoved = null; | |
} | |
if (this._itTail !== null) { | |
this._itTail._next = null; | |
} | |
if (this._removalsTail !== null) { | |
this._removalsTail._nextRemoved = null; | |
} | |
if (this._identityChangesTail !== null) { | |
this._identityChangesTail._nextIdentityChange = null; | |
} | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} prevRecord | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) { | |
if (this._unlinkedRecords !== null) { | |
this._unlinkedRecords.remove(record); | |
} | |
var /** @type {?} */ prev = record._prevRemoved; | |
var /** @type {?} */ next = record._nextRemoved; | |
if (prev === null) { | |
this._removalsHead = next; | |
} | |
else { | |
prev._nextRemoved = next; | |
} | |
if (next === null) { | |
this._removalsTail = prev; | |
} | |
else { | |
next._prevRemoved = prev; | |
} | |
this._insertAfter(record, prevRecord, index); | |
this._addToMoves(record, index); | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} prevRecord | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) { | |
this._unlink(record); | |
this._insertAfter(record, prevRecord, index); | |
this._addToMoves(record, index); | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} prevRecord | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) { | |
this._insertAfter(record, prevRecord, index); | |
if (this._additionsTail === null) { | |
// todo(vicb) | |
// assert(this._additionsHead === null); | |
this._additionsTail = this._additionsHead = record; | |
} | |
else { | |
// todo(vicb) | |
// assert(_additionsTail._nextAdded === null); | |
// assert(record._nextAdded === null); | |
this._additionsTail = this._additionsTail._nextAdded = record; | |
} | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} prevRecord | |
* @param {?} index | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) { | |
// todo(vicb) | |
// assert(record != prevRecord); | |
// assert(record._next === null); | |
// assert(record._prev === null); | |
var /** @type {?} */ next = prevRecord === null ? this._itHead : prevRecord._next; | |
// todo(vicb) | |
// assert(next != record); | |
// assert(prevRecord != record); | |
record._next = next; | |
record._prev = prevRecord; | |
if (next === null) { | |
this._itTail = record; | |
} | |
else { | |
next._prev = record; | |
} | |
if (prevRecord === null) { | |
this._itHead = record; | |
} | |
else { | |
prevRecord._next = record; | |
} | |
if (this._linkedRecords === null) { | |
this._linkedRecords = new _DuplicateMap(); | |
} | |
this._linkedRecords.put(record); | |
record.currentIndex = index; | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._remove = function (record) { | |
return this._addToRemovals(this._unlink(record)); | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._unlink = function (record) { | |
if (this._linkedRecords !== null) { | |
this._linkedRecords.remove(record); | |
} | |
var /** @type {?} */ prev = record._prev; | |
var /** @type {?} */ next = record._next; | |
// todo(vicb) | |
// assert((record._prev = null) === null); | |
// assert((record._next = null) === null); | |
if (prev === null) { | |
this._itHead = next; | |
} | |
else { | |
prev._next = next; | |
} | |
if (next === null) { | |
this._itTail = prev; | |
} | |
else { | |
next._prev = prev; | |
} | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} toIndex | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) { | |
// todo(vicb) | |
// assert(record._nextMoved === null); | |
if (record.previousIndex === toIndex) { | |
return record; | |
} | |
if (this._movesTail === null) { | |
// todo(vicb) | |
// assert(_movesHead === null); | |
this._movesTail = this._movesHead = record; | |
} | |
else { | |
// todo(vicb) | |
// assert(_movesTail._nextMoved === null); | |
this._movesTail = this._movesTail._nextMoved = record; | |
} | |
return record; | |
}; | |
/** | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._addToRemovals = function (record) { | |
if (this._unlinkedRecords === null) { | |
this._unlinkedRecords = new _DuplicateMap(); | |
} | |
this._unlinkedRecords.put(record); | |
record.currentIndex = null; | |
record._nextRemoved = null; | |
if (this._removalsTail === null) { | |
// todo(vicb) | |
// assert(_removalsHead === null); | |
this._removalsTail = this._removalsHead = record; | |
record._prevRemoved = null; | |
} | |
else { | |
// todo(vicb) | |
// assert(_removalsTail._nextRemoved === null); | |
// assert(record._nextRemoved === null); | |
record._prevRemoved = this._removalsTail; | |
this._removalsTail = this._removalsTail._nextRemoved = record; | |
} | |
return record; | |
}; | |
/** | |
* \@internal | |
* @param {?} record | |
* @param {?} item | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) { | |
record.item = item; | |
if (this._identityChangesTail === null) { | |
this._identityChangesTail = this._identityChangesHead = record; | |
} | |
else { | |
this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record; | |
} | |
return record; | |
}; | |
/** | |
* @return {?} | |
*/ | |
DefaultIterableDiffer.prototype.toString = function () { | |
var /** @type {?} */ list = []; | |
this.forEachItem(function (record) { return list.push(record); }); | |
var /** @type {?} */ previous = []; | |
this.forEachPreviousItem(function (record) { return previous.push(record); }); | |
var /** @type {?} */ additions = []; | |
this.forEachAddedItem(function (record) { return additions.push(record); }); | |
var /** @type {?} */ moves = []; | |
this.forEachMovedItem(function (record) { return moves.push(record); }); | |
var /** @type {?} */ removals = []; | |
this.forEachRemovedItem(function (record) { return removals.push(record); }); | |
var /** @type {?} */ identityChanges = []; | |
this.forEachIdentityChange(function (record) { return identityChanges.push(record); }); | |
return 'collection: ' + list.join(', ') + '\n' + | |
'previous: ' + previous.join(', ') + '\n' + | |
'additions: ' + additions.join(', ') + '\n' + | |
'moves: ' + moves.join(', ') + '\n' + | |
'removals: ' + removals.join(', ') + '\n' + | |
'identityChanges: ' + identityChanges.join(', ') + '\n'; | |
}; | |
return DefaultIterableDiffer; | |
}()); | |
/** | |
* \@stable | |
*/ | |
var IterableChangeRecord_ = (function () { | |
/** | |
* @param {?} item | |
* @param {?} trackById | |
*/ | |
function IterableChangeRecord_(item, trackById) { | |
this.item = item; | |
this.trackById = trackById; | |
this.currentIndex = null; | |
this.previousIndex = null; | |
/** | |
* \@internal | |
*/ | |
this._nextPrevious = null; | |
/** | |
* \@internal | |
*/ | |
this._prev = null; | |
/** | |
* \@internal | |
*/ | |
this._next = null; | |
/** | |
* \@internal | |
*/ | |
this._prevDup = null; | |
/** | |
* \@internal | |
*/ | |
this._nextDup = null; | |
/** | |
* \@internal | |
*/ | |
this._prevRemoved = null; | |
/** | |
* \@internal | |
*/ | |
this._nextRemoved = null; | |
/** | |
* \@internal | |
*/ | |
this._nextAdded = null; | |
/** | |
* \@internal | |
*/ | |
this._nextMoved = null; | |
/** | |
* \@internal | |
*/ | |
this._nextIdentityChange = null; | |
} | |
/** | |
* @return {?} | |
*/ | |
IterableChangeRecord_.prototype.toString = function () { | |
return this.previousIndex === this.currentIndex ? stringify(this.item) : | |
stringify(this.item) + '[' + | |
stringify(this.previousIndex) + '->' + stringify(this.currentIndex) + ']'; | |
}; | |
return IterableChangeRecord_; | |
}()); | |
var _DuplicateItemRecordList = (function () { | |
function _DuplicateItemRecordList() { | |
/** | |
* \@internal | |
*/ | |
this._head = null; | |
/** | |
* \@internal | |
*/ | |
this._tail = null; | |
} | |
/** | |
* Append the record to the list of duplicates. | |
* | |
* Note: by design all records in the list of duplicates hold the same value in record.item. | |
* @param {?} record | |
* @return {?} | |
*/ | |
_DuplicateItemRecordList.prototype.add = function (record) { | |
if (this._head === null) { | |
this._head = this._tail = record; | |
record._nextDup = null; | |
record._prevDup = null; | |
} | |
else { | |
(( | |
// todo(vicb) | |
// assert(record.item == _head.item || | |
// record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN); | |
this._tail))._nextDup = record; | |
record._prevDup = this._tail; | |
record._nextDup = null; | |
this._tail = record; | |
} | |
}; | |
/** | |
* @param {?} trackById | |
* @param {?} afterIndex | |
* @return {?} | |
*/ | |
_DuplicateItemRecordList.prototype.get = function (trackById, afterIndex) { | |
var /** @type {?} */ record; | |
for (record = this._head; record !== null; record = record._nextDup) { | |
if ((afterIndex === null || afterIndex < record.currentIndex) && | |
looseIdentical(record.trackById, trackById)) { | |
return record; | |
} | |
} | |
return null; | |
}; | |
/** | |
* Remove one {\@link IterableChangeRecord_} from the list of duplicates. | |
* | |
* Returns whether the list of duplicates is empty. | |
* @param {?} record | |
* @return {?} | |
*/ | |
_DuplicateItemRecordList.prototype.remove = function (record) { | |
// todo(vicb) | |
// assert(() { | |
// // verify that the record being removed is in the list. | |
// for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) { | |
// if (identical(cursor, record)) return true; | |
// } | |
// return false; | |
//}); | |
var /** @type {?} */ prev = record._prevDup; | |
var /** @type {?} */ next = record._nextDup; | |
if (prev === null) { | |
this._head = next; | |
} | |
else { | |
prev._nextDup = next; | |
} | |
if (next === null) { | |
this._tail = prev; | |
} | |
else { | |
next._prevDup = prev; | |
} | |
return this._head === null; | |
}; | |
return _DuplicateItemRecordList; | |
}()); | |
var _DuplicateMap = (function () { | |
function _DuplicateMap() { | |
this.map = new Map(); | |
} | |
/** | |
* @param {?} record | |
* @return {?} | |
*/ | |
_DuplicateMap.prototype.put = function (record) { | |
var /** @type {?} */ key = record.trackById; | |
var /** @type {?} */ duplicates = this.map.get(key); | |
if (!duplicates) { | |
duplicates = new _DuplicateItemRecordList(); | |
this.map.set(key, duplicates); | |
} | |
duplicates.add(record); | |
}; | |
/** | |
* Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we | |
* have already iterated over, we use the afterIndex to pretend it is not there. | |
* | |
* Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we | |
* have any more `a`s needs to return the last `a` not the first or second. | |
* @param {?} trackById | |
* @param {?} afterIndex | |
* @return {?} | |
*/ | |
_DuplicateMap.prototype.get = function (trackById, afterIndex) { | |
var /** @type {?} */ key = trackById; | |
var /** @type {?} */ recordList = this.map.get(key); | |
return recordList ? recordList.get(trackById, afterIndex) : null; | |
}; | |
/** | |
* Removes a {\@link IterableChangeRecord_} from the list of duplicates. | |
* | |
* The list of duplicates also is removed from the map if it gets empty. | |
* @param {?} record | |
* @return {?} | |
*/ | |
_DuplicateMap.prototype.remove = function (record) { | |
var /** @type {?} */ key = record.trackById; | |
var /** @type {?} */ recordList = ((this.map.get(key))); | |
// Remove the list of duplicates when it gets empty | |
if (recordList.remove(record)) { | |
this.map.delete(key); | |
} | |
return record; | |
}; | |
Object.defineProperty(_DuplicateMap.prototype, "isEmpty", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.map.size === 0; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
_DuplicateMap.prototype.clear = function () { this.map.clear(); }; | |
/** | |
* @return {?} | |
*/ | |
_DuplicateMap.prototype.toString = function () { return '_DuplicateMap(' + stringify(this.map) + ')'; }; | |
return _DuplicateMap; | |
}()); | |
/** | |
* @param {?} item | |
* @param {?} addRemoveOffset | |
* @param {?} moveOffsets | |
* @return {?} | |
*/ | |
function getPreviousIndex(item, addRemoveOffset, moveOffsets) { | |
var /** @type {?} */ previousIndex = item.previousIndex; | |
if (previousIndex === null) | |
return previousIndex; | |
var /** @type {?} */ moveOffset = 0; | |
if (moveOffsets && previousIndex < moveOffsets.length) { | |
moveOffset = moveOffsets[previousIndex]; | |
} | |
return previousIndex + addRemoveOffset + moveOffset; | |
} | |
/** | |
* @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 DefaultKeyValueDifferFactory = (function () { | |
function DefaultKeyValueDifferFactory() { | |
} | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); }; | |
/** | |
* @deprecated v4.0.0 - ChangeDetectorRef is not used and is no longer a parameter | |
* @template K, V | |
* @param {?=} cd | |
* @return {?} | |
*/ | |
DefaultKeyValueDifferFactory.prototype.create = function (cd) { | |
return new DefaultKeyValueDiffer(); | |
}; | |
return DefaultKeyValueDifferFactory; | |
}()); | |
var DefaultKeyValueDiffer = (function () { | |
function DefaultKeyValueDiffer() { | |
this._records = new Map(); | |
this._mapHead = null; | |
this._appendAfter = null; | |
this._previousMapHead = null; | |
this._changesHead = null; | |
this._changesTail = null; | |
this._additionsHead = null; | |
this._additionsTail = null; | |
this._removalsHead = null; | |
this._removalsTail = null; | |
} | |
Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return this._additionsHead !== null || this._changesHead !== null || | |
this._removalsHead !== null; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.forEachItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._mapHead; record !== null; record = record._next) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) { | |
var /** @type {?} */ record; | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
fn(record); | |
} | |
}; | |
/** | |
* @param {?=} map | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.diff = function (map) { | |
if (!map) { | |
map = new Map(); | |
} | |
else if (!(map instanceof Map || isJsObject(map))) { | |
throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed"); | |
} | |
return this.check(map) ? this : null; | |
}; | |
/** | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.onDestroy = function () { }; | |
/** | |
* Check the current state of the map vs the previous. | |
* The algorithm is optimised for when the keys do no change. | |
* @param {?} map | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.check = function (map) { | |
var _this = this; | |
this._reset(); | |
var /** @type {?} */ insertBefore = this._mapHead; | |
this._appendAfter = null; | |
this._forEach(map, function (value, key) { | |
if (insertBefore && insertBefore.key === key) { | |
_this._maybeAddToChanges(insertBefore, value); | |
_this._appendAfter = insertBefore; | |
insertBefore = insertBefore._next; | |
} | |
else { | |
var /** @type {?} */ record = _this._getOrCreateRecordForKey(key, value); | |
insertBefore = _this._insertBeforeOrAppend(insertBefore, record); | |
} | |
}); | |
// Items remaining at the end of the list have been deleted | |
if (insertBefore) { | |
if (insertBefore._prev) { | |
insertBefore._prev._next = null; | |
} | |
this._removalsHead = insertBefore; | |
this._removalsTail = insertBefore; | |
for (var /** @type {?} */ record = insertBefore; record !== null; record = record._nextRemoved) { | |
if (record === this._mapHead) { | |
this._mapHead = null; | |
} | |
this._records.delete(record.key); | |
record._nextRemoved = record._next; | |
record.previousValue = record.currentValue; | |
record.currentValue = null; | |
record._prev = null; | |
record._next = null; | |
} | |
} | |
return this.isDirty; | |
}; | |
/** | |
* Inserts a record before `before` or append at the end of the list when `before` is null. | |
* | |
* Notes: | |
* - This method appends at `this._appendAfter`, | |
* - This method updates `this._appendAfter`, | |
* - The return value is the new value for the insertion pointer. | |
* @param {?} before | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) { | |
if (before) { | |
var /** @type {?} */ prev = before._prev; | |
record._next = before; | |
record._prev = prev; | |
before._prev = record; | |
if (prev) { | |
prev._next = record; | |
} | |
if (before === this._mapHead) { | |
this._mapHead = record; | |
} | |
this._appendAfter = before; | |
return before; | |
} | |
if (this._appendAfter) { | |
this._appendAfter._next = record; | |
record._prev = this._appendAfter; | |
} | |
else { | |
this._mapHead = record; | |
} | |
this._appendAfter = record; | |
return null; | |
}; | |
/** | |
* @param {?} key | |
* @param {?} value | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) { | |
if (this._records.has(key)) { | |
var /** @type {?} */ record_1 = this._records.get(key); | |
this._maybeAddToChanges(record_1, value); | |
var /** @type {?} */ prev = record_1._prev; | |
var /** @type {?} */ next = record_1._next; | |
if (prev) { | |
prev._next = next; | |
} | |
if (next) { | |
next._prev = prev; | |
} | |
record_1._next = null; | |
record_1._prev = null; | |
return record_1; | |
} | |
var /** @type {?} */ record = new KeyValueChangeRecord_(key); | |
this._records.set(key, record); | |
record.currentValue = value; | |
this._addToAdditions(record); | |
return record; | |
}; | |
/** | |
* \@internal | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._reset = function () { | |
if (this.isDirty) { | |
var /** @type {?} */ record = void 0; | |
// let `_previousMapHead` contain the state of the map before the changes | |
this._previousMapHead = this._mapHead; | |
for (record = this._previousMapHead; record !== null; record = record._next) { | |
record._nextPrevious = record._next; | |
} | |
// Update `record.previousValue` with the value of the item before the changes | |
// We need to update all changed items (that's those which have been added and changed) | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
record.previousValue = record.currentValue; | |
} | |
for (record = this._additionsHead; record != null; record = record._nextAdded) { | |
record.previousValue = record.currentValue; | |
} | |
this._changesHead = this._changesTail = null; | |
this._additionsHead = this._additionsTail = null; | |
this._removalsHead = this._removalsTail = null; | |
} | |
}; | |
/** | |
* @param {?} record | |
* @param {?} newValue | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) { | |
if (!looseIdentical(newValue, record.currentValue)) { | |
record.previousValue = record.currentValue; | |
record.currentValue = newValue; | |
this._addToChanges(record); | |
} | |
}; | |
/** | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._addToAdditions = function (record) { | |
if (this._additionsHead === null) { | |
this._additionsHead = this._additionsTail = record; | |
} | |
else { | |
((this._additionsTail))._nextAdded = record; | |
this._additionsTail = record; | |
} | |
}; | |
/** | |
* @param {?} record | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._addToChanges = function (record) { | |
if (this._changesHead === null) { | |
this._changesHead = this._changesTail = record; | |
} | |
else { | |
((this._changesTail))._nextChanged = record; | |
this._changesTail = record; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype.toString = function () { | |
var /** @type {?} */ items = []; | |
var /** @type {?} */ previous = []; | |
var /** @type {?} */ changes = []; | |
var /** @type {?} */ additions = []; | |
var /** @type {?} */ removals = []; | |
var /** @type {?} */ record; | |
for (record = this._mapHead; record !== null; record = record._next) { | |
items.push(stringify(record)); | |
} | |
for (record = this._previousMapHead; record !== null; record = record._nextPrevious) { | |
previous.push(stringify(record)); | |
} | |
for (record = this._changesHead; record !== null; record = record._nextChanged) { | |
changes.push(stringify(record)); | |
} | |
for (record = this._additionsHead; record !== null; record = record._nextAdded) { | |
additions.push(stringify(record)); | |
} | |
for (record = this._removalsHead; record !== null; record = record._nextRemoved) { | |
removals.push(stringify(record)); | |
} | |
return 'map: ' + items.join(', ') + '\n' + | |
'previous: ' + previous.join(', ') + '\n' + | |
'additions: ' + additions.join(', ') + '\n' + | |
'changes: ' + changes.join(', ') + '\n' + | |
'removals: ' + removals.join(', ') + '\n'; | |
}; | |
/** | |
* \@internal | |
* @template K, V | |
* @param {?} obj | |
* @param {?} fn | |
* @return {?} | |
*/ | |
DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) { | |
if (obj instanceof Map) { | |
obj.forEach(fn); | |
} | |
else { | |
Object.keys(obj).forEach(function (k) { return fn(obj[k], k); }); | |
} | |
}; | |
return DefaultKeyValueDiffer; | |
}()); | |
/** | |
* \@stable | |
*/ | |
var KeyValueChangeRecord_ = (function () { | |
/** | |
* @param {?} key | |
*/ | |
function KeyValueChangeRecord_(key) { | |
this.key = key; | |
this.previousValue = null; | |
this.currentValue = null; | |
/** | |
* \@internal | |
*/ | |
this._nextPrevious = null; | |
/** | |
* \@internal | |
*/ | |
this._next = null; | |
/** | |
* \@internal | |
*/ | |
this._prev = null; | |
/** | |
* \@internal | |
*/ | |
this._nextAdded = null; | |
/** | |
* \@internal | |
*/ | |
this._nextRemoved = null; | |
/** | |
* \@internal | |
*/ | |
this._nextChanged = null; | |
} | |
/** | |
* @return {?} | |
*/ | |
KeyValueChangeRecord_.prototype.toString = function () { | |
return looseIdentical(this.previousValue, this.currentValue) ? | |
stringify(this.key) : | |
(stringify(this.key) + '[' + stringify(this.previousValue) + '->' + | |
stringify(this.currentValue) + ']'); | |
}; | |
return KeyValueChangeRecord_; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* A repository of different iterable diffing strategies used by NgFor, NgClass, and others. | |
* \@stable | |
*/ | |
var IterableDiffers = (function () { | |
/** | |
* @param {?} factories | |
*/ | |
function IterableDiffers(factories) { | |
this.factories = factories; | |
} | |
/** | |
* @param {?} factories | |
* @param {?=} parent | |
* @return {?} | |
*/ | |
IterableDiffers.create = function (factories, parent) { | |
if (parent != null) { | |
var /** @type {?} */ copied = parent.factories.slice(); | |
factories = factories.concat(copied); | |
return new IterableDiffers(factories); | |
} | |
else { | |
return new IterableDiffers(factories); | |
} | |
}; | |
/** | |
* Takes an array of {\@link IterableDifferFactory} and returns a provider used to extend the | |
* inherited {\@link IterableDiffers} instance with the provided factories and return a new | |
* {\@link IterableDiffers} instance. | |
* | |
* The following example shows how to extend an existing list of factories, | |
* which will only be applied to the injector for this component and its children. | |
* This step is all that's required to make a new {\@link IterableDiffer} available. | |
* | |
* ### Example | |
* | |
* ``` | |
* \@Component({ | |
* viewProviders: [ | |
* IterableDiffers.extend([new ImmutableListDiffer()]) | |
* ] | |
* }) | |
* ``` | |
* @param {?} factories | |
* @return {?} | |
*/ | |
IterableDiffers.extend = function (factories) { | |
return { | |
provide: IterableDiffers, | |
useFactory: function (parent) { | |
if (!parent) { | |
// Typically would occur when calling IterableDiffers.extend inside of dependencies passed | |
// to | |
// bootstrap(), which would override default pipes instead of extending them. | |
throw new Error('Cannot extend IterableDiffers without a parent injector'); | |
} | |
return IterableDiffers.create(factories, parent); | |
}, | |
// Dependency technically isn't optional, but we can provide a better error message this way. | |
deps: [[IterableDiffers, new SkipSelf(), new Optional()]] | |
}; | |
}; | |
/** | |
* @param {?} iterable | |
* @return {?} | |
*/ | |
IterableDiffers.prototype.find = function (iterable) { | |
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(iterable); }); | |
if (factory != null) { | |
return factory; | |
} | |
else { | |
throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'"); | |
} | |
}; | |
return IterableDiffers; | |
}()); | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
function getTypeNameForDebugging(type) { | |
return type['name'] || typeof type; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* A repository of different Map diffing strategies used by NgClass, NgStyle, and others. | |
* \@stable | |
*/ | |
var KeyValueDiffers = (function () { | |
/** | |
* @param {?} factories | |
*/ | |
function KeyValueDiffers(factories) { | |
this.factories = factories; | |
} | |
/** | |
* @template S | |
* @param {?} factories | |
* @param {?=} parent | |
* @return {?} | |
*/ | |
KeyValueDiffers.create = function (factories, parent) { | |
if (parent) { | |
var /** @type {?} */ copied = parent.factories.slice(); | |
factories = factories.concat(copied); | |
} | |
return new KeyValueDiffers(factories); | |
}; | |
/** | |
* Takes an array of {\@link KeyValueDifferFactory} and returns a provider used to extend the | |
* inherited {\@link KeyValueDiffers} instance with the provided factories and return a new | |
* {\@link KeyValueDiffers} instance. | |
* | |
* The following example shows how to extend an existing list of factories, | |
* which will only be applied to the injector for this component and its children. | |
* This step is all that's required to make a new {\@link KeyValueDiffer} available. | |
* | |
* ### Example | |
* | |
* ``` | |
* \@Component({ | |
* viewProviders: [ | |
* KeyValueDiffers.extend([new ImmutableMapDiffer()]) | |
* ] | |
* }) | |
* ``` | |
* @template S | |
* @param {?} factories | |
* @return {?} | |
*/ | |
KeyValueDiffers.extend = function (factories) { | |
return { | |
provide: KeyValueDiffers, | |
useFactory: function (parent) { | |
if (!parent) { | |
// Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed | |
// to bootstrap(), which would override default pipes instead of extending them. | |
throw new Error('Cannot extend KeyValueDiffers without a parent injector'); | |
} | |
return KeyValueDiffers.create(factories, parent); | |
}, | |
// Dependency technically isn't optional, but we can provide a better error message this way. | |
deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]] | |
}; | |
}; | |
/** | |
* @param {?} kv | |
* @return {?} | |
*/ | |
KeyValueDiffers.prototype.find = function (kv) { | |
var /** @type {?} */ factory = this.factories.find(function (f) { return f.supports(kv); }); | |
if (factory) { | |
return factory; | |
} | |
throw new Error("Cannot find a differ supporting object '" + kv + "'"); | |
}; | |
return KeyValueDiffers; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Structural diffing for `Object`s and `Map`s. | |
*/ | |
var keyValDiff = [new DefaultKeyValueDifferFactory()]; | |
/** | |
* Structural diffing for `Iterable` types such as `Array`s. | |
*/ | |
var iterableDiff = [new DefaultIterableDifferFactory()]; | |
var defaultIterableDiffers = new IterableDiffers(iterableDiff); | |
var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff); | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Change detection enables data binding in Angular. | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @return {?} | |
*/ | |
function _reflector() { | |
return reflector; | |
} | |
var _CORE_PLATFORM_PROVIDERS = [ | |
// Set a default platform name for platforms that don't set it explicitly. | |
{ provide: PLATFORM_ID, useValue: 'unknown' }, | |
PlatformRef_, | |
{ provide: PlatformRef, useExisting: PlatformRef_ }, | |
{ provide: Reflector, useFactory: _reflector, deps: [] }, | |
{ provide: ReflectorReader, useExisting: Reflector }, | |
TestabilityRegistry, | |
Console, | |
]; | |
/** | |
* This platform has to be included in any other platform | |
* | |
* \@experimental | |
*/ | |
var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS); | |
/** | |
* @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 | |
*/ | |
/** | |
* \@experimental i18n support is experimental. | |
*/ | |
var LOCALE_ID = new InjectionToken('LocaleId'); | |
/** | |
* \@experimental i18n support is experimental. | |
*/ | |
var TRANSLATIONS = new InjectionToken('Translations'); | |
/** | |
* \@experimental i18n support is experimental. | |
*/ | |
var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat'); | |
var MissingTranslationStrategy = {}; | |
MissingTranslationStrategy.Error = 0; | |
MissingTranslationStrategy.Warning = 1; | |
MissingTranslationStrategy.Ignore = 2; | |
MissingTranslationStrategy[MissingTranslationStrategy.Error] = "Error"; | |
MissingTranslationStrategy[MissingTranslationStrategy.Warning] = "Warning"; | |
MissingTranslationStrategy[MissingTranslationStrategy.Ignore] = "Ignore"; | |
var SecurityContext = {}; | |
SecurityContext.NONE = 0; | |
SecurityContext.HTML = 1; | |
SecurityContext.STYLE = 2; | |
SecurityContext.SCRIPT = 3; | |
SecurityContext.URL = 4; | |
SecurityContext.RESOURCE_URL = 5; | |
SecurityContext[SecurityContext.NONE] = "NONE"; | |
SecurityContext[SecurityContext.HTML] = "HTML"; | |
SecurityContext[SecurityContext.STYLE] = "STYLE"; | |
SecurityContext[SecurityContext.SCRIPT] = "SCRIPT"; | |
SecurityContext[SecurityContext.URL] = "URL"; | |
SecurityContext[SecurityContext.RESOURCE_URL] = "RESOURCE_URL"; | |
/** | |
* Sanitizer is used by the views to sanitize potentially dangerous values. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var Sanitizer = (function () { | |
function Sanitizer() { | |
} | |
/** | |
* @abstract | |
* @param {?} context | |
* @param {?} value | |
* @return {?} | |
*/ | |
Sanitizer.prototype.sanitize = function (context, value) { }; | |
return Sanitizer; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Node instance data. | |
* | |
* We have a separate type per NodeType to save memory | |
* (TextData | ElementData | ProviderData | PureExpressionData | QueryList<any>) | |
* | |
* To keep our code monomorphic, | |
* we prohibit using `NodeData` directly but enforce the use of accessors (`asElementData`, ...). | |
* This way, no usage site can get a `NodeData` from view.nodes and then use it for different | |
* purposes. | |
*/ | |
/** | |
* Accessor for view.nodes, enforcing that every usage site stays monomorphic. | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function asTextData(view, index) { | |
return (view.nodes[index]); | |
} | |
/** | |
* Accessor for view.nodes, enforcing that every usage site stays monomorphic. | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function asElementData(view, index) { | |
return (view.nodes[index]); | |
} | |
/** | |
* Accessor for view.nodes, enforcing that every usage site stays monomorphic. | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function asProviderData(view, index) { | |
return (view.nodes[index]); | |
} | |
/** | |
* Accessor for view.nodes, enforcing that every usage site stays monomorphic. | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function asPureExpressionData(view, index) { | |
return (view.nodes[index]); | |
} | |
/** | |
* Accessor for view.nodes, enforcing that every usage site stays monomorphic. | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function asQueryList(view, index) { | |
return (view.nodes[index]); | |
} | |
/** | |
* @abstract | |
*/ | |
var DebugContext = (function () { | |
function DebugContext() { | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.view = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.nodeIndex = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.injector = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.component = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.providerTokens = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.references = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.context = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.componentRenderElement = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DebugContext.prototype.renderNode = function () { }; | |
/** | |
* @abstract | |
* @param {?} console | |
* @param {...?} values | |
* @return {?} | |
*/ | |
DebugContext.prototype.logError = function (console) { | |
var values = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
values[_i - 1] = arguments[_i]; | |
} | |
}; | |
return DebugContext; | |
}()); | |
/** | |
* This object is used to prevent cycles in the source files and to have a place where | |
* debug mode can hook it. It is lazily filled when `isDevMode` is known. | |
*/ | |
var Services = { | |
setCurrentNode: /** @type {?} */ ((undefined)), | |
createRootView: /** @type {?} */ ((undefined)), | |
createEmbeddedView: /** @type {?} */ ((undefined)), | |
checkAndUpdateView: /** @type {?} */ ((undefined)), | |
checkNoChangesView: /** @type {?} */ ((undefined)), | |
destroyView: /** @type {?} */ ((undefined)), | |
resolveDep: /** @type {?} */ ((undefined)), | |
createDebugContext: /** @type {?} */ ((undefined)), | |
handleEvent: /** @type {?} */ ((undefined)), | |
updateDirectives: /** @type {?} */ ((undefined)), | |
updateRenderer: /** @type {?} */ ((undefined)), | |
dirtyParentQueries: /** @type {?} */ ((undefined)), | |
}; | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} context | |
* @param {?} oldValue | |
* @param {?} currValue | |
* @param {?} isFirstCheck | |
* @return {?} | |
*/ | |
function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) { | |
var /** @type {?} */ msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'."; | |
if (isFirstCheck) { | |
msg += | |
" It seems like the view has been created after its parent and its children have been dirty checked." + | |
" Has it been created in a change detection hook ?"; | |
} | |
return viewDebugError(msg, context); | |
} | |
/** | |
* @param {?} err | |
* @param {?} context | |
* @return {?} | |
*/ | |
function viewWrappedDebugError(err, context) { | |
if (!(err instanceof Error)) { | |
// errors that are not Error instances don't have a stack, | |
// so it is ok to wrap them into a new Error object... | |
err = new Error(err.toString()); | |
} | |
_addDebugContext(err, context); | |
return err; | |
} | |
/** | |
* @param {?} msg | |
* @param {?} context | |
* @return {?} | |
*/ | |
function viewDebugError(msg, context) { | |
var /** @type {?} */ err = new Error(msg); | |
_addDebugContext(err, context); | |
return err; | |
} | |
/** | |
* @param {?} err | |
* @param {?} context | |
* @return {?} | |
*/ | |
function _addDebugContext(err, context) { | |
((err))[ERROR_DEBUG_CONTEXT] = context; | |
((err))[ERROR_LOGGER] = context.logError.bind(context); | |
} | |
/** | |
* @param {?} err | |
* @return {?} | |
*/ | |
function isViewDebugError(err) { | |
return !!getDebugContext(err); | |
} | |
/** | |
* @param {?} action | |
* @return {?} | |
*/ | |
function viewDestroyedError(action) { | |
return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action); | |
} | |
/** | |
* @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 NOOP = function () { }; | |
var _tokenKeyCache = new Map(); | |
/** | |
* @param {?} token | |
* @return {?} | |
*/ | |
function tokenKey(token) { | |
var /** @type {?} */ key = _tokenKeyCache.get(token); | |
if (!key) { | |
key = stringify(token) + '_' + _tokenKeyCache.size; | |
_tokenKeyCache.set(token, key); | |
} | |
return key; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIdx | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @return {?} | |
*/ | |
function unwrapValue(view, nodeIdx, bindingIdx, value) { | |
if (value instanceof WrappedValue) { | |
value = value.wrapped; | |
var /** @type {?} */ globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx; | |
var /** @type {?} */ oldValue = view.oldValues[globalBindingIdx]; | |
if (oldValue instanceof WrappedValue) { | |
oldValue = oldValue.wrapped; | |
} | |
view.oldValues[globalBindingIdx] = new WrappedValue(oldValue); | |
} | |
return value; | |
} | |
var UNDEFINED_RENDERER_TYPE_ID = '$$undefined'; | |
var EMPTY_RENDERER_TYPE_ID = '$$empty'; | |
/** | |
* @param {?} values | |
* @return {?} | |
*/ | |
function createRendererType2(values) { | |
return { | |
id: UNDEFINED_RENDERER_TYPE_ID, | |
styles: values.styles, | |
encapsulation: values.encapsulation, | |
data: values.data | |
}; | |
} | |
var _renderCompCount = 0; | |
/** | |
* @param {?=} type | |
* @return {?} | |
*/ | |
function resolveRendererType2(type) { | |
if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) { | |
// first time we see this RendererType2. Initialize it... | |
var /** @type {?} */ isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) || | |
type.styles.length || Object.keys(type.data).length); | |
if (isFilled) { | |
type.id = "c" + _renderCompCount++; | |
} | |
else { | |
type.id = EMPTY_RENDERER_TYPE_ID; | |
} | |
} | |
if (type && type.id === EMPTY_RENDERER_TYPE_ID) { | |
type = null; | |
} | |
return type || null; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @return {?} | |
*/ | |
function checkBinding(view, def, bindingIdx, value) { | |
var /** @type {?} */ oldValues = view.oldValues; | |
if ((view.state & 1 /* FirstCheck */) || | |
!looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) { | |
return true; | |
} | |
return false; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @return {?} | |
*/ | |
function checkAndUpdateBinding(view, def, bindingIdx, value) { | |
if (checkBinding(view, def, bindingIdx, value)) { | |
view.oldValues[def.bindingIndex + bindingIdx] = value; | |
return true; | |
} | |
return false; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @return {?} | |
*/ | |
function checkBindingNoChanges(view, def, bindingIdx, value) { | |
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx]; | |
if ((view.state & 1 /* FirstCheck */) || !devModeEqual(oldValue, value)) { | |
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.index), oldValue, value, (view.state & 1 /* FirstCheck */) !== 0); | |
} | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function markParentViewsForCheck(view) { | |
var /** @type {?} */ currView = view; | |
while (currView) { | |
if (currView.def.flags & 2 /* OnPush */) { | |
currView.state |= 2 /* ChecksEnabled */; | |
} | |
currView = currView.viewContainerParent || currView.parent; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} eventName | |
* @param {?} event | |
* @return {?} | |
*/ | |
function dispatchEvent(view, nodeIndex, eventName, event) { | |
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; | |
var /** @type {?} */ startView = nodeDef.flags & 16777216 /* ComponentView */ ? asElementData(view, nodeIndex).componentView : view; | |
markParentViewsForCheck(startView); | |
return Services.handleEvent(view, nodeIndex, eventName, event); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function declaredViewContainer(view) { | |
if (view.parent) { | |
var /** @type {?} */ parentView = view.parent; | |
return asElementData(parentView, /** @type {?} */ ((view.parentNodeDef)).index); | |
} | |
return null; | |
} | |
/** | |
* for component views, this is the host element. | |
* for embedded views, this is the index of the parent node | |
* that contains the view container. | |
* @param {?} view | |
* @return {?} | |
*/ | |
function viewParentEl(view) { | |
var /** @type {?} */ parentView = view.parent; | |
if (parentView) { | |
return ((view.parentNodeDef)).parent; | |
} | |
else { | |
return null; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function renderNode(view, def) { | |
switch (def.flags & 100673535 /* Types */) { | |
case 1 /* TypeElement */: | |
return asElementData(view, def.index).renderElement; | |
case 2 /* TypeText */: | |
return asTextData(view, def.index).renderText; | |
} | |
} | |
/** | |
* @param {?} target | |
* @param {?} name | |
* @return {?} | |
*/ | |
function elementEventFullName(target, name) { | |
return target ? target + ":" + name : name; | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function isComponentView(view) { | |
return !!view.parent && !!(((view.parentNodeDef)).flags & 16384 /* Component */); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function isEmbeddedView(view) { | |
return !!view.parent && !(((view.parentNodeDef)).flags & 16384 /* Component */); | |
} | |
/** | |
* @param {?} queryId | |
* @return {?} | |
*/ | |
function filterQueryId(queryId) { | |
return 1 << (queryId % 32); | |
} | |
/** | |
* @param {?} matchedQueriesDsl | |
* @return {?} | |
*/ | |
function splitMatchedQueriesDsl(matchedQueriesDsl) { | |
var /** @type {?} */ matchedQueries = {}; | |
var /** @type {?} */ matchedQueryIds = 0; | |
var /** @type {?} */ references = {}; | |
if (matchedQueriesDsl) { | |
matchedQueriesDsl.forEach(function (_a) { | |
var queryId = _a[0], valueType = _a[1]; | |
if (typeof queryId === 'number') { | |
matchedQueries[queryId] = valueType; | |
matchedQueryIds |= filterQueryId(queryId); | |
} | |
else { | |
references[queryId] = valueType; | |
} | |
}); | |
} | |
return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds }; | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderHost | |
* @param {?} def | |
* @return {?} | |
*/ | |
function getParentRenderElement(view, renderHost, def) { | |
var /** @type {?} */ renderParent = def.renderParent; | |
if (renderParent) { | |
if ((renderParent.flags & 1 /* TypeElement */) === 0 || | |
(renderParent.flags & 16777216 /* ComponentView */) === 0 || | |
(((renderParent.element)).componentRendererType && ((((renderParent.element)).componentRendererType)).encapsulation === | |
ViewEncapsulation.Native)) { | |
// only children of non components, or children of components with native encapsulation should | |
// be attached. | |
return asElementData(view, /** @type {?} */ ((def.renderParent)).index).renderElement; | |
} | |
} | |
else { | |
return renderHost; | |
} | |
} | |
var VIEW_DEFINITION_CACHE = new WeakMap(); | |
/** | |
* @param {?} factory | |
* @return {?} | |
*/ | |
function resolveViewDefinition(factory) { | |
var /** @type {?} */ value = ((VIEW_DEFINITION_CACHE.get(factory))); | |
if (!value) { | |
value = factory(function () { return NOOP; }); | |
value.factory = factory; | |
VIEW_DEFINITION_CACHE.set(factory, value); | |
} | |
return value; | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function rootRenderNodes(view) { | |
var /** @type {?} */ renderNodes = []; | |
visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes); | |
return renderNodes; | |
} | |
/** | |
* @param {?} view | |
* @param {?} action | |
* @param {?} parentNode | |
* @param {?} nextSibling | |
* @param {?=} target | |
* @return {?} | |
*/ | |
function visitRootRenderNodes(view, action, parentNode, nextSibling, target) { | |
// We need to re-compute the parent node in case the nodes have been moved around manually | |
if (action === 3 /* RemoveChild */) { | |
parentNode = view.renderer.parentNode(renderNode(view, /** @type {?} */ ((view.def.lastRenderRootNode)))); | |
} | |
visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target); | |
} | |
/** | |
* @param {?} view | |
* @param {?} action | |
* @param {?} startIndex | |
* @param {?} endIndex | |
* @param {?} parentNode | |
* @param {?} nextSibling | |
* @param {?=} target | |
* @return {?} | |
*/ | |
function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) { | |
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 4 /* TypeNgContent */)) { | |
visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target); | |
} | |
// jump to next sibling | |
i += nodeDef.childCount; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} ngContentIndex | |
* @param {?} action | |
* @param {?} parentNode | |
* @param {?} nextSibling | |
* @param {?=} target | |
* @return {?} | |
*/ | |
function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) { | |
var /** @type {?} */ compView = view; | |
while (compView && !isComponentView(compView)) { | |
compView = compView.parent; | |
} | |
var /** @type {?} */ hostView = ((compView)).parent; | |
var /** @type {?} */ hostElDef = viewParentEl(/** @type {?} */ ((compView))); | |
var /** @type {?} */ startIndex = ((hostElDef)).index + 1; | |
var /** @type {?} */ endIndex = ((hostElDef)).index + ((hostElDef)).childCount; | |
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { | |
var /** @type {?} */ nodeDef = ((hostView)).def.nodes[i]; | |
if (nodeDef.ngContentIndex === ngContentIndex) { | |
visitRenderNode(/** @type {?} */ ((hostView)), nodeDef, action, parentNode, nextSibling, target); | |
} | |
// jump to next sibling | |
i += nodeDef.childCount; | |
} | |
if (!((hostView)).parent) { | |
// a root view | |
var /** @type {?} */ projectedNodes = view.root.projectableNodes[ngContentIndex]; | |
if (projectedNodes) { | |
for (var /** @type {?} */ i = 0; i < projectedNodes.length; i++) { | |
execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target); | |
} | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} action | |
* @param {?} parentNode | |
* @param {?} nextSibling | |
* @param {?=} target | |
* @return {?} | |
*/ | |
function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) { | |
if (nodeDef.flags & 4 /* TypeNgContent */) { | |
visitProjectedRenderNodes(view, /** @type {?} */ ((nodeDef.ngContent)).index, action, parentNode, nextSibling, target); | |
} | |
else { | |
var /** @type {?} */ rn = renderNode(view, nodeDef); | |
if (action === 3 /* RemoveChild */ && (nodeDef.flags & 16777216 /* ComponentView */) && | |
(nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) { | |
// Note: we might need to do both actions. | |
if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) { | |
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); | |
} | |
if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) { | |
var /** @type {?} */ compView = asElementData(view, nodeDef.index).componentView; | |
execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target); | |
} | |
} | |
else { | |
execRenderNodeAction(view, rn, action, parentNode, nextSibling, target); | |
} | |
if (nodeDef.flags & 8388608 /* EmbeddedViews */) { | |
var /** @type {?} */ embeddedViews = ((asElementData(view, nodeDef.index).viewContainer))._embeddedViews; | |
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { | |
visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target); | |
} | |
} | |
if (nodeDef.flags & 1 /* TypeElement */ && !((nodeDef.element)).name) { | |
visitSiblingRenderNodes(view, action, nodeDef.index + 1, nodeDef.index + nodeDef.childCount, parentNode, nextSibling, target); | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderNode | |
* @param {?} action | |
* @param {?} parentNode | |
* @param {?} nextSibling | |
* @param {?=} target | |
* @return {?} | |
*/ | |
function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) { | |
var /** @type {?} */ renderer = view.renderer; | |
switch (action) { | |
case 1 /* AppendChild */: | |
renderer.appendChild(parentNode, renderNode); | |
break; | |
case 2 /* InsertBefore */: | |
renderer.insertBefore(parentNode, renderNode, nextSibling); | |
break; | |
case 3 /* RemoveChild */: | |
renderer.removeChild(parentNode, renderNode); | |
break; | |
case 0 /* Collect */: | |
((target)).push(renderNode); | |
break; | |
} | |
} | |
var NS_PREFIX_RE = /^:([^:]+):(.+)$/; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
function splitNamespace(name) { | |
if (name[0] === ':') { | |
var /** @type {?} */ match = ((name.match(NS_PREFIX_RE))); | |
return [match[1], match[2]]; | |
} | |
return ['', name]; | |
} | |
/** | |
* @param {?} bindings | |
* @return {?} | |
*/ | |
function calcBindingFlags(bindings) { | |
var /** @type {?} */ flags = 0; | |
for (var /** @type {?} */ i = 0; i < bindings.length; i++) { | |
flags |= bindings[i].flags; | |
} | |
return flags; | |
} | |
/** | |
* @param {?} valueCount | |
* @param {?} constAndInterp | |
* @return {?} | |
*/ | |
function interpolate(valueCount, constAndInterp) { | |
var /** @type {?} */ result = ''; | |
for (var /** @type {?} */ i = 0; i < valueCount * 2; i = i + 2) { | |
result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]); | |
} | |
return result + constAndInterp[valueCount * 2]; | |
} | |
/** | |
* @param {?} valueCount | |
* @param {?} c0 | |
* @param {?} a1 | |
* @param {?} c1 | |
* @param {?=} a2 | |
* @param {?=} c2 | |
* @param {?=} a3 | |
* @param {?=} c3 | |
* @param {?=} a4 | |
* @param {?=} c4 | |
* @param {?=} a5 | |
* @param {?=} c5 | |
* @param {?=} a6 | |
* @param {?=} c6 | |
* @param {?=} a7 | |
* @param {?=} c7 | |
* @param {?=} a8 | |
* @param {?=} c8 | |
* @param {?=} a9 | |
* @param {?=} c9 | |
* @return {?} | |
*/ | |
function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) { | |
switch (valueCount) { | |
case 1: | |
return c0 + _toStringWithNull(a1) + c1; | |
case 2: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2; | |
case 3: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3; | |
case 4: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4; | |
case 5: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5; | |
case 6: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6; | |
case 7: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + | |
c6 + _toStringWithNull(a7) + c7; | |
case 8: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + | |
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8; | |
case 9: | |
return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) + | |
c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + | |
c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9; | |
default: | |
throw new Error("Does not support more than 9 expressions"); | |
} | |
} | |
/** | |
* @param {?} v | |
* @return {?} | |
*/ | |
function _toStringWithNull(v) { | |
return v != null ? v.toString() : ''; | |
} | |
var EMPTY_ARRAY = []; | |
var EMPTY_MAP = {}; | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} flags | |
* @param {?} matchedQueriesDsl | |
* @param {?} ngContentIndex | |
* @param {?} childCount | |
* @param {?=} handleEvent | |
* @param {?=} templateFactory | |
* @return {?} | |
*/ | |
function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) { | |
flags |= 1 /* TypeElement */; | |
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; | |
var /** @type {?} */ template = templateFactory ? resolveViewDefinition(templateFactory) : null; | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, | |
bindings: [], | |
bindingFlags: 0, | |
outputs: [], | |
element: { | |
ns: null, | |
name: null, | |
attrs: null, template: template, | |
componentProvider: null, | |
componentView: null, | |
componentRendererType: null, | |
publicProviders: null, | |
allProviders: null, | |
handleEvent: handleEvent || NOOP | |
}, | |
provider: null, | |
text: null, | |
query: null, | |
ngContent: null | |
}; | |
} | |
/** | |
* @param {?} flags | |
* @param {?} matchedQueriesDsl | |
* @param {?} ngContentIndex | |
* @param {?} childCount | |
* @param {?} namespaceAndName | |
* @param {?=} fixedAttrs | |
* @param {?=} bindings | |
* @param {?=} outputs | |
* @param {?=} handleEvent | |
* @param {?=} componentView | |
* @param {?=} componentRendererType | |
* @return {?} | |
*/ | |
function elementDef(flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) { | |
if (fixedAttrs === void 0) { fixedAttrs = []; } | |
if (!handleEvent) { | |
handleEvent = NOOP; | |
} | |
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; | |
var /** @type {?} */ ns = ((null)); | |
var /** @type {?} */ name = ((null)); | |
if (namespaceAndName) { | |
_b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1]; | |
} | |
bindings = bindings || []; | |
var /** @type {?} */ bindingDefs = new Array(bindings.length); | |
for (var /** @type {?} */ i = 0; i < bindings.length; i++) { | |
var _c = bindings[i], bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2]; | |
var _d = splitNamespace(namespaceAndName_1), ns_1 = _d[0], name_1 = _d[1]; | |
var /** @type {?} */ securityContext = ((undefined)); | |
var /** @type {?} */ suffix = ((undefined)); | |
switch (bindingFlags & 15 /* Types */) { | |
case 4 /* TypeElementStyle */: | |
suffix = (suffixOrSecurityContext); | |
break; | |
case 1 /* TypeElementAttribute */: | |
case 8 /* TypeProperty */: | |
securityContext = (suffixOrSecurityContext); | |
break; | |
} | |
bindingDefs[i] = | |
{ flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix }; | |
} | |
outputs = outputs || []; | |
var /** @type {?} */ outputDefs = new Array(outputs.length); | |
for (var /** @type {?} */ i = 0; i < outputs.length; i++) { | |
var _e = outputs[i], target = _e[0], eventName = _e[1]; | |
outputDefs[i] = { | |
type: 0 /* ElementOutput */, | |
target: /** @type {?} */ (target), eventName: eventName, | |
propName: null | |
}; | |
} | |
fixedAttrs = fixedAttrs || []; | |
var /** @type {?} */ attrs = (fixedAttrs.map(function (_a) { | |
var namespaceAndName = _a[0], value = _a[1]; | |
var _b = splitNamespace(namespaceAndName), ns = _b[0], name = _b[1]; | |
return [ns, name, value]; | |
})); | |
componentRendererType = resolveRendererType2(componentRendererType); | |
if (componentView) { | |
flags |= 16777216 /* ComponentView */; | |
} | |
flags |= 1 /* TypeElement */; | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount, | |
bindings: bindingDefs, | |
bindingFlags: calcBindingFlags(bindingDefs), | |
outputs: outputDefs, | |
element: { | |
ns: ns, | |
name: name, | |
attrs: attrs, | |
template: null, | |
// will bet set by the view definition | |
componentProvider: null, | |
componentView: componentView || null, | |
componentRendererType: componentRendererType, | |
publicProviders: null, | |
allProviders: null, | |
handleEvent: handleEvent || NOOP, | |
}, | |
provider: null, | |
text: null, | |
query: null, | |
ngContent: null | |
}; | |
var _b; | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderHost | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createElement(view, renderHost, def) { | |
var /** @type {?} */ elDef = ((def.element)); | |
var /** @type {?} */ rootSelectorOrNode = view.root.selectorOrNode; | |
var /** @type {?} */ renderer = view.renderer; | |
var /** @type {?} */ el; | |
if (view.parent || !rootSelectorOrNode) { | |
if (elDef.name) { | |
el = renderer.createElement(elDef.name, elDef.ns); | |
} | |
else { | |
el = renderer.createComment(''); | |
} | |
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); | |
if (parentEl) { | |
renderer.appendChild(parentEl, el); | |
} | |
} | |
else { | |
el = renderer.selectRootElement(rootSelectorOrNode); | |
} | |
if (elDef.attrs) { | |
for (var /** @type {?} */ i = 0; i < elDef.attrs.length; i++) { | |
var _a = elDef.attrs[i], ns = _a[0], name = _a[1], value = _a[2]; | |
renderer.setAttribute(el, name, value, ns); | |
} | |
} | |
return el; | |
} | |
/** | |
* @param {?} view | |
* @param {?} compView | |
* @param {?} def | |
* @param {?} el | |
* @return {?} | |
*/ | |
function listenToElementOutputs(view, compView, def, el) { | |
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) { | |
var /** @type {?} */ output = def.outputs[i]; | |
var /** @type {?} */ handleEventClosure = renderEventHandlerClosure(view, def.index, elementEventFullName(output.target, output.eventName)); | |
var /** @type {?} */ listenTarget = output.target; | |
var /** @type {?} */ listenerView = view; | |
if (output.target === 'component') { | |
listenTarget = null; | |
listenerView = compView; | |
} | |
var /** @type {?} */ disposable = (listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure)); /** @type {?} */ | |
((view.disposables))[def.outputIndex + i] = disposable; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} index | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
function renderEventHandlerClosure(view, index, eventName) { | |
return function (event) { return dispatchEvent(view, index, eventName, event); }; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} v0 | |
* @param {?} v1 | |
* @param {?} v2 | |
* @param {?} v3 | |
* @param {?} v4 | |
* @param {?} v5 | |
* @param {?} v6 | |
* @param {?} v7 | |
* @param {?} v8 | |
* @param {?} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ bindLen = def.bindings.length; | |
var /** @type {?} */ changed = false; | |
if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0)) | |
changed = true; | |
if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1)) | |
changed = true; | |
if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2)) | |
changed = true; | |
if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3)) | |
changed = true; | |
if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4)) | |
changed = true; | |
if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5)) | |
changed = true; | |
if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6)) | |
changed = true; | |
if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7)) | |
changed = true; | |
if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8)) | |
changed = true; | |
if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9)) | |
changed = true; | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkAndUpdateElementDynamic(view, def, values) { | |
var /** @type {?} */ changed = false; | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
if (checkAndUpdateElementValue(view, def, i, values[i])) | |
changed = true; | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @return {?} | |
*/ | |
function checkAndUpdateElementValue(view, def, bindingIdx, value) { | |
if (!checkAndUpdateBinding(view, def, bindingIdx, value)) { | |
return false; | |
} | |
var /** @type {?} */ binding = def.bindings[bindingIdx]; | |
var /** @type {?} */ elData = asElementData(view, def.index); | |
var /** @type {?} */ renderNode$$1 = elData.renderElement; | |
var /** @type {?} */ name = ((binding.name)); | |
switch (binding.flags & 15 /* Types */) { | |
case 1 /* TypeElementAttribute */: | |
setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value); | |
break; | |
case 2 /* TypeElementClass */: | |
setElementClass(view, renderNode$$1, name, value); | |
break; | |
case 4 /* TypeElementStyle */: | |
setElementStyle(view, binding, renderNode$$1, name, value); | |
break; | |
case 8 /* TypeProperty */: | |
var /** @type {?} */ bindView = (def.flags & 16777216 /* ComponentView */ && | |
binding.flags & 32 /* SyntheticHostProperty */) ? | |
elData.componentView : | |
view; | |
setElementProperty(bindView, binding, renderNode$$1, name, value); | |
break; | |
} | |
return true; | |
} | |
/** | |
* @param {?} view | |
* @param {?} binding | |
* @param {?} renderNode | |
* @param {?} ns | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
function setElementAttribute(view, binding, renderNode$$1, ns, name, value) { | |
var /** @type {?} */ securityContext = binding.securityContext; | |
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; | |
renderValue = renderValue != null ? renderValue.toString() : null; | |
var /** @type {?} */ renderer = view.renderer; | |
if (value != null) { | |
renderer.setAttribute(renderNode$$1, name, renderValue, ns); | |
} | |
else { | |
renderer.removeAttribute(renderNode$$1, name, ns); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderNode | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
function setElementClass(view, renderNode$$1, name, value) { | |
var /** @type {?} */ renderer = view.renderer; | |
if (value) { | |
renderer.addClass(renderNode$$1, name); | |
} | |
else { | |
renderer.removeClass(renderNode$$1, name); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} binding | |
* @param {?} renderNode | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
function setElementStyle(view, binding, renderNode$$1, name, value) { | |
var /** @type {?} */ renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, value); | |
if (renderValue != null) { | |
renderValue = renderValue.toString(); | |
var /** @type {?} */ unit = binding.suffix; | |
if (unit != null) { | |
renderValue = renderValue + unit; | |
} | |
} | |
else { | |
renderValue = null; | |
} | |
var /** @type {?} */ renderer = view.renderer; | |
if (renderValue != null) { | |
renderer.setStyle(renderNode$$1, name, renderValue); | |
} | |
else { | |
renderer.removeStyle(renderNode$$1, name); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} binding | |
* @param {?} renderNode | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
function setElementProperty(view, binding, renderNode$$1, name, value) { | |
var /** @type {?} */ securityContext = binding.securityContext; | |
var /** @type {?} */ renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value; | |
view.renderer.setProperty(renderNode$$1, name, renderValue); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} ngContentIndex | |
* @param {?} index | |
* @return {?} | |
*/ | |
function ngContentDef(ngContentIndex, index) { | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: 4 /* TypeNgContent */, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, | |
matchedQueries: {}, | |
matchedQueryIds: 0, | |
references: {}, ngContentIndex: ngContentIndex, | |
childCount: 0, | |
bindings: [], | |
bindingFlags: 0, | |
outputs: [], | |
element: null, | |
provider: null, | |
text: null, | |
query: null, | |
ngContent: { index: index } | |
}; | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderHost | |
* @param {?} def | |
* @return {?} | |
*/ | |
function appendNgContent(view, renderHost, def) { | |
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); | |
if (!parentEl) { | |
// Nothing to do if there is no parent element. | |
return; | |
} | |
var /** @type {?} */ ngContentIndex = ((def.ngContent)).index; | |
visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} parentView | |
* @param {?} elementData | |
* @param {?} viewIndex | |
* @param {?} view | |
* @return {?} | |
*/ | |
function attachEmbeddedView(parentView, elementData, viewIndex, view) { | |
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; | |
if (viewIndex === null || viewIndex === undefined) { | |
viewIndex = embeddedViews.length; | |
} | |
view.viewContainerParent = parentView; | |
addToArray(embeddedViews, /** @type {?} */ ((viewIndex)), view); | |
var /** @type {?} */ dvcElementData = declaredViewContainer(view); | |
if (dvcElementData && dvcElementData !== elementData) { | |
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; | |
if (!projectedViews) { | |
projectedViews = dvcElementData.template._projectedViews = []; | |
} | |
projectedViews.push(view); | |
} | |
Services.dirtyParentQueries(view); | |
var /** @type {?} */ prevView = ((viewIndex)) > 0 ? embeddedViews[((viewIndex)) - 1] : null; | |
renderAttachEmbeddedView(elementData, prevView, view); | |
} | |
/** | |
* @param {?} elementData | |
* @param {?=} viewIndex | |
* @return {?} | |
*/ | |
function detachEmbeddedView(elementData, viewIndex) { | |
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; | |
if (viewIndex == null || viewIndex >= embeddedViews.length) { | |
viewIndex = embeddedViews.length - 1; | |
} | |
if (viewIndex < 0) { | |
return null; | |
} | |
var /** @type {?} */ view = embeddedViews[viewIndex]; | |
view.viewContainerParent = null; | |
removeFromArray(embeddedViews, viewIndex); | |
var /** @type {?} */ dvcElementData = declaredViewContainer(view); | |
if (dvcElementData && dvcElementData !== elementData) { | |
var /** @type {?} */ projectedViews = dvcElementData.template._projectedViews; | |
removeFromArray(projectedViews, projectedViews.indexOf(view)); | |
} | |
Services.dirtyParentQueries(view); | |
renderDetachView(view); | |
return view; | |
} | |
/** | |
* @param {?} elementData | |
* @param {?} oldViewIndex | |
* @param {?} newViewIndex | |
* @return {?} | |
*/ | |
function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) { | |
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; | |
var /** @type {?} */ view = embeddedViews[oldViewIndex]; | |
removeFromArray(embeddedViews, oldViewIndex); | |
if (newViewIndex == null) { | |
newViewIndex = embeddedViews.length; | |
} | |
addToArray(embeddedViews, newViewIndex, view); | |
// Note: Don't need to change projectedViews as the order in there | |
// as always invalid... | |
Services.dirtyParentQueries(view); | |
renderDetachView(view); | |
var /** @type {?} */ prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null; | |
renderAttachEmbeddedView(elementData, prevView, view); | |
return view; | |
} | |
/** | |
* @param {?} elementData | |
* @param {?} prevView | |
* @param {?} view | |
* @return {?} | |
*/ | |
function renderAttachEmbeddedView(elementData, prevView, view) { | |
var /** @type {?} */ prevRenderNode = prevView ? renderNode(prevView, /** @type {?} */ ((prevView.def.lastRenderRootNode))) : | |
elementData.renderElement; | |
var /** @type {?} */ parentNode = view.renderer.parentNode(prevRenderNode); | |
var /** @type {?} */ nextSibling = view.renderer.nextSibling(prevRenderNode); | |
// Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be! | |
// However, browsers automatically do `appendChild` when there is no `nextSibling`. | |
visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function renderDetachView(view) { | |
visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined); | |
} | |
/** | |
* @param {?} arr | |
* @param {?} index | |
* @param {?} value | |
* @return {?} | |
*/ | |
function addToArray(arr, index, value) { | |
// perf: array.push is faster than array.splice! | |
if (index >= arr.length) { | |
arr.push(value); | |
} | |
else { | |
arr.splice(index, 0, value); | |
} | |
} | |
/** | |
* @param {?} arr | |
* @param {?} index | |
* @return {?} | |
*/ | |
function removeFromArray(arr, index) { | |
// perf: array.pop is faster than array.splice! | |
if (index >= arr.length - 1) { | |
arr.pop(); | |
} | |
else { | |
arr.splice(index, 1); | |
} | |
} | |
/** | |
* @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 EMPTY_CONTEXT = new Object(); | |
/** | |
* @param {?} selector | |
* @param {?} componentType | |
* @param {?} viewDefFactory | |
* @param {?} inputs | |
* @param {?} outputs | |
* @param {?} ngContentSelectors | |
* @return {?} | |
*/ | |
function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) { | |
return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors); | |
} | |
/** | |
* @param {?} componentFactory | |
* @return {?} | |
*/ | |
function getComponentViewDefinitionFactory(componentFactory) { | |
return ((componentFactory)).viewDefFactory; | |
} | |
var ComponentFactory_ = (function (_super) { | |
__extends(ComponentFactory_, _super); | |
/** | |
* @param {?} selector | |
* @param {?} componentType | |
* @param {?} viewDefFactory | |
* @param {?} _inputs | |
* @param {?} _outputs | |
* @param {?} ngContentSelectors | |
*/ | |
function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) { | |
var _this = | |
// Attention: this ctor is called as top level function. | |
// Putting any logic in here will destroy closure tree shaking! | |
_super.call(this) || this; | |
_this.selector = selector; | |
_this.componentType = componentType; | |
_this._inputs = _inputs; | |
_this._outputs = _outputs; | |
_this.ngContentSelectors = ngContentSelectors; | |
_this.viewDefFactory = viewDefFactory; | |
return _this; | |
} | |
Object.defineProperty(ComponentFactory_.prototype, "inputs", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ inputsArr = []; | |
for (var /** @type {?} */ propName in this._inputs) { | |
var /** @type {?} */ templateName = this._inputs[propName]; | |
inputsArr.push({ propName: propName, templateName: templateName }); | |
} | |
return inputsArr; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentFactory_.prototype, "outputs", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ outputsArr = []; | |
for (var /** @type {?} */ propName in this._outputs) { | |
var /** @type {?} */ templateName = this._outputs[propName]; | |
outputsArr.push({ propName: propName, templateName: templateName }); | |
} | |
return outputsArr; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* Creates a new component. | |
* @param {?} injector | |
* @param {?=} projectableNodes | |
* @param {?=} rootSelectorOrNode | |
* @param {?=} ngModule | |
* @return {?} | |
*/ | |
ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) { | |
if (!ngModule) { | |
throw new Error('ngModule should be provided'); | |
} | |
var /** @type {?} */ viewDef = resolveViewDefinition(this.viewDefFactory); | |
var /** @type {?} */ componentNodeIndex = ((((viewDef.nodes[0].element)).componentProvider)).index; | |
var /** @type {?} */ view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT); | |
var /** @type {?} */ component = asProviderData(view, componentNodeIndex).instance; | |
view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full); | |
return new ComponentRef_(view, new ViewRef_(view), component); | |
}; | |
return ComponentFactory_; | |
}(ComponentFactory)); | |
var ComponentRef_ = (function (_super) { | |
__extends(ComponentRef_, _super); | |
/** | |
* @param {?} _view | |
* @param {?} _viewRef | |
* @param {?} _component | |
*/ | |
function ComponentRef_(_view, _viewRef, _component) { | |
var _this = _super.call(this) || this; | |
_this._view = _view; | |
_this._viewRef = _viewRef; | |
_this._component = _component; | |
_this._elDef = _this._view.def.nodes[0]; | |
return _this; | |
} | |
Object.defineProperty(ComponentRef_.prototype, "location", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return new ElementRef(asElementData(this._view, this._elDef.index).renderElement); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentRef_.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return new Injector_(this._view, this._elDef); }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ComponentRef_.prototype, "instance", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._component; }, | |
enumerable: true, | |
configurable: true | |
}); | |
; | |
Object.defineProperty(ComponentRef_.prototype, "hostView", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._viewRef; }, | |
enumerable: true, | |
configurable: true | |
}); | |
; | |
Object.defineProperty(ComponentRef_.prototype, "changeDetectorRef", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._viewRef; }, | |
enumerable: true, | |
configurable: true | |
}); | |
; | |
Object.defineProperty(ComponentRef_.prototype, "componentType", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return (this._component.constructor); }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); }; | |
/** | |
* @param {?} callback | |
* @return {?} | |
*/ | |
ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); }; | |
return ComponentRef_; | |
}(ComponentRef)); | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} elData | |
* @return {?} | |
*/ | |
function createViewContainerData(view, elDef, elData) { | |
return new ViewContainerRef_(view, elDef, elData); | |
} | |
var ViewContainerRef_ = (function () { | |
/** | |
* @param {?} _view | |
* @param {?} _elDef | |
* @param {?} _data | |
*/ | |
function ViewContainerRef_(_view, _elDef, _data) { | |
this._view = _view; | |
this._elDef = _elDef; | |
this._data = _data; | |
/** | |
* \@internal | |
*/ | |
this._embeddedViews = []; | |
} | |
Object.defineProperty(ViewContainerRef_.prototype, "element", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return new ElementRef(this._data.renderElement); }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ViewContainerRef_.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return new Injector_(this._view, this._elDef); }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ view = this._view; | |
var /** @type {?} */ elDef = this._elDef.parent; | |
while (!elDef && view) { | |
elDef = viewParentEl(view); | |
view = ((view.parent)); | |
} | |
return view ? new Injector_(view, elDef) : new Injector_(this._view, null); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.clear = function () { | |
var /** @type {?} */ len = this._embeddedViews.length; | |
for (var /** @type {?} */ i = len - 1; i >= 0; i--) { | |
var /** @type {?} */ view = ((detachEmbeddedView(this._data, i))); | |
Services.destroyView(view); | |
} | |
}; | |
/** | |
* @param {?} index | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.get = function (index) { | |
var /** @type {?} */ view = this._embeddedViews[index]; | |
if (view) { | |
var /** @type {?} */ ref = new ViewRef_(view); | |
ref.attachToViewContainerRef(this); | |
return ref; | |
} | |
return null; | |
}; | |
Object.defineProperty(ViewContainerRef_.prototype, "length", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._embeddedViews.length; }, | |
enumerable: true, | |
configurable: true | |
}); | |
; | |
/** | |
* @template C | |
* @param {?} templateRef | |
* @param {?=} context | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) { | |
var /** @type {?} */ viewRef = templateRef.createEmbeddedView(context || ({})); | |
this.insert(viewRef, index); | |
return viewRef; | |
}; | |
/** | |
* @template C | |
* @param {?} componentFactory | |
* @param {?=} index | |
* @param {?=} injector | |
* @param {?=} projectableNodes | |
* @param {?=} ngModuleRef | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) { | |
var /** @type {?} */ contextInjector = injector || this.parentInjector; | |
if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) { | |
ngModuleRef = contextInjector.get(NgModuleRef); | |
} | |
var /** @type {?} */ componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef); | |
this.insert(componentRef.hostView, index); | |
return componentRef; | |
}; | |
/** | |
* @param {?} viewRef | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.insert = function (viewRef, index) { | |
var /** @type {?} */ viewRef_ = (viewRef); | |
var /** @type {?} */ viewData = viewRef_._view; | |
attachEmbeddedView(this._view, this._data, index, viewData); | |
viewRef_.attachToViewContainerRef(this); | |
return viewRef; | |
}; | |
/** | |
* @param {?} viewRef | |
* @param {?} currentIndex | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.move = function (viewRef, currentIndex) { | |
var /** @type {?} */ previousIndex = this._embeddedViews.indexOf(viewRef._view); | |
moveEmbeddedView(this._data, previousIndex, currentIndex); | |
return viewRef; | |
}; | |
/** | |
* @param {?} viewRef | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.indexOf = function (viewRef) { | |
return this._embeddedViews.indexOf(((viewRef))._view); | |
}; | |
/** | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.remove = function (index) { | |
var /** @type {?} */ viewData = detachEmbeddedView(this._data, index); | |
if (viewData) { | |
Services.destroyView(viewData); | |
} | |
}; | |
/** | |
* @param {?=} index | |
* @return {?} | |
*/ | |
ViewContainerRef_.prototype.detach = function (index) { | |
var /** @type {?} */ view = detachEmbeddedView(this._data, index); | |
return view ? new ViewRef_(view) : null; | |
}; | |
return ViewContainerRef_; | |
}()); | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function createChangeDetectorRef(view) { | |
return new ViewRef_(view); | |
} | |
var ViewRef_ = (function () { | |
/** | |
* @param {?} _view | |
*/ | |
function ViewRef_(_view) { | |
this._view = _view; | |
this._viewContainerRef = null; | |
this._appRef = null; | |
} | |
Object.defineProperty(ViewRef_.prototype, "rootNodes", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return rootRenderNodes(this._view); }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ViewRef_.prototype, "context", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._view.context; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(ViewRef_.prototype, "destroyed", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return (this._view.state & 8 /* Destroyed */) !== 0; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); }; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.detach = function () { this._view.state &= ~2 /* ChecksEnabled */; }; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.detectChanges = function () { Services.checkAndUpdateView(this._view); }; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); }; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.reattach = function () { this._view.state |= 2 /* ChecksEnabled */; }; | |
/** | |
* @param {?} callback | |
* @return {?} | |
*/ | |
ViewRef_.prototype.onDestroy = function (callback) { | |
if (!this._view.disposables) { | |
this._view.disposables = []; | |
} | |
this._view.disposables.push(/** @type {?} */ (callback)); | |
}; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.destroy = function () { | |
if (this._appRef) { | |
this._appRef.detachView(this); | |
} | |
else if (this._viewContainerRef) { | |
this._viewContainerRef.detach(this._viewContainerRef.indexOf(this)); | |
} | |
Services.destroyView(this._view); | |
}; | |
/** | |
* @return {?} | |
*/ | |
ViewRef_.prototype.detachFromAppRef = function () { | |
this._appRef = null; | |
renderDetachView(this._view); | |
Services.dirtyParentQueries(this._view); | |
}; | |
/** | |
* @param {?} appRef | |
* @return {?} | |
*/ | |
ViewRef_.prototype.attachToAppRef = function (appRef) { | |
if (this._viewContainerRef) { | |
throw new Error('This view is already attached to a ViewContainer!'); | |
} | |
this._appRef = appRef; | |
}; | |
/** | |
* @param {?} vcRef | |
* @return {?} | |
*/ | |
ViewRef_.prototype.attachToViewContainerRef = function (vcRef) { | |
if (this._appRef) { | |
throw new Error('This view is already attached directly to the ApplicationRef!'); | |
} | |
this._viewContainerRef = vcRef; | |
}; | |
return ViewRef_; | |
}()); | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createTemplateData(view, def) { | |
return new TemplateRef_(view, def); | |
} | |
var TemplateRef_ = (function (_super) { | |
__extends(TemplateRef_, _super); | |
/** | |
* @param {?} _parentView | |
* @param {?} _def | |
*/ | |
function TemplateRef_(_parentView, _def) { | |
var _this = _super.call(this) || this; | |
_this._parentView = _parentView; | |
_this._def = _def; | |
return _this; | |
} | |
/** | |
* @param {?} context | |
* @return {?} | |
*/ | |
TemplateRef_.prototype.createEmbeddedView = function (context) { | |
return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, context)); | |
}; | |
Object.defineProperty(TemplateRef_.prototype, "elementRef", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return new ElementRef(asElementData(this._parentView, this._def.index).renderElement); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
return TemplateRef_; | |
}(TemplateRef)); | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @return {?} | |
*/ | |
function createInjector(view, elDef) { | |
return new Injector_(view, elDef); | |
} | |
var Injector_ = (function () { | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
*/ | |
function Injector_(view, elDef) { | |
this.view = view; | |
this.elDef = elDef; | |
} | |
/** | |
* @param {?} token | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
Injector_.prototype.get = function (token, notFoundValue) { | |
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; } | |
var /** @type {?} */ allowPrivateServices = this.elDef ? (this.elDef.flags & 16777216 /* ComponentView */) !== 0 : false; | |
return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue); | |
}; | |
return Injector_; | |
}()); | |
/** | |
* @param {?} view | |
* @param {?} index | |
* @return {?} | |
*/ | |
function nodeValue(view, index) { | |
var /** @type {?} */ def = view.def.nodes[index]; | |
if (def.flags & 1 /* TypeElement */) { | |
var /** @type {?} */ elData = asElementData(view, def.index); | |
return ((def.element)).template ? elData.template : elData.renderElement; | |
} | |
else if (def.flags & 2 /* TypeText */) { | |
return asTextData(view, def.index).renderText; | |
} | |
else if (def.flags & (10112 /* CatProvider */ | 8 /* TypePipe */)) { | |
return asProviderData(view, def.index).instance; | |
} | |
throw new Error("Illegal state: read nodeValue for node index " + index); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function createRendererV1(view) { | |
return new RendererAdapter(view.renderer); | |
} | |
var RendererAdapter = (function () { | |
/** | |
* @param {?} delegate | |
*/ | |
function RendererAdapter(delegate) { | |
this.delegate = delegate; | |
} | |
/** | |
* @param {?} selectorOrNode | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.selectRootElement = function (selectorOrNode) { | |
return this.delegate.selectRootElement(selectorOrNode); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} namespaceAndName | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.createElement = function (parent, namespaceAndName) { | |
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1]; | |
var /** @type {?} */ el = this.delegate.createElement(name, ns); | |
if (parent) { | |
this.delegate.appendChild(parent, el); | |
} | |
return el; | |
}; | |
/** | |
* @param {?} hostElement | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; }; | |
/** | |
* @param {?} parentElement | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.createTemplateAnchor = function (parentElement) { | |
var /** @type {?} */ comment = this.delegate.createComment(''); | |
if (parentElement) { | |
this.delegate.appendChild(parentElement, comment); | |
} | |
return comment; | |
}; | |
/** | |
* @param {?} parentElement | |
* @param {?} value | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.createText = function (parentElement, value) { | |
var /** @type {?} */ node = this.delegate.createText(value); | |
if (parentElement) { | |
this.delegate.appendChild(parentElement, node); | |
} | |
return node; | |
}; | |
/** | |
* @param {?} parentElement | |
* @param {?} nodes | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.projectNodes = function (parentElement, nodes) { | |
for (var /** @type {?} */ i = 0; i < nodes.length; i++) { | |
this.delegate.appendChild(parentElement, nodes[i]); | |
} | |
}; | |
/** | |
* @param {?} node | |
* @param {?} viewRootNodes | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) { | |
var /** @type {?} */ parentElement = this.delegate.parentNode(node); | |
var /** @type {?} */ nextSibling = this.delegate.nextSibling(node); | |
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { | |
this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling); | |
} | |
}; | |
/** | |
* @param {?} viewRootNodes | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.detachView = function (viewRootNodes) { | |
for (var /** @type {?} */ i = 0; i < viewRootNodes.length; i++) { | |
var /** @type {?} */ node = viewRootNodes[i]; | |
var /** @type {?} */ parentElement = this.delegate.parentNode(node); | |
this.delegate.removeChild(parentElement, node); | |
} | |
}; | |
/** | |
* @param {?} hostElement | |
* @param {?} viewAllNodes | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) { | |
for (var /** @type {?} */ i = 0; i < viewAllNodes.length; i++) { | |
((this.delegate.destroyNode))(viewAllNodes[i]); | |
} | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} name | |
* @param {?} callback | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.listen = function (renderElement, name, callback) { | |
return this.delegate.listen(renderElement, name, /** @type {?} */ (callback)); | |
}; | |
/** | |
* @param {?} target | |
* @param {?} name | |
* @param {?} callback | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.listenGlobal = function (target, name, callback) { | |
return this.delegate.listen(target, name, /** @type {?} */ (callback)); | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} propertyName | |
* @param {?} propertyValue | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) { | |
this.delegate.setProperty(renderElement, propertyName, propertyValue); | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} namespaceAndName | |
* @param {?} attributeValue | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) { | |
var _a = splitNamespace(namespaceAndName), ns = _a[0], name = _a[1]; | |
if (attributeValue != null) { | |
this.delegate.setAttribute(renderElement, name, attributeValue, ns); | |
} | |
else { | |
this.delegate.removeAttribute(renderElement, name, ns); | |
} | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} propertyName | |
* @param {?} propertyValue | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { }; | |
/** | |
* @param {?} renderElement | |
* @param {?} className | |
* @param {?} isAdd | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) { | |
if (isAdd) { | |
this.delegate.addClass(renderElement, className); | |
} | |
else { | |
this.delegate.removeClass(renderElement, className); | |
} | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} styleName | |
* @param {?} styleValue | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) { | |
if (styleValue != null) { | |
this.delegate.setStyle(renderElement, styleName, styleValue); | |
} | |
else { | |
this.delegate.removeStyle(renderElement, styleName); | |
} | |
}; | |
/** | |
* @param {?} renderElement | |
* @param {?} methodName | |
* @param {?} args | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) { | |
((renderElement))[methodName].apply(renderElement, args); | |
}; | |
/** | |
* @param {?} renderNode | |
* @param {?} text | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); }; | |
/** | |
* @return {?} | |
*/ | |
RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); }; | |
return RendererAdapter; | |
}()); | |
/** | |
* @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 RendererV1TokenKey = tokenKey(Renderer); | |
var Renderer2TokenKey = tokenKey(Renderer2); | |
var ElementRefTokenKey = tokenKey(ElementRef); | |
var ViewContainerRefTokenKey = tokenKey(ViewContainerRef); | |
var TemplateRefTokenKey = tokenKey(TemplateRef); | |
var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef); | |
var InjectorRefTokenKey = tokenKey(Injector); | |
var NOT_CREATED = new Object(); | |
/** | |
* @param {?} flags | |
* @param {?} matchedQueries | |
* @param {?} childCount | |
* @param {?} ctor | |
* @param {?} deps | |
* @param {?=} props | |
* @param {?=} outputs | |
* @return {?} | |
*/ | |
function directiveDef(flags, matchedQueries, childCount, ctor, deps, props, outputs) { | |
var /** @type {?} */ bindings = []; | |
if (props) { | |
for (var /** @type {?} */ prop in props) { | |
var _a = props[prop], bindingIndex = _a[0], nonMinifiedName = _a[1]; | |
bindings[bindingIndex] = { | |
flags: 8 /* TypeProperty */, | |
name: prop, nonMinifiedName: nonMinifiedName, | |
ns: null, | |
securityContext: null, | |
suffix: null | |
}; | |
} | |
} | |
var /** @type {?} */ outputDefs = []; | |
if (outputs) { | |
for (var /** @type {?} */ propName in outputs) { | |
outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] }); | |
} | |
} | |
flags |= 8192 /* TypeDirective */; | |
return _def(flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs); | |
} | |
/** | |
* @param {?} flags | |
* @param {?} ctor | |
* @param {?} deps | |
* @return {?} | |
*/ | |
function pipeDef(flags, ctor, deps) { | |
flags |= 8 /* TypePipe */; | |
return _def(flags, null, 0, ctor, ctor, deps); | |
} | |
/** | |
* @param {?} flags | |
* @param {?} matchedQueries | |
* @param {?} token | |
* @param {?} value | |
* @param {?} deps | |
* @return {?} | |
*/ | |
function providerDef(flags, matchedQueries, token, value, deps) { | |
return _def(flags, matchedQueries, 0, token, value, deps); | |
} | |
/** | |
* @param {?} flags | |
* @param {?} matchedQueriesDsl | |
* @param {?} childCount | |
* @param {?} token | |
* @param {?} value | |
* @param {?} deps | |
* @param {?=} bindings | |
* @param {?=} outputs | |
* @return {?} | |
*/ | |
function _def(flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) { | |
var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds; | |
if (!outputs) { | |
outputs = []; | |
} | |
if (!bindings) { | |
bindings = []; | |
} | |
var /** @type {?} */ depDefs = deps.map(function (value) { | |
var /** @type {?} */ token; | |
var /** @type {?} */ flags; | |
if (Array.isArray(value)) { | |
flags = value[0], token = value[1]; | |
} | |
else { | |
flags = 0 /* None */; | |
token = value; | |
} | |
return { flags: flags, token: token, tokenKey: tokenKey(token) }; | |
}); | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, | |
ngContentIndex: -1, childCount: childCount, bindings: bindings, | |
bindingFlags: calcBindingFlags(bindings), outputs: outputs, | |
element: null, | |
provider: { token: token, tokenKey: tokenKey(token), value: value, deps: depDefs }, | |
text: null, | |
query: null, | |
ngContent: null | |
}; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createProviderInstance(view, def) { | |
return def.flags & 2048 /* LazyProvider */ ? NOT_CREATED : _createProviderInstance(view, def); | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createPipeInstance(view, def) { | |
// deps are looked up from component. | |
var /** @type {?} */ compView = view; | |
while (compView.parent && !isComponentView(compView)) { | |
compView = compView.parent; | |
} | |
// pipes can see the private services of the component | |
var /** @type {?} */ allowPrivateServices = true; | |
// pipes are always eager and classes! | |
return createClass(/** @type {?} */ ((compView.parent)), /** @type {?} */ ((viewParentEl(compView))), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createDirectiveInstance(view, def) { | |
// components can see other private services, other directives can't. | |
var /** @type {?} */ allowPrivateServices = (def.flags & 16384 /* Component */) > 0; | |
// directives are always eager and classes! | |
var /** @type {?} */ instance = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((def.provider)).value, /** @type {?} */ ((def.provider)).deps); | |
if (def.outputs.length) { | |
for (var /** @type {?} */ i = 0; i < def.outputs.length; i++) { | |
var /** @type {?} */ output = def.outputs[i]; | |
var /** @type {?} */ subscription = instance[((output.propName))].subscribe(eventHandlerClosure(view, /** @type {?} */ ((def.parent)).index, output.eventName)); /** @type {?} */ | |
((view.disposables))[def.outputIndex + i] = subscription.unsubscribe.bind(subscription); | |
} | |
} | |
return instance; | |
} | |
/** | |
* @param {?} view | |
* @param {?} index | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
function eventHandlerClosure(view, index, eventName) { | |
return function (event) { return dispatchEvent(view, index, eventName, event); }; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} v0 | |
* @param {?} v1 | |
* @param {?} v2 | |
* @param {?} v3 | |
* @param {?} v4 | |
* @param {?} v5 | |
* @param {?} v6 | |
* @param {?} v7 | |
* @param {?} v8 | |
* @param {?} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ providerData = asProviderData(view, def.index); | |
var /** @type {?} */ directive = providerData.instance; | |
var /** @type {?} */ changed = false; | |
var /** @type {?} */ changes = ((undefined)); | |
var /** @type {?} */ bindLen = def.bindings.length; | |
if (bindLen > 0 && checkBinding(view, def, 0, v0)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 0, v0, changes); | |
} | |
if (bindLen > 1 && checkBinding(view, def, 1, v1)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 1, v1, changes); | |
} | |
if (bindLen > 2 && checkBinding(view, def, 2, v2)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 2, v2, changes); | |
} | |
if (bindLen > 3 && checkBinding(view, def, 3, v3)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 3, v3, changes); | |
} | |
if (bindLen > 4 && checkBinding(view, def, 4, v4)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 4, v4, changes); | |
} | |
if (bindLen > 5 && checkBinding(view, def, 5, v5)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 5, v5, changes); | |
} | |
if (bindLen > 6 && checkBinding(view, def, 6, v6)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 6, v6, changes); | |
} | |
if (bindLen > 7 && checkBinding(view, def, 7, v7)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 7, v7, changes); | |
} | |
if (bindLen > 8 && checkBinding(view, def, 8, v8)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 8, v8, changes); | |
} | |
if (bindLen > 9 && checkBinding(view, def, 9, v9)) { | |
changed = true; | |
changes = updateProp(view, providerData, def, 9, v9, changes); | |
} | |
if (changes) { | |
directive.ngOnChanges(changes); | |
} | |
if ((view.state & 1 /* FirstCheck */) && (def.flags & 32768 /* OnInit */)) { | |
directive.ngOnInit(); | |
} | |
if (def.flags & 131072 /* DoCheck */) { | |
directive.ngDoCheck(); | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkAndUpdateDirectiveDynamic(view, def, values) { | |
var /** @type {?} */ providerData = asProviderData(view, def.index); | |
var /** @type {?} */ directive = providerData.instance; | |
var /** @type {?} */ changed = false; | |
var /** @type {?} */ changes = ((undefined)); | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
if (checkBinding(view, def, i, values[i])) { | |
changed = true; | |
changes = updateProp(view, providerData, def, i, values[i], changes); | |
} | |
} | |
if (changes) { | |
directive.ngOnChanges(changes); | |
} | |
if ((view.state & 1 /* FirstCheck */) && (def.flags & 32768 /* OnInit */)) { | |
directive.ngOnInit(); | |
} | |
if (def.flags & 131072 /* DoCheck */) { | |
directive.ngDoCheck(); | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function _createProviderInstance(view, def) { | |
// private services can see other private services | |
var /** @type {?} */ allowPrivateServices = (def.flags & 4096 /* PrivateProvider */) > 0; | |
var /** @type {?} */ providerDef = def.provider; | |
var /** @type {?} */ injectable; | |
switch (def.flags & 100673535 /* Types */) { | |
case 256 /* TypeClassProvider */: | |
injectable = createClass(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); | |
break; | |
case 512 /* TypeFactoryProvider */: | |
injectable = callFactory(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).value, /** @type {?} */ ((providerDef)).deps); | |
break; | |
case 1024 /* TypeUseExistingProvider */: | |
injectable = resolveDep(view, /** @type {?} */ ((def.parent)), allowPrivateServices, /** @type {?} */ ((providerDef)).deps[0]); | |
break; | |
case 128 /* TypeValueProvider */: | |
injectable = ((providerDef)).value; | |
break; | |
} | |
return injectable; | |
} | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} allowPrivateServices | |
* @param {?} ctor | |
* @param {?} deps | |
* @return {?} | |
*/ | |
function createClass(view, elDef, allowPrivateServices, ctor, deps) { | |
var /** @type {?} */ len = deps.length; | |
var /** @type {?} */ injectable; | |
switch (len) { | |
case 0: | |
injectable = new ctor(); | |
break; | |
case 1: | |
injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0])); | |
break; | |
case 2: | |
injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); | |
break; | |
case 3: | |
injectable = new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); | |
break; | |
default: | |
var /** @type {?} */ depValues = new Array(len); | |
for (var /** @type {?} */ i = 0; i < len; i++) { | |
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); | |
} | |
injectable = new (ctor.bind.apply(ctor, [void 0].concat(depValues)))(); | |
} | |
return injectable; | |
} | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} allowPrivateServices | |
* @param {?} factory | |
* @param {?} deps | |
* @return {?} | |
*/ | |
function callFactory(view, elDef, allowPrivateServices, factory, deps) { | |
var /** @type {?} */ len = deps.length; | |
var /** @type {?} */ injectable; | |
switch (len) { | |
case 0: | |
injectable = factory(); | |
break; | |
case 1: | |
injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0])); | |
break; | |
case 2: | |
injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1])); | |
break; | |
case 3: | |
injectable = factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2])); | |
break; | |
default: | |
var /** @type {?} */ depValues = Array(len); | |
for (var /** @type {?} */ i = 0; i < len; i++) { | |
depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]); | |
} | |
injectable = factory.apply(void 0, depValues); | |
} | |
return injectable; | |
} | |
// This default value is when checking the hierarchy for a token. | |
// | |
// It means both: | |
// - the token is not provided by the current injector, | |
// - only the element injectors should be checked (ie do not check module injectors | |
// | |
// mod1 | |
// / | |
// el1 mod2 | |
// \ / | |
// el2 | |
// | |
// When requesting el2.injector.get(token), we should check in the following order and return the | |
// first found value: | |
// - el2.injector.get(token, default) | |
// - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module | |
// - mod2.injector.get(token, default) | |
var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {}; | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} allowPrivateServices | |
* @param {?} depDef | |
* @param {?=} notFoundValue | |
* @return {?} | |
*/ | |
function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) { | |
if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; } | |
if (depDef.flags & 8 /* Value */) { | |
return depDef.token; | |
} | |
var /** @type {?} */ startView = view; | |
if (depDef.flags & 2 /* Optional */) { | |
notFoundValue = null; | |
} | |
var /** @type {?} */ tokenKey$$1 = depDef.tokenKey; | |
if (elDef && (depDef.flags & 1 /* SkipSelf */)) { | |
allowPrivateServices = false; | |
elDef = ((elDef.parent)); | |
} | |
while (view) { | |
if (elDef) { | |
switch (tokenKey$$1) { | |
case RendererV1TokenKey: { | |
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); | |
return createRendererV1(compView); | |
} | |
case Renderer2TokenKey: { | |
var /** @type {?} */ compView = findCompView(view, elDef, allowPrivateServices); | |
return compView.renderer; | |
} | |
case ElementRefTokenKey: | |
return new ElementRef(asElementData(view, elDef.index).renderElement); | |
case ViewContainerRefTokenKey: | |
return asElementData(view, elDef.index).viewContainer; | |
case TemplateRefTokenKey: { | |
if (((elDef.element)).template) { | |
return asElementData(view, elDef.index).template; | |
} | |
break; | |
} | |
case ChangeDetectorRefTokenKey: { | |
var /** @type {?} */ cdView = findCompView(view, elDef, allowPrivateServices); | |
return createChangeDetectorRef(cdView); | |
} | |
case InjectorRefTokenKey: | |
return createInjector(view, elDef); | |
default: | |
var /** @type {?} */ providerDef_1 = (((allowPrivateServices ? ((elDef.element)).allProviders : ((elDef.element)).publicProviders)))[tokenKey$$1]; | |
if (providerDef_1) { | |
var /** @type {?} */ providerData = asProviderData(view, providerDef_1.index); | |
if (providerData.instance === NOT_CREATED) { | |
providerData.instance = _createProviderInstance(view, providerDef_1); | |
} | |
return providerData.instance; | |
} | |
} | |
} | |
allowPrivateServices = isComponentView(view); | |
elDef = ((viewParentEl(view))); | |
view = ((view.parent)); | |
} | |
var /** @type {?} */ value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR); | |
if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR || | |
notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) { | |
// Return the value from the root element injector when | |
// - it provides it | |
// (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) | |
// - the module injector should not be checked | |
// (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) | |
return value; | |
} | |
return startView.root.ngModule.injector.get(depDef.token, notFoundValue); | |
} | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} allowPrivateServices | |
* @return {?} | |
*/ | |
function findCompView(view, elDef, allowPrivateServices) { | |
var /** @type {?} */ compView; | |
if (allowPrivateServices) { | |
compView = asElementData(view, elDef.index).componentView; | |
} | |
else { | |
compView = view; | |
while (compView.parent && !isComponentView(compView)) { | |
compView = compView.parent; | |
} | |
} | |
return compView; | |
} | |
/** | |
* @param {?} view | |
* @param {?} providerData | |
* @param {?} def | |
* @param {?} bindingIdx | |
* @param {?} value | |
* @param {?} changes | |
* @return {?} | |
*/ | |
function updateProp(view, providerData, def, bindingIdx, value, changes) { | |
if (def.flags & 16384 /* Component */) { | |
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((def.parent)).index).componentView; | |
if (compView.def.flags & 2 /* OnPush */) { | |
compView.state |= 2 /* ChecksEnabled */; | |
} | |
} | |
var /** @type {?} */ binding = def.bindings[bindingIdx]; | |
var /** @type {?} */ propName = ((binding.name)); | |
// Note: This is still safe with Closure Compiler as | |
// the user passed in the property name as an object has to `providerDef`, | |
// so Closure Compiler will have renamed the property correctly already. | |
providerData.instance[propName] = value; | |
if (def.flags & 262144 /* OnChanges */) { | |
changes = changes || {}; | |
var /** @type {?} */ oldValue = view.oldValues[def.bindingIndex + bindingIdx]; | |
if (oldValue instanceof WrappedValue) { | |
oldValue = oldValue.wrapped; | |
} | |
var /** @type {?} */ binding_1 = def.bindings[bindingIdx]; | |
changes[((binding_1.nonMinifiedName))] = | |
new SimpleChange(oldValue, value, (view.state & 1 /* FirstCheck */) !== 0); | |
} | |
view.oldValues[def.bindingIndex + bindingIdx] = value; | |
return changes; | |
} | |
/** | |
* @param {?} view | |
* @param {?} lifecycles | |
* @return {?} | |
*/ | |
function callLifecycleHooksChildrenFirst(view, lifecycles) { | |
if (!(view.def.nodeFlags & lifecycles)) { | |
return; | |
} | |
var /** @type {?} */ nodes = view.def.nodes; | |
for (var /** @type {?} */ i = 0; i < nodes.length; i++) { | |
var /** @type {?} */ nodeDef = nodes[i]; | |
var /** @type {?} */ parent = nodeDef.parent; | |
if (!parent && nodeDef.flags & lifecycles) { | |
// matching root node (e.g. a pipe) | |
callProviderLifecycles(view, i, nodeDef.flags & lifecycles); | |
} | |
if ((nodeDef.childFlags & lifecycles) === 0) { | |
// no child matches one of the lifecycles | |
i += nodeDef.childCount; | |
} | |
while (parent && (parent.flags & 1 /* TypeElement */) && | |
i === parent.index + parent.childCount) { | |
// last child of an element | |
if (parent.directChildFlags & lifecycles) { | |
callElementProvidersLifecycles(view, parent, lifecycles); | |
} | |
parent = parent.parent; | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} elDef | |
* @param {?} lifecycles | |
* @return {?} | |
*/ | |
function callElementProvidersLifecycles(view, elDef, lifecycles) { | |
for (var /** @type {?} */ i = elDef.index + 1; i <= elDef.index + elDef.childCount; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if (nodeDef.flags & lifecycles) { | |
callProviderLifecycles(view, i, nodeDef.flags & lifecycles); | |
} | |
// only visit direct children | |
i += nodeDef.childCount; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} index | |
* @param {?} lifecycles | |
* @return {?} | |
*/ | |
function callProviderLifecycles(view, index, lifecycles) { | |
var /** @type {?} */ provider = asProviderData(view, index).instance; | |
if (provider === NOT_CREATED) { | |
return; | |
} | |
Services.setCurrentNode(view, index); | |
if (lifecycles & 524288 /* AfterContentInit */) { | |
provider.ngAfterContentInit(); | |
} | |
if (lifecycles & 1048576 /* AfterContentChecked */) { | |
provider.ngAfterContentChecked(); | |
} | |
if (lifecycles & 2097152 /* AfterViewInit */) { | |
provider.ngAfterViewInit(); | |
} | |
if (lifecycles & 4194304 /* AfterViewChecked */) { | |
provider.ngAfterViewChecked(); | |
} | |
if (lifecycles & 65536 /* OnDestroy */) { | |
provider.ngOnDestroy(); | |
} | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} argCount | |
* @return {?} | |
*/ | |
function purePipeDef(argCount) { | |
// argCount + 1 to include the pipe as first arg | |
return _pureExpressionDef(64 /* TypePurePipe */, new Array(argCount + 1)); | |
} | |
/** | |
* @param {?} argCount | |
* @return {?} | |
*/ | |
function pureArrayDef(argCount) { | |
return _pureExpressionDef(16 /* TypePureArray */, new Array(argCount)); | |
} | |
/** | |
* @param {?} propertyNames | |
* @return {?} | |
*/ | |
function pureObjectDef(propertyNames) { | |
return _pureExpressionDef(32 /* TypePureObject */, propertyNames); | |
} | |
/** | |
* @param {?} flags | |
* @param {?} propertyNames | |
* @return {?} | |
*/ | |
function _pureExpressionDef(flags, propertyNames) { | |
var /** @type {?} */ bindings = new Array(propertyNames.length); | |
for (var /** @type {?} */ i = 0; i < propertyNames.length; i++) { | |
var /** @type {?} */ prop = propertyNames[i]; | |
bindings[i] = { | |
flags: 8 /* TypeProperty */, | |
name: prop, | |
ns: null, | |
nonMinifiedName: prop, | |
securityContext: null, | |
suffix: null | |
}; | |
} | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, | |
matchedQueries: {}, | |
matchedQueryIds: 0, | |
references: {}, | |
ngContentIndex: -1, | |
childCount: 0, bindings: bindings, | |
bindingFlags: calcBindingFlags(bindings), | |
outputs: [], | |
element: null, | |
provider: null, | |
text: null, | |
query: null, | |
ngContent: null | |
}; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createPureExpression(view, def) { | |
return { value: undefined }; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} v0 | |
* @param {?} v1 | |
* @param {?} v2 | |
* @param {?} v3 | |
* @param {?} v4 | |
* @param {?} v5 | |
* @param {?} v6 | |
* @param {?} v7 | |
* @param {?} v8 | |
* @param {?} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ bindings = def.bindings; | |
var /** @type {?} */ changed = false; | |
var /** @type {?} */ bindLen = bindings.length; | |
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) | |
changed = true; | |
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) | |
changed = true; | |
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) | |
changed = true; | |
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) | |
changed = true; | |
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) | |
changed = true; | |
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) | |
changed = true; | |
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) | |
changed = true; | |
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) | |
changed = true; | |
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) | |
changed = true; | |
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) | |
changed = true; | |
if (changed) { | |
var /** @type {?} */ data = asPureExpressionData(view, def.index); | |
var /** @type {?} */ value = void 0; | |
switch (def.flags & 100673535 /* Types */) { | |
case 16 /* TypePureArray */: | |
value = new Array(bindings.length); | |
if (bindLen > 0) | |
value[0] = v0; | |
if (bindLen > 1) | |
value[1] = v1; | |
if (bindLen > 2) | |
value[2] = v2; | |
if (bindLen > 3) | |
value[3] = v3; | |
if (bindLen > 4) | |
value[4] = v4; | |
if (bindLen > 5) | |
value[5] = v5; | |
if (bindLen > 6) | |
value[6] = v6; | |
if (bindLen > 7) | |
value[7] = v7; | |
if (bindLen > 8) | |
value[8] = v8; | |
if (bindLen > 9) | |
value[9] = v9; | |
break; | |
case 32 /* TypePureObject */: | |
value = {}; | |
if (bindLen > 0) | |
value[((bindings[0].name))] = v0; | |
if (bindLen > 1) | |
value[((bindings[1].name))] = v1; | |
if (bindLen > 2) | |
value[((bindings[2].name))] = v2; | |
if (bindLen > 3) | |
value[((bindings[3].name))] = v3; | |
if (bindLen > 4) | |
value[((bindings[4].name))] = v4; | |
if (bindLen > 5) | |
value[((bindings[5].name))] = v5; | |
if (bindLen > 6) | |
value[((bindings[6].name))] = v6; | |
if (bindLen > 7) | |
value[((bindings[7].name))] = v7; | |
if (bindLen > 8) | |
value[((bindings[8].name))] = v8; | |
if (bindLen > 9) | |
value[((bindings[9].name))] = v9; | |
break; | |
case 64 /* TypePurePipe */: | |
var /** @type {?} */ pipe = v0; | |
switch (bindLen) { | |
case 1: | |
value = pipe.transform(v0); | |
break; | |
case 2: | |
value = pipe.transform(v1); | |
break; | |
case 3: | |
value = pipe.transform(v1, v2); | |
break; | |
case 4: | |
value = pipe.transform(v1, v2, v3); | |
break; | |
case 5: | |
value = pipe.transform(v1, v2, v3, v4); | |
break; | |
case 6: | |
value = pipe.transform(v1, v2, v3, v4, v5); | |
break; | |
case 7: | |
value = pipe.transform(v1, v2, v3, v4, v5, v6); | |
break; | |
case 8: | |
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7); | |
break; | |
case 9: | |
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8); | |
break; | |
case 10: | |
value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
break; | |
} | |
break; | |
} | |
data.value = value; | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkAndUpdatePureExpressionDynamic(view, def, values) { | |
var /** @type {?} */ bindings = def.bindings; | |
var /** @type {?} */ changed = false; | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
// Note: We need to loop over all values, so that | |
// the old values are updates as well! | |
if (checkAndUpdateBinding(view, def, i, values[i])) { | |
changed = true; | |
} | |
} | |
if (changed) { | |
var /** @type {?} */ data = asPureExpressionData(view, def.index); | |
var /** @type {?} */ value = void 0; | |
switch (def.flags & 100673535 /* Types */) { | |
case 16 /* TypePureArray */: | |
value = values; | |
break; | |
case 32 /* TypePureObject */: | |
value = {}; | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
value[((bindings[i].name))] = values[i]; | |
} | |
break; | |
case 64 /* TypePurePipe */: | |
var /** @type {?} */ pipe = values[0]; | |
var /** @type {?} */ params = values.slice(1); | |
value = pipe.transform.apply(pipe, params); | |
break; | |
} | |
data.value = value; | |
} | |
return changed; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} flags | |
* @param {?} id | |
* @param {?} bindings | |
* @return {?} | |
*/ | |
function queryDef(flags, id, bindings) { | |
var /** @type {?} */ bindingDefs = []; | |
for (var /** @type {?} */ propName in bindings) { | |
var /** @type {?} */ bindingType = bindings[propName]; | |
bindingDefs.push({ propName: propName, bindingType: bindingType }); | |
} | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, | |
ngContentIndex: -1, | |
matchedQueries: {}, | |
matchedQueryIds: 0, | |
references: {}, | |
childCount: 0, | |
bindings: [], | |
bindingFlags: 0, | |
outputs: [], | |
element: null, | |
provider: null, | |
text: null, | |
query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs }, | |
ngContent: null | |
}; | |
} | |
/** | |
* @return {?} | |
*/ | |
function createQuery() { | |
return new QueryList(); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function dirtyParentQueries(view) { | |
var /** @type {?} */ queryIds = view.def.nodeMatchedQueries; | |
while (view.parent && isEmbeddedView(view)) { | |
var /** @type {?} */ tplDef = ((view.parentNodeDef)); | |
view = view.parent; | |
// content queries | |
var /** @type {?} */ end = tplDef.index + tplDef.childCount; | |
for (var /** @type {?} */ i = 0; i <= end; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if ((nodeDef.flags & 33554432 /* TypeContentQuery */) && | |
(nodeDef.flags & 268435456 /* DynamicQuery */) && | |
(((nodeDef.query)).filterId & queryIds) === ((nodeDef.query)).filterId) { | |
asQueryList(view, i).setDirty(); | |
} | |
if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.index) || | |
!(nodeDef.childFlags & 33554432 /* TypeContentQuery */) || | |
!(nodeDef.childFlags & 268435456 /* DynamicQuery */)) { | |
// skip elements that don't contain the template element or no query. | |
i += nodeDef.childCount; | |
} | |
} | |
} | |
// view queries | |
if (view.def.nodeFlags & 67108864 /* TypeViewQuery */) { | |
for (var /** @type {?} */ i = 0; i < view.def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if ((nodeDef.flags & 67108864 /* TypeViewQuery */) && (nodeDef.flags & 268435456 /* DynamicQuery */)) { | |
asQueryList(view, i).setDirty(); | |
} | |
// only visit the root nodes | |
i += nodeDef.childCount; | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @return {?} | |
*/ | |
function checkAndUpdateQuery(view, nodeDef) { | |
var /** @type {?} */ queryList = asQueryList(view, nodeDef.index); | |
if (!queryList.dirty) { | |
return; | |
} | |
var /** @type {?} */ directiveInstance; | |
var /** @type {?} */ newValues = ((undefined)); | |
if (nodeDef.flags & 33554432 /* TypeContentQuery */) { | |
var /** @type {?} */ elementDef_1 = ((((nodeDef.parent)).parent)); | |
newValues = calcQueryValues(view, elementDef_1.index, elementDef_1.index + elementDef_1.childCount, /** @type {?} */ ((nodeDef.query)), []); | |
directiveInstance = asProviderData(view, /** @type {?} */ ((nodeDef.parent)).index).instance; | |
} | |
else if (nodeDef.flags & 67108864 /* TypeViewQuery */) { | |
newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, /** @type {?} */ ((nodeDef.query)), []); | |
directiveInstance = view.component; | |
} | |
queryList.reset(newValues); | |
var /** @type {?} */ bindings = ((nodeDef.query)).bindings; | |
var /** @type {?} */ notify = false; | |
for (var /** @type {?} */ i = 0; i < bindings.length; i++) { | |
var /** @type {?} */ binding = bindings[i]; | |
var /** @type {?} */ boundValue = void 0; | |
switch (binding.bindingType) { | |
case 0 /* First */: | |
boundValue = queryList.first; | |
break; | |
case 1 /* All */: | |
boundValue = queryList; | |
notify = true; | |
break; | |
} | |
directiveInstance[binding.propName] = boundValue; | |
} | |
if (notify) { | |
queryList.notifyOnChanges(); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} startIndex | |
* @param {?} endIndex | |
* @param {?} queryDef | |
* @param {?} values | |
* @return {?} | |
*/ | |
function calcQueryValues(view, startIndex, endIndex, queryDef, values) { | |
for (var /** @type {?} */ i = startIndex; i <= endIndex; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
var /** @type {?} */ valueType = nodeDef.matchedQueries[queryDef.id]; | |
if (valueType != null) { | |
values.push(getQueryValue(view, nodeDef, valueType)); | |
} | |
if (nodeDef.flags & 1 /* TypeElement */ && ((nodeDef.element)).template && | |
(((((nodeDef.element)).template)).nodeMatchedQueries & queryDef.filterId) === | |
queryDef.filterId) { | |
// check embedded views that were attached at the place of their template. | |
var /** @type {?} */ elementData = asElementData(view, i); | |
if (nodeDef.flags & 8388608 /* EmbeddedViews */) { | |
var /** @type {?} */ embeddedViews = ((elementData.viewContainer))._embeddedViews; | |
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { | |
var /** @type {?} */ embeddedView = embeddedViews[k]; | |
var /** @type {?} */ dvc = declaredViewContainer(embeddedView); | |
if (dvc && dvc === elementData) { | |
calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values); | |
} | |
} | |
} | |
var /** @type {?} */ projectedViews = elementData.template._projectedViews; | |
if (projectedViews) { | |
for (var /** @type {?} */ k = 0; k < projectedViews.length; k++) { | |
var /** @type {?} */ projectedView = projectedViews[k]; | |
calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values); | |
} | |
} | |
} | |
if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) { | |
// if no child matches the query, skip the children. | |
i += nodeDef.childCount; | |
} | |
} | |
return values; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} queryValueType | |
* @return {?} | |
*/ | |
function getQueryValue(view, nodeDef, queryValueType) { | |
if (queryValueType != null) { | |
// a match | |
var /** @type {?} */ value = void 0; | |
switch (queryValueType) { | |
case 1 /* RenderElement */: | |
value = asElementData(view, nodeDef.index).renderElement; | |
break; | |
case 0 /* ElementRef */: | |
value = new ElementRef(asElementData(view, nodeDef.index).renderElement); | |
break; | |
case 2 /* TemplateRef */: | |
value = asElementData(view, nodeDef.index).template; | |
break; | |
case 3 /* ViewContainerRef */: | |
value = asElementData(view, nodeDef.index).viewContainer; | |
break; | |
case 4 /* Provider */: | |
value = asProviderData(view, nodeDef.index).instance; | |
break; | |
} | |
return value; | |
} | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} ngContentIndex | |
* @param {?} constants | |
* @return {?} | |
*/ | |
function textDef(ngContentIndex, constants) { | |
var /** @type {?} */ bindings = new Array(constants.length - 1); | |
for (var /** @type {?} */ i = 1; i < constants.length; i++) { | |
bindings[i - 1] = { | |
flags: 8 /* TypeProperty */, | |
name: null, | |
ns: null, | |
nonMinifiedName: null, | |
securityContext: null, | |
suffix: constants[i] | |
}; | |
} | |
var /** @type {?} */ flags = 2; | |
return { | |
// will bet set by the view definition | |
index: -1, | |
parent: null, | |
renderParent: null, | |
bindingIndex: -1, | |
outputIndex: -1, | |
// regular values | |
flags: flags, | |
childFlags: 0, | |
directChildFlags: 0, | |
childMatchedQueries: 0, | |
matchedQueries: {}, | |
matchedQueryIds: 0, | |
references: {}, ngContentIndex: ngContentIndex, | |
childCount: 0, bindings: bindings, | |
bindingFlags: calcBindingFlags(bindings), | |
outputs: [], | |
element: null, | |
provider: null, | |
text: { prefix: constants[0] }, | |
query: null, | |
ngContent: null | |
}; | |
} | |
/** | |
* @param {?} view | |
* @param {?} renderHost | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createText(view, renderHost, def) { | |
var /** @type {?} */ renderNode$$1; | |
var /** @type {?} */ renderer = view.renderer; | |
renderNode$$1 = renderer.createText(/** @type {?} */ ((def.text)).prefix); | |
var /** @type {?} */ parentEl = getParentRenderElement(view, renderHost, def); | |
if (parentEl) { | |
renderer.appendChild(parentEl, renderNode$$1); | |
} | |
return { renderText: renderNode$$1 }; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} v0 | |
* @param {?} v1 | |
* @param {?} v2 | |
* @param {?} v3 | |
* @param {?} v4 | |
* @param {?} v5 | |
* @param {?} v6 | |
* @param {?} v7 | |
* @param {?} v8 | |
* @param {?} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ changed = false; | |
var /** @type {?} */ bindings = def.bindings; | |
var /** @type {?} */ bindLen = bindings.length; | |
if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0)) | |
changed = true; | |
if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1)) | |
changed = true; | |
if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2)) | |
changed = true; | |
if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3)) | |
changed = true; | |
if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4)) | |
changed = true; | |
if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5)) | |
changed = true; | |
if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6)) | |
changed = true; | |
if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7)) | |
changed = true; | |
if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8)) | |
changed = true; | |
if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9)) | |
changed = true; | |
if (changed) { | |
var /** @type {?} */ value = ((def.text)).prefix; | |
if (bindLen > 0) | |
value += _addInterpolationPart(v0, bindings[0]); | |
if (bindLen > 1) | |
value += _addInterpolationPart(v1, bindings[1]); | |
if (bindLen > 2) | |
value += _addInterpolationPart(v2, bindings[2]); | |
if (bindLen > 3) | |
value += _addInterpolationPart(v3, bindings[3]); | |
if (bindLen > 4) | |
value += _addInterpolationPart(v4, bindings[4]); | |
if (bindLen > 5) | |
value += _addInterpolationPart(v5, bindings[5]); | |
if (bindLen > 6) | |
value += _addInterpolationPart(v6, bindings[6]); | |
if (bindLen > 7) | |
value += _addInterpolationPart(v7, bindings[7]); | |
if (bindLen > 8) | |
value += _addInterpolationPart(v8, bindings[8]); | |
if (bindLen > 9) | |
value += _addInterpolationPart(v9, bindings[9]); | |
var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText; | |
view.renderer.setValue(renderNode$$1, value); | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} def | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkAndUpdateTextDynamic(view, def, values) { | |
var /** @type {?} */ bindings = def.bindings; | |
var /** @type {?} */ changed = false; | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
// Note: We need to loop over all values, so that | |
// the old values are updates as well! | |
if (checkAndUpdateBinding(view, def, i, values[i])) { | |
changed = true; | |
} | |
} | |
if (changed) { | |
var /** @type {?} */ value = ''; | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
value = value + _addInterpolationPart(values[i], bindings[i]); | |
} | |
value = ((def.text)).prefix + value; | |
var /** @type {?} */ renderNode$$1 = asTextData(view, def.index).renderText; | |
view.renderer.setValue(renderNode$$1, value); | |
} | |
return changed; | |
} | |
/** | |
* @param {?} value | |
* @param {?} binding | |
* @return {?} | |
*/ | |
function _addInterpolationPart(value, binding) { | |
var /** @type {?} */ valueStr = value != null ? value.toString() : ''; | |
return valueStr + binding.suffix; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} flags | |
* @param {?} nodes | |
* @param {?=} updateDirectives | |
* @param {?=} updateRenderer | |
* @return {?} | |
*/ | |
function viewDef(flags, nodes, updateDirectives, updateRenderer) { | |
// clone nodes and set auto calculated values | |
var /** @type {?} */ viewBindingCount = 0; | |
var /** @type {?} */ viewDisposableCount = 0; | |
var /** @type {?} */ viewNodeFlags = 0; | |
var /** @type {?} */ viewRootNodeFlags = 0; | |
var /** @type {?} */ viewMatchedQueries = 0; | |
var /** @type {?} */ currentParent = null; | |
var /** @type {?} */ currentElementHasPublicProviders = false; | |
var /** @type {?} */ currentElementHasPrivateProviders = false; | |
var /** @type {?} */ lastRenderRootNode = null; | |
for (var /** @type {?} */ i = 0; i < nodes.length; i++) { | |
while (currentParent && i > currentParent.index + currentParent.childCount) { | |
var /** @type {?} */ newParent = currentParent.parent; | |
if (newParent) { | |
newParent.childFlags |= ((currentParent.childFlags)); | |
newParent.childMatchedQueries |= currentParent.childMatchedQueries; | |
} | |
currentParent = newParent; | |
} | |
var /** @type {?} */ node = nodes[i]; | |
node.index = i; | |
node.parent = currentParent; | |
node.bindingIndex = viewBindingCount; | |
node.outputIndex = viewDisposableCount; | |
// renderParent needs to account for ng-container! | |
var /** @type {?} */ currentRenderParent = void 0; | |
if (currentParent && currentParent.flags & 1 /* TypeElement */ && | |
!((currentParent.element)).name) { | |
currentRenderParent = currentParent.renderParent; | |
} | |
else { | |
currentRenderParent = currentParent; | |
} | |
node.renderParent = currentRenderParent; | |
if (node.element) { | |
var /** @type {?} */ elDef = node.element; | |
elDef.publicProviders = | |
currentParent ? ((currentParent.element)).publicProviders : Object.create(null); | |
elDef.allProviders = elDef.publicProviders; | |
// Note: We assume that all providers of an element are before any child element! | |
currentElementHasPublicProviders = false; | |
currentElementHasPrivateProviders = false; | |
} | |
validateNode(currentParent, node, nodes.length); | |
viewNodeFlags |= node.flags; | |
viewMatchedQueries |= node.matchedQueryIds; | |
if (node.element && node.element.template) { | |
viewMatchedQueries |= node.element.template.nodeMatchedQueries; | |
} | |
if (currentParent) { | |
currentParent.childFlags |= node.flags; | |
currentParent.directChildFlags |= node.flags; | |
currentParent.childMatchedQueries |= node.matchedQueryIds; | |
if (node.element && node.element.template) { | |
currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries; | |
} | |
} | |
else { | |
viewRootNodeFlags |= node.flags; | |
} | |
viewBindingCount += node.bindings.length; | |
viewDisposableCount += node.outputs.length; | |
if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) { | |
lastRenderRootNode = node; | |
} | |
if (node.flags & 10112 /* CatProvider */) { | |
if (!currentElementHasPublicProviders) { | |
currentElementHasPublicProviders = true; /** @type {?} */ | |
(((( | |
// Use prototypical inheritance to not get O(n^2) complexity... | |
currentParent)).element)).publicProviders = | |
Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); /** @type {?} */ | |
((((currentParent)).element)).allProviders = ((((currentParent)).element)).publicProviders; | |
} | |
var /** @type {?} */ isPrivateService = (node.flags & 4096 /* PrivateProvider */) !== 0; | |
var /** @type {?} */ isComponent = (node.flags & 16384 /* Component */) !== 0; | |
if (!isPrivateService || isComponent) { | |
((((((currentParent)).element)).publicProviders))[((node.provider)).tokenKey] = node; | |
} | |
else { | |
if (!currentElementHasPrivateProviders) { | |
currentElementHasPrivateProviders = true; /** @type {?} */ | |
(((( | |
// Use protoyypical inheritance to not get O(n^2) complexity... | |
currentParent)).element)).allProviders = | |
Object.create(/** @type {?} */ ((((currentParent)).element)).publicProviders); | |
} /** @type {?} */ | |
((((((currentParent)).element)).allProviders))[((node.provider)).tokenKey] = node; | |
} | |
if (isComponent) { | |
((((currentParent)).element)).componentProvider = node; | |
} | |
} | |
if (node.childCount) { | |
currentParent = node; | |
} | |
} | |
while (currentParent) { | |
var /** @type {?} */ newParent = currentParent.parent; | |
if (newParent) { | |
newParent.childFlags |= currentParent.childFlags; | |
newParent.childMatchedQueries |= currentParent.childMatchedQueries; | |
} | |
currentParent = newParent; | |
} | |
var /** @type {?} */ handleEvent = function (view, nodeIndex, eventName, event) { return ((((nodes[nodeIndex].element)).handleEvent))(view, eventName, event); }; | |
return { | |
// Will be filled later... | |
factory: null, | |
nodeFlags: viewNodeFlags, | |
rootNodeFlags: viewRootNodeFlags, | |
nodeMatchedQueries: viewMatchedQueries, flags: flags, | |
nodes: nodes, | |
updateDirectives: updateDirectives || NOOP, | |
updateRenderer: updateRenderer || NOOP, | |
handleEvent: handleEvent || NOOP, | |
bindingCount: viewBindingCount, | |
outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode | |
}; | |
} | |
/** | |
* @param {?} parent | |
* @param {?} node | |
* @param {?} nodeCount | |
* @return {?} | |
*/ | |
function validateNode(parent, node, nodeCount) { | |
var /** @type {?} */ template = node.element && node.element.template; | |
if (template) { | |
if (!template.lastRenderRootNode) { | |
throw new Error("Illegal State: Embedded templates without nodes are not allowed!"); | |
} | |
if (template.lastRenderRootNode && | |
template.lastRenderRootNode.flags & 8388608 /* EmbeddedViews */) { | |
throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.index + "!"); | |
} | |
} | |
if (node.flags & 10112 /* CatProvider */) { | |
var /** @type {?} */ parentFlags = parent ? parent.flags : 0; | |
if ((parentFlags & 1 /* TypeElement */) === 0) { | |
throw new Error("Illegal State: Provider/Directive nodes need to be children of elements or anchors, at index " + node.index + "!"); | |
} | |
} | |
if (node.query) { | |
if (node.flags & 33554432 /* TypeContentQuery */ && | |
(!parent || (parent.flags & 8192 /* TypeDirective */) === 0)) { | |
throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.index + "!"); | |
} | |
if (node.flags & 67108864 /* TypeViewQuery */ && parent) { | |
throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.index + "!"); | |
} | |
} | |
if (node.childCount) { | |
var /** @type {?} */ parentEnd = parent ? parent.index + parent.childCount : nodeCount - 1; | |
if (node.index <= parentEnd && node.index + node.childCount > parentEnd) { | |
throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.index + "!"); | |
} | |
} | |
} | |
/** | |
* @param {?} parent | |
* @param {?} anchorDef | |
* @param {?=} context | |
* @return {?} | |
*/ | |
function createEmbeddedView(parent, anchorDef$$1, context) { | |
// embedded views are seen as siblings to the anchor, so we need | |
// to get the parent of the anchor and use it as parentIndex. | |
var /** @type {?} */ view = createView(parent.root, parent.renderer, parent, anchorDef$$1, /** @type {?} */ ((((anchorDef$$1.element)).template))); | |
initView(view, parent.component, context); | |
createViewNodes(view); | |
return view; | |
} | |
/** | |
* @param {?} root | |
* @param {?} def | |
* @param {?=} context | |
* @return {?} | |
*/ | |
function createRootView(root, def, context) { | |
var /** @type {?} */ view = createView(root, root.renderer, null, null, def); | |
initView(view, context, context); | |
createViewNodes(view); | |
return view; | |
} | |
/** | |
* @param {?} root | |
* @param {?} renderer | |
* @param {?} parent | |
* @param {?} parentNodeDef | |
* @param {?} def | |
* @return {?} | |
*/ | |
function createView(root, renderer, parent, parentNodeDef, def) { | |
var /** @type {?} */ nodes = new Array(def.nodes.length); | |
var /** @type {?} */ disposables = def.outputCount ? new Array(def.outputCount) : null; | |
var /** @type {?} */ view = { | |
def: def, | |
parent: parent, | |
viewContainerParent: null, parentNodeDef: parentNodeDef, | |
context: null, | |
component: null, nodes: nodes, | |
state: 1 /* FirstCheck */ | 2 /* ChecksEnabled */, root: root, renderer: renderer, | |
oldValues: new Array(def.bindingCount), disposables: disposables | |
}; | |
return view; | |
} | |
/** | |
* @param {?} view | |
* @param {?} component | |
* @param {?} context | |
* @return {?} | |
*/ | |
function initView(view, component, context) { | |
view.component = component; | |
view.context = context; | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function createViewNodes(view) { | |
var /** @type {?} */ renderHost; | |
if (isComponentView(view)) { | |
var /** @type {?} */ hostDef = view.parentNodeDef; | |
renderHost = asElementData(/** @type {?} */ ((view.parent)), /** @type {?} */ ((((hostDef)).parent)).index).renderElement; | |
} | |
var /** @type {?} */ def = view.def; | |
var /** @type {?} */ nodes = view.nodes; | |
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = def.nodes[i]; | |
Services.setCurrentNode(view, i); | |
var /** @type {?} */ nodeData = void 0; | |
switch (nodeDef.flags & 100673535 /* Types */) { | |
case 1 /* TypeElement */: | |
var /** @type {?} */ el = (createElement(view, renderHost, nodeDef)); | |
var /** @type {?} */ componentView = ((undefined)); | |
if (nodeDef.flags & 16777216 /* ComponentView */) { | |
var /** @type {?} */ compViewDef = resolveViewDefinition(/** @type {?} */ ((((nodeDef.element)).componentView))); | |
var /** @type {?} */ rendererType = ((nodeDef.element)).componentRendererType; | |
var /** @type {?} */ compRenderer = void 0; | |
if (!rendererType) { | |
compRenderer = view.root.renderer; | |
} | |
else { | |
compRenderer = view.root.rendererFactory.createRenderer(el, rendererType); | |
} | |
componentView = createView(view.root, compRenderer, view, /** @type {?} */ ((nodeDef.element)).componentProvider, compViewDef); | |
} | |
listenToElementOutputs(view, componentView, nodeDef, el); | |
nodeData = ({ | |
renderElement: el, | |
componentView: componentView, | |
viewContainer: null, | |
template: /** @type {?} */ ((nodeDef.element)).template ? createTemplateData(view, nodeDef) : undefined | |
}); | |
if (nodeDef.flags & 8388608 /* EmbeddedViews */) { | |
nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData); | |
} | |
break; | |
case 2 /* TypeText */: | |
nodeData = (createText(view, renderHost, nodeDef)); | |
break; | |
case 256 /* TypeClassProvider */: | |
case 512 /* TypeFactoryProvider */: | |
case 1024 /* TypeUseExistingProvider */: | |
case 128 /* TypeValueProvider */: { | |
var /** @type {?} */ instance = createProviderInstance(view, nodeDef); | |
nodeData = ({ instance: instance }); | |
break; | |
} | |
case 8 /* TypePipe */: { | |
var /** @type {?} */ instance = createPipeInstance(view, nodeDef); | |
nodeData = ({ instance: instance }); | |
break; | |
} | |
case 8192 /* TypeDirective */: { | |
var /** @type {?} */ instance = createDirectiveInstance(view, nodeDef); | |
nodeData = ({ instance: instance }); | |
if (nodeDef.flags & 16384 /* Component */) { | |
var /** @type {?} */ compView = asElementData(view, /** @type {?} */ ((nodeDef.parent)).index).componentView; | |
initView(compView, instance, instance); | |
} | |
break; | |
} | |
case 16 /* TypePureArray */: | |
case 32 /* TypePureObject */: | |
case 64 /* TypePurePipe */: | |
nodeData = (createPureExpression(view, nodeDef)); | |
break; | |
case 33554432 /* TypeContentQuery */: | |
case 67108864 /* TypeViewQuery */: | |
nodeData = (createQuery()); | |
break; | |
case 4 /* TypeNgContent */: | |
appendNgContent(view, renderHost, nodeDef); | |
// no runtime data needed for NgContent... | |
nodeData = undefined; | |
break; | |
} | |
nodes[i] = nodeData; | |
} | |
// Create the ViewData.nodes of component views after we created everything else, | |
// so that e.g. ng-content works | |
execComponentViewsAction(view, ViewAction.CreateViewNodes); | |
// fill static content and view queries | |
execQueriesAction(view, 33554432 /* TypeContentQuery */ | 67108864 /* TypeViewQuery */, 134217728 /* StaticQuery */, 0 /* CheckAndUpdate */); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function checkNoChangesView(view) { | |
Services.updateDirectives(view, 1 /* CheckNoChanges */); | |
execEmbeddedViewsAction(view, ViewAction.CheckNoChanges); | |
Services.updateRenderer(view, 1 /* CheckNoChanges */); | |
execComponentViewsAction(view, ViewAction.CheckNoChanges); | |
// Note: We don't check queries for changes as we didn't do this in v2.x. | |
// TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message. | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function checkAndUpdateView(view) { | |
Services.updateDirectives(view, 0 /* CheckAndUpdate */); | |
execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate); | |
execQueriesAction(view, 33554432 /* TypeContentQuery */, 268435456 /* DynamicQuery */, 0 /* CheckAndUpdate */); | |
callLifecycleHooksChildrenFirst(view, 1048576 /* AfterContentChecked */ | | |
(view.state & 1 /* FirstCheck */ ? 524288 /* AfterContentInit */ : 0)); | |
Services.updateRenderer(view, 0 /* CheckAndUpdate */); | |
execComponentViewsAction(view, ViewAction.CheckAndUpdate); | |
execQueriesAction(view, 67108864 /* TypeViewQuery */, 268435456 /* DynamicQuery */, 0 /* CheckAndUpdate */); | |
callLifecycleHooksChildrenFirst(view, 4194304 /* AfterViewChecked */ | | |
(view.state & 1 /* FirstCheck */ ? 2097152 /* AfterViewInit */ : 0)); | |
if (view.def.flags & 2 /* OnPush */) { | |
view.state &= ~2 /* ChecksEnabled */; | |
} | |
view.state &= ~1 /* FirstCheck */; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} argStyle | |
* @param {?=} v0 | |
* @param {?=} v1 | |
* @param {?=} v2 | |
* @param {?=} v3 | |
* @param {?=} v4 | |
* @param {?=} v5 | |
* @param {?=} v6 | |
* @param {?=} v7 | |
* @param {?=} v8 | |
* @param {?=} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
if (argStyle === 0 /* Inline */) { | |
return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
} | |
else { | |
return checkAndUpdateNodeDynamic(view, nodeDef, v0); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?=} v0 | |
* @param {?=} v1 | |
* @param {?=} v2 | |
* @param {?=} v3 | |
* @param {?=} v4 | |
* @param {?=} v5 | |
* @param {?=} v6 | |
* @param {?=} v7 | |
* @param {?=} v8 | |
* @param {?=} v9 | |
* @return {?} | |
*/ | |
function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ changed = false; | |
switch (nodeDef.flags & 100673535 /* Types */) { | |
case 1 /* TypeElement */: | |
changed = checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
break; | |
case 2 /* TypeText */: | |
changed = checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
break; | |
case 8192 /* TypeDirective */: | |
changed = | |
checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
break; | |
case 16 /* TypePureArray */: | |
case 32 /* TypePureObject */: | |
case 64 /* TypePurePipe */: | |
changed = | |
checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
break; | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkAndUpdateNodeDynamic(view, nodeDef, values) { | |
var /** @type {?} */ changed = false; | |
switch (nodeDef.flags & 100673535 /* Types */) { | |
case 1 /* TypeElement */: | |
changed = checkAndUpdateElementDynamic(view, nodeDef, values); | |
break; | |
case 2 /* TypeText */: | |
changed = checkAndUpdateTextDynamic(view, nodeDef, values); | |
break; | |
case 8192 /* TypeDirective */: | |
changed = checkAndUpdateDirectiveDynamic(view, nodeDef, values); | |
break; | |
case 16 /* TypePureArray */: | |
case 32 /* TypePureObject */: | |
case 64 /* TypePurePipe */: | |
changed = checkAndUpdatePureExpressionDynamic(view, nodeDef, values); | |
break; | |
} | |
if (changed) { | |
// Update oldValues after all bindings have been updated, | |
// as a setter for a property might update other properties. | |
var /** @type {?} */ bindLen = nodeDef.bindings.length; | |
var /** @type {?} */ bindingStart = nodeDef.bindingIndex; | |
var /** @type {?} */ oldValues = view.oldValues; | |
for (var /** @type {?} */ i = 0; i < bindLen; i++) { | |
oldValues[bindingStart + i] = values[i]; | |
} | |
} | |
return changed; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} argStyle | |
* @param {?=} v0 | |
* @param {?=} v1 | |
* @param {?=} v2 | |
* @param {?=} v3 | |
* @param {?=} v4 | |
* @param {?=} v5 | |
* @param {?=} v6 | |
* @param {?=} v7 | |
* @param {?=} v8 | |
* @param {?=} v9 | |
* @return {?} | |
*/ | |
function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
if (argStyle === 0 /* Inline */) { | |
checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
} | |
else { | |
checkNoChangesNodeDynamic(view, nodeDef, v0); | |
} | |
// Returning false is ok here as we would have thrown in case of a change. | |
return false; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} v0 | |
* @param {?} v1 | |
* @param {?} v2 | |
* @param {?} v3 | |
* @param {?} v4 | |
* @param {?} v5 | |
* @param {?} v6 | |
* @param {?} v7 | |
* @param {?} v8 | |
* @param {?} v9 | |
* @return {?} | |
*/ | |
function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ bindLen = nodeDef.bindings.length; | |
if (bindLen > 0) | |
checkBindingNoChanges(view, nodeDef, 0, v0); | |
if (bindLen > 1) | |
checkBindingNoChanges(view, nodeDef, 1, v1); | |
if (bindLen > 2) | |
checkBindingNoChanges(view, nodeDef, 2, v2); | |
if (bindLen > 3) | |
checkBindingNoChanges(view, nodeDef, 3, v3); | |
if (bindLen > 4) | |
checkBindingNoChanges(view, nodeDef, 4, v4); | |
if (bindLen > 5) | |
checkBindingNoChanges(view, nodeDef, 5, v5); | |
if (bindLen > 6) | |
checkBindingNoChanges(view, nodeDef, 6, v6); | |
if (bindLen > 7) | |
checkBindingNoChanges(view, nodeDef, 7, v7); | |
if (bindLen > 8) | |
checkBindingNoChanges(view, nodeDef, 8, v8); | |
if (bindLen > 9) | |
checkBindingNoChanges(view, nodeDef, 9, v9); | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} values | |
* @return {?} | |
*/ | |
function checkNoChangesNodeDynamic(view, nodeDef, values) { | |
for (var /** @type {?} */ i = 0; i < values.length; i++) { | |
checkBindingNoChanges(view, nodeDef, i, values[i]); | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @return {?} | |
*/ | |
function checkNoChangesQuery(view, nodeDef) { | |
var /** @type {?} */ queryList = asQueryList(view, nodeDef.index); | |
if (queryList.dirty) { | |
throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.index), "Query " + ((nodeDef.query)).id + " not dirty", "Query " + ((nodeDef.query)).id + " dirty", (view.state & 1 /* FirstCheck */) !== 0); | |
} | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function destroyView(view) { | |
if (view.state & 8 /* Destroyed */) { | |
return; | |
} | |
execEmbeddedViewsAction(view, ViewAction.Destroy); | |
execComponentViewsAction(view, ViewAction.Destroy); | |
callLifecycleHooksChildrenFirst(view, 65536 /* OnDestroy */); | |
if (view.disposables) { | |
for (var /** @type {?} */ i = 0; i < view.disposables.length; i++) { | |
view.disposables[i](); | |
} | |
} | |
if (view.renderer.destroyNode) { | |
destroyViewNodes(view); | |
} | |
if (isComponentView(view)) { | |
view.renderer.destroy(); | |
} | |
view.state |= 8 /* Destroyed */; | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function destroyViewNodes(view) { | |
var /** @type {?} */ len = view.def.nodes.length; | |
for (var /** @type {?} */ i = 0; i < len; i++) { | |
var /** @type {?} */ def = view.def.nodes[i]; | |
if (def.flags & 1 /* TypeElement */) { | |
((view.renderer.destroyNode))(asElementData(view, i).renderElement); | |
} | |
else if (def.flags & 2 /* TypeText */) { | |
((view.renderer.destroyNode))(asTextData(view, i).renderText); | |
} | |
} | |
} | |
var ViewAction = {}; | |
ViewAction.CreateViewNodes = 0; | |
ViewAction.CheckNoChanges = 1; | |
ViewAction.CheckAndUpdate = 2; | |
ViewAction.Destroy = 3; | |
ViewAction[ViewAction.CreateViewNodes] = "CreateViewNodes"; | |
ViewAction[ViewAction.CheckNoChanges] = "CheckNoChanges"; | |
ViewAction[ViewAction.CheckAndUpdate] = "CheckAndUpdate"; | |
ViewAction[ViewAction.Destroy] = "Destroy"; | |
/** | |
* @param {?} view | |
* @param {?} action | |
* @return {?} | |
*/ | |
function execComponentViewsAction(view, action) { | |
var /** @type {?} */ def = view.def; | |
if (!(def.nodeFlags & 16777216 /* ComponentView */)) { | |
return; | |
} | |
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = def.nodes[i]; | |
if (nodeDef.flags & 16777216 /* ComponentView */) { | |
// a leaf | |
callViewAction(asElementData(view, i).componentView, action); | |
} | |
else if ((nodeDef.childFlags & 16777216 /* ComponentView */) === 0) { | |
// a parent with leafs | |
// no child is a component, | |
// then skip the children | |
i += nodeDef.childCount; | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} action | |
* @return {?} | |
*/ | |
function execEmbeddedViewsAction(view, action) { | |
var /** @type {?} */ def = view.def; | |
if (!(def.nodeFlags & 8388608 /* EmbeddedViews */)) { | |
return; | |
} | |
for (var /** @type {?} */ i = 0; i < def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = def.nodes[i]; | |
if (nodeDef.flags & 8388608 /* EmbeddedViews */) { | |
// a leaf | |
var /** @type {?} */ embeddedViews = ((asElementData(view, i).viewContainer))._embeddedViews; | |
for (var /** @type {?} */ k = 0; k < embeddedViews.length; k++) { | |
callViewAction(embeddedViews[k], action); | |
} | |
} | |
else if ((nodeDef.childFlags & 8388608 /* EmbeddedViews */) === 0) { | |
// a parent with leafs | |
// no child is a component, | |
// then skip the children | |
i += nodeDef.childCount; | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} action | |
* @return {?} | |
*/ | |
function callViewAction(view, action) { | |
var /** @type {?} */ viewState = view.state; | |
switch (action) { | |
case ViewAction.CheckNoChanges: | |
if ((viewState & 2 /* ChecksEnabled */) && | |
(viewState & (4 /* Errored */ | 8 /* Destroyed */)) === 0) { | |
checkNoChangesView(view); | |
} | |
break; | |
case ViewAction.CheckAndUpdate: | |
if ((viewState & 2 /* ChecksEnabled */) && | |
(viewState & (4 /* Errored */ | 8 /* Destroyed */)) === 0) { | |
checkAndUpdateView(view); | |
} | |
break; | |
case ViewAction.Destroy: | |
destroyView(view); | |
break; | |
case ViewAction.CreateViewNodes: | |
createViewNodes(view); | |
break; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} queryFlags | |
* @param {?} staticDynamicQueryFlag | |
* @param {?} checkType | |
* @return {?} | |
*/ | |
function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) { | |
if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) { | |
return; | |
} | |
var /** @type {?} */ nodeCount = view.def.nodes.length; | |
for (var /** @type {?} */ i = 0; i < nodeCount; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) { | |
Services.setCurrentNode(view, nodeDef.index); | |
switch (checkType) { | |
case 0 /* CheckAndUpdate */: | |
checkAndUpdateQuery(view, nodeDef); | |
break; | |
case 1 /* CheckNoChanges */: | |
checkNoChangesQuery(view, nodeDef); | |
break; | |
} | |
} | |
if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) { | |
// no child has a matching query | |
// then skip the children | |
i += nodeDef.childCount; | |
} | |
} | |
} | |
/** | |
* @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 initialized = false; | |
/** | |
* @return {?} | |
*/ | |
function initServicesIfNeeded() { | |
if (initialized) { | |
return; | |
} | |
initialized = true; | |
var /** @type {?} */ services = isDevMode() ? createDebugServices() : createProdServices(); | |
Services.setCurrentNode = services.setCurrentNode; | |
Services.createRootView = services.createRootView; | |
Services.createEmbeddedView = services.createEmbeddedView; | |
Services.checkAndUpdateView = services.checkAndUpdateView; | |
Services.checkNoChangesView = services.checkNoChangesView; | |
Services.destroyView = services.destroyView; | |
Services.resolveDep = resolveDep; | |
Services.createDebugContext = services.createDebugContext; | |
Services.handleEvent = services.handleEvent; | |
Services.updateDirectives = services.updateDirectives; | |
Services.updateRenderer = services.updateRenderer; | |
Services.dirtyParentQueries = dirtyParentQueries; | |
} | |
/** | |
* @return {?} | |
*/ | |
function createProdServices() { | |
return { | |
setCurrentNode: function () { }, | |
createRootView: createProdRootView, | |
createEmbeddedView: createEmbeddedView, | |
checkAndUpdateView: checkAndUpdateView, | |
checkNoChangesView: checkNoChangesView, | |
destroyView: destroyView, | |
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, | |
handleEvent: function (view, nodeIndex, eventName, event) { return view.def.handleEvent(view, nodeIndex, eventName, event); }, | |
updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : | |
prodCheckNoChangesNode, view); }, | |
updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode : | |
prodCheckNoChangesNode, view); }, | |
}; | |
} | |
/** | |
* @return {?} | |
*/ | |
function createDebugServices() { | |
return { | |
setCurrentNode: debugSetCurrentNode, | |
createRootView: debugCreateRootView, | |
createEmbeddedView: debugCreateEmbeddedView, | |
checkAndUpdateView: debugCheckAndUpdateView, | |
checkNoChangesView: debugCheckNoChangesView, | |
destroyView: debugDestroyView, | |
createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); }, | |
handleEvent: debugHandleEvent, | |
updateDirectives: debugUpdateDirectives, | |
updateRenderer: debugUpdateRenderer | |
}; | |
} | |
/** | |
* @param {?} elInjector | |
* @param {?} projectableNodes | |
* @param {?} rootSelectorOrNode | |
* @param {?} def | |
* @param {?} ngModule | |
* @param {?=} context | |
* @return {?} | |
*/ | |
function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { | |
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); | |
return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context); | |
} | |
/** | |
* @param {?} elInjector | |
* @param {?} projectableNodes | |
* @param {?} rootSelectorOrNode | |
* @param {?} def | |
* @param {?} ngModule | |
* @param {?=} context | |
* @return {?} | |
*/ | |
function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) { | |
var /** @type {?} */ rendererFactory = ngModule.injector.get(RendererFactory2); | |
var /** @type {?} */ root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode); | |
return callWithDebugContext(DebugAction.create, createRootView, null, [root, def, context]); | |
} | |
/** | |
* @param {?} elInjector | |
* @param {?} ngModule | |
* @param {?} rendererFactory | |
* @param {?} projectableNodes | |
* @param {?} rootSelectorOrNode | |
* @return {?} | |
*/ | |
function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) { | |
var /** @type {?} */ sanitizer = ngModule.injector.get(Sanitizer); | |
var /** @type {?} */ renderer = rendererFactory.createRenderer(null, null); | |
return { | |
ngModule: ngModule, | |
injector: elInjector, projectableNodes: projectableNodes, | |
selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer | |
}; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} argStyle | |
* @param {?=} v0 | |
* @param {?=} v1 | |
* @param {?=} v2 | |
* @param {?=} v3 | |
* @param {?=} v4 | |
* @param {?=} v5 | |
* @param {?=} v6 | |
* @param {?=} v7 | |
* @param {?=} v8 | |
* @param {?=} v9 | |
* @return {?} | |
*/ | |
function prodCheckAndUpdateNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; | |
checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
return (nodeDef.flags & 112 /* CatPureExpression */) ? | |
asPureExpressionData(view, nodeIndex).value : | |
undefined; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} argStyle | |
* @param {?=} v0 | |
* @param {?=} v1 | |
* @param {?=} v2 | |
* @param {?=} v3 | |
* @param {?=} v4 | |
* @param {?=} v5 | |
* @param {?=} v6 | |
* @param {?=} v7 | |
* @param {?=} v8 | |
* @param {?=} v9 | |
* @return {?} | |
*/ | |
function prodCheckNoChangesNode(view, nodeIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) { | |
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; | |
checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9); | |
return (nodeDef.flags & 112 /* CatPureExpression */) ? | |
asPureExpressionData(view, nodeIndex).value : | |
undefined; | |
} | |
/** | |
* @param {?} parent | |
* @param {?} anchorDef | |
* @param {?=} context | |
* @return {?} | |
*/ | |
function debugCreateEmbeddedView(parent, anchorDef, context) { | |
return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parent, anchorDef, context]); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function debugCheckAndUpdateView(view) { | |
return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function debugCheckNoChangesView(view) { | |
return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]); | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function debugDestroyView(view) { | |
return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]); | |
} | |
var DebugAction = {}; | |
DebugAction.create = 0; | |
DebugAction.detectChanges = 1; | |
DebugAction.checkNoChanges = 2; | |
DebugAction.destroy = 3; | |
DebugAction.handleEvent = 4; | |
DebugAction[DebugAction.create] = "create"; | |
DebugAction[DebugAction.detectChanges] = "detectChanges"; | |
DebugAction[DebugAction.checkNoChanges] = "checkNoChanges"; | |
DebugAction[DebugAction.destroy] = "destroy"; | |
DebugAction[DebugAction.handleEvent] = "handleEvent"; | |
var _currentAction; | |
var _currentView; | |
var _currentNodeIndex; | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @return {?} | |
*/ | |
function debugSetCurrentNode(view, nodeIndex) { | |
_currentView = view; | |
_currentNodeIndex = nodeIndex; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} eventName | |
* @param {?} event | |
* @return {?} | |
*/ | |
function debugHandleEvent(view, nodeIndex, eventName, event) { | |
debugSetCurrentNode(view, nodeIndex); | |
return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]); | |
} | |
/** | |
* @param {?} view | |
* @param {?} checkType | |
* @return {?} | |
*/ | |
function debugUpdateDirectives(view, checkType) { | |
if (view.state & 8 /* Destroyed */) { | |
throw viewDestroyedError(DebugAction[_currentAction]); | |
} | |
debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0)); | |
return view.def.updateDirectives(debugCheckDirectivesFn, view); | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} argStyle | |
* @param {...?} values | |
* @return {?} | |
*/ | |
function debugCheckDirectivesFn(view, nodeIndex, argStyle) { | |
var values = []; | |
for (var _i = 3; _i < arguments.length; _i++) { | |
values[_i - 3] = arguments[_i]; | |
} | |
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; | |
if (checkType === 0 /* CheckAndUpdate */) { | |
debugCheckAndUpdateNode(view, nodeDef, argStyle, values); | |
} | |
else { | |
debugCheckNoChangesNode(view, nodeDef, argStyle, values); | |
} | |
if (nodeDef.flags & 8192 /* TypeDirective */) { | |
debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex)); | |
} | |
return (nodeDef.flags & 112 /* CatPureExpression */) ? | |
asPureExpressionData(view, nodeDef.index).value : | |
undefined; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} checkType | |
* @return {?} | |
*/ | |
function debugUpdateRenderer(view, checkType) { | |
if (view.state & 8 /* Destroyed */) { | |
throw viewDestroyedError(DebugAction[_currentAction]); | |
} | |
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0)); | |
return view.def.updateRenderer(debugCheckRenderNodeFn, view); | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @param {?} argStyle | |
* @param {...?} values | |
* @return {?} | |
*/ | |
function debugCheckRenderNodeFn(view, nodeIndex, argStyle) { | |
var values = []; | |
for (var _i = 3; _i < arguments.length; _i++) { | |
values[_i - 3] = arguments[_i]; | |
} | |
var /** @type {?} */ nodeDef = view.def.nodes[nodeIndex]; | |
if (checkType === 0 /* CheckAndUpdate */) { | |
debugCheckAndUpdateNode(view, nodeDef, argStyle, values); | |
} | |
else { | |
debugCheckNoChangesNode(view, nodeDef, argStyle, values); | |
} | |
if (nodeDef.flags & 3 /* CatRenderNode */) { | |
debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex)); | |
} | |
return (nodeDef.flags & 112 /* CatPureExpression */) ? | |
asPureExpressionData(view, nodeDef.index).value : | |
undefined; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} argStyle | |
* @param {?} givenValues | |
* @return {?} | |
*/ | |
function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) { | |
var /** @type {?} */ changed = ((checkAndUpdateNode)).apply(void 0, [view, nodeDef, argStyle].concat(givenValues)); | |
if (changed) { | |
var /** @type {?} */ values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues; | |
if (nodeDef.flags & 8192 /* TypeDirective */) { | |
var /** @type {?} */ bindingValues = {}; | |
for (var /** @type {?} */ i = 0; i < nodeDef.bindings.length; i++) { | |
var /** @type {?} */ binding = nodeDef.bindings[i]; | |
var /** @type {?} */ value = values[i]; | |
if (binding.flags & 8 /* TypeProperty */) { | |
bindingValues[normalizeDebugBindingName(/** @type {?} */ ((binding.nonMinifiedName)))] = | |
normalizeDebugBindingValue(value); | |
} | |
} | |
var /** @type {?} */ elDef = ((nodeDef.parent)); | |
var /** @type {?} */ el = asElementData(view, elDef.index).renderElement; | |
if (!((elDef.element)).name) { | |
// a comment. | |
view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2)); | |
} | |
else { | |
// a regular element. | |
for (var /** @type {?} */ attr in bindingValues) { | |
var /** @type {?} */ value = bindingValues[attr]; | |
if (value != null) { | |
view.renderer.setAttribute(el, attr, value); | |
} | |
else { | |
view.renderer.removeAttribute(el, attr); | |
} | |
} | |
} | |
} | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} argStyle | |
* @param {?} values | |
* @return {?} | |
*/ | |
function debugCheckNoChangesNode(view, nodeDef, argStyle, values) { | |
((checkNoChangesNode)).apply(void 0, [view, nodeDef, argStyle].concat(values)); | |
} | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
function normalizeDebugBindingName(name) { | |
// Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers | |
name = camelCaseToDashCase(name.replace(/[$@]/g, '_')); | |
return "ng-reflect-" + name; | |
} | |
var CAMEL_CASE_REGEXP = /([A-Z])/g; | |
/** | |
* @param {?} input | |
* @return {?} | |
*/ | |
function camelCaseToDashCase(input) { | |
return input.replace(CAMEL_CASE_REGEXP, function () { | |
var m = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
m[_i] = arguments[_i]; | |
} | |
return '-' + m[1].toLowerCase(); | |
}); | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function normalizeDebugBindingValue(value) { | |
try { | |
// Limit the size of the value as otherwise the DOM just gets polluted. | |
return value != null ? value.toString().slice(0, 30) : value; | |
} | |
catch (e) { | |
return '[ERROR] Exception while trying to serialize the value'; | |
} | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @return {?} | |
*/ | |
function nextDirectiveWithBinding(view, nodeIndex) { | |
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if (nodeDef.flags & 8192 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) { | |
return i; | |
} | |
} | |
return null; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
* @return {?} | |
*/ | |
function nextRenderNodeWithBinding(view, nodeIndex) { | |
for (var /** @type {?} */ i = nodeIndex; i < view.def.nodes.length; i++) { | |
var /** @type {?} */ nodeDef = view.def.nodes[i]; | |
if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) { | |
return i; | |
} | |
} | |
return null; | |
} | |
var DebugContext_ = (function () { | |
/** | |
* @param {?} view | |
* @param {?} nodeIndex | |
*/ | |
function DebugContext_(view, nodeIndex) { | |
this.view = view; | |
this.nodeIndex = nodeIndex; | |
if (nodeIndex == null) { | |
this.nodeIndex = nodeIndex = 0; | |
} | |
this.nodeDef = view.def.nodes[nodeIndex]; | |
var elDef = this.nodeDef; | |
var elView = view; | |
while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) { | |
elDef = elDef.parent; | |
} | |
if (!elDef) { | |
while (!elDef && elView) { | |
elDef = viewParentEl(elView); | |
elView = elView.parent; | |
} | |
} | |
this.elDef = elDef; | |
this.elView = elView; | |
} | |
Object.defineProperty(DebugContext_.prototype, "elOrCompView", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
// Has to be done lazily as we use the DebugContext also during creation of elements... | |
return asElementData(this.elView, this.elDef.index).componentView || this.view; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "injector", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return createInjector(this.elView, this.elDef); }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "component", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.elOrCompView.component; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "context", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.elOrCompView.context; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "providerTokens", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ tokens = []; | |
if (this.elDef) { | |
for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) { | |
var /** @type {?} */ childDef = this.elView.def.nodes[i]; | |
if (childDef.flags & 10112 /* CatProvider */) { | |
tokens.push(/** @type {?} */ ((childDef.provider)).token); | |
} | |
i += childDef.childCount; | |
} | |
} | |
return tokens; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "references", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ references = {}; | |
if (this.elDef) { | |
collectReferences(this.elView, this.elDef, references); | |
for (var /** @type {?} */ i = this.elDef.index + 1; i <= this.elDef.index + this.elDef.childCount; i++) { | |
var /** @type {?} */ childDef = this.elView.def.nodes[i]; | |
if (childDef.flags & 10112 /* CatProvider */) { | |
collectReferences(this.elView, childDef, references); | |
} | |
i += childDef.childCount; | |
} | |
} | |
return references; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "componentRenderElement", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
var /** @type {?} */ elData = findHostElement(this.elOrCompView); | |
return elData ? elData.renderElement : undefined; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(DebugContext_.prototype, "renderNode", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { | |
return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) : | |
renderNode(this.elView, this.elDef); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} console | |
* @param {...?} values | |
* @return {?} | |
*/ | |
DebugContext_.prototype.logError = function (console) { | |
var values = []; | |
for (var _i = 1; _i < arguments.length; _i++) { | |
values[_i - 1] = arguments[_i]; | |
} | |
var /** @type {?} */ logViewDef; | |
var /** @type {?} */ logNodeIndex; | |
if (this.nodeDef.flags & 2 /* TypeText */) { | |
logViewDef = this.view.def; | |
logNodeIndex = this.nodeDef.index; | |
} | |
else { | |
logViewDef = this.elView.def; | |
logNodeIndex = this.elDef.index; | |
} | |
// Note: we only generate a log function for text and element nodes | |
// to make the generated code as small as possible. | |
var /** @type {?} */ renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex); | |
var /** @type {?} */ currRenderNodeIndex = -1; | |
var /** @type {?} */ nodeLogger = function () { | |
currRenderNodeIndex++; | |
if (currRenderNodeIndex === renderNodeIndex) { | |
return (_a = console.error).bind.apply(_a, [console].concat(values)); | |
} | |
else { | |
return NOOP; | |
} | |
var _a; | |
}; /** @type {?} */ | |
((logViewDef.factory))(nodeLogger); | |
if (currRenderNodeIndex < renderNodeIndex) { | |
console.error('Illegal state: the ViewDefinitionFactory did not call the logger!'); | |
console.error.apply(console, values); | |
} | |
}; | |
return DebugContext_; | |
}()); | |
/** | |
* @param {?} viewDef | |
* @param {?} nodeIndex | |
* @return {?} | |
*/ | |
function getRenderNodeIndex(viewDef$$1, nodeIndex) { | |
var /** @type {?} */ renderNodeIndex = -1; | |
for (var /** @type {?} */ i = 0; i <= nodeIndex; i++) { | |
var /** @type {?} */ nodeDef = viewDef$$1.nodes[i]; | |
if (nodeDef.flags & 3 /* CatRenderNode */) { | |
renderNodeIndex++; | |
} | |
} | |
return renderNodeIndex; | |
} | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
function findHostElement(view) { | |
while (view && !isComponentView(view)) { | |
view = ((view.parent)); | |
} | |
if (view.parent) { | |
return asElementData(view.parent, /** @type {?} */ ((viewParentEl(view))).index); | |
} | |
return null; | |
} | |
/** | |
* @param {?} view | |
* @param {?} nodeDef | |
* @param {?} references | |
* @return {?} | |
*/ | |
function collectReferences(view, nodeDef, references) { | |
for (var /** @type {?} */ refName in nodeDef.references) { | |
references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]); | |
} | |
} | |
/** | |
* @param {?} action | |
* @param {?} fn | |
* @param {?} self | |
* @param {?} args | |
* @return {?} | |
*/ | |
function callWithDebugContext(action, fn, self, args) { | |
var /** @type {?} */ oldAction = _currentAction; | |
var /** @type {?} */ oldView = _currentView; | |
var /** @type {?} */ oldNodeIndex = _currentNodeIndex; | |
try { | |
_currentAction = action; | |
var /** @type {?} */ result = fn.apply(self, args); | |
_currentView = oldView; | |
_currentNodeIndex = oldNodeIndex; | |
_currentAction = oldAction; | |
return result; | |
} | |
catch (e) { | |
if (isViewDebugError(e) || !_currentView) { | |
throw e; | |
} | |
_currentView.state |= 4 /* Errored */; | |
throw viewWrappedDebugError(e, /** @type {?} */ ((getCurrentDebugContext()))); | |
} | |
} | |
/** | |
* @return {?} | |
*/ | |
function getCurrentDebugContext() { | |
return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null; | |
} | |
var DebugRendererFactory2 = (function () { | |
/** | |
* @param {?} delegate | |
*/ | |
function DebugRendererFactory2(delegate) { | |
this.delegate = delegate; | |
} | |
/** | |
* @param {?} element | |
* @param {?} renderData | |
* @return {?} | |
*/ | |
DebugRendererFactory2.prototype.createRenderer = function (element, renderData) { | |
return new DebugRenderer2(this.delegate.createRenderer(element, renderData)); | |
}; | |
return DebugRendererFactory2; | |
}()); | |
var DebugRenderer2 = (function () { | |
/** | |
* @param {?} delegate | |
*/ | |
function DebugRenderer2(delegate) { | |
this.delegate = delegate; | |
} | |
Object.defineProperty(DebugRenderer2.prototype, "data", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.delegate.data; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.destroyNode = function (node) { | |
removeDebugNodeFromIndex(/** @type {?} */ ((getDebugNode(node)))); | |
if (this.delegate.destroyNode) { | |
this.delegate.destroyNode(node); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); }; | |
/** | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.createElement = function (name, namespace) { | |
var /** @type {?} */ el = this.delegate.createElement(name, namespace); | |
var /** @type {?} */ debugCtx = getCurrentDebugContext(); | |
if (debugCtx) { | |
var /** @type {?} */ debugEl = new DebugElement(el, null, debugCtx); | |
debugEl.name = name; | |
indexDebugNode(debugEl); | |
} | |
return el; | |
}; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.createComment = function (value) { | |
var /** @type {?} */ comment = this.delegate.createComment(value); | |
var /** @type {?} */ debugCtx = getCurrentDebugContext(); | |
if (debugCtx) { | |
indexDebugNode(new DebugNode(comment, null, debugCtx)); | |
} | |
return comment; | |
}; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.createText = function (value) { | |
var /** @type {?} */ text = this.delegate.createText(value); | |
var /** @type {?} */ debugCtx = getCurrentDebugContext(); | |
if (debugCtx) { | |
indexDebugNode(new DebugNode(text, null, debugCtx)); | |
} | |
return text; | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.appendChild = function (parent, newChild) { | |
var /** @type {?} */ debugEl = getDebugNode(parent); | |
var /** @type {?} */ debugChildEl = getDebugNode(newChild); | |
if (debugEl && debugChildEl && debugEl instanceof DebugElement) { | |
debugEl.addChild(debugChildEl); | |
} | |
this.delegate.appendChild(parent, newChild); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @param {?} refChild | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) { | |
var /** @type {?} */ debugEl = getDebugNode(parent); | |
var /** @type {?} */ debugChildEl = getDebugNode(newChild); | |
var /** @type {?} */ debugRefEl = ((getDebugNode(refChild))); | |
if (debugEl && debugChildEl && debugEl instanceof DebugElement) { | |
debugEl.insertBefore(debugRefEl, debugChildEl); | |
} | |
this.delegate.insertBefore(parent, newChild, refChild); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} oldChild | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.removeChild = function (parent, oldChild) { | |
var /** @type {?} */ debugEl = getDebugNode(parent); | |
var /** @type {?} */ debugChildEl = getDebugNode(oldChild); | |
if (debugEl && debugChildEl && debugEl instanceof DebugElement) { | |
debugEl.removeChild(debugChildEl); | |
} | |
this.delegate.removeChild(parent, oldChild); | |
}; | |
/** | |
* @param {?} selectorOrNode | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) { | |
var /** @type {?} */ el = this.delegate.selectRootElement(selectorOrNode); | |
var /** @type {?} */ debugCtx = getCurrentDebugContext(); | |
if (debugCtx) { | |
indexDebugNode(new DebugElement(el, null, debugCtx)); | |
} | |
return el; | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; | |
debugEl.attributes[fullName] = value; | |
} | |
this.delegate.setAttribute(el, name, value, namespace); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
var /** @type {?} */ fullName = namespace ? namespace + ':' + name : name; | |
debugEl.attributes[fullName] = null; | |
} | |
this.delegate.removeAttribute(el, name, namespace); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.addClass = function (el, name) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
debugEl.classes[name] = true; | |
} | |
this.delegate.addClass(el, name); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.removeClass = function (el, name) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
debugEl.classes[name] = false; | |
} | |
this.delegate.removeClass(el, name); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} style | |
* @param {?} value | |
* @param {?} flags | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.setStyle = function (el, style, value, flags) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
debugEl.styles[style] = value; | |
} | |
this.delegate.setStyle(el, style, value, flags); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} style | |
* @param {?} flags | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.removeStyle = function (el, style, flags) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
debugEl.styles[style] = null; | |
} | |
this.delegate.removeStyle(el, style, flags); | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.setProperty = function (el, name, value) { | |
var /** @type {?} */ debugEl = getDebugNode(el); | |
if (debugEl && debugEl instanceof DebugElement) { | |
debugEl.properties[name] = value; | |
} | |
this.delegate.setProperty(el, name, value); | |
}; | |
/** | |
* @param {?} target | |
* @param {?} eventName | |
* @param {?} callback | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.listen = function (target, eventName, callback) { | |
if (typeof target !== 'string') { | |
var /** @type {?} */ debugEl = getDebugNode(target); | |
if (debugEl) { | |
debugEl.listeners.push(new EventListener(eventName, callback)); | |
} | |
} | |
return this.delegate.listen(target, eventName, callback); | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); }; | |
/** | |
* @param {?} node | |
* @param {?} value | |
* @return {?} | |
*/ | |
DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); }; | |
return DebugRenderer2; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @return {?} | |
*/ | |
function _iterableDiffersFactory() { | |
return defaultIterableDiffers; | |
} | |
/** | |
* @return {?} | |
*/ | |
function _keyValueDiffersFactory() { | |
return defaultKeyValueDiffers; | |
} | |
/** | |
* @param {?=} locale | |
* @return {?} | |
*/ | |
function _localeFactory(locale) { | |
return locale || 'en-US'; | |
} | |
/** | |
* @return {?} | |
*/ | |
function _initViewEngine() { | |
initServicesIfNeeded(); | |
} | |
/** | |
* This module includes the providers of \@angular/core that are needed | |
* to bootstrap components via `ApplicationRef`. | |
* | |
* \@experimental | |
*/ | |
var ApplicationModule = (function () { | |
/** | |
* @param {?} appRef | |
*/ | |
function ApplicationModule(appRef) { | |
} | |
return ApplicationModule; | |
}()); | |
ApplicationModule.decorators = [ | |
{ type: NgModule, args: [{ | |
providers: [ | |
ApplicationRef_, | |
{ provide: ApplicationRef, useExisting: ApplicationRef_ }, | |
ApplicationInitStatus, | |
Compiler, | |
APP_ID_RANDOM_PROVIDER, | |
{ provide: IterableDiffers, useFactory: _iterableDiffersFactory }, | |
{ provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory }, | |
{ | |
provide: LOCALE_ID, | |
useFactory: _localeFactory, | |
deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]] | |
}, | |
{ provide: APP_INITIALIZER, useValue: _initViewEngine, multi: true }, | |
] | |
},] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
ApplicationModule.ctorParameters = function () { return [ | |
{ type: ApplicationRef, }, | |
]; }; | |
/** | |
* @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 LifecycleHooks = {}; | |
LifecycleHooks.OnInit = 0; | |
LifecycleHooks.OnDestroy = 1; | |
LifecycleHooks.DoCheck = 2; | |
LifecycleHooks.OnChanges = 3; | |
LifecycleHooks.AfterContentInit = 4; | |
LifecycleHooks.AfterContentChecked = 5; | |
LifecycleHooks.AfterViewInit = 6; | |
LifecycleHooks.AfterViewChecked = 7; | |
LifecycleHooks[LifecycleHooks.OnInit] = "OnInit"; | |
LifecycleHooks[LifecycleHooks.OnDestroy] = "OnDestroy"; | |
LifecycleHooks[LifecycleHooks.DoCheck] = "DoCheck"; | |
LifecycleHooks[LifecycleHooks.OnChanges] = "OnChanges"; | |
LifecycleHooks[LifecycleHooks.AfterContentInit] = "AfterContentInit"; | |
LifecycleHooks[LifecycleHooks.AfterContentChecked] = "AfterContentChecked"; | |
LifecycleHooks[LifecycleHooks.AfterViewInit] = "AfterViewInit"; | |
LifecycleHooks[LifecycleHooks.AfterViewChecked] = "AfterViewChecked"; | |
var LIFECYCLE_HOOKS_VALUES = [ | |
LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges, | |
LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit, | |
LifecycleHooks.AfterViewChecked | |
]; | |
/** | |
* @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 | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* \@experimental Animation support is experimental. | |
*/ | |
/** | |
* `trigger` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `trigger` Creates an animation trigger which will a list of {\@link state state} and {\@link | |
* transition transition} entries that will be evaluated when the expression bound to the trigger | |
* changes. | |
* | |
* Triggers are registered within the component annotation data under the {\@link | |
* Component#animations-anchor animations section}. An animation trigger can be placed on an element | |
* within a template by referencing the name of the trigger followed by the expression value that the | |
* trigger is bound to (in the form of `[\@triggerName]="expression"`. | |
* | |
* ### Usage | |
* | |
* `trigger` will create an animation trigger reference based on the provided `name` value. The | |
* provided `animation` value is expected to be an array consisting of {\@link state state} and {\@link | |
* transition transition} declarations. | |
* | |
* ```typescript | |
* \@Component({ | |
* selector: 'my-component', | |
* templateUrl: 'my-component-tpl.html', | |
* animations: [ | |
* trigger("myAnimationTrigger", [ | |
* state(...), | |
* state(...), | |
* transition(...), | |
* transition(...) | |
* ]) | |
* ] | |
* }) | |
* class MyComponent { | |
* myStatusExp = "something"; | |
* } | |
* ``` | |
* | |
* The template associated with this component will make use of the `myAnimationTrigger` animation | |
* trigger by binding to an element within its template code. | |
* | |
* ```html | |
* <!-- somewhere inside of my-component-tpl.html --> | |
* <div [\@myAnimationTrigger]="myStatusExp">...</div> | |
* tools/gulp-tasks/validate-commit-message.js ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} name | |
* @param {?} definitions | |
* @return {?} | |
*/ | |
function trigger$1(name, definitions) { | |
return { name: name, definitions: definitions }; | |
} | |
/** | |
* `animate` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `animate` specifies an animation step that will apply the provided `styles` data for a given | |
* amount of time based on the provided `timing` expression value. Calls to `animate` are expected | |
* to be used within {\@link sequence an animation sequence}, {\@link group group}, or {\@link | |
* transition transition}. | |
* | |
* ### Usage | |
* | |
* The `animate` function accepts two input parameters: `timing` and `styles`: | |
* | |
* - `timing` is a string based value that can be a combination of a duration with optional delay | |
* and easing values. The format for the expression breaks down to `duration delay easing` | |
* (therefore a value such as `1s 100ms ease-out` will be parse itself into `duration=1000, | |
* delay=100, easing=ease-out`. If a numeric value is provided then that will be used as the | |
* `duration` value in millisecond form. | |
* - `styles` is the style input data which can either be a call to {\@link style style} or {\@link | |
* keyframes keyframes}. If left empty then the styles from the destination state will be collected | |
* and used (this is useful when describing an animation step that will complete an animation by | |
* {\@link transition#the-final-animate-call animating to the final state}). | |
* | |
* ```typescript | |
* // various functions for specifying timing data | |
* animate(500, style(...)) | |
* animate("1s", style(...)) | |
* animate("100ms 0.5s", style(...)) | |
* animate("5s ease", style(...)) | |
* animate("5s 10ms cubic-bezier(.17,.67,.88,.1)", style(...)) | |
* | |
* // either style() of keyframes() can be used | |
* animate(500, style({ background: "red" })) | |
* animate(500, keyframes([ | |
* style({ background: "blue" })), | |
* style({ background: "red" })) | |
* ]) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} timings | |
* @param {?=} styles | |
* @return {?} | |
*/ | |
function animate$1(timings, styles) { | |
if (styles === void 0) { styles = null; } | |
return { type: 4 /* Animate */, styles: styles, timings: timings }; | |
} | |
/** | |
* `group` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `group` specifies a list of animation steps that are all run in parallel. Grouped animations are | |
* useful when a series of styles must be animated/closed off at different statrting/ending times. | |
* | |
* The `group` function can either be used within a {\@link sequence sequence} or a {\@link transition | |
* transition} and it will only continue to the next instruction once all of the inner animation | |
* steps have completed. | |
* | |
* ### Usage | |
* | |
* The `steps` data that is passed into the `group` animation function can either consist of {\@link | |
* style style} or {\@link animate animate} function calls. Each call to `style()` or `animate()` | |
* within a group will be executed instantly (use {\@link keyframes keyframes} or a {\@link | |
* animate#usage animate() with a delay value} to offset styles to be applied at a later time). | |
* | |
* ```typescript | |
* group([ | |
* animate("1s", { background: "black" })) | |
* animate("2s", { color: "white" })) | |
* ]) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function group$1(steps) { | |
return { type: 3 /* Group */, steps: steps }; | |
} | |
/** | |
* `sequence` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `sequence` Specifies a list of animation steps that are run one by one. (`sequence` is used by | |
* default when an array is passed as animation data into {\@link transition transition}.) | |
* | |
* The `sequence` function can either be used within a {\@link group group} or a {\@link transition | |
* transition} and it will only continue to the next instruction once each of the inner animation | |
* steps have completed. | |
* | |
* To perform animation styling in parallel with other animation steps then have a look at the | |
* {\@link group group} animation function. | |
* | |
* ### Usage | |
* | |
* The `steps` data that is passed into the `sequence` animation function can either consist of | |
* {\@link style style} or {\@link animate animate} function calls. A call to `style()` will apply the | |
* provided styling data immediately while a call to `animate()` will apply its styling data over a | |
* given time depending on its timing data. | |
* | |
* ```typescript | |
* sequence([ | |
* style({ opacity: 0 })), | |
* animate("1s", { opacity: 1 })) | |
* ]) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function sequence$1(steps) { | |
return { type: 2 /* Sequence */, steps: steps }; | |
} | |
/** | |
* `style` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `style` declares a key/value object containing CSS properties/styles that can then be used for | |
* {\@link state animation states}, within an {\@link sequence animation sequence}, or as styling data | |
* for both {\@link animate animate} and {\@link keyframes keyframes}. | |
* | |
* ### Usage | |
* | |
* `style` takes in a key/value string map as data and expects one or more CSS property/value pairs | |
* to be defined. | |
* | |
* ```typescript | |
* // string values are used for css properties | |
* style({ background: "red", color: "blue" }) | |
* | |
* // numerical (pixel) values are also supported | |
* style({ width: 100, height: 0 }) | |
* ``` | |
* | |
* #### Auto-styles (using `*`) | |
* | |
* When an asterix (`*`) character is used as a value then it will be detected from the element | |
* being animated and applied as animation data when the animation starts. | |
* | |
* This feature proves useful for a state depending on layout and/or environment factors; in such | |
* cases the styles are calculated just before the animation starts. | |
* | |
* ```typescript | |
* // the steps below will animate from 0 to the | |
* // actual height of the element | |
* style({ height: 0 }), | |
* animate("1s", style({ height: "*" })) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} tokens | |
* @return {?} | |
*/ | |
function style$1(tokens) { | |
return { type: 6 /* Style */, styles: tokens }; | |
} | |
/** | |
* `state` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `state` declares an animation state within the given trigger. When a state is active within a | |
* component then its associated styles will persist on the element that the trigger is attached to | |
* (even when the animation ends). | |
* | |
* To animate between states, have a look at the animation {\@link transition transition} DSL | |
* function. To register states to an animation trigger please have a look at the {\@link trigger | |
* trigger} function. | |
* | |
* #### The `void` state | |
* | |
* The `void` state value is a reserved word that angular uses to determine when the element is not | |
* apart of the application anymore (e.g. when an `ngIf` evaluates to false then the state of the | |
* associated element is void). | |
* | |
* #### The `*` (default) state | |
* | |
* The `*` state (when styled) is a fallback state that will be used if the state that is being | |
* animated is not declared within the trigger. | |
* | |
* ### Usage | |
* | |
* `state` will declare an animation state with its associated styles | |
* within the given trigger. | |
* | |
* - `stateNameExpr` can be one or more state names separated by commas. | |
* - `styles` refers to the {\@link style styling data} that will be persisted on the element once | |
* the state has been reached. | |
* | |
* ```typescript | |
* // "void" is a reserved name for a state and is used to represent | |
* // the state in which an element is detached from from the application. | |
* state("void", style({ height: 0 })) | |
* | |
* // user-defined states | |
* state("closed", style({ height: 0 })) | |
* state("open, visible", style({ height: "*" })) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} name | |
* @param {?} styles | |
* @return {?} | |
*/ | |
function state$1(name, styles) { | |
return { type: 0 /* State */, name: name, styles: styles }; | |
} | |
/** | |
* `keyframes` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `keyframes` specifies a collection of {\@link style style} entries each optionally characterized | |
* by an `offset` value. | |
* | |
* ### Usage | |
* | |
* The `keyframes` animation function is designed to be used alongside the {\@link animate animate} | |
* animation function. Instead of applying animations from where they are currently to their | |
* destination, keyframes can describe how each style entry is applied and at what point within the | |
* animation arc (much like CSS Keyframe Animations do). | |
* | |
* For each `style()` entry an `offset` value can be set. Doing so allows to specifiy at what | |
* percentage of the animate time the styles will be applied. | |
* | |
* ```typescript | |
* // the provided offset values describe when each backgroundColor value is applied. | |
* animate("5s", keyframes([ | |
* style({ backgroundColor: "red", offset: 0 }), | |
* style({ backgroundColor: "blue", offset: 0.2 }), | |
* style({ backgroundColor: "orange", offset: 0.3 }), | |
* style({ backgroundColor: "black", offset: 1 }) | |
* ])) | |
* ``` | |
* | |
* Alternatively, if there are no `offset` values used within the style entries then the offsets | |
* will be calculated automatically. | |
* | |
* ```typescript | |
* animate("5s", keyframes([ | |
* style({ backgroundColor: "red" }) // offset = 0 | |
* style({ backgroundColor: "blue" }) // offset = 0.33 | |
* style({ backgroundColor: "orange" }) // offset = 0.66 | |
* style({ backgroundColor: "black" }) // offset = 1 | |
* ])) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function keyframes$1(steps) { | |
return { type: 5 /* KeyframeSequence */, steps: steps }; | |
} | |
/** | |
* `transition` is an animation-specific function that is designed to be used inside of Angular's | |
* animation DSL language. If this information is new, please navigate to the {\@link | |
* Component#animations-anchor component animations metadata page} to gain a better understanding of | |
* how animations in Angular are used. | |
* | |
* `transition` declares the {\@link sequence sequence of animation steps} that will be run when the | |
* provided `stateChangeExpr` value is satisfied. The `stateChangeExpr` consists of a `state1 => | |
* state2` which consists of two known states (use an asterix (`*`) to refer to a dynamic starting | |
* and/or ending state). | |
* | |
* A function can also be provided as the `stateChangeExpr` argument for a transition and this | |
* function will be executed each time a state change occurs. If the value returned within the | |
* function is true then the associated animation will be run. | |
* | |
* Animation transitions are placed within an {\@link trigger animation trigger}. For an transition | |
* to animate to a state value and persist its styles then one or more {\@link state animation | |
* states} is expected to be defined. | |
* | |
* ### Usage | |
* | |
* An animation transition is kicked off the `stateChangeExpr` predicate evaluates to true based on | |
* what the previous state is and what the current state has become. In other words, if a transition | |
* is defined that matches the old/current state criteria then the associated animation will be | |
* triggered. | |
* | |
* ```typescript | |
* // all transition/state changes are defined within an animation trigger | |
* trigger("myAnimationTrigger", [ | |
* // if a state is defined then its styles will be persisted when the | |
* // animation has fully completed itself | |
* state("on", style({ background: "green" })), | |
* state("off", style({ background: "grey" })), | |
* | |
* // a transition animation that will be kicked off when the state value | |
* // bound to "myAnimationTrigger" changes from "on" to "off" | |
* transition("on => off", animate(500)), | |
* | |
* // it is also possible to do run the same animation for both directions | |
* transition("on <=> off", animate(500)), | |
* | |
* // or to define multiple states pairs separated by commas | |
* transition("on => off, off => void", animate(500)), | |
* | |
* // this is a catch-all state change for when an element is inserted into | |
* // the page and the destination state is unknown | |
* transition("void => *", [ | |
* style({ opacity: 0 }), | |
* animate(500) | |
* ]), | |
* | |
* // this will capture a state change between any states | |
* transition("* => *", animate("1s 0s")), | |
* | |
* // you can also go full out and include a function | |
* transition((fromState, toState) => { | |
* // when `true` then it will allow the animation below to be invoked | |
* return fromState == "off" && toState == "on"; | |
* }, animate("1s 0s")) | |
* ]) | |
* ``` | |
* | |
* The template associated with this component will make use of the `myAnimationTrigger` animation | |
* trigger by binding to an element within its template code. | |
* | |
* ```html | |
* <!-- somewhere inside of my-component-tpl.html --> | |
* <div [\@myAnimationTrigger]="myStatusExp">...</div> | |
* ``` | |
* | |
* #### The final `animate` call | |
* | |
* If the final step within the transition steps is a call to `animate()` that **only** uses a | |
* timing value with **no style data** then it will be automatically used as the final animation arc | |
* for the element to animate itself to the final state. This involves an automatic mix of | |
* adding/removing CSS styles so that the element will be in the exact state it should be for the | |
* applied state to be presented correctly. | |
* | |
* ``` | |
* // start off by hiding the element, but make sure that it animates properly to whatever state | |
* // is currently active for "myAnimationTrigger" | |
* transition("void => *", [ | |
* style({ opacity: 0 }), | |
* animate(500) | |
* ]) | |
* ``` | |
* | |
* ### Transition Aliases (`:enter` and `:leave`) | |
* | |
* Given that enter (insertion) and leave (removal) animations are so common, the `transition` | |
* function accepts both `:enter` and `:leave` values which are aliases for the `void => *` and `* | |
* => void` state changes. | |
* | |
* ``` | |
* transition(":enter", [ | |
* style({ opacity: 0 }), | |
* animate(500, style({ opacity: 1 })) | |
* ]) | |
* transition(":leave", [ | |
* animate(500, style({ opacity: 0 })) | |
* ]) | |
* ``` | |
* | |
* {\@example core/animation/ts/dsl/animation_example.ts region='Component'} | |
* | |
* \@experimental Animation support is experimental. | |
* @param {?} stateChangeExpr | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function transition$1(stateChangeExpr, steps) { | |
return { type: 1 /* Transition */, expr: stateChangeExpr, animation: steps }; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
*/ | |
var AUTO_STYLE$$1 = '*'; | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} name | |
* @param {?} definitions | |
* @return {?} | |
*/ | |
function trigger$$1(name, definitions) { | |
return trigger$1(name, definitions); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} timings | |
* @param {?=} styles | |
* @return {?} | |
*/ | |
function animate$$1(timings, styles) { | |
return animate$1(timings, styles); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function group$$1(steps) { | |
return group$1(steps); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function sequence$$1(steps) { | |
return sequence$1(steps); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} tokens | |
* @return {?} | |
*/ | |
function style$$1(tokens) { | |
return style$1(tokens); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} name | |
* @param {?} styles | |
* @return {?} | |
*/ | |
function state$$1(name, styles) { | |
return state$1(name, styles); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function keyframes$$1(steps) { | |
return keyframes$1(steps); | |
} | |
/** | |
* @deprecated This symbol has moved. Please Import from \@angular/animations instead! | |
* @param {?} stateChangeExpr | |
* @param {?} steps | |
* @return {?} | |
*/ | |
function transition$$1(stateChangeExpr, steps) { | |
return transition$1(stateChangeExpr, steps); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point from which you should import all public core APIs. | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the core package. | |
*/ | |
/** | |
* Generated bundle index. Do not edit. | |
*/ | |
//# sourceMappingURL=core.es5.js.map | |
/* WEBPACK VAR INJECTION */}.call(__webpack_exports__, __webpack_require__(13))) | |
/***/ }), | |
/* 46 */, | |
/* 47 */, | |
/* 48 */, | |
/* 49 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Observable_1 = __webpack_require__(0); | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @extends {Ignored} | |
* @hide true | |
*/ | |
var EmptyObservable = (function (_super) { | |
__extends(EmptyObservable, _super); | |
function EmptyObservable(scheduler) { | |
_super.call(this); | |
this.scheduler = scheduler; | |
} | |
/** | |
* Creates an Observable that emits no items to the Observer and immediately | |
* emits a complete notification. | |
* | |
* <span class="informal">Just emits 'complete', and nothing else. | |
* </span> | |
* | |
* <img src="./img/empty.png" width="100%"> | |
* | |
* This static operator is useful for creating a simple Observable that only | |
* emits the complete notification. It can be used for composing with other | |
* Observables, such as in a {@link mergeMap}. | |
* | |
* @example <caption>Emit the number 7, then complete.</caption> | |
* var result = Rx.Observable.empty().startWith(7); | |
* result.subscribe(x => console.log(x)); | |
* | |
* @example <caption>Map and flatten only odd numbers to the sequence 'a', 'b', 'c'</caption> | |
* var interval = Rx.Observable.interval(1000); | |
* var result = interval.mergeMap(x => | |
* x % 2 === 1 ? Rx.Observable.of('a', 'b', 'c') : Rx.Observable.empty() | |
* ); | |
* result.subscribe(x => console.log(x)); | |
* | |
* // Results in the following to the console: | |
* // x is equal to the count on the interval eg(0,1,2,3,...) | |
* // x will occur every 1000ms | |
* // if x % 2 is equal to 1 print abc | |
* // if x % 2 is not equal to 1 nothing will be output | |
* | |
* @see {@link create} | |
* @see {@link never} | |
* @see {@link of} | |
* @see {@link throw} | |
* | |
* @param {Scheduler} [scheduler] A {@link IScheduler} to use for scheduling | |
* the emission of the complete notification. | |
* @return {Observable} An "empty" Observable: emits only the complete | |
* notification. | |
* @static true | |
* @name empty | |
* @owner Observable | |
*/ | |
EmptyObservable.create = function (scheduler) { | |
return new EmptyObservable(scheduler); | |
}; | |
EmptyObservable.dispatch = function (arg) { | |
var subscriber = arg.subscriber; | |
subscriber.complete(); | |
}; | |
EmptyObservable.prototype._subscribe = function (subscriber) { | |
var scheduler = this.scheduler; | |
if (scheduler) { | |
return scheduler.schedule(EmptyObservable.dispatch, 0, { subscriber: subscriber }); | |
} | |
else { | |
subscriber.complete(); | |
} | |
}; | |
return EmptyObservable; | |
}(Observable_1.Observable)); | |
exports.EmptyObservable = EmptyObservable; | |
//# sourceMappingURL=EmptyObservable.js.map | |
/***/ }), | |
/* 50 */, | |
/* 51 */, | |
/* 52 */, | |
/* 53 */, | |
/* 54 */, | |
/* 55 */, | |
/* 56 */, | |
/* 57 */, | |
/* 58 */, | |
/* 59 */, | |
/* 60 */ | |
/***/ (function(module, exports) { | |
/** | |
* Expose `Emitter`. | |
*/ | |
module.exports = Emitter; | |
/** | |
* Initialize a new `Emitter`. | |
* | |
* @api public | |
*/ | |
function Emitter(obj) { | |
if (obj) return mixin(obj); | |
}; | |
/** | |
* Mixin the emitter properties. | |
* | |
* @param {Object} obj | |
* @return {Object} | |
* @api private | |
*/ | |
function mixin(obj) { | |
for (var key in Emitter.prototype) { | |
obj[key] = Emitter.prototype[key]; | |
} | |
return obj; | |
} | |
/** | |
* Listen on the given `event` with `fn`. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.on = | |
Emitter.prototype.addEventListener = function(event, fn){ | |
this._callbacks = this._callbacks || {}; | |
(this._callbacks[event] = this._callbacks[event] || []) | |
.push(fn); | |
return this; | |
}; | |
/** | |
* Adds an `event` listener that will be invoked a single | |
* time then automatically removed. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.once = function(event, fn){ | |
var self = this; | |
this._callbacks = this._callbacks || {}; | |
function on() { | |
self.off(event, on); | |
fn.apply(this, arguments); | |
} | |
on.fn = fn; | |
this.on(event, on); | |
return this; | |
}; | |
/** | |
* Remove the given callback for `event` or all | |
* registered callbacks. | |
* | |
* @param {String} event | |
* @param {Function} fn | |
* @return {Emitter} | |
* @api public | |
*/ | |
Emitter.prototype.off = | |
Emitter.prototype.removeListener = | |
Emitter.prototype.removeAllListeners = | |
Emitter.prototype.removeEventListener = function(event, fn){ | |
this._callbacks = this._callbacks || {}; | |
// all | |
if (0 == arguments.length) { | |
this._callbacks = {}; | |
return this; | |
} | |
// specific event | |
var callbacks = this._callbacks[event]; | |
if (!callbacks) return this; | |
// remove all handlers | |
if (1 == arguments.length) { | |
delete this._callbacks[event]; | |
return this; | |
} | |
// remove specific handler | |
var cb; | |
for (var i = 0; i < callbacks.length; i++) { | |
cb = callbacks[i]; | |
if (cb === fn || cb.fn === fn) { | |
callbacks.splice(i, 1); | |
break; | |
} | |
} | |
return this; | |
}; | |
/** | |
* Emit `event` with the given args. | |
* | |
* @param {String} event | |
* @param {Mixed} ... | |
* @return {Emitter} | |
*/ | |
Emitter.prototype.emit = function(event){ | |
this._callbacks = this._callbacks || {}; | |
var args = [].slice.call(arguments, 1) | |
, callbacks = this._callbacks[event]; | |
if (callbacks) { | |
callbacks = callbacks.slice(0); | |
for (var i = 0, len = callbacks.length; i < len; ++i) { | |
callbacks[i].apply(this, args); | |
} | |
} | |
return this; | |
}; | |
/** | |
* Return array of callbacks for `event`. | |
* | |
* @param {String} event | |
* @return {Array} | |
* @api public | |
*/ | |
Emitter.prototype.listeners = function(event){ | |
this._callbacks = this._callbacks || {}; | |
return this._callbacks[event] || []; | |
}; | |
/** | |
* Check if this emitter has `event` handlers. | |
* | |
* @param {String} event | |
* @return {Boolean} | |
* @api public | |
*/ | |
Emitter.prototype.hasListeners = function(event){ | |
return !! this.listeners(event).length; | |
}; | |
/***/ }), | |
/* 61 */, | |
/* 62 */, | |
/* 63 */, | |
/* 64 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(global) {/** | |
* Module dependencies. | |
*/ | |
var keys = __webpack_require__(446); | |
var hasBinary = __webpack_require__(184); | |
var sliceBuffer = __webpack_require__(248); | |
var after = __webpack_require__(247); | |
var utf8 = __webpack_require__(742); | |
var base64encoder; | |
if (global && global.ArrayBuffer) { | |
base64encoder = __webpack_require__(250); | |
} | |
/** | |
* Check if we are running an android browser. That requires us to use | |
* ArrayBuffer with polling transports... | |
* | |
* http://ghinda.net/jpeg-blob-ajax-android/ | |
*/ | |
var isAndroid = typeof navigator !== 'undefined' && /Android/i.test(navigator.userAgent); | |
/** | |
* Check if we are running in PhantomJS. | |
* Uploading a Blob with PhantomJS does not work correctly, as reported here: | |
* https://github.com/ariya/phantomjs/issues/11395 | |
* @type boolean | |
*/ | |
var isPhantomJS = typeof navigator !== 'undefined' && /PhantomJS/i.test(navigator.userAgent); | |
/** | |
* When true, avoids using Blobs to encode payloads. | |
* @type boolean | |
*/ | |
var dontSendBlobs = isAndroid || isPhantomJS; | |
/** | |
* Current protocol version. | |
*/ | |
exports.protocol = 3; | |
/** | |
* Packet types. | |
*/ | |
var packets = exports.packets = { | |
open: 0 // non-ws | |
, close: 1 // non-ws | |
, ping: 2 | |
, pong: 3 | |
, message: 4 | |
, upgrade: 5 | |
, noop: 6 | |
}; | |
var packetslist = keys(packets); | |
/** | |
* Premade error packet. | |
*/ | |
var err = { type: 'error', data: 'parser error' }; | |
/** | |
* Create a blob api even for blob builder when vendor prefixes exist | |
*/ | |
var Blob = __webpack_require__(251); | |
/** | |
* Encodes a packet. | |
* | |
* <packet type id> [ <data> ] | |
* | |
* Example: | |
* | |
* 5hello world | |
* 3 | |
* 4 | |
* | |
* Binary is encoded in an identical principle | |
* | |
* @api private | |
*/ | |
exports.encodePacket = function (packet, supportsBinary, utf8encode, callback) { | |
if ('function' == typeof supportsBinary) { | |
callback = supportsBinary; | |
supportsBinary = false; | |
} | |
if ('function' == typeof utf8encode) { | |
callback = utf8encode; | |
utf8encode = null; | |
} | |
var data = (packet.data === undefined) | |
? undefined | |
: packet.data.buffer || packet.data; | |
if (global.ArrayBuffer && data instanceof ArrayBuffer) { | |
return encodeArrayBuffer(packet, supportsBinary, callback); | |
} else if (Blob && data instanceof global.Blob) { | |
return encodeBlob(packet, supportsBinary, callback); | |
} | |
// might be an object with { base64: true, data: dataAsBase64String } | |
if (data && data.base64) { | |
return encodeBase64Object(packet, callback); | |
} | |
// Sending data as a utf-8 string | |
var encoded = packets[packet.type]; | |
// data fragment is optional | |
if (undefined !== packet.data) { | |
encoded += utf8encode ? utf8.encode(String(packet.data)) : String(packet.data); | |
} | |
return callback('' + encoded); | |
}; | |
function encodeBase64Object(packet, callback) { | |
// packet data is an object { base64: true, data: dataAsBase64String } | |
var message = 'b' + exports.packets[packet.type] + packet.data.data; | |
return callback(message); | |
} | |
/** | |
* Encode packet helpers for binary types | |
*/ | |
function encodeArrayBuffer(packet, supportsBinary, callback) { | |
if (!supportsBinary) { | |
return exports.encodeBase64Packet(packet, callback); | |
} | |
var data = packet.data; | |
var contentArray = new Uint8Array(data); | |
var resultBuffer = new Uint8Array(1 + data.byteLength); | |
resultBuffer[0] = packets[packet.type]; | |
for (var i = 0; i < contentArray.length; i++) { | |
resultBuffer[i+1] = contentArray[i]; | |
} | |
return callback(resultBuffer.buffer); | |
} | |
function encodeBlobAsArrayBuffer(packet, supportsBinary, callback) { | |
if (!supportsBinary) { | |
return exports.encodeBase64Packet(packet, callback); | |
} | |
var fr = new FileReader(); | |
fr.onload = function() { | |
packet.data = fr.result; | |
exports.encodePacket(packet, supportsBinary, true, callback); | |
}; | |
return fr.readAsArrayBuffer(packet.data); | |
} | |
function encodeBlob(packet, supportsBinary, callback) { | |
if (!supportsBinary) { | |
return exports.encodeBase64Packet(packet, callback); | |
} | |
if (dontSendBlobs) { | |
return encodeBlobAsArrayBuffer(packet, supportsBinary, callback); | |
} | |
var length = new Uint8Array(1); | |
length[0] = packets[packet.type]; | |
var blob = new Blob([length.buffer, packet.data]); | |
return callback(blob); | |
} | |
/** | |
* Encodes a packet with binary data in a base64 string | |
* | |
* @param {Object} packet, has `type` and `data` | |
* @return {String} base64 encoded message | |
*/ | |
exports.encodeBase64Packet = function(packet, callback) { | |
var message = 'b' + exports.packets[packet.type]; | |
if (Blob && packet.data instanceof global.Blob) { | |
var fr = new FileReader(); | |
fr.onload = function() { | |
var b64 = fr.result.split(',')[1]; | |
callback(message + b64); | |
}; | |
return fr.readAsDataURL(packet.data); | |
} | |
var b64data; | |
try { | |
b64data = String.fromCharCode.apply(null, new Uint8Array(packet.data)); | |
} catch (e) { | |
// iPhone Safari doesn't let you apply with typed arrays | |
var typed = new Uint8Array(packet.data); | |
var basic = new Array(typed.length); | |
for (var i = 0; i < typed.length; i++) { | |
basic[i] = typed[i]; | |
} | |
b64data = String.fromCharCode.apply(null, basic); | |
} | |
message += global.btoa(b64data); | |
return callback(message); | |
}; | |
/** | |
* Decodes a packet. Changes format to Blob if requested. | |
* | |
* @return {Object} with `type` and `data` (if any) | |
* @api private | |
*/ | |
exports.decodePacket = function (data, binaryType, utf8decode) { | |
if (data === undefined) { | |
return err; | |
} | |
// String data | |
if (typeof data == 'string') { | |
if (data.charAt(0) == 'b') { | |
return exports.decodeBase64Packet(data.substr(1), binaryType); | |
} | |
if (utf8decode) { | |
data = tryDecode(data); | |
if (data === false) { | |
return err; | |
} | |
} | |
var type = data.charAt(0); | |
if (Number(type) != type || !packetslist[type]) { | |
return err; | |
} | |
if (data.length > 1) { | |
return { type: packetslist[type], data: data.substring(1) }; | |
} else { | |
return { type: packetslist[type] }; | |
} | |
} | |
var asArray = new Uint8Array(data); | |
var type = asArray[0]; | |
var rest = sliceBuffer(data, 1); | |
if (Blob && binaryType === 'blob') { | |
rest = new Blob([rest]); | |
} | |
return { type: packetslist[type], data: rest }; | |
}; | |
function tryDecode(data) { | |
try { | |
data = utf8.decode(data); | |
} catch (e) { | |
return false; | |
} | |
return data; | |
} | |
/** | |
* Decodes a packet encoded in a base64 string | |
* | |
* @param {String} base64 encoded message | |
* @return {Object} with `type` and `data` (if any) | |
*/ | |
exports.decodeBase64Packet = function(msg, binaryType) { | |
var type = packetslist[msg.charAt(0)]; | |
if (!base64encoder) { | |
return { type: type, data: { base64: true, data: msg.substr(1) } }; | |
} | |
var data = base64encoder.decode(msg.substr(1)); | |
if (binaryType === 'blob' && Blob) { | |
data = new Blob([data]); | |
} | |
return { type: type, data: data }; | |
}; | |
/** | |
* Encodes multiple messages (payload). | |
* | |
* <length>:data | |
* | |
* Example: | |
* | |
* 11:hello world2:hi | |
* | |
* If any contents are binary, they will be encoded as base64 strings. Base64 | |
* encoded strings are marked with a b before the length specifier | |
* | |
* @param {Array} packets | |
* @api private | |
*/ | |
exports.encodePayload = function (packets, supportsBinary, callback) { | |
if (typeof supportsBinary == 'function') { | |
callback = supportsBinary; | |
supportsBinary = null; | |
} | |
var isBinary = hasBinary(packets); | |
if (supportsBinary && isBinary) { | |
if (Blob && !dontSendBlobs) { | |
return exports.encodePayloadAsBlob(packets, callback); | |
} | |
return exports.encodePayloadAsArrayBuffer(packets, callback); | |
} | |
if (!packets.length) { | |
return callback('0:'); | |
} | |
function setLengthHeader(message) { | |
return message.length + ':' + message; | |
} | |
function encodeOne(packet, doneCallback) { | |
exports.encodePacket(packet, !isBinary ? false : supportsBinary, true, function(message) { | |
doneCallback(null, setLengthHeader(message)); | |
}); | |
} | |
map(packets, encodeOne, function(err, results) { | |
return callback(results.join('')); | |
}); | |
}; | |
/** | |
* Async array map using after | |
*/ | |
function map(ary, each, done) { | |
var result = new Array(ary.length); | |
var next = after(ary.length, done); | |
var eachWithIndex = function(i, el, cb) { | |
each(el, function(error, msg) { | |
result[i] = msg; | |
cb(error, result); | |
}); | |
}; | |
for (var i = 0; i < ary.length; i++) { | |
eachWithIndex(i, ary[i], next); | |
} | |
} | |
/* | |
* Decodes data when a payload is maybe expected. Possible binary contents are | |
* decoded from their base64 representation | |
* | |
* @param {String} data, callback method | |
* @api public | |
*/ | |
exports.decodePayload = function (data, binaryType, callback) { | |
if (typeof data != 'string') { | |
return exports.decodePayloadAsBinary(data, binaryType, callback); | |
} | |
if (typeof binaryType === 'function') { | |
callback = binaryType; | |
binaryType = null; | |
} | |
var packet; | |
if (data == '') { | |
// parser error - ignoring payload | |
return callback(err, 0, 1); | |
} | |
var length = '' | |
, n, msg; | |
for (var i = 0, l = data.length; i < l; i++) { | |
var chr = data.charAt(i); | |
if (':' != chr) { | |
length += chr; | |
} else { | |
if ('' == length || (length != (n = Number(length)))) { | |
// parser error - ignoring payload | |
return callback(err, 0, 1); | |
} | |
msg = data.substr(i + 1, n); | |
if (length != msg.length) { | |
// parser error - ignoring payload | |
return callback(err, 0, 1); | |
} | |
if (msg.length) { | |
packet = exports.decodePacket(msg, binaryType, true); | |
if (err.type == packet.type && err.data == packet.data) { | |
// parser error in individual packet - ignoring payload | |
return callback(err, 0, 1); | |
} | |
var ret = callback(packet, i + n, l); | |
if (false === ret) return; | |
} | |
// advance cursor | |
i += n; | |
length = ''; | |
} | |
} | |
if (length != '') { | |
// parser error - ignoring payload | |
return callback(err, 0, 1); | |
} | |
}; | |
/** | |
* Encodes multiple messages (payload) as binary. | |
* | |
* <1 = binary, 0 = string><number from 0-9><number from 0-9>[...]<number | |
* 255><data> | |
* | |
* Example: | |
* 1 3 255 1 2 3, if the binary contents are interpreted as 8 bit integers | |
* | |
* @param {Array} packets | |
* @return {ArrayBuffer} encoded payload | |
* @api private | |
*/ | |
exports.encodePayloadAsArrayBuffer = function(packets, callback) { | |
if (!packets.length) { | |
return callback(new ArrayBuffer(0)); | |
} | |
function encodeOne(packet, doneCallback) { | |
exports.encodePacket(packet, true, true, function(data) { | |
return doneCallback(null, data); | |
}); | |
} | |
map(packets, encodeOne, function(err, encodedPackets) { | |
var totalLength = encodedPackets.reduce(function(acc, p) { | |
var len; | |
if (typeof p === 'string'){ | |
len = p.length; | |
} else { | |
len = p.byteLength; | |
} | |
return acc + len.toString().length + len + 2; // string/binary identifier + separator = 2 | |
}, 0); | |
var resultArray = new Uint8Array(totalLength); | |
var bufferIndex = 0; | |
encodedPackets.forEach(function(p) { | |
var isString = typeof p === 'string'; | |
var ab = p; | |
if (isString) { | |
var view = new Uint8Array(p.length); | |
for (var i = 0; i < p.length; i++) { | |
view[i] = p.charCodeAt(i); | |
} | |
ab = view.buffer; | |
} | |
if (isString) { // not true binary | |
resultArray[bufferIndex++] = 0; | |
} else { // true binary | |
resultArray[bufferIndex++] = 1; | |
} | |
var lenStr = ab.byteLength.toString(); | |
for (var i = 0; i < lenStr.length; i++) { | |
resultArray[bufferIndex++] = parseInt(lenStr[i]); | |
} | |
resultArray[bufferIndex++] = 255; | |
var view = new Uint8Array(ab); | |
for (var i = 0; i < view.length; i++) { | |
resultArray[bufferIndex++] = view[i]; | |
} | |
}); | |
return callback(resultArray.buffer); | |
}); | |
}; | |
/** | |
* Encode as Blob | |
*/ | |
exports.encodePayloadAsBlob = function(packets, callback) { | |
function encodeOne(packet, doneCallback) { | |
exports.encodePacket(packet, true, true, function(encoded) { | |
var binaryIdentifier = new Uint8Array(1); | |
binaryIdentifier[0] = 1; | |
if (typeof encoded === 'string') { | |
var view = new Uint8Array(encoded.length); | |
for (var i = 0; i < encoded.length; i++) { | |
view[i] = encoded.charCodeAt(i); | |
} | |
encoded = view.buffer; | |
binaryIdentifier[0] = 0; | |
} | |
var len = (encoded instanceof ArrayBuffer) | |
? encoded.byteLength | |
: encoded.size; | |
var lenStr = len.toString(); | |
var lengthAry = new Uint8Array(lenStr.length + 1); | |
for (var i = 0; i < lenStr.length; i++) { | |
lengthAry[i] = parseInt(lenStr[i]); | |
} | |
lengthAry[lenStr.length] = 255; | |
if (Blob) { | |
var blob = new Blob([binaryIdentifier.buffer, lengthAry.buffer, encoded]); | |
doneCallback(null, blob); | |
} | |
}); | |
} | |
map(packets, encodeOne, function(err, results) { | |
return callback(new Blob(results)); | |
}); | |
}; | |
/* | |
* Decodes data when a payload is maybe expected. Strings are decoded by | |
* interpreting each byte as a key code for entries marked to start with 0. See | |
* description of encodePayloadAsBinary | |
* | |
* @param {ArrayBuffer} data, callback method | |
* @api public | |
*/ | |
exports.decodePayloadAsBinary = function (data, binaryType, callback) { | |
if (typeof binaryType === 'function') { | |
callback = binaryType; | |
binaryType = null; | |
} | |
var bufferTail = data; | |
var buffers = []; | |
var numberTooLong = false; | |
while (bufferTail.byteLength > 0) { | |
var tailArray = new Uint8Array(bufferTail); | |
var isString = tailArray[0] === 0; | |
var msgLength = ''; | |
for (var i = 1; ; i++) { | |
if (tailArray[i] == 255) break; | |
if (msgLength.length > 310) { | |
numberTooLong = true; | |
break; | |
} | |
msgLength += tailArray[i]; | |
} | |
if(numberTooLong) return callback(err, 0, 1); | |
bufferTail = sliceBuffer(bufferTail, 2 + msgLength.length); | |
msgLength = parseInt(msgLength); | |
var msg = sliceBuffer(bufferTail, 0, msgLength); | |
if (isString) { | |
try { | |
msg = String.fromCharCode.apply(null, new Uint8Array(msg)); | |
} catch (e) { | |
// iPhone Safari doesn't let you apply to typed arrays | |
var typed = new Uint8Array(msg); | |
msg = ''; | |
for (var i = 0; i < typed.length; i++) { | |
msg += String.fromCharCode(typed[i]); | |
} | |
} | |
} | |
buffers.push(msg); | |
bufferTail = sliceBuffer(bufferTail, msgLength); | |
} | |
var total = buffers.length; | |
buffers.forEach(function(buffer, i) { | |
callback(exports.decodePacket(buffer, binaryType, true), i, total); | |
}); | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) | |
/***/ }), | |
/* 65 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _arguments = __webpack_require__(453); | |
var _arguments2 = _interopRequireDefault(_arguments); | |
var _utils = __webpack_require__(181); | |
var _hooks = __webpack_require__(454); | |
var _hooks2 = _interopRequireDefault(_hooks); | |
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } | |
exports.default = { | |
_: _utils._, | |
getArguments: _arguments2.default, | |
stripSlashes: _utils.stripSlashes, | |
hooks: _hooks2.default, | |
matcher: _utils.matcher, | |
sorter: _utils.sorter, | |
select: _utils.select, | |
makeUrl: _utils.makeUrl, | |
// lodash functions | |
each: _utils.each, | |
some: _utils.some, | |
every: _utils.every, | |
keys: _utils.keys, | |
values: _utils.values, | |
isMatch: _utils.isMatch, | |
isEmpty: _utils.isEmpty, | |
isObject: _utils.isObject, | |
extend: _utils.extend, | |
omit: _utils.omit, | |
pick: _utils.pick, | |
merge: _utils.merge | |
}; | |
module.exports = exports['default']; | |
/***/ }), | |
/* 66 */ | |
/***/ (function(module, exports) { | |
// shim for using process in browser | |
var process = module.exports = {}; | |
// cached from whatever global is present so that test runners that stub it | |
// don't break things. But we need to wrap it in a try catch in case it is | |
// wrapped in strict mode code which doesn't define any globals. It's inside a | |
// function because try/catches deoptimize in certain engines. | |
var cachedSetTimeout; | |
var cachedClearTimeout; | |
function defaultSetTimout() { | |
throw new Error('setTimeout has not been defined'); | |
} | |
function defaultClearTimeout () { | |
throw new Error('clearTimeout has not been defined'); | |
} | |
(function () { | |
try { | |
if (typeof setTimeout === 'function') { | |
cachedSetTimeout = setTimeout; | |
} else { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
} catch (e) { | |
cachedSetTimeout = defaultSetTimout; | |
} | |
try { | |
if (typeof clearTimeout === 'function') { | |
cachedClearTimeout = clearTimeout; | |
} else { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} catch (e) { | |
cachedClearTimeout = defaultClearTimeout; | |
} | |
} ()) | |
function runTimeout(fun) { | |
if (cachedSetTimeout === setTimeout) { | |
//normal enviroments in sane situations | |
return setTimeout(fun, 0); | |
} | |
// if setTimeout wasn't available but was latter defined | |
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) { | |
cachedSetTimeout = setTimeout; | |
return setTimeout(fun, 0); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedSetTimeout(fun, 0); | |
} catch(e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedSetTimeout.call(null, fun, 0); | |
} catch(e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error | |
return cachedSetTimeout.call(this, fun, 0); | |
} | |
} | |
} | |
function runClearTimeout(marker) { | |
if (cachedClearTimeout === clearTimeout) { | |
//normal enviroments in sane situations | |
return clearTimeout(marker); | |
} | |
// if clearTimeout wasn't available but was latter defined | |
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) { | |
cachedClearTimeout = clearTimeout; | |
return clearTimeout(marker); | |
} | |
try { | |
// when when somebody has screwed with setTimeout but no I.E. maddness | |
return cachedClearTimeout(marker); | |
} catch (e){ | |
try { | |
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally | |
return cachedClearTimeout.call(null, marker); | |
} catch (e){ | |
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error. | |
// Some versions of I.E. have different rules for clearTimeout vs setTimeout | |
return cachedClearTimeout.call(this, marker); | |
} | |
} | |
} | |
var queue = []; | |
var draining = false; | |
var currentQueue; | |
var queueIndex = -1; | |
function cleanUpNextTick() { | |
if (!draining || !currentQueue) { | |
return; | |
} | |
draining = false; | |
if (currentQueue.length) { | |
queue = currentQueue.concat(queue); | |
} else { | |
queueIndex = -1; | |
} | |
if (queue.length) { | |
drainQueue(); | |
} | |
} | |
function drainQueue() { | |
if (draining) { | |
return; | |
} | |
var timeout = runTimeout(cleanUpNextTick); | |
draining = true; | |
var len = queue.length; | |
while(len) { | |
currentQueue = queue; | |
queue = []; | |
while (++queueIndex < len) { | |
if (currentQueue) { | |
currentQueue[queueIndex].run(); | |
} | |
} | |
queueIndex = -1; | |
len = queue.length; | |
} | |
currentQueue = null; | |
draining = false; | |
runClearTimeout(timeout); | |
} | |
process.nextTick = function (fun) { | |
var args = new Array(arguments.length - 1); | |
if (arguments.length > 1) { | |
for (var i = 1; i < arguments.length; i++) { | |
args[i - 1] = arguments[i]; | |
} | |
} | |
queue.push(new Item(fun, args)); | |
if (queue.length === 1 && !draining) { | |
runTimeout(drainQueue); | |
} | |
}; | |
// v8 likes predictible objects | |
function Item(fun, array) { | |
this.fun = fun; | |
this.array = array; | |
} | |
Item.prototype.run = function () { | |
this.fun.apply(null, this.array); | |
}; | |
process.title = 'browser'; | |
process.browser = true; | |
process.env = {}; | |
process.argv = []; | |
process.version = ''; // empty string to avoid regexp issues | |
process.versions = {}; | |
function noop() {} | |
process.on = noop; | |
process.addListener = noop; | |
process.once = noop; | |
process.off = noop; | |
process.removeListener = noop; | |
process.removeAllListeners = noop; | |
process.emit = noop; | |
process.binding = function (name) { | |
throw new Error('process.binding is not supported'); | |
}; | |
process.cwd = function () { return '/' }; | |
process.chdir = function (dir) { | |
throw new Error('process.chdir is not supported'); | |
}; | |
process.umask = function() { return 0; }; | |
/***/ }), | |
/* 67 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var ConnectableObservable_1 = __webpack_require__(190); | |
/* tslint:enable:max-line-length */ | |
/** | |
* Returns an Observable that emits the results of invoking a specified selector on items | |
* emitted by a ConnectableObservable that shares a single subscription to the underlying stream. | |
* | |
* <img src="./img/multicast.png" width="100%"> | |
* | |
* @param {Function|Subject} subjectOrSubjectFactory - Factory function to create an intermediate subject through | |
* which the source sequence's elements will be multicast to the selector function | |
* or Subject to push source elements into. | |
* @param {Function} [selector] - Optional selector function that can use the multicasted source stream | |
* as many times as needed, without causing multiple subscriptions to the source stream. | |
* Subscribers to the given source will receive all notifications of the source from the | |
* time of the subscription forward. | |
* @return {Observable} An Observable that emits the results of invoking the selector | |
* on the items emitted by a `ConnectableObservable` that shares a single subscription to | |
* the underlying stream. | |
* @method multicast | |
* @owner Observable | |
*/ | |
function multicast(subjectOrSubjectFactory, selector) { | |
var subjectFactory; | |
if (typeof subjectOrSubjectFactory === 'function') { | |
subjectFactory = subjectOrSubjectFactory; | |
} | |
else { | |
subjectFactory = function subjectFactory() { | |
return subjectOrSubjectFactory; | |
}; | |
} | |
if (typeof selector === 'function') { | |
return this.lift(new MulticastOperator(subjectFactory, selector)); | |
} | |
var connectable = Object.create(this, ConnectableObservable_1.connectableObservableDescriptor); | |
connectable.source = this; | |
connectable.subjectFactory = subjectFactory; | |
return connectable; | |
} | |
exports.multicast = multicast; | |
var MulticastOperator = (function () { | |
function MulticastOperator(subjectFactory, selector) { | |
this.subjectFactory = subjectFactory; | |
this.selector = selector; | |
} | |
MulticastOperator.prototype.call = function (subscriber, source) { | |
var selector = this.selector; | |
var subject = this.subjectFactory(); | |
var subscription = selector(subject).subscribe(subscriber); | |
subscription.add(source.subscribe(subject)); | |
return subscription; | |
}; | |
return MulticastOperator; | |
}()); | |
exports.MulticastOperator = MulticastOperator; | |
//# sourceMappingURL=multicast.js.map | |
/***/ }), | |
/* 68 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_common__ = __webpack_require__(79); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_1__angular_core__ = __webpack_require__(45); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserModule", function() { return BrowserModule; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowser", function() { return platformBrowser; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Meta", function() { return Meta; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Title", function() { return Title; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableDebugTools", function() { return disableDebugTools; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebugTools", function() { return enableDebugTools; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "By", function() { return By; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgProbeToken", function() { return NgProbeToken$1; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EVENT_MANAGER_PLUGINS", function() { return EVENT_MANAGER_PLUGINS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventManager", function() { return EventManager; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_GESTURE_CONFIG", function() { return HAMMER_GESTURE_CONFIG; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HammerGestureConfig", function() { return HammerGestureConfig; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomSanitizer", function() { return DomSanitizer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBROWSER_SANITIZATION_PROVIDERS", function() { return BROWSER_SANITIZATION_PROVIDERS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitDomAdapter", function() { return initDomAdapter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserDomAdapter", function() { return BrowserDomAdapter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetValueOnPath", function() { return setValueOnPath; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserPlatformLocation", function() { return BrowserPlatformLocation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵTRANSITION_ID", function() { return TRANSITION_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserGetTestability", function() { return BrowserGetTestability; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵELEMENT_PROBE_PROVIDERS", function() { return ELEMENT_PROBE_PROVIDERS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomAdapter", function() { return DomAdapter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDOM", function() { return getDOM; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetRootDomAdapter", function() { return setRootDomAdapter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomRendererFactory2", function() { return DomRendererFactory2; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNAMESPACE_URIS", function() { return NAMESPACE_URIS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflattenStyles", function() { return flattenStyles; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimContentAttribute", function() { return shimContentAttribute; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimHostAttribute", function() { return shimHostAttribute; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomEventsPlugin", function() { return DomEventsPlugin; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHammerGesturesPlugin", function() { return HammerGesturesPlugin; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵKeyEventsPlugin", function() { return KeyEventsPlugin; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSharedStylesHost", function() { return DomSharedStylesHost; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSharedStylesHost", function() { return SharedStylesHost; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return _document; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return errorHandler; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵh", function() { return GenericBrowserDomAdapter; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵg", function() { return SERVER_TRANSITION_PROVIDERS; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf", function() { return bootstrapListenerFactory; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵc", function() { return _createNgProbe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return EventManagerPlugin; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return DomSanitizerImpl; }); | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* @license Angular v4.0.1 | |
* (c) 2010-2017 Google, Inc. https://angular.io/ | |
* License: MIT | |
*/ | |
/** | |
* @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 _DOM = null; | |
/** | |
* @return {?} | |
*/ | |
function getDOM() { | |
return _DOM; | |
} | |
/** | |
* @param {?} adapter | |
* @return {?} | |
*/ | |
/** | |
* @param {?} adapter | |
* @return {?} | |
*/ | |
function setRootDomAdapter(adapter) { | |
if (!_DOM) { | |
_DOM = adapter; | |
} | |
} | |
/** | |
* Provides DOM operations in an environment-agnostic way. | |
* | |
* \@security Tread carefully! Interacting with the DOM directly is dangerous and | |
* can introduce XSS risks. | |
* @abstract | |
*/ | |
var DomAdapter = (function () { | |
function DomAdapter() { | |
this.resourceLoaderType = null; | |
} | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasProperty = function (element, name) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setProperty = function (el, name, value) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getProperty = function (el, name) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} methodName | |
* @param {?} args | |
* @return {?} | |
*/ | |
DomAdapter.prototype.invoke = function (el, methodName, args) { }; | |
/** | |
* @abstract | |
* @param {?} error | |
* @return {?} | |
*/ | |
DomAdapter.prototype.logError = function (error) { }; | |
/** | |
* @abstract | |
* @param {?} error | |
* @return {?} | |
*/ | |
DomAdapter.prototype.log = function (error) { }; | |
/** | |
* @abstract | |
* @param {?} error | |
* @return {?} | |
*/ | |
DomAdapter.prototype.logGroup = function (error) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.logGroupEnd = function () { }; | |
Object.defineProperty(DomAdapter.prototype, "attrToPropMap", { | |
/** | |
* Maps attribute names to their corresponding property names for cases | |
* where attribute name doesn't match property name. | |
* @return {?} | |
*/ | |
get: function () { return this._attrToPropMap; }, | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
set: function (value) { this._attrToPropMap = value; }, | |
enumerable: true, | |
configurable: true | |
}); | |
; | |
; | |
/** | |
* @abstract | |
* @param {?} nodeA | |
* @param {?} nodeB | |
* @return {?} | |
*/ | |
DomAdapter.prototype.contains = function (nodeA, nodeB) { }; | |
/** | |
* @abstract | |
* @param {?} templateHtml | |
* @return {?} | |
*/ | |
DomAdapter.prototype.parse = function (templateHtml) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} selector | |
* @return {?} | |
*/ | |
DomAdapter.prototype.querySelector = function (el, selector) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} selector | |
* @return {?} | |
*/ | |
DomAdapter.prototype.querySelectorAll = function (el, selector) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} evt | |
* @param {?} listener | |
* @return {?} | |
*/ | |
DomAdapter.prototype.on = function (el, evt, listener) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} evt | |
* @param {?} listener | |
* @return {?} | |
*/ | |
DomAdapter.prototype.onAndCancel = function (el, evt, listener) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} evt | |
* @return {?} | |
*/ | |
DomAdapter.prototype.dispatchEvent = function (el, evt) { }; | |
/** | |
* @abstract | |
* @param {?} eventType | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createMouseEvent = function (eventType) { }; | |
/** | |
* @abstract | |
* @param {?} eventType | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createEvent = function (eventType) { }; | |
/** | |
* @abstract | |
* @param {?} evt | |
* @return {?} | |
*/ | |
DomAdapter.prototype.preventDefault = function (evt) { }; | |
/** | |
* @abstract | |
* @param {?} evt | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isPrevented = function (evt) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getInnerHTML = function (el) { }; | |
/** | |
* Returns content if el is a <template> element, null otherwise. | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getTemplateContent = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getOuterHTML = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.nodeName = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.nodeValue = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.type = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.content = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.firstChild = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.nextSibling = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.parentElement = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.childNodes = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.childNodesAsList = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.clearNodes = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.appendChild = function (el, node) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.removeChild = function (el, node) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} newNode | |
* @param {?} oldNode | |
* @return {?} | |
*/ | |
DomAdapter.prototype.replaceChild = function (el, newNode, oldNode) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.remove = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} ref | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.insertBefore = function (parent, ref, node) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} ref | |
* @param {?} nodes | |
* @return {?} | |
*/ | |
DomAdapter.prototype.insertAllBefore = function (parent, ref, nodes) { }; | |
/** | |
* @abstract | |
* @param {?} parent | |
* @param {?} el | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.insertAfter = function (parent, el, node) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setInnerHTML = function (el, value) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getText = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setText = function (el, value) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getValue = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setValue = function (el, value) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getChecked = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setChecked = function (el, value) { }; | |
/** | |
* @abstract | |
* @param {?} text | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createComment = function (text) { }; | |
/** | |
* @abstract | |
* @param {?} html | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createTemplate = function (html) { }; | |
/** | |
* @abstract | |
* @param {?} tagName | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createElement = function (tagName, doc) { }; | |
/** | |
* @abstract | |
* @param {?} ns | |
* @param {?} tagName | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createElementNS = function (ns, tagName, doc) { }; | |
/** | |
* @abstract | |
* @param {?} text | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createTextNode = function (text, doc) { }; | |
/** | |
* @abstract | |
* @param {?} attrName | |
* @param {?} attrValue | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) { }; | |
/** | |
* @abstract | |
* @param {?} css | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createStyleElement = function (css, doc) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createShadowRoot = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getShadowRoot = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getHost = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getDistributedNodes = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.clone /*<T extends Node>*/ = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getElementsByClassName = function (element, name) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getElementsByTagName = function (element, name) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @return {?} | |
*/ | |
DomAdapter.prototype.classList = function (element) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
DomAdapter.prototype.addClass = function (element, className) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
DomAdapter.prototype.removeClass = function (element, className) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasClass = function (element, className) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} styleName | |
* @param {?} styleValue | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setStyle = function (element, styleName, styleValue) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} styleName | |
* @return {?} | |
*/ | |
DomAdapter.prototype.removeStyle = function (element, styleName) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} styleName | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getStyle = function (element, styleName) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} styleName | |
* @param {?=} styleValue | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasStyle = function (element, styleName, styleValue) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @return {?} | |
*/ | |
DomAdapter.prototype.tagName = function (element) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @return {?} | |
*/ | |
DomAdapter.prototype.attributeMap = function (element) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasAttribute = function (element, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getAttribute = function (element, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getAttributeNS = function (element, ns, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setAttribute = function (element, name, value) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setAttributeNS = function (element, ns, name, value) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.removeAttribute = function (element, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
DomAdapter.prototype.removeAttributeNS = function (element, ns, attribute) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.templateAwareRoot = function (el) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.createHtmlDocument = function () { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getBoundingClientRect = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getTitle = function (doc) { }; | |
/** | |
* @abstract | |
* @param {?} doc | |
* @param {?} newTitle | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setTitle = function (doc, newTitle) { }; | |
/** | |
* @abstract | |
* @param {?} n | |
* @param {?} selector | |
* @return {?} | |
*/ | |
DomAdapter.prototype.elementMatches = function (n, selector) { }; | |
/** | |
* @abstract | |
* @param {?} el | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isTemplateElement = function (el) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isTextNode = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isCommentNode = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isElementNode = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.hasShadowRoot = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.isShadowRoot = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.importIntoDoc /*<T extends Node>*/ = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} node | |
* @return {?} | |
*/ | |
DomAdapter.prototype.adoptNode /*<T extends Node>*/ = function (node) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getHref = function (element) { }; | |
/** | |
* @abstract | |
* @param {?} event | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getEventKey = function (event) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} baseUrl | |
* @param {?} href | |
* @return {?} | |
*/ | |
DomAdapter.prototype.resolveAndSetHref = function (element, baseUrl, href) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.supportsDOMEvents = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.supportsNativeShadowDOM = function () { }; | |
/** | |
* @abstract | |
* @param {?} doc | |
* @param {?} target | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getGlobalEventTarget = function (doc, target) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getHistory = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getLocation = function () { }; | |
/** | |
* @abstract | |
* @param {?} doc | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getBaseHref = function (doc) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.resetBaseElement = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getUserAgent = function () { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setData = function (element, name, value) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getComputedStyle = function (element) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getData = function (element, name) { }; | |
/** | |
* @abstract | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setGlobalVar = function (name, value) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.supportsWebAnimation = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.performanceNow = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getAnimationPrefix = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getTransitionEnd = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.supportsAnimation = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
DomAdapter.prototype.supportsCookies = function () { }; | |
/** | |
* @abstract | |
* @param {?} name | |
* @return {?} | |
*/ | |
DomAdapter.prototype.getCookie = function (name) { }; | |
/** | |
* @abstract | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomAdapter.prototype.setCookie = function (name, value) { }; | |
return DomAdapter; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* Provides DOM operations in any browser environment. | |
* | |
* \@security Tread carefully! Interacting with the DOM directly is dangerous and | |
* can introduce XSS risks. | |
* @abstract | |
*/ | |
var GenericBrowserDomAdapter = (function (_super) { | |
__extends(GenericBrowserDomAdapter, _super); | |
function GenericBrowserDomAdapter() { | |
var _this = _super.call(this) || this; | |
_this._animationPrefix = null; | |
_this._transitionEnd = null; | |
try { | |
var element_1 = _this.createElement('div', document); | |
if (_this.getStyle(element_1, 'animationName') != null) { | |
_this._animationPrefix = ''; | |
} | |
else { | |
var domPrefixes = ['Webkit', 'Moz', 'O', 'ms']; | |
for (var i = 0; i < domPrefixes.length; i++) { | |
if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) { | |
_this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-'; | |
break; | |
} | |
} | |
} | |
var transEndEventNames_1 = { | |
WebkitTransition: 'webkitTransitionEnd', | |
MozTransition: 'transitionend', | |
OTransition: 'oTransitionEnd otransitionend', | |
transition: 'transitionend' | |
}; | |
Object.keys(transEndEventNames_1).forEach(function (key) { | |
if (_this.getStyle(element_1, key) != null) { | |
_this._transitionEnd = transEndEventNames_1[key]; | |
} | |
}); | |
} | |
catch (e) { | |
_this._animationPrefix = null; | |
_this._transitionEnd = null; | |
} | |
return _this; | |
} | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return ((el)).getDistributedNodes(); }; | |
/** | |
* @param {?} el | |
* @param {?} baseUrl | |
* @param {?} href | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) { | |
el.href = href == null ? baseUrl : baseUrl + '/../' + href; | |
}; | |
/** | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; }; | |
/** | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () { | |
return typeof ((document.body)).createShadowRoot === 'function'; | |
}; | |
/** | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () { return this._animationPrefix ? this._animationPrefix : ''; }; | |
/** | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return this._transitionEnd ? this._transitionEnd : ''; }; | |
/** | |
* @return {?} | |
*/ | |
GenericBrowserDomAdapter.prototype.supportsAnimation = function () { | |
return this._animationPrefix != null && this._transitionEnd != null; | |
}; | |
return GenericBrowserDomAdapter; | |
}(DomAdapter)); | |
/** | |
* @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 _attrToPropMap = { | |
'class': 'className', | |
'innerHtml': 'innerHTML', | |
'readonly': 'readOnly', | |
'tabindex': 'tabIndex', | |
}; | |
var DOM_KEY_LOCATION_NUMPAD = 3; | |
// Map to convert some key or keyIdentifier values to what will be returned by getEventKey | |
var _keyMap = { | |
// The following values are here for cross-browser compatibility and to match the W3C standard | |
// cf http://www.w3.org/TR/DOM-Level-3-Events-key/ | |
'\b': 'Backspace', | |
'\t': 'Tab', | |
'\x7F': 'Delete', | |
'\x1B': 'Escape', | |
'Del': 'Delete', | |
'Esc': 'Escape', | |
'Left': 'ArrowLeft', | |
'Right': 'ArrowRight', | |
'Up': 'ArrowUp', | |
'Down': 'ArrowDown', | |
'Menu': 'ContextMenu', | |
'Scroll': 'ScrollLock', | |
'Win': 'OS' | |
}; | |
// There is a bug in Chrome for numeric keypad keys: | |
// https://code.google.com/p/chromium/issues/detail?id=155654 | |
// 1, 2, 3 ... are reported as A, B, C ... | |
var _chromeNumKeyPadMap = { | |
'A': '1', | |
'B': '2', | |
'C': '3', | |
'D': '4', | |
'E': '5', | |
'F': '6', | |
'G': '7', | |
'H': '8', | |
'I': '9', | |
'J': '*', | |
'K': '+', | |
'M': '-', | |
'N': '.', | |
'O': '/', | |
'\x60': '0', | |
'\x90': 'NumLock' | |
}; | |
var nodeContains; | |
if (__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['Node']) { | |
nodeContains = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['Node'].prototype.contains || function (node) { | |
return !!(this.compareDocumentPosition(node) & 16); | |
}; | |
} | |
var BrowserDomAdapter = (function (_super) { | |
__extends(BrowserDomAdapter, _super); | |
function BrowserDomAdapter() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @param {?} templateHtml | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.parse = function (templateHtml) { throw new Error('parse not implemented'); }; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.makeCurrent = function () { setRootDomAdapter(new BrowserDomAdapter()); }; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasProperty = function (element, name) { return name in element; }; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setProperty = function (el, name, value) { ((el))[name] = value; }; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getProperty = function (el, name) { return ((el))[name]; }; | |
/** | |
* @param {?} el | |
* @param {?} methodName | |
* @param {?} args | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.invoke = function (el, methodName, args) { ((el))[methodName].apply(((el)), args); }; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.logError = function (error) { | |
if (window.console) { | |
if (console.error) { | |
console.error(error); | |
} | |
else { | |
console.log(error); | |
} | |
} | |
}; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.log = function (error) { | |
if (window.console) { | |
window.console.log && window.console.log(error); | |
} | |
}; | |
/** | |
* @param {?} error | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.logGroup = function (error) { | |
if (window.console) { | |
window.console.group && window.console.group(error); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.logGroupEnd = function () { | |
if (window.console) { | |
window.console.groupEnd && window.console.groupEnd(); | |
} | |
}; | |
Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return _attrToPropMap; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} nodeA | |
* @param {?} nodeB | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.contains = function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); }; | |
/** | |
* @param {?} el | |
* @param {?} selector | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.querySelector = function (el, selector) { return el.querySelector(selector); }; | |
/** | |
* @param {?} el | |
* @param {?} selector | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.querySelectorAll = function (el, selector) { return el.querySelectorAll(selector); }; | |
/** | |
* @param {?} el | |
* @param {?} evt | |
* @param {?} listener | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.on = function (el, evt, listener) { el.addEventListener(evt, listener, false); }; | |
/** | |
* @param {?} el | |
* @param {?} evt | |
* @param {?} listener | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) { | |
el.addEventListener(evt, listener, false); | |
// Needed to follow Dart's subscription semantic, until fix of | |
// https://code.google.com/p/dart/issues/detail?id=17406 | |
return function () { el.removeEventListener(evt, listener, false); }; | |
}; | |
/** | |
* @param {?} el | |
* @param {?} evt | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) { el.dispatchEvent(evt); }; | |
/** | |
* @param {?} eventType | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createMouseEvent = function (eventType) { | |
var /** @type {?} */ evt = document.createEvent('MouseEvent'); | |
evt.initEvent(eventType, true, true); | |
return evt; | |
}; | |
/** | |
* @param {?} eventType | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createEvent = function (eventType) { | |
var /** @type {?} */ evt = document.createEvent('Event'); | |
evt.initEvent(eventType, true, true); | |
return evt; | |
}; | |
/** | |
* @param {?} evt | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.preventDefault = function (evt) { | |
evt.preventDefault(); | |
evt.returnValue = false; | |
}; | |
/** | |
* @param {?} evt | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isPrevented = function (evt) { | |
return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue; | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getInnerHTML = function (el) { return el.innerHTML; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getTemplateContent = function (el) { | |
return 'content' in el && el instanceof HTMLTemplateElement ? el.content : null; | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getOuterHTML = function (el) { return el.outerHTML; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.nodeName = function (node) { return node.nodeName; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.type = function (node) { return node.type; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.content = function (node) { | |
if (this.hasProperty(node, 'content')) { | |
return ((node)).content; | |
} | |
else { | |
return node; | |
} | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.firstChild = function (el) { return el.firstChild; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.nextSibling = function (el) { return el.nextSibling; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.parentElement = function (el) { return el.parentNode; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.childNodes = function (el) { return el.childNodes; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.childNodesAsList = function (el) { | |
var /** @type {?} */ childNodes = el.childNodes; | |
var /** @type {?} */ res = new Array(childNodes.length); | |
for (var /** @type {?} */ i = 0; i < childNodes.length; i++) { | |
res[i] = childNodes[i]; | |
} | |
return res; | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.clearNodes = function (el) { | |
while (el.firstChild) { | |
el.removeChild(el.firstChild); | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.appendChild = function (el, node) { el.appendChild(node); }; | |
/** | |
* @param {?} el | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.removeChild = function (el, node) { el.removeChild(node); }; | |
/** | |
* @param {?} el | |
* @param {?} newChild | |
* @param {?} oldChild | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.replaceChild = function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.remove = function (node) { | |
if (node.parentNode) { | |
node.parentNode.removeChild(node); | |
} | |
return node; | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} ref | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.insertBefore = function (parent, ref, node) { parent.insertBefore(node, ref); }; | |
/** | |
* @param {?} parent | |
* @param {?} ref | |
* @param {?} nodes | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.insertAllBefore = function (parent, ref, nodes) { | |
nodes.forEach(function (n) { return parent.insertBefore(n, ref); }); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} ref | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.insertAfter = function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); }; | |
/** | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setInnerHTML = function (el, value) { el.innerHTML = value; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getText = function (el) { return el.textContent; }; | |
/** | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setText = function (el, value) { el.textContent = value; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getValue = function (el) { return el.value; }; | |
/** | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setValue = function (el, value) { el.value = value; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getChecked = function (el) { return el.checked; }; | |
/** | |
* @param {?} el | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setChecked = function (el, value) { el.checked = value; }; | |
/** | |
* @param {?} text | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createComment = function (text) { return document.createComment(text); }; | |
/** | |
* @param {?} html | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createTemplate = function (html) { | |
var /** @type {?} */ t = document.createElement('template'); | |
t.innerHTML = html; | |
return t; | |
}; | |
/** | |
* @param {?} tagName | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createElement = function (tagName, doc) { | |
if (doc === void 0) { doc = document; } | |
return doc.createElement(tagName); | |
}; | |
/** | |
* @param {?} ns | |
* @param {?} tagName | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createElementNS = function (ns, tagName, doc) { | |
if (doc === void 0) { doc = document; } | |
return doc.createElementNS(ns, tagName); | |
}; | |
/** | |
* @param {?} text | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createTextNode = function (text, doc) { | |
if (doc === void 0) { doc = document; } | |
return doc.createTextNode(text); | |
}; | |
/** | |
* @param {?} attrName | |
* @param {?} attrValue | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) { | |
if (doc === void 0) { doc = document; } | |
var /** @type {?} */ el = (doc.createElement('SCRIPT')); | |
el.setAttribute(attrName, attrValue); | |
return el; | |
}; | |
/** | |
* @param {?} css | |
* @param {?=} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createStyleElement = function (css, doc) { | |
if (doc === void 0) { doc = document; } | |
var /** @type {?} */ style = (doc.createElement('style')); | |
this.appendChild(style, this.createTextNode(css)); | |
return style; | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createShadowRoot = function (el) { return ((el)).createShadowRoot(); }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getShadowRoot = function (el) { return ((el)).shadowRoot; }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getHost = function (el) { return ((el)).host; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.clone = function (node) { return node.cloneNode(true); }; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getElementsByClassName = function (element, name) { | |
return element.getElementsByClassName(name); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getElementsByTagName = function (element, name) { | |
return element.getElementsByTagName(name); | |
}; | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.classList = function (element) { return Array.prototype.slice.call(element.classList, 0); }; | |
/** | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.addClass = function (element, className) { element.classList.add(className); }; | |
/** | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.removeClass = function (element, className) { element.classList.remove(className); }; | |
/** | |
* @param {?} element | |
* @param {?} className | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasClass = function (element, className) { | |
return element.classList.contains(className); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} styleName | |
* @param {?} styleValue | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setStyle = function (element, styleName, styleValue) { | |
element.style[styleName] = styleValue; | |
}; | |
/** | |
* @param {?} element | |
* @param {?} stylename | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.removeStyle = function (element, stylename) { | |
// IE requires '' instead of null | |
// see https://github.com/angular/angular/issues/7916 | |
element.style[stylename] = ''; | |
}; | |
/** | |
* @param {?} element | |
* @param {?} stylename | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getStyle = function (element, stylename) { return element.style[stylename]; }; | |
/** | |
* @param {?} element | |
* @param {?} styleName | |
* @param {?=} styleValue | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasStyle = function (element, styleName, styleValue) { | |
if (styleValue === void 0) { styleValue = null; } | |
var /** @type {?} */ value = this.getStyle(element, styleName) || ''; | |
return styleValue ? value == styleValue : value.length > 0; | |
}; | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.tagName = function (element) { return element.tagName; }; | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.attributeMap = function (element) { | |
var /** @type {?} */ res = new Map(); | |
var /** @type {?} */ elAttrs = element.attributes; | |
for (var /** @type {?} */ i = 0; i < elAttrs.length; i++) { | |
var /** @type {?} */ attrib = elAttrs[i]; | |
res.set(attrib.name, attrib.value); | |
} | |
return res; | |
}; | |
/** | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasAttribute = function (element, attribute) { | |
return element.hasAttribute(attribute); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) { | |
return element.hasAttributeNS(ns, attribute); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getAttribute = function (element, attribute) { | |
return element.getAttribute(attribute); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getAttributeNS = function (element, ns, name) { | |
return element.getAttributeNS(ns, name); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setAttribute = function (element, name, value) { element.setAttribute(name, value); }; | |
/** | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setAttributeNS = function (element, ns, name, value) { | |
element.setAttributeNS(ns, name, value); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} attribute | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.removeAttribute = function (element, attribute) { element.removeAttribute(attribute); }; | |
/** | |
* @param {?} element | |
* @param {?} ns | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.removeAttributeNS = function (element, ns, name) { | |
element.removeAttributeNS(ns, name); | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.templateAwareRoot = function (el) { return this.isTemplateElement(el) ? this.content(el) : el; }; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.createHtmlDocument = function () { | |
return document.implementation.createHTMLDocument('fakeTitle'); | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getBoundingClientRect = function (el) { | |
try { | |
return el.getBoundingClientRect(); | |
} | |
catch (e) { | |
return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 }; | |
} | |
}; | |
/** | |
* @param {?} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getTitle = function (doc) { return document.title; }; | |
/** | |
* @param {?} doc | |
* @param {?} newTitle | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setTitle = function (doc, newTitle) { document.title = newTitle || ''; }; | |
/** | |
* @param {?} n | |
* @param {?} selector | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.elementMatches = function (n, selector) { | |
if (n instanceof HTMLElement) { | |
return n.matches && n.matches(selector) || | |
n.msMatchesSelector && n.msMatchesSelector(selector) || | |
n.webkitMatchesSelector && n.webkitMatchesSelector(selector); | |
} | |
return false; | |
}; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isTemplateElement = function (el) { | |
return el instanceof HTMLElement && el.nodeName == 'TEMPLATE'; | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isCommentNode = function (node) { return node.nodeType === Node.COMMENT_NODE; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.hasShadowRoot = function (node) { | |
return node.shadowRoot != null && node instanceof HTMLElement; | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.isShadowRoot = function (node) { return node instanceof DocumentFragment; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.importIntoDoc = function (node) { return document.importNode(this.templateAwareRoot(node), true); }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.adoptNode = function (node) { return document.adoptNode(node); }; | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getHref = function (el) { return ((el)).href; }; | |
/** | |
* @param {?} event | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getEventKey = function (event) { | |
var /** @type {?} */ key = event.key; | |
if (key == null) { | |
key = event.keyIdentifier; | |
// keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and | |
// Safari cf | |
// http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces | |
if (key == null) { | |
return 'Unidentified'; | |
} | |
if (key.startsWith('U+')) { | |
key = String.fromCharCode(parseInt(key.substring(2), 16)); | |
if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) { | |
// There is a bug in Chrome for numeric keypad keys: | |
// https://code.google.com/p/chromium/issues/detail?id=155654 | |
// 1, 2, 3 ... are reported as A, B, C ... | |
key = ((_chromeNumKeyPadMap))[key]; | |
} | |
} | |
} | |
return _keyMap[key] || key; | |
}; | |
/** | |
* @param {?} doc | |
* @param {?} target | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) { | |
if (target === 'window') { | |
return window; | |
} | |
if (target === 'document') { | |
return document; | |
} | |
if (target === 'body') { | |
return document.body; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getHistory = function () { return window.history; }; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getLocation = function () { return window.location; }; | |
/** | |
* @param {?} doc | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getBaseHref = function (doc) { | |
var /** @type {?} */ href = getBaseElementHref(); | |
return href == null ? null : relativePath(href); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.resetBaseElement = function () { baseElement = null; }; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getUserAgent = function () { return window.navigator.userAgent; }; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setData = function (element, name, value) { | |
this.setAttribute(element, 'data-' + name, value); | |
}; | |
/** | |
* @param {?} element | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getData = function (element, name) { | |
return this.getAttribute(element, 'data-' + name); | |
}; | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getComputedStyle = function (element) { return getComputedStyle(element); }; | |
/** | |
* @param {?} path | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setGlobalVar = function (path, value) { setValueOnPath(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"], path, value); }; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.supportsWebAnimation = function () { | |
return typeof ((Element)).prototype['animate'] === 'function'; | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.performanceNow = function () { | |
// performance.now() is not available in all browsers, see | |
// http://caniuse.com/#search=performance.now | |
return window.performance && window.performance.now ? window.performance.now() : | |
new Date().getTime(); | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.supportsCookies = function () { return true; }; | |
/** | |
* @param {?} name | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.getCookie = function (name) { return parseCookieValue(document.cookie, name); }; | |
/** | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
BrowserDomAdapter.prototype.setCookie = function (name, value) { | |
// document.cookie is magical, assigning into it assigns/overrides one cookie value, but does | |
// not clear other cookies. | |
document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value); | |
}; | |
return BrowserDomAdapter; | |
}(GenericBrowserDomAdapter)); | |
var baseElement = null; | |
/** | |
* @return {?} | |
*/ | |
function getBaseElementHref() { | |
if (!baseElement) { | |
baseElement = document.querySelector('base'); | |
if (!baseElement) { | |
return null; | |
} | |
} | |
return baseElement.getAttribute('href'); | |
} | |
// based on urlUtils.js in AngularJS 1 | |
var urlParsingNode; | |
/** | |
* @param {?} url | |
* @return {?} | |
*/ | |
function relativePath(url) { | |
if (!urlParsingNode) { | |
urlParsingNode = document.createElement('a'); | |
} | |
urlParsingNode.setAttribute('href', url); | |
return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname : | |
'/' + urlParsingNode.pathname; | |
} | |
/** | |
* @param {?} cookieStr | |
* @param {?} name | |
* @return {?} | |
*/ | |
function parseCookieValue(cookieStr, name) { | |
name = encodeURIComponent(name); | |
for (var _i = 0, _a = cookieStr.split(';'); _i < _a.length; _i++) { | |
var cookie = _a[_i]; | |
var /** @type {?} */ eqIndex = cookie.indexOf('='); | |
var _b = eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], cookieName = _b[0], cookieValue = _b[1]; | |
if (cookieName.trim() === name) { | |
return decodeURIComponent(cookieValue); | |
} | |
} | |
return null; | |
} | |
/** | |
* @param {?} global | |
* @param {?} path | |
* @param {?} value | |
* @return {?} | |
*/ | |
function setValueOnPath(global, path, value) { | |
var /** @type {?} */ parts = path.split('.'); | |
var /** @type {?} */ obj = global; | |
while (parts.length > 1) { | |
var /** @type {?} */ name = parts.shift(); | |
if (obj.hasOwnProperty(name) && obj[name] != null) { | |
obj = obj[name]; | |
} | |
else { | |
obj = obj[name] = {}; | |
} | |
} | |
if (obj === undefined || obj === null) { | |
obj = {}; | |
} | |
obj[parts.shift()] = value; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* A DI Token representing the main rendering context. In a browser this is the DOM Document. | |
* | |
* Note: Document might not be available in the Application Context when Application and Rendering | |
* Contexts are not the same (e.g. when running the application into a Web Worker). | |
* | |
* \@stable | |
*/ | |
var DOCUMENT = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('DocumentToken'); | |
/** | |
* @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 | |
* @return {?} | |
*/ | |
function supportsState() { | |
return !!window.history.pushState; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* `PlatformLocation` encapsulates all of the direct calls to platform APIs. | |
* This class should not be used directly by an application developer. Instead, use | |
* {\@link Location}. | |
*/ | |
var BrowserPlatformLocation = (function (_super) { | |
__extends(BrowserPlatformLocation, _super); | |
/** | |
* @param {?} _doc | |
*/ | |
function BrowserPlatformLocation(_doc) { | |
var _this = _super.call(this) || this; | |
_this._doc = _doc; | |
_this._init(); | |
return _this; | |
} | |
/** | |
* \@internal | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype._init = function () { | |
this._location = getDOM().getLocation(); | |
this._history = getDOM().getHistory(); | |
}; | |
Object.defineProperty(BrowserPlatformLocation.prototype, "location", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._location; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(this._doc); }; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.onPopState = function (fn) { | |
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false); | |
}; | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.onHashChange = function (fn) { | |
getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false); | |
}; | |
Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._location.pathname; }, | |
/** | |
* @param {?} newPath | |
* @return {?} | |
*/ | |
set: function (newPath) { this._location.pathname = newPath; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(BrowserPlatformLocation.prototype, "search", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._location.search; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(BrowserPlatformLocation.prototype, "hash", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._location.hash; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.pushState = function (state, title, url) { | |
if (supportsState()) { | |
this._history.pushState(state, title, url); | |
} | |
else { | |
this._location.hash = url; | |
} | |
}; | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.replaceState = function (state, title, url) { | |
if (supportsState()) { | |
this._history.replaceState(state, title, url); | |
} | |
else { | |
this._location.hash = url; | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); }; | |
/** | |
* @return {?} | |
*/ | |
BrowserPlatformLocation.prototype.back = function () { this._history.back(); }; | |
return BrowserPlatformLocation; | |
}(__WEBPACK_IMPORTED_MODULE_0__angular_common__["PlatformLocation"])); | |
BrowserPlatformLocation.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
BrowserPlatformLocation.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* A service that can be used to get and add meta tags. | |
* | |
* \@experimental | |
*/ | |
var Meta = (function () { | |
/** | |
* @param {?} _doc | |
*/ | |
function Meta(_doc) { | |
this._doc = _doc; | |
this._dom = getDOM(); | |
} | |
/** | |
* @param {?} tag | |
* @param {?=} forceCreation | |
* @return {?} | |
*/ | |
Meta.prototype.addTag = function (tag, forceCreation) { | |
if (forceCreation === void 0) { forceCreation = false; } | |
if (!tag) | |
return null; | |
return this._getOrCreateElement(tag, forceCreation); | |
}; | |
/** | |
* @param {?} tags | |
* @param {?=} forceCreation | |
* @return {?} | |
*/ | |
Meta.prototype.addTags = function (tags, forceCreation) { | |
var _this = this; | |
if (forceCreation === void 0) { forceCreation = false; } | |
if (!tags) | |
return []; | |
return tags.reduce(function (result, tag) { | |
if (tag) { | |
result.push(_this._getOrCreateElement(tag, forceCreation)); | |
} | |
return result; | |
}, []); | |
}; | |
/** | |
* @param {?} attrSelector | |
* @return {?} | |
*/ | |
Meta.prototype.getTag = function (attrSelector) { | |
if (!attrSelector) | |
return null; | |
return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]"); | |
}; | |
/** | |
* @param {?} attrSelector | |
* @return {?} | |
*/ | |
Meta.prototype.getTags = function (attrSelector) { | |
if (!attrSelector) | |
return []; | |
var /** @type {?} */ list /*NodeList*/ = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]"); | |
return list ? [].slice.call(list) : []; | |
}; | |
/** | |
* @param {?} tag | |
* @param {?=} selector | |
* @return {?} | |
*/ | |
Meta.prototype.updateTag = function (tag, selector) { | |
if (!tag) | |
return null; | |
selector = selector || this._parseSelector(tag); | |
var /** @type {?} */ meta = this.getTag(selector); | |
if (meta) { | |
return this._setMetaElementAttributes(tag, meta); | |
} | |
return this._getOrCreateElement(tag, true); | |
}; | |
/** | |
* @param {?} attrSelector | |
* @return {?} | |
*/ | |
Meta.prototype.removeTag = function (attrSelector) { this.removeTagElement(this.getTag(attrSelector)); }; | |
/** | |
* @param {?} meta | |
* @return {?} | |
*/ | |
Meta.prototype.removeTagElement = function (meta) { | |
if (meta) { | |
this._dom.remove(meta); | |
} | |
}; | |
/** | |
* @param {?} meta | |
* @param {?=} forceCreation | |
* @return {?} | |
*/ | |
Meta.prototype._getOrCreateElement = function (meta, forceCreation) { | |
if (forceCreation === void 0) { forceCreation = false; } | |
if (!forceCreation) { | |
var /** @type {?} */ selector = this._parseSelector(meta); | |
var /** @type {?} */ elem = this.getTag(selector); | |
// It's allowed to have multiple elements with the same name so it's not enough to | |
// just check that element with the same name already present on the page. We also need to | |
// check if element has tag attributes | |
if (elem && this._containsAttributes(meta, elem)) | |
return elem; | |
} | |
var /** @type {?} */ element = (this._dom.createElement('meta')); | |
this._setMetaElementAttributes(meta, element); | |
var /** @type {?} */ head = this._dom.getElementsByTagName(this._doc, 'head')[0]; | |
this._dom.appendChild(head, element); | |
return element; | |
}; | |
/** | |
* @param {?} tag | |
* @param {?} el | |
* @return {?} | |
*/ | |
Meta.prototype._setMetaElementAttributes = function (tag, el) { | |
var _this = this; | |
Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); }); | |
return el; | |
}; | |
/** | |
* @param {?} tag | |
* @return {?} | |
*/ | |
Meta.prototype._parseSelector = function (tag) { | |
var /** @type {?} */ attr = tag.name ? 'name' : 'property'; | |
return attr + "=\"" + tag[attr] + "\""; | |
}; | |
/** | |
* @param {?} tag | |
* @param {?} elem | |
* @return {?} | |
*/ | |
Meta.prototype._containsAttributes = function (tag, elem) { | |
var _this = this; | |
return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; }); | |
}; | |
return Meta; | |
}()); | |
Meta.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Meta.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* An id that identifies a particular application being bootstrapped, that should | |
* match across the client/server boundary. | |
*/ | |
var TRANSITION_ID = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('TRANSITION_ID'); | |
/** | |
* @param {?} transitionId | |
* @param {?} document | |
* @return {?} | |
*/ | |
function bootstrapListenerFactory(transitionId, document) { | |
var /** @type {?} */ factory = function () { | |
var /** @type {?} */ dom = getDOM(); | |
var /** @type {?} */ styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]")); | |
styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; }) | |
.forEach(function (el) { return dom.remove(el); }); | |
}; | |
return factory; | |
} | |
var SERVER_TRANSITION_PROVIDERS = [ | |
{ | |
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_INITIALIZER"], | |
useFactory: bootstrapListenerFactory, | |
deps: [TRANSITION_ID, DOCUMENT], | |
multi: true | |
}, | |
]; | |
/** | |
* @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 BrowserGetTestability = (function () { | |
function BrowserGetTestability() { | |
} | |
/** | |
* @return {?} | |
*/ | |
BrowserGetTestability.init = function () { __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["setTestabilityGetter"])(new BrowserGetTestability()); }; | |
/** | |
* @param {?} registry | |
* @return {?} | |
*/ | |
BrowserGetTestability.prototype.addToWindow = function (registry) { | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAngularTestability'] = function (elem, findInAncestors) { | |
if (findInAncestors === void 0) { findInAncestors = true; } | |
var /** @type {?} */ testability = registry.findTestabilityInTree(elem, findInAncestors); | |
if (testability == null) { | |
throw new Error('Could not find testability for element.'); | |
} | |
return testability; | |
}; | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); }; | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); }; | |
var /** @type {?} */ whenAllStable = function (callback /** TODO #9100 */) { | |
var /** @type {?} */ testabilities = __WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['getAllAngularTestabilities'](); | |
var /** @type {?} */ count = testabilities.length; | |
var /** @type {?} */ didWork = false; | |
var /** @type {?} */ decrement = function (didWork_ /** TODO #9100 */) { | |
didWork = didWork || didWork_; | |
count--; | |
if (count == 0) { | |
callback(didWork); | |
} | |
}; | |
testabilities.forEach(function (testability /** TODO #9100 */) { | |
testability.whenStable(decrement); | |
}); | |
}; | |
if (!__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers']) { | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers'] = []; | |
} | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["ɵglobal"]['frameworkStabilizers'].push(whenAllStable); | |
}; | |
/** | |
* @param {?} registry | |
* @param {?} elem | |
* @param {?} findInAncestors | |
* @return {?} | |
*/ | |
BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) { | |
if (elem == null) { | |
return null; | |
} | |
var /** @type {?} */ t = registry.getTestability(elem); | |
if (t != null) { | |
return t; | |
} | |
else if (!findInAncestors) { | |
return null; | |
} | |
if (getDOM().isShadowRoot(elem)) { | |
return this.findTestabilityInTree(registry, getDOM().getHost(elem), true); | |
} | |
return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true); | |
}; | |
return BrowserGetTestability; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* A service that can be used to get and set the title of a current HTML document. | |
* | |
* Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag) | |
* it is not possible to bind to the `text` property of the `HTMLTitleElement` elements | |
* (representing the `<title>` tag). Instead, this service can be used to set and get the current | |
* title value. | |
* | |
* \@experimental | |
*/ | |
var Title = (function () { | |
/** | |
* @param {?} _doc | |
*/ | |
function Title(_doc) { | |
this._doc = _doc; | |
} | |
/** | |
* Get the title of the current HTML document. | |
* @return {?} | |
*/ | |
Title.prototype.getTitle = function () { return getDOM().getTitle(this._doc); }; | |
/** | |
* Set the title of the current HTML document. | |
* @param {?} newTitle | |
* @return {?} | |
*/ | |
Title.prototype.setTitle = function (newTitle) { getDOM().setTitle(this._doc, newTitle); }; | |
return Title; | |
}()); | |
Title.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Title.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 __assign = (undefined && undefined.__assign) || Object.assign || function (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; | |
}; | |
var CORE_TOKENS = { | |
'ApplicationRef': __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"], | |
'NgZone': __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"], | |
}; | |
var INSPECT_GLOBAL_NAME = 'ng.probe'; | |
var CORE_TOKENS_GLOBAL_NAME = 'ng.coreTokens'; | |
/** | |
* Returns a {\@link DebugElement} for the given native DOM element, or | |
* null if the given native element does not have an Angular view associated | |
* with it. | |
* @param {?} element | |
* @return {?} | |
*/ | |
function inspectNativeElement(element) { | |
return __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["getDebugNode"])(element); | |
} | |
/** | |
* Deprecated. Use the one from '\@angular/core'. | |
* @deprecated | |
*/ | |
var NgProbeToken$1 = (function () { | |
/** | |
* @param {?} name | |
* @param {?} token | |
*/ | |
function NgProbeToken$1(name, token) { | |
this.name = name; | |
this.token = token; | |
} | |
return NgProbeToken$1; | |
}()); | |
/** | |
* @param {?} extraTokens | |
* @param {?} coreTokens | |
* @return {?} | |
*/ | |
function _createNgProbe(extraTokens, coreTokens) { | |
var /** @type {?} */ tokens = (extraTokens || []).concat(coreTokens || []); | |
getDOM().setGlobalVar(INSPECT_GLOBAL_NAME, inspectNativeElement); | |
getDOM().setGlobalVar(CORE_TOKENS_GLOBAL_NAME, __assign({}, CORE_TOKENS, _ngProbeTokensToMap(tokens || []))); | |
return function () { return inspectNativeElement; }; | |
} | |
/** | |
* @param {?} tokens | |
* @return {?} | |
*/ | |
function _ngProbeTokensToMap(tokens) { | |
return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {}); | |
} | |
/** | |
* Providers which support debugging Angular applications (e.g. via `ng.probe`). | |
*/ | |
var ELEMENT_PROBE_PROVIDERS = [ | |
{ | |
provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_INITIALIZER"], | |
useFactory: _createNgProbe, | |
deps: [ | |
[NgProbeToken$1, new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()], | |
[__WEBPACK_IMPORTED_MODULE_1__angular_core__["NgProbeToken"], new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"]()], | |
], | |
multi: true, | |
}, | |
]; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@stable | |
*/ | |
var EVENT_MANAGER_PLUGINS = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('EventManagerPlugins'); | |
/** | |
* \@stable | |
*/ | |
var EventManager = (function () { | |
/** | |
* @param {?} plugins | |
* @param {?} _zone | |
*/ | |
function EventManager(plugins, _zone) { | |
var _this = this; | |
this._zone = _zone; | |
this._eventNameToPlugin = new Map(); | |
plugins.forEach(function (p) { return p.manager = _this; }); | |
this._plugins = plugins.slice().reverse(); | |
} | |
/** | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
EventManager.prototype.addEventListener = function (element, eventName, handler) { | |
var /** @type {?} */ plugin = this._findPluginFor(eventName); | |
return plugin.addEventListener(element, eventName, handler); | |
}; | |
/** | |
* @param {?} target | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) { | |
var /** @type {?} */ plugin = this._findPluginFor(eventName); | |
return plugin.addGlobalEventListener(target, eventName, handler); | |
}; | |
/** | |
* @return {?} | |
*/ | |
EventManager.prototype.getZone = function () { return this._zone; }; | |
/** | |
* \@internal | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
EventManager.prototype._findPluginFor = function (eventName) { | |
var /** @type {?} */ plugin = this._eventNameToPlugin.get(eventName); | |
if (plugin) { | |
return plugin; | |
} | |
var /** @type {?} */ plugins = this._plugins; | |
for (var /** @type {?} */ i = 0; i < plugins.length; i++) { | |
var /** @type {?} */ plugin_1 = plugins[i]; | |
if (plugin_1.supports(eventName)) { | |
this._eventNameToPlugin.set(eventName, plugin_1); | |
return plugin_1; | |
} | |
} | |
throw new Error("No event manager plugin found for event " + eventName); | |
}; | |
return EventManager; | |
}()); | |
EventManager.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
EventManager.ctorParameters = function () { return [ | |
{ type: Array, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [EVENT_MANAGER_PLUGINS,] },] }, | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgZone"], }, | |
]; }; | |
/** | |
* @abstract | |
*/ | |
var EventManagerPlugin = (function () { | |
/** | |
* @param {?} _doc | |
*/ | |
function EventManagerPlugin(_doc) { | |
this._doc = _doc; | |
} | |
/** | |
* @abstract | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
EventManagerPlugin.prototype.supports = function (eventName) { }; | |
/** | |
* @abstract | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
EventManagerPlugin.prototype.addEventListener = function (element, eventName, handler) { }; | |
/** | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) { | |
var /** @type {?} */ target = getDOM().getGlobalEventTarget(this._doc, element); | |
if (!target) { | |
throw new Error("Unsupported event target " + target + " for event " + eventName); | |
} | |
return this.addEventListener(target, eventName, handler); | |
}; | |
; | |
return EventManagerPlugin; | |
}()); | |
/** | |
* @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 SharedStylesHost = (function () { | |
function SharedStylesHost() { | |
/** | |
* \@internal | |
*/ | |
this._stylesSet = new Set(); | |
} | |
/** | |
* @param {?} styles | |
* @return {?} | |
*/ | |
SharedStylesHost.prototype.addStyles = function (styles) { | |
var _this = this; | |
var /** @type {?} */ additions = new Set(); | |
styles.forEach(function (style) { | |
if (!_this._stylesSet.has(style)) { | |
_this._stylesSet.add(style); | |
additions.add(style); | |
} | |
}); | |
this.onStylesAdded(additions); | |
}; | |
/** | |
* @param {?} additions | |
* @return {?} | |
*/ | |
SharedStylesHost.prototype.onStylesAdded = function (additions) { }; | |
/** | |
* @return {?} | |
*/ | |
SharedStylesHost.prototype.getAllStyles = function () { return Array.from(this._stylesSet); }; | |
return SharedStylesHost; | |
}()); | |
SharedStylesHost.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
SharedStylesHost.ctorParameters = function () { return []; }; | |
var DomSharedStylesHost = (function (_super) { | |
__extends(DomSharedStylesHost, _super); | |
/** | |
* @param {?} _doc | |
*/ | |
function DomSharedStylesHost(_doc) { | |
var _this = _super.call(this) || this; | |
_this._doc = _doc; | |
_this._hostNodes = new Set(); | |
_this._styleNodes = new Set(); | |
_this._hostNodes.add(_doc.head); | |
return _this; | |
} | |
/** | |
* @param {?} styles | |
* @param {?} host | |
* @return {?} | |
*/ | |
DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) { | |
var _this = this; | |
styles.forEach(function (style) { | |
var /** @type {?} */ styleEl = _this._doc.createElement('style'); | |
styleEl.textContent = style; | |
_this._styleNodes.add(host.appendChild(styleEl)); | |
}); | |
}; | |
/** | |
* @param {?} hostNode | |
* @return {?} | |
*/ | |
DomSharedStylesHost.prototype.addHost = function (hostNode) { | |
this._addStylesToHost(this._stylesSet, hostNode); | |
this._hostNodes.add(hostNode); | |
}; | |
/** | |
* @param {?} hostNode | |
* @return {?} | |
*/ | |
DomSharedStylesHost.prototype.removeHost = function (hostNode) { this._hostNodes.delete(hostNode); }; | |
/** | |
* @param {?} additions | |
* @return {?} | |
*/ | |
DomSharedStylesHost.prototype.onStylesAdded = function (additions) { | |
var _this = this; | |
this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); }); | |
}; | |
/** | |
* @return {?} | |
*/ | |
DomSharedStylesHost.prototype.ngOnDestroy = function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); }; | |
return DomSharedStylesHost; | |
}(SharedStylesHost)); | |
DomSharedStylesHost.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DomSharedStylesHost.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 NAMESPACE_URIS = { | |
'svg': 'http://www.w3.org/2000/svg', | |
'xhtml': 'http://www.w3.org/1999/xhtml', | |
'xlink': 'http://www.w3.org/1999/xlink', | |
'xml': 'http://www.w3.org/XML/1998/namespace', | |
'xmlns': 'http://www.w3.org/2000/xmlns/', | |
}; | |
var COMPONENT_REGEX = /%COMP%/g; | |
var COMPONENT_VARIABLE = '%COMP%'; | |
var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE; | |
var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE; | |
/** | |
* @param {?} componentShortId | |
* @return {?} | |
*/ | |
function shimContentAttribute(componentShortId) { | |
return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId); | |
} | |
/** | |
* @param {?} componentShortId | |
* @return {?} | |
*/ | |
function shimHostAttribute(componentShortId) { | |
return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId); | |
} | |
/** | |
* @param {?} compId | |
* @param {?} styles | |
* @param {?} target | |
* @return {?} | |
*/ | |
function flattenStyles(compId, styles, target) { | |
for (var /** @type {?} */ i = 0; i < styles.length; i++) { | |
var /** @type {?} */ style = styles[i]; | |
if (Array.isArray(style)) { | |
flattenStyles(compId, style, target); | |
} | |
else { | |
style = style.replace(COMPONENT_REGEX, compId); | |
target.push(style); | |
} | |
} | |
return target; | |
} | |
/** | |
* @param {?} eventHandler | |
* @return {?} | |
*/ | |
function decoratePreventDefault(eventHandler) { | |
return function (event) { | |
var /** @type {?} */ allowDefaultBehavior = eventHandler(event); | |
if (allowDefaultBehavior === false) { | |
// TODO(tbosch): move preventDefault into event plugins... | |
event.preventDefault(); | |
event.returnValue = false; | |
} | |
}; | |
} | |
var DomRendererFactory2 = (function () { | |
/** | |
* @param {?} eventManager | |
* @param {?} sharedStylesHost | |
*/ | |
function DomRendererFactory2(eventManager, sharedStylesHost) { | |
this.eventManager = eventManager; | |
this.sharedStylesHost = sharedStylesHost; | |
this.rendererByCompId = new Map(); | |
this.defaultRenderer = new DefaultDomRenderer2(eventManager); | |
} | |
; | |
/** | |
* @param {?} element | |
* @param {?} type | |
* @return {?} | |
*/ | |
DomRendererFactory2.prototype.createRenderer = function (element, type) { | |
if (!element || !type) { | |
return this.defaultRenderer; | |
} | |
switch (type.encapsulation) { | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"].Emulated: { | |
var /** @type {?} */ renderer = this.rendererByCompId.get(type.id); | |
if (!renderer) { | |
renderer = | |
new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type); | |
this.rendererByCompId.set(type.id, renderer); | |
} | |
((renderer)).applyToHost(element); | |
return renderer; | |
} | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["ViewEncapsulation"].Native: | |
return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type); | |
default: { | |
if (!this.rendererByCompId.has(type.id)) { | |
var /** @type {?} */ styles = flattenStyles(type.id, type.styles, []); | |
this.sharedStylesHost.addStyles(styles); | |
this.rendererByCompId.set(type.id, this.defaultRenderer); | |
} | |
return this.defaultRenderer; | |
} | |
} | |
}; | |
return DomRendererFactory2; | |
}()); | |
DomRendererFactory2.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DomRendererFactory2.ctorParameters = function () { return [ | |
{ type: EventManager, }, | |
{ type: DomSharedStylesHost, }, | |
]; }; | |
var DefaultDomRenderer2 = (function () { | |
/** | |
* @param {?} eventManager | |
*/ | |
function DefaultDomRenderer2(eventManager) { | |
this.eventManager = eventManager; | |
this.data = Object.create(null); | |
} | |
/** | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.destroy = function () { }; | |
/** | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.createElement = function (name, namespace) { | |
if (namespace) { | |
return document.createElementNS(NAMESPACE_URIS[namespace], name); | |
} | |
return document.createElement(name); | |
}; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.createComment = function (value) { return document.createComment(value); }; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.createText = function (value) { return document.createTextNode(value); }; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) { parent.appendChild(newChild); }; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @param {?} refChild | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) { | |
if (parent) { | |
parent.insertBefore(newChild, refChild); | |
} | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} oldChild | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) { | |
if (parent) { | |
parent.removeChild(oldChild); | |
} | |
}; | |
/** | |
* @param {?} selectorOrNode | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode) { | |
var /** @type {?} */ el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) : | |
selectorOrNode; | |
if (!el) { | |
throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements"); | |
} | |
el.textContent = ''; | |
return el; | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.parentNode = function (node) { return node.parentNode; }; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.nextSibling = function (node) { return node.nextSibling; }; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) { | |
if (namespace) { | |
name = namespace + ":" + name; | |
var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace]; | |
if (namespaceUri) { | |
el.setAttributeNS(namespaceUri, name, value); | |
} | |
else { | |
el.setAttribute(name, value); | |
} | |
} | |
else { | |
el.setAttribute(name, value); | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?=} namespace | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) { | |
if (namespace) { | |
var /** @type {?} */ namespaceUri = NAMESPACE_URIS[namespace]; | |
if (namespaceUri) { | |
el.removeAttributeNS(namespaceUri, name); | |
} | |
else { | |
el.removeAttribute(namespace + ":" + name); | |
} | |
} | |
else { | |
el.removeAttribute(name); | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.addClass = function (el, name) { el.classList.add(name); }; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.removeClass = function (el, name) { el.classList.remove(name); }; | |
/** | |
* @param {?} el | |
* @param {?} style | |
* @param {?} value | |
* @param {?} flags | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) { | |
if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].DashCase) { | |
el.style.setProperty(style, value, !!(flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].Important) ? 'important' : ''); | |
} | |
else { | |
el.style[style] = value; | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {?} style | |
* @param {?} flags | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) { | |
if (flags & __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererStyleFlags2"].DashCase) { | |
el.style.removeProperty(style); | |
} | |
else { | |
// IE requires '' instead of null | |
// see https://github.com/angular/angular/issues/7916 | |
el.style[style] = ''; | |
} | |
}; | |
/** | |
* @param {?} el | |
* @param {?} name | |
* @param {?} value | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.setProperty = function (el, name, value) { | |
checkNoSyntheticProp(name, 'property'); | |
el[name] = value; | |
}; | |
/** | |
* @param {?} node | |
* @param {?} value | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.setValue = function (node, value) { node.nodeValue = value; }; | |
/** | |
* @param {?} target | |
* @param {?} event | |
* @param {?} callback | |
* @return {?} | |
*/ | |
DefaultDomRenderer2.prototype.listen = function (target, event, callback) { | |
checkNoSyntheticProp(event, 'listener'); | |
if (typeof target === 'string') { | |
return (this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback))); | |
} | |
return ((this.eventManager.addEventListener(target, event, decoratePreventDefault(callback)))); | |
}; | |
return DefaultDomRenderer2; | |
}()); | |
var AT_CHARCODE = '@'.charCodeAt(0); | |
/** | |
* @param {?} name | |
* @param {?} nameKind | |
* @return {?} | |
*/ | |
function checkNoSyntheticProp(name, nameKind) { | |
if (name.charCodeAt(0) === AT_CHARCODE) { | |
throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application."); | |
} | |
} | |
var EmulatedEncapsulationDomRenderer2 = (function (_super) { | |
__extends(EmulatedEncapsulationDomRenderer2, _super); | |
/** | |
* @param {?} eventManager | |
* @param {?} sharedStylesHost | |
* @param {?} component | |
*/ | |
function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) { | |
var _this = _super.call(this, eventManager) || this; | |
_this.component = component; | |
var styles = flattenStyles(component.id, component.styles, []); | |
sharedStylesHost.addStyles(styles); | |
_this.contentAttr = shimContentAttribute(component.id); | |
_this.hostAttr = shimHostAttribute(component.id); | |
return _this; | |
} | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); }; | |
/** | |
* @param {?} parent | |
* @param {?} name | |
* @return {?} | |
*/ | |
EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) { | |
var /** @type {?} */ el = _super.prototype.createElement.call(this, parent, name); | |
_super.prototype.setAttribute.call(this, el, this.contentAttr, ''); | |
return el; | |
}; | |
return EmulatedEncapsulationDomRenderer2; | |
}(DefaultDomRenderer2)); | |
var ShadowDomRenderer = (function (_super) { | |
__extends(ShadowDomRenderer, _super); | |
/** | |
* @param {?} eventManager | |
* @param {?} sharedStylesHost | |
* @param {?} hostEl | |
* @param {?} component | |
*/ | |
function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) { | |
var _this = _super.call(this, eventManager) || this; | |
_this.sharedStylesHost = sharedStylesHost; | |
_this.hostEl = hostEl; | |
_this.component = component; | |
_this.shadowRoot = hostEl.createShadowRoot(); | |
_this.sharedStylesHost.addHost(_this.shadowRoot); | |
var styles = flattenStyles(component.id, component.styles, []); | |
for (var i = 0; i < styles.length; i++) { | |
var styleEl = document.createElement('style'); | |
styleEl.textContent = styles[i]; | |
_this.shadowRoot.appendChild(styleEl); | |
} | |
return _this; | |
} | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) { return node === this.hostEl ? this.shadowRoot : node; }; | |
/** | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.destroy = function () { this.sharedStylesHost.removeHost(this.shadowRoot); }; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.appendChild = function (parent, newChild) { | |
return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} newChild | |
* @param {?} refChild | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) { | |
return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild); | |
}; | |
/** | |
* @param {?} parent | |
* @param {?} oldChild | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) { | |
return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild); | |
}; | |
/** | |
* @param {?} node | |
* @return {?} | |
*/ | |
ShadowDomRenderer.prototype.parentNode = function (node) { | |
return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node))); | |
}; | |
return ShadowDomRenderer; | |
}(DefaultDomRenderer2)); | |
/** | |
* @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 DomEventsPlugin = (function (_super) { | |
__extends(DomEventsPlugin, _super); | |
/** | |
* @param {?} doc | |
*/ | |
function DomEventsPlugin(doc) { | |
return _super.call(this, doc) || this; | |
} | |
/** | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
DomEventsPlugin.prototype.supports = function (eventName) { return true; }; | |
/** | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) { | |
element.addEventListener(eventName, /** @type {?} */ (handler), false); | |
return function () { return element.removeEventListener(eventName, /** @type {?} */ (handler), false); }; | |
}; | |
return DomEventsPlugin; | |
}(EventManagerPlugin)); | |
DomEventsPlugin.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DomEventsPlugin.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 EVENT_NAMES = { | |
// pan | |
'pan': true, | |
'panstart': true, | |
'panmove': true, | |
'panend': true, | |
'pancancel': true, | |
'panleft': true, | |
'panright': true, | |
'panup': true, | |
'pandown': true, | |
// pinch | |
'pinch': true, | |
'pinchstart': true, | |
'pinchmove': true, | |
'pinchend': true, | |
'pinchcancel': true, | |
'pinchin': true, | |
'pinchout': true, | |
// press | |
'press': true, | |
'pressup': true, | |
// rotate | |
'rotate': true, | |
'rotatestart': true, | |
'rotatemove': true, | |
'rotateend': true, | |
'rotatecancel': true, | |
// swipe | |
'swipe': true, | |
'swipeleft': true, | |
'swiperight': true, | |
'swipeup': true, | |
'swipedown': true, | |
// tap | |
'tap': true, | |
}; | |
/** | |
* A DI token that you can use to provide{\@link HammerGestureConfig} to Angular. Use it to configure | |
* Hammer gestures. | |
* | |
* \@experimental | |
*/ | |
var HAMMER_GESTURE_CONFIG = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["InjectionToken"]('HammerGestureConfig'); | |
/** | |
* \@experimental | |
*/ | |
var HammerGestureConfig = (function () { | |
function HammerGestureConfig() { | |
this.events = []; | |
this.overrides = {}; | |
} | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
HammerGestureConfig.prototype.buildHammer = function (element) { | |
var /** @type {?} */ mc = new Hammer(element); | |
mc.get('pinch').set({ enable: true }); | |
mc.get('rotate').set({ enable: true }); | |
for (var /** @type {?} */ eventName in this.overrides) { | |
mc.get(eventName).set(this.overrides[eventName]); | |
} | |
return mc; | |
}; | |
return HammerGestureConfig; | |
}()); | |
HammerGestureConfig.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
HammerGestureConfig.ctorParameters = function () { return []; }; | |
var HammerGesturesPlugin = (function (_super) { | |
__extends(HammerGesturesPlugin, _super); | |
/** | |
* @param {?} doc | |
* @param {?} _config | |
*/ | |
function HammerGesturesPlugin(doc, _config) { | |
var _this = _super.call(this, doc) || this; | |
_this._config = _config; | |
return _this; | |
} | |
/** | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
HammerGesturesPlugin.prototype.supports = function (eventName) { | |
if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) { | |
return false; | |
} | |
if (!((window)).Hammer) { | |
throw new Error("Hammer.js is not loaded, can not bind " + eventName + " event"); | |
} | |
return true; | |
}; | |
/** | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) { | |
var _this = this; | |
var /** @type {?} */ zone = this.manager.getZone(); | |
eventName = eventName.toLowerCase(); | |
return zone.runOutsideAngular(function () { | |
// Creating the manager bind events, must be done outside of angular | |
var /** @type {?} */ mc = _this._config.buildHammer(element); | |
var /** @type {?} */ callback = function (eventObj) { | |
zone.runGuarded(function () { handler(eventObj); }); | |
}; | |
mc.on(eventName, callback); | |
return function () { return mc.off(eventName, callback); }; | |
}); | |
}; | |
/** | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; }; | |
return HammerGesturesPlugin; | |
}(EventManagerPlugin)); | |
HammerGesturesPlugin.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
HammerGesturesPlugin.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
{ type: HammerGestureConfig, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [HAMMER_GESTURE_CONFIG,] },] }, | |
]; }; | |
/** | |
* @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 MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift']; | |
var MODIFIER_KEY_GETTERS = { | |
'alt': function (event) { return event.altKey; }, | |
'control': function (event) { return event.ctrlKey; }, | |
'meta': function (event) { return event.metaKey; }, | |
'shift': function (event) { return event.shiftKey; } | |
}; | |
/** | |
* \@experimental | |
*/ | |
var KeyEventsPlugin = (function (_super) { | |
__extends(KeyEventsPlugin, _super); | |
/** | |
* @param {?} doc | |
*/ | |
function KeyEventsPlugin(doc) { | |
return _super.call(this, doc) || this; | |
} | |
/** | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
KeyEventsPlugin.prototype.supports = function (eventName) { return KeyEventsPlugin.parseEventName(eventName) != null; }; | |
/** | |
* @param {?} element | |
* @param {?} eventName | |
* @param {?} handler | |
* @return {?} | |
*/ | |
KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) { | |
var /** @type {?} */ parsedEvent = KeyEventsPlugin.parseEventName(eventName); | |
var /** @type {?} */ outsideHandler = KeyEventsPlugin.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone()); | |
return this.manager.getZone().runOutsideAngular(function () { | |
return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler); | |
}); | |
}; | |
/** | |
* @param {?} eventName | |
* @return {?} | |
*/ | |
KeyEventsPlugin.parseEventName = function (eventName) { | |
var /** @type {?} */ parts = eventName.toLowerCase().split('.'); | |
var /** @type {?} */ domEventName = parts.shift(); | |
if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) { | |
return null; | |
} | |
var /** @type {?} */ key = KeyEventsPlugin._normalizeKey(parts.pop()); | |
var /** @type {?} */ fullKey = ''; | |
MODIFIER_KEYS.forEach(function (modifierName) { | |
var /** @type {?} */ index = parts.indexOf(modifierName); | |
if (index > -1) { | |
parts.splice(index, 1); | |
fullKey += modifierName + '.'; | |
} | |
}); | |
fullKey += key; | |
if (parts.length != 0 || key.length === 0) { | |
// returning null instead of throwing to let another plugin process the event | |
return null; | |
} | |
var /** @type {?} */ result = {}; | |
result['domEventName'] = domEventName; | |
result['fullKey'] = fullKey; | |
return result; | |
}; | |
/** | |
* @param {?} event | |
* @return {?} | |
*/ | |
KeyEventsPlugin.getEventFullKey = function (event) { | |
var /** @type {?} */ fullKey = ''; | |
var /** @type {?} */ key = getDOM().getEventKey(event); | |
key = key.toLowerCase(); | |
if (key === ' ') { | |
key = 'space'; // for readability | |
} | |
else if (key === '.') { | |
key = 'dot'; // because '.' is used as a separator in event names | |
} | |
MODIFIER_KEYS.forEach(function (modifierName) { | |
if (modifierName != key) { | |
var /** @type {?} */ modifierGetter = MODIFIER_KEY_GETTERS[modifierName]; | |
if (modifierGetter(event)) { | |
fullKey += modifierName + '.'; | |
} | |
} | |
}); | |
fullKey += key; | |
return fullKey; | |
}; | |
/** | |
* @param {?} fullKey | |
* @param {?} handler | |
* @param {?} zone | |
* @return {?} | |
*/ | |
KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) { | |
return function (event /** TODO #9100 */) { | |
if (KeyEventsPlugin.getEventFullKey(event) === fullKey) { | |
zone.runGuarded(function () { return handler(event); }); | |
} | |
}; | |
}; | |
/** | |
* \@internal | |
* @param {?} keyName | |
* @return {?} | |
*/ | |
KeyEventsPlugin._normalizeKey = function (keyName) { | |
// TODO: switch to a Map if the mapping grows too much | |
switch (keyName) { | |
case 'esc': | |
return 'escape'; | |
default: | |
return keyName; | |
} | |
}; | |
return KeyEventsPlugin; | |
}(EventManagerPlugin)); | |
KeyEventsPlugin.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
KeyEventsPlugin.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* A pattern that recognizes a commonly useful subset of URLs that are safe. | |
* | |
* This regular expression matches a subset of URLs that will not cause script | |
* execution if used in URL context within a HTML document. Specifically, this | |
* regular expression matches if (comment from here on and regex copied from | |
* Soy's EscapingConventions): | |
* (1) Either a protocol in a whitelist (http, https, mailto or ftp). | |
* (2) or no protocol. A protocol must be followed by a colon. The below | |
* allows that by allowing colons only after one of the characters [/?#]. | |
* A colon after a hash (#) must be in the fragment. | |
* Otherwise, a colon after a (?) must be in a query. | |
* Otherwise, a colon after a single solidus (/) must be in a path. | |
* Otherwise, a colon after a double solidus (//) must be in the authority | |
* (before port). | |
* | |
* The pattern disallows &, used in HTML entity declarations before | |
* one of the characters in [/?#]. This disallows HTML entities used in the | |
* protocol name, which should never happen, e.g. "http" for "http". | |
* It also disallows HTML entities in the first path part of a relative path, | |
* e.g. "foo<bar/baz". Our existing escaping functions should not produce | |
* that. More importantly, it disallows masking of a colon, | |
* e.g. "javascript:...". | |
* | |
* This regular expression was taken from the Closure sanitization library. | |
*/ | |
var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi; | |
/** A pattern that matches safe data URLs. Only matches image, video and audio types. */ | |
var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z0-9+\/]+=*$/i; | |
/** | |
* @param {?} url | |
* @return {?} | |
*/ | |
function sanitizeUrl(url) { | |
url = String(url); | |
if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN)) | |
return url; | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])()) { | |
getDOM().log("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)"); | |
} | |
return 'unsafe:' + url; | |
} | |
/** | |
* @param {?} srcset | |
* @return {?} | |
*/ | |
function sanitizeSrcset(srcset) { | |
srcset = String(srcset); | |
return srcset.split(',').map(function (srcset) { return sanitizeUrl(srcset.trim()); }).join(', '); | |
} | |
/** | |
* @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 | |
*/ | |
/** A <body> element that can be safely used to parse untrusted HTML. Lazily initialized below. */ | |
var inertElement = null; | |
/** Lazily initialized to make sure the DOM adapter gets set before use. */ | |
var DOM = null; | |
/** | |
* Returns an HTML element that is guaranteed to not execute code when creating elements in it. | |
* @return {?} | |
*/ | |
function getInertElement() { | |
if (inertElement) | |
return inertElement; | |
DOM = getDOM(); | |
// Prefer using <template> element if supported. | |
var /** @type {?} */ templateEl = DOM.createElement('template'); | |
if ('content' in templateEl) | |
return templateEl; | |
var /** @type {?} */ doc = DOM.createHtmlDocument(); | |
inertElement = DOM.querySelector(doc, 'body'); | |
if (inertElement == null) { | |
// usually there should be only one body element in the document, but IE doesn't have any, so we | |
// need to create one. | |
var /** @type {?} */ html = DOM.createElement('html', doc); | |
inertElement = DOM.createElement('body', doc); | |
DOM.appendChild(html, inertElement); | |
DOM.appendChild(doc, html); | |
} | |
return inertElement; | |
} | |
/** | |
* @param {?} tags | |
* @return {?} | |
*/ | |
function tagSet(tags) { | |
var /** @type {?} */ res = {}; | |
for (var _i = 0, _a = tags.split(','); _i < _a.length; _i++) { | |
var t = _a[_i]; | |
res[t] = true; | |
} | |
return res; | |
} | |
/** | |
* @param {...?} sets | |
* @return {?} | |
*/ | |
function merge() { | |
var sets = []; | |
for (var _i = 0; _i < arguments.length; _i++) { | |
sets[_i] = arguments[_i]; | |
} | |
var /** @type {?} */ res = {}; | |
for (var _a = 0, sets_1 = sets; _a < sets_1.length; _a++) { | |
var s = sets_1[_a]; | |
for (var /** @type {?} */ v in s) { | |
if (s.hasOwnProperty(v)) | |
res[v] = true; | |
} | |
} | |
return res; | |
} | |
// Good source of info about elements and attributes | |
// http://dev.w3.org/html5/spec/Overview.html#semantics | |
// http://simon.html5.org/html-elements | |
// Safe Void Elements - HTML5 | |
// http://dev.w3.org/html5/spec/Overview.html#void-elements | |
var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr'); | |
// Elements that you can, intentionally, leave open (and which close themselves) | |
// http://dev.w3.org/html5/spec/Overview.html#optional-tags | |
var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr'); | |
var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt'); | |
var OPTIONAL_END_TAG_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS); | |
// Safe Block Elements - HTML5 | |
var BLOCK_ELEMENTS = merge(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' + | |
'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' + | |
'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul')); | |
// Inline Elements - HTML5 | |
var INLINE_ELEMENTS = merge(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' + | |
'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' + | |
'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video')); | |
var VALID_ELEMENTS = merge(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS); | |
// Attributes that have href and hence need to be sanitized | |
var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href'); | |
// Attributes that have special href set hence need to be sanitized | |
var SRCSET_ATTRS = tagSet('srcset'); | |
var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' + | |
'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' + | |
'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' + | |
'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' + | |
'valign,value,vspace,width'); | |
// NB: This currently conciously doesn't support SVG. SVG sanitization has had several security | |
// issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via | |
// innerHTML is required, SVG attributes should be added here. | |
// NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those | |
// can be sanitized, but they increase security surface area without a legitimate use case, so they | |
// are left out here. | |
var VALID_ATTRS = merge(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS); | |
/** | |
* SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe | |
* attributes. | |
*/ | |
var SanitizingHtmlSerializer = (function () { | |
function SanitizingHtmlSerializer() { | |
this.sanitizedSomething = false; | |
this.buf = []; | |
} | |
/** | |
* @param {?} el | |
* @return {?} | |
*/ | |
SanitizingHtmlSerializer.prototype.sanitizeChildren = function (el) { | |
// This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters. | |
// However this code never accesses properties off of `document` before deleting its contents | |
// again, so it shouldn't be vulnerable to DOM clobbering. | |
var /** @type {?} */ current = el.firstChild; | |
while (current) { | |
if (DOM.isElementNode(current)) { | |
this.startElement(/** @type {?} */ (current)); | |
} | |
else if (DOM.isTextNode(current)) { | |
this.chars(DOM.nodeValue(current)); | |
} | |
else { | |
// Strip non-element, non-text nodes. | |
this.sanitizedSomething = true; | |
} | |
if (DOM.firstChild(current)) { | |
current = DOM.firstChild(current); | |
continue; | |
} | |
while (current) { | |
// Leaving the element. Walk up and to the right, closing tags as we go. | |
if (DOM.isElementNode(current)) { | |
this.endElement(/** @type {?} */ (current)); | |
} | |
var /** @type {?} */ next = checkClobberedElement(current, DOM.nextSibling(current)); | |
if (next) { | |
current = next; | |
break; | |
} | |
current = checkClobberedElement(current, DOM.parentElement(current)); | |
} | |
} | |
return this.buf.join(''); | |
}; | |
/** | |
* @param {?} element | |
* @return {?} | |
*/ | |
SanitizingHtmlSerializer.prototype.startElement = function (element) { | |
var _this = this; | |
var /** @type {?} */ tagName = DOM.nodeName(element).toLowerCase(); | |
if (!VALID_ELEMENTS.hasOwnProperty(tagName)) { | |
this.sanitizedSomething = true; | |
return; | |
} | |
this.buf.push('<'); | |
this.buf.push(tagName); | |
DOM.attributeMap(element).forEach(function (value, attrName) { | |
var /** @type {?} */ lower = attrName.toLowerCase(); | |
if (!VALID_ATTRS.hasOwnProperty(lower)) { | |
_this.sanitizedSomething = true; | |
return; | |
} | |
// TODO(martinprobst): Special case image URIs for data:image/... | |
if (URI_ATTRS[lower]) | |
value = sanitizeUrl(value); | |
if (SRCSET_ATTRS[lower]) | |
value = sanitizeSrcset(value); | |
_this.buf.push(' '); | |
_this.buf.push(attrName); | |
_this.buf.push('="'); | |
_this.buf.push(encodeEntities(value)); | |
_this.buf.push('"'); | |
}); | |
this.buf.push('>'); | |
}; | |
/** | |
* @param {?} current | |
* @return {?} | |
*/ | |
SanitizingHtmlSerializer.prototype.endElement = function (current) { | |
var /** @type {?} */ tagName = DOM.nodeName(current).toLowerCase(); | |
if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) { | |
this.buf.push('</'); | |
this.buf.push(tagName); | |
this.buf.push('>'); | |
} | |
}; | |
/** | |
* @param {?} chars | |
* @return {?} | |
*/ | |
SanitizingHtmlSerializer.prototype.chars = function (chars) { this.buf.push(encodeEntities(chars)); }; | |
return SanitizingHtmlSerializer; | |
}()); | |
/** | |
* @param {?} node | |
* @param {?} nextNode | |
* @return {?} | |
*/ | |
function checkClobberedElement(node, nextNode) { | |
if (nextNode && DOM.contains(node, nextNode)) { | |
throw new Error("Failed to sanitize html because the element is clobbered: " + DOM.getOuterHTML(node)); | |
} | |
return nextNode; | |
} | |
// Regular Expressions for parsing tags and attributes | |
var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g; | |
// ! to ~ is the ASCII range. | |
var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g; | |
/** | |
* Escapes all potentially dangerous characters, so that the | |
* resulting string can be safely inserted into attribute or | |
* element text. | |
* @param {?} value | |
* @return {?} | |
*/ | |
function encodeEntities(value) { | |
return value.replace(/&/g, '&') | |
.replace(SURROGATE_PAIR_REGEXP, function (match) { | |
var /** @type {?} */ hi = match.charCodeAt(0); | |
var /** @type {?} */ low = match.charCodeAt(1); | |
return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';'; | |
}) | |
.replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; }) | |
.replace(/</g, '<') | |
.replace(/>/g, '>'); | |
} | |
/** | |
* When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1' | |
* attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g. 'ns1:xlink:foo'). | |
* | |
* This is undesirable since we don't want to allow any of these custom attributes. This method | |
* strips them all. | |
* @param {?} el | |
* @return {?} | |
*/ | |
function stripCustomNsAttrs(el) { | |
DOM.attributeMap(el).forEach(function (_, attrName) { | |
if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) { | |
DOM.removeAttribute(el, attrName); | |
} | |
}); | |
for (var _i = 0, _a = DOM.childNodesAsList(el); _i < _a.length; _i++) { | |
var n = _a[_i]; | |
if (DOM.isElementNode(n)) | |
stripCustomNsAttrs(/** @type {?} */ (n)); | |
} | |
} | |
/** | |
* Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to | |
* the DOM in a browser environment. | |
* @param {?} defaultDoc | |
* @param {?} unsafeHtmlInput | |
* @return {?} | |
*/ | |
function sanitizeHtml(defaultDoc, unsafeHtmlInput) { | |
try { | |
var /** @type {?} */ containerEl = getInertElement(); | |
// Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime). | |
var /** @type {?} */ unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : ''; | |
// mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser | |
// trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous. | |
var /** @type {?} */ mXSSAttempts = 5; | |
var /** @type {?} */ parsedHtml = unsafeHtml; | |
do { | |
if (mXSSAttempts === 0) { | |
throw new Error('Failed to sanitize html because the input is unstable'); | |
} | |
mXSSAttempts--; | |
unsafeHtml = parsedHtml; | |
DOM.setInnerHTML(containerEl, unsafeHtml); | |
if (defaultDoc.documentMode) { | |
// strip custom-namespaced attributes on IE<=11 | |
stripCustomNsAttrs(containerEl); | |
} | |
parsedHtml = DOM.getInnerHTML(containerEl); | |
} while (unsafeHtml !== parsedHtml); | |
var /** @type {?} */ sanitizer = new SanitizingHtmlSerializer(); | |
var /** @type {?} */ safeHtml = sanitizer.sanitizeChildren(DOM.getTemplateContent(containerEl) || containerEl); | |
// Clear out the body element. | |
var /** @type {?} */ parent = DOM.getTemplateContent(containerEl) || containerEl; | |
for (var _i = 0, _a = DOM.childNodesAsList(parent); _i < _a.length; _i++) { | |
var child = _a[_i]; | |
DOM.removeChild(parent, child); | |
} | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])() && sanitizer.sanitizedSomething) { | |
DOM.log('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).'); | |
} | |
return safeHtml; | |
} | |
catch (e) { | |
// In case anything goes wrong, clear out inertElement to reset the entire DOM structure. | |
inertElement = null; | |
throw e; | |
} | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Regular expression for safe style values. | |
* | |
* Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced. | |
* | |
* ',' allows multiple values to be assigned to the same property (e.g. background-attachment or | |
* font-family) and hence could allow multiple values to get injected, but that should pose no risk | |
* of XSS. | |
* | |
* The function expression checks only for XSS safety, not for CSS validity. | |
* | |
* This regular expression was taken from the Closure sanitization library, and augmented for | |
* transformation values. | |
*/ | |
var VALUES = '[-,."\'%_!# a-zA-Z0-9]+'; | |
var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?'; | |
var COLOR_FNS = '(?:rgb|hsl)a?'; | |
var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient'; | |
var CSS3_FNS = '(?:calc|attr)'; | |
var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)'; | |
var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" + | |
("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") + | |
(FN_ARGS + ")$"), 'g'); | |
/** | |
* Matches a `url(...)` value with an arbitrary argument as long as it does | |
* not contain parentheses. | |
* | |
* The URL value still needs to be sanitized separately. | |
* | |
* `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted | |
* CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g. | |
* by observing whether scroll bars are displayed, or character ranges used by a font face | |
* definition. | |
* | |
* Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that | |
* binding a URL value without further cooperation from the page will cause an information leak, and | |
* if so, it is just a leak, not a full blown XSS vulnerability. | |
* | |
* Given the common use case, low likelihood of attack vector, and low impact of an attack, this | |
* code is permissive and allows URLs that sanitize otherwise. | |
*/ | |
var URL_RE = /^url\(([^)]+)\)$/; | |
/** | |
* Checks that quotes (" and ') are properly balanced inside a string. Assumes | |
* that neither escape (\) nor any other character that could result in | |
* breaking out of a string parsing context are allowed; | |
* see http://www.w3.org/TR/css3-syntax/#string-token-diagram. | |
* | |
* This code was taken from the Closure sanitization library. | |
* @param {?} value | |
* @return {?} | |
*/ | |
function hasBalancedQuotes(value) { | |
var /** @type {?} */ outsideSingle = true; | |
var /** @type {?} */ outsideDouble = true; | |
for (var /** @type {?} */ i = 0; i < value.length; i++) { | |
var /** @type {?} */ c = value.charAt(i); | |
if (c === '\'' && outsideDouble) { | |
outsideSingle = !outsideSingle; | |
} | |
else if (c === '"' && outsideSingle) { | |
outsideDouble = !outsideDouble; | |
} | |
} | |
return outsideSingle && outsideDouble; | |
} | |
/** | |
* Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single | |
* value) and returns a value that is safe to use in a browser environment. | |
* @param {?} value | |
* @return {?} | |
*/ | |
function sanitizeStyle(value) { | |
value = String(value).trim(); // Make sure it's actually a string. | |
if (!value) | |
return ''; | |
// Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for | |
// reasoning behind this. | |
var /** @type {?} */ urlMatch = value.match(URL_RE); | |
if ((urlMatch && sanitizeUrl(urlMatch[1]) === urlMatch[1]) || | |
value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) { | |
return value; // Safe style values. | |
} | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["isDevMode"])()) { | |
getDOM().log("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss)."); | |
} | |
return 'unsafe'; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing | |
* values to be safe to use in the different DOM contexts. | |
* | |
* For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be | |
* sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on | |
* the website. | |
* | |
* In specific situations, it might be necessary to disable sanitization, for example if the | |
* application genuinely needs to produce a `javascript:` style link with a dynamic value in it. | |
* Users can bypass security by constructing a value with one of the `bypassSecurityTrust...` | |
* methods, and then binding to that value from the template. | |
* | |
* These situations should be very rare, and extraordinary care must be taken to avoid creating a | |
* Cross Site Scripting (XSS) security bug! | |
* | |
* When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as | |
* close as possible to the source of the value, to make it easy to verify no security bug is | |
* created by its use. | |
* | |
* It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that | |
* does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous | |
* code. The sanitizer leaves safe values intact. | |
* | |
* \@security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in | |
* sanitization for the value passed in. Carefully check and audit all values and code paths going | |
* into this call. Make sure any user data is appropriately escaped for this security context. | |
* For more detail, see the [Security Guide](http://g.co/ng/security). | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var DomSanitizer = (function () { | |
function DomSanitizer() { | |
} | |
/** | |
* Sanitizes a value for use in the given SecurityContext. | |
* | |
* If value is trusted for the context, this method will unwrap the contained safe value and use | |
* it directly. Otherwise, value will be sanitized to be safe in the given context, for example | |
* by replacing URLs that have an unsafe protocol part (such as `javascript:`). The implementation | |
* is responsible to make sure that the value can definitely be safely used in the given context. | |
* @abstract | |
* @param {?} context | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.sanitize = function (context, value) { }; | |
/** | |
* Bypass security and trust the given value to be safe HTML. Only use this when the bound HTML | |
* is unsafe (e.g. contains `<script>` tags) and the code should be executed. The sanitizer will | |
* leave safe HTML intact, so in most situations this method should not be used. | |
* | |
* **WARNING:** calling this method with untrusted user data exposes your application to XSS | |
* security risks! | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.bypassSecurityTrustHtml = function (value) { }; | |
/** | |
* Bypass security and trust the given value to be safe style value (CSS). | |
* | |
* **WARNING:** calling this method with untrusted user data exposes your application to XSS | |
* security risks! | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.bypassSecurityTrustStyle = function (value) { }; | |
/** | |
* Bypass security and trust the given value to be safe JavaScript. | |
* | |
* **WARNING:** calling this method with untrusted user data exposes your application to XSS | |
* security risks! | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.bypassSecurityTrustScript = function (value) { }; | |
/** | |
* Bypass security and trust the given value to be a safe style URL, i.e. a value that can be used | |
* in hyperlinks or `<img src>`. | |
* | |
* **WARNING:** calling this method with untrusted user data exposes your application to XSS | |
* security risks! | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.bypassSecurityTrustUrl = function (value) { }; | |
/** | |
* Bypass security and trust the given value to be a safe resource URL, i.e. a location that may | |
* be used to load executable code from, like `<script src>`, or `<iframe src>`. | |
* | |
* **WARNING:** calling this method with untrusted user data exposes your application to XSS | |
* security risks! | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizer.prototype.bypassSecurityTrustResourceUrl = function (value) { }; | |
return DomSanitizer; | |
}()); | |
var DomSanitizerImpl = (function (_super) { | |
__extends(DomSanitizerImpl, _super); | |
/** | |
* @param {?} _doc | |
*/ | |
function DomSanitizerImpl(_doc) { | |
var _this = _super.call(this) || this; | |
_this._doc = _doc; | |
return _this; | |
} | |
/** | |
* @param {?} ctx | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.sanitize = function (ctx, value) { | |
if (value == null) | |
return null; | |
switch (ctx) { | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].NONE: | |
return value; | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].HTML: | |
if (value instanceof SafeHtmlImpl) | |
return value.changingThisBreaksApplicationSecurity; | |
this.checkNotSafeValue(value, 'HTML'); | |
return sanitizeHtml(this._doc, String(value)); | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].STYLE: | |
if (value instanceof SafeStyleImpl) | |
return value.changingThisBreaksApplicationSecurity; | |
this.checkNotSafeValue(value, 'Style'); | |
return sanitizeStyle(value); | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].SCRIPT: | |
if (value instanceof SafeScriptImpl) | |
return value.changingThisBreaksApplicationSecurity; | |
this.checkNotSafeValue(value, 'Script'); | |
throw new Error('unsafe value used in a script context'); | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].URL: | |
if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) { | |
// Allow resource URLs in URL contexts, they are strictly more trusted. | |
return value.changingThisBreaksApplicationSecurity; | |
} | |
this.checkNotSafeValue(value, 'URL'); | |
return sanitizeUrl(String(value)); | |
case __WEBPACK_IMPORTED_MODULE_1__angular_core__["SecurityContext"].RESOURCE_URL: | |
if (value instanceof SafeResourceUrlImpl) { | |
return value.changingThisBreaksApplicationSecurity; | |
} | |
this.checkNotSafeValue(value, 'ResourceURL'); | |
throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)'); | |
default: | |
throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)"); | |
} | |
}; | |
/** | |
* @param {?} value | |
* @param {?} expectedType | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.checkNotSafeValue = function (value, expectedType) { | |
if (value instanceof SafeValueImpl) { | |
throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " + | |
"(see http://g.co/ng/security#xss)"); | |
} | |
}; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) { return new SafeHtmlImpl(value); }; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) { return new SafeStyleImpl(value); }; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) { return new SafeScriptImpl(value); }; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) { return new SafeUrlImpl(value); }; | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) { | |
return new SafeResourceUrlImpl(value); | |
}; | |
return DomSanitizerImpl; | |
}(DomSanitizer)); | |
DomSanitizerImpl.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DomSanitizerImpl.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Inject"], args: [DOCUMENT,] },] }, | |
]; }; | |
/** | |
* @abstract | |
*/ | |
var SafeValueImpl = (function () { | |
/** | |
* @param {?} changingThisBreaksApplicationSecurity | |
*/ | |
function SafeValueImpl(changingThisBreaksApplicationSecurity) { | |
this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity; | |
// empty | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
SafeValueImpl.prototype.getTypeName = function () { }; | |
/** | |
* @return {?} | |
*/ | |
SafeValueImpl.prototype.toString = function () { | |
return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity + | |
" (see http://g.co/ng/security#xss)"; | |
}; | |
return SafeValueImpl; | |
}()); | |
var SafeHtmlImpl = (function (_super) { | |
__extends(SafeHtmlImpl, _super); | |
function SafeHtmlImpl() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
SafeHtmlImpl.prototype.getTypeName = function () { return 'HTML'; }; | |
return SafeHtmlImpl; | |
}(SafeValueImpl)); | |
var SafeStyleImpl = (function (_super) { | |
__extends(SafeStyleImpl, _super); | |
function SafeStyleImpl() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
SafeStyleImpl.prototype.getTypeName = function () { return 'Style'; }; | |
return SafeStyleImpl; | |
}(SafeValueImpl)); | |
var SafeScriptImpl = (function (_super) { | |
__extends(SafeScriptImpl, _super); | |
function SafeScriptImpl() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
SafeScriptImpl.prototype.getTypeName = function () { return 'Script'; }; | |
return SafeScriptImpl; | |
}(SafeValueImpl)); | |
var SafeUrlImpl = (function (_super) { | |
__extends(SafeUrlImpl, _super); | |
function SafeUrlImpl() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
SafeUrlImpl.prototype.getTypeName = function () { return 'URL'; }; | |
return SafeUrlImpl; | |
}(SafeValueImpl)); | |
var SafeResourceUrlImpl = (function (_super) { | |
__extends(SafeResourceUrlImpl, _super); | |
function SafeResourceUrlImpl() { | |
return _super !== null && _super.apply(this, arguments) || this; | |
} | |
/** | |
* @return {?} | |
*/ | |
SafeResourceUrlImpl.prototype.getTypeName = function () { return 'ResourceURL'; }; | |
return SafeResourceUrlImpl; | |
}(SafeValueImpl)); | |
/** | |
* @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 INTERNAL_BROWSER_PLATFORM_PROVIDERS = [ | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PLATFORM_ID"], useValue: __WEBPACK_IMPORTED_MODULE_0__angular_common__["ɵPLATFORM_BROWSER_ID"] }, | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["PLATFORM_INITIALIZER"], useValue: initDomAdapter, multi: true }, | |
{ provide: __WEBPACK_IMPORTED_MODULE_0__angular_common__["PlatformLocation"], useClass: BrowserPlatformLocation }, | |
{ provide: DOCUMENT, useFactory: _document, deps: [] }, | |
]; | |
/** | |
* \@security Replacing built-in sanitization providers exposes the application to XSS risks. | |
* Attacker-controlled data introduced by an unsanitized provider could expose your | |
* application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security). | |
* \@experimental | |
*/ | |
var BROWSER_SANITIZATION_PROVIDERS = [ | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Sanitizer"], useExisting: DomSanitizer }, | |
{ provide: DomSanitizer, useClass: DomSanitizerImpl }, | |
]; | |
/** | |
* \@stable | |
*/ | |
var platformBrowser = __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_1__angular_core__["createPlatformFactory"])(__WEBPACK_IMPORTED_MODULE_1__angular_core__["platformCore"], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS); | |
/** | |
* @return {?} | |
*/ | |
function initDomAdapter() { | |
BrowserDomAdapter.makeCurrent(); | |
BrowserGetTestability.init(); | |
} | |
/** | |
* @return {?} | |
*/ | |
function errorHandler() { | |
return new __WEBPACK_IMPORTED_MODULE_1__angular_core__["ErrorHandler"](); | |
} | |
/** | |
* @return {?} | |
*/ | |
function _document() { | |
return document; | |
} | |
/** | |
* The ng module for the browser. | |
* | |
* \@stable | |
*/ | |
var BrowserModule = (function () { | |
/** | |
* @param {?} parentModule | |
*/ | |
function BrowserModule(parentModule) { | |
if (parentModule) { | |
throw new Error("BrowserModule has already been loaded. If you need access to common directives such as NgIf and NgFor from a lazy loaded module, import CommonModule instead."); | |
} | |
} | |
/** | |
* Configures a browser-based application to transition from a server-rendered app, if | |
* one is present on the page. The specified parameters must include an application id, | |
* which must match between the client and server applications. | |
* | |
* \@experimental | |
* @param {?} params | |
* @return {?} | |
*/ | |
BrowserModule.withServerTransition = function (params) { | |
return { | |
ngModule: BrowserModule, | |
providers: [ | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_ID"], useValue: params.appId }, | |
{ provide: TRANSITION_ID, useExisting: __WEBPACK_IMPORTED_MODULE_1__angular_core__["APP_ID"] }, | |
SERVER_TRANSITION_PROVIDERS, | |
], | |
}; | |
}; | |
return BrowserModule; | |
}()); | |
BrowserModule.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["NgModule"], args: [{ | |
providers: [ | |
BROWSER_SANITIZATION_PROVIDERS, | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["ErrorHandler"], useFactory: errorHandler, deps: [] }, | |
{ provide: EVENT_MANAGER_PLUGINS, useClass: DomEventsPlugin, multi: true }, | |
{ provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true }, | |
{ provide: EVENT_MANAGER_PLUGINS, useClass: HammerGesturesPlugin, multi: true }, | |
{ provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig }, | |
DomRendererFactory2, | |
{ provide: __WEBPACK_IMPORTED_MODULE_1__angular_core__["RendererFactory2"], useExisting: DomRendererFactory2 }, | |
{ provide: SharedStylesHost, useExisting: DomSharedStylesHost }, | |
DomSharedStylesHost, | |
__WEBPACK_IMPORTED_MODULE_1__angular_core__["Testability"], | |
EventManager, | |
ELEMENT_PROBE_PROVIDERS, | |
Meta, | |
Title, | |
], | |
exports: [__WEBPACK_IMPORTED_MODULE_0__angular_common__["CommonModule"], __WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationModule"]] | |
},] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
BrowserModule.ctorParameters = function () { return [ | |
{ type: BrowserModule, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_1__angular_core__["SkipSelf"] },] }, | |
]; }; | |
/** | |
* @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 win = typeof window !== 'undefined' && window || {}; | |
/** | |
* @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 ChangeDetectionPerfRecord = (function () { | |
/** | |
* @param {?} msPerTick | |
* @param {?} numTicks | |
*/ | |
function ChangeDetectionPerfRecord(msPerTick, numTicks) { | |
this.msPerTick = msPerTick; | |
this.numTicks = numTicks; | |
} | |
return ChangeDetectionPerfRecord; | |
}()); | |
/** | |
* Entry point for all Angular profiling-related debug tools. This object | |
* corresponds to the `ng.profiler` in the dev console. | |
*/ | |
var AngularProfiler = (function () { | |
/** | |
* @param {?} ref | |
*/ | |
function AngularProfiler(ref) { | |
this.appRef = ref.injector.get(__WEBPACK_IMPORTED_MODULE_1__angular_core__["ApplicationRef"]); | |
} | |
/** | |
* Exercises change detection in a loop and then prints the average amount of | |
* time in milliseconds how long a single round of change detection takes for | |
* the current state of the UI. It runs a minimum of 5 rounds for a minimum | |
* of 500 milliseconds. | |
* | |
* Optionally, a user may pass a `config` parameter containing a map of | |
* options. Supported options are: | |
* | |
* `record` (boolean) - causes the profiler to record a CPU profile while | |
* it exercises the change detector. Example: | |
* | |
* ``` | |
* ng.profiler.timeChangeDetection({record: true}) | |
* ``` | |
* @param {?} config | |
* @return {?} | |
*/ | |
AngularProfiler.prototype.timeChangeDetection = function (config) { | |
var /** @type {?} */ record = config && config['record']; | |
var /** @type {?} */ profileName = 'Change Detection'; | |
// Profiler is not available in Android browsers, nor in IE 9 without dev tools opened | |
var /** @type {?} */ isProfilerAvailable = win.console.profile != null; | |
if (record && isProfilerAvailable) { | |
win.console.profile(profileName); | |
} | |
var /** @type {?} */ start = getDOM().performanceNow(); | |
var /** @type {?} */ numTicks = 0; | |
while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) { | |
this.appRef.tick(); | |
numTicks++; | |
} | |
var /** @type {?} */ end = getDOM().performanceNow(); | |
if (record && isProfilerAvailable) { | |
// need to cast to <any> because type checker thinks there's no argument | |
// while in fact there is: | |
// | |
// https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd | |
((win.console.profileEnd))(profileName); | |
} | |
var /** @type {?} */ msPerTick = (end - start) / numTicks; | |
win.console.log("ran " + numTicks + " change detection cycles"); | |
win.console.log(msPerTick.toFixed(2) + " ms per check"); | |
return new ChangeDetectionPerfRecord(msPerTick, numTicks); | |
}; | |
return AngularProfiler; | |
}()); | |
/** | |
* @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 PROFILER_GLOBAL_NAME = 'ng.profiler'; | |
/** | |
* Enabled Angular debug tools that are accessible via your browser's | |
* developer console. | |
* | |
* Usage: | |
* | |
* 1. Open developer console (e.g. in Chrome Ctrl + Shift + j) | |
* 1. Type `ng.` (usually the console will show auto-complete suggestion) | |
* 1. Try the change detection profiler `ng.profiler.timeChangeDetection()` | |
* then hit Enter. | |
* | |
* \@experimental All debugging apis are currently experimental. | |
* @template T | |
* @param {?} ref | |
* @return {?} | |
*/ | |
function enableDebugTools(ref) { | |
getDOM().setGlobalVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref)); | |
return ref; | |
} | |
/** | |
* Disables Angular tools. | |
* | |
* \@experimental All debugging apis are currently experimental. | |
* @return {?} | |
*/ | |
function disableDebugTools() { | |
getDOM().setGlobalVar(PROFILER_GLOBAL_NAME, null); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Predicates for use with {\@link DebugElement}'s query functions. | |
* | |
* \@experimental All debugging apis are currently experimental. | |
*/ | |
var By = (function () { | |
function By() { | |
} | |
/** | |
* Match all elements. | |
* | |
* ## Example | |
* | |
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_all'} | |
* @return {?} | |
*/ | |
By.all = function () { return function (debugElement) { return true; }; }; | |
/** | |
* Match elements by the given CSS selector. | |
* | |
* ## Example | |
* | |
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_css'} | |
* @param {?} selector | |
* @return {?} | |
*/ | |
By.css = function (selector) { | |
return function (debugElement) { | |
return debugElement.nativeElement != null ? | |
getDOM().elementMatches(debugElement.nativeElement, selector) : | |
false; | |
}; | |
}; | |
/** | |
* Match elements that have the given directive present. | |
* | |
* ## Example | |
* | |
* {\@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'} | |
* @param {?} type | |
* @return {?} | |
*/ | |
By.directive = function (type) { | |
return function (debugElement) { return debugElement.providerTokens.indexOf(type) !== -1; }; | |
}; | |
return By; | |
}()); | |
/** | |
* @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 | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the common package. | |
*/ | |
/** | |
* \@stable | |
*/ | |
var VERSION = new __WEBPACK_IMPORTED_MODULE_1__angular_core__["Version"]('4.0.1'); | |
/** | |
* @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 | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the platform-browser package. | |
*/ | |
// This file only reexports content of the `src` folder. Keep it that way. | |
/** | |
* Generated bundle index. Do not edit. | |
*/ | |
//# sourceMappingURL=platform-browser.es5.js.map | |
/***/ }), | |
/* 69 */, | |
/* 70 */, | |
/* 71 */, | |
/* 72 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var Observable_1 = __webpack_require__(0); | |
/** | |
* Represents a push-based event or value that an {@link Observable} can emit. | |
* This class is particularly useful for operators that manage notifications, | |
* like {@link materialize}, {@link dematerialize}, {@link observeOn}, and | |
* others. Besides wrapping the actual delivered value, it also annotates it | |
* with metadata of, for instance, what type of push message it is (`next`, | |
* `error`, or `complete`). | |
* | |
* @see {@link materialize} | |
* @see {@link dematerialize} | |
* @see {@link observeOn} | |
* | |
* @class Notification<T> | |
*/ | |
var Notification = (function () { | |
function Notification(kind, value, error) { | |
this.kind = kind; | |
this.value = value; | |
this.error = error; | |
this.hasValue = kind === 'N'; | |
} | |
/** | |
* Delivers to the given `observer` the value wrapped by this Notification. | |
* @param {Observer} observer | |
* @return | |
*/ | |
Notification.prototype.observe = function (observer) { | |
switch (this.kind) { | |
case 'N': | |
return observer.next && observer.next(this.value); | |
case 'E': | |
return observer.error && observer.error(this.error); | |
case 'C': | |
return observer.complete && observer.complete(); | |
} | |
}; | |
/** | |
* Given some {@link Observer} callbacks, deliver the value represented by the | |
* current Notification to the correctly corresponding callback. | |
* @param {function(value: T): void} next An Observer `next` callback. | |
* @param {function(err: any): void} [error] An Observer `error` callback. | |
* @param {function(): void} [complete] An Observer `complete` callback. | |
* @return {any} | |
*/ | |
Notification.prototype.do = function (next, error, complete) { | |
var kind = this.kind; | |
switch (kind) { | |
case 'N': | |
return next && next(this.value); | |
case 'E': | |
return error && error(this.error); | |
case 'C': | |
return complete && complete(); | |
} | |
}; | |
/** | |
* Takes an Observer or its individual callback functions, and calls `observe` | |
* or `do` methods accordingly. | |
* @param {Observer|function(value: T): void} nextOrObserver An Observer or | |
* the `next` callback. | |
* @param {function(err: any): void} [error] An Observer `error` callback. | |
* @param {function(): void} [complete] An Observer `complete` callback. | |
* @return {any} | |
*/ | |
Notification.prototype.accept = function (nextOrObserver, error, complete) { | |
if (nextOrObserver && typeof nextOrObserver.next === 'function') { | |
return this.observe(nextOrObserver); | |
} | |
else { | |
return this.do(nextOrObserver, error, complete); | |
} | |
}; | |
/** | |
* Returns a simple Observable that just delivers the notification represented | |
* by this Notification instance. | |
* @return {any} | |
*/ | |
Notification.prototype.toObservable = function () { | |
var kind = this.kind; | |
switch (kind) { | |
case 'N': | |
return Observable_1.Observable.of(this.value); | |
case 'E': | |
return Observable_1.Observable.throw(this.error); | |
case 'C': | |
return Observable_1.Observable.empty(); | |
} | |
throw new Error('unexpected notification kind value'); | |
}; | |
/** | |
* A shortcut to create a Notification instance of the type `next` from a | |
* given value. | |
* @param {T} value The `next` value. | |
* @return {Notification<T>} The "next" Notification representing the | |
* argument. | |
*/ | |
Notification.createNext = function (value) { | |
if (typeof value !== 'undefined') { | |
return new Notification('N', value); | |
} | |
return this.undefinedValueNotification; | |
}; | |
/** | |
* A shortcut to create a Notification instance of the type `error` from a | |
* given error. | |
* @param {any} [err] The `error` error. | |
* @return {Notification<T>} The "error" Notification representing the | |
* argument. | |
*/ | |
Notification.createError = function (err) { | |
return new Notification('E', undefined, err); | |
}; | |
/** | |
* A shortcut to create a Notification instance of the type `complete`. | |
* @return {Notification<any>} The valueless "complete" Notification. | |
*/ | |
Notification.createComplete = function () { | |
return this.completeNotification; | |
}; | |
Notification.completeNotification = new Notification('C'); | |
Notification.undefinedValueNotification = new Notification('N', undefined); | |
return Notification; | |
}()); | |
exports.Notification = Notification; | |
//# sourceMappingURL=Notification.js.map | |
/***/ }), | |
/* 73 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subscriber_1 = __webpack_require__(2); | |
/** | |
* Applies a given `project` function to each value emitted by the source | |
* Observable, and emits the resulting values as an Observable. | |
* | |
* <span class="informal">Like [Array.prototype.map()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map), | |
* it passes each source value through a transformation function to get | |
* corresponding output values.</span> | |
* | |
* <img src="./img/map.png" width="100%"> | |
* | |
* Similar to the well known `Array.prototype.map` function, this operator | |
* applies a projection to each value and emits that projection in the output | |
* Observable. | |
* | |
* @example <caption>Map every every click to the clientX position of that click</caption> | |
* var clicks = Rx.Observable.fromEvent(document, 'click'); | |
* var positions = clicks.map(ev => ev.clientX); | |
* positions.subscribe(x => console.log(x)); | |
* | |
* @see {@link mapTo} | |
* @see {@link pluck} | |
* | |
* @param {function(value: T, index: number): R} project The function to apply | |
* to each `value` emitted by the source Observable. The `index` parameter is | |
* the number `i` for the i-th emission that has happened since the | |
* subscription, starting from the number `0`. | |
* @param {any} [thisArg] An optional argument to define what `this` is in the | |
* `project` function. | |
* @return {Observable<R>} An Observable that emits the values from the source | |
* Observable transformed by the given `project` function. | |
* @method map | |
* @owner Observable | |
*/ | |
function map(project, thisArg) { | |
if (typeof project !== 'function') { | |
throw new TypeError('argument is not a function. Are you looking for `mapTo()`?'); | |
} | |
return this.lift(new MapOperator(project, thisArg)); | |
} | |
exports.map = map; | |
var MapOperator = (function () { | |
function MapOperator(project, thisArg) { | |
this.project = project; | |
this.thisArg = thisArg; | |
} | |
MapOperator.prototype.call = function (subscriber, source) { | |
return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg)); | |
}; | |
return MapOperator; | |
}()); | |
exports.MapOperator = MapOperator; | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var MapSubscriber = (function (_super) { | |
__extends(MapSubscriber, _super); | |
function MapSubscriber(destination, project, thisArg) { | |
_super.call(this, destination); | |
this.project = project; | |
this.count = 0; | |
this.thisArg = thisArg || this; | |
} | |
// NOTE: This looks unoptimized, but it's actually purposefully NOT | |
// using try/catch optimizations. | |
MapSubscriber.prototype._next = function (value) { | |
var result; | |
try { | |
result = this.project.call(this.thisArg, value, this.count++); | |
} | |
catch (err) { | |
this.destination.error(err); | |
return; | |
} | |
this.destination.next(result); | |
}; | |
return MapSubscriber; | |
}(Subscriber_1.Subscriber)); | |
//# sourceMappingURL=map.js.map | |
/***/ }), | |
/* 74 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var OuterSubscriber_1 = __webpack_require__(3); | |
var subscribeToResult_1 = __webpack_require__(4); | |
/** | |
* Converts a higher-order Observable into a first-order Observable which | |
* concurrently delivers all values that are emitted on the inner Observables. | |
* | |
* <span class="informal">Flattens an Observable-of-Observables.</span> | |
* | |
* <img src="./img/mergeAll.png" width="100%"> | |
* | |
* `mergeAll` subscribes to an Observable that emits Observables, also known as | |
* a higher-order Observable. Each time it observes one of these emitted inner | |
* Observables, it subscribes to that and delivers all the values from the | |
* inner Observable on the output Observable. The output Observable only | |
* completes once all inner Observables have completed. Any error delivered by | |
* a inner Observable will be immediately emitted on the output Observable. | |
* | |
* @example <caption>Spawn a new interval Observable for each click event, and blend their outputs as one Observable</caption> | |
* var clicks = Rx.Observable.fromEvent(document, 'click'); | |
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000)); | |
* var firstOrder = higherOrder.mergeAll(); | |
* firstOrder.subscribe(x => console.log(x)); | |
* | |
* @example <caption>Count from 0 to 9 every second for each click, but only allow 2 concurrent timers</caption> | |
* var clicks = Rx.Observable.fromEvent(document, 'click'); | |
* var higherOrder = clicks.map((ev) => Rx.Observable.interval(1000).take(10)); | |
* var firstOrder = higherOrder.mergeAll(2); | |
* firstOrder.subscribe(x => console.log(x)); | |
* | |
* @see {@link combineAll} | |
* @see {@link concatAll} | |
* @see {@link exhaust} | |
* @see {@link merge} | |
* @see {@link mergeMap} | |
* @see {@link mergeMapTo} | |
* @see {@link mergeScan} | |
* @see {@link switch} | |
* @see {@link zipAll} | |
* | |
* @param {number} [concurrent=Number.POSITIVE_INFINITY] Maximum number of inner | |
* Observables being subscribed to concurrently. | |
* @return {Observable} An Observable that emits values coming from all the | |
* inner Observables emitted by the source Observable. | |
* @method mergeAll | |
* @owner Observable | |
*/ | |
function mergeAll(concurrent) { | |
if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } | |
return this.lift(new MergeAllOperator(concurrent)); | |
} | |
exports.mergeAll = mergeAll; | |
var MergeAllOperator = (function () { | |
function MergeAllOperator(concurrent) { | |
this.concurrent = concurrent; | |
} | |
MergeAllOperator.prototype.call = function (observer, source) { | |
return source.subscribe(new MergeAllSubscriber(observer, this.concurrent)); | |
}; | |
return MergeAllOperator; | |
}()); | |
exports.MergeAllOperator = MergeAllOperator; | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var MergeAllSubscriber = (function (_super) { | |
__extends(MergeAllSubscriber, _super); | |
function MergeAllSubscriber(destination, concurrent) { | |
_super.call(this, destination); | |
this.concurrent = concurrent; | |
this.hasCompleted = false; | |
this.buffer = []; | |
this.active = 0; | |
} | |
MergeAllSubscriber.prototype._next = function (observable) { | |
if (this.active < this.concurrent) { | |
this.active++; | |
this.add(subscribeToResult_1.subscribeToResult(this, observable)); | |
} | |
else { | |
this.buffer.push(observable); | |
} | |
}; | |
MergeAllSubscriber.prototype._complete = function () { | |
this.hasCompleted = true; | |
if (this.active === 0 && this.buffer.length === 0) { | |
this.destination.complete(); | |
} | |
}; | |
MergeAllSubscriber.prototype.notifyComplete = function (innerSub) { | |
var buffer = this.buffer; | |
this.remove(innerSub); | |
this.active--; | |
if (buffer.length > 0) { | |
this._next(buffer.shift()); | |
} | |
else if (this.active === 0 && this.hasCompleted) { | |
this.destination.complete(); | |
} | |
}; | |
return MergeAllSubscriber; | |
}(OuterSubscriber_1.OuterSubscriber)); | |
exports.MergeAllSubscriber = MergeAllSubscriber; | |
//# sourceMappingURL=mergeAll.js.map | |
/***/ }), | |
/* 75 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var root_1 = __webpack_require__(18); | |
var Action_1 = __webpack_require__(718); | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var AsyncAction = (function (_super) { | |
__extends(AsyncAction, _super); | |
function AsyncAction(scheduler, work) { | |
_super.call(this, scheduler, work); | |
this.scheduler = scheduler; | |
this.work = work; | |
this.pending = false; | |
} | |
AsyncAction.prototype.schedule = function (state, delay) { | |
if (delay === void 0) { delay = 0; } | |
if (this.closed) { | |
return this; | |
} | |
// Always replace the current state with the new state. | |
this.state = state; | |
// Set the pending flag indicating that this action has been scheduled, or | |
// has recursively rescheduled itself. | |
this.pending = true; | |
var id = this.id; | |
var scheduler = this.scheduler; | |
// | |
// Important implementation note: | |
// | |
// Actions only execute once by default, unless rescheduled from within the | |
// scheduled callback. This allows us to implement single and repeat | |
// actions via the same code path, without adding API surface area, as well | |
// as mimic traditional recursion but across asynchronous boundaries. | |
// | |
// However, JS runtimes and timers distinguish between intervals achieved by | |
// serial `setTimeout` calls vs. a single `setInterval` call. An interval of | |
// serial `setTimeout` calls can be individually delayed, which delays | |
// scheduling the next `setTimeout`, and so on. `setInterval` attempts to | |
// guarantee the interval callback will be invoked more precisely to the | |
// interval period, regardless of load. | |
// | |
// Therefore, we use `setInterval` to schedule single and repeat actions. | |
// If the action reschedules itself with the same delay, the interval is not | |
// canceled. If the action doesn't reschedule, or reschedules with a | |
// different delay, the interval will be canceled after scheduled callback | |
// execution. | |
// | |
if (id != null) { | |
this.id = this.recycleAsyncId(scheduler, id, delay); | |
} | |
this.delay = delay; | |
// If this action has already an async Id, don't request a new one. | |
this.id = this.id || this.requestAsyncId(scheduler, this.id, delay); | |
return this; | |
}; | |
AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) { | |
if (delay === void 0) { delay = 0; } | |
return root_1.root.setInterval(scheduler.flush.bind(scheduler, this), delay); | |
}; | |
AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) { | |
if (delay === void 0) { delay = 0; } | |
// If this action is rescheduled with the same delay time, don't clear the interval id. | |
if (delay !== null && this.delay === delay) { | |
return id; | |
} | |
// Otherwise, if the action's delay time is different from the current delay, | |
// clear the interval id | |
return root_1.root.clearInterval(id) && undefined || undefined; | |
}; | |
/** | |
* Immediately executes this action and the `work` it contains. | |
* @return {any} | |
*/ | |
AsyncAction.prototype.execute = function (state, delay) { | |
if (this.closed) { | |
return new Error('executing a cancelled action'); | |
} | |
this.pending = false; | |
var error = this._execute(state, delay); | |
if (error) { | |
return error; | |
} | |
else if (this.pending === false && this.id != null) { | |
// Dequeue if the action didn't reschedule itself. Don't call | |
// unsubscribe(), because the action could reschedule later. | |
// For example: | |
// ``` | |
// scheduler.schedule(function doWork(counter) { | |
// /* ... I'm a busy worker bee ... */ | |
// var originalAction = this; | |
// /* wait 100ms before rescheduling the action */ | |
// setTimeout(function () { | |
// originalAction.schedule(counter + 1); | |
// }, 100); | |
// }, 1000); | |
// ``` | |
this.id = this.recycleAsyncId(this.scheduler, this.id, null); | |
} | |
}; | |
AsyncAction.prototype._execute = function (state, delay) { | |
var errored = false; | |
var errorValue = undefined; | |
try { | |
this.work(state); | |
} | |
catch (e) { | |
errored = true; | |
errorValue = !!e && e || new Error(e); | |
} | |
if (errored) { | |
this.unsubscribe(); | |
return errorValue; | |
} | |
}; | |
AsyncAction.prototype._unsubscribe = function () { | |
var id = this.id; | |
var scheduler = this.scheduler; | |
var actions = scheduler.actions; | |
var index = actions.indexOf(this); | |
this.work = null; | |
this.delay = null; | |
this.state = null; | |
this.pending = false; | |
this.scheduler = null; | |
if (index !== -1) { | |
actions.splice(index, 1); | |
} | |
if (id != null) { | |
this.id = this.recycleAsyncId(scheduler, id, null); | |
} | |
}; | |
return AsyncAction; | |
}(Action_1.Action)); | |
exports.AsyncAction = AsyncAction; | |
//# sourceMappingURL=AsyncAction.js.map | |
/***/ }), | |
/* 76 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Scheduler_1 = __webpack_require__(477); | |
var AsyncScheduler = (function (_super) { | |
__extends(AsyncScheduler, _super); | |
function AsyncScheduler() { | |
_super.apply(this, arguments); | |
this.actions = []; | |
/** | |
* A flag to indicate whether the Scheduler is currently executing a batch of | |
* queued actions. | |
* @type {boolean} | |
*/ | |
this.active = false; | |
/** | |
* An internal ID used to track the latest asynchronous task such as those | |
* coming from `setTimeout`, `setInterval`, `requestAnimationFrame`, and | |
* others. | |
* @type {any} | |
*/ | |
this.scheduled = undefined; | |
} | |
AsyncScheduler.prototype.flush = function (action) { | |
var actions = this.actions; | |
if (this.active) { | |
actions.push(action); | |
return; | |
} | |
var error; | |
this.active = true; | |
do { | |
if (error = action.execute(action.state, action.delay)) { | |
break; | |
} | |
} while (action = actions.shift()); // exhaust the scheduler queue | |
this.active = false; | |
if (error) { | |
while (action = actions.shift()) { | |
action.unsubscribe(); | |
} | |
throw error; | |
} | |
}; | |
return AsyncScheduler; | |
}(Scheduler_1.Scheduler)); | |
exports.AsyncScheduler = AsyncScheduler; | |
//# sourceMappingURL=AsyncScheduler.js.map | |
/***/ }), | |
/* 77 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var root_1 = __webpack_require__(18); | |
function symbolIteratorPonyfill(root) { | |
var Symbol = root.Symbol; | |
if (typeof Symbol === 'function') { | |
if (!Symbol.iterator) { | |
Symbol.iterator = Symbol('iterator polyfill'); | |
} | |
return Symbol.iterator; | |
} | |
else { | |
// [for Mozilla Gecko 27-35:](https://mzl.la/2ewE1zC) | |
var Set_1 = root.Set; | |
if (Set_1 && typeof new Set_1()['@@iterator'] === 'function') { | |
return '@@iterator'; | |
} | |
var Map_1 = root.Map; | |
// required for compatability with es6-shim | |
if (Map_1) { | |
var keys = Object.getOwnPropertyNames(Map_1.prototype); | |
for (var i = 0; i < keys.length; ++i) { | |
var key = keys[i]; | |
// according to spec, Map.prototype[@@iterator] and Map.orototype.entries must be equal. | |
if (key !== 'entries' && key !== 'size' && Map_1.prototype[key] === Map_1.prototype['entries']) { | |
return key; | |
} | |
} | |
} | |
return '@@iterator'; | |
} | |
} | |
exports.symbolIteratorPonyfill = symbolIteratorPonyfill; | |
exports.$$iterator = symbolIteratorPonyfill(root_1.root); | |
//# sourceMappingURL=iterator.js.map | |
/***/ }), | |
/* 78 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* An error thrown when an Observable or a sequence was queried but has no | |
* elements. | |
* | |
* @see {@link first} | |
* @see {@link last} | |
* @see {@link single} | |
* | |
* @class EmptyError | |
*/ | |
var EmptyError = (function (_super) { | |
__extends(EmptyError, _super); | |
function EmptyError() { | |
var err = _super.call(this, 'no elements in sequence'); | |
this.name = err.name = 'EmptyError'; | |
this.stack = err.stack; | |
this.message = err.message; | |
} | |
return EmptyError; | |
}(Error)); | |
exports.EmptyError = EmptyError; | |
//# sourceMappingURL=EmptyError.js.map | |
/***/ }), | |
/* 79 */ | |
/***/ (function(module, __webpack_exports__, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(__webpack_exports__, "__esModule", { value: true }); | |
/* harmony import */ var __WEBPACK_IMPORTED_MODULE_0__angular_core__ = __webpack_require__(45); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function() { return NgLocaleLocalization; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocalization", function() { return NgLocalization; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function() { return CommonModule; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function() { return NgClass; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgFor", function() { return NgFor; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOf", function() { return NgForOf; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOfContext", function() { return NgForOfContext; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIf", function() { return NgIf; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIfContext", function() { return NgIfContext; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPlural", function() { return NgPlural; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPluralCase", function() { return NgPluralCase; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyle", function() { return NgStyle; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitch", function() { return NgSwitch; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchCase", function() { return NgSwitchCase; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function() { return NgSwitchDefault; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function() { return NgTemplateOutlet; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function() { return NgComponentOutlet; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function() { return AsyncPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function() { return DatePipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function() { return I18nPluralPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function() { return I18nSelectPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonPipe", function() { return JsonPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LowerCasePipe", function() { return LowerCasePipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function() { return CurrencyPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function() { return DecimalPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function() { return PercentPipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function() { return SlicePipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function() { return UpperCasePipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function() { return TitleCasePipe; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function() { return PLATFORM_BROWSER_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function() { return PLATFORM_SERVER_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function() { return PLATFORM_WORKER_APP_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function() { return PLATFORM_WORKER_UI_ID; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function() { return isPlatformBrowser; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformServer", function() { return isPlatformServer; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function() { return isPlatformWorkerApp; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function() { return isPlatformWorkerUi; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function() { return PlatformLocation; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function() { return LOCATION_INITIALIZED; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function() { return LocationStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function() { return APP_BASE_HREF; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function() { return HashLocationStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function() { return PathLocationStrategy; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return COMMON_DIRECTIVES; }); | |
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return COMMON_PIPES; }); | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* @license Angular v4.0.1 | |
* (c) 2010-2017 Google, Inc. https://angular.io/ | |
* License: MIT | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* This class should not be used directly by an application developer. Instead, use | |
* {\@link Location}. | |
* | |
* `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform | |
* agnostic. | |
* This means that we can have different implementation of `PlatformLocation` for the different | |
* platforms | |
* that angular supports. For example, the default `PlatformLocation` is {\@link | |
* BrowserPlatformLocation}, | |
* however when you run your app in a WebWorker you use {\@link WebWorkerPlatformLocation}. | |
* | |
* The `PlatformLocation` class is used directly by all implementations of {\@link LocationStrategy} | |
* when | |
* they need to interact with the DOM apis like pushState, popState, etc... | |
* | |
* {\@link LocationStrategy} in turn is used by the {\@link Location} service which is used directly | |
* by | |
* the {\@link Router} in order to navigate between routes. Since all interactions between {\@link | |
* Router} / | |
* {\@link Location} / {\@link LocationStrategy} and DOM apis flow through the `PlatformLocation` | |
* class | |
* they are all platform independent. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var PlatformLocation = (function () { | |
function PlatformLocation() { | |
} | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.getBaseHrefFromDOM = function () { }; | |
/** | |
* @abstract | |
* @param {?} fn | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.onPopState = function (fn) { }; | |
/** | |
* @abstract | |
* @param {?} fn | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.onHashChange = function (fn) { }; | |
Object.defineProperty(PlatformLocation.prototype, "pathname", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return null; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(PlatformLocation.prototype, "search", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return null; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(PlatformLocation.prototype, "hash", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return null; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @abstract | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.replaceState = function (state, title, url) { }; | |
/** | |
* @abstract | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.pushState = function (state, title, url) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.forward = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
PlatformLocation.prototype.back = function () { }; | |
return PlatformLocation; | |
}()); | |
/** | |
* \@whatItDoes indicates when a location is initialized | |
* \@experimental | |
*/ | |
var LOCATION_INITIALIZED = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('Location Initialized'); | |
/** | |
* @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 | |
*/ | |
/** | |
* `LocationStrategy` is responsible for representing and reading route state | |
* from the browser's URL. Angular provides two strategies: | |
* {\@link HashLocationStrategy} and {\@link PathLocationStrategy}. | |
* | |
* This is used under the hood of the {\@link Location} service. | |
* | |
* Applications should use the {\@link Router} or {\@link Location} services to | |
* interact with application route state. | |
* | |
* For instance, {\@link HashLocationStrategy} produces URLs like | |
* `http://example.com#/foo`, and {\@link PathLocationStrategy} produces | |
* `http://example.com/foo` as an equivalent URL. | |
* | |
* See these two classes for more. | |
* | |
* \@stable | |
* @abstract | |
*/ | |
var LocationStrategy = (function () { | |
function LocationStrategy() { | |
} | |
/** | |
* @abstract | |
* @param {?=} includeHash | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.path = function (includeHash) { }; | |
/** | |
* @abstract | |
* @param {?} internal | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.prepareExternalUrl = function (internal) { }; | |
/** | |
* @abstract | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.pushState = function (state, title, url, queryParams) { }; | |
/** | |
* @abstract | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.forward = function () { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.back = function () { }; | |
/** | |
* @abstract | |
* @param {?} fn | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.onPopState = function (fn) { }; | |
/** | |
* @abstract | |
* @return {?} | |
*/ | |
LocationStrategy.prototype.getBaseHref = function () { }; | |
return LocationStrategy; | |
}()); | |
/** | |
* The `APP_BASE_HREF` token represents the base href to be used with the | |
* {\@link PathLocationStrategy}. | |
* | |
* If you're using {\@link PathLocationStrategy}, you must provide a provider to a string | |
* representing the URL prefix that should be preserved when generating and recognizing | |
* URLs. | |
* | |
* ### Example | |
* | |
* ```typescript | |
* import {Component, NgModule} from '\@angular/core'; | |
* import {APP_BASE_HREF} from '\@angular/common'; | |
* | |
* \@NgModule({ | |
* providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}] | |
* }) | |
* class AppModule {} | |
* ``` | |
* | |
* \@stable | |
*/ | |
var APP_BASE_HREF = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["InjectionToken"]('appBaseHref'); | |
/** | |
* @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 | |
*/ | |
/** | |
* \@whatItDoes `Location` is a service that applications can use to interact with a browser's URL. | |
* \@description | |
* Depending on which {\@link LocationStrategy} is used, `Location` will either persist | |
* to the URL's path or the URL's hash segment. | |
* | |
* Note: it's better to use {\@link Router#navigate} service to trigger route changes. Use | |
* `Location` only if you need to interact with or create normalized URLs outside of | |
* routing. | |
* | |
* `Location` is responsible for normalizing the URL against the application's base href. | |
* A normalized URL is absolute from the URL host, includes the application's base href, and has no | |
* trailing slash: | |
* - `/my/app/user/123` is normalized | |
* - `my/app/user/123` **is not** normalized | |
* - `/my/app/user/123/` **is not** normalized | |
* | |
* ### Example | |
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'} | |
* \@stable | |
*/ | |
var Location = (function () { | |
/** | |
* @param {?} platformStrategy | |
*/ | |
function Location(platformStrategy) { | |
var _this = this; | |
/** | |
* \@internal | |
*/ | |
this._subject = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["EventEmitter"](); | |
this._platformStrategy = platformStrategy; | |
var browserBaseHref = this._platformStrategy.getBaseHref(); | |
this._baseHref = Location.stripTrailingSlash(_stripIndexHtml(browserBaseHref)); | |
this._platformStrategy.onPopState(function (ev) { | |
_this._subject.emit({ | |
'url': _this.path(true), | |
'pop': true, | |
'type': ev.type, | |
}); | |
}); | |
} | |
/** | |
* @param {?=} includeHash | |
* @return {?} | |
*/ | |
Location.prototype.path = function (includeHash) { | |
if (includeHash === void 0) { includeHash = false; } | |
return this.normalize(this._platformStrategy.path(includeHash)); | |
}; | |
/** | |
* Normalizes the given path and compares to the current normalized path. | |
* @param {?} path | |
* @param {?=} query | |
* @return {?} | |
*/ | |
Location.prototype.isCurrentPathEqualTo = function (path, query) { | |
if (query === void 0) { query = ''; } | |
return this.path() == this.normalize(path + Location.normalizeQueryParams(query)); | |
}; | |
/** | |
* Given a string representing a URL, returns the normalized URL path without leading or | |
* trailing slashes. | |
* @param {?} url | |
* @return {?} | |
*/ | |
Location.prototype.normalize = function (url) { | |
return Location.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url))); | |
}; | |
/** | |
* Given a string representing a URL, returns the platform-specific external URL path. | |
* If the given URL doesn't begin with a leading slash (`'/'`), this method adds one | |
* before normalizing. This method will also add a hash if `HashLocationStrategy` is | |
* used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use. | |
* @param {?} url | |
* @return {?} | |
*/ | |
Location.prototype.prepareExternalUrl = function (url) { | |
if (url && url[0] !== '/') { | |
url = '/' + url; | |
} | |
return this._platformStrategy.prepareExternalUrl(url); | |
}; | |
/** | |
* Changes the browsers URL to the normalized version of the given URL, and pushes a | |
* new item onto the platform's history. | |
* @param {?} path | |
* @param {?=} query | |
* @return {?} | |
*/ | |
Location.prototype.go = function (path, query) { | |
if (query === void 0) { query = ''; } | |
this._platformStrategy.pushState(null, '', path, query); | |
}; | |
/** | |
* Changes the browsers URL to the normalized version of the given URL, and replaces | |
* the top item on the platform's history stack. | |
* @param {?} path | |
* @param {?=} query | |
* @return {?} | |
*/ | |
Location.prototype.replaceState = function (path, query) { | |
if (query === void 0) { query = ''; } | |
this._platformStrategy.replaceState(null, '', path, query); | |
}; | |
/** | |
* Navigates forward in the platform's history. | |
* @return {?} | |
*/ | |
Location.prototype.forward = function () { this._platformStrategy.forward(); }; | |
/** | |
* Navigates back in the platform's history. | |
* @return {?} | |
*/ | |
Location.prototype.back = function () { this._platformStrategy.back(); }; | |
/** | |
* Subscribe to the platform's `popState` events. | |
* @param {?} onNext | |
* @param {?=} onThrow | |
* @param {?=} onReturn | |
* @return {?} | |
*/ | |
Location.prototype.subscribe = function (onNext, onThrow, onReturn) { | |
if (onThrow === void 0) { onThrow = null; } | |
if (onReturn === void 0) { onReturn = null; } | |
return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn }); | |
}; | |
/** | |
* Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as | |
* is. | |
* @param {?} params | |
* @return {?} | |
*/ | |
Location.normalizeQueryParams = function (params) { | |
return params && params[0] !== '?' ? '?' + params : params; | |
}; | |
/** | |
* Given 2 parts of a url, join them with a slash if needed. | |
* @param {?} start | |
* @param {?} end | |
* @return {?} | |
*/ | |
Location.joinWithSlash = function (start, end) { | |
if (start.length == 0) { | |
return end; | |
} | |
if (end.length == 0) { | |
return start; | |
} | |
var /** @type {?} */ slashes = 0; | |
if (start.endsWith('/')) { | |
slashes++; | |
} | |
if (end.startsWith('/')) { | |
slashes++; | |
} | |
if (slashes == 2) { | |
return start + end.substring(1); | |
} | |
if (slashes == 1) { | |
return start + end; | |
} | |
return start + '/' + end; | |
}; | |
/** | |
* If url has a trailing slash, remove it, otherwise return url as is. | |
* @param {?} url | |
* @return {?} | |
*/ | |
Location.stripTrailingSlash = function (url) { return url.replace(/\/$/, ''); }; | |
return Location; | |
}()); | |
Location.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
Location.ctorParameters = function () { return [ | |
{ type: LocationStrategy, }, | |
]; }; | |
/** | |
* @param {?} baseHref | |
* @param {?} url | |
* @return {?} | |
*/ | |
function _stripBaseHref(baseHref, url) { | |
return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url; | |
} | |
/** | |
* @param {?} url | |
* @return {?} | |
*/ | |
function _stripIndexHtml(url) { | |
return url.replace(/\/index.html$/, ''); | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* \@whatItDoes Use URL hash for storing application location data. | |
* \@description | |
* `HashLocationStrategy` is a {\@link LocationStrategy} used to configure the | |
* {\@link Location} service to represent its state in the | |
* [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) | |
* of the browser's URL. | |
* | |
* For instance, if you call `location.go('/foo')`, the browser's URL will become | |
* `example.com#/foo`. | |
* | |
* ### Example | |
* | |
* {\@example common/location/ts/hash_location_component.ts region='LocationComponent'} | |
* | |
* \@stable | |
*/ | |
var HashLocationStrategy = (function (_super) { | |
__extends(HashLocationStrategy, _super); | |
/** | |
* @param {?} _platformLocation | |
* @param {?=} _baseHref | |
*/ | |
function HashLocationStrategy(_platformLocation, _baseHref) { | |
var _this = _super.call(this) || this; | |
_this._platformLocation = _platformLocation; | |
_this._baseHref = ''; | |
if (_baseHref != null) { | |
_this._baseHref = _baseHref; | |
} | |
return _this; | |
} | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.onPopState = function (fn) { | |
this._platformLocation.onPopState(fn); | |
this._platformLocation.onHashChange(fn); | |
}; | |
/** | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; | |
/** | |
* @param {?=} includeHash | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.path = function (includeHash) { | |
if (includeHash === void 0) { includeHash = false; } | |
// the hash value is always prefixed with a `#` | |
// and if it is empty then it will stay empty | |
var /** @type {?} */ path = this._platformLocation.hash; | |
if (path == null) | |
path = '#'; | |
return path.length > 0 ? path.substring(1) : path; | |
}; | |
/** | |
* @param {?} internal | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.prepareExternalUrl = function (internal) { | |
var /** @type {?} */ url = Location.joinWithSlash(this._baseHref, internal); | |
return url.length > 0 ? ('#' + url) : url; | |
}; | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} path | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) { | |
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); | |
if (url.length == 0) { | |
url = this._platformLocation.pathname; | |
} | |
this._platformLocation.pushState(state, title, url); | |
}; | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} path | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) { | |
var /** @type {?} */ url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams)); | |
if (url.length == 0) { | |
url = this._platformLocation.pathname; | |
} | |
this._platformLocation.replaceState(state, title, url); | |
}; | |
/** | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; | |
/** | |
* @return {?} | |
*/ | |
HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; | |
return HashLocationStrategy; | |
}(LocationStrategy)); | |
HashLocationStrategy.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
HashLocationStrategy.ctorParameters = function () { return [ | |
{ type: PlatformLocation, }, | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@whatItDoes Use URL for storing application location data. | |
* \@description | |
* `PathLocationStrategy` is a {\@link LocationStrategy} used to configure the | |
* {\@link Location} service to represent its state in the | |
* [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the | |
* browser's URL. | |
* | |
* If you're using `PathLocationStrategy`, you must provide a {\@link APP_BASE_HREF} | |
* or add a base element to the document. This URL prefix that will be preserved | |
* when generating and recognizing URLs. | |
* | |
* For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call | |
* `location.go('/foo')`, the browser's URL will become | |
* `example.com/my/app/foo`. | |
* | |
* Similarly, if you add `<base href='/my/app'/>` to the document and call | |
* `location.go('/foo')`, the browser's URL will become | |
* `example.com/my/app/foo`. | |
* | |
* ### Example | |
* | |
* {\@example common/location/ts/path_location_component.ts region='LocationComponent'} | |
* | |
* \@stable | |
*/ | |
var PathLocationStrategy = (function (_super) { | |
__extends(PathLocationStrategy, _super); | |
/** | |
* @param {?} _platformLocation | |
* @param {?=} href | |
*/ | |
function PathLocationStrategy(_platformLocation, href) { | |
var _this = _super.call(this) || this; | |
_this._platformLocation = _platformLocation; | |
if (href == null) { | |
href = _this._platformLocation.getBaseHrefFromDOM(); | |
} | |
if (href == null) { | |
throw new Error("No base href set. Please provide a value for the APP_BASE_HREF token or add a base element to the document."); | |
} | |
_this._baseHref = href; | |
return _this; | |
} | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.onPopState = function (fn) { | |
this._platformLocation.onPopState(fn); | |
this._platformLocation.onHashChange(fn); | |
}; | |
/** | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; }; | |
/** | |
* @param {?} internal | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.prepareExternalUrl = function (internal) { | |
return Location.joinWithSlash(this._baseHref, internal); | |
}; | |
/** | |
* @param {?=} includeHash | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.path = function (includeHash) { | |
if (includeHash === void 0) { includeHash = false; } | |
var /** @type {?} */ pathname = this._platformLocation.pathname + | |
Location.normalizeQueryParams(this._platformLocation.search); | |
var /** @type {?} */ hash = this._platformLocation.hash; | |
return hash && includeHash ? "" + pathname + hash : pathname; | |
}; | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) { | |
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); | |
this._platformLocation.pushState(state, title, externalUrl); | |
}; | |
/** | |
* @param {?} state | |
* @param {?} title | |
* @param {?} url | |
* @param {?} queryParams | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) { | |
var /** @type {?} */ externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams)); | |
this._platformLocation.replaceState(state, title, externalUrl); | |
}; | |
/** | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); }; | |
/** | |
* @return {?} | |
*/ | |
PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); }; | |
return PathLocationStrategy; | |
}(LocationStrategy)); | |
PathLocationStrategy.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
PathLocationStrategy.ctorParameters = function () { return [ | |
{ type: PlatformLocation, }, | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Optional"] }, { type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [APP_BASE_HREF,] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* \@experimental | |
* @abstract | |
*/ | |
var NgLocalization = (function () { | |
function NgLocalization() { | |
} | |
/** | |
* @abstract | |
* @param {?} value | |
* @return {?} | |
*/ | |
NgLocalization.prototype.getPluralCategory = function (value) { }; | |
return NgLocalization; | |
}()); | |
/** | |
* Returns the plural category for a given value. | |
* - "=value" when the case exists, | |
* - the plural category otherwise | |
* | |
* \@internal | |
* @param {?} value | |
* @param {?} cases | |
* @param {?} ngLocalization | |
* @return {?} | |
*/ | |
function getPluralCategory(value, cases, ngLocalization) { | |
var /** @type {?} */ key = "=" + value; | |
if (cases.indexOf(key) > -1) { | |
return key; | |
} | |
key = ngLocalization.getPluralCategory(value); | |
if (cases.indexOf(key) > -1) { | |
return key; | |
} | |
if (cases.indexOf('other') > -1) { | |
return 'other'; | |
} | |
throw new Error("No plural message found for value \"" + value + "\""); | |
} | |
/** | |
* Returns the plural case based on the locale | |
* | |
* \@experimental | |
*/ | |
var NgLocaleLocalization = (function (_super) { | |
__extends(NgLocaleLocalization, _super); | |
/** | |
* @param {?} locale | |
*/ | |
function NgLocaleLocalization(locale) { | |
var _this = _super.call(this) || this; | |
_this.locale = locale; | |
return _this; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
NgLocaleLocalization.prototype.getPluralCategory = function (value) { | |
var /** @type {?} */ plural = getPluralCase(this.locale, value); | |
switch (plural) { | |
case Plural.Zero: | |
return 'zero'; | |
case Plural.One: | |
return 'one'; | |
case Plural.Two: | |
return 'two'; | |
case Plural.Few: | |
return 'few'; | |
case Plural.Many: | |
return 'many'; | |
default: | |
return 'other'; | |
} | |
}; | |
return NgLocaleLocalization; | |
}(NgLocalization)); | |
NgLocaleLocalization.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Injectable"] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgLocaleLocalization.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, | |
]; }; | |
var Plural = {}; | |
Plural.Zero = 0; | |
Plural.One = 1; | |
Plural.Two = 2; | |
Plural.Few = 3; | |
Plural.Many = 4; | |
Plural.Other = 5; | |
Plural[Plural.Zero] = "Zero"; | |
Plural[Plural.One] = "One"; | |
Plural[Plural.Two] = "Two"; | |
Plural[Plural.Few] = "Few"; | |
Plural[Plural.Many] = "Many"; | |
Plural[Plural.Other] = "Other"; | |
/** | |
* Returns the plural case based on the locale | |
* | |
* \@experimental | |
* @param {?} locale | |
* @param {?} nLike | |
* @return {?} | |
*/ | |
function getPluralCase(locale, nLike) { | |
// TODO(vicb): lazy compute | |
if (typeof nLike === 'string') { | |
nLike = parseInt(/** @type {?} */ (nLike), 10); | |
} | |
var /** @type {?} */ n = (nLike); | |
var /** @type {?} */ nDecimal = n.toString().replace(/^[^.]*\.?/, ''); | |
var /** @type {?} */ i = Math.floor(Math.abs(n)); | |
var /** @type {?} */ v = nDecimal.length; | |
var /** @type {?} */ f = parseInt(nDecimal, 10); | |
var /** @type {?} */ t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0; | |
var /** @type {?} */ lang = locale.split('-')[0].toLowerCase(); | |
switch (lang) { | |
case 'af': | |
case 'asa': | |
case 'az': | |
case 'bem': | |
case 'bez': | |
case 'bg': | |
case 'brx': | |
case 'ce': | |
case 'cgg': | |
case 'chr': | |
case 'ckb': | |
case 'ee': | |
case 'el': | |
case 'eo': | |
case 'es': | |
case 'eu': | |
case 'fo': | |
case 'fur': | |
case 'gsw': | |
case 'ha': | |
case 'haw': | |
case 'hu': | |
case 'jgo': | |
case 'jmc': | |
case 'ka': | |
case 'kk': | |
case 'kkj': | |
case 'kl': | |
case 'ks': | |
case 'ksb': | |
case 'ky': | |
case 'lb': | |
case 'lg': | |
case 'mas': | |
case 'mgo': | |
case 'ml': | |
case 'mn': | |
case 'nb': | |
case 'nd': | |
case 'ne': | |
case 'nn': | |
case 'nnh': | |
case 'nyn': | |
case 'om': | |
case 'or': | |
case 'os': | |
case 'ps': | |
case 'rm': | |
case 'rof': | |
case 'rwk': | |
case 'saq': | |
case 'seh': | |
case 'sn': | |
case 'so': | |
case 'sq': | |
case 'ta': | |
case 'te': | |
case 'teo': | |
case 'tk': | |
case 'tr': | |
case 'ug': | |
case 'uz': | |
case 'vo': | |
case 'vun': | |
case 'wae': | |
case 'xog': | |
if (n === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'agq': | |
case 'bas': | |
case 'cu': | |
case 'dav': | |
case 'dje': | |
case 'dua': | |
case 'dyo': | |
case 'ebu': | |
case 'ewo': | |
case 'guz': | |
case 'kam': | |
case 'khq': | |
case 'ki': | |
case 'kln': | |
case 'kok': | |
case 'ksf': | |
case 'lrc': | |
case 'lu': | |
case 'luo': | |
case 'luy': | |
case 'mer': | |
case 'mfe': | |
case 'mgh': | |
case 'mua': | |
case 'mzn': | |
case 'nmg': | |
case 'nus': | |
case 'qu': | |
case 'rn': | |
case 'rw': | |
case 'sbp': | |
case 'twq': | |
case 'vai': | |
case 'yav': | |
case 'yue': | |
case 'zgh': | |
case 'ak': | |
case 'ln': | |
case 'mg': | |
case 'pa': | |
case 'ti': | |
if (n === Math.floor(n) && n >= 0 && n <= 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'am': | |
case 'as': | |
case 'bn': | |
case 'fa': | |
case 'gu': | |
case 'hi': | |
case 'kn': | |
case 'mr': | |
case 'zu': | |
if (i === 0 || n === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'ar': | |
if (n === 0) | |
return Plural.Zero; | |
if (n === 1) | |
return Plural.One; | |
if (n === 2) | |
return Plural.Two; | |
if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10) | |
return Plural.Few; | |
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99) | |
return Plural.Many; | |
return Plural.Other; | |
case 'ast': | |
case 'ca': | |
case 'de': | |
case 'en': | |
case 'et': | |
case 'fi': | |
case 'fy': | |
case 'gl': | |
case 'it': | |
case 'nl': | |
case 'sv': | |
case 'sw': | |
case 'ur': | |
case 'yi': | |
if (i === 1 && v === 0) | |
return Plural.One; | |
return Plural.Other; | |
case 'be': | |
if (n % 10 === 1 && !(n % 100 === 11)) | |
return Plural.One; | |
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 && | |
!(n % 100 >= 12 && n % 100 <= 14)) | |
return Plural.Few; | |
if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 || | |
n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14) | |
return Plural.Many; | |
return Plural.Other; | |
case 'br': | |
if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91)) | |
return Plural.One; | |
if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92)) | |
return Plural.Two; | |
if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) && | |
!(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 || | |
n % 100 >= 90 && n % 100 <= 99)) | |
return Plural.Few; | |
if (!(n === 0) && n % 1e6 === 0) | |
return Plural.Many; | |
return Plural.Other; | |
case 'bs': | |
case 'hr': | |
case 'sr': | |
if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11)) | |
return Plural.One; | |
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && | |
!(i % 100 >= 12 && i % 100 <= 14) || | |
f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 && | |
!(f % 100 >= 12 && f % 100 <= 14)) | |
return Plural.Few; | |
return Plural.Other; | |
case 'cs': | |
case 'sk': | |
if (i === 1 && v === 0) | |
return Plural.One; | |
if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0) | |
return Plural.Few; | |
if (!(v === 0)) | |
return Plural.Many; | |
return Plural.Other; | |
case 'cy': | |
if (n === 0) | |
return Plural.Zero; | |
if (n === 1) | |
return Plural.One; | |
if (n === 2) | |
return Plural.Two; | |
if (n === 3) | |
return Plural.Few; | |
if (n === 6) | |
return Plural.Many; | |
return Plural.Other; | |
case 'da': | |
if (n === 1 || !(t === 0) && (i === 0 || i === 1)) | |
return Plural.One; | |
return Plural.Other; | |
case 'dsb': | |
case 'hsb': | |
if (v === 0 && i % 100 === 1 || f % 100 === 1) | |
return Plural.One; | |
if (v === 0 && i % 100 === 2 || f % 100 === 2) | |
return Plural.Two; | |
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || | |
f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4) | |
return Plural.Few; | |
return Plural.Other; | |
case 'ff': | |
case 'fr': | |
case 'hy': | |
case 'kab': | |
if (i === 0 || i === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'fil': | |
if (v === 0 && (i === 1 || i === 2 || i === 3) || | |
v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) || | |
!(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9)) | |
return Plural.One; | |
return Plural.Other; | |
case 'ga': | |
if (n === 1) | |
return Plural.One; | |
if (n === 2) | |
return Plural.Two; | |
if (n === Math.floor(n) && n >= 3 && n <= 6) | |
return Plural.Few; | |
if (n === Math.floor(n) && n >= 7 && n <= 10) | |
return Plural.Many; | |
return Plural.Other; | |
case 'gd': | |
if (n === 1 || n === 11) | |
return Plural.One; | |
if (n === 2 || n === 12) | |
return Plural.Two; | |
if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19)) | |
return Plural.Few; | |
return Plural.Other; | |
case 'gv': | |
if (v === 0 && i % 10 === 1) | |
return Plural.One; | |
if (v === 0 && i % 10 === 2) | |
return Plural.Two; | |
if (v === 0 && | |
(i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80)) | |
return Plural.Few; | |
if (!(v === 0)) | |
return Plural.Many; | |
return Plural.Other; | |
case 'he': | |
if (i === 1 && v === 0) | |
return Plural.One; | |
if (i === 2 && v === 0) | |
return Plural.Two; | |
if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0) | |
return Plural.Many; | |
return Plural.Other; | |
case 'is': | |
if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0)) | |
return Plural.One; | |
return Plural.Other; | |
case 'ksh': | |
if (n === 0) | |
return Plural.Zero; | |
if (n === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'kw': | |
case 'naq': | |
case 'se': | |
case 'smn': | |
if (n === 1) | |
return Plural.One; | |
if (n === 2) | |
return Plural.Two; | |
return Plural.Other; | |
case 'lag': | |
if (n === 0) | |
return Plural.Zero; | |
if ((i === 0 || i === 1) && !(n === 0)) | |
return Plural.One; | |
return Plural.Other; | |
case 'lt': | |
if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19)) | |
return Plural.One; | |
if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 && | |
!(n % 100 >= 11 && n % 100 <= 19)) | |
return Plural.Few; | |
if (!(f === 0)) | |
return Plural.Many; | |
return Plural.Other; | |
case 'lv': | |
case 'prg': | |
if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 || | |
v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19) | |
return Plural.Zero; | |
if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) || | |
!(v === 2) && f % 10 === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'mk': | |
if (v === 0 && i % 10 === 1 || f % 10 === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'mt': | |
if (n === 1) | |
return Plural.One; | |
if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10) | |
return Plural.Few; | |
if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19) | |
return Plural.Many; | |
return Plural.Other; | |
case 'pl': | |
if (i === 1 && v === 0) | |
return Plural.One; | |
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && | |
!(i % 100 >= 12 && i % 100 <= 14)) | |
return Plural.Few; | |
if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 || | |
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || | |
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14) | |
return Plural.Many; | |
return Plural.Other; | |
case 'pt': | |
if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2)) | |
return Plural.One; | |
return Plural.Other; | |
case 'ro': | |
if (i === 1 && v === 0) | |
return Plural.One; | |
if (!(v === 0) || n === 0 || | |
!(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19) | |
return Plural.Few; | |
return Plural.Other; | |
case 'ru': | |
case 'uk': | |
if (v === 0 && i % 10 === 1 && !(i % 100 === 11)) | |
return Plural.One; | |
if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 && | |
!(i % 100 >= 12 && i % 100 <= 14)) | |
return Plural.Few; | |
if (v === 0 && i % 10 === 0 || | |
v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 || | |
v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14) | |
return Plural.Many; | |
return Plural.Other; | |
case 'shi': | |
if (i === 0 || n === 1) | |
return Plural.One; | |
if (n === Math.floor(n) && n >= 2 && n <= 10) | |
return Plural.Few; | |
return Plural.Other; | |
case 'si': | |
if (n === 0 || n === 1 || i === 0 && f === 1) | |
return Plural.One; | |
return Plural.Other; | |
case 'sl': | |
if (v === 0 && i % 100 === 1) | |
return Plural.One; | |
if (v === 0 && i % 100 === 2) | |
return Plural.Two; | |
if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0)) | |
return Plural.Few; | |
return Plural.Other; | |
case 'tzm': | |
if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99) | |
return Plural.One; | |
return Plural.Other; | |
default: | |
return Plural.Other; | |
} | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Adds and removes CSS classes on an HTML element. | |
* | |
* \@howToUse | |
* ``` | |
* <some-element [ngClass]="'first second'">...</some-element> | |
* | |
* <some-element [ngClass]="['first', 'second']">...</some-element> | |
* | |
* <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element> | |
* | |
* <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element> | |
* | |
* <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element> | |
* ``` | |
* | |
* \@description | |
* | |
* The CSS classes are updated as follows, depending on the type of the expression evaluation: | |
* - `string` - the CSS classes listed in the string (space delimited) are added, | |
* - `Array` - the CSS classes declared as Array elements are added, | |
* - `Object` - keys are CSS classes that get added when the expression given in the value | |
* evaluates to a truthy value, otherwise they are removed. | |
* | |
* \@stable | |
*/ | |
var NgClass = (function () { | |
/** | |
* @param {?} _iterableDiffers | |
* @param {?} _keyValueDiffers | |
* @param {?} _ngEl | |
* @param {?} _renderer | |
*/ | |
function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) { | |
this._iterableDiffers = _iterableDiffers; | |
this._keyValueDiffers = _keyValueDiffers; | |
this._ngEl = _ngEl; | |
this._renderer = _renderer; | |
this._initialClasses = []; | |
} | |
Object.defineProperty(NgClass.prototype, "klass", { | |
/** | |
* @param {?} v | |
* @return {?} | |
*/ | |
set: function (v) { | |
this._applyInitialClasses(true); | |
this._initialClasses = typeof v === 'string' ? v.split(/\s+/) : []; | |
this._applyInitialClasses(false); | |
this._applyClasses(this._rawClass, false); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgClass.prototype, "ngClass", { | |
/** | |
* @param {?} v | |
* @return {?} | |
*/ | |
set: function (v) { | |
this._cleanupClasses(this._rawClass); | |
this._iterableDiffer = null; | |
this._keyValueDiffer = null; | |
this._rawClass = typeof v === 'string' ? v.split(/\s+/) : v; | |
if (this._rawClass) { | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisListLikeIterable"])(this._rawClass)) { | |
this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create(); | |
} | |
else { | |
this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create(); | |
} | |
} | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
NgClass.prototype.ngDoCheck = function () { | |
if (this._iterableDiffer) { | |
var /** @type {?} */ iterableChanges = this._iterableDiffer.diff(/** @type {?} */ (this._rawClass)); | |
if (iterableChanges) { | |
this._applyIterableChanges(iterableChanges); | |
} | |
} | |
else if (this._keyValueDiffer) { | |
var /** @type {?} */ keyValueChanges = this._keyValueDiffer.diff(/** @type {?} */ (this._rawClass)); | |
if (keyValueChanges) { | |
this._applyKeyValueChanges(keyValueChanges); | |
} | |
} | |
}; | |
/** | |
* @param {?} rawClassVal | |
* @return {?} | |
*/ | |
NgClass.prototype._cleanupClasses = function (rawClassVal) { | |
this._applyClasses(rawClassVal, true); | |
this._applyInitialClasses(false); | |
}; | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgClass.prototype._applyKeyValueChanges = function (changes) { | |
var _this = this; | |
changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); | |
changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); }); | |
changes.forEachRemovedItem(function (record) { | |
if (record.previousValue) { | |
_this._toggleClass(record.key, false); | |
} | |
}); | |
}; | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgClass.prototype._applyIterableChanges = function (changes) { | |
var _this = this; | |
changes.forEachAddedItem(function (record) { | |
if (typeof record.item === 'string') { | |
_this._toggleClass(record.item, true); | |
} | |
else { | |
throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(record.item)); | |
} | |
}); | |
changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); }); | |
}; | |
/** | |
* @param {?} isCleanup | |
* @return {?} | |
*/ | |
NgClass.prototype._applyInitialClasses = function (isCleanup) { | |
var _this = this; | |
this._initialClasses.forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); | |
}; | |
/** | |
* @param {?} rawClassVal | |
* @param {?} isCleanup | |
* @return {?} | |
*/ | |
NgClass.prototype._applyClasses = function (rawClassVal, isCleanup) { | |
var _this = this; | |
if (rawClassVal) { | |
if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) { | |
((rawClassVal)).forEach(function (klass) { return _this._toggleClass(klass, !isCleanup); }); | |
} | |
else { | |
Object.keys(rawClassVal).forEach(function (klass) { | |
if (rawClassVal[klass] != null) | |
_this._toggleClass(klass, !isCleanup); | |
}); | |
} | |
} | |
}; | |
/** | |
* @param {?} klass | |
* @param {?} enabled | |
* @return {?} | |
*/ | |
NgClass.prototype._toggleClass = function (klass, enabled) { | |
var _this = this; | |
klass = klass.trim(); | |
if (klass) { | |
klass.split(/\s+/g).forEach(function (klass) { _this._renderer.setElementClass(_this._ngEl.nativeElement, klass, !!enabled); }); | |
} | |
}; | |
return NgClass; | |
}()); | |
NgClass.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngClass]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgClass.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer"], }, | |
]; }; | |
NgClass.propDecorators = { | |
'klass': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"], args: ['class',] },], | |
'ngClass': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* @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 | |
*/ | |
/** | |
* Instantiates a single {\@link Component} type and inserts its Host View into current View. | |
* `NgComponentOutlet` provides a declarative approach for dynamic component creation. | |
* | |
* `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and | |
* any existing component will get destroyed. | |
* | |
* ### Fine tune control | |
* | |
* You can control the component creation process by using the following optional attributes: | |
* | |
* * `ngComponentOutletInjector`: Optional custom {\@link Injector} that will be used as parent for | |
* the Component. Defaults to the injector of the current view container. | |
* | |
* * `ngComponentOutletProviders`: Optional injectable objects ({\@link Provider}) that are visible | |
* to the component. | |
* | |
* * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content | |
* section of the component, if exists. | |
* | |
* * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other | |
* module, then load a component from that module. | |
* | |
* ### Syntax | |
* | |
* Simple | |
* ``` | |
* <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container> | |
* ``` | |
* | |
* Customized injector/content | |
* ``` | |
* <ng-container *ngComponentOutlet="componentTypeExpression; | |
* injector: injectorExpression; | |
* content: contentNodesExpression;"> | |
* </ng-container> | |
* ``` | |
* | |
* Customized ngModuleFactory | |
* ``` | |
* <ng-container *ngComponentOutlet="componentTypeExpression; | |
* ngModuleFactory: moduleFactory;"> | |
* </ng-container> | |
* ``` | |
* # Example | |
* | |
* {\@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'} | |
* | |
* A more complete example with additional options: | |
* | |
* {\@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'} | |
* A more complete example with ngModuleFactory: | |
* | |
* {\@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'} | |
* | |
* \@experimental | |
*/ | |
var NgComponentOutlet = (function () { | |
/** | |
* @param {?} _viewContainerRef | |
*/ | |
function NgComponentOutlet(_viewContainerRef) { | |
this._viewContainerRef = _viewContainerRef; | |
this._componentRef = null; | |
this._moduleRef = null; | |
} | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgComponentOutlet.prototype.ngOnChanges = function (changes) { | |
this._viewContainerRef.clear(); | |
this._componentRef = null; | |
if (this.ngComponentOutlet) { | |
var /** @type {?} */ elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector; | |
if (changes['ngComponentOutletNgModuleFactory']) { | |
if (this._moduleRef) | |
this._moduleRef.destroy(); | |
if (this.ngComponentOutletNgModuleFactory) { | |
var /** @type {?} */ parentModule = elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModuleRef"]); | |
this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector); | |
} | |
else { | |
this._moduleRef = null; | |
} | |
} | |
var /** @type {?} */ componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver : | |
elInjector.get(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ComponentFactoryResolver"]); | |
var /** @type {?} */ componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet); | |
this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent); | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgComponentOutlet.prototype.ngOnDestroy = function () { | |
if (this._moduleRef) | |
this._moduleRef.destroy(); | |
}; | |
return NgComponentOutlet; | |
}()); | |
NgComponentOutlet.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngComponentOutlet]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgComponentOutlet.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
]; }; | |
NgComponentOutlet.propDecorators = { | |
'ngComponentOutlet': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngComponentOutletInjector': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngComponentOutletContent': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngComponentOutletNgModuleFactory': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@stable | |
*/ | |
var NgForOfContext = (function () { | |
/** | |
* @param {?} $implicit | |
* @param {?} ngForOf | |
* @param {?} index | |
* @param {?} count | |
*/ | |
function NgForOfContext($implicit, ngForOf, index, count) { | |
this.$implicit = $implicit; | |
this.ngForOf = ngForOf; | |
this.index = index; | |
this.count = count; | |
} | |
Object.defineProperty(NgForOfContext.prototype, "first", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.index === 0; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgForOfContext.prototype, "last", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.index === this.count - 1; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgForOfContext.prototype, "even", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this.index % 2 === 0; }, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgForOfContext.prototype, "odd", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return !this.even; }, | |
enumerable: true, | |
configurable: true | |
}); | |
return NgForOfContext; | |
}()); | |
/** | |
* The `NgForOf` directive instantiates a template once per item from an iterable. The context | |
* for each instantiated template inherits from the outer context with the given loop variable | |
* set to the current item from the iterable. | |
* | |
* ### Local Variables | |
* | |
* `NgForOf` provides several exported values that can be aliased to local variables: | |
* | |
* - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`). | |
* - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is | |
* more complex then a property access, for example when using the async pipe (`userStreams | | |
* async`). | |
* - `index: number`: The index of the current item in the iterable. | |
* - `first: boolean`: True when the item is the first item in the iterable. | |
* - `last: boolean`: True when the item is the last item in the iterable. | |
* - `even: boolean`: True when the item has an even index in the iterable. | |
* - `odd: boolean`: True when the item has an odd index in the iterable. | |
* | |
* ``` | |
* <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst"> | |
* {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span> | |
* </li> | |
* ``` | |
* | |
* ### Change Propagation | |
* | |
* When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM: | |
* | |
* * When an item is added, a new instance of the template is added to the DOM. | |
* * When an item is removed, its template instance is removed from the DOM. | |
* * When items are reordered, their respective templates are reordered in the DOM. | |
* * Otherwise, the DOM element for that item will remain the same. | |
* | |
* Angular uses object identity to track insertions and deletions within the iterator and reproduce | |
* those changes in the DOM. This has important implications for animations and any stateful | |
* controls (such as `<input>` elements which accept user input) that are present. Inserted rows can | |
* be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state | |
* such as user input. | |
* | |
* It is possible for the identities of elements in the iterator to change while the data does not. | |
* This can happen, for example, if the iterator produced from an RPC to the server, and that | |
* RPC is re-run. Even if the data hasn't changed, the second response will produce objects with | |
* different identities, and Angular will tear down the entire DOM and rebuild it (as if all old | |
* elements were deleted and all new elements inserted). This is an expensive operation and should | |
* be avoided if possible. | |
* | |
* To customize the default tracking algorithm, `NgForOf` supports `trackBy` option. | |
* `trackBy` takes a function which has two arguments: `index` and `item`. | |
* If `trackBy` is given, Angular tracks changes by the return value of the function. | |
* | |
* ### Syntax | |
* | |
* - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>` | |
* - `<li template="ngFor let item of items; index as i; trackBy: trackByFn">...</li>` | |
* | |
* With `<ng-template>` element: | |
* | |
* ``` | |
* <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn"> | |
* <li>...</li> | |
* </ng-template> | |
* ``` | |
* | |
* ### Example | |
* | |
* See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed | |
* example. | |
* | |
* \@stable | |
*/ | |
var NgForOf = (function () { | |
/** | |
* @param {?} _viewContainer | |
* @param {?} _template | |
* @param {?} _differs | |
*/ | |
function NgForOf(_viewContainer, _template, _differs) { | |
this._viewContainer = _viewContainer; | |
this._template = _template; | |
this._differs = _differs; | |
this._differ = null; | |
} | |
Object.defineProperty(NgForOf.prototype, "ngForTrackBy", { | |
/** | |
* @return {?} | |
*/ | |
get: function () { return this._trackByFn; }, | |
/** | |
* @param {?} fn | |
* @return {?} | |
*/ | |
set: function (fn) { | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["isDevMode"])() && fn != null && typeof fn !== 'function') { | |
// TODO(vicb): use a log service once there is a public one available | |
if ((console) && (console.warn)) { | |
console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " + | |
"See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information."); | |
} | |
} | |
this._trackByFn = fn; | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgForOf.prototype, "ngForTemplate", { | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
set: function (value) { | |
// TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1 | |
// The current type is too restrictive; a template that just uses index, for example, | |
// should be acceptable. | |
if (value) { | |
this._template = value; | |
} | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgForOf.prototype.ngOnChanges = function (changes) { | |
if ('ngForOf' in changes) { | |
// React on ngForOf changes only once all inputs have been initialized | |
var /** @type {?} */ value = changes['ngForOf'].currentValue; | |
if (!this._differ && value) { | |
try { | |
this._differ = this._differs.find(value).create(this.ngForTrackBy); | |
} | |
catch (e) { | |
throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays."); | |
} | |
} | |
} | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgForOf.prototype.ngDoCheck = function () { | |
if (this._differ) { | |
var /** @type {?} */ changes = this._differ.diff(this.ngForOf); | |
if (changes) | |
this._applyChanges(changes); | |
} | |
}; | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgForOf.prototype._applyChanges = function (changes) { | |
var _this = this; | |
var /** @type {?} */ insertTuples = []; | |
changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) { | |
if (item.previousIndex == null) { | |
var /** @type {?} */ view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(null, _this.ngForOf, null, null), currentIndex); | |
var /** @type {?} */ tuple = new RecordViewTuple(item, view); | |
insertTuples.push(tuple); | |
} | |
else if (currentIndex == null) { | |
_this._viewContainer.remove(adjustedPreviousIndex); | |
} | |
else { | |
var /** @type {?} */ view = _this._viewContainer.get(adjustedPreviousIndex); | |
_this._viewContainer.move(view, currentIndex); | |
var /** @type {?} */ tuple = new RecordViewTuple(item, /** @type {?} */ (view)); | |
insertTuples.push(tuple); | |
} | |
}); | |
for (var /** @type {?} */ i = 0; i < insertTuples.length; i++) { | |
this._perViewChange(insertTuples[i].view, insertTuples[i].record); | |
} | |
for (var /** @type {?} */ i = 0, /** @type {?} */ ilen = this._viewContainer.length; i < ilen; i++) { | |
var /** @type {?} */ viewRef = (this._viewContainer.get(i)); | |
viewRef.context.index = i; | |
viewRef.context.count = ilen; | |
} | |
changes.forEachIdentityChange(function (record) { | |
var /** @type {?} */ viewRef = (_this._viewContainer.get(record.currentIndex)); | |
viewRef.context.$implicit = record.item; | |
}); | |
}; | |
/** | |
* @param {?} view | |
* @param {?} record | |
* @return {?} | |
*/ | |
NgForOf.prototype._perViewChange = function (view, record) { | |
view.context.$implicit = record.item; | |
}; | |
return NgForOf; | |
}()); | |
NgForOf.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngFor][ngForOf]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgForOf.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["IterableDiffers"], }, | |
]; }; | |
NgForOf.propDecorators = { | |
'ngForOf': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngForTrackBy': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngForTemplate': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
var RecordViewTuple = (function () { | |
/** | |
* @param {?} record | |
* @param {?} view | |
*/ | |
function RecordViewTuple(record, view) { | |
this.record = record; | |
this.view = view; | |
} | |
return RecordViewTuple; | |
}()); | |
/** | |
* @deprecated from v4.0.0 - Use NgForOf instead. | |
*/ | |
var NgFor = NgForOf; | |
/** | |
* @param {?} type | |
* @return {?} | |
*/ | |
function getTypeNameForDebugging(type) { | |
return type['name'] || typeof type; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* Conditionally includes a template based on the value of an `expression`. | |
* | |
* `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place | |
* when expression is truthy or falsy respectively. Typically the: | |
* - `then` template is the inline template of `ngIf` unless bound to a different value. | |
* - `else` template is blank unless it is bound. | |
* | |
* # Most common usage | |
* | |
* The most common usage of the `ngIf` directive is to conditionally show the inline template as | |
* seen in this example: | |
* {\@example common/ngIf/ts/module.ts region='NgIfSimple'} | |
* | |
* # Showing an alternative template using `else` | |
* | |
* If it is necessary to display a template when the `expression` is falsy use the `else` template | |
* binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`. | |
* The template can be defined anywhere in the component view but is typically placed right after | |
* `ngIf` for readability. | |
* | |
* {\@example common/ngIf/ts/module.ts region='NgIfElse'} | |
* | |
* # Using non-inlined `then` template | |
* | |
* Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using | |
* a binding (just like `else`). Because `then` and `else` are bindings, the template references can | |
* change at runtime as shown in this example. | |
* | |
* {\@example common/ngIf/ts/module.ts region='NgIfThenElse'} | |
* | |
* # Storing conditional result in a variable | |
* | |
* A common pattern is that we need to show a set of properties from the same object. If the | |
* object is undefined, then we have to use the safe-traversal-operator `?.` to guard against | |
* dereferencing a `null` value. This is especially the case when waiting on async data such as | |
* when using the `async` pipe as shown in folowing example: | |
* | |
* ``` | |
* Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}! | |
* ``` | |
* | |
* There are several inefficiencies in the above example: | |
* - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the | |
* example above. | |
* - We cannot display an alternative screen while waiting for the data to arrive asynchronously. | |
* - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome. | |
* - We have to place the `async` pipe in parenthesis. | |
* | |
* A better way to do this is to use `ngIf` and store the result of the condition in a local | |
* variable as shown in the the example below: | |
* | |
* {\@example common/ngIf/ts/module.ts region='NgIfAs'} | |
* | |
* Notice that: | |
* - We use only one `async` pipe and hence only one subscription gets created. | |
* - `ngIf` stores the result of the `userStream|async` in the local variable `user`. | |
* - The local `user` can then be bound repeatedly in a more efficient way. | |
* - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only | |
* display the data if `userStream` returns a value. | |
* - We can display an alternative template while waiting for the data. | |
* | |
* ### Syntax | |
* | |
* Simple form: | |
* - `<div *ngIf="condition">...</div>` | |
* - `<div template="ngIf condition">...</div>` | |
* - `<ng-template [ngIf]="condition"><div>...</div></ng-template>` | |
* | |
* Form with an else block: | |
* ``` | |
* <div *ngIf="condition; else elseBlock">...</div> | |
* <ng-template #elseBlock>...</ng-template> | |
* ``` | |
* | |
* Form with a `then` and `else` block: | |
* ``` | |
* <div *ngIf="condition; then thenBlock else elseBlock"></div> | |
* <ng-template #thenBlock>...</ng-template> | |
* <ng-template #elseBlock>...</ng-template> | |
* ``` | |
* | |
* Form with storing the value locally: | |
* ``` | |
* <div *ngIf="condition as value; else elseBlock">{{value}}</div> | |
* <ng-template #elseBlock>...</ng-template> | |
* ``` | |
* | |
* \@stable | |
*/ | |
var NgIf = (function () { | |
/** | |
* @param {?} _viewContainer | |
* @param {?} templateRef | |
*/ | |
function NgIf(_viewContainer, templateRef) { | |
this._viewContainer = _viewContainer; | |
this._context = new NgIfContext(); | |
this._thenTemplateRef = null; | |
this._elseTemplateRef = null; | |
this._thenViewRef = null; | |
this._elseViewRef = null; | |
this._thenTemplateRef = templateRef; | |
} | |
Object.defineProperty(NgIf.prototype, "ngIf", { | |
/** | |
* @param {?} condition | |
* @return {?} | |
*/ | |
set: function (condition) { | |
this._context.$implicit = this._context.ngIf = condition; | |
this._updateView(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgIf.prototype, "ngIfThen", { | |
/** | |
* @param {?} templateRef | |
* @return {?} | |
*/ | |
set: function (templateRef) { | |
this._thenTemplateRef = templateRef; | |
this._thenViewRef = null; // clear previous view if any. | |
this._updateView(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
Object.defineProperty(NgIf.prototype, "ngIfElse", { | |
/** | |
* @param {?} templateRef | |
* @return {?} | |
*/ | |
set: function (templateRef) { | |
this._elseTemplateRef = templateRef; | |
this._elseViewRef = null; // clear previous view if any. | |
this._updateView(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
NgIf.prototype._updateView = function () { | |
if (this._context.$implicit) { | |
if (!this._thenViewRef) { | |
this._viewContainer.clear(); | |
this._elseViewRef = null; | |
if (this._thenTemplateRef) { | |
this._thenViewRef = | |
this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context); | |
} | |
} | |
} | |
else { | |
if (!this._elseViewRef) { | |
this._viewContainer.clear(); | |
this._thenViewRef = null; | |
if (this._elseTemplateRef) { | |
this._elseViewRef = | |
this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context); | |
} | |
} | |
} | |
}; | |
return NgIf; | |
}()); | |
NgIf.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngIf]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgIf.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, | |
]; }; | |
NgIf.propDecorators = { | |
'ngIf': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngIfThen': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngIfElse': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* \@stable | |
*/ | |
var NgIfContext = (function () { | |
function NgIfContext() { | |
this.$implicit = null; | |
this.ngIf = null; | |
} | |
return NgIfContext; | |
}()); | |
/** | |
* @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 SwitchView = (function () { | |
/** | |
* @param {?} _viewContainerRef | |
* @param {?} _templateRef | |
*/ | |
function SwitchView(_viewContainerRef, _templateRef) { | |
this._viewContainerRef = _viewContainerRef; | |
this._templateRef = _templateRef; | |
this._created = false; | |
} | |
/** | |
* @return {?} | |
*/ | |
SwitchView.prototype.create = function () { | |
this._created = true; | |
this._viewContainerRef.createEmbeddedView(this._templateRef); | |
}; | |
/** | |
* @return {?} | |
*/ | |
SwitchView.prototype.destroy = function () { | |
this._created = false; | |
this._viewContainerRef.clear(); | |
}; | |
/** | |
* @param {?} created | |
* @return {?} | |
*/ | |
SwitchView.prototype.enforceState = function (created) { | |
if (created && !this._created) { | |
this.create(); | |
} | |
else if (!created && this._created) { | |
this.destroy(); | |
} | |
}; | |
return SwitchView; | |
}()); | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Adds / removes DOM sub-trees when the nest match expressions matches the switch | |
* expression. | |
* | |
* \@howToUse | |
* ``` | |
* <container-element [ngSwitch]="switch_expression"> | |
* <some-element *ngSwitchCase="match_expression_1">...</some-element> | |
* <some-element *ngSwitchCase="match_expression_2">...</some-element> | |
* <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element> | |
* <ng-container *ngSwitchCase="match_expression_3"> | |
* <!-- use a ng-container to group multiple root nodes --> | |
* <inner-element></inner-element> | |
* <inner-other-element></inner-other-element> | |
* </ng-container> | |
* <some-element *ngSwitchDefault>...</some-element> | |
* </container-element> | |
* ``` | |
* \@description | |
* | |
* `NgSwitch` stamps out nested views when their match expression value matches the value of the | |
* switch expression. | |
* | |
* In other words: | |
* - you define a container element (where you place the directive with a switch expression on the | |
* `[ngSwitch]="..."` attribute) | |
* - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view | |
* root elements. | |
* | |
* Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will | |
* be preserved at the location. | |
* | |
* The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the | |
* expression is evaluated. | |
* When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is | |
* stamped out. | |
* | |
* \@stable | |
*/ | |
var NgSwitch = (function () { | |
function NgSwitch() { | |
this._defaultUsed = false; | |
this._caseCount = 0; | |
this._lastCaseCheckIndex = 0; | |
this._lastCasesMatched = false; | |
} | |
Object.defineProperty(NgSwitch.prototype, "ngSwitch", { | |
/** | |
* @param {?} newValue | |
* @return {?} | |
*/ | |
set: function (newValue) { | |
this._ngSwitch = newValue; | |
if (this._caseCount === 0) { | |
this._updateDefaultCases(true); | |
} | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* \@internal | |
* @return {?} | |
*/ | |
NgSwitch.prototype._addCase = function () { return this._caseCount++; }; | |
/** | |
* \@internal | |
* @param {?} view | |
* @return {?} | |
*/ | |
NgSwitch.prototype._addDefault = function (view) { | |
if (!this._defaultViews) { | |
this._defaultViews = []; | |
} | |
this._defaultViews.push(view); | |
}; | |
/** | |
* \@internal | |
* @param {?} value | |
* @return {?} | |
*/ | |
NgSwitch.prototype._matchCase = function (value) { | |
var /** @type {?} */ matched = value == this._ngSwitch; | |
this._lastCasesMatched = this._lastCasesMatched || matched; | |
this._lastCaseCheckIndex++; | |
if (this._lastCaseCheckIndex === this._caseCount) { | |
this._updateDefaultCases(!this._lastCasesMatched); | |
this._lastCaseCheckIndex = 0; | |
this._lastCasesMatched = false; | |
} | |
return matched; | |
}; | |
/** | |
* @param {?} useDefault | |
* @return {?} | |
*/ | |
NgSwitch.prototype._updateDefaultCases = function (useDefault) { | |
if (this._defaultViews && useDefault !== this._defaultUsed) { | |
this._defaultUsed = useDefault; | |
for (var /** @type {?} */ i = 0; i < this._defaultViews.length; i++) { | |
var /** @type {?} */ defaultView = this._defaultViews[i]; | |
defaultView.enforceState(useDefault); | |
} | |
} | |
}; | |
return NgSwitch; | |
}()); | |
NgSwitch.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitch]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgSwitch.ctorParameters = function () { return []; }; | |
NgSwitch.propDecorators = { | |
'ngSwitch': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgSwitch} when the | |
* given expression evaluate to respectively the same/different value as the switch | |
* expression. | |
* | |
* \@howToUse | |
* ``` | |
* <container-element [ngSwitch]="switch_expression"> | |
* <some-element *ngSwitchCase="match_expression_1">...</some-element> | |
* </container-element> | |
* ``` | |
* \@description | |
* | |
* Insert the sub-tree when the expression evaluates to the same value as the enclosing switch | |
* expression. | |
* | |
* If multiple match expressions match the switch expression value, all of them are displayed. | |
* | |
* See {\@link NgSwitch} for more details and example. | |
* | |
* \@stable | |
*/ | |
var NgSwitchCase = (function () { | |
/** | |
* @param {?} viewContainer | |
* @param {?} templateRef | |
* @param {?} ngSwitch | |
*/ | |
function NgSwitchCase(viewContainer, templateRef, ngSwitch) { | |
this.ngSwitch = ngSwitch; | |
ngSwitch._addCase(); | |
this._view = new SwitchView(viewContainer, templateRef); | |
} | |
/** | |
* @return {?} | |
*/ | |
NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); }; | |
return NgSwitchCase; | |
}()); | |
NgSwitchCase.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchCase]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgSwitchCase.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, | |
{ type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, | |
]; }; | |
NgSwitchCase.propDecorators = { | |
'ngSwitchCase': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Creates a view that is added to the parent {\@link NgSwitch} when no case expressions | |
* match the | |
* switch expression. | |
* | |
* \@howToUse | |
* ``` | |
* <container-element [ngSwitch]="switch_expression"> | |
* <some-element *ngSwitchCase="match_expression_1">...</some-element> | |
* <some-other-element *ngSwitchDefault>...</some-other-element> | |
* </container-element> | |
* ``` | |
* | |
* \@description | |
* | |
* Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch | |
* expression. | |
* | |
* See {\@link NgSwitch} for more details and example. | |
* | |
* \@stable | |
*/ | |
var NgSwitchDefault = (function () { | |
/** | |
* @param {?} viewContainer | |
* @param {?} templateRef | |
* @param {?} ngSwitch | |
*/ | |
function NgSwitchDefault(viewContainer, templateRef, ngSwitch) { | |
ngSwitch._addDefault(new SwitchView(viewContainer, templateRef)); | |
} | |
return NgSwitchDefault; | |
}()); | |
NgSwitchDefault.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngSwitchDefault]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgSwitchDefault.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, | |
{ type: NgSwitch, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization. | |
* | |
* \@howToUse | |
* ``` | |
* <some-element [ngPlural]="value"> | |
* <ng-template ngPluralCase="=0">there is nothing</ng-template> | |
* <ng-template ngPluralCase="=1">there is one</ng-template> | |
* <ng-template ngPluralCase="few">there are a few</ng-template> | |
* </some-element> | |
* ``` | |
* | |
* \@description | |
* | |
* Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees | |
* that match the switch expression's pluralization category. | |
* | |
* To use this directive you must provide a container element that sets the `[ngPlural]` attribute | |
* to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their | |
* expression: | |
* - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value | |
* matches the switch expression exactly, | |
* - otherwise, the view will be treated as a "category match", and will only display if exact | |
* value matches aren't found and the value maps to its category for the defined locale. | |
* | |
* See http://cldr.unicode.org/index/cldr-spec/plural-rules | |
* | |
* \@experimental | |
*/ | |
var NgPlural = (function () { | |
/** | |
* @param {?} _localization | |
*/ | |
function NgPlural(_localization) { | |
this._localization = _localization; | |
this._caseViews = {}; | |
} | |
Object.defineProperty(NgPlural.prototype, "ngPlural", { | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
set: function (value) { | |
this._switchValue = value; | |
this._updateView(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} value | |
* @param {?} switchView | |
* @return {?} | |
*/ | |
NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; }; | |
/** | |
* @return {?} | |
*/ | |
NgPlural.prototype._updateView = function () { | |
this._clearViews(); | |
var /** @type {?} */ cases = Object.keys(this._caseViews); | |
var /** @type {?} */ key = getPluralCategory(this._switchValue, cases, this._localization); | |
this._activateView(this._caseViews[key]); | |
}; | |
/** | |
* @return {?} | |
*/ | |
NgPlural.prototype._clearViews = function () { | |
if (this._activeView) | |
this._activeView.destroy(); | |
}; | |
/** | |
* @param {?} view | |
* @return {?} | |
*/ | |
NgPlural.prototype._activateView = function (view) { | |
if (view) { | |
this._activeView = view; | |
this._activeView.create(); | |
} | |
}; | |
return NgPlural; | |
}()); | |
NgPlural.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPlural]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgPlural.ctorParameters = function () { return [ | |
{ type: NgLocalization, }, | |
]; }; | |
NgPlural.propDecorators = { | |
'ngPlural': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Creates a view that will be added/removed from the parent {\@link NgPlural} when the | |
* given expression matches the plural expression according to CLDR rules. | |
* | |
* \@howToUse | |
* ``` | |
* <some-element [ngPlural]="value"> | |
* <ng-template ngPluralCase="=0">...</ng-template> | |
* <ng-template ngPluralCase="other">...</ng-template> | |
* </some-element> | |
* ``` | |
* | |
* See {\@link NgPlural} for more details and example. | |
* | |
* \@experimental | |
*/ | |
var NgPluralCase = (function () { | |
/** | |
* @param {?} value | |
* @param {?} template | |
* @param {?} viewContainer | |
* @param {?} ngPlural | |
*/ | |
function NgPluralCase(value, template, viewContainer, ngPlural) { | |
this.value = value; | |
var isANumber = !isNaN(Number(value)); | |
ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template)); | |
} | |
return NgPluralCase; | |
}()); | |
NgPluralCase.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngPluralCase]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgPluralCase.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Attribute"], args: ['ngPluralCase',] },] }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["TemplateRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
{ type: NgPlural, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Host"] },] }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Update an HTML element styles. | |
* | |
* \@howToUse | |
* ``` | |
* <some-element [ngStyle]="{'font-style': styleExp}">...</some-element> | |
* | |
* <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element> | |
* | |
* <some-element [ngStyle]="objExp">...</some-element> | |
* ``` | |
* | |
* \@description | |
* | |
* The styles are updated according to the value of the expression evaluation: | |
* - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'), | |
* - values are the values assigned to those properties (expressed in the given unit). | |
* | |
* \@stable | |
*/ | |
var NgStyle = (function () { | |
/** | |
* @param {?} _differs | |
* @param {?} _ngEl | |
* @param {?} _renderer | |
*/ | |
function NgStyle(_differs, _ngEl, _renderer) { | |
this._differs = _differs; | |
this._ngEl = _ngEl; | |
this._renderer = _renderer; | |
} | |
Object.defineProperty(NgStyle.prototype, "ngStyle", { | |
/** | |
* @param {?} v | |
* @return {?} | |
*/ | |
set: function (v) { | |
this._ngStyle = v; | |
if (!this._differ && v) { | |
this._differ = this._differs.find(v).create(); | |
} | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @return {?} | |
*/ | |
NgStyle.prototype.ngDoCheck = function () { | |
if (this._differ) { | |
var /** @type {?} */ changes = this._differ.diff(this._ngStyle); | |
if (changes) { | |
this._applyChanges(changes); | |
} | |
} | |
}; | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgStyle.prototype._applyChanges = function (changes) { | |
var _this = this; | |
changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); }); | |
changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); | |
changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); }); | |
}; | |
/** | |
* @param {?} nameAndUnit | |
* @param {?} value | |
* @return {?} | |
*/ | |
NgStyle.prototype._setStyle = function (nameAndUnit, value) { | |
var _a = nameAndUnit.split('.'), name = _a[0], unit = _a[1]; | |
value = value != null && unit ? "" + value + unit : value; | |
this._renderer.setElementStyle(this._ngEl.nativeElement, name, /** @type {?} */ (value)); | |
}; | |
return NgStyle; | |
}()); | |
NgStyle.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngStyle]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgStyle.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["KeyValueDiffers"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ElementRef"], }, | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Renderer"], }, | |
]; }; | |
NgStyle.propDecorators = { | |
'ngStyle': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* | |
* \@whatItDoes Inserts an embedded view from a prepared `TemplateRef` | |
* | |
* \@howToUse | |
* ``` | |
* <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container> | |
* ``` | |
* | |
* \@description | |
* | |
* You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`. | |
* `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding | |
* by the local template `let` declarations. | |
* | |
* Note: using the key `$implicit` in the context object will set it's value as default. | |
* | |
* # Example | |
* | |
* {\@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'} | |
* | |
* \@experimental | |
*/ | |
var NgTemplateOutlet = (function () { | |
/** | |
* @param {?} _viewContainerRef | |
*/ | |
function NgTemplateOutlet(_viewContainerRef) { | |
this._viewContainerRef = _viewContainerRef; | |
} | |
Object.defineProperty(NgTemplateOutlet.prototype, "ngOutletContext", { | |
/** | |
* @deprecated v4.0.0 - Renamed to ngTemplateOutletContext. | |
* @param {?} context | |
* @return {?} | |
*/ | |
set: function (context) { this.ngTemplateOutletContext = context; }, | |
enumerable: true, | |
configurable: true | |
}); | |
/** | |
* @param {?} changes | |
* @return {?} | |
*/ | |
NgTemplateOutlet.prototype.ngOnChanges = function (changes) { | |
if (this._viewRef) { | |
this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef)); | |
} | |
if (this.ngTemplateOutlet) { | |
this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext); | |
} | |
}; | |
return NgTemplateOutlet; | |
}()); | |
NgTemplateOutlet.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Directive"], args: [{ selector: '[ngTemplateOutlet]' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
NgTemplateOutlet.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ViewContainerRef"], }, | |
]; }; | |
NgTemplateOutlet.propDecorators = { | |
'ngTemplateOutletContext': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngTemplateOutlet': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
'ngOutletContext': [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Input"] },], | |
}; | |
/** | |
* @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 | |
*/ | |
/** | |
* A collection of Angular directives that are likely to be used in each and every Angular | |
* application. | |
*/ | |
var COMMON_DIRECTIVES = [ | |
NgClass, | |
NgComponentOutlet, | |
NgForOf, | |
NgIf, | |
NgTemplateOutlet, | |
NgStyle, | |
NgSwitch, | |
NgSwitchCase, | |
NgSwitchDefault, | |
NgPlural, | |
NgPluralCase, | |
]; | |
/** | |
* A collection of deprecated directives that are no longer part of the core module. | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @param {?} type | |
* @param {?} value | |
* @return {?} | |
*/ | |
function invalidPipeArgumentError(type, value) { | |
return Error("InvalidPipeArgument: '" + value + "' for pipe '" + __webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵstringify"])(type) + "'"); | |
} | |
/** | |
* @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 ObservableStrategy = (function () { | |
function ObservableStrategy() { | |
} | |
/** | |
* @param {?} async | |
* @param {?} updateLatestValue | |
* @return {?} | |
*/ | |
ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) { | |
return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } }); | |
}; | |
/** | |
* @param {?} subscription | |
* @return {?} | |
*/ | |
ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); }; | |
/** | |
* @param {?} subscription | |
* @return {?} | |
*/ | |
ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); }; | |
return ObservableStrategy; | |
}()); | |
var PromiseStrategy = (function () { | |
function PromiseStrategy() { | |
} | |
/** | |
* @param {?} async | |
* @param {?} updateLatestValue | |
* @return {?} | |
*/ | |
PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) { | |
return async.then(updateLatestValue, function (e) { throw e; }); | |
}; | |
/** | |
* @param {?} subscription | |
* @return {?} | |
*/ | |
PromiseStrategy.prototype.dispose = function (subscription) { }; | |
/** | |
* @param {?} subscription | |
* @return {?} | |
*/ | |
PromiseStrategy.prototype.onDestroy = function (subscription) { }; | |
return PromiseStrategy; | |
}()); | |
var _promiseStrategy = new PromiseStrategy(); | |
var _observableStrategy = new ObservableStrategy(); | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Unwraps a value from an asynchronous primitive. | |
* \@howToUse `observable_or_promise_expression | async` | |
* \@description | |
* The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has | |
* emitted. When a new value is emitted, the `async` pipe marks the component to be checked for | |
* changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid | |
* potential memory leaks. | |
* | |
* | |
* ## Examples | |
* | |
* This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the | |
* promise. | |
* | |
* {\@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'} | |
* | |
* It's also possible to use `async` with Observables. The example below binds the `time` Observable | |
* to the view. The Observable continuously updates the view with the current time. | |
* | |
* {\@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'} | |
* | |
* \@stable | |
*/ | |
var AsyncPipe = (function () { | |
/** | |
* @param {?} _ref | |
*/ | |
function AsyncPipe(_ref) { | |
this._ref = _ref; | |
this._latestValue = null; | |
this._latestReturnedValue = null; | |
this._subscription = null; | |
this._obj = null; | |
this._strategy = null; | |
} | |
/** | |
* @return {?} | |
*/ | |
AsyncPipe.prototype.ngOnDestroy = function () { | |
if (this._subscription) { | |
this._dispose(); | |
} | |
}; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
AsyncPipe.prototype.transform = function (obj) { | |
if (!this._obj) { | |
if (obj) { | |
this._subscribe(obj); | |
} | |
this._latestReturnedValue = this._latestValue; | |
return this._latestValue; | |
} | |
if (obj !== this._obj) { | |
this._dispose(); | |
return this.transform(/** @type {?} */ (obj)); | |
} | |
if (this._latestValue === this._latestReturnedValue) { | |
return this._latestReturnedValue; | |
} | |
this._latestReturnedValue = this._latestValue; | |
return __WEBPACK_IMPORTED_MODULE_0__angular_core__["WrappedValue"].wrap(this._latestValue); | |
}; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
AsyncPipe.prototype._subscribe = function (obj) { | |
var _this = this; | |
this._obj = obj; | |
this._strategy = this._selectStrategy(obj); | |
this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); }); | |
}; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
AsyncPipe.prototype._selectStrategy = function (obj) { | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisPromise"])(obj)) { | |
return _promiseStrategy; | |
} | |
if (__webpack_require__.i(__WEBPACK_IMPORTED_MODULE_0__angular_core__["ɵisObservable"])(obj)) { | |
return _observableStrategy; | |
} | |
throw invalidPipeArgumentError(AsyncPipe, obj); | |
}; | |
/** | |
* @return {?} | |
*/ | |
AsyncPipe.prototype._dispose = function () { | |
this._strategy.dispose(this._subscription); | |
this._latestValue = null; | |
this._latestReturnedValue = null; | |
this._subscription = null; | |
this._obj = null; | |
}; | |
/** | |
* @param {?} async | |
* @param {?} value | |
* @return {?} | |
*/ | |
AsyncPipe.prototype._updateLatestValue = function (async, value) { | |
if (async === this._obj) { | |
this._latestValue = value; | |
this._ref.markForCheck(); | |
} | |
}; | |
return AsyncPipe; | |
}()); | |
AsyncPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'async', pure: false },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
AsyncPipe.ctorParameters = function () { return [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["ChangeDetectorRef"], }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* Transforms text to lowercase. | |
* | |
* {\@example common/pipes/ts/lowerupper_pipe.ts region='LowerUpperPipe' } | |
* | |
* \@stable | |
*/ | |
var LowerCasePipe = (function () { | |
function LowerCasePipe() { | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
LowerCasePipe.prototype.transform = function (value) { | |
if (!value) | |
return value; | |
if (typeof value !== 'string') { | |
throw invalidPipeArgumentError(LowerCasePipe, value); | |
} | |
return value.toLowerCase(); | |
}; | |
return LowerCasePipe; | |
}()); | |
LowerCasePipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'lowercase' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
LowerCasePipe.ctorParameters = function () { return []; }; | |
/** | |
* Helper method to transform a single word to titlecase. | |
* | |
* \@stable | |
* @param {?} word | |
* @return {?} | |
*/ | |
function titleCaseWord(word) { | |
if (!word) | |
return word; | |
return word[0].toUpperCase() + word.substr(1).toLowerCase(); | |
} | |
/** | |
* Transforms text to titlecase. | |
* | |
* \@stable | |
*/ | |
var TitleCasePipe = (function () { | |
function TitleCasePipe() { | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
TitleCasePipe.prototype.transform = function (value) { | |
if (!value) | |
return value; | |
if (typeof value !== 'string') { | |
throw invalidPipeArgumentError(TitleCasePipe, value); | |
} | |
return value.split(/\b/g).map(function (word) { return titleCaseWord(word); }).join(''); | |
}; | |
return TitleCasePipe; | |
}()); | |
TitleCasePipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'titlecase' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
TitleCasePipe.ctorParameters = function () { return []; }; | |
/** | |
* Transforms text to uppercase. | |
* | |
* \@stable | |
*/ | |
var UpperCasePipe = (function () { | |
function UpperCasePipe() { | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
UpperCasePipe.prototype.transform = function (value) { | |
if (!value) | |
return value; | |
if (typeof value !== 'string') { | |
throw invalidPipeArgumentError(UpperCasePipe, value); | |
} | |
return value.toUpperCase(); | |
}; | |
return UpperCasePipe; | |
}()); | |
UpperCasePipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'uppercase' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
UpperCasePipe.ctorParameters = function () { return []; }; | |
var NumberFormatStyle = {}; | |
NumberFormatStyle.Decimal = 0; | |
NumberFormatStyle.Percent = 1; | |
NumberFormatStyle.Currency = 2; | |
NumberFormatStyle[NumberFormatStyle.Decimal] = "Decimal"; | |
NumberFormatStyle[NumberFormatStyle.Percent] = "Percent"; | |
NumberFormatStyle[NumberFormatStyle.Currency] = "Currency"; | |
var NumberFormatter = (function () { | |
function NumberFormatter() { | |
} | |
/** | |
* @param {?} num | |
* @param {?} locale | |
* @param {?} style | |
* @param {?=} __3 | |
* @return {?} | |
*/ | |
NumberFormatter.format = function (num, locale, style, _a) { | |
var _b = _a === void 0 ? {} : _a, minimumIntegerDigits = _b.minimumIntegerDigits, minimumFractionDigits = _b.minimumFractionDigits, maximumFractionDigits = _b.maximumFractionDigits, currency = _b.currency, _c = _b.currencyAsSymbol, currencyAsSymbol = _c === void 0 ? false : _c; | |
var /** @type {?} */ options = { | |
minimumIntegerDigits: minimumIntegerDigits, | |
minimumFractionDigits: minimumFractionDigits, | |
maximumFractionDigits: maximumFractionDigits, | |
style: NumberFormatStyle[style].toLowerCase() | |
}; | |
if (style == NumberFormatStyle.Currency) { | |
options.currency = currency; | |
options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code'; | |
} | |
return new Intl.NumberFormat(locale, options).format(num); | |
}; | |
return NumberFormatter; | |
}()); | |
var DATE_FORMATS_SPLIT = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/; | |
var PATTERN_ALIASES = { | |
// Keys are quoted so they do not get renamed during closure compilation. | |
'yMMMdjms': datePartGetterFactory(combine([ | |
digitCondition('year', 1), | |
nameCondition('month', 3), | |
digitCondition('day', 1), | |
digitCondition('hour', 1), | |
digitCondition('minute', 1), | |
digitCondition('second', 1), | |
])), | |
'yMdjm': datePartGetterFactory(combine([ | |
digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1), | |
digitCondition('hour', 1), digitCondition('minute', 1) | |
])), | |
'yMMMMEEEEd': datePartGetterFactory(combine([ | |
digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4), | |
digitCondition('day', 1) | |
])), | |
'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])), | |
'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])), | |
'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])), | |
'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])), | |
'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)])) | |
}; | |
var DATE_FORMATS = { | |
// Keys are quoted so they do not get renamed. | |
'yyyy': datePartGetterFactory(digitCondition('year', 4)), | |
'yy': datePartGetterFactory(digitCondition('year', 2)), | |
'y': datePartGetterFactory(digitCondition('year', 1)), | |
'MMMM': datePartGetterFactory(nameCondition('month', 4)), | |
'MMM': datePartGetterFactory(nameCondition('month', 3)), | |
'MM': datePartGetterFactory(digitCondition('month', 2)), | |
'M': datePartGetterFactory(digitCondition('month', 1)), | |
'LLLL': datePartGetterFactory(nameCondition('month', 4)), | |
'L': datePartGetterFactory(nameCondition('month', 1)), | |
'dd': datePartGetterFactory(digitCondition('day', 2)), | |
'd': datePartGetterFactory(digitCondition('day', 1)), | |
'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))), | |
'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))), | |
'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))), | |
'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), | |
'jj': datePartGetterFactory(digitCondition('hour', 2)), | |
'j': datePartGetterFactory(digitCondition('hour', 1)), | |
'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))), | |
'm': datePartGetterFactory(digitCondition('minute', 1)), | |
'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))), | |
's': datePartGetterFactory(digitCondition('second', 1)), | |
// while ISO 8601 requires fractions to be prefixed with `.` or `,` | |
// we can be just safely rely on using `sss` since we currently don't support single or two digit | |
// fractions | |
'sss': datePartGetterFactory(digitCondition('second', 3)), | |
'EEEE': datePartGetterFactory(nameCondition('weekday', 4)), | |
'EEE': datePartGetterFactory(nameCondition('weekday', 3)), | |
'EE': datePartGetterFactory(nameCondition('weekday', 2)), | |
'E': datePartGetterFactory(nameCondition('weekday', 1)), | |
'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))), | |
'Z': timeZoneGetter('short'), | |
'z': timeZoneGetter('long'), | |
'ww': datePartGetterFactory({}), | |
// first Thursday of the year. not support ? | |
'w': datePartGetterFactory({}), | |
// of the year not support ? | |
'G': datePartGetterFactory(nameCondition('era', 1)), | |
'GG': datePartGetterFactory(nameCondition('era', 2)), | |
'GGG': datePartGetterFactory(nameCondition('era', 3)), | |
'GGGG': datePartGetterFactory(nameCondition('era', 4)) | |
}; | |
/** | |
* @param {?} inner | |
* @return {?} | |
*/ | |
function digitModifier(inner) { | |
return function (date, locale) { | |
var /** @type {?} */ result = inner(date, locale); | |
return result.length == 1 ? '0' + result : result; | |
}; | |
} | |
/** | |
* @param {?} inner | |
* @return {?} | |
*/ | |
function hourClockExtractor(inner) { | |
return function (date, locale) { return inner(date, locale).split(' ')[1]; }; | |
} | |
/** | |
* @param {?} inner | |
* @return {?} | |
*/ | |
function hourExtractor(inner) { | |
return function (date, locale) { return inner(date, locale).split(' ')[0]; }; | |
} | |
/** | |
* @param {?} date | |
* @param {?} locale | |
* @param {?} options | |
* @return {?} | |
*/ | |
function intlDateFormat(date, locale, options) { | |
return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, ''); | |
} | |
/** | |
* @param {?} timezone | |
* @return {?} | |
*/ | |
function timeZoneGetter(timezone) { | |
// To workaround `Intl` API restriction for single timezone let format with 24 hours | |
var /** @type {?} */ options = { hour: '2-digit', hour12: false, timeZoneName: timezone }; | |
return function (date, locale) { | |
var /** @type {?} */ result = intlDateFormat(date, locale, options); | |
// Then extract first 3 letters that related to hours | |
return result ? result.substring(3) : ''; | |
}; | |
} | |
/** | |
* @param {?} options | |
* @param {?} value | |
* @return {?} | |
*/ | |
function hour12Modify(options, value) { | |
options.hour12 = value; | |
return options; | |
} | |
/** | |
* @param {?} prop | |
* @param {?} len | |
* @return {?} | |
*/ | |
function digitCondition(prop, len) { | |
var /** @type {?} */ result = {}; | |
result[prop] = len === 2 ? '2-digit' : 'numeric'; | |
return result; | |
} | |
/** | |
* @param {?} prop | |
* @param {?} len | |
* @return {?} | |
*/ | |
function nameCondition(prop, len) { | |
var /** @type {?} */ result = {}; | |
if (len < 4) { | |
result[prop] = len > 1 ? 'short' : 'narrow'; | |
} | |
else { | |
result[prop] = 'long'; | |
} | |
return result; | |
} | |
/** | |
* @param {?} options | |
* @return {?} | |
*/ | |
function combine(options) { | |
return ((Object)).assign.apply(((Object)), [{}].concat(options)); | |
} | |
/** | |
* @param {?} ret | |
* @return {?} | |
*/ | |
function datePartGetterFactory(ret) { | |
return function (date, locale) { return intlDateFormat(date, locale, ret); }; | |
} | |
var DATE_FORMATTER_CACHE = new Map(); | |
/** | |
* @param {?} format | |
* @param {?} date | |
* @param {?} locale | |
* @return {?} | |
*/ | |
function dateFormatter(format, date, locale) { | |
var /** @type {?} */ fn = PATTERN_ALIASES[format]; | |
if (fn) | |
return fn(date, locale); | |
var /** @type {?} */ cacheKey = format; | |
var /** @type {?} */ parts = DATE_FORMATTER_CACHE.get(cacheKey); | |
if (!parts) { | |
parts = []; | |
var /** @type {?} */ match = void 0; | |
DATE_FORMATS_SPLIT.exec(format); | |
while (format) { | |
match = DATE_FORMATS_SPLIT.exec(format); | |
if (match) { | |
parts = parts.concat(match.slice(1)); | |
format = parts.pop(); | |
} | |
else { | |
parts.push(format); | |
format = null; | |
} | |
} | |
DATE_FORMATTER_CACHE.set(cacheKey, parts); | |
} | |
return parts.reduce(function (text, part) { | |
var /** @type {?} */ fn = DATE_FORMATS[part]; | |
return text + (fn ? fn(date, locale) : partToTime(part)); | |
}, ''); | |
} | |
/** | |
* @param {?} part | |
* @return {?} | |
*/ | |
function partToTime(part) { | |
return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\''); | |
} | |
var DateFormatter = (function () { | |
function DateFormatter() { | |
} | |
/** | |
* @param {?} date | |
* @param {?} locale | |
* @param {?} pattern | |
* @return {?} | |
*/ | |
DateFormatter.format = function (date, locale, pattern) { | |
return dateFormatter(pattern, date, locale); | |
}; | |
return DateFormatter; | |
}()); | |
/** | |
* @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 _NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/; | |
/** | |
* @param {?} pipe | |
* @param {?} locale | |
* @param {?} value | |
* @param {?} style | |
* @param {?} digits | |
* @param {?=} currency | |
* @param {?=} currencyAsSymbol | |
* @return {?} | |
*/ | |
function formatNumber(pipe, locale, value, style, digits, currency, currencyAsSymbol) { | |
if (currency === void 0) { currency = null; } | |
if (currencyAsSymbol === void 0) { currencyAsSymbol = false; } | |
if (value == null) | |
return null; | |
// Convert strings to numbers | |
value = typeof value === 'string' && isNumeric(value) ? +value : value; | |
if (typeof value !== 'number') { | |
throw invalidPipeArgumentError(pipe, value); | |
} | |
var /** @type {?} */ minInt; | |
var /** @type {?} */ minFraction; | |
var /** @type {?} */ maxFraction; | |
if (style !== NumberFormatStyle.Currency) { | |
// rely on Intl default for currency | |
minInt = 1; | |
minFraction = 0; | |
maxFraction = 3; | |
} | |
if (digits) { | |
var /** @type {?} */ parts = digits.match(_NUMBER_FORMAT_REGEXP); | |
if (parts === null) { | |
throw new Error(digits + " is not a valid digit info for number pipes"); | |
} | |
if (parts[1] != null) { | |
minInt = parseIntAutoRadix(parts[1]); | |
} | |
if (parts[3] != null) { | |
minFraction = parseIntAutoRadix(parts[3]); | |
} | |
if (parts[5] != null) { | |
maxFraction = parseIntAutoRadix(parts[5]); | |
} | |
} | |
return NumberFormatter.format(/** @type {?} */ (value), locale, style, { | |
minimumIntegerDigits: minInt, | |
minimumFractionDigits: minFraction, | |
maximumFractionDigits: maxFraction, | |
currency: currency, | |
currencyAsSymbol: currencyAsSymbol, | |
}); | |
} | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Formats a number according to locale rules. | |
* \@howToUse `number_expression | number[:digitInfo]` | |
* | |
* Formats a number as text. Group sizing and separator and other locale-specific | |
* configurations are based on the active locale. | |
* | |
* where `expression` is a number: | |
* - `digitInfo` is a `string` which has a following format: <br> | |
* <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code> | |
* - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`. | |
* - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`. | |
* - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`. | |
* | |
* For more information on the acceptable range for each of these numbers and other | |
* details see your native internationalization library. | |
* | |
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers | |
* and may require a polyfill. See {\@linkDocs guide/browser-support} for details. | |
* | |
* ### Example | |
* | |
* {\@example common/pipes/ts/number_pipe.ts region='NumberPipe'} | |
* | |
* \@stable | |
*/ | |
var DecimalPipe = (function () { | |
/** | |
* @param {?} _locale | |
*/ | |
function DecimalPipe(_locale) { | |
this._locale = _locale; | |
} | |
/** | |
* @param {?} value | |
* @param {?=} digits | |
* @return {?} | |
*/ | |
DecimalPipe.prototype.transform = function (value, digits) { | |
if (digits === void 0) { digits = null; } | |
return formatNumber(DecimalPipe, this._locale, value, NumberFormatStyle.Decimal, digits); | |
}; | |
return DecimalPipe; | |
}()); | |
DecimalPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'number' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DecimalPipe.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, | |
]; }; | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Formats a number as a percentage according to locale rules. | |
* \@howToUse `number_expression | percent[:digitInfo]` | |
* | |
* \@description | |
* | |
* Formats a number as percentage. | |
* | |
* - `digitInfo` See {\@link DecimalPipe} for detailed description. | |
* | |
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers | |
* and may require a polyfill. See {\@linkDocs guide/browser-support} for details. | |
* | |
* ### Example | |
* | |
* {\@example common/pipes/ts/number_pipe.ts region='PercentPipe'} | |
* | |
* \@stable | |
*/ | |
var PercentPipe = (function () { | |
/** | |
* @param {?} _locale | |
*/ | |
function PercentPipe(_locale) { | |
this._locale = _locale; | |
} | |
/** | |
* @param {?} value | |
* @param {?=} digits | |
* @return {?} | |
*/ | |
PercentPipe.prototype.transform = function (value, digits) { | |
if (digits === void 0) { digits = null; } | |
return formatNumber(PercentPipe, this._locale, value, NumberFormatStyle.Percent, digits); | |
}; | |
return PercentPipe; | |
}()); | |
PercentPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'percent' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
PercentPipe.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, | |
]; }; | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Formats a number as currency using locale rules. | |
* \@howToUse `number_expression | currency[:currencyCode[:symbolDisplay[:digitInfo]]]` | |
* \@description | |
* | |
* Use `currency` to format a number as currency. | |
* | |
* - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such | |
* as `USD` for the US dollar and `EUR` for the euro. | |
* - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code. | |
* - `true`: use symbol (e.g. `$`). | |
* - `false`(default): use code (e.g. `USD`). | |
* - `digitInfo` See {\@link DecimalPipe} for detailed description. | |
* | |
* WARNING: this pipe uses the Internationalization API which is not yet available in all browsers | |
* and may require a polyfill. See {\@linkDocs guide/browser-support} for details. | |
* | |
* ### Example | |
* | |
* {\@example common/pipes/ts/number_pipe.ts region='CurrencyPipe'} | |
* | |
* \@stable | |
*/ | |
var CurrencyPipe = (function () { | |
/** | |
* @param {?} _locale | |
*/ | |
function CurrencyPipe(_locale) { | |
this._locale = _locale; | |
} | |
/** | |
* @param {?} value | |
* @param {?=} currencyCode | |
* @param {?=} symbolDisplay | |
* @param {?=} digits | |
* @return {?} | |
*/ | |
CurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) { | |
if (currencyCode === void 0) { currencyCode = 'USD'; } | |
if (symbolDisplay === void 0) { symbolDisplay = false; } | |
if (digits === void 0) { digits = null; } | |
return formatNumber(CurrencyPipe, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay); | |
}; | |
return CurrencyPipe; | |
}()); | |
CurrencyPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'currency' },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
CurrencyPipe.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, | |
]; }; | |
/** | |
* @param {?} text | |
* @return {?} | |
*/ | |
function parseIntAutoRadix(text) { | |
var /** @type {?} */ result = parseInt(text); | |
if (isNaN(result)) { | |
throw new Error('Invalid integer literal when parsing ' + text); | |
} | |
return result; | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
function isNumeric(value) { | |
return !isNaN(value - parseFloat(value)); | |
} | |
/** | |
* @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 ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/; | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Formats a date according to locale rules. | |
* \@howToUse `date_expression | date[:format]` | |
* \@description | |
* | |
* Where: | |
* - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string | |
* (https://www.w3.org/TR/NOTE-datetime). | |
* - `format` indicates which date/time components to include. The format can be predefined as | |
* shown below or custom as shown in the table. | |
* - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`) | |
* - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`) | |
* - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`) | |
* - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`) | |
* - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`) | |
* - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`) | |
* - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`) | |
* - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`) | |
* | |
* | |
* | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit | | |
* |-----------|:------:|--------|--------------|-------------------|-----------|-----------| | |
* | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - | | |
* | year | y | - | - | - | y (2015) | yy (15) | | |
* | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) | | |
* | day | d | - | - | - | d (3) | dd (03) | | |
* | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - | | |
* | hour | j | - | - | - | j (13) | jj (13) | | |
* | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)| | |
* | hour24 | H | - | - | - | H (13) | HH (13) | | |
* | minute | m | - | - | - | m (5) | mm (05) | | |
* | second | s | - | - | - | s (9) | ss (09) | | |
* | timezone | z | - | - | z (Pacific Standard Time)| - | - | | |
* | timezone | Z | - | Z (GMT-8:00) | - | - | - | | |
* | timezone | a | - | a (PM) | - | - | - | | |
* | |
* In javascript, only the components specified will be respected (not the ordering, | |
* punctuations, ...) and details of the formatting will be dependent on the locale. | |
* | |
* Timezone of the formatted text will be the local system timezone of the end-user's machine. | |
* | |
* When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not | |
* applied and the formatted text will have the same day, month and year of the expression. | |
* | |
* WARNINGS: | |
* - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated. | |
* Instead users should treat the date as an immutable object and change the reference when the | |
* pipe needs to re-run (this is to avoid reformatting the date on every change detection run | |
* which would be an expensive operation). | |
* - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera | |
* browsers. | |
* | |
* ### Examples | |
* | |
* Assuming `dateObj` is (year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11) | |
* in the _local_ time and locale is 'en-US': | |
* | |
* ``` | |
* {{ dateObj | date }} // output is 'Jun 15, 2015' | |
* {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM' | |
* {{ dateObj | date:'shortTime' }} // output is '9:43 PM' | |
* {{ dateObj | date:'mmss' }} // output is '43:11' | |
* ``` | |
* | |
* {\@example common/pipes/ts/date_pipe.ts region='DatePipe'} | |
* | |
* \@stable | |
*/ | |
var DatePipe = (function () { | |
/** | |
* @param {?} _locale | |
*/ | |
function DatePipe(_locale) { | |
this._locale = _locale; | |
} | |
/** | |
* @param {?} value | |
* @param {?=} pattern | |
* @return {?} | |
*/ | |
DatePipe.prototype.transform = function (value, pattern) { | |
if (pattern === void 0) { pattern = 'mediumDate'; } | |
var /** @type {?} */ date; | |
if (isBlank(value) || value !== value) | |
return null; | |
if (typeof value === 'string') { | |
value = value.trim(); | |
} | |
if (isDate(value)) { | |
date = value; | |
} | |
else if (isNumeric(value)) { | |
date = new Date(parseFloat(value)); | |
} | |
else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) { | |
/** | |
* For ISO Strings without time the day, month and year must be extracted from the ISO String | |
* before Date creation to avoid time offset and errors in the new Date. | |
* If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new | |
* date, some browsers (e.g. IE 9) will throw an invalid Date error | |
* If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset | |
* is applied | |
* Note: ISO months are 0 for January, 1 for February, ... | |
*/ | |
var _a = value.split('-').map(function (val) { return parseInt(val, 10); }), y = _a[0], m = _a[1], d = _a[2]; | |
date = new Date(y, m - 1, d); | |
} | |
else { | |
date = new Date(value); | |
} | |
if (!isDate(date)) { | |
var /** @type {?} */ match = void 0; | |
if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) { | |
date = isoStringToDate(match); | |
} | |
else { | |
throw invalidPipeArgumentError(DatePipe, value); | |
} | |
} | |
return DateFormatter.format(date, this._locale, DatePipe._ALIASES[pattern] || pattern); | |
}; | |
return DatePipe; | |
}()); | |
/** | |
* \@internal | |
*/ | |
DatePipe._ALIASES = { | |
'medium': 'yMMMdjms', | |
'short': 'yMdjm', | |
'fullDate': 'yMMMMEEEEd', | |
'longDate': 'yMMMMd', | |
'mediumDate': 'yMMMd', | |
'shortDate': 'yMd', | |
'mediumTime': 'jms', | |
'shortTime': 'jm' | |
}; | |
DatePipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'date', pure: true },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
DatePipe.ctorParameters = function () { return [ | |
{ type: undefined, decorators: [{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Inject"], args: [__WEBPACK_IMPORTED_MODULE_0__angular_core__["LOCALE_ID"],] },] }, | |
]; }; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
function isBlank(obj) { | |
return obj == null || obj === ''; | |
} | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
function isDate(obj) { | |
return obj instanceof Date && !isNaN(obj.valueOf()); | |
} | |
/** | |
* @param {?} match | |
* @return {?} | |
*/ | |
function isoStringToDate(match) { | |
var /** @type {?} */ date = new Date(0); | |
var /** @type {?} */ tzHour = 0; | |
var /** @type {?} */ tzMin = 0; | |
var /** @type {?} */ dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear; | |
var /** @type {?} */ timeSetter = match[8] ? date.setUTCHours : date.setHours; | |
if (match[9]) { | |
tzHour = toInt(match[9] + match[10]); | |
tzMin = toInt(match[9] + match[11]); | |
} | |
dateSetter.call(date, toInt(match[1]), toInt(match[2]) - 1, toInt(match[3])); | |
var /** @type {?} */ h = toInt(match[4] || '0') - tzHour; | |
var /** @type {?} */ m = toInt(match[5] || '0') - tzMin; | |
var /** @type {?} */ s = toInt(match[6] || '0'); | |
var /** @type {?} */ ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000); | |
timeSetter.call(date, h, m, s, ms); | |
return date; | |
} | |
/** | |
* @param {?} str | |
* @return {?} | |
*/ | |
function toInt(str) { | |
return parseInt(str, 10); | |
} | |
/** | |
* @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 _INTERPOLATION_REGEXP = /#/g; | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Maps a value to a string that pluralizes the value according to locale rules. | |
* \@howToUse `expression | i18nPlural:mapping` | |
* \@description | |
* | |
* Where: | |
* - `expression` is a number. | |
* - `mapping` is an object that mimics the ICU format, see | |
* http://userguide.icu-project.org/formatparse/messages | |
* | |
* ## Example | |
* | |
* {\@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'} | |
* | |
* \@experimental | |
*/ | |
var I18nPluralPipe = (function () { | |
/** | |
* @param {?} _localization | |
*/ | |
function I18nPluralPipe(_localization) { | |
this._localization = _localization; | |
} | |
/** | |
* @param {?} value | |
* @param {?} pluralMap | |
* @return {?} | |
*/ | |
I18nPluralPipe.prototype.transform = function (value, pluralMap) { | |
if (value == null) | |
return ''; | |
if (typeof pluralMap !== 'object' || pluralMap === null) { | |
throw invalidPipeArgumentError(I18nPluralPipe, pluralMap); | |
} | |
var /** @type {?} */ key = getPluralCategory(value, Object.keys(pluralMap), this._localization); | |
return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString()); | |
}; | |
return I18nPluralPipe; | |
}()); | |
I18nPluralPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nPlural', pure: true },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
I18nPluralPipe.ctorParameters = function () { return [ | |
{ type: NgLocalization, }, | |
]; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Generic selector that displays the string that matches the current value. | |
* \@howToUse `expression | i18nSelect:mapping` | |
* \@description | |
* | |
* Where `mapping` is an object that indicates the text that should be displayed | |
* for different values of the provided `expression`. | |
* If none of the keys of the mapping match the value of the `expression`, then the content | |
* of the `other` key is returned when present, otherwise an empty string is returned. | |
* | |
* ## Example | |
* | |
* {\@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'} | |
* | |
* \@experimental | |
*/ | |
var I18nSelectPipe = (function () { | |
function I18nSelectPipe() { | |
} | |
/** | |
* @param {?} value | |
* @param {?} mapping | |
* @return {?} | |
*/ | |
I18nSelectPipe.prototype.transform = function (value, mapping) { | |
if (value == null) | |
return ''; | |
if (typeof mapping !== 'object' || typeof value !== 'string') { | |
throw invalidPipeArgumentError(I18nSelectPipe, mapping); | |
} | |
if (mapping.hasOwnProperty(value)) { | |
return mapping[value]; | |
} | |
if (mapping.hasOwnProperty('other')) { | |
return mapping['other']; | |
} | |
return ''; | |
}; | |
return I18nSelectPipe; | |
}()); | |
I18nSelectPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'i18nSelect', pure: true },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
I18nSelectPipe.ctorParameters = function () { return []; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Converts value into JSON string. | |
* \@howToUse `expression | json` | |
* \@description | |
* | |
* Converts value into string using `JSON.stringify`. Useful for debugging. | |
* | |
* ### Example | |
* {\@example common/pipes/ts/json_pipe.ts region='JsonPipe'} | |
* | |
* \@stable | |
*/ | |
var JsonPipe = (function () { | |
function JsonPipe() { | |
} | |
/** | |
* @param {?} value | |
* @return {?} | |
*/ | |
JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); }; | |
return JsonPipe; | |
}()); | |
JsonPipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'json', pure: false },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
JsonPipe.ctorParameters = function () { return []; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* \@ngModule CommonModule | |
* \@whatItDoes Creates a new List or String containing a subset (slice) of the elements. | |
* \@howToUse `array_or_string_expression | slice:start[:end]` | |
* \@description | |
* | |
* Where the input expression is a `List` or `String`, and: | |
* - `start`: The starting index of the subset to return. | |
* - **a positive integer**: return the item at `start` index and all items after | |
* in the list or string expression. | |
* - **a negative integer**: return the item at `start` index from the end and all items after | |
* in the list or string expression. | |
* - **if positive and greater than the size of the expression**: return an empty list or string. | |
* - **if negative and greater than the size of the expression**: return entire list or string. | |
* - `end`: The ending index of the subset to return. | |
* - **omitted**: return all items until the end. | |
* - **if positive**: return all items before `end` index of the list or string. | |
* - **if negative**: return all items before `end` index from the end of the list or string. | |
* | |
* All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()` | |
* and `String.prototype.slice()`. | |
* | |
* When operating on a [List], the returned list is always a copy even when all | |
* the elements are being returned. | |
* | |
* When operating on a blank value, the pipe returns the blank value. | |
* | |
* ## List Example | |
* | |
* This `ngFor` example: | |
* | |
* {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'} | |
* | |
* produces the following: | |
* | |
* <li>b</li> | |
* <li>c</li> | |
* | |
* ## String Examples | |
* | |
* {\@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'} | |
* | |
* \@stable | |
*/ | |
var SlicePipe = (function () { | |
function SlicePipe() { | |
} | |
/** | |
* @param {?} value | |
* @param {?} start | |
* @param {?=} end | |
* @return {?} | |
*/ | |
SlicePipe.prototype.transform = function (value, start, end) { | |
if (value == null) | |
return value; | |
if (!this.supports(value)) { | |
throw invalidPipeArgumentError(SlicePipe, value); | |
} | |
return value.slice(start, end); | |
}; | |
/** | |
* @param {?} obj | |
* @return {?} | |
*/ | |
SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); }; | |
return SlicePipe; | |
}()); | |
SlicePipe.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["Pipe"], args: [{ name: 'slice', pure: false },] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
SlicePipe.ctorParameters = function () { return []; }; | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* This module provides a set of common Pipes. | |
*/ | |
/** | |
* A collection of Angular pipes that are likely to be used in each and every application. | |
*/ | |
var COMMON_PIPES = [ | |
AsyncPipe, | |
UpperCasePipe, | |
LowerCasePipe, | |
JsonPipe, | |
SlicePipe, | |
DecimalPipe, | |
PercentPipe, | |
TitleCasePipe, | |
CurrencyPipe, | |
DatePipe, | |
I18nPluralPipe, | |
I18nSelectPipe, | |
]; | |
/** | |
* @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 | |
*/ | |
/** | |
* The module that includes all the basic Angular directives like {\@link NgIf}, {\@link NgForOf}, ... | |
* | |
* \@stable | |
*/ | |
var CommonModule = (function () { | |
function CommonModule() { | |
} | |
return CommonModule; | |
}()); | |
CommonModule.decorators = [ | |
{ type: __WEBPACK_IMPORTED_MODULE_0__angular_core__["NgModule"], args: [{ | |
declarations: [COMMON_DIRECTIVES, COMMON_PIPES], | |
exports: [COMMON_DIRECTIVES, COMMON_PIPES], | |
providers: [ | |
{ provide: NgLocalization, useClass: NgLocaleLocalization }, | |
], | |
},] }, | |
]; | |
/** | |
* @nocollapse | |
*/ | |
CommonModule.ctorParameters = function () { return []; }; | |
/** | |
* @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 PLATFORM_BROWSER_ID = 'browser'; | |
var PLATFORM_SERVER_ID = 'server'; | |
var PLATFORM_WORKER_APP_ID = 'browserWorkerApp'; | |
var PLATFORM_WORKER_UI_ID = 'browserWorkerUi'; | |
/** | |
* Returns whether a platform id represents a browser platform. | |
* \@experimental | |
* @param {?} platformId | |
* @return {?} | |
*/ | |
function isPlatformBrowser(platformId) { | |
return platformId === PLATFORM_BROWSER_ID; | |
} | |
/** | |
* Returns whether a platform id represents a server platform. | |
* \@experimental | |
* @param {?} platformId | |
* @return {?} | |
*/ | |
function isPlatformServer(platformId) { | |
return platformId === PLATFORM_SERVER_ID; | |
} | |
/** | |
* Returns whether a platform id represents a web worker app platform. | |
* \@experimental | |
* @param {?} platformId | |
* @return {?} | |
*/ | |
function isPlatformWorkerApp(platformId) { | |
return platformId === PLATFORM_WORKER_APP_ID; | |
} | |
/** | |
* Returns whether a platform id represents a web worker UI platform. | |
* \@experimental | |
* @param {?} platformId | |
* @return {?} | |
*/ | |
function isPlatformWorkerUi(platformId) { | |
return platformId === PLATFORM_WORKER_UI_ID; | |
} | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the common package. | |
*/ | |
/** | |
* \@stable | |
*/ | |
var VERSION = new __WEBPACK_IMPORTED_MODULE_0__angular_core__["Version"]('4.0.1'); | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the common package. | |
*/ | |
/** | |
* @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 | |
*/ | |
/** | |
* @module | |
* @description | |
* Entry point for all public APIs of the common package. | |
*/ | |
// This file only reexports content of the `src` folder. Keep it that way. | |
/** | |
* Generated bundle index. Do not edit. | |
*/ | |
//# sourceMappingURL=common.es5.js.map | |
/***/ }), | |
/* 80 */ | |
/***/ (function(module, exports) { | |
module.exports = function(a, b){ | |
var fn = function(){}; | |
fn.prototype = b.prototype; | |
a.prototype = new fn; | |
a.prototype.constructor = a; | |
}; | |
/***/ }), | |
/* 81 */, | |
/* 82 */, | |
/* 83 */, | |
/* 84 */, | |
/* 85 */, | |
/* 86 */, | |
/* 87 */, | |
/* 88 */, | |
/* 89 */, | |
/* 90 */, | |
/* 91 */, | |
/* 92 */, | |
/* 93 */, | |
/* 94 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
Object.defineProperty(exports, "__esModule", { | |
value: true | |
}); | |
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | |
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; | |
var _createClass = function () { 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); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | |
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } | |
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } | |
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } | |
function _extendableBuiltin(cls) { | |
function ExtendableBuiltin() { | |
var instance = Reflect.construct(cls, Array.from(arguments)); | |
Object.setPrototypeOf(instance, Object.getPrototypeOf(this)); | |
return instance; | |
} | |
ExtendableBuiltin.prototype = Object.create(cls.prototype, { | |
constructor: { | |
value: cls, | |
enumerable: false, | |
writable: true, | |
configurable: true | |
} | |
}); | |
if (Object.setPrototypeOf) { | |
Object.setPrototypeOf(ExtendableBuiltin, cls); | |
} else { | |
ExtendableBuiltin.__proto__ = cls; | |
} | |
return ExtendableBuiltin; | |
} | |
var debug = __webpack_require__(30)('feathers-errors'); | |
// NOTE (EK): Babel doesn't properly support extending | |
// some classes in ES6. The Error class being one of them. | |
// Node v5.0+ does support this but until we want to drop support | |
// for older versions we need this hack. | |
// http://stackoverflow.com/questions/33870684/why-doesnt-instanceof-work-on-instances-of-error-subclasses-under-babel-node | |
// https://github.com/loganfsmyth/babel-plugin-transform-builtin-extend | |
var FeathersError = function (_extendableBuiltin2) { | |
_inherits(FeathersError, _extendableBuiltin2); | |
function FeathersError(msg, name, code, className, data) { | |
_classCallCheck(this, FeathersError); | |
msg = msg || 'Error'; | |
var errors = void 0; | |
var message = void 0; | |
var newData = void 0; | |
if (msg instanceof Error) { | |
message = msg.message || 'Error'; | |
// NOTE (EK): This is typically to handle validation errors | |
if (msg.errors) { | |
errors = msg.errors; | |
} | |
} else if ((typeof msg === 'undefined' ? 'undefined' : _typeof(msg)) === 'object') { | |
// Support plain old objects | |
message = msg.message || 'Error'; | |
data = msg; | |
} else { | |
// message is just a string | |
message = msg; | |
} | |
if (data) { | |
// NOTE(EK): To make sure that we are not messing | |
// with immutable data, just make a copy. | |
// https://github.com/feathersjs/feathers-errors/issues/19 | |
newData = _extends({}, data); | |
if (newData.errors) { | |
errors = newData.errors; | |
delete newData.errors; | |
} | |
} | |
// NOTE (EK): Babel doesn't support this so | |
// we have to pass in the class name manually. | |
// this.name = this.constructor.name; | |
var _this = _possibleConstructorReturn(this, (FeathersError.__proto__ || Object.getPrototypeOf(FeathersError)).call(this, message)); | |
_this.type = 'FeathersError'; | |
_this.name = name; | |
_this.message = message; | |
_this.code = code; | |
_this.className = className; | |
_this.data = newData; | |
_this.errors = errors || {}; | |
debug(_this.name + '(' + _this.code + '): ' + _this.message); | |
return _this; | |
} | |
// NOTE (EK): A little hack to get around `message` not | |
// being included in the default toJSON call. | |
_createClass(FeathersError, [{ | |
key: 'toJSON', | |
value: function toJSON() { | |
return { | |
name: this.name, | |
message: this.message, | |
code: this.code, | |
className: this.className, | |
data: this.data, | |
errors: this.errors | |
}; | |
} | |
}]); | |
return FeathersError; | |
}(_extendableBuiltin(Error)); | |
var BadRequest = function (_FeathersError) { | |
_inherits(BadRequest, _FeathersError); | |
function BadRequest(message, data) { | |
_classCallCheck(this, BadRequest); | |
return _possibleConstructorReturn(this, (BadRequest.__proto__ || Object.getPrototypeOf(BadRequest)).call(this, message, 'BadRequest', 400, 'bad-request', data)); | |
} | |
return BadRequest; | |
}(FeathersError); | |
var NotAuthenticated = function (_FeathersError2) { | |
_inherits(NotAuthenticated, _FeathersError2); | |
function NotAuthenticated(message, data) { | |
_classCallCheck(this, NotAuthenticated); | |
return _possibleConstructorReturn(this, (NotAuthenticated.__proto__ || Object.getPrototypeOf(NotAuthenticated)).call(this, message, 'NotAuthenticated', 401, 'not-authenticated', data)); | |
} | |
return NotAuthenticated; | |
}(FeathersError); | |
var PaymentError = function (_FeathersError3) { | |
_inherits(PaymentError, _FeathersError3); | |
function PaymentError(message, data) { | |
_classCallCheck(this, PaymentError); | |
return _possibleConstructorReturn(this, (PaymentError.__proto__ || Object.getPrototypeOf(PaymentError)).call(this, message, 'PaymentError', 402, 'payment-error', data)); | |
} | |
return PaymentError; | |
}(FeathersError); | |
var Forbidden = function (_FeathersError4) { | |
_inherits(Forbidden, _FeathersError4); | |
function Forbidden(message, data) { | |
_classCallCheck(this, Forbidden); | |
return _possibleConstructorReturn(this, (Forbidden.__proto__ || Object.getPrototypeOf(Forbidden)).call(this, message, 'Forbidden', 403, 'forbidden', data)); | |
} | |
return Forbidden; | |
}(FeathersError); | |
var NotFound = function (_FeathersError5) { | |
_inherits(NotFound, _FeathersError5); | |
function NotFound(message, data) { | |
_classCallCheck(this, NotFound); | |
return _possibleConstructorReturn(this, (NotFound.__proto__ || Object.getPrototypeOf(NotFound)).call(this, message, 'NotFound', 404, 'not-found', data)); | |
} | |
return NotFound; | |
}(FeathersError); | |
var MethodNotAllowed = function (_FeathersError6) { | |
_inherits(MethodNotAllowed, _FeathersError6); | |
function MethodNotAllowed(message, data) { | |
_classCallCheck(this, MethodNotAllowed); | |
return _possibleConstructorReturn(this, (MethodNotAllowed.__proto__ || Object.getPrototypeOf(MethodNotAllowed)).call(this, message, 'MethodNotAllowed', 405, 'method-not-allowed', data)); | |
} | |
return MethodNotAllowed; | |
}(FeathersError); | |
var NotAcceptable = function (_FeathersError7) { | |
_inherits(NotAcceptable, _FeathersError7); | |
function NotAcceptable(message, data) { | |
_classCallCheck(this, NotAcceptable); | |
return _possibleConstructorReturn(this, (NotAcceptable.__proto__ || Object.getPrototypeOf(NotAcceptable)).call(this, message, 'NotAcceptable', 406, 'not-acceptable', data)); | |
} | |
return NotAcceptable; | |
}(FeathersError); | |
var Timeout = function (_FeathersError8) { | |
_inherits(Timeout, _FeathersError8); | |
function Timeout(message, data) { | |
_classCallCheck(this, Timeout); | |
return _possibleConstructorReturn(this, (Timeout.__proto__ || Object.getPrototypeOf(Timeout)).call(this, message, 'Timeout', 408, 'timeout', data)); | |
} | |
return Timeout; | |
}(FeathersError); | |
var Conflict = function (_FeathersError9) { | |
_inherits(Conflict, _FeathersError9); | |
function Conflict(message, data) { | |
_classCallCheck(this, Conflict); | |
return _possibleConstructorReturn(this, (Conflict.__proto__ || Object.getPrototypeOf(Conflict)).call(this, message, 'Conflict', 409, 'conflict', data)); | |
} | |
return Conflict; | |
}(FeathersError); | |
var LengthRequired = function (_FeathersError10) { | |
_inherits(LengthRequired, _FeathersError10); | |
function LengthRequired(message, data) { | |
_classCallCheck(this, LengthRequired); | |
return _possibleConstructorReturn(this, (LengthRequired.__proto__ || Object.getPrototypeOf(LengthRequired)).call(this, message, 'LengthRequired', 411, 'length-required', data)); | |
} | |
return LengthRequired; | |
}(FeathersError); | |
var Unprocessable = function (_FeathersError11) { | |
_inherits(Unprocessable, _FeathersError11); | |
function Unprocessable(message, data) { | |
_classCallCheck(this, Unprocessable); | |
return _possibleConstructorReturn(this, (Unprocessable.__proto__ || Object.getPrototypeOf(Unprocessable)).call(this, message, 'Unprocessable', 422, 'unprocessable', data)); | |
} | |
return Unprocessable; | |
}(FeathersError); | |
var TooManyRequests = function (_FeathersError12) { | |
_inherits(TooManyRequests, _FeathersError12); | |
function TooManyRequests(message, data) { | |
_classCallCheck(this, TooManyRequests); | |
return _possibleConstructorReturn(this, (TooManyRequests.__proto__ || Object.getPrototypeOf(TooManyRequests)).call(this, message, 'TooManyRequests', 429, 'too-many-requests', data)); | |
} | |
return TooManyRequests; | |
}(FeathersError); | |
var GeneralError = function (_FeathersError13) { | |
_inherits(GeneralError, _FeathersError13); | |
function GeneralError(message, data) { | |
_classCallCheck(this, GeneralError); | |
return _possibleConstructorReturn(this, (GeneralError.__proto__ || Object.getPrototypeOf(GeneralError)).call(this, message, 'GeneralError', 500, 'general-error', data)); | |
} | |
return GeneralError; | |
}(FeathersError); | |
var NotImplemented = function (_FeathersError14) { | |
_inherits(NotImplemented, _FeathersError14); | |
function NotImplemented(message, data) { | |
_classCallCheck(this, NotImplemented); | |
return _possibleConstructorReturn(this, (NotImplemented.__proto__ || Object.getPrototypeOf(NotImplemented)).call(this, message, 'NotImplemented', 501, 'not-implemented', data)); | |
} | |
return NotImplemented; | |
}(FeathersError); | |
var BadGateway = function (_FeathersError15) { | |
_inherits(BadGateway, _FeathersError15); | |
function BadGateway(message, data) { | |
_classCallCheck(this, BadGateway); | |
return _possibleConstructorReturn(this, (BadGateway.__proto__ || Object.getPrototypeOf(BadGateway)).call(this, message, 'BadGateway', 502, 'bad-gateway', data)); | |
} | |
return BadGateway; | |
}(FeathersError); | |
var Unavailable = function (_FeathersError16) { | |
_inherits(Unavailable, _FeathersError16); | |
function Unavailable(message, data) { | |
_classCallCheck(this, Unavailable); | |
return _possibleConstructorReturn(this, (Unavailable.__proto__ || Object.getPrototypeOf(Unavailable)).call(this, message, 'Unavailable', 503, 'unavailable', data)); | |
} | |
return Unavailable; | |
}(FeathersError); | |
var errors = { | |
FeathersError: FeathersError, | |
BadRequest: BadRequest, | |
NotAuthenticated: NotAuthenticated, | |
PaymentError: PaymentError, | |
Forbidden: Forbidden, | |
NotFound: NotFound, | |
MethodNotAllowed: MethodNotAllowed, | |
NotAcceptable: NotAcceptable, | |
Timeout: Timeout, | |
Conflict: Conflict, | |
LengthRequired: LengthRequired, | |
Unprocessable: Unprocessable, | |
TooManyRequests: TooManyRequests, | |
GeneralError: GeneralError, | |
NotImplemented: NotImplemented, | |
BadGateway: BadGateway, | |
Unavailable: Unavailable, | |
400: BadRequest, | |
401: NotAuthenticated, | |
402: PaymentError, | |
403: Forbidden, | |
404: NotFound, | |
405: MethodNotAllowed, | |
406: NotAcceptable, | |
408: Timeout, | |
409: Conflict, | |
411: LengthRequired, | |
422: Unprocessable, | |
429: TooManyRequests, | |
500: GeneralError, | |
501: NotImplemented, | |
502: BadGateway, | |
503: Unavailable | |
}; | |
function convert(error) { | |
if (!error) { | |
return error; | |
} | |
var FeathersError = errors[error.name]; | |
var result = FeathersError ? new FeathersError(error.message, error.data) : new Error(error.message || error); | |
if ((typeof error === 'undefined' ? 'undefined' : _typeof(error)) === 'object') { | |
_extends(result, error); | |
} | |
return result; | |
} | |
exports.default = _extends({ | |
convert: convert, | |
types: errors, | |
errors: errors | |
}, errors); | |
module.exports = exports['default']; | |
/***/ }), | |
/* 95 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subject_1 = __webpack_require__(12); | |
var Subscription_1 = __webpack_require__(14); | |
/** | |
* @class AsyncSubject<T> | |
*/ | |
var AsyncSubject = (function (_super) { | |
__extends(AsyncSubject, _super); | |
function AsyncSubject() { | |
_super.apply(this, arguments); | |
this.value = null; | |
this.hasNext = false; | |
this.hasCompleted = false; | |
} | |
AsyncSubject.prototype._subscribe = function (subscriber) { | |
if (this.hasError) { | |
subscriber.error(this.thrownError); | |
return Subscription_1.Subscription.EMPTY; | |
} | |
else if (this.hasCompleted && this.hasNext) { | |
subscriber.next(this.value); | |
subscriber.complete(); | |
return Subscription_1.Subscription.EMPTY; | |
} | |
return _super.prototype._subscribe.call(this, subscriber); | |
}; | |
AsyncSubject.prototype.next = function (value) { | |
if (!this.hasCompleted) { | |
this.value = value; | |
this.hasNext = true; | |
} | |
}; | |
AsyncSubject.prototype.error = function (error) { | |
if (!this.hasCompleted) { | |
_super.prototype.error.call(this, error); | |
} | |
}; | |
AsyncSubject.prototype.complete = function () { | |
this.hasCompleted = true; | |
if (this.hasNext) { | |
_super.prototype.next.call(this, this.value); | |
} | |
_super.prototype.complete.call(this); | |
}; | |
return AsyncSubject; | |
}(Subject_1.Subject)); | |
exports.AsyncSubject = AsyncSubject; | |
//# sourceMappingURL=AsyncSubject.js.map | |
/***/ }), | |
/* 96 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subscriber_1 = __webpack_require__(2); | |
/* tslint:enable:max-line-length */ | |
/** | |
* Applies an accumulator function over the source Observable, and returns the | |
* accumulated result when the source completes, given an optional seed value. | |
* | |
* <span class="informal">Combines together all values emitted on the source, | |
* using an accumulator function that knows how to join a new source value into | |
* the accumulation from the past.</span> | |
* | |
* <img src="./img/reduce.png" width="100%"> | |
* | |
* Like | |
* [Array.prototype.reduce()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce), | |
* `reduce` applies an `accumulator` function against an accumulation and each | |
* value of the source Observable (from the past) to reduce it to a single | |
* value, emitted on the output Observable. Note that `reduce` will only emit | |
* one value, only when the source Observable completes. It is equivalent to | |
* applying operator {@link scan} followed by operator {@link last}. | |
* | |
* Returns an Observable that applies a specified `accumulator` function to each | |
* item emitted by the source Observable. If a `seed` value is specified, then | |
* that value will be used as the initial value for the accumulator. If no seed | |
* value is specified, the first item of the source is used as the seed. | |
* | |
* @example <caption>Count the number of click events that happened in 5 seconds</caption> | |
* var clicksInFiveSeconds = Rx.Observable.fromEvent(document, 'click') | |
* .takeUntil(Rx.Observable.interval(5000)); | |
* var ones = clicksInFiveSeconds.mapTo(1); | |
* var seed = 0; | |
* var count = ones.reduce((acc, one) => acc + one, seed); | |
* count.subscribe(x => console.log(x)); | |
* | |
* @see {@link count} | |
* @see {@link expand} | |
* @see {@link mergeScan} | |
* @see {@link scan} | |
* | |
* @param {function(acc: R, value: T, index: number): R} accumulator The accumulator function | |
* called on each source value. | |
* @param {R} [seed] The initial accumulation value. | |
* @return {Observable<R>} An Observable that emits a single value that is the | |
* result of accumulating the values emitted by the source Observable. | |
* @method reduce | |
* @owner Observable | |
*/ | |
function reduce(accumulator, seed) { | |
var hasSeed = false; | |
// providing a seed of `undefined` *should* be valid and trigger | |
// hasSeed! so don't use `seed !== undefined` checks! | |
// For this reason, we have to check it here at the original call site | |
// otherwise inside Operator/Subscriber we won't know if `undefined` | |
// means they didn't provide anything or if they literally provided `undefined` | |
if (arguments.length >= 2) { | |
hasSeed = true; | |
} | |
return this.lift(new ReduceOperator(accumulator, seed, hasSeed)); | |
} | |
exports.reduce = reduce; | |
var ReduceOperator = (function () { | |
function ReduceOperator(accumulator, seed, hasSeed) { | |
if (hasSeed === void 0) { hasSeed = false; } | |
this.accumulator = accumulator; | |
this.seed = seed; | |
this.hasSeed = hasSeed; | |
} | |
ReduceOperator.prototype.call = function (subscriber, source) { | |
return source.subscribe(new ReduceSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed)); | |
}; | |
return ReduceOperator; | |
}()); | |
exports.ReduceOperator = ReduceOperator; | |
/** | |
* We need this JSDoc comment for affecting ESDoc. | |
* @ignore | |
* @extends {Ignored} | |
*/ | |
var ReduceSubscriber = (function (_super) { | |
__extends(ReduceSubscriber, _super); | |
function ReduceSubscriber(destination, accumulator, seed, hasSeed) { | |
_super.call(this, destination); | |
this.accumulator = accumulator; | |
this.hasSeed = hasSeed; | |
this.index = 0; | |
this.hasValue = false; | |
this.acc = seed; | |
if (!this.hasSeed) { | |
this.index++; | |
} | |
} | |
ReduceSubscriber.prototype._next = function (value) { | |
if (this.hasValue || (this.hasValue = this.hasSeed)) { | |
this._tryReduce(value); | |
} | |
else { | |
this.acc = value; | |
this.hasValue = true; | |
} | |
}; | |
ReduceSubscriber.prototype._tryReduce = function (value) { | |
var result; | |
try { | |
result = this.accumulator(this.acc, value, this.index++); | |
} | |
catch (err) { | |
this.destination.error(err); | |
return; | |
} | |
this.acc = result; | |
}; | |
ReduceSubscriber.prototype._complete = function () { | |
if (this.hasValue || this.hasSeed) { | |
this.destination.next(this.acc); | |
} | |
this.destination.complete(); | |
}; | |
return ReduceSubscriber; | |
}(Subscriber_1.Subscriber)); | |
exports.ReduceSubscriber = ReduceSubscriber; | |
//# sourceMappingURL=reduce.js.map | |
/***/ }), | |
/* 97 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var root_1 = __webpack_require__(18); | |
function getSymbolObservable(context) { | |
var $$observable; | |
var Symbol = context.Symbol; | |
if (typeof Symbol === 'function') { | |
if (Symbol.observable) { | |
$$observable = Symbol.observable; | |
} | |
else { | |
$$observable = Symbol('observable'); | |
Symbol.observable = $$observable; | |
} | |
} | |
else { | |
$$observable = '@@observable'; | |
} | |
return $$observable; | |
} | |
exports.getSymbolObservable = getSymbolObservable; | |
exports.$$observable = getSymbolObservable(root_1.root); | |
//# sourceMappingURL=observable.js.map | |
/***/ }), | |
/* 98 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var root_1 = __webpack_require__(18); | |
var Symbol = root_1.root.Symbol; | |
exports.$$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? | |
Symbol.for('rxSubscriber') : '@@rxSubscriber'; | |
//# sourceMappingURL=rxSubscriber.js.map | |
/***/ }), | |
/* 99 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* An error thrown when an element was queried at a certain index of an | |
* Observable, but no such index or position exists in that sequence. | |
* | |
* @see {@link elementAt} | |
* @see {@link take} | |
* @see {@link takeLast} | |
* | |
* @class ArgumentOutOfRangeError | |
*/ | |
var ArgumentOutOfRangeError = (function (_super) { | |
__extends(ArgumentOutOfRangeError, _super); | |
function ArgumentOutOfRangeError() { | |
var err = _super.call(this, 'argument out of range'); | |
this.name = err.name = 'ArgumentOutOfRangeError'; | |
this.stack = err.stack; | |
this.message = err.message; | |
} | |
return ArgumentOutOfRangeError; | |
}(Error)); | |
exports.ArgumentOutOfRangeError = ArgumentOutOfRangeError; | |
//# sourceMappingURL=ArgumentOutOfRangeError.js.map | |
/***/ }), | |
/* 100 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
/** | |
* An error thrown when an action is invalid because the object has been | |
* unsubscribed. | |
* | |
* @see {@link Subject} | |
* @see {@link BehaviorSubject} | |
* | |
* @class ObjectUnsubscribedError | |
*/ | |
var ObjectUnsubscribedError = (function (_super) { | |
__extends(ObjectUnsubscribedError, _super); | |
function ObjectUnsubscribedError() { | |
var err = _super.call(this, 'object unsubscribed'); | |
this.name = err.name = 'ObjectUnsubscribedError'; | |
this.stack = err.stack; | |
this.message = err.message; | |
} | |
return ObjectUnsubscribedError; | |
}(Error)); | |
exports.ObjectUnsubscribedError = ObjectUnsubscribedError; | |
//# sourceMappingURL=ObjectUnsubscribedError.js.map | |
/***/ }), | |
/* 101 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function isDate(value) { | |
return value instanceof Date && !isNaN(+value); | |
} | |
exports.isDate = isDate; | |
//# sourceMappingURL=isDate.js.map | |
/***/ }), | |
/* 102 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
function isFunction(x) { | |
return typeof x === 'function'; | |
} | |
exports.isFunction = isFunction; | |
//# sourceMappingURL=isFunction.js.map | |
/***/ }), | |
/* 103 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var isArray_1 = __webpack_require__(43); | |
function isNumeric(val) { | |
// parseFloat NaNs numeric-cast false positives (null|true|false|"") | |
// ...but misinterprets leading-number strings, particularly hex literals ("0x...") | |
// subtraction forces infinities to NaN | |
// adding 1 corrects loss of precision from parseFloat (#15100) | |
return !isArray_1.isArray(val) && (val - parseFloat(val) + 1) >= 0; | |
} | |
exports.isNumeric = isNumeric; | |
; | |
//# sourceMappingURL=isNumeric.js.map | |
/***/ }), | |
/* 104 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/* global define */ | |
/** | |
* A base object for ECMAScript 5 style prototypal inheritance. | |
* | |
* @see https://github.com/rauschma/proto-js/ | |
* @see http://ejohn.org/blog/simple-javascript-inheritance/ | |
* @see http://uxebu.com/blog/2011/02/23/object-based-inheritance-for-ecmascript-5/ | |
*/ | |
(function (root, factory) { | |
if (true) { | |
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_FACTORY__ = (factory), | |
__WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? | |
(__WEBPACK_AMD_DEFINE_FACTORY__.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__)) : __WEBPACK_AMD_DEFINE_FACTORY__), | |
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); | |
} else if (typeof exports === 'object') { | |
module.exports = factory(); | |
} else { | |
root.Proto = factory(); | |
} | |
}(this, function () { | |
function makeSuper(_super, old, name, fn) { | |
return function () { | |
var tmp = this._super; | |
// Add a new ._super() method that is the same method | |
// but either pointing to the prototype method | |
// or to the overwritten method | |
this._super = (typeof old === 'function') ? old : _super[name]; | |
// The method only need to be bound temporarily, so we | |
// remove it when we're done executing | |
var ret = fn.apply(this, arguments); | |
this._super = tmp; | |
return ret; | |
}; | |
} | |
function legacyMixin(prop, obj) { | |
var self = obj || this; | |
var fnTest = /\b_super\b/; | |
var _super = Object.getPrototypeOf(self) || self.prototype; | |
var _old; | |
// Copy the properties over | |
for (var name in prop) { | |
// store the old function which would be overwritten | |
_old = self[name]; | |
// Check if we're overwriting an existing function | |
if( | |
(( | |
typeof prop[name] === 'function' && | |
typeof _super[name] === 'function' | |
) || ( | |
typeof _old === 'function' && | |
typeof prop[name] === 'function' | |
)) && fnTest.test(prop[name]) | |
) { | |
self[name] = makeSuper(_super, _old, name, prop[name]); | |
} else { | |
self[name] = prop[name]; | |
} | |
} | |
return self; | |
} | |
function es5Mixin(prop, obj) { | |
var self = obj || this; | |
var fnTest = /\b_super\b/; | |
var _super = Object.getPrototypeOf(self) || self.prototype; | |
var descriptors = {}; | |
var proto = prop; | |
var processProperty = function(name) { | |
if(!descriptors[name]) { | |
descriptors[name] = Object.getOwnPropertyDescriptor(proto, name); | |
} | |
}; | |
// Collect all property descriptors | |
do { | |
Object.getOwnPropertyNames(proto).forEach(processProperty); | |
} while((proto = Object.getPrototypeOf(proto)) && Object.getPrototypeOf(proto)); | |
Object.keys(descriptors).forEach(function(name) { | |
var descriptor = descriptors[name]; | |
if(typeof descriptor.value === 'function' && fnTest.test(descriptor.value)) { | |
descriptor.value = makeSuper(_super, self[name], name, descriptor.value); | |
} | |
Object.defineProperty(self, name, descriptor); | |
}); | |
return self; | |
} | |
return { | |
/** | |
* Create a new object using Object.create. The arguments will be | |
* passed to the new instances init method or to a method name set in | |
* __init. | |
*/ | |
create: function () { | |
var instance = Object.create(this); | |
var init = typeof instance.__init === 'string' ? instance.__init : 'init'; | |
if (typeof instance[init] === 'function') { | |
instance[init].apply(instance, arguments); | |
} | |
return instance; | |
}, | |
/** | |
* Mixin a given set of properties | |
* @param prop The properties to mix in | |
* @param obj [optional] The object to add the mixin | |
*/ | |
mixin: typeof Object.defineProperty === 'function' ? es5Mixin : legacyMixin, | |
/** | |
* Extend the current or a given object with the given property | |
* and return the extended object. | |
* @param prop The properties to extend with | |
* @param obj [optional] The object to extend from | |
* @returns The extended object | |
*/ | |
extend: function (prop, obj) { | |
return this.mixin(prop, Object.create(obj || this)); | |
}, | |
/** | |
* Return a callback function with this set to the current or a given context object. | |
* @param name Name of the method to proxy | |
* @param args... [optional] Arguments to use for partial application | |
*/ | |
proxy: function (name) { | |
var fn = this[name]; | |
var args = Array.prototype.slice.call(arguments, 1); | |
args.unshift(this); | |
return fn.bind.apply(fn, args); | |
} | |
}; | |
})); | |
/***/ }), | |
/* 105 */, | |
/* 106 */, | |
/* 107 */, | |
/* 108 */, | |
/* 109 */, | |
/* 110 */, | |
/* 111 */, | |
/* 112 */, | |
/* 113 */, | |
/* 114 */, | |
/* 115 */, | |
/* 116 */, | |
/* 117 */, | |
/* 118 */, | |
/* 119 */, | |
/* 120 */, | |
/* 121 */, | |
/* 122 */, | |
/* 123 */, | |
/* 124 */, | |
/* 125 */, | |
/* 126 */, | |
/* 127 */, | |
/* 128 */, | |
/* 129 */, | |
/* 130 */, | |
/* 131 */, | |
/* 132 */, | |
/* 133 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/** | |
* Module dependencies. | |
*/ | |
var parser = __webpack_require__(64); | |
var Emitter = __webpack_require__(60); | |
/** | |
* Module exports. | |
*/ | |
module.exports = Transport; | |
/** | |
* Transport abstract constructor. | |
* | |
* @param {Object} options. | |
* @api private | |
*/ | |
function Transport (opts) { | |
this.path = opts.path; | |
this.hostname = opts.hostname; | |
this.port = opts.port; | |
this.secure = opts.secure; | |
this.query = opts.query; | |
this.timestampParam = opts.timestampParam; | |
this.timestampRequests = opts.timestampRequests; | |
this.readyState = ''; | |
this.agent = opts.agent || false; | |
this.socket = opts.socket; | |
this.enablesXDR = opts.enablesXDR; | |
// SSL options for Node.js client | |
this.pfx = opts.pfx; | |
this.key = opts.key; | |
this.passphrase = opts.passphrase; | |
this.cert = opts.cert; | |
this.ca = opts.ca; | |
this.ciphers = opts.ciphers; | |
this.rejectUnauthorized = opts.rejectUnauthorized; | |
this.forceNode = opts.forceNode; | |
// other options for Node.js client | |
this.extraHeaders = opts.extraHeaders; | |
this.localAddress = opts.localAddress; | |
} | |
/** | |
* Mix in `Emitter`. | |
*/ | |
Emitter(Transport.prototype); | |
/** | |
* Emits an error. | |
* | |
* @param {String} str | |
* @return {Transport} for chaining | |
* @api public | |
*/ | |
Transport.prototype.onError = function (msg, desc) { | |
var err = new Error(msg); | |
err.type = 'TransportError'; | |
err.description = desc; | |
this.emit('error', err); | |
return this; | |
}; | |
/** | |
* Opens the transport. | |
* | |
* @api public | |
*/ | |
Transport.prototype.open = function () { | |
if ('closed' === this.readyState || '' === this.readyState) { | |
this.readyState = 'opening'; | |
this.doOpen(); | |
} | |
return this; | |
}; | |
/** | |
* Closes the transport. | |
* | |
* @api private | |
*/ | |
Transport.prototype.close = function () { | |
if ('opening' === this.readyState || 'open' === this.readyState) { | |
this.doClose(); | |
this.onClose(); | |
} | |
return this; | |
}; | |
/** | |
* Sends multiple packets. | |
* | |
* @param {Array} packets | |
* @api private | |
*/ | |
Transport.prototype.send = function (packets) { | |
if ('open' === this.readyState) { | |
this.write(packets); | |
} else { | |
throw new Error('Transport not open'); | |
} | |
}; | |
/** | |
* Called upon open | |
* | |
* @api private | |
*/ | |
Transport.prototype.onOpen = function () { | |
this.readyState = 'open'; | |
this.writable = true; | |
this.emit('open'); | |
}; | |
/** | |
* Called with data. | |
* | |
* @param {String} data | |
* @api private | |
*/ | |
Transport.prototype.onData = function (data) { | |
var packet = parser.decodePacket(data, this.socket.binaryType); | |
this.onPacket(packet); | |
}; | |
/** | |
* Called with a decoded packet. | |
*/ | |
Transport.prototype.onPacket = function (packet) { | |
this.emit('packet', packet); | |
}; | |
/** | |
* Called upon close. | |
* | |
* @api private | |
*/ | |
Transport.prototype.onClose = function () { | |
this.readyState = 'closed'; | |
this.emit('close'); | |
}; | |
/***/ }), | |
/* 134 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
/* WEBPACK VAR INJECTION */(function(global) {// browser shim for xmlhttprequest module | |
var hasCORS = __webpack_require__(467); | |
module.exports = function (opts) { | |
var xdomain = opts.xdomain; | |
// scheme must be same when usign XDomainRequest | |
// http://blogs.msdn.com/b/ieinternals/archive/2010/05/13/xdomainrequest-restrictions-limitations-and-workarounds.aspx | |
var xscheme = opts.xscheme; | |
// XDomainRequest has a flow of not sending cookie, therefore it should be disabled as a default. | |
// https://github.com/Automattic/engine.io-client/pull/217 | |
var enablesXDR = opts.enablesXDR; | |
// XMLHttpRequest can be disabled on IE | |
try { | |
if ('undefined' !== typeof XMLHttpRequest && (!xdomain || hasCORS)) { | |
return new XMLHttpRequest(); | |
} | |
} catch (e) { } | |
// Use XDomainRequest for IE8 if enablesXDR is true | |
// because loading bar keeps flashing when using jsonp-polling | |
// https://github.com/yujiosaka/socke.io-ie8-loading-example | |
try { | |
if ('undefined' !== typeof XDomainRequest && !xscheme && enablesXDR) { | |
return new XDomainRequest(); | |
} | |
} catch (e) { } | |
if (!xdomain) { | |
try { | |
return new global[['Active'].concat('Object').join('X')]('Microsoft.XMLHTTP'); | |
} catch (e) { } | |
} | |
}; | |
/* WEBPACK VAR INJECTION */}.call(exports, __webpack_require__(13))) | |
/***/ }), | |
/* 135 */ | |
/***/ (function(module, exports) { | |
// Copyright Joyent, Inc. and other Node contributors. | |
// | |
// Permission is hereby granted, free of charge, to any person obtaining a | |
// copy of this software and associated documentation files (the | |
// "Software"), to deal in the Software without restriction, including | |
// without limitation the rights to use, copy, modify, merge, publish, | |
// distribute, sublicense, and/or sell copies of the Software, and to permit | |
// persons to whom the Software is furnished to do so, subject to the | |
// following conditions: | |
// | |
// The above copyright notice and this permission notice shall be included | |
// in all copies or substantial portions of the Software. | |
// | |
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF | |
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN | |
// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, | |
// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | |
// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE | |
// USE OR OTHER DEALINGS IN THE SOFTWARE. | |
function EventEmitter() { | |
this._events = this._events || {}; | |
this._maxListeners = this._maxListeners || undefined; | |
} | |
module.exports = EventEmitter; | |
// Backwards-compat with node 0.10.x | |
EventEmitter.EventEmitter = EventEmitter; | |
EventEmitter.prototype._events = undefined; | |
EventEmitter.prototype._maxListeners = undefined; | |
// By default EventEmitters will print a warning if more than 10 listeners are | |
// added to it. This is a useful default which helps finding memory leaks. | |
EventEmitter.defaultMaxListeners = 10; | |
// Obviously not all Emitters should be limited to 10. This function allows | |
// that to be increased. Set to zero for unlimited. | |
EventEmitter.prototype.setMaxListeners = function(n) { | |
if (!isNumber(n) || n < 0 || isNaN(n)) | |
throw TypeError('n must be a positive number'); | |
this._maxListeners = n; | |
return this; | |
}; | |
EventEmitter.prototype.emit = function(type) { | |
var er, handler, len, args, i, listeners; | |
if (!this._events) | |
this._events = {}; | |
// If there is no 'error' event listener then throw. | |
if (type === 'error') { | |
if (!this._events.error || | |
(isObject(this._events.error) && !this._events.error.length)) { | |
er = arguments[1]; | |
if (er instanceof Error) { | |
throw er; // Unhandled 'error' event | |
} else { | |
// At least give some kind of context to the user | |
var err = new Error('Uncaught, unspecified "error" event. (' + er + ')'); | |
err.context = er; | |
throw err; | |
} | |
} | |
} | |
handler = this._events[type]; | |
if (isUndefined(handler)) | |
return false; | |
if (isFunction(handler)) { | |
switch (arguments.length) { | |
// fast cases | |
case 1: | |
handler.call(this); | |
break; | |
case 2: | |
handler.call(this, arguments[1]); | |
break; | |
case 3: | |
handler.call(this, arguments[1], arguments[2]); | |
break; | |
// slower | |
default: | |
args = Array.prototype.slice.call(arguments, 1); | |
handler.apply(this, args); | |
} | |
} else if (isObject(handler)) { | |
args = Array.prototype.slice.call(arguments, 1); | |
listeners = handler.slice(); | |
len = listeners.length; | |
for (i = 0; i < len; i++) | |
listeners[i].apply(this, args); | |
} | |
return true; | |
}; | |
EventEmitter.prototype.addListener = function(type, listener) { | |
var m; | |
if (!isFunction(listener)) | |
throw TypeError('listener must be a function'); | |
if (!this._events) | |
this._events = {}; | |
// To avoid recursion in the case that type === "newListener"! Before | |
// adding it to the listeners, first emit "newListener". | |
if (this._events.newListener) | |
this.emit('newListener', type, | |
isFunction(listener.listener) ? | |
listener.listener : listener); | |
if (!this._events[type]) | |
// Optimize the case of one listener. Don't need the extra array object. | |
this._events[type] = listener; | |
else if (isObject(this._events[type])) | |
// If we've already got an array, just append. | |
this._events[type].push(listener); | |
else | |
// Adding the second element, need to change to array. | |
this._events[type] = [this._events[type], listener]; | |
// Check for listener leak | |
if (isObject(this._events[type]) && !this._events[type].warned) { | |
if (!isUndefined(this._maxListeners)) { | |
m = this._maxListeners; | |
} else { | |
m = EventEmitter.defaultMaxListeners; | |
} | |
if (m && m > 0 && this._events[type].length > m) { | |
this._events[type].warned = true; | |
console.error('(node) warning: possible EventEmitter memory ' + | |
'leak detected. %d listeners added. ' + | |
'Use emitter.setMaxListeners() to increase limit.', | |
this._events[type].length); | |
if (typeof console.trace === 'function') { | |
// not supported in IE 10 | |
console.trace(); | |
} | |
} | |
} | |
return this; | |
}; | |
EventEmitter.prototype.on = EventEmitter.prototype.addListener; | |
EventEmitter.prototype.once = function(type, listener) { | |
if (!isFunction(listener)) | |
throw TypeError('listener must be a function'); | |
var fired = false; | |
function g() { | |
this.removeListener(type, g); | |
if (!fired) { | |
fired = true; | |
listener.apply(this, arguments); | |
} | |
} | |
g.listener = listener; | |
this.on(type, g); | |
return this; | |
}; | |
// emits a 'removeListener' event iff the listener was removed | |
EventEmitter.prototype.removeListener = function(type, listener) { | |
var list, position, length, i; | |
if (!isFunction(listener)) | |
throw TypeError('listener must be a function'); | |
if (!this._events || !this._events[type]) | |
return this; | |
list = this._events[type]; | |
length = list.length; | |
position = -1; | |
if (list === listener || | |
(isFunction(list.listener) && list.listener === listener)) { | |
delete this._events[type]; | |
if (this._events.removeListener) | |
this.emit('removeListener', type, listener); | |
} else if (isObject(list)) { | |
for (i = length; i-- > 0;) { | |
if (list[i] === listener || | |
(list[i].listener && list[i].listener === listener)) { | |
position = i; | |
break; | |
} | |
} | |
if (position < 0) | |
return this; | |
if (list.length === 1) { | |
list.length = 0; | |
delete this._events[type]; | |
} else { | |
list.splice(position, 1); | |
} | |
if (this._events.removeListener) | |
this.emit('removeListener', type, listener); | |
} | |
return this; | |
}; | |
EventEmitter.prototype.removeAllListeners = function(type) { | |
var key, listeners; | |
if (!this._events) | |
return this; | |
// not listening for removeListener, no need to emit | |
if (!this._events.removeListener) { | |
if (arguments.length === 0) | |
this._events = {}; | |
else if (this._events[type]) | |
delete this._events[type]; | |
return this; | |
} | |
// emit removeListener for all listeners on all events | |
if (arguments.length === 0) { | |
for (key in this._events) { | |
if (key === 'removeListener') continue; | |
this.removeAllListeners(key); | |
} | |
this.removeAllListeners('removeListener'); | |
this._events = {}; | |
return this; | |
} | |
listeners = this._events[type]; | |
if (isFunction(listeners)) { | |
this.removeListener(type, listeners); | |
} else if (listeners) { | |
// LIFO order | |
while (listeners.length) | |
this.removeListener(type, listeners[listeners.length - 1]); | |
} | |
delete this._events[type]; | |
return this; | |
}; | |
EventEmitter.prototype.listeners = function(type) { | |
var ret; | |
if (!this._events || !this._events[type]) | |
ret = []; | |
else if (isFunction(this._events[type])) | |
ret = [this._events[type]]; | |
else | |
ret = this._events[type].slice(); | |
return ret; | |
}; | |
EventEmitter.prototype.listenerCount = function(type) { | |
if (this._events) { | |
var evlistener = this._events[type]; | |
if (isFunction(evlistener)) | |
return 1; | |
else if (evlistener) | |
return evlistener.length; | |
} | |
return 0; | |
}; | |
EventEmitter.listenerCount = function(emitter, type) { | |
return emitter.listenerCount(type); | |
}; | |
function isFunction(arg) { | |
return typeof arg === 'function'; | |
} | |
function isNumber(arg) { | |
return typeof arg === 'number'; | |
} | |
function isObject(arg) { | |
return typeof arg === 'object' && arg !== null; | |
} | |
function isUndefined(arg) { | |
return arg === void 0; | |
} | |
/***/ }), | |
/* 136 */ | |
/***/ (function(module, exports) { | |
/** | |
* Compiles a querystring | |
* Returns string representation of the object | |
* | |
* @param {Object} | |
* @api private | |
*/ | |
exports.encode = function (obj) { | |
var str = ''; | |
for (var i in obj) { | |
if (obj.hasOwnProperty(i)) { | |
if (str.length) str += '&'; | |
str += encodeURIComponent(i) + '=' + encodeURIComponent(obj[i]); | |
} | |
} | |
return str; | |
}; | |
/** | |
* Parses a simple querystring into an object | |
* | |
* @param {String} qs | |
* @api private | |
*/ | |
exports.decode = function(qs){ | |
var qry = {}; | |
var pairs = qs.split('&'); | |
for (var i = 0, l = pairs.length; i < l; i++) { | |
var pair = pairs[i].split('='); | |
qry[decodeURIComponent(pair[0])] = decodeURIComponent(pair[1]); | |
} | |
return qry; | |
}; | |
/***/ }), | |
/* 137 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subject_1 = __webpack_require__(12); | |
var ObjectUnsubscribedError_1 = __webpack_require__(100); | |
/** | |
* @class BehaviorSubject<T> | |
*/ | |
var BehaviorSubject = (function (_super) { | |
__extends(BehaviorSubject, _super); | |
function BehaviorSubject(_value) { | |
_super.call(this); | |
this._value = _value; | |
} | |
Object.defineProperty(BehaviorSubject.prototype, "value", { | |
get: function () { | |
return this.getValue(); | |
}, | |
enumerable: true, | |
configurable: true | |
}); | |
BehaviorSubject.prototype._subscribe = function (subscriber) { | |
var subscription = _super.prototype._subscribe.call(this, subscriber); | |
if (subscription && !subscription.closed) { | |
subscriber.next(this._value); | |
} | |
return subscription; | |
}; | |
BehaviorSubject.prototype.getValue = function () { | |
if (this.hasError) { | |
throw this.thrownError; | |
} | |
else if (this.closed) { | |
throw new ObjectUnsubscribedError_1.ObjectUnsubscribedError(); | |
} | |
else { | |
return this._value; | |
} | |
}; | |
BehaviorSubject.prototype.next = function (value) { | |
_super.prototype.next.call(this, this._value = value); | |
}; | |
return BehaviorSubject; | |
}(Subject_1.Subject)); | |
exports.BehaviorSubject = BehaviorSubject; | |
//# sourceMappingURL=BehaviorSubject.js.map | |
/***/ }), | |
/* 138 */ | |
/***/ (function(module, exports, __webpack_require__) { | |
"use strict"; | |
var __extends = (this && this.__extends) || function (d, b) { | |
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; | |
function __() { this.constructor = d; } | |
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); | |
}; | |
var Subject_1 = __webpack_require__(12); | |
var queue_1 = __webpack_require__(215); | |
var Subscription_1 = __webpack_require__(14); | |
var observeOn_1 = __webpack_require__(145); | |
var ObjectUnsubscribedError_1 = __webpack_require__(100); | |
var SubjectSubscription_1 = __webpack_require__(189); | |
/** | |
* @class ReplaySubject<T> | |
*/ | |
var ReplaySubject = (function (_super) { | |
__extends(ReplaySubject, _super); | |
function ReplaySubject(bufferSize, windowTime, scheduler) { | |
if (bufferSize === void 0) { bufferSize = Number.POSITIVE_INFINITY; } | |
if (windowTime === void 0) { windowTime = Number.POSITIVE_INFINITY; } | |
_super.call(this); | |
this.scheduler = scheduler; | |
this._events = []; | |
this._bufferSize = bufferSize < 1 ? 1 : bufferSize; | |
this._windowTime = windowTime < 1 ? 1 : windowTime; | |
} | |
ReplaySubject.prototype.next = function (value) { | |
var now = this._getNow(); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment