// ==UserScript== // @name anti-redirect (typescript) // @author axetroy // @collaborator axetroy // @description 反重定向 // @version 2016.11.18.2728 // @grant GM_xmlhttpRequest // @include *www.baidu.com* // @include *tieba.baidu.com* // @include *v.baidu.com* // @include *www.google.* // @include *www.so.com* // @include *www.zhihu.com* // @include *daily.zhihu.com* // @include *weibo.com* // @include *twitter.com* // @connect * // @compatible chrome 完美运行 // @compatible firefox 完美运行 // @supportURL http://www.burningall.com // @run-at document-start // @contributionURL troy450409405@gmail.com|alipay.com // @namespace https://greasyfork.org/zh-CN/users/3400-axetroy // @license The MIT License (MIT); http://opensource.org/licenses/MIT // @downloadURL none // ==/UserScript== // Github源码:https://github.com/axetroy/anti-redirect /******/ (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 harmory imports with the correct context /******/ __webpack_require__.i = function(value) { return value; }; /******/ // define getter function for harmory exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ 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 = 87); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var root_1 = __webpack_require__(2); var toSubscriber_1 = __webpack_require__(83); var observable_1 = __webpack_require__(11); /** * A representation of any set of values over any amount of time. This the most basic building block * of RxJS. * * @class Observable */ 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); } else { sink.add(this._subscribe(sink)); } if (sink.syncErrorThrowable) { sink.syncErrorThrowable = false; if (sink.syncErrorThrown) { throw sink.syncErrorValue; } } return sink; }; /** * @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 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(14); var Subscription_1 = __webpack_require__(8); var Observer_1 = __webpack_require__(18); var rxSubscriber_1 = __webpack_require__(21); /** * 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 */ 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} 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(); }; 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(_parent, observerOrNext, error, complete) { _super.call(this); this._parent = _parent; 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 _parent = this._parent; if (!_parent.syncErrorThrowable) { this.__tryOrUnsub(this._next, value); } else if (this.__tryOrSetError(_parent, this._next, value)) { this.unsubscribe(); } } }; SafeSubscriber.prototype.error = function (err) { if (!this.isStopped) { var _parent = this._parent; if (this._error) { if (!_parent.syncErrorThrowable) { this.__tryOrUnsub(this._error, err); this.unsubscribe(); } else { this.__tryOrSetError(_parent, this._error, err); this.unsubscribe(); } } else if (!_parent.syncErrorThrowable) { this.unsubscribe(); throw err; } else { _parent.syncErrorValue = err; _parent.syncErrorThrown = true; this.unsubscribe(); } } }; SafeSubscriber.prototype.complete = function () { if (!this.isStopped) { var _parent = this._parent; if (this._complete) { if (!_parent.syncErrorThrowable) { this.__tryOrUnsub(this._complete); this.unsubscribe(); } else { this.__tryOrSetError(_parent, 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 _parent = this._parent; this._context = null; this._parent = null; _parent.unsubscribe(); }; return SafeSubscriber; }(Subscriber)); //# sourceMappingURL=Subscriber.js.map /***/ }, /* 2 */ /***/ function(module, exports, __webpack_require__) { "use strict"; /* WEBPACK VAR INJECTION */(function(global) {"use strict"; /** * 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__(86))) /***/ }, /* 3 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var config_1 = __webpack_require__(15); var DEBUG = config_1.CONFIG.debug; var RedirectOnUrl = (function () { function RedirectOnUrl(domainTester, urlTester, matcher, ASelector) { this.domainTester = domainTester; this.urlTester = urlTester; this.matcher = matcher; this.ASelector = ASelector; this.match = false; this.DEBUG = DEBUG; this.logCount = 0; this.ASelector = this.ASelector || 'a'; this.match = domainTester.test(document.domain); } RedirectOnUrl.prototype.handlerOneEle = function (aEle) { var _this = this; return Observable_1.Observable.of(aEle) .filter(function (ele) { return _this.urlTester.test(ele.href); }) .subscribe(function (aEle) { var matcher = _this.matcher.exec(aEle.href); if (!matcher || !matcher.length || !matcher[1]) return; var url = ''; try { url = decodeURIComponent(matcher[1]); } catch (e) { url = /https?:\/\//.test(matcher[1]) ? matcher[1] : ''; } if (url) { aEle.href = url; DEBUG && (aEle.style.backgroundColor = 'green'); } }); }; RedirectOnUrl.prototype.handlerOneByOneEle = function () { return Observable_1.Observable.from([].slice.call(document.querySelectorAll(this.ASelector))) .filter(function (target) { return !!(target.nodeName === 'A' && target.href); }); }; RedirectOnUrl.prototype.scroll = function () { var _this = this; return Observable_1.Observable.fromEvent(document, 'scroll') .debounceTime(500) .flatMap(function () { return _this.handlerOneByOneEle(); }) .subscribe(function (aEle) { _this.handlerOneEle(aEle); }); }; RedirectOnUrl.prototype.mouseover = function () { return Observable_1.Observable.fromEvent(document, 'mousemove') .debounce(function () { return Observable_1.Observable.timer(100); }) .map(function (event) { var target = event.target; return target.nodeName === 'A' ? target : target.parentNode.nodeName === 'A' ? target.parentNode : target; }) .filter(function (ele) { return ele.nodeName === 'A'; }); }; RedirectOnUrl.prototype.log = function (project) { if (this.logCount < 1) { console.log("%c Anti-Redirect %c Copyright \xa9 2015-%s %s", 'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size:64px;color:#00bbee;-webkit-text-fill-color:#00bbee;-webkit-text-stroke: 1px #00bbee;', "font-size:12px;color:#999999;", (new Date).getFullYear(), '\n' + (project || '')); this.logCount++; } }; RedirectOnUrl.prototype.bootstrap = function () { var _this = this; if (!this.match) return; Observable_1.Observable.fromEvent(document, 'DOMContentLoaded') .delay(1000) .flatMap(function () { return _this.handlerOneByOneEle().filter(function (aEle) { return __webpack_require__(16).is(aEle); }); }) .subscribe(function (aEle) { _this.handlerOneEle(aEle); _this.scroll(); _this.mouseover() .subscribe(function (aEle) { _this.handlerOneEle(aEle); }); _this.log(); }); }; return RedirectOnUrl; }()); exports.RedirectOnUrl = RedirectOnUrl; /***/ }, /* 4 */ /***/ function(module, exports) { "use strict"; "use strict"; exports.isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; }); //# sourceMappingURL=isArray.js.map /***/ }, /* 5 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /** * 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 /***/ }, /* 6 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var AsyncAction_1 = __webpack_require__(77); var AsyncScheduler_1 = __webpack_require__(78); exports.async = new AsyncScheduler_1.AsyncScheduler(AsyncAction_1.AsyncAction); //# sourceMappingURL=async.js.map /***/ }, /* 7 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var root_1 = __webpack_require__(2); var isArray_1 = __webpack_require__(4); var isPromise_1 = __webpack_require__(22); var Observable_1 = __webpack_require__(0); var iterator_1 = __webpack_require__(10); var InnerSubscriber_1 = __webpack_require__(51); var observable_1 = __webpack_require__(11); 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); } } if (isArray_1.isArray(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 (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 (typeof result[observable_1.$$observable] === 'function') { var obs = result[observable_1.$$observable](); if (typeof obs.subscribe !== 'function') { destination.error(new Error('invalid observable')); } else { return obs.subscribe(new InnerSubscriber_1.InnerSubscriber(outerSubscriber, outerValue, outerIndex)); } } else { destination.error(new TypeError('unknown type returned')); } return null; } exports.subscribeToResult = subscribeToResult; //# sourceMappingURL=subscribeToResult.js.map /***/ }, /* 8 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var isArray_1 = __webpack_require__(4); var isObject_1 = __webpack_require__(82); var isFunction_1 = __webpack_require__(14); var tryCatch_1 = __webpack_require__(24); var errorObject_1 = __webpack_require__(12); var UnsubscriptionError_1 = __webpack_require__(80); /** * 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; 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; } this.closed = true; var _a = this, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions; this._subscriptions = null; if (isFunction_1.isFunction(_unsubscribe)) { var trial = tryCatch_1.tryCatch(_unsubscribe).call(this); if (trial === errorObject_1.errorObject) { hasErrors = true; (errors = errors || []).push(errorObject_1.errorObject.e); } } if (isArray_1.isArray(_subscriptions)) { var index = -1; var 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(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 sub = teardown; switch (typeof teardown) { case 'function': sub = new Subscription(teardown); case 'object': if (sub.closed || typeof sub.unsubscribe !== 'function') { break; } else if (this.closed) { sub.unsubscribe(); } else { (this._subscriptions || (this._subscriptions = [])).push(sub); } break; default: throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.'); } return sub; }; /** * 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) { // HACK: This might be redundant because of the logic in `add()` if (subscription == null || (subscription === this) || (subscription === Subscription.EMPTY)) { return; } var subscriptions = this._subscriptions; if (subscriptions) { var subscriptionIndex = subscriptions.indexOf(subscription); if (subscriptionIndex !== -1) { subscriptions.splice(subscriptionIndex, 1); } } }; Subscription.EMPTY = (function (empty) { empty.closed = true; return empty; }(new Subscription())); return Subscription; }()); exports.Subscription = Subscription; //# sourceMappingURL=Subscription.js.map /***/ }, /* 9 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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. * * Just emits 'complete', and nothing else. * * * * * 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 Emit the number 7, then complete. * var result = Rx.Observable.empty().startWith(7); * result.subscribe(x => console.log(x)); * * @example Map and flatten only odd numbers to the sequence 'a', 'b', 'c' * 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)); * * @see {@link create} * @see {@link never} * @see {@link of} * @see {@link throw} * * @param {Scheduler} [scheduler] A {@link Scheduler} 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 /***/ }, /* 10 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var root_1 = __webpack_require__(2); 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 /***/ }, /* 11 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var root_1 = __webpack_require__(2); 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 /***/ }, /* 12 */ /***/ function(module, exports) { "use strict"; "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 /***/ }, /* 13 */ /***/ function(module, exports) { "use strict"; "use strict"; function isDate(value) { return value instanceof Date && !isNaN(+value); } exports.isDate = isDate; //# sourceMappingURL=isDate.js.map /***/ }, /* 14 */ /***/ function(module, exports) { "use strict"; "use strict"; function isFunction(x) { return typeof x === 'function'; } exports.isFunction = isFunction; //# sourceMappingURL=isFunction.js.map /***/ }, /* 15 */ /***/ function(module, exports) { "use strict"; "use strict"; /** * Created by axetroy on 16-11-12. */ var CONFIG = { debug: false }; exports.CONFIG = CONFIG; /***/ }, /* 16 */ /***/ function(module, exports, __webpack_require__) { /*! * in-view 0.6.0 - Get notified when a DOM element enters or exits the viewport. * Copyright (c) 2016 Cam Wiegert - https://camwiegert.github.io/in-view * License: MIT */ !function(t,e){ true?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.inView=e():t.inView=e()}(this,function(){return function(t){function e(r){if(n[r])return n[r].exports;var i=n[r]={exports:{},id:r,loaded:!1};return t[r].call(i.exports,i,i.exports,e),i.loaded=!0,i.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}var i=n(2),o=r(i);t.exports=o["default"]},function(t,e){function n(t){var e=typeof t;return null!=t&&("object"==e||"function"==e)}t.exports=n},function(t,e,n){"use strict";function r(t){return t&&t.__esModule?t:{"default":t}}Object.defineProperty(e,"__esModule",{value:!0});var i=n(9),o=r(i),u=n(3),f=r(u),s=n(4),c=function(){if("undefined"!=typeof window){var t=100,e=["scroll","resize","load"],n={history:[]},r={offset:{},threshold:0,test:s.inViewport},i=(0,o["default"])(function(){n.history.forEach(function(t){n[t].check()})},t);e.forEach(function(t){return addEventListener(t,i)}),window.MutationObserver&&new MutationObserver(i).observe(document.body,{attributes:!0,childList:!0,subtree:!0});var u=function(t){if("string"==typeof t){var e=[].slice.call(document.querySelectorAll(t));return n.history.indexOf(t)>-1?n[t].elements=e:(n[t]=(0,f["default"])(e,r),n.history.push(t)),n[t]}};return u.offset=function(t){if(void 0===t)return r.offset;var e=function(t){return"number"==typeof t};return["top","right","bottom","left"].forEach(e(t)?function(e){return r.offset[e]=t}:function(n){return e(t[n])?r.offset[n]=t[n]:null}),r.offset},u.threshold=function(t){return"number"==typeof t&&t>=0&&t<=1?r.threshold=t:r.threshold},u.test=function(t){return"function"==typeof t?r.test=t:r.test},u.is=function(t){return r.test(t,r)},u.offset(0),u}};e["default"]=c()},function(t,e){"use strict";function n(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e){for(var n=0;n-1,o=n&&!i,u=!n&&i;o&&(t.current.push(e),t.emit("enter",e)),u&&(t.current.splice(r,1),t.emit("exit",e))}),this}},{key:"on",value:function(t,e){return this.handlers[t].push(e),this}},{key:"once",value:function(t,e){return this.singles[t].unshift(e),this}},{key:"emit",value:function(t,e){for(;this.singles[t].length;)this.singles[t].pop()(e);for(var n=this.handlers[t].length;--n>-1;)this.handlers[t][n](e);return this}}]),t}();e["default"]=function(t,e){return new i(t,e)}},function(t,e){"use strict";function n(t,e){var n=t.getBoundingClientRect(),r=n.top,i=n.right,o=n.bottom,u=n.left,f=n.width,s=n.height,c={t:o,r:window.innerWidth-u,b:window.innerHeight-r,l:i},a={x:e.threshold*f,y:e.threshold*s};return c.t>e.offset.top+a.y&&c.r>e.offset.right+a.x&&c.b>e.offset.bottom+a.y&&c.l>e.offset.left+a.x}Object.defineProperty(e,"__esModule",{value:!0}),e.inViewport=n},function(t,e){(function(e){var n="object"==typeof e&&e&&e.Object===Object&&e;t.exports=n}).call(e,function(){return this}())},function(t,e,n){var r=n(5),i="object"==typeof self&&self&&self.Object===Object&&self,o=r||i||Function("return this")();t.exports=o},function(t,e,n){function r(t,e,n){function r(e){var n=x,r=m;return x=m=void 0,E=e,w=t.apply(r,n)}function a(t){return E=t,j=setTimeout(h,e),_?r(t):w}function l(t){var n=t-O,r=t-E,i=e-n;return M?c(i,g-r):i}function d(t){var n=t-O,r=t-E;return void 0===O||n>=e||n<0||M&&r>=g}function h(){var t=o();return d(t)?p(t):void(j=setTimeout(h,l(t)))}function p(t){return j=void 0,T&&x?r(t):(x=m=void 0,w)}function v(){void 0!==j&&clearTimeout(j),E=0,x=O=m=j=void 0}function y(){return void 0===j?w:p(o())}function b(){var t=o(),n=d(t);if(x=arguments,m=this,O=t,n){if(void 0===j)return a(O);if(M)return j=setTimeout(h,e),r(O)}return void 0===j&&(j=setTimeout(h,e)),w}var x,m,g,w,j,O,E=0,_=!1,M=!1,T=!0;if("function"!=typeof t)throw new TypeError(f);return e=u(e)||0,i(n)&&(_=!!n.leading,M="maxWait"in n,g=M?s(u(n.maxWait)||0,e):g,T="trailing"in n?!!n.trailing:T),b.cancel=v,b.flush=y,b}var i=n(1),o=n(8),u=n(10),f="Expected a function",s=Math.max,c=Math.min;t.exports=r},function(t,e,n){var r=n(6),i=function(){return r.Date.now()};t.exports=i},function(t,e,n){function r(t,e,n){var r=!0,f=!0;if("function"!=typeof t)throw new TypeError(u);return o(n)&&(r="leading"in n?!!n.leading:r,f="trailing"in n?!!n.trailing:f),i(t,e,{leading:r,maxWait:e,trailing:f})}var i=n(7),o=n(1),u="Expected a function";t.exports=r},function(t,e){function n(t){return t}t.exports=n}])}); /***/ }, /* 17 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 */ 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} 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} 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} 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 /***/ }, /* 18 */ /***/ function(module, exports) { "use strict"; "use strict"; exports.empty = { closed: true, next: function (value) { }, error: function (err) { throw err; }, complete: function () { } }; //# sourceMappingURL=Observer.js.map /***/ }, /* 19 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(20); var EmptyObservable_1 = __webpack_require__(9); var isScheduler_1 = __webpack_require__(23); /** * 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. * * Emits the arguments you provide, then completes. * * * * * 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` Scheduler, which means the `next` * notifications are sent synchronously, although with a different Scheduler * it is possible to determine when those notifications will be delivered. * * @example Emit 10, 20, 30, then 'a', 'b', 'c', then start ticking every second. * 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 Scheduler} to use for scheduling * the emissions of the `next` notifications. * @return {Observable} 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 /***/ }, /* 20 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 ScalarObservable = (function (_super) { __extends(ScalarObservable, _super); function ScalarObservable(value, scheduler) { _super.call(this); this.value = value; this.scheduler = scheduler; this._isScalar = true; if (scheduler) { this._isScalar = false; } } ScalarObservable.create = function (value, scheduler) { return new ScalarObservable(value, scheduler); }; ScalarObservable.dispatch = function (state) { var done = state.done, value = state.value, subscriber = state.subscriber; if (done) { subscriber.complete(); return; } subscriber.next(value); if (subscriber.closed) { return; } state.done = true; this.schedule(state); }; ScalarObservable.prototype._subscribe = function (subscriber) { var value = this.value; var scheduler = this.scheduler; if (scheduler) { return scheduler.schedule(ScalarObservable.dispatch, 0, { done: false, value: value, subscriber: subscriber }); } else { subscriber.next(value); if (!subscriber.closed) { subscriber.complete(); } } }; return ScalarObservable; }(Observable_1.Observable)); exports.ScalarObservable = ScalarObservable; //# sourceMappingURL=ScalarObservable.js.map /***/ }, /* 21 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var root_1 = __webpack_require__(2); var Symbol = root_1.root.Symbol; exports.$$rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function') ? Symbol.for('rxSubscriber') : '@@rxSubscriber'; //# sourceMappingURL=rxSubscriber.js.map /***/ }, /* 22 */ /***/ function(module, exports) { "use strict"; "use strict"; function isPromise(value) { return value && typeof value.subscribe !== 'function' && typeof value.then === 'function'; } exports.isPromise = isPromise; //# sourceMappingURL=isPromise.js.map /***/ }, /* 23 */ /***/ function(module, exports) { "use strict"; "use strict"; function isScheduler(value) { return value && typeof value.schedule === 'function'; } exports.isScheduler = isScheduler; //# sourceMappingURL=isScheduler.js.map /***/ }, /* 24 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var errorObject_1 = __webpack_require__(12); 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 /***/ }, /* 25 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var _ = __webpack_require__(85); var Observable_1 = __webpack_require__(0); var Http = (function () { function Http(options) { this.options = options; } Http.prototype.request = function (requestOptions) { var options = _.extend({}, this.options, requestOptions); var onreadystatechange = options.onreadystatechange, onerror = options.onerror, onabort = options.onabort, ontimeout = options.ontimeout; return Observable_1.Observable.create(function (observer) { // options.synchronous = true; // async options.onreadystatechange = function (response) { _.isFunction(onreadystatechange) && onreadystatechange.call(this, response); if (response.readyState !== 4) return; response.status >= 200 && response.status < 400 && response.finalUrl ? observer.next(response) : observer.error(response); observer.complete(); }; options.onerror = function (response) { _.isFunction(onerror) && onerror.call(this, response); observer.error(response); observer.complete(); }; options.onabort = function (response) { _.isFunction(onabort) && onabort.call(this, response); observer.error(response); observer.complete(); }; options.ontimeout = function (response) { _.isFunction(ontimeout) && ontimeout.call(this, response); observer.error(response); observer.complete(); }; GM_xmlhttpRequest(_.extend({}, options)); }); }; Http.prototype.get = function (url, options) { var requestOptions = _.extend(options || {}, { url: url, method: 'GET' }); return this.request(requestOptions); }; Http.prototype.post = function (url, data, options) { return this.request(_.extend(options || {}, { url: url, method: 'POST', data: data })); }; Http.prototype.head = function (url, options) { return this.request(_.extend(options || {}, { url: url, method: 'HEAD' })); }; return Http; }()); var timeout = 2000; exports.timeout = timeout; var http = new Http({ timeout: timeout }); exports.http = http; /***/ }, /* 26 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var http_1 = __webpack_require__(25); var config_1 = __webpack_require__(15); var DEBUG = config_1.CONFIG.debug; var status = { ing: 'redirect-ing', done: 'redirect-done' }; var inview; var RedirectOnRequest = (function () { function RedirectOnRequest(domainTester, urlTester, matcher, ASelector) { this.domainTester = domainTester; this.urlTester = urlTester; this.matcher = matcher; this.ASelector = ASelector; this.DEBUG = DEBUG; this.status = status; this.logCount = 0; this.ASelector = this.ASelector || 'a'; this.match = domainTester.test(document.domain); } RedirectOnRequest.prototype.resHandler = function (res) { return res; }; RedirectOnRequest.prototype.handlerOneEle = function (aElement) { var _this = this; if (!this.urlTester.test(aElement.href) || aElement.getAttribute(status.ing) || aElement.getAttribute(status.done)) return; var url = aElement.href.replace(/^https?/, location.protocol.replace(/:$/, '')) + ("×tamp=" + new Date().getTime()); aElement.style.cursor = 'progress'; aElement.setAttribute(status.ing, '1'); http_1.http.get(url) .retry(2) .timeout(http_1.timeout) .map(function (res) { return _this.resHandler(res); }) .subscribe(function (res) { aElement.href = res.finalUrl; aElement.removeAttribute(status.ing); aElement.setAttribute(status.done, '1'); DEBUG && (aElement.style.backgroundColor = 'green'); }, function (err) { aElement.style.cursor = null; aElement.removeAttribute(status.ing); }, function () { aElement.style.cursor = null; aElement.removeAttribute(status.ing); }); }; RedirectOnRequest.prototype.handlerOneEleOneByOne = function () { var _this = this; Observable_1.Observable.from([].slice.call(document.querySelectorAll(this.ASelector))) .subscribe(function (aElement) { inview && inview.is(aElement) && _this.handlerOneEle(aElement); }); }; RedirectOnRequest.prototype.handlerAll = function () { var agm = []; for (var _i = 0; _i < arguments.length; _i++) { agm[_i - 0] = arguments[_i]; } }; RedirectOnRequest.prototype.handlerAllOne = function () { var agm = []; for (var _i = 0; _i < arguments.length; _i++) { agm[_i - 0] = arguments[_i]; } }; RedirectOnRequest.prototype.scroll = function () { var _this = this; return Observable_1.Observable.fromEvent(window, 'scroll') .debounce(function () { return Observable_1.Observable.timer(200); }) .subscribe(function () { _this.handlerOneEleOneByOne(); }); }; RedirectOnRequest.prototype.mouseover = function () { var _this = this; return Observable_1.Observable.fromEvent(document, 'mousemove') .throttle(function () { return Observable_1.Observable.timer(100); }) .map(function (event) { var target = event.toElement; return target.nodeName === 'A' ? target : target.parentNode.nodeName === 'A' ? target.parentNode : target; }) .filter(function (ele) { return ele.nodeName === 'A'; }) .subscribe(function (aEle) { _this.handlerOneEle(aEle); }); }; RedirectOnRequest.prototype.log = function (project) { if (this.logCount < 1) { console.log("%c Anti-Redirect %c Copyright \xa9 2015-%s %s", 'font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;font-size:64px;color:#00bbee;-webkit-text-fill-color:#00bbee;-webkit-text-stroke: 1px #00bbee;', "font-size:12px;color:#999999;", (new Date).getFullYear(), '\n' + (project || '')); this.logCount++; } }; RedirectOnRequest.prototype.bootstrap = function () { var _this = this; if (!this.match) return; Observable_1.Observable.fromEvent(document, 'DOMContentLoaded') .debounce(function () { return Observable_1.Observable.timer(200); }) .delay(200) .flatMap(function () { return Observable_1.Observable.create(function (observer) { new MutationObserver(function (mutations) { if (mutations === void 0) { mutations = []; } if (!mutations.length) return; observer.next(); }).observe(document.body, { childList: true }); }).debounce(function () { return Observable_1.Observable.timer(100); }); }) .subscribe(function () { inview = __webpack_require__(16); inview(_this.ASelector) .on('enter', function (aEle) { _this.handlerOneEle(aEle); }); _this.scroll(); _this.mouseover(); _this.handlerAll(); _this.handlerOneEleOneByOne(); _this.log(); }); }; return RedirectOnRequest; }()); exports.RedirectOnRequest = RedirectOnRequest; /***/ }, /* 27 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var forkJoin_1 = __webpack_require__(60); Observable_1.Observable.forkJoin = forkJoin_1.forkJoin; //# sourceMappingURL=forkJoin.js.map /***/ }, /* 28 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var from_1 = __webpack_require__(61); Observable_1.Observable.from = from_1.from; //# sourceMappingURL=from.js.map /***/ }, /* 29 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var fromEvent_1 = __webpack_require__(62); Observable_1.Observable.fromEvent = fromEvent_1.fromEvent; //# sourceMappingURL=fromEvent.js.map /***/ }, /* 30 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var of_1 = __webpack_require__(63); Observable_1.Observable.of = of_1.of; //# sourceMappingURL=of.js.map /***/ }, /* 31 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var timer_1 = __webpack_require__(64); Observable_1.Observable.timer = timer_1.timer; //# sourceMappingURL=timer.js.map /***/ }, /* 32 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var debounce_1 = __webpack_require__(65); Observable_1.Observable.prototype.debounce = debounce_1.debounce; //# sourceMappingURL=debounce.js.map /***/ }, /* 33 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var debounceTime_1 = __webpack_require__(66); Observable_1.Observable.prototype.debounceTime = debounceTime_1.debounceTime; //# sourceMappingURL=debounceTime.js.map /***/ }, /* 34 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var delay_1 = __webpack_require__(67); Observable_1.Observable.prototype.delay = delay_1.delay; //# sourceMappingURL=delay.js.map /***/ }, /* 35 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var do_1 = __webpack_require__(68); Observable_1.Observable.prototype.do = do_1._do; Observable_1.Observable.prototype._do = do_1._do; //# sourceMappingURL=do.js.map /***/ }, /* 36 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var filter_1 = __webpack_require__(69); Observable_1.Observable.prototype.filter = filter_1.filter; //# sourceMappingURL=filter.js.map /***/ }, /* 37 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var map_1 = __webpack_require__(70); Observable_1.Observable.prototype.map = map_1.map; //# sourceMappingURL=map.js.map /***/ }, /* 38 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var mergeMap_1 = __webpack_require__(71); Observable_1.Observable.prototype.mergeMap = mergeMap_1.mergeMap; Observable_1.Observable.prototype.flatMap = mergeMap_1.mergeMap; //# sourceMappingURL=mergeMap.js.map /***/ }, /* 39 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var retry_1 = __webpack_require__(73); Observable_1.Observable.prototype.retry = retry_1.retry; //# sourceMappingURL=retry.js.map /***/ }, /* 40 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var throttle_1 = __webpack_require__(74); Observable_1.Observable.prototype.throttle = throttle_1.throttle; //# sourceMappingURL=throttle.js.map /***/ }, /* 41 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Observable_1 = __webpack_require__(0); var timeout_1 = __webpack_require__(75); Observable_1.Observable.prototype.timeout = timeout_1.timeout; //# sourceMappingURL=timeout.js.map /***/ }, /* 42 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_request_1 = __webpack_require__(26); var BaiduVideoRedirect = (function (_super) { __extends(BaiduVideoRedirect, _super); function BaiduVideoRedirect(domainTester, urlTester, matcher, ASelector) { if (ASelector === void 0) { ASelector = 'a'; } return _super.call(this, domainTester, urlTester, matcher, ASelector) || this; } BaiduVideoRedirect.prototype.resHandler = function (res) { var url = res.response.match(/URL='(.*)'/); if (url.length && url[1]) { res.finalUrl = url[1]; } return res; }; return BaiduVideoRedirect; }(redirect_on_request_1.RedirectOnRequest)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new BaiduVideoRedirect(/v.baidu\.com/, /v\.baidu\.com\/link\?url=/, null); /***/ }, /* 43 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 http_1 = __webpack_require__(25); var query_1 = __webpack_require__(84); var redirect_on_request_1 = __webpack_require__(26); function getText(htmlElement) { return htmlElement.innerText || htmlElement.textContent; } var BaiduRedirect = (function (_super) { __extends(BaiduRedirect, _super); function BaiduRedirect(domainTester, urlTester, matcher, ASelector) { if (ASelector === void 0) { ASelector = 'a'; } return _super.call(this, domainTester, urlTester, matcher, ASelector) || this; } BaiduRedirect.prototype.resHandler = function (res) { if (this.urlTester.test(res.finalUrl)) { if (!res.response || /<\/noscript>$/.test(res.response.trim())) throw res; var url = res.response.match(/URL=\'?https?:\/\/[^'"]+/).join('').match(/https?:\/\/[^'"]+/)[0]; if (!url || !/^https?/.test(url) || this.urlTester.test(url)) throw res; res.finalUrl = url; } return res; }; BaiduRedirect.prototype.handlerAll = function () { var _this = this; if (!/www\.baidu\.com\/s/.test(window.top.location.href)) return; var query = new query_1.default(window.top.location.search); var skip = query.object.pn || 0; query.object.tn = 'baidulocal'; query.object.timestamp = new Date().getTime(); query.object.rn = 50; var url = location.protocol.replace(/:/, '') + "://" + (location.host + location.pathname + query); Observable_1.Observable.forkJoin(http_1.http.get(url), http_1.http.get(url.replace(/pn=(\d+)/, "pn=" + (skip + 10)))).retry(2) .timeout(http_1.timeout) .subscribe(function (resList) { if (!resList || !resList.length) return; resList.forEach(function (res) { return _this.handlerAllOne(res); }); }); }; BaiduRedirect.prototype.handlerAllOne = function (res) { var _this = this; var responseText = res.responseText.replace(/(src=[^>]*|link=[^>])/g, ''); var html = document.createElement('html'); html.innerHTML = responseText; Observable_1.Observable.of(html.querySelectorAll('.f>a')) .map(function (nodeList) { return [].slice.call(nodeList).map(function (ele) { var local = [].slice.call(document.querySelectorAll('.t>a')).find(function (remoteEle) { return getText(remoteEle) === getText(ele); }); return local ? { local: local, remote: ele } : void 0; }) .filter(function (v) { return !!v; }); }) .subscribe(function (items) { items.filter(function (item) { return !_this.urlTester.test(item.remote.href); }) .forEach(function (item) { item.local.href = item.remote.href; item.local.setAttribute(_this.status.done, '1'); _this.DEBUG && (item.local.style.backgroundColor = 'red'); }); }); }; return BaiduRedirect; }(redirect_on_request_1.RedirectOnRequest)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new BaiduRedirect(/www\.baidu\.com/, /www\.baidu\.com\/link\?url=/, null, '#content_left a'); /***/ }, /* 44 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 config_1 = __webpack_require__(15); var DEBUG = config_1.CONFIG.debug; var redirect_on_url_1 = __webpack_require__(3); var GoogleRedirect = (function (_super) { __extends(GoogleRedirect, _super); function GoogleRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } GoogleRedirect.prototype.handlerOneEle = function (aEle) { return Observable_1.Observable.of(aEle) .subscribe(function (aEle) { if (aEle.getAttribute('onmousedown')) { aEle.removeAttribute('onmousedown'); DEBUG && (aEle.style.backgroundColor = 'green'); } if (aEle.getAttribute('data-href')) { aEle.href = aEle.getAttribute('data-href'); DEBUG && (aEle.style.backgroundColor = 'green'); } }); }; return GoogleRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new GoogleRedirect(/www\.google\./, null, null); /***/ }, /* 45 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var SoRedirect = (function (_super) { __extends(SoRedirect, _super); function SoRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } return SoRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new SoRedirect(/www\.so\.com/, /so\.com\/link\?url=/, /so\.com\/link\?url=(.*)/); /***/ }, /* 46 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var BaiduTiebaRedirect = (function (_super) { __extends(BaiduTiebaRedirect, _super); function BaiduTiebaRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } BaiduTiebaRedirect.prototype.handlerOneEle = function (aEle) { var _this = this; return Observable_1.Observable.of(aEle) .filter(function (ele) { return _this.urlTester.test(ele.href); }) .subscribe(function (aEle) { var url = ''; var text = aEle.innerText || aEle.textContent; try { url = decodeURIComponent(aEle.innerText || aEle.textContent); } catch (e) { url = /https?:\/\//.test(text) ? text : ''; } if (url) { aEle.href = url; _this.DEBUG && (aEle.style.backgroundColor = 'green'); } }); }; return BaiduTiebaRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new BaiduTiebaRedirect(/tieba\.baidu\.com/, /jump\.bdimg\.com/, null); /***/ }, /* 47 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var TwitterRedirect = (function (_super) { __extends(TwitterRedirect, _super); function TwitterRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } TwitterRedirect.prototype.handlerOneEle = function (aEle) { var _this = this; return Observable_1.Observable.of(aEle) .filter(function (ele) { return _this.urlTester.test(ele.href) && /^https?:\/\//.test(ele.title); }) .subscribe(function (aEle) { var url = decodeURIComponent(aEle.title); if (url) { aEle.href = url; _this.DEBUG && (aEle.style.backgroundColor = 'green'); } }); }; return TwitterRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new TwitterRedirect(/twitter\.com/, /t\.co\/\w+/, null); /***/ }, /* 48 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var WeiboRedirect = (function (_super) { __extends(WeiboRedirect, _super); function WeiboRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } WeiboRedirect.prototype.handlerOneEle = function (aEle) { var _this = this; return Observable_1.Observable.of(aEle) .filter(function (ele) { return _this.urlTester.test(ele.href) && /^https?:\/\//.test(ele.title); }) .subscribe(function (aEle) { var url = decodeURIComponent(aEle.title); if (url) { aEle.href = url; _this.DEBUG && (aEle.style.backgroundColor = 'green'); } }); }; return WeiboRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new WeiboRedirect(/weibo\.com/, /t\.cn\/\w+/, null); /***/ }, /* 49 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var ZhihuDailyRedirect = (function (_super) { __extends(ZhihuDailyRedirect, _super); function ZhihuDailyRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } return ZhihuDailyRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new ZhihuDailyRedirect(/daily\.zhihu\.com/, /zhihu\.com\/\?target=/, /zhihu\.com\/\?target=(.*)/); /***/ }, /* 50 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 redirect_on_url_1 = __webpack_require__(3); var ZhihuRedirect = (function (_super) { __extends(ZhihuRedirect, _super); function ZhihuRedirect(domainTester, urlTester, matcher) { return _super.call(this, domainTester, urlTester, matcher) || this; } return ZhihuRedirect; }(redirect_on_url_1.RedirectOnUrl)); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = new ZhihuRedirect(/www\.zhihu\.com/, /zhihu\.com\/\?target=/, /zhihu\.com\/\?target=(.*)/); /***/ }, /* 51 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var InnerSubscriber = (function (_super) { __extends(InnerSubscriber, _super); function InnerSubscriber(parent, outerValue, outerIndex) { _super.call(this); this.parent = parent; this.outerValue = outerValue; this.outerIndex = outerIndex; this.index = 0; } InnerSubscriber.prototype._next = function (value) { this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this); }; InnerSubscriber.prototype._error = function (error) { this.parent.notifyError(error, this); this.unsubscribe(); }; InnerSubscriber.prototype._complete = function () { this.parent.notifyComplete(this); this.unsubscribe(); }; return InnerSubscriber; }(Subscriber_1.Subscriber)); exports.InnerSubscriber = InnerSubscriber; //# sourceMappingURL=InnerSubscriber.js.map /***/ }, /* 52 */ /***/ function(module, exports) { "use strict"; "use strict"; /** * An execution context and a data structure to order tasks and schedule their * execution. Provides a notion of (potentially virtual) time, through the * `now()` getter method. * * Each unit of work in a Scheduler is called an {@link Action}. * * ```ts * class Scheduler { * now(): number; * schedule(work, delay?, state?): Subscription; * } * ``` * * @class Scheduler */ var Scheduler = (function () { function Scheduler(SchedulerAction, now) { if (now === void 0) { now = Scheduler.now; } this.SchedulerAction = SchedulerAction; this.now = now; } /** * Schedules a function, `work`, for execution. May happen at some point in * the future, according to the `delay` parameter, if specified. May be passed * some context object, `state`, which will be passed to the `work` function. * * The given arguments will be processed an stored as an Action object in a * queue of actions. * * @param {function(state: ?T): ?Subscription} work A function representing a * task, or some unit of work to be executed by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler itself. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @return {Subscription} A subscription in order to be able to unsubscribe * the scheduled work. */ Scheduler.prototype.schedule = function (work, delay, state) { if (delay === void 0) { delay = 0; } return new this.SchedulerAction(this, work).schedule(state, delay); }; Scheduler.now = Date.now ? Date.now : function () { return +new Date(); }; return Scheduler; }()); exports.Scheduler = Scheduler; //# sourceMappingURL=Scheduler.js.map /***/ }, /* 53 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(20); var EmptyObservable_1 = __webpack_require__(9); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ArrayLikeObservable = (function (_super) { __extends(ArrayLikeObservable, _super); function ArrayLikeObservable(arrayLike, scheduler) { _super.call(this); this.arrayLike = arrayLike; this.scheduler = scheduler; if (!scheduler && arrayLike.length === 1) { this._isScalar = true; this.value = arrayLike[0]; } } ArrayLikeObservable.create = function (arrayLike, scheduler) { var length = arrayLike.length; if (length === 0) { return new EmptyObservable_1.EmptyObservable(); } else if (length === 1) { return new ScalarObservable_1.ScalarObservable(arrayLike[0], scheduler); } else { return new ArrayLikeObservable(arrayLike, scheduler); } }; ArrayLikeObservable.dispatch = function (state) { var arrayLike = state.arrayLike, index = state.index, length = state.length, subscriber = state.subscriber; if (subscriber.closed) { return; } if (index >= length) { subscriber.complete(); return; } subscriber.next(arrayLike[index]); state.index = index + 1; this.schedule(state); }; ArrayLikeObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, arrayLike = _a.arrayLike, scheduler = _a.scheduler; var length = arrayLike.length; if (scheduler) { return scheduler.schedule(ArrayLikeObservable.dispatch, 0, { arrayLike: arrayLike, index: index, length: length, subscriber: subscriber }); } else { for (var i = 0; i < length && !subscriber.closed; i++) { subscriber.next(arrayLike[i]); } subscriber.complete(); } }; return ArrayLikeObservable; }(Observable_1.Observable)); exports.ArrayLikeObservable = ArrayLikeObservable; //# sourceMappingURL=ArrayLikeObservable.js.map /***/ }, /* 54 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 EmptyObservable_1 = __webpack_require__(9); var isArray_1 = __webpack_require__(4); var subscribeToResult_1 = __webpack_require__(7); var OuterSubscriber_1 = __webpack_require__(5); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var ForkJoinObservable = (function (_super) { __extends(ForkJoinObservable, _super); function ForkJoinObservable(sources, resultSelector) { _super.call(this); this.sources = sources; this.resultSelector = resultSelector; } /* tslint:enable:max-line-length */ /** * @param sources * @return {any} * @static true * @name forkJoin * @owner Observable */ ForkJoinObservable.create = function () { var sources = []; for (var _i = 0; _i < arguments.length; _i++) { sources[_i - 0] = arguments[_i]; } if (sources === null || arguments.length === 0) { return new EmptyObservable_1.EmptyObservable(); } var resultSelector = null; if (typeof sources[sources.length - 1] === 'function') { resultSelector = sources.pop(); } // if the first and only other argument besides the resultSelector is an array // assume it's been called with `forkJoin([obs1, obs2, obs3], resultSelector)` if (sources.length === 1 && isArray_1.isArray(sources[0])) { sources = sources[0]; } if (sources.length === 0) { return new EmptyObservable_1.EmptyObservable(); } return new ForkJoinObservable(sources, resultSelector); }; ForkJoinObservable.prototype._subscribe = function (subscriber) { return new ForkJoinSubscriber(subscriber, this.sources, this.resultSelector); }; return ForkJoinObservable; }(Observable_1.Observable)); exports.ForkJoinObservable = ForkJoinObservable; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ForkJoinSubscriber = (function (_super) { __extends(ForkJoinSubscriber, _super); function ForkJoinSubscriber(destination, sources, resultSelector) { _super.call(this, destination); this.sources = sources; this.resultSelector = resultSelector; this.completed = 0; this.haveValues = 0; var len = sources.length; this.total = len; this.values = new Array(len); for (var i = 0; i < len; i++) { var source = sources[i]; var innerSubscription = subscribeToResult_1.subscribeToResult(this, source, null, i); if (innerSubscription) { innerSubscription.outerIndex = i; this.add(innerSubscription); } } } ForkJoinSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.values[outerIndex] = innerValue; if (!innerSub._hasValue) { innerSub._hasValue = true; this.haveValues++; } }; ForkJoinSubscriber.prototype.notifyComplete = function (innerSub) { var destination = this.destination; var _a = this, haveValues = _a.haveValues, resultSelector = _a.resultSelector, values = _a.values; var len = values.length; if (!innerSub._hasValue) { destination.complete(); return; } this.completed++; if (this.completed !== len) { return; } if (haveValues === len) { var value = resultSelector ? resultSelector.apply(this, values) : values; destination.next(value); } destination.complete(); }; return ForkJoinSubscriber; }(OuterSubscriber_1.OuterSubscriber)); //# sourceMappingURL=ForkJoinObservable.js.map /***/ }, /* 55 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 tryCatch_1 = __webpack_require__(24); var isFunction_1 = __webpack_require__(14); var errorObject_1 = __webpack_require__(12); var Subscription_1 = __webpack_require__(8); function isNodeStyleEventEmmitter(sourceObj) { return !!sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function'; } function isJQueryStyleEventEmitter(sourceObj) { return !!sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function'; } function isNodeList(sourceObj) { return !!sourceObj && sourceObj.toString() === '[object NodeList]'; } function isHTMLCollection(sourceObj) { return !!sourceObj && sourceObj.toString() === '[object HTMLCollection]'; } function isEventTarget(sourceObj) { return !!sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function'; } /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromEventObservable = (function (_super) { __extends(FromEventObservable, _super); function FromEventObservable(sourceObj, eventName, selector, options) { _super.call(this); this.sourceObj = sourceObj; this.eventName = eventName; this.selector = selector; this.options = options; } /* tslint:enable:max-line-length */ /** * Creates an Observable that emits events of a specific type coming from the * given event target. * * Creates an Observable from DOM events, or Node * EventEmitter events or others. * * * * Creates an Observable by attaching an event listener to an "event target", * which may be an object with `addEventListener` and `removeEventListener`, * a Node.js EventEmitter, a jQuery style EventEmitter, a NodeList from the * DOM, or an HTMLCollection from the DOM. The event handler is attached when * the output Observable is subscribed, and removed when the Subscription is * unsubscribed. * * @example Emits clicks happening on the DOM document * var clicks = Rx.Observable.fromEvent(document, 'click'); * clicks.subscribe(x => console.log(x)); * * @see {@link from} * @see {@link fromEventPattern} * * @param {EventTargetLike} target The DOMElement, event target, Node.js * EventEmitter, NodeList or HTMLCollection to attach the event handler to. * @param {string} eventName The event name of interest, being emitted by the * `target`. * @param {EventListenerOptions} [options] Options to pass through to addEventListener * @param {SelectorMethodSignature} [selector] An optional function to * post-process results. It takes the arguments from the event handler and * should return a single value. * @return {Observable} * @static true * @name fromEvent * @owner Observable */ FromEventObservable.create = function (target, eventName, options, selector) { if (isFunction_1.isFunction(options)) { selector = options; options = undefined; } return new FromEventObservable(target, eventName, selector, options); }; FromEventObservable.setupSubscription = function (sourceObj, eventName, handler, subscriber, options) { var unsubscribe; if (isNodeList(sourceObj) || isHTMLCollection(sourceObj)) { for (var i = 0, len = sourceObj.length; i < len; i++) { FromEventObservable.setupSubscription(sourceObj[i], eventName, handler, subscriber, options); } } else if (isEventTarget(sourceObj)) { var source_1 = sourceObj; sourceObj.addEventListener(eventName, handler, options); unsubscribe = function () { return source_1.removeEventListener(eventName, handler); }; } else if (isJQueryStyleEventEmitter(sourceObj)) { var source_2 = sourceObj; sourceObj.on(eventName, handler); unsubscribe = function () { return source_2.off(eventName, handler); }; } else if (isNodeStyleEventEmmitter(sourceObj)) { var source_3 = sourceObj; sourceObj.addListener(eventName, handler); unsubscribe = function () { return source_3.removeListener(eventName, handler); }; } else { throw new TypeError('Invalid event target'); } subscriber.add(new Subscription_1.Subscription(unsubscribe)); }; FromEventObservable.prototype._subscribe = function (subscriber) { var sourceObj = this.sourceObj; var eventName = this.eventName; var options = this.options; var selector = this.selector; var handler = selector ? function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i - 0] = arguments[_i]; } var result = tryCatch_1.tryCatch(selector).apply(void 0, args); if (result === errorObject_1.errorObject) { subscriber.error(errorObject_1.errorObject.e); } else { subscriber.next(result); } } : function (e) { return subscriber.next(e); }; FromEventObservable.setupSubscription(sourceObj, eventName, handler, subscriber, options); }; return FromEventObservable; }(Observable_1.Observable)); exports.FromEventObservable = FromEventObservable; //# sourceMappingURL=FromEventObservable.js.map /***/ }, /* 56 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 isArray_1 = __webpack_require__(4); var isPromise_1 = __webpack_require__(22); var PromiseObservable_1 = __webpack_require__(58); var IteratorObservable_1 = __webpack_require__(57); var ArrayObservable_1 = __webpack_require__(19); var ArrayLikeObservable_1 = __webpack_require__(53); var iterator_1 = __webpack_require__(10); var Observable_1 = __webpack_require__(0); var observeOn_1 = __webpack_require__(72); var observable_1 = __webpack_require__(11); var isArrayLike = (function (x) { return x && typeof x.length === 'number'; }); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var FromObservable = (function (_super) { __extends(FromObservable, _super); function FromObservable(ish, scheduler) { _super.call(this, null); this.ish = ish; this.scheduler = scheduler; } /** * Creates an Observable from an Array, an array-like object, a Promise, an * iterable object, or an Observable-like object. * * Converts almost anything to an Observable. * * * * Convert various other objects and data types into Observables. `from` * converts a Promise or an array-like or an * [iterable](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols#iterable) * object into an Observable that emits the items in that promise or array or * iterable. A String, in this context, is treated as an array of characters. * Observable-like objects (contains a function named with the ES2015 Symbol * for Observable) can also be converted through this operator. * * @example Converts an array to an Observable * var array = [10, 20, 30]; * var result = Rx.Observable.from(array); * result.subscribe(x => console.log(x)); * * @example Convert an infinite iterable (from a generator) to an Observable * function* generateDoubles(seed) { * var i = seed; * while (true) { * yield i; * i = 2 * i; // double it * } * } * * var iterator = generateDoubles(3); * var result = Rx.Observable.from(iterator).take(10); * result.subscribe(x => console.log(x)); * * @see {@link create} * @see {@link fromEvent} * @see {@link fromEventPattern} * @see {@link fromPromise} * * @param {ObservableInput} ish A subscribable object, a Promise, an * Observable-like, an Array, an iterable or an array-like object to be * converted. * @param {Scheduler} [scheduler] The scheduler on which to schedule the * emissions of values. * @return {Observable} The Observable whose values are originally from the * input object that was converted. * @static true * @name from * @owner Observable */ FromObservable.create = function (ish, scheduler) { if (ish != null) { if (typeof ish[observable_1.$$observable] === 'function') { if (ish instanceof Observable_1.Observable && !scheduler) { return ish; } return new FromObservable(ish, scheduler); } else if (isArray_1.isArray(ish)) { return new ArrayObservable_1.ArrayObservable(ish, scheduler); } else if (isPromise_1.isPromise(ish)) { return new PromiseObservable_1.PromiseObservable(ish, scheduler); } else if (typeof ish[iterator_1.$$iterator] === 'function' || typeof ish === 'string') { return new IteratorObservable_1.IteratorObservable(ish, scheduler); } else if (isArrayLike(ish)) { return new ArrayLikeObservable_1.ArrayLikeObservable(ish, scheduler); } } throw new TypeError((ish !== null && typeof ish || ish) + ' is not observable'); }; FromObservable.prototype._subscribe = function (subscriber) { var ish = this.ish; var scheduler = this.scheduler; if (scheduler == null) { return ish[observable_1.$$observable]().subscribe(subscriber); } else { return ish[observable_1.$$observable]().subscribe(new observeOn_1.ObserveOnSubscriber(subscriber, scheduler, 0)); } }; return FromObservable; }(Observable_1.Observable)); exports.FromObservable = FromObservable; //# sourceMappingURL=FromObservable.js.map /***/ }, /* 57 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(2); var Observable_1 = __webpack_require__(0); var iterator_1 = __webpack_require__(10); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var IteratorObservable = (function (_super) { __extends(IteratorObservable, _super); function IteratorObservable(iterator, scheduler) { _super.call(this); this.scheduler = scheduler; if (iterator == null) { throw new Error('iterator cannot be null.'); } this.iterator = getIterator(iterator); } IteratorObservable.create = function (iterator, scheduler) { return new IteratorObservable(iterator, scheduler); }; IteratorObservable.dispatch = function (state) { var index = state.index, hasError = state.hasError, iterator = state.iterator, subscriber = state.subscriber; if (hasError) { subscriber.error(state.error); return; } var result = iterator.next(); if (result.done) { subscriber.complete(); return; } subscriber.next(result.value); state.index = index + 1; if (subscriber.closed) { if (typeof iterator.return === 'function') { iterator.return(); } return; } this.schedule(state); }; IteratorObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, iterator = _a.iterator, scheduler = _a.scheduler; if (scheduler) { return scheduler.schedule(IteratorObservable.dispatch, 0, { index: index, iterator: iterator, subscriber: subscriber }); } else { do { var result = iterator.next(); if (result.done) { subscriber.complete(); break; } else { subscriber.next(result.value); } if (subscriber.closed) { if (typeof iterator.return === 'function') { iterator.return(); } break; } } while (true); } }; return IteratorObservable; }(Observable_1.Observable)); exports.IteratorObservable = IteratorObservable; var StringIterator = (function () { function StringIterator(str, idx, len) { if (idx === void 0) { idx = 0; } if (len === void 0) { len = str.length; } this.str = str; this.idx = idx; this.len = len; } StringIterator.prototype[iterator_1.$$iterator] = function () { return (this); }; StringIterator.prototype.next = function () { return this.idx < this.len ? { done: false, value: this.str.charAt(this.idx++) } : { done: true, value: undefined }; }; return StringIterator; }()); var ArrayIterator = (function () { function ArrayIterator(arr, idx, len) { if (idx === void 0) { idx = 0; } if (len === void 0) { len = toLength(arr); } this.arr = arr; this.idx = idx; this.len = len; } ArrayIterator.prototype[iterator_1.$$iterator] = function () { return this; }; ArrayIterator.prototype.next = function () { return this.idx < this.len ? { done: false, value: this.arr[this.idx++] } : { done: true, value: undefined }; }; return ArrayIterator; }()); function getIterator(obj) { var i = obj[iterator_1.$$iterator]; if (!i && typeof obj === 'string') { return new StringIterator(obj); } if (!i && obj.length !== undefined) { return new ArrayIterator(obj); } if (!i) { throw new TypeError('object is not iterable'); } return obj[iterator_1.$$iterator](); } var maxSafeInteger = Math.pow(2, 53) - 1; function toLength(o) { var len = +o.length; if (isNaN(len)) { return 0; } if (len === 0 || !numberIsFinite(len)) { return len; } len = sign(len) * Math.floor(Math.abs(len)); if (len <= 0) { return 0; } if (len > maxSafeInteger) { return maxSafeInteger; } return len; } function numberIsFinite(value) { return typeof value === 'number' && root_1.root.isFinite(value); } function sign(value) { var valueAsNumber = +value; if (valueAsNumber === 0) { return valueAsNumber; } if (isNaN(valueAsNumber)) { return valueAsNumber; } return valueAsNumber < 0 ? -1 : 1; } //# sourceMappingURL=IteratorObservable.js.map /***/ }, /* 58 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(2); var Observable_1 = __webpack_require__(0); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var PromiseObservable = (function (_super) { __extends(PromiseObservable, _super); function PromiseObservable(promise, scheduler) { _super.call(this); this.promise = promise; this.scheduler = scheduler; } /** * Converts a Promise to an Observable. * * Returns an Observable that just emits the Promise's * resolved value, then completes. * * Converts an ES2015 Promise or a Promises/A+ spec compliant Promise to an * Observable. If the Promise resolves with a value, the output Observable * emits that resolved value as a `next`, and then completes. If the Promise * is rejected, then the output Observable emits the corresponding Error. * * @example Convert the Promise returned by Fetch to an Observable * var result = Rx.Observable.fromPromise(fetch('http://myserver.com/')); * result.subscribe(x => console.log(x), e => console.error(e)); * * @see {@link bindCallback} * @see {@link from} * * @param {Promise} promise The promise to be converted. * @param {Scheduler} [scheduler] An optional Scheduler to use for scheduling * the delivery of the resolved value (or the rejection). * @return {Observable} An Observable which wraps the Promise. * @static true * @name fromPromise * @owner Observable */ PromiseObservable.create = function (promise, scheduler) { return new PromiseObservable(promise, scheduler); }; PromiseObservable.prototype._subscribe = function (subscriber) { var _this = this; var promise = this.promise; var scheduler = this.scheduler; if (scheduler == null) { if (this._isScalar) { if (!subscriber.closed) { subscriber.next(this.value); subscriber.complete(); } } else { promise.then(function (value) { _this.value = value; _this._isScalar = true; if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } }, function (err) { if (!subscriber.closed) { subscriber.error(err); } }) .then(null, function (err) { // escape the promise trap, throw unhandled errors root_1.root.setTimeout(function () { throw err; }); }); } } else { if (this._isScalar) { if (!subscriber.closed) { return scheduler.schedule(dispatchNext, 0, { value: this.value, subscriber: subscriber }); } } else { promise.then(function (value) { _this.value = value; _this._isScalar = true; if (!subscriber.closed) { subscriber.add(scheduler.schedule(dispatchNext, 0, { value: value, subscriber: subscriber })); } }, function (err) { if (!subscriber.closed) { subscriber.add(scheduler.schedule(dispatchError, 0, { err: err, subscriber: subscriber })); } }) .then(null, function (err) { // escape the promise trap, throw unhandled errors root_1.root.setTimeout(function () { throw err; }); }); } } }; return PromiseObservable; }(Observable_1.Observable)); exports.PromiseObservable = PromiseObservable; function dispatchNext(arg) { var value = arg.value, subscriber = arg.subscriber; if (!subscriber.closed) { subscriber.next(value); subscriber.complete(); } } function dispatchError(arg) { var err = arg.err, subscriber = arg.subscriber; if (!subscriber.closed) { subscriber.error(err); } } //# sourceMappingURL=PromiseObservable.js.map /***/ }, /* 59 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 isNumeric_1 = __webpack_require__(81); var Observable_1 = __webpack_require__(0); var async_1 = __webpack_require__(6); var isScheduler_1 = __webpack_require__(23); var isDate_1 = __webpack_require__(13); /** * We need this JSDoc comment for affecting ESDoc. * @extends {Ignored} * @hide true */ var TimerObservable = (function (_super) { __extends(TimerObservable, _super); function TimerObservable(dueTime, period, scheduler) { if (dueTime === void 0) { dueTime = 0; } _super.call(this); this.period = -1; this.dueTime = 0; if (isNumeric_1.isNumeric(period)) { this.period = Number(period) < 1 && 1 || Number(period); } else if (isScheduler_1.isScheduler(period)) { scheduler = period; } if (!isScheduler_1.isScheduler(scheduler)) { scheduler = async_1.async; } this.scheduler = scheduler; this.dueTime = isDate_1.isDate(dueTime) ? (+dueTime - this.scheduler.now()) : dueTime; } /** * Creates an Observable that starts emitting after an `initialDelay` and * emits ever increasing numbers after each `period` of time thereafter. * * Its like {@link interval}, but you can specify when * should the emissions start. * * * * `timer` returns an Observable that emits an infinite sequence of ascending * integers, with a constant interval of time, `period` of your choosing * between those emissions. The first emission happens after the specified * `initialDelay`. The initial delay may be a {@link Date}. By default, this * operator uses the `async` Scheduler to provide a notion of time, but you * may pass any Scheduler to it. If `period` is not specified, the output * Observable emits only one value, `0`. Otherwise, it emits an infinite * sequence. * * @example Emits ascending numbers, one every second (1000ms), starting after 3 seconds * var numbers = Rx.Observable.timer(3000, 1000); * numbers.subscribe(x => console.log(x)); * * @example Emits one number after five seconds * var numbers = Rx.Observable.timer(5000); * numbers.subscribe(x => console.log(x)); * * @see {@link interval} * @see {@link delay} * * @param {number|Date} initialDelay The initial delay time to wait before * emitting the first value of `0`. * @param {number} [period] The period of time between emissions of the * subsequent numbers. * @param {Scheduler} [scheduler=async] The Scheduler to use for scheduling * the emission of values, and providing a notion of "time". * @return {Observable} An Observable that emits a `0` after the * `initialDelay` and ever increasing numbers after each `period` of time * thereafter. * @static true * @name timer * @owner Observable */ TimerObservable.create = function (initialDelay, period, scheduler) { if (initialDelay === void 0) { initialDelay = 0; } return new TimerObservable(initialDelay, period, scheduler); }; TimerObservable.dispatch = function (state) { var index = state.index, period = state.period, subscriber = state.subscriber; var action = this; subscriber.next(index); if (subscriber.closed) { return; } else if (period === -1) { return subscriber.complete(); } state.index = index + 1; action.schedule(state, period); }; TimerObservable.prototype._subscribe = function (subscriber) { var index = 0; var _a = this, period = _a.period, dueTime = _a.dueTime, scheduler = _a.scheduler; return scheduler.schedule(TimerObservable.dispatch, dueTime, { index: index, period: period, subscriber: subscriber }); }; return TimerObservable; }(Observable_1.Observable)); exports.TimerObservable = TimerObservable; //# sourceMappingURL=TimerObservable.js.map /***/ }, /* 60 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var ForkJoinObservable_1 = __webpack_require__(54); exports.forkJoin = ForkJoinObservable_1.ForkJoinObservable.create; //# sourceMappingURL=forkJoin.js.map /***/ }, /* 61 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var FromObservable_1 = __webpack_require__(56); exports.from = FromObservable_1.FromObservable.create; //# sourceMappingURL=from.js.map /***/ }, /* 62 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var FromEventObservable_1 = __webpack_require__(55); exports.fromEvent = FromEventObservable_1.FromEventObservable.create; //# sourceMappingURL=fromEvent.js.map /***/ }, /* 63 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var ArrayObservable_1 = __webpack_require__(19); exports.of = ArrayObservable_1.ArrayObservable.of; //# sourceMappingURL=of.js.map /***/ }, /* 64 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var TimerObservable_1 = __webpack_require__(59); exports.timer = TimerObservable_1.TimerObservable.create; //# sourceMappingURL=timer.js.map /***/ }, /* 65 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(5); var subscribeToResult_1 = __webpack_require__(7); /** * Emits a value from the source Observable only after a particular time span * determined by another Observable has passed without another source emission. * * It's like {@link debounceTime}, but the time span of * emission silence is determined by a second Observable. * * * * `debounce` delays values emitted by the source Observable, but drops previous * pending delayed emissions if a new value arrives on the source Observable. * This operator keeps track of the most recent value from the source * Observable, and spawns a duration Observable by calling the * `durationSelector` function. The value is emitted only when the duration * Observable emits a value or completes, and if no other value was emitted on * the source Observable since the duration Observable was spawned. If a new * value appears before the duration Observable emits, the previous value will * be dropped and will not be emitted on the output Observable. * * Like {@link debounceTime}, this is a rate-limiting operator, and also a * delay-like operator since output emissions do not necessarily occur at the * same time as they did on the source Observable. * * @example Emit the most recent click after a burst of clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounce(() => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounceTime} * @see {@link delayWhen} * @see {@link throttle} * * @param {function(value: T): Observable|Promise} durationSelector A function * that receives a value from the source Observable, for computing the timeout * duration for each source value, returned as an Observable or a Promise. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified duration Observable returned by * `durationSelector`, and may drop some values if they occur too frequently. * @method debounce * @owner Observable */ function debounce(durationSelector) { return this.lift(new DebounceOperator(durationSelector)); } exports.debounce = debounce; var DebounceOperator = (function () { function DebounceOperator(durationSelector) { this.durationSelector = durationSelector; } DebounceOperator.prototype.call = function (subscriber, source) { return source._subscribe(new DebounceSubscriber(subscriber, this.durationSelector)); }; return DebounceOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceSubscriber = (function (_super) { __extends(DebounceSubscriber, _super); function DebounceSubscriber(destination, durationSelector) { _super.call(this, destination); this.durationSelector = durationSelector; this.hasValue = false; this.durationSubscription = null; } DebounceSubscriber.prototype._next = function (value) { try { var result = this.durationSelector.call(this, value); if (result) { this._tryNext(value, result); } } catch (err) { this.destination.error(err); } }; DebounceSubscriber.prototype._complete = function () { this.emitValue(); this.destination.complete(); }; DebounceSubscriber.prototype._tryNext = function (value, duration) { var subscription = this.durationSubscription; this.value = value; this.hasValue = true; if (subscription) { subscription.unsubscribe(); this.remove(subscription); } subscription = subscribeToResult_1.subscribeToResult(this, duration); if (!subscription.closed) { this.add(this.durationSubscription = subscription); } }; DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this.emitValue(); }; DebounceSubscriber.prototype.notifyComplete = function () { this.emitValue(); }; DebounceSubscriber.prototype.emitValue = function () { if (this.hasValue) { var value = this.value; var subscription = this.durationSubscription; if (subscription) { this.durationSubscription = null; subscription.unsubscribe(); this.remove(subscription); } this.value = null; this.hasValue = false; _super.prototype._next.call(this, value); } }; return DebounceSubscriber; }(OuterSubscriber_1.OuterSubscriber)); //# sourceMappingURL=debounce.js.map /***/ }, /* 66 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); var async_1 = __webpack_require__(6); /** * Emits a value from the source Observable only after a particular time span * has passed without another source emission. * * It's like {@link delay}, but passes only the most * recent value from each burst of emissions. * * * * `debounceTime` delays values emitted by the source Observable, but drops * previous pending delayed emissions if a new value arrives on the source * Observable. This operator keeps track of the most recent value from the * source Observable, and emits that only when `dueTime` enough time has passed * without any other value appearing on the source Observable. If a new value * appears before `dueTime` silence occurs, the previous value will be dropped * and will not be emitted on the output Observable. * * This is a rate-limiting operator, because it is impossible for more than one * value to be emitted in any time window of duration `dueTime`, but it is also * a delay-like operator since output emissions do not occur at the same time as * they did on the source Observable. Optionally takes a {@link Scheduler} for * managing timers. * * @example Emit the most recent click after a burst of clicks * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.debounceTime(1000); * result.subscribe(x => console.log(x)); * * @see {@link auditTime} * @see {@link debounce} * @see {@link delay} * @see {@link sampleTime} * @see {@link throttleTime} * * @param {number} dueTime The timeout duration in milliseconds (or the time * unit determined internally by the optional `scheduler`) for the window of * time required to wait for emission silence before emitting the most recent * source value. * @param {Scheduler} [scheduler=async] The {@link Scheduler} to use for * managing the timers that handle the timeout for each value. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified `dueTime`, and may drop some values if they occur * too frequently. * @method debounceTime * @owner Observable */ function debounceTime(dueTime, scheduler) { if (scheduler === void 0) { scheduler = async_1.async; } return this.lift(new DebounceTimeOperator(dueTime, scheduler)); } exports.debounceTime = debounceTime; var DebounceTimeOperator = (function () { function DebounceTimeOperator(dueTime, scheduler) { this.dueTime = dueTime; this.scheduler = scheduler; } DebounceTimeOperator.prototype.call = function (subscriber, source) { return source._subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler)); }; return DebounceTimeOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DebounceTimeSubscriber = (function (_super) { __extends(DebounceTimeSubscriber, _super); function DebounceTimeSubscriber(destination, dueTime, scheduler) { _super.call(this, destination); this.dueTime = dueTime; this.scheduler = scheduler; this.debouncedSubscription = null; this.lastValue = null; this.hasValue = false; } DebounceTimeSubscriber.prototype._next = function (value) { this.clearDebounce(); this.lastValue = value; this.hasValue = true; this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this)); }; DebounceTimeSubscriber.prototype._complete = function () { this.debouncedNext(); this.destination.complete(); }; DebounceTimeSubscriber.prototype.debouncedNext = function () { this.clearDebounce(); if (this.hasValue) { this.destination.next(this.lastValue); this.lastValue = null; this.hasValue = false; } }; DebounceTimeSubscriber.prototype.clearDebounce = function () { var debouncedSubscription = this.debouncedSubscription; if (debouncedSubscription !== null) { this.remove(debouncedSubscription); debouncedSubscription.unsubscribe(); this.debouncedSubscription = null; } }; return DebounceTimeSubscriber; }(Subscriber_1.Subscriber)); function dispatchNext(subscriber) { subscriber.debouncedNext(); } //# sourceMappingURL=debounceTime.js.map /***/ }, /* 67 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 async_1 = __webpack_require__(6); var isDate_1 = __webpack_require__(13); var Subscriber_1 = __webpack_require__(1); var Notification_1 = __webpack_require__(17); /** * Delays the emission of items from the source Observable by a given timeout or * until a given Date. * * Time shifts each item by some specified amount of * milliseconds. * * * * If the delay argument is a Number, this operator time shifts the source * Observable by that amount of time expressed in milliseconds. The relative * time intervals between the values are preserved. * * If the delay argument is a Date, this operator time shifts the start of the * Observable execution until the given date occurs. * * @example Delay each click by one second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var delayedClicks = clicks.delay(1000); // each click emitted after 1 second * delayedClicks.subscribe(x => console.log(x)); * * @example Delay all clicks until a future date happens * var clicks = Rx.Observable.fromEvent(document, 'click'); * var date = new Date('March 15, 2050 12:00:00'); // in the future * var delayedClicks = clicks.delay(date); // click emitted only after that date * delayedClicks.subscribe(x => console.log(x)); * * @see {@link debounceTime} * @see {@link delayWhen} * * @param {number|Date} delay The delay duration in milliseconds (a `number`) or * a `Date` until which the emission of the source items is delayed. * @param {Scheduler} [scheduler=async] The Scheduler to use for * managing the timers that handle the time-shift for each item. * @return {Observable} An Observable that delays the emissions of the source * Observable by the specified timeout or Date. * @method delay * @owner Observable */ function delay(delay, scheduler) { if (scheduler === void 0) { scheduler = async_1.async; } var absoluteDelay = isDate_1.isDate(delay); var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay); return this.lift(new DelayOperator(delayFor, scheduler)); } exports.delay = delay; var DelayOperator = (function () { function DelayOperator(delay, scheduler) { this.delay = delay; this.scheduler = scheduler; } DelayOperator.prototype.call = function (subscriber, source) { return source._subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler)); }; return DelayOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DelaySubscriber = (function (_super) { __extends(DelaySubscriber, _super); function DelaySubscriber(destination, delay, scheduler) { _super.call(this, destination); this.delay = delay; this.scheduler = scheduler; this.queue = []; this.active = false; this.errored = false; } DelaySubscriber.dispatch = function (state) { var source = state.source; var queue = source.queue; var scheduler = state.scheduler; var destination = state.destination; while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) { queue.shift().notification.observe(destination); } if (queue.length > 0) { var delay_1 = Math.max(0, queue[0].time - scheduler.now()); this.schedule(state, delay_1); } else { source.active = false; } }; DelaySubscriber.prototype._schedule = function (scheduler) { this.active = true; this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, { source: this, destination: this.destination, scheduler: scheduler })); }; DelaySubscriber.prototype.scheduleNotification = function (notification) { if (this.errored === true) { return; } var scheduler = this.scheduler; var message = new DelayMessage(scheduler.now() + this.delay, notification); this.queue.push(message); if (this.active === false) { this._schedule(scheduler); } }; DelaySubscriber.prototype._next = function (value) { this.scheduleNotification(Notification_1.Notification.createNext(value)); }; DelaySubscriber.prototype._error = function (err) { this.errored = true; this.queue = []; this.destination.error(err); }; DelaySubscriber.prototype._complete = function () { this.scheduleNotification(Notification_1.Notification.createComplete()); }; return DelaySubscriber; }(Subscriber_1.Subscriber)); var DelayMessage = (function () { function DelayMessage(time, notification) { this.time = time; this.notification = notification; } return DelayMessage; }()); //# sourceMappingURL=delay.js.map /***/ }, /* 68 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /* tslint:disable:max-line-length */ function _do(nextOrObserver, error, complete) { return this.lift(new DoOperator(nextOrObserver, error, complete)); } exports._do = _do; var DoOperator = (function () { function DoOperator(nextOrObserver, error, complete) { this.nextOrObserver = nextOrObserver; this.error = error; this.complete = complete; } DoOperator.prototype.call = function (subscriber, source) { return source._subscribe(new DoSubscriber(subscriber, this.nextOrObserver, this.error, this.complete)); }; return DoOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var DoSubscriber = (function (_super) { __extends(DoSubscriber, _super); function DoSubscriber(destination, nextOrObserver, error, complete) { _super.call(this, destination); var safeSubscriber = new Subscriber_1.Subscriber(nextOrObserver, error, complete); safeSubscriber.syncErrorThrowable = true; this.add(safeSubscriber); this.safeSubscriber = safeSubscriber; } DoSubscriber.prototype._next = function (value) { var safeSubscriber = this.safeSubscriber; safeSubscriber.next(value); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.next(value); } }; DoSubscriber.prototype._error = function (err) { var safeSubscriber = this.safeSubscriber; safeSubscriber.error(err); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.error(err); } }; DoSubscriber.prototype._complete = function () { var safeSubscriber = this.safeSubscriber; safeSubscriber.complete(); if (safeSubscriber.syncErrorThrown) { this.destination.error(safeSubscriber.syncErrorValue); } else { this.destination.complete(); } }; return DoSubscriber; }(Subscriber_1.Subscriber)); //# sourceMappingURL=do.js.map /***/ }, /* 69 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /* tslint:disable:max-line-length */ function filter(predicate, thisArg) { return this.lift(new FilterOperator(predicate, thisArg)); } exports.filter = filter; var FilterOperator = (function () { function FilterOperator(predicate, thisArg) { this.predicate = predicate; this.thisArg = thisArg; } FilterOperator.prototype.call = function (subscriber, source) { return source._subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg)); }; return FilterOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var FilterSubscriber = (function (_super) { __extends(FilterSubscriber, _super); function FilterSubscriber(destination, predicate, thisArg) { _super.call(this, destination); this.predicate = predicate; this.thisArg = thisArg; this.count = 0; this.predicate = predicate; } // the try catch block below is left specifically for // optimization and perf reasons. a tryCatcher is not necessary here. FilterSubscriber.prototype._next = function (value) { var result; try { result = this.predicate.call(this.thisArg, value, this.count++); } catch (err) { this.destination.error(err); return; } if (result) { this.destination.next(value); } }; return FilterSubscriber; }(Subscriber_1.Subscriber)); //# sourceMappingURL=filter.js.map /***/ }, /* 70 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /** * Applies a given `project` function to each value emitted by the source * Observable, and emits the resulting values as an Observable. * * 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. * * * * 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 Map every every click to the clientX position of that click * 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} 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 /***/ }, /* 71 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 subscribeToResult_1 = __webpack_require__(7); var OuterSubscriber_1 = __webpack_require__(5); /* tslint:disable:max-line-length */ function mergeMap(project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } if (typeof resultSelector === 'number') { concurrent = resultSelector; resultSelector = null; } return this.lift(new MergeMapOperator(project, resultSelector, concurrent)); } exports.mergeMap = mergeMap; var MergeMapOperator = (function () { function MergeMapOperator(project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } this.project = project; this.resultSelector = resultSelector; this.concurrent = concurrent; } MergeMapOperator.prototype.call = function (observer, source) { return source._subscribe(new MergeMapSubscriber(observer, this.project, this.resultSelector, this.concurrent)); }; return MergeMapOperator; }()); exports.MergeMapOperator = MergeMapOperator; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var MergeMapSubscriber = (function (_super) { __extends(MergeMapSubscriber, _super); function MergeMapSubscriber(destination, project, resultSelector, concurrent) { if (concurrent === void 0) { concurrent = Number.POSITIVE_INFINITY; } _super.call(this, destination); this.project = project; this.resultSelector = resultSelector; this.concurrent = concurrent; this.hasCompleted = false; this.buffer = []; this.active = 0; this.index = 0; } MergeMapSubscriber.prototype._next = function (value) { if (this.active < this.concurrent) { this._tryNext(value); } else { this.buffer.push(value); } }; MergeMapSubscriber.prototype._tryNext = function (value) { var result; var index = this.index++; try { result = this.project(value, index); } catch (err) { this.destination.error(err); return; } this.active++; this._innerSub(result, value, index); }; MergeMapSubscriber.prototype._innerSub = function (ish, value, index) { this.add(subscribeToResult_1.subscribeToResult(this, ish, value, index)); }; MergeMapSubscriber.prototype._complete = function () { this.hasCompleted = true; if (this.active === 0 && this.buffer.length === 0) { this.destination.complete(); } }; MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { if (this.resultSelector) { this._notifyResultSelector(outerValue, innerValue, outerIndex, innerIndex); } else { this.destination.next(innerValue); } }; MergeMapSubscriber.prototype._notifyResultSelector = function (outerValue, innerValue, outerIndex, innerIndex) { var result; try { result = this.resultSelector(outerValue, innerValue, outerIndex, innerIndex); } catch (err) { this.destination.error(err); return; } this.destination.next(result); }; MergeMapSubscriber.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 MergeMapSubscriber; }(OuterSubscriber_1.OuterSubscriber)); exports.MergeMapSubscriber = MergeMapSubscriber; //# sourceMappingURL=mergeMap.js.map /***/ }, /* 72 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); var Notification_1 = __webpack_require__(17); /** * @see {@link Notification} * * @param scheduler * @param delay * @return {Observable|WebSocketSubject|Observable} * @method observeOn * @owner Observable */ function observeOn(scheduler, delay) { if (delay === void 0) { delay = 0; } return this.lift(new ObserveOnOperator(scheduler, delay)); } exports.observeOn = observeOn; var ObserveOnOperator = (function () { function ObserveOnOperator(scheduler, delay) { if (delay === void 0) { delay = 0; } this.scheduler = scheduler; this.delay = delay; } ObserveOnOperator.prototype.call = function (subscriber, source) { return source._subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay)); }; return ObserveOnOperator; }()); exports.ObserveOnOperator = ObserveOnOperator; /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ObserveOnSubscriber = (function (_super) { __extends(ObserveOnSubscriber, _super); function ObserveOnSubscriber(destination, scheduler, delay) { if (delay === void 0) { delay = 0; } _super.call(this, destination); this.scheduler = scheduler; this.delay = delay; } ObserveOnSubscriber.dispatch = function (arg) { var notification = arg.notification, destination = arg.destination; notification.observe(destination); }; ObserveOnSubscriber.prototype.scheduleMessage = function (notification) { this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination))); }; ObserveOnSubscriber.prototype._next = function (value) { this.scheduleMessage(Notification_1.Notification.createNext(value)); }; ObserveOnSubscriber.prototype._error = function (err) { this.scheduleMessage(Notification_1.Notification.createError(err)); }; ObserveOnSubscriber.prototype._complete = function () { this.scheduleMessage(Notification_1.Notification.createComplete()); }; return ObserveOnSubscriber; }(Subscriber_1.Subscriber)); exports.ObserveOnSubscriber = ObserveOnSubscriber; var ObserveOnMessage = (function () { function ObserveOnMessage(notification, destination) { this.notification = notification; this.destination = destination; } return ObserveOnMessage; }()); exports.ObserveOnMessage = ObserveOnMessage; //# sourceMappingURL=observeOn.js.map /***/ }, /* 73 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(1); /** * Returns an Observable that mirrors the source Observable, resubscribing to it if it calls `error` and the * predicate returns true for that specific exception and retry count. * If the source Observable calls `error`, this method will resubscribe to the source Observable for a maximum of * count resubscriptions (given as a number parameter) rather than propagating the `error` call. * * * * Any and all items emitted by the source Observable will be emitted by the resulting Observable, even those emitted * during failed subscriptions. For example, if an Observable fails at first but emits [1, 2] then succeeds the second * time and emits: [1, 2, 3, 4, 5] then the complete stream of emissions and notifications * would be: [1, 2, 1, 2, 3, 4, 5, `complete`]. * @param {number} number of retry attempts before failing. * @return {Observable} the source Observable modified with the retry logic. * @method retry * @owner Observable */ function retry(count) { if (count === void 0) { count = -1; } return this.lift(new RetryOperator(count, this)); } exports.retry = retry; var RetryOperator = (function () { function RetryOperator(count, source) { this.count = count; this.source = source; } RetryOperator.prototype.call = function (subscriber, source) { return source._subscribe(new RetrySubscriber(subscriber, this.count, this.source)); }; return RetryOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var RetrySubscriber = (function (_super) { __extends(RetrySubscriber, _super); function RetrySubscriber(destination, count, source) { _super.call(this, destination); this.count = count; this.source = source; } RetrySubscriber.prototype.error = function (err) { if (!this.isStopped) { var _a = this, source = _a.source, count = _a.count; if (count === 0) { return _super.prototype.error.call(this, err); } else if (count > -1) { this.count = count - 1; } this.unsubscribe(); this.isStopped = false; this.closed = false; source.subscribe(this); } }; return RetrySubscriber; }(Subscriber_1.Subscriber)); //# sourceMappingURL=retry.js.map /***/ }, /* 74 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(5); var subscribeToResult_1 = __webpack_require__(7); /** * Emits a value from the source Observable, then ignores subsequent source * values for a duration determined by another Observable, then repeats this * process. * * It's like {@link throttleTime}, but the silencing * duration is determined by a second Observable. * * * * `throttle` emits the source Observable values on the output Observable * when its internal timer is disabled, and ignores source values when the timer * is enabled. Initially, the timer is disabled. As soon as the first source * value arrives, it is forwarded to the output Observable, and then the timer * is enabled by calling the `durationSelector` function with the source value, * which returns the "duration" Observable. When the duration Observable emits a * value or completes, the timer is disabled, and this process repeats for the * next source value. * * @example Emit clicks at a rate of at most one click per second * var clicks = Rx.Observable.fromEvent(document, 'click'); * var result = clicks.throttle(ev => Rx.Observable.interval(1000)); * result.subscribe(x => console.log(x)); * * @see {@link audit} * @see {@link debounce} * @see {@link delayWhen} * @see {@link sample} * @see {@link throttleTime} * * @param {function(value: T): Observable|Promise} durationSelector A function * that receives a value from the source Observable, for computing the silencing * duration for each source value, returned as an Observable or a Promise. * @return {Observable} An Observable that performs the throttle operation to * limit the rate of emissions from the source. * @method throttle * @owner Observable */ function throttle(durationSelector) { return this.lift(new ThrottleOperator(durationSelector)); } exports.throttle = throttle; var ThrottleOperator = (function () { function ThrottleOperator(durationSelector) { this.durationSelector = durationSelector; } ThrottleOperator.prototype.call = function (subscriber, source) { return source._subscribe(new ThrottleSubscriber(subscriber, this.durationSelector)); }; return ThrottleOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var ThrottleSubscriber = (function (_super) { __extends(ThrottleSubscriber, _super); function ThrottleSubscriber(destination, durationSelector) { _super.call(this, destination); this.destination = destination; this.durationSelector = durationSelector; } ThrottleSubscriber.prototype._next = function (value) { if (!this.throttled) { this.tryDurationSelector(value); } }; ThrottleSubscriber.prototype.tryDurationSelector = function (value) { var duration = null; try { duration = this.durationSelector(value); } catch (err) { this.destination.error(err); return; } this.emitAndThrottle(value, duration); }; ThrottleSubscriber.prototype.emitAndThrottle = function (value, duration) { this.add(this.throttled = subscribeToResult_1.subscribeToResult(this, duration)); this.destination.next(value); }; ThrottleSubscriber.prototype._unsubscribe = function () { var throttled = this.throttled; if (throttled) { this.remove(throttled); this.throttled = null; throttled.unsubscribe(); } }; ThrottleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) { this._unsubscribe(); }; ThrottleSubscriber.prototype.notifyComplete = function () { this._unsubscribe(); }; return ThrottleSubscriber; }(OuterSubscriber_1.OuterSubscriber)); //# sourceMappingURL=throttle.js.map /***/ }, /* 75 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 async_1 = __webpack_require__(6); var isDate_1 = __webpack_require__(13); var Subscriber_1 = __webpack_require__(1); var TimeoutError_1 = __webpack_require__(79); /** * @param due * @param errorToSend * @param scheduler * @return {Observable|WebSocketSubject|Observable} * @method timeout * @owner Observable */ function timeout(due, errorToSend, scheduler) { if (errorToSend === void 0) { errorToSend = null; } if (scheduler === void 0) { scheduler = async_1.async; } var absoluteTimeout = isDate_1.isDate(due); var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due); return this.lift(new TimeoutOperator(waitFor, absoluteTimeout, errorToSend, scheduler)); } exports.timeout = timeout; var TimeoutOperator = (function () { function TimeoutOperator(waitFor, absoluteTimeout, errorToSend, scheduler) { this.waitFor = waitFor; this.absoluteTimeout = absoluteTimeout; this.errorToSend = errorToSend; this.scheduler = scheduler; } TimeoutOperator.prototype.call = function (subscriber, source) { return source._subscribe(new TimeoutSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.errorToSend, this.scheduler)); }; return TimeoutOperator; }()); /** * We need this JSDoc comment for affecting ESDoc. * @ignore * @extends {Ignored} */ var TimeoutSubscriber = (function (_super) { __extends(TimeoutSubscriber, _super); function TimeoutSubscriber(destination, absoluteTimeout, waitFor, errorToSend, scheduler) { _super.call(this, destination); this.absoluteTimeout = absoluteTimeout; this.waitFor = waitFor; this.errorToSend = errorToSend; this.scheduler = scheduler; this.index = 0; this._previousIndex = 0; this._hasCompleted = false; this.scheduleTimeout(); } Object.defineProperty(TimeoutSubscriber.prototype, "previousIndex", { get: function () { return this._previousIndex; }, enumerable: true, configurable: true }); Object.defineProperty(TimeoutSubscriber.prototype, "hasCompleted", { get: function () { return this._hasCompleted; }, enumerable: true, configurable: true }); TimeoutSubscriber.dispatchTimeout = function (state) { var source = state.subscriber; var currentIndex = state.index; if (!source.hasCompleted && source.previousIndex === currentIndex) { source.notifyTimeout(); } }; TimeoutSubscriber.prototype.scheduleTimeout = function () { var currentIndex = this.index; this.scheduler.schedule(TimeoutSubscriber.dispatchTimeout, this.waitFor, { subscriber: this, index: currentIndex }); this.index++; this._previousIndex = currentIndex; }; TimeoutSubscriber.prototype._next = function (value) { this.destination.next(value); if (!this.absoluteTimeout) { this.scheduleTimeout(); } }; TimeoutSubscriber.prototype._error = function (err) { this.destination.error(err); this._hasCompleted = true; }; TimeoutSubscriber.prototype._complete = function () { this.destination.complete(); this._hasCompleted = true; }; TimeoutSubscriber.prototype.notifyTimeout = function () { this.error(this.errorToSend || new TimeoutError_1.TimeoutError()); }; return TimeoutSubscriber; }(Subscriber_1.Subscriber)); //# sourceMappingURL=timeout.js.map /***/ }, /* 76 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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 Subscription_1 = __webpack_require__(8); /** * A unit of work to be executed in a {@link Scheduler}. An action is typically * created from within a Scheduler and an RxJS user does not need to concern * themselves about creating and manipulating an Action. * * ```ts * class Action extends Subscription { * new (scheduler: Scheduler, work: (state?: T) => void); * schedule(state?: T, delay: number = 0): Subscription; * } * ``` * * @class Action */ var Action = (function (_super) { __extends(Action, _super); function Action(scheduler, work) { _super.call(this); } /** * Schedules this action on its parent Scheduler for execution. May be passed * some context object, `state`. May happen at some point in the future, * according to the `delay` parameter, if specified. * @param {T} [state] Some contextual data that the `work` function uses when * called by the Scheduler. * @param {number} [delay] Time to wait before executing the work, where the * time unit is implicit and defined by the Scheduler. * @return {void} */ Action.prototype.schedule = function (state, delay) { if (delay === void 0) { delay = 0; } return this; }; return Action; }(Subscription_1.Subscription)); exports.Action = Action; //# sourceMappingURL=Action.js.map /***/ }, /* 77 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(2); var Action_1 = __webpack_require__(76); /** * 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 /***/ }, /* 78 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "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__(52); 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 /***/ }, /* 79 */ /***/ function(module, exports) { "use strict"; "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 duetime elapses. * * @see {@link timeout} * * @class TimeoutError */ var TimeoutError = (function (_super) { __extends(TimeoutError, _super); function TimeoutError() { var err = _super.call(this, 'Timeout has occurred'); this.name = err.name = 'TimeoutError'; this.stack = err.stack; this.message = err.message; } return TimeoutError; }(Error)); exports.TimeoutError = TimeoutError; //# sourceMappingURL=TimeoutError.js.map /***/ }, /* 80 */ /***/ function(module, exports) { "use strict"; "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 one or more errors have occurred during the * `unsubscribe` of a {@link Subscription}. */ var UnsubscriptionError = (function (_super) { __extends(UnsubscriptionError, _super); function UnsubscriptionError(errors) { _super.call(this); this.errors = errors; var err = Error.call(this, errors ? errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return ((i + 1) + ") " + err.toString()); }).join('\n ') : ''); this.name = err.name = 'UnsubscriptionError'; this.stack = err.stack; this.message = err.message; } return UnsubscriptionError; }(Error)); exports.UnsubscriptionError = UnsubscriptionError; //# sourceMappingURL=UnsubscriptionError.js.map /***/ }, /* 81 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var isArray_1 = __webpack_require__(4); 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 /***/ }, /* 82 */ /***/ function(module, exports) { "use strict"; "use strict"; function isObject(x) { return x != null && typeof x === 'object'; } exports.isObject = isObject; //# sourceMappingURL=isObject.js.map /***/ }, /* 83 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; var Subscriber_1 = __webpack_require__(1); var rxSubscriber_1 = __webpack_require__(21); var Observer_1 = __webpack_require__(18); function toSubscriber(nextOrObserver, error, complete) { if (nextOrObserver) { if (nextOrObserver instanceof Subscriber_1.Subscriber) { return nextOrObserver; } if (nextOrObserver[rxSubscriber_1.$$rxSubscriber]) { return nextOrObserver[rxSubscriber_1.$$rxSubscriber](); } } if (!nextOrObserver && !error && !complete) { return new Subscriber_1.Subscriber(Observer_1.empty); } return new Subscriber_1.Subscriber(nextOrObserver, error, complete); } exports.toSubscriber = toSubscriber; //# sourceMappingURL=toSubscriber.js.map /***/ }, /* 84 */ /***/ function(module, exports) { "use strict"; /** * Created by axetroy on 16-11-18. */ "use strict"; var Query = (function () { function Query(queryStr) { this.queryStr = queryStr; this.object = {}; this.object = this.toObject(queryStr.replace(/^\?+/, '')); } Query.prototype.toObject = function (queryStr) { var obj = {}; queryStr.split('&').forEach(function (item) { var arr = item.split('=') || []; var key = arr[0] || ''; obj[key] = arr[1] || ''; }); return obj; }; Query.prototype.toString = function () { var arr = []; for (var key in this.object) { if (this.object.hasOwnProperty(key)) { var value = this.object[key]; arr.push(key + '=' + value); } } return '?' + arr.join('&'); }; return Query; }()); Object.defineProperty(exports, "__esModule", { value: true }); /** * Created by axetroy on 16-11-18. */ exports.default = Query; /***/ }, /* 85 */ /***/ function(module, exports, __webpack_require__) { var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;// Underscore.js 1.8.3 // http://underscorejs.org // (c) 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors // Underscore may be freely distributed under the MIT license. (function() { // Baseline setup // -------------- // Establish the root object, `window` in the browser, or `exports` on the server. var root = this; // Save the previous value of the `_` variable. var previousUnderscore = root._; // Save bytes in the minified (but not gzipped) version: var ArrayProto = Array.prototype, ObjProto = Object.prototype, FuncProto = Function.prototype; // Create quick reference variables for speed access to core prototypes. var push = ArrayProto.push, slice = ArrayProto.slice, toString = ObjProto.toString, hasOwnProperty = ObjProto.hasOwnProperty; // All **ECMAScript 5** native function implementations that we hope to use // are declared here. var nativeIsArray = Array.isArray, nativeKeys = Object.keys, nativeBind = FuncProto.bind, nativeCreate = Object.create; // Naked function reference for surrogate-prototype-swapping. var Ctor = function(){}; // Create a safe reference to the Underscore object for use below. var _ = function(obj) { if (obj instanceof _) return obj; if (!(this instanceof _)) return new _(obj); this._wrapped = obj; }; // Export the Underscore object for **Node.js**, with // backwards-compatibility for the old `require()` API. If we're in // the browser, add `_` as a global object. if (true) { if (typeof module !== 'undefined' && module.exports) { exports = module.exports = _; } exports._ = _; } else { root._ = _; } // Current version. _.VERSION = '1.8.3'; // Internal function that returns an efficient (for current engines) version // of the passed-in callback, to be repeatedly applied in other Underscore // functions. var optimizeCb = function(func, context, argCount) { if (context === void 0) return func; switch (argCount == null ? 3 : argCount) { case 1: return function(value) { return func.call(context, value); }; case 2: return function(value, other) { return func.call(context, value, other); }; case 3: return function(value, index, collection) { return func.call(context, value, index, collection); }; case 4: return function(accumulator, value, index, collection) { return func.call(context, accumulator, value, index, collection); }; } return function() { return func.apply(context, arguments); }; }; // A mostly-internal function to generate callbacks that can be applied // to each element in a collection, returning the desired result — either // identity, an arbitrary callback, a property matcher, or a property accessor. var cb = function(value, context, argCount) { if (value == null) return _.identity; if (_.isFunction(value)) return optimizeCb(value, context, argCount); if (_.isObject(value)) return _.matcher(value); return _.property(value); }; _.iteratee = function(value, context) { return cb(value, context, Infinity); }; // An internal function for creating assigner functions. var createAssigner = function(keysFunc, undefinedOnly) { return function(obj) { var length = arguments.length; if (length < 2 || obj == null) return obj; for (var index = 1; index < length; index++) { var source = arguments[index], keys = keysFunc(source), l = keys.length; for (var i = 0; i < l; i++) { var key = keys[i]; if (!undefinedOnly || obj[key] === void 0) obj[key] = source[key]; } } return obj; }; }; // An internal function for creating a new object that inherits from another. var baseCreate = function(prototype) { if (!_.isObject(prototype)) return {}; if (nativeCreate) return nativeCreate(prototype); Ctor.prototype = prototype; var result = new Ctor; Ctor.prototype = null; return result; }; var property = function(key) { return function(obj) { return obj == null ? void 0 : obj[key]; }; }; // Helper for collection methods to determine whether a collection // should be iterated as an array or as an object // Related: http://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength // Avoids a very nasty iOS 8 JIT bug on ARM-64. #2094 var MAX_ARRAY_INDEX = Math.pow(2, 53) - 1; var getLength = property('length'); var isArrayLike = function(collection) { var length = getLength(collection); return typeof length == 'number' && length >= 0 && length <= MAX_ARRAY_INDEX; }; // Collection Functions // -------------------- // The cornerstone, an `each` implementation, aka `forEach`. // Handles raw objects in addition to array-likes. Treats all // sparse array-likes as if they were dense. _.each = _.forEach = function(obj, iteratee, context) { iteratee = optimizeCb(iteratee, context); var i, length; if (isArrayLike(obj)) { for (i = 0, length = obj.length; i < length; i++) { iteratee(obj[i], i, obj); } } else { var keys = _.keys(obj); for (i = 0, length = keys.length; i < length; i++) { iteratee(obj[keys[i]], keys[i], obj); } } return obj; }; // Return the results of applying the iteratee to each element. _.map = _.collect = function(obj, iteratee, context) { iteratee = cb(iteratee, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, results = Array(length); for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; results[index] = iteratee(obj[currentKey], currentKey, obj); } return results; }; // Create a reducing function iterating left or right. function createReduce(dir) { // Optimized iterator function as using arguments.length // in the main function will deoptimize the, see #1991. function iterator(obj, iteratee, memo, keys, index, length) { for (; index >= 0 && index < length; index += dir) { var currentKey = keys ? keys[index] : index; memo = iteratee(memo, obj[currentKey], currentKey, obj); } return memo; } return function(obj, iteratee, memo, context) { iteratee = optimizeCb(iteratee, context, 4); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length, index = dir > 0 ? 0 : length - 1; // Determine the initial value if none is provided. if (arguments.length < 3) { memo = obj[keys ? keys[index] : index]; index += dir; } return iterator(obj, iteratee, memo, keys, index, length); }; } // **Reduce** builds up a single result from a list of values, aka `inject`, // or `foldl`. _.reduce = _.foldl = _.inject = createReduce(1); // The right-associative version of reduce, also known as `foldr`. _.reduceRight = _.foldr = createReduce(-1); // Return the first value which passes a truth test. Aliased as `detect`. _.find = _.detect = function(obj, predicate, context) { var key; if (isArrayLike(obj)) { key = _.findIndex(obj, predicate, context); } else { key = _.findKey(obj, predicate, context); } if (key !== void 0 && key !== -1) return obj[key]; }; // Return all the elements that pass a truth test. // Aliased as `select`. _.filter = _.select = function(obj, predicate, context) { var results = []; predicate = cb(predicate, context); _.each(obj, function(value, index, list) { if (predicate(value, index, list)) results.push(value); }); return results; }; // Return all the elements for which a truth test fails. _.reject = function(obj, predicate, context) { return _.filter(obj, _.negate(cb(predicate)), context); }; // Determine whether all of the elements match a truth test. // Aliased as `all`. _.every = _.all = function(obj, predicate, context) { predicate = cb(predicate, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; if (!predicate(obj[currentKey], currentKey, obj)) return false; } return true; }; // Determine if at least one element in the object matches a truth test. // Aliased as `any`. _.some = _.any = function(obj, predicate, context) { predicate = cb(predicate, context); var keys = !isArrayLike(obj) && _.keys(obj), length = (keys || obj).length; for (var index = 0; index < length; index++) { var currentKey = keys ? keys[index] : index; if (predicate(obj[currentKey], currentKey, obj)) return true; } return false; }; // Determine if the array or object contains a given item (using `===`). // Aliased as `includes` and `include`. _.contains = _.includes = _.include = function(obj, item, fromIndex, guard) { if (!isArrayLike(obj)) obj = _.values(obj); if (typeof fromIndex != 'number' || guard) fromIndex = 0; return _.indexOf(obj, item, fromIndex) >= 0; }; // Invoke a method (with arguments) on every item in a collection. _.invoke = function(obj, method) { var args = slice.call(arguments, 2); var isFunc = _.isFunction(method); return _.map(obj, function(value) { var func = isFunc ? method : value[method]; return func == null ? func : func.apply(value, args); }); }; // Convenience version of a common use case of `map`: fetching a property. _.pluck = function(obj, key) { return _.map(obj, _.property(key)); }; // Convenience version of a common use case of `filter`: selecting only objects // containing specific `key:value` pairs. _.where = function(obj, attrs) { return _.filter(obj, _.matcher(attrs)); }; // Convenience version of a common use case of `find`: getting the first object // containing specific `key:value` pairs. _.findWhere = function(obj, attrs) { return _.find(obj, _.matcher(attrs)); }; // Return the maximum element (or element-based computation). _.max = function(obj, iteratee, context) { var result = -Infinity, lastComputed = -Infinity, value, computed; if (iteratee == null && obj != null) { obj = isArrayLike(obj) ? obj : _.values(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value > result) { result = value; } } } else { iteratee = cb(iteratee, context); _.each(obj, function(value, index, list) { computed = iteratee(value, index, list); if (computed > lastComputed || computed === -Infinity && result === -Infinity) { result = value; lastComputed = computed; } }); } return result; }; // Return the minimum element (or element-based computation). _.min = function(obj, iteratee, context) { var result = Infinity, lastComputed = Infinity, value, computed; if (iteratee == null && obj != null) { obj = isArrayLike(obj) ? obj : _.values(obj); for (var i = 0, length = obj.length; i < length; i++) { value = obj[i]; if (value < result) { result = value; } } } else { iteratee = cb(iteratee, context); _.each(obj, function(value, index, list) { computed = iteratee(value, index, list); if (computed < lastComputed || computed === Infinity && result === Infinity) { result = value; lastComputed = computed; } }); } return result; }; // Shuffle a collection, using the modern version of the // [Fisher-Yates shuffle](http://en.wikipedia.org/wiki/Fisher–Yates_shuffle). _.shuffle = function(obj) { var set = isArrayLike(obj) ? obj : _.values(obj); var length = set.length; var shuffled = Array(length); for (var index = 0, rand; index < length; index++) { rand = _.random(0, index); if (rand !== index) shuffled[index] = shuffled[rand]; shuffled[rand] = set[index]; } return shuffled; }; // Sample **n** random values from a collection. // If **n** is not specified, returns a single random element. // The internal `guard` argument allows it to work with `map`. _.sample = function(obj, n, guard) { if (n == null || guard) { if (!isArrayLike(obj)) obj = _.values(obj); return obj[_.random(obj.length - 1)]; } return _.shuffle(obj).slice(0, Math.max(0, n)); }; // Sort the object's values by a criterion produced by an iteratee. _.sortBy = function(obj, iteratee, context) { iteratee = cb(iteratee, context); return _.pluck(_.map(obj, function(value, index, list) { return { value: value, index: index, criteria: iteratee(value, index, list) }; }).sort(function(left, right) { var a = left.criteria; var b = right.criteria; if (a !== b) { if (a > b || a === void 0) return 1; if (a < b || b === void 0) return -1; } return left.index - right.index; }), 'value'); }; // An internal function used for aggregate "group by" operations. var group = function(behavior) { return function(obj, iteratee, context) { var result = {}; iteratee = cb(iteratee, context); _.each(obj, function(value, index) { var key = iteratee(value, index, obj); behavior(result, value, key); }); return result; }; }; // Groups the object's values by a criterion. Pass either a string attribute // to group by, or a function that returns the criterion. _.groupBy = group(function(result, value, key) { if (_.has(result, key)) result[key].push(value); else result[key] = [value]; }); // Indexes the object's values by a criterion, similar to `groupBy`, but for // when you know that your index values will be unique. _.indexBy = group(function(result, value, key) { result[key] = value; }); // Counts instances of an object that group by a certain criterion. Pass // either a string attribute to count by, or a function that returns the // criterion. _.countBy = group(function(result, value, key) { if (_.has(result, key)) result[key]++; else result[key] = 1; }); // Safely create a real, live array from anything iterable. _.toArray = function(obj) { if (!obj) return []; if (_.isArray(obj)) return slice.call(obj); if (isArrayLike(obj)) return _.map(obj, _.identity); return _.values(obj); }; // Return the number of elements in an object. _.size = function(obj) { if (obj == null) return 0; return isArrayLike(obj) ? obj.length : _.keys(obj).length; }; // Split a collection into two arrays: one whose elements all satisfy the given // predicate, and one whose elements all do not satisfy the predicate. _.partition = function(obj, predicate, context) { predicate = cb(predicate, context); var pass = [], fail = []; _.each(obj, function(value, key, obj) { (predicate(value, key, obj) ? pass : fail).push(value); }); return [pass, fail]; }; // Array Functions // --------------- // Get the first element of an array. Passing **n** will return the first N // values in the array. Aliased as `head` and `take`. The **guard** check // allows it to work with `_.map`. _.first = _.head = _.take = function(array, n, guard) { if (array == null) return void 0; if (n == null || guard) return array[0]; return _.initial(array, array.length - n); }; // Returns everything but the last entry of the array. Especially useful on // the arguments object. Passing **n** will return all the values in // the array, excluding the last N. _.initial = function(array, n, guard) { return slice.call(array, 0, Math.max(0, array.length - (n == null || guard ? 1 : n))); }; // Get the last element of an array. Passing **n** will return the last N // values in the array. _.last = function(array, n, guard) { if (array == null) return void 0; if (n == null || guard) return array[array.length - 1]; return _.rest(array, Math.max(0, array.length - n)); }; // Returns everything but the first entry of the array. Aliased as `tail` and `drop`. // Especially useful on the arguments object. Passing an **n** will return // the rest N values in the array. _.rest = _.tail = _.drop = function(array, n, guard) { return slice.call(array, n == null || guard ? 1 : n); }; // Trim out all falsy values from an array. _.compact = function(array) { return _.filter(array, _.identity); }; // Internal implementation of a recursive `flatten` function. var flatten = function(input, shallow, strict, startIndex) { var output = [], idx = 0; for (var i = startIndex || 0, length = getLength(input); i < length; i++) { var value = input[i]; if (isArrayLike(value) && (_.isArray(value) || _.isArguments(value))) { //flatten current level of array or arguments object if (!shallow) value = flatten(value, shallow, strict); var j = 0, len = value.length; output.length += len; while (j < len) { output[idx++] = value[j++]; } } else if (!strict) { output[idx++] = value; } } return output; }; // Flatten out an array, either recursively (by default), or just one level. _.flatten = function(array, shallow) { return flatten(array, shallow, false); }; // Return a version of the array that does not contain the specified value(s). _.without = function(array) { return _.difference(array, slice.call(arguments, 1)); }; // Produce a duplicate-free version of the array. If the array has already // been sorted, you have the option of using a faster algorithm. // Aliased as `unique`. _.uniq = _.unique = function(array, isSorted, iteratee, context) { if (!_.isBoolean(isSorted)) { context = iteratee; iteratee = isSorted; isSorted = false; } if (iteratee != null) iteratee = cb(iteratee, context); var result = []; var seen = []; for (var i = 0, length = getLength(array); i < length; i++) { var value = array[i], computed = iteratee ? iteratee(value, i, array) : value; if (isSorted) { if (!i || seen !== computed) result.push(value); seen = computed; } else if (iteratee) { if (!_.contains(seen, computed)) { seen.push(computed); result.push(value); } } else if (!_.contains(result, value)) { result.push(value); } } return result; }; // Produce an array that contains the union: each distinct element from all of // the passed-in arrays. _.union = function() { return _.uniq(flatten(arguments, true, true)); }; // Produce an array that contains every item shared between all the // passed-in arrays. _.intersection = function(array) { var result = []; var argsLength = arguments.length; for (var i = 0, length = getLength(array); i < length; i++) { var item = array[i]; if (_.contains(result, item)) continue; for (var j = 1; j < argsLength; j++) { if (!_.contains(arguments[j], item)) break; } if (j === argsLength) result.push(item); } return result; }; // Take the difference between one array and a number of other arrays. // Only the elements present in just the first array will remain. _.difference = function(array) { var rest = flatten(arguments, true, true, 1); return _.filter(array, function(value){ return !_.contains(rest, value); }); }; // Zip together multiple lists into a single array -- elements that share // an index go together. _.zip = function() { return _.unzip(arguments); }; // Complement of _.zip. Unzip accepts an array of arrays and groups // each array's elements on shared indices _.unzip = function(array) { var length = array && _.max(array, getLength).length || 0; var result = Array(length); for (var index = 0; index < length; index++) { result[index] = _.pluck(array, index); } return result; }; // Converts lists into objects. Pass either a single array of `[key, value]` // pairs, or two parallel arrays of the same length -- one of keys, and one of // the corresponding values. _.object = function(list, values) { var result = {}; for (var i = 0, length = getLength(list); i < length; i++) { if (values) { result[list[i]] = values[i]; } else { result[list[i][0]] = list[i][1]; } } return result; }; // Generator function to create the findIndex and findLastIndex functions function createPredicateIndexFinder(dir) { return function(array, predicate, context) { predicate = cb(predicate, context); var length = getLength(array); var index = dir > 0 ? 0 : length - 1; for (; index >= 0 && index < length; index += dir) { if (predicate(array[index], index, array)) return index; } return -1; }; } // Returns the first index on an array-like that passes a predicate test _.findIndex = createPredicateIndexFinder(1); _.findLastIndex = createPredicateIndexFinder(-1); // Use a comparator function to figure out the smallest index at which // an object should be inserted so as to maintain order. Uses binary search. _.sortedIndex = function(array, obj, iteratee, context) { iteratee = cb(iteratee, context, 1); var value = iteratee(obj); var low = 0, high = getLength(array); while (low < high) { var mid = Math.floor((low + high) / 2); if (iteratee(array[mid]) < value) low = mid + 1; else high = mid; } return low; }; // Generator function to create the indexOf and lastIndexOf functions function createIndexFinder(dir, predicateFind, sortedIndex) { return function(array, item, idx) { var i = 0, length = getLength(array); if (typeof idx == 'number') { if (dir > 0) { i = idx >= 0 ? idx : Math.max(idx + length, i); } else { length = idx >= 0 ? Math.min(idx + 1, length) : idx + length + 1; } } else if (sortedIndex && idx && length) { idx = sortedIndex(array, item); return array[idx] === item ? idx : -1; } if (item !== item) { idx = predicateFind(slice.call(array, i, length), _.isNaN); return idx >= 0 ? idx + i : -1; } for (idx = dir > 0 ? i : length - 1; idx >= 0 && idx < length; idx += dir) { if (array[idx] === item) return idx; } return -1; }; } // Return the position of the first occurrence of an item in an array, // or -1 if the item is not included in the array. // If the array is large and already in sort order, pass `true` // for **isSorted** to use binary search. _.indexOf = createIndexFinder(1, _.findIndex, _.sortedIndex); _.lastIndexOf = createIndexFinder(-1, _.findLastIndex); // Generate an integer Array containing an arithmetic progression. A port of // the native Python `range()` function. See // [the Python documentation](http://docs.python.org/library/functions.html#range). _.range = function(start, stop, step) { if (stop == null) { stop = start || 0; start = 0; } step = step || 1; var length = Math.max(Math.ceil((stop - start) / step), 0); var range = Array(length); for (var idx = 0; idx < length; idx++, start += step) { range[idx] = start; } return range; }; // Function (ahem) Functions // ------------------ // Determines whether to execute a function as a constructor // or a normal function with the provided arguments var executeBound = function(sourceFunc, boundFunc, context, callingContext, args) { if (!(callingContext instanceof boundFunc)) return sourceFunc.apply(context, args); var self = baseCreate(sourceFunc.prototype); var result = sourceFunc.apply(self, args); if (_.isObject(result)) return result; return self; }; // Create a function bound to a given object (assigning `this`, and arguments, // optionally). Delegates to **ECMAScript 5**'s native `Function.bind` if // available. _.bind = function(func, context) { if (nativeBind && func.bind === nativeBind) return nativeBind.apply(func, slice.call(arguments, 1)); if (!_.isFunction(func)) throw new TypeError('Bind must be called on a function'); var args = slice.call(arguments, 2); var bound = function() { return executeBound(func, bound, context, this, args.concat(slice.call(arguments))); }; return bound; }; // Partially apply a function by creating a version that has had some of its // arguments pre-filled, without changing its dynamic `this` context. _ acts // as a placeholder, allowing any combination of arguments to be pre-filled. _.partial = function(func) { var boundArgs = slice.call(arguments, 1); var bound = function() { var position = 0, length = boundArgs.length; var args = Array(length); for (var i = 0; i < length; i++) { args[i] = boundArgs[i] === _ ? arguments[position++] : boundArgs[i]; } while (position < arguments.length) args.push(arguments[position++]); return executeBound(func, bound, this, this, args); }; return bound; }; // Bind a number of an object's methods to that object. Remaining arguments // are the method names to be bound. Useful for ensuring that all callbacks // defined on an object belong to it. _.bindAll = function(obj) { var i, length = arguments.length, key; if (length <= 1) throw new Error('bindAll must be passed function names'); for (i = 1; i < length; i++) { key = arguments[i]; obj[key] = _.bind(obj[key], obj); } return obj; }; // Memoize an expensive function by storing its results. _.memoize = function(func, hasher) { var memoize = function(key) { var cache = memoize.cache; var address = '' + (hasher ? hasher.apply(this, arguments) : key); if (!_.has(cache, address)) cache[address] = func.apply(this, arguments); return cache[address]; }; memoize.cache = {}; return memoize; }; // Delays a function for the given number of milliseconds, and then calls // it with the arguments supplied. _.delay = function(func, wait) { var args = slice.call(arguments, 2); return setTimeout(function(){ return func.apply(null, args); }, wait); }; // Defers a function, scheduling it to run after the current call stack has // cleared. _.defer = _.partial(_.delay, _, 1); // Returns a function, that, when invoked, will only be triggered at most once // during a given window of time. Normally, the throttled function will run // as much as it can, without ever going more than once per `wait` duration; // but if you'd like to disable the execution on the leading edge, pass // `{leading: false}`. To disable execution on the trailing edge, ditto. _.throttle = function(func, wait, options) { var context, args, result; var timeout = null; var previous = 0; if (!options) options = {}; var later = function() { previous = options.leading === false ? 0 : _.now(); timeout = null; result = func.apply(context, args); if (!timeout) context = args = null; }; return function() { var now = _.now(); if (!previous && options.leading === false) previous = now; var remaining = wait - (now - previous); context = this; args = arguments; if (remaining <= 0 || remaining > wait) { if (timeout) { clearTimeout(timeout); timeout = null; } previous = now; result = func.apply(context, args); if (!timeout) context = args = null; } else if (!timeout && options.trailing !== false) { timeout = setTimeout(later, remaining); } return result; }; }; // Returns a function, that, as long as it continues to be invoked, will not // be triggered. The function will be called after it stops being called for // N milliseconds. If `immediate` is passed, trigger the function on the // leading edge, instead of the trailing. _.debounce = function(func, wait, immediate) { var timeout, args, context, timestamp, result; var later = function() { var last = _.now() - timestamp; if (last < wait && last >= 0) { timeout = setTimeout(later, wait - last); } else { timeout = null; if (!immediate) { result = func.apply(context, args); if (!timeout) context = args = null; } } }; return function() { context = this; args = arguments; timestamp = _.now(); var callNow = immediate && !timeout; if (!timeout) timeout = setTimeout(later, wait); if (callNow) { result = func.apply(context, args); context = args = null; } return result; }; }; // Returns the first function passed as an argument to the second, // allowing you to adjust arguments, run code before and after, and // conditionally execute the original function. _.wrap = function(func, wrapper) { return _.partial(wrapper, func); }; // Returns a negated version of the passed-in predicate. _.negate = function(predicate) { return function() { return !predicate.apply(this, arguments); }; }; // Returns a function that is the composition of a list of functions, each // consuming the return value of the function that follows. _.compose = function() { var args = arguments; var start = args.length - 1; return function() { var i = start; var result = args[start].apply(this, arguments); while (i--) result = args[i].call(this, result); return result; }; }; // Returns a function that will only be executed on and after the Nth call. _.after = function(times, func) { return function() { if (--times < 1) { return func.apply(this, arguments); } }; }; // Returns a function that will only be executed up to (but not including) the Nth call. _.before = function(times, func) { var memo; return function() { if (--times > 0) { memo = func.apply(this, arguments); } if (times <= 1) func = null; return memo; }; }; // Returns a function that will be executed at most one time, no matter how // often you call it. Useful for lazy initialization. _.once = _.partial(_.before, 2); // Object Functions // ---------------- // Keys in IE < 9 that won't be iterated by `for key in ...` and thus missed. var hasEnumBug = !{toString: null}.propertyIsEnumerable('toString'); var nonEnumerableProps = ['valueOf', 'isPrototypeOf', 'toString', 'propertyIsEnumerable', 'hasOwnProperty', 'toLocaleString']; function collectNonEnumProps(obj, keys) { var nonEnumIdx = nonEnumerableProps.length; var constructor = obj.constructor; var proto = (_.isFunction(constructor) && constructor.prototype) || ObjProto; // Constructor is a special case. var prop = 'constructor'; if (_.has(obj, prop) && !_.contains(keys, prop)) keys.push(prop); while (nonEnumIdx--) { prop = nonEnumerableProps[nonEnumIdx]; if (prop in obj && obj[prop] !== proto[prop] && !_.contains(keys, prop)) { keys.push(prop); } } } // Retrieve the names of an object's own properties. // Delegates to **ECMAScript 5**'s native `Object.keys` _.keys = function(obj) { if (!_.isObject(obj)) return []; if (nativeKeys) return nativeKeys(obj); var keys = []; for (var key in obj) if (_.has(obj, key)) keys.push(key); // Ahem, IE < 9. if (hasEnumBug) collectNonEnumProps(obj, keys); return keys; }; // Retrieve all the property names of an object. _.allKeys = function(obj) { if (!_.isObject(obj)) return []; var keys = []; for (var key in obj) keys.push(key); // Ahem, IE < 9. if (hasEnumBug) collectNonEnumProps(obj, keys); return keys; }; // Retrieve the values of an object's properties. _.values = function(obj) { var keys = _.keys(obj); var length = keys.length; var values = Array(length); for (var i = 0; i < length; i++) { values[i] = obj[keys[i]]; } return values; }; // Returns the results of applying the iteratee to each element of the object // In contrast to _.map it returns an object _.mapObject = function(obj, iteratee, context) { iteratee = cb(iteratee, context); var keys = _.keys(obj), length = keys.length, results = {}, currentKey; for (var index = 0; index < length; index++) { currentKey = keys[index]; results[currentKey] = iteratee(obj[currentKey], currentKey, obj); } return results; }; // Convert an object into a list of `[key, value]` pairs. _.pairs = function(obj) { var keys = _.keys(obj); var length = keys.length; var pairs = Array(length); for (var i = 0; i < length; i++) { pairs[i] = [keys[i], obj[keys[i]]]; } return pairs; }; // Invert the keys and values of an object. The values must be serializable. _.invert = function(obj) { var result = {}; var keys = _.keys(obj); for (var i = 0, length = keys.length; i < length; i++) { result[obj[keys[i]]] = keys[i]; } return result; }; // Return a sorted list of the function names available on the object. // Aliased as `methods` _.functions = _.methods = function(obj) { var names = []; for (var key in obj) { if (_.isFunction(obj[key])) names.push(key); } return names.sort(); }; // Extend a given object with all the properties in passed-in object(s). _.extend = createAssigner(_.allKeys); // Assigns a given object with all the own properties in the passed-in object(s) // (https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object/assign) _.extendOwn = _.assign = createAssigner(_.keys); // Returns the first key on an object that passes a predicate test _.findKey = function(obj, predicate, context) { predicate = cb(predicate, context); var keys = _.keys(obj), key; for (var i = 0, length = keys.length; i < length; i++) { key = keys[i]; if (predicate(obj[key], key, obj)) return key; } }; // Return a copy of the object only containing the whitelisted properties. _.pick = function(object, oiteratee, context) { var result = {}, obj = object, iteratee, keys; if (obj == null) return result; if (_.isFunction(oiteratee)) { keys = _.allKeys(obj); iteratee = optimizeCb(oiteratee, context); } else { keys = flatten(arguments, false, false, 1); iteratee = function(value, key, obj) { return key in obj; }; obj = Object(obj); } for (var i = 0, length = keys.length; i < length; i++) { var key = keys[i]; var value = obj[key]; if (iteratee(value, key, obj)) result[key] = value; } return result; }; // Return a copy of the object without the blacklisted properties. _.omit = function(obj, iteratee, context) { if (_.isFunction(iteratee)) { iteratee = _.negate(iteratee); } else { var keys = _.map(flatten(arguments, false, false, 1), String); iteratee = function(value, key) { return !_.contains(keys, key); }; } return _.pick(obj, iteratee, context); }; // Fill in a given object with default properties. _.defaults = createAssigner(_.allKeys, true); // Creates an object that inherits from the given prototype object. // If additional properties are provided then they will be added to the // created object. _.create = function(prototype, props) { var result = baseCreate(prototype); if (props) _.extendOwn(result, props); return result; }; // Create a (shallow-cloned) duplicate of an object. _.clone = function(obj) { if (!_.isObject(obj)) return obj; return _.isArray(obj) ? obj.slice() : _.extend({}, obj); }; // Invokes interceptor with the obj, and then returns obj. // The primary purpose of this method is to "tap into" a method chain, in // order to perform operations on intermediate results within the chain. _.tap = function(obj, interceptor) { interceptor(obj); return obj; }; // Returns whether an object has a given set of `key:value` pairs. _.isMatch = function(object, attrs) { var keys = _.keys(attrs), length = keys.length; if (object == null) return !length; var obj = Object(object); for (var i = 0; i < length; i++) { var key = keys[i]; if (attrs[key] !== obj[key] || !(key in obj)) return false; } return true; }; // Internal recursive comparison function for `isEqual`. var eq = function(a, b, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // A strict comparison is necessary because `null == undefined`. if (a == null || b == null) return a === b; // Unwrap any wrapped objects. if (a instanceof _) a = a._wrapped; if (b instanceof _) b = b._wrapped; // Compare `[[Class]]` names. var className = toString.call(a); if (className !== toString.call(b)) return false; switch (className) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case '[object RegExp]': // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case '[object String]': // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return '' + a === '' + b; case '[object Number]': // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case '[object Date]': case '[object Boolean]': // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a === +b; } var areArrays = className === '[object Array]'; if (!areArrays) { if (typeof a != 'object' || typeof b != 'object') return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(_.isFunction(aCtor) && aCtor instanceof aCtor && _.isFunction(bCtor) && bCtor instanceof bCtor) && ('constructor' in a && 'constructor' in b)) { return false; } } // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. aStack = aStack || []; bStack = bStack || []; var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] === a) return bStack[length] === b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); // Recursively compare objects and arrays. if (areArrays) { // Compare array lengths to determine if a deep comparison is necessary. length = a.length; if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties. while (length--) { if (!eq(a[length], b[length], aStack, bStack)) return false; } } else { // Deep compare objects. var keys = _.keys(a), key; length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. if (_.keys(b).length !== length) return false; while (length--) { // Deep compare each member key = keys[length]; if (!(_.has(b, key) && eq(a[key], b[key], aStack, bStack))) return false; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return true; }; // Perform a deep comparison to check if two objects are equal. _.isEqual = function(a, b) { return eq(a, b); }; // Is a given array, string, or object empty? // An "empty" object has no enumerable own-properties. _.isEmpty = function(obj) { if (obj == null) return true; if (isArrayLike(obj) && (_.isArray(obj) || _.isString(obj) || _.isArguments(obj))) return obj.length === 0; return _.keys(obj).length === 0; }; // Is a given value a DOM element? _.isElement = function(obj) { return !!(obj && obj.nodeType === 1); }; // Is a given value an array? // Delegates to ECMA5's native Array.isArray _.isArray = nativeIsArray || function(obj) { return toString.call(obj) === '[object Array]'; }; // Is a given variable an object? _.isObject = function(obj) { var type = typeof obj; return type === 'function' || type === 'object' && !!obj; }; // Add some isType methods: isArguments, isFunction, isString, isNumber, isDate, isRegExp, isError. _.each(['Arguments', 'Function', 'String', 'Number', 'Date', 'RegExp', 'Error'], function(name) { _['is' + name] = function(obj) { return toString.call(obj) === '[object ' + name + ']'; }; }); // Define a fallback version of the method in browsers (ahem, IE < 9), where // there isn't any inspectable "Arguments" type. if (!_.isArguments(arguments)) { _.isArguments = function(obj) { return _.has(obj, 'callee'); }; } // Optimize `isFunction` if appropriate. Work around some typeof bugs in old v8, // IE 11 (#1621), and in Safari 8 (#1929). if (typeof /./ != 'function' && typeof Int8Array != 'object') { _.isFunction = function(obj) { return typeof obj == 'function' || false; }; } // Is a given object a finite number? _.isFinite = function(obj) { return isFinite(obj) && !isNaN(parseFloat(obj)); }; // Is the given value `NaN`? (NaN is the only number which does not equal itself). _.isNaN = function(obj) { return _.isNumber(obj) && obj !== +obj; }; // Is a given value a boolean? _.isBoolean = function(obj) { return obj === true || obj === false || toString.call(obj) === '[object Boolean]'; }; // Is a given value equal to null? _.isNull = function(obj) { return obj === null; }; // Is a given variable undefined? _.isUndefined = function(obj) { return obj === void 0; }; // Shortcut function for checking if an object has a given property directly // on itself (in other words, not on a prototype). _.has = function(obj, key) { return obj != null && hasOwnProperty.call(obj, key); }; // Utility Functions // ----------------- // Run Underscore.js in *noConflict* mode, returning the `_` variable to its // previous owner. Returns a reference to the Underscore object. _.noConflict = function() { root._ = previousUnderscore; return this; }; // Keep the identity function around for default iteratees. _.identity = function(value) { return value; }; // Predicate-generating functions. Often useful outside of Underscore. _.constant = function(value) { return function() { return value; }; }; _.noop = function(){}; _.property = property; // Generates a function for a given object that returns a given property. _.propertyOf = function(obj) { return obj == null ? function(){} : function(key) { return obj[key]; }; }; // Returns a predicate for checking whether an object has a given set of // `key:value` pairs. _.matcher = _.matches = function(attrs) { attrs = _.extendOwn({}, attrs); return function(obj) { return _.isMatch(obj, attrs); }; }; // Run a function **n** times. _.times = function(n, iteratee, context) { var accum = Array(Math.max(0, n)); iteratee = optimizeCb(iteratee, context, 1); for (var i = 0; i < n; i++) accum[i] = iteratee(i); return accum; }; // Return a random integer between min and max (inclusive). _.random = function(min, max) { if (max == null) { max = min; min = 0; } return min + Math.floor(Math.random() * (max - min + 1)); }; // A (possibly faster) way to get the current timestamp as an integer. _.now = Date.now || function() { return new Date().getTime(); }; // List of HTML entities for escaping. var escapeMap = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''', '`': '`' }; var unescapeMap = _.invert(escapeMap); // Functions for escaping and unescaping strings to/from HTML interpolation. var createEscaper = function(map) { var escaper = function(match) { return map[match]; }; // Regexes for identifying a key that needs to be escaped var source = '(?:' + _.keys(map).join('|') + ')'; var testRegexp = RegExp(source); var replaceRegexp = RegExp(source, 'g'); return function(string) { string = string == null ? '' : '' + string; return testRegexp.test(string) ? string.replace(replaceRegexp, escaper) : string; }; }; _.escape = createEscaper(escapeMap); _.unescape = createEscaper(unescapeMap); // If the value of the named `property` is a function then invoke it with the // `object` as context; otherwise, return it. _.result = function(object, property, fallback) { var value = object == null ? void 0 : object[property]; if (value === void 0) { value = fallback; } return _.isFunction(value) ? value.call(object) : value; }; // Generate a unique integer id (unique within the entire client session). // Useful for temporary DOM ids. var idCounter = 0; _.uniqueId = function(prefix) { var id = ++idCounter + ''; return prefix ? prefix + id : id; }; // By default, Underscore uses ERB-style template delimiters, change the // following template settings to use alternative delimiters. _.templateSettings = { evaluate : /<%([\s\S]+?)%>/g, interpolate : /<%=([\s\S]+?)%>/g, escape : /<%-([\s\S]+?)%>/g }; // When customizing `templateSettings`, if you don't want to define an // interpolation, evaluation or escaping regex, we need one that is // guaranteed not to match. var noMatch = /(.)^/; // Certain characters need to be escaped so that they can be put into a // string literal. var escapes = { "'": "'", '\\': '\\', '\r': 'r', '\n': 'n', '\u2028': 'u2028', '\u2029': 'u2029' }; var escaper = /\\|'|\r|\n|\u2028|\u2029/g; var escapeChar = function(match) { return '\\' + escapes[match]; }; // JavaScript micro-templating, similar to John Resig's implementation. // Underscore templating handles arbitrary delimiters, preserves whitespace, // and correctly escapes quotes within interpolated code. // NB: `oldSettings` only exists for backwards compatibility. _.template = function(text, settings, oldSettings) { if (!settings && oldSettings) settings = oldSettings; settings = _.defaults({}, settings, _.templateSettings); // Combine delimiters into one regular expression via alternation. var matcher = RegExp([ (settings.escape || noMatch).source, (settings.interpolate || noMatch).source, (settings.evaluate || noMatch).source ].join('|') + '|$', 'g'); // Compile the template source, escaping string literals appropriately. var index = 0; var source = "__p+='"; text.replace(matcher, function(match, escape, interpolate, evaluate, offset) { source += text.slice(index, offset).replace(escaper, escapeChar); index = offset + match.length; if (escape) { source += "'+\n((__t=(" + escape + "))==null?'':_.escape(__t))+\n'"; } else if (interpolate) { source += "'+\n((__t=(" + interpolate + "))==null?'':__t)+\n'"; } else if (evaluate) { source += "';\n" + evaluate + "\n__p+='"; } // Adobe VMs need the match returned to produce the correct offest. return match; }); source += "';\n"; // If a variable is not specified, place data values in local scope. if (!settings.variable) source = 'with(obj||{}){\n' + source + '}\n'; source = "var __t,__p='',__j=Array.prototype.join," + "print=function(){__p+=__j.call(arguments,'');};\n" + source + 'return __p;\n'; try { var render = new Function(settings.variable || 'obj', '_', source); } catch (e) { e.source = source; throw e; } var template = function(data) { return render.call(this, data, _); }; // Provide the compiled source as a convenience for precompilation. var argument = settings.variable || 'obj'; template.source = 'function(' + argument + '){\n' + source + '}'; return template; }; // Add a "chain" function. Start chaining a wrapped Underscore object. _.chain = function(obj) { var instance = _(obj); instance._chain = true; return instance; }; // OOP // --------------- // If Underscore is called as a function, it returns a wrapped object that // can be used OO-style. This wrapper holds altered versions of all the // underscore functions. Wrapped objects may be chained. // Helper function to continue chaining intermediate results. var result = function(instance, obj) { return instance._chain ? _(obj).chain() : obj; }; // Add your own custom functions to the Underscore object. _.mixin = function(obj) { _.each(_.functions(obj), function(name) { var func = _[name] = obj[name]; _.prototype[name] = function() { var args = [this._wrapped]; push.apply(args, arguments); return result(this, func.apply(_, args)); }; }); }; // Add all of the Underscore functions to the wrapper object. _.mixin(_); // Add all mutator Array functions to the wrapper. _.each(['pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift'], function(name) { var method = ArrayProto[name]; _.prototype[name] = function() { var obj = this._wrapped; method.apply(obj, arguments); if ((name === 'shift' || name === 'splice') && obj.length === 0) delete obj[0]; return result(this, obj); }; }); // Add all accessor Array functions to the wrapper. _.each(['concat', 'join', 'slice'], function(name) { var method = ArrayProto[name]; _.prototype[name] = function() { return result(this, method.apply(this._wrapped, arguments)); }; }); // Extracts the result from a wrapped and chained object. _.prototype.value = function() { return this._wrapped; }; // Provide unwrapping proxy for some methods used in engine operations // such as arithmetic and JSON stringification. _.prototype.valueOf = _.prototype.toJSON = _.prototype.value; _.prototype.toString = function() { return '' + this._wrapped; }; // AMD registration happens at the end for compatibility with AMD loaders // that may not enforce next-turn semantics on modules. Even though general // practice for AMD registration is to be anonymous, underscore registers // as a named module because, like jQuery, it is a base library that is // popular enough to be bundled in a third party lib, but not be part of // an AMD load request. Those cases could generate an error when an // anonymous define() is called outside of a loader request. if (true) { !(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = function() { return _; }.apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)); } }.call(this)); /***/ }, /* 86 */ /***/ 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; /***/ }, /* 87 */ /***/ function(module, exports, __webpack_require__) { "use strict"; "use strict"; __webpack_require__(28); __webpack_require__(30); __webpack_require__(29); __webpack_require__(31); __webpack_require__(27); __webpack_require__(40); __webpack_require__(37); __webpack_require__(36); __webpack_require__(32); __webpack_require__(33); __webpack_require__(35); __webpack_require__(38); __webpack_require__(39); __webpack_require__(41); __webpack_require__(34); var baidu_1 = __webpack_require__(43); var tieba_1 = __webpack_require__(46); var baidu_video_1 = __webpack_require__(42); var google_1 = __webpack_require__(44); var weibo_1 = __webpack_require__(48); var twitter_1 = __webpack_require__(47); var so_1 = __webpack_require__(45); var zhihu_1 = __webpack_require__(50); var zhihu_daily_1 = __webpack_require__(49); baidu_1.default.bootstrap(); tieba_1.default.bootstrap(); baidu_video_1.default.bootstrap(); google_1.default.bootstrap(); weibo_1.default.bootstrap(); twitter_1.default.bootstrap(); so_1.default.bootstrap(); zhihu_1.default.bootstrap(); zhihu_daily_1.default.bootstrap(); /***/ } /******/ ]);