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C,KAAK6C,cAAcE,OAAS,GAC3GlC,EAAOe,eAAiB5B,KAAKY,MAAM,KAAOZ,KAAK6C,cAAc,KAE7DhC,EAAOW,cAAe,EACtBX,EAAOe,gBAAiB,GAGnBf,CACT,EAOAjB,EAAgBuB,UAAU8C,aAAe,WAGvC,OAAOjE,KAAK6D,aAAaD,SAFV,cAGjB,EAkBA5C,EAAwBG,UAAUgG,SAAW,WAC3C,OAAOnH,KAAKiB,IACd,EAWAD,EAAwBG,UAAUD,QAAU,SAASpB,EAASC,GAC5D,IAAIqH,EAAeC,MAAMlG,UAAU8B,MAAMqE,KAAKxH,EAAQqE,KAAK,cAAe,GACtEoD,EAAYlI,EAAiBU,EAAMe,eACnC0G,EAAcD,EAAU9H,KAAO,4BAA8B8H,EAAU5H,QAAU,IAAM4H,EAAU5H,QAAU,IAU/G,OAPAZ,QAAQsF,QAAQ+C,EAAc,SAAS1B,GACrC5F,EAAQ2H,WAAW/B,EAAKgC,KAC1B,GAGA5H,EAAQ4F,KAAK,YAAa8B,GAEnB1H,EAAQqE,KAAK,YACtB,EAEO,CACLwD,SAAU,IACV9H,OAAO,EACP+H,SAAS,EAETC,SAAU,SAAS/H,EAASC,GAC1B,MAAO,OAAKiB,EAAwBlB,EAASC,EAC/C,EAEA+H,WAAY,SAASC,EAAQC,EAAUC,GACrC,IAAInH,EAAgB,IAAIlB,EAAgBmI,EAAQC,EAAUC,GAI1D,OAFAF,EAAOG,eAAiBpH,EAEjBA,CACT,EAEJ,EACH,CAtmBD,E","sources":["webpack://angular-ui/./vendor/angular-endless-scroll.js"],"sourcesContent":["/*!\n * angular-endless-scroll.js v0.0.5\n * http://davidchin.me\n * Copyright 2015 David Chin\n * MIT License\n */\n(function() {\n  'use strict';\n\n  /**\n   * @namespace dc\n   */\n\n  /**\n   * @module dc.endlessScroll\n   *\n   * @description\n   * A module for implementing an endless/infinite scroll user interface.\n   */\n  angular.module('dc.endlessScroll', []);\n})();\n\n(function() {\n  'use strict';\n\n  angular.module('dc.endlessScroll')\n\n    /**\n     * @member dc.endlessScroll.endlessScroll\n     *\n     * @description\n     * A directive for implementing an endless scrolling list.\n     */\n    .directive('endlessScroll', function($window, $timeout) {\n      var NG_REPEAT_REGEXP = /^\\s*(.+)\\s+in\\s+([\\r\\n\\s\\S]*?)\\s*(\\s+track\\s+by\\s+(.+)\\s*)?$/;\n\n      /**\n       * @function throttle\n       * @private\n       * @param {Function} fn\n       * @param {number} delay\n       * @returns {Function}\n       *\n       * @description\n       * Return a function that only gets executed once within a given time period.\n       */\n      function throttle(fn, delay) {\n        var timeout,\n            previous = 0;\n\n        return function() {\n          var current = new Date().getTime(),\n              remaining = delay - (current - previous),\n              args = arguments;\n\n          if (remaining <= 0) {\n            if (timeout) {\n              $timeout.cancel(timeout);\n            }\n\n            timeout = undefined;\n            previous = current;\n\n            fn.apply(this, args);\n          } else if (!timeout) {\n            timeout = $timeout(function() {\n              timeout = undefined;\n              previous = new Date().getTime();\n\n              fn.apply(this, args);\n            }, remaining);\n          }\n        };\n      }\n\n      /**\n       * @function parseNgRepeatExp\n       * @private\n       * @param {string} expression\n       * @returns {Object}\n       *\n       * @description\n       * Parse ngRepeat expression and\n       * return the name of the loop variable, the collection and tracking expression\n       */\n      function parseNgRepeatExp(expression) {\n        var matches = expression.match(NG_REPEAT_REGEXP);\n\n        return {\n          item: matches[1],\n          collection: matches[2],\n          trackBy: matches[3]\n        };\n      }\n\n      /**\n       * @constructor dc.endlessScroll.EndlessScroller\n       * @param {Object} scope The scope of the directive.\n       * @param {Object} element The element of the directive.\n       * @param {Object} attrs The attributes of the directive.\n       *\n       * @description\n       * The controller of endlessScroll directive.\n       * Each directive creates an instance of EndlessScroller.\n       */\n      function EndlessScroller(scope, element, attrs) {\n        var defaultOptions = {\n          scrollOffset: -100,\n          scrollThrottle: 300\n        };\n\n        // Priviledged properties\n        this.scope = scope;\n        this.attrs = attrs;\n        this.element = $(element);\n        this.options = angular.extend({}, defaultOptions, this.scope.$eval(this.attrs.endlessScrollOptions));\n        this.docWindow = $($window);\n        this.window = this.options.window ? $(this.options.window) : this.docWindow;\n        this.dimension = { window: {}, parent: {}, items: [] };\n        this.status = {};\n        this.expression = parseNgRepeatExp(this.attrs.endlessScroll);\n\n        // Watch for events and scope changes\n        this._watch();\n      }\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#check\n       *\n       * @description\n       * Check to see if more items need to be fetched\n       * by checking if the user has scrolled to the bottom or top.\n       */\n      EndlessScroller.prototype.check = function() {\n        // Determine if scrolling up or down and if we reach the end of list or not\n        angular.extend(this.status, this._getScrollStatus());\n\n        // Determine window dimension\n        this.dimension.window = this._getDimension('window');\n\n        // Determine parent element dimension\n        this.dimension.parent = this._getDimension('parent');\n\n        // Clean up off-screen elements\n        this.clean();\n\n        // If scrolled to bottom, request more items\n        if (this.status.isEndReached && this.status.isScrollingDown &&\n            this.dimension.parent.bottom + this.options.scrollOffset <= this.dimension.window.bottom) {\n          this.next();\n        }\n\n        // If scrolled to top, request more items\n        if (this.status.isStartReached && this.status.isScrollingUp &&\n            this.dimension.parent.top - this.options.scrollOffset >= this.dimension.window.top) {\n          this.previous();\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#next\n       *\n       * @description\n       * Request the next page of items by notifying its parent controller.\n       */\n      EndlessScroller.prototype.next = function() {\n        if (!this.status.isPendingNext) {\n          this._setPending('next', true);\n\n          // Notify parent scope\n          this.scope.$emit('endlessScroll:next', this);\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#previous\n       *\n       * @description\n       * Request the previous page of items by notifying its parent controller.\n       */\n      EndlessScroller.prototype.previous = function() {\n        if (!this.status.isPendingPrevious) {\n          this._setPending('previous', true);\n\n          // Notify parent scope\n          this.scope.$emit('endlessScroll:previous', this);\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#update\n       * @param {Array} collection A list of items bound to the directive.\n       *\n       * @description\n       * Insert new items before or after a list of existing items and render them.\n       */\n      EndlessScroller.prototype.update = function(collection) {\n        var beforeItems,\n            afterItems,\n            firstCommonItemIndex,\n            lastCommonItemIndex,\n            oldCollection,\n            i,\n            len;\n\n        // KLUGE: collection == oldCollection before AngularJS 1.2.15\n        oldCollection = this.previousOriginalItems;\n\n        // Retain reference to original items\n        this.originalItems = collection;\n\n        // Get new items\n        if (angular.isArray(collection) && angular.isArray(oldCollection)) {\n          // Find first common item index\n          for (i = 0, len = collection.length; i < len; i++) {\n            if (collection[i] === oldCollection[0] && collection[i] !== undefined) {\n              firstCommonItemIndex = i;\n              break;\n            }\n          }\n\n          // Find last common item index\n          for (i = collection.length - 1; i >= 0; i--) {\n            if (collection[i] === oldCollection[oldCollection.length - 1] && collection[i] !== undefined) {\n              lastCommonItemIndex = i;\n              break;\n            }\n          }\n\n          if (firstCommonItemIndex) {\n            beforeItems = collection.slice(0, firstCommonItemIndex);\n          }\n\n          if (lastCommonItemIndex) {\n            afterItems = collection.slice(lastCommonItemIndex + 1);\n          }\n        }\n\n        // Add to items\n        if (!angular.isArray(this.items) || this.items.length === 0) {\n          if (angular.isArray(collection)) {\n            this.items = collection.slice();\n          }\n        } else {\n          if (beforeItems) {\n            this.items.unshift.apply(this.items, beforeItems);\n          }\n\n          if (afterItems) {\n            this.items.push.apply(this.items, afterItems);\n          }\n        }\n\n        // Previous collection\n        if (angular.isArray(collection)) {\n          this.previousOriginalItems = collection.slice();\n        }\n\n        // Flag status\n        $timeout(angular.bind(this, function() {\n          this._setPending('next', false);\n          this._setPending('previous', false);\n\n          // Perform check\n          if (angular.isArray(collection) && angular.isArray(oldCollection)) {\n            this.check();\n          }\n        }));\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#clean\n       *\n       * @description\n       * Remove items which are not visible in the viewport from DOM\n       * and re-insert them when they become visible again.\n       */\n      EndlessScroller.prototype.clean = function() {\n        var firstVisibleItemIndex,\n            lastVisibleItemIndex,\n            defaultPlaceholderAttrs,\n            placeholderHeight,\n            itemTagName,\n            newItems,\n            children,\n            parent = this._getParent();\n\n        // Set default placeholder attrs\n        defaultPlaceholderAttrs = {\n          visibility: 'hidden',\n          padding: 0,\n          border: 0\n        };\n\n        // Determine dimension of each repeated element\n        this.dimension.items = this._getDimension('items');\n\n        if (this.dimension.items && this.originalItems &&\n            this.dimension.items.length === this.originalItems.length) {\n          // Determine tag name\n          children = this._getChildren();\n          itemTagName = children.get(0) && children.prop('tagName').toLowerCase();\n\n          // Determine first and last visible item\n          angular.forEach(this.dimension.items, function(dimension, itemIndex) {\n            var isVisible = dimension.bottom >= this.dimension.window.top - this.dimension.window.height &&\n                            dimension.top <= this.dimension.window.bottom + this.dimension.window.height;\n\n            // Set reference to item index\n            if (isVisible) {\n              if (firstVisibleItemIndex === undefined) {\n                firstVisibleItemIndex = itemIndex;\n              }\n\n              lastVisibleItemIndex = itemIndex;\n            }\n          }, this);\n\n          // Create placeholder\n          if (!this.placeholder && itemTagName) {\n            this.placeholder = $('<' + itemTagName + '>');\n\n            // Insert placeholder before all items\n            this.placeholder\n              .css(defaultPlaceholderAttrs)\n              .prependTo(parent);\n          }\n\n          // Calculate total space occupied by items before the first visible item\n          if (this.placeholder) {\n            if (angular.isDefined(firstVisibleItemIndex)) {\n              placeholderHeight = this.dimension.items[firstVisibleItemIndex].top - this.dimension.parent.top;\n            } else {\n              placeholderHeight = 0;\n            }\n\n            this.placeholder.height(placeholderHeight);\n          }\n\n          // Add to items\n          if (angular.isDefined(firstVisibleItemIndex) &&\n              angular.isDefined(lastVisibleItemIndex) &&\n              angular.isArray(this.items) &&\n              angular.isArray(this.originalItems)) {\n            newItems = this.originalItems.slice(firstVisibleItemIndex, lastVisibleItemIndex + 1);\n            this.items.splice.apply(this.items, [0, this.items.length].concat(newItems));\n          }\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_watch\n       * @protected\n       *\n       * @description\n       * Watch for changes to scope properties and events fired by the scope and DOM\n       */\n      EndlessScroller.prototype._watch = function() {\n        var collectionExp = this.expression.collection;\n\n        if (collectionExp) {\n          // Watch for data changes\n          this.scope.$watch(collectionExp, angular.bind(this, function watch(collection, oldCollection) {\n            if (collection && oldCollection && this.items) {\n              this.items = undefined;\n            }\n          }));\n\n          this.scope.$watchCollection(collectionExp, angular.bind(this, function watchCollection() {\n            this.update.apply(this, arguments);\n          }));\n\n          // Watch for onScroll event\n          this.window.on('scroll', this._boundOnScroll = angular.bind(this, this._onScroll));\n\n          // Watch for $destroy event\n          this.scope.$on('$destroy', angular.bind(this, this._unwatch));\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_unwatch\n       * @protected\n       *\n       * @description\n       * Watch for changes to scope properties and events fired by the scope and DOM\n       */\n      EndlessScroller.prototype._unwatch = function() {\n        if (this._boundOnScroll) {\n          this.window.off('scroll', this._boundOnScroll);\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_setPending\n       * @protected\n       * @param {string} type\n       * @param {boolean} [bool=true]\n       *\n       * @description\n       * Set a flag to indicate if the directive is pending for more items.\n       */\n      EndlessScroller.prototype._setPending = function(type, bool) {\n        var attr = 'isPending' + type.charAt(0).toUpperCase() + type.slice(1).toLowerCase();\n\n        this.status[attr] = angular.isUndefined(bool) ? true : !!bool;\n        this.timeouts = this.timeouts || {};\n\n        if (this.status[attr]) {\n          if (this.timeouts[attr]) {\n            $timeout.cancel(this.timeouts[attr]);\n            delete this.timeouts[attr];\n          }\n\n          // Automatically set the wait status to false after a time period\n          this.timeouts[attr] = $timeout(angular.bind(this, function() {\n            this.status[attr] = false;\n          }), 5000);\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_onScroll\n       * @protected\n       *\n       * @description\n       * An event handler for scrolling.\n       */\n      EndlessScroller.prototype._onScroll = function() {\n        this.scope.$apply(angular.bind(this, function() {\n          // Define a throttled check method, if it's not already defined\n          if (!this._throttledCheck) {\n            this._throttledCheck = throttle(angular.bind(this, this.check), this.options.scrollThrottle);\n          }\n\n          // Check if there's a need to fetch more data\n          this._throttledCheck();\n        }));\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_getParent\n       * @protected\n       * @returns {Object} The parent element of the directive element.\n       *\n       * @description\n       * Find the parent element of the directive and return it.\n       */\n      EndlessScroller.prototype._getParent = function() {\n        if (!this._parent || !this._parent.get(0)) {\n          this._parent = this.element.parent();\n        }\n\n        return this._parent;\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_getOffsetTop\n       * @protected\n       * @returns {Number} The offset top of an element relative to the document\n       *\n       * @description\n       * Get the offset top of an element\n       */\n      EndlessScroller.prototype._getOffsetTop = function(element) {\n        var offset = element.offset();\n\n        if (this.window.get(0) === $window) {\n          return offset.top;\n        } else {\n          return offset.top + this.window.scrollTop() - this.docWindow.scrollTop();\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_getDimension\n       * @protected\n       * @param {string} type\n       */\n      EndlessScroller.prototype._getDimension = function(type) {\n        var height,\n            top,\n            bottom,\n            parent = this._getParent();\n\n        switch(type) {\n          case 'window':\n            height = this.window.outerHeight();\n            top    = this.window.scrollTop();\n            bottom = top + height;\n\n            return {\n              height: height,\n              top:    top,\n              bottom: bottom\n            };\n\n          case 'parent':\n            height = parent.outerHeight();\n            top    = parent.get(0) && this._getOffsetTop(parent);\n            bottom = top + height;\n\n            return {\n              height: height,\n              top:    top,\n              bottom: bottom\n            };\n\n          case 'items':\n            var itemIndex,\n                items = this.dimension.items.slice();\n\n            this._getChildren()\n              .each(angular.bind(this, function(i, child) {\n                child = $(child);\n                height = child.outerHeight();\n                top = child.get(0) && this._getOffsetTop(child);\n                bottom = top + height;\n                itemIndex = $.inArray(child.scope()[this.expression.item], this.originalItems);\n\n                // Set reference to the dimension of each visible element\n                if (itemIndex > -1) {\n                  items[itemIndex] = {\n                    height: height,\n                    top: top,\n                    bottom: bottom\n                  };\n                }\n              }));\n\n            return items;\n        }\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_getScrollStatus\n       * @protected\n       * @returns {Object} An object containing information about the scroll status of the directive element.\n       */\n      EndlessScroller.prototype._getScrollStatus = function() {\n        var windowTop = this.window.scrollTop(),\n            status = {};\n\n        if (this.dimension.window.top > 0) {\n          status.isScrollingUp = windowTop - this.dimension.window.top < 0;\n          status.isScrollingDown = windowTop - this.dimension.window.top > 0;\n        } else {\n          status.isScrollingUp = false;\n          status.isScrollingDown = true;\n        }\n\n        if (angular.isArray(this.items) && angular.isArray(this.originalItems)) {\n          status.isEndReached = this.items[this.items.length - 1] === this.originalItems[this.originalItems.length - 1];\n          status.isStartReached = this.items[0] === this.originalItems[0];\n        } else {\n          status.isEndReached = true;\n          status.isStartReached = false;\n        }\n\n        return status;\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScroller#_getChildren\n       * @protected\n       * @returns The child elements of the directive element. It is the list of items which are currently rendered in DOM.\n       */\n      EndlessScroller.prototype._getChildren = function() {\n        var selector = '[ng-repeat]';\n\n        return this._getParent().children(selector);\n      };\n\n      /**\n       * @constructor dc.endlessScroll.EndlessScrollerTemplate\n       * @param {Object} element The directive element.\n       * @param {Object} attrs The directive attributes.\n       *\n       * @description\n       * The template of endlessScroll directive.\n       */\n      function EndlessScrollerTemplate(element, attrs) {\n        this.html = this._create(element, attrs);\n      }\n\n      /**\n       * @function dc.endlessScroll.EndlessScrollerTemplate#toString\n       * @returns {String} The template element as HTML string\n       */\n      EndlessScrollerTemplate.prototype.toString = function() {\n        return this.html;\n      };\n\n      /**\n       * @function dc.endlessScroll.EndlessScrollerTemplate#_create\n       * @param element {Object}\n       * @param attrs {Object}\n       * @returns {String} The template element as HTML string\n       *\n       * @description\n       * Create a template element for the directive.\n       */\n      EndlessScrollerTemplate.prototype._create = function(element, attrs) {\n        var elementAttrs = Array.prototype.slice.call(element.prop('attributes'), 0),\n            parsedExp = parseNgRepeatExp(attrs.endlessScroll),\n            ngRepeatExp = parsedExp.item + ' in _endlessScroll.items' + (parsedExp.trackBy ? ' ' + parsedExp.trackBy : '');\n\n        // Remove all element attributes as 'replace' already copies over these attributes\n        angular.forEach(elementAttrs, function(attr) {\n          element.removeAttr(attr.name);\n        });\n\n        // Retain reference to the original repeat expression\n        element.attr('ng-repeat', ngRepeatExp);\n\n        return element.prop('outerHTML');\n      };\n\n      return {\n        restrict: 'A',\n        scope: true,\n        replace: true,\n\n        template: function(element, attrs) {\n          return (new EndlessScrollerTemplate(element, attrs)).toString();\n        },\n\n        controller: function($scope, $element, $attrs) {\n          var endlessScroll = new EndlessScroller($scope, $element, $attrs);\n\n          $scope._endlessScroll = endlessScroll;\n\n          return endlessScroll;\n        }\n      };\n    });\n})();\n"],"names":["angular","module","directive","$window","$timeout","NG_REPEAT_REGEXP","parseNgRepeatExp","expression","matches","match","item","collection","trackBy","EndlessScroller","scope","element","attrs","this","$","options","extend","scrollOffset","scrollThrottle","$eval","endlessScrollOptions","docWindow","window","dimension","parent","items","status","endlessScroll","_watch","EndlessScrollerTemplate","html","_create","prototype","check","_getScrollStatus","_getDimension","clean","isEndReached","isScrollingDown","bottom","next","isStartReached","isScrollingUp","top","previous","isPendingNext","_setPending","$emit","isPendingPrevious","update","beforeItems","afterItems","firstCommonItemIndex","lastCommonItemIndex","oldCollection","i","len","previousOriginalItems","originalItems","isArray","length","undefined","slice","unshift","apply","push","bind","firstVisibleItemIndex","lastVisibleItemIndex","defaultPlaceholderAttrs","placeholderHeight","itemTagName","newItems","children","_getParent","visibility","padding","border","_getChildren","get","prop","toLowerCase","forEach","itemIndex","height","placeholder","css","prependTo","isDefined","splice","concat","collectionExp","$watch","$watchCollection","arguments","on","_boundOnScroll","_onScroll","$on","_unwatch","off","type","bool","attr","charAt","toUpperCase","isUndefined","timeouts","cancel","$apply","fn","delay","timeout","_throttledCheck","current","Date","getTime","remaining","args","_parent","_getOffsetTop","offset","scrollTop","outerHeight","each","child","inArray","windowTop","toString","elementAttrs","Array","call","parsedExp","ngRepeatExp","removeAttr","name","restrict","replace","template","controller","$scope","$element","$attrs","_endlessScroll"],"sourceRoot":""}