diff --git a/dist/famous-flex-global.js b/dist/famous-flex-global.js
index 70c5675..a321d8e 100644
--- a/dist/famous-flex-global.js
+++ b/dist/famous-flex-global.js
@@ -8,8 +8,8 @@
 * @copyright Gloey Apps, 2014/2015
 *
 * @library famous-flex
-* @version 0.3.5
-* @generated 07-09-2015
+* @version 0.3.6
+* @generated 09-11-2015
 */
 (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
 var View = window.famous.core.View;
@@ -1116,7 +1116,7 @@ FlexScrollView.prototype.commit = function (context) {
     return result;
 };
 module.exports = FlexScrollView;
-},{"./LayoutUtility":8,"./ScrollController":9,"./layouts/ListLayout":17}],3:[function(require,module,exports){
+},{"./LayoutUtility":8,"./ScrollController":10,"./layouts/ListLayout":18}],3:[function(require,module,exports){
 var OptionsManager = window.famous.core.OptionsManager;
 var Transform = window.famous.core.Transform;
 var Vector = window.famous.math.Vector;
@@ -1584,6 +1584,7 @@ module.exports = LayoutContext;
 var Utility = window.famous.utilities.Utility;
 var Entity = window.famous.core.Entity;
 var ViewSequence = window.famous.core.ViewSequence;
+var LinkedListViewSequence = require('./LinkedListViewSequence');
 var OptionsManager = window.famous.core.OptionsManager;
 var EventHandler = window.famous.core.EventHandler;
 var LayoutUtility = require('./LayoutUtility');
@@ -1705,37 +1706,36 @@ LayoutController.prototype.setOptions = function (options) {
     return this;
 };
 function _forEachRenderable(callback) {
-    var dataSource = this._dataSource;
-    if (dataSource instanceof Array) {
-        for (var i = 0, j = dataSource.length; i < j; i++) {
-            callback(dataSource[i]);
-        }
-    } else if (dataSource instanceof ViewSequence) {
-        var renderable;
-        while (dataSource) {
-            renderable = dataSource.get();
-            if (!renderable) {
-                break;
-            }
-            callback(renderable);
-            dataSource = dataSource.getNext();
+    if (this._nodesById) {
+        for (var key in this._nodesById) {
+            callback(this._nodesById[key]);
         }
     } else {
-        for (var key in dataSource) {
-            callback(dataSource[key]);
+        var sequence = this._viewSequence.getHead();
+        while (sequence) {
+            var renderable = sequence.get();
+            if (renderable) {
+                callback(renderable);
+            }
+            sequence = sequence.getNext();
         }
     }
 }
 LayoutController.prototype.setDataSource = function (dataSource) {
     this._dataSource = dataSource;
-    this._initialViewSequence = undefined;
     this._nodesById = undefined;
-    if (dataSource instanceof Array) {
-        this._viewSequence = new ViewSequence(dataSource);
-        this._initialViewSequence = this._viewSequence;
-    } else if (dataSource instanceof ViewSequence || dataSource.getNext) {
+    if (dataSource instanceof ViewSequence) {
+        console.warn('The stock famo.us ViewSequence is no longer supported as it is too buggy');
+        console.warn('It has been automatically converted to the safe LinkedListViewSequence.');
+        console.warn('Please refactor your code by using LinkedListViewSequence.');
+        this._dataSource = new LinkedListViewSequence(dataSource._.array);
+        this._viewSequence = this._dataSource;
+    } else if (dataSource instanceof Array) {
+        this._viewSequence = new LinkedListViewSequence(dataSource);
+    } else if (dataSource instanceof LinkedListViewSequence) {
+        this._viewSequence = dataSource;
+    } else if (dataSource.getNext) {
         this._viewSequence = dataSource;
-        this._initialViewSequence = dataSource;
     } else if (dataSource instanceof Object) {
         this._nodesById = dataSource;
     }
@@ -1893,32 +1893,10 @@ LayoutController.prototype.insert = function (indexOrId, renderable, insertSpec)
         this._nodesById[indexOrId] = renderable;
     } else {
         if (this._dataSource === undefined) {
-            this._dataSource = [];
-            this._viewSequence = new ViewSequence(this._dataSource);
-            this._initialViewSequence = this._viewSequence;
-        }
-        var dataSource = this._viewSequence || this._dataSource;
-        var array = _getDataSourceArray.call(this);
-        if (array && indexOrId === array.length) {
-            indexOrId = -1;
-        }
-        if (indexOrId === -1) {
-            dataSource.push(renderable);
-        } else if (indexOrId === 0) {
-            if (dataSource === this._viewSequence) {
-                dataSource.splice(0, 0, renderable);
-                if (this._viewSequence.getIndex() === 0) {
-                    var nextViewSequence = this._viewSequence.getNext();
-                    if (nextViewSequence && nextViewSequence.get()) {
-                        this._viewSequence = nextViewSequence;
-                    }
-                }
-            } else {
-                dataSource.splice(0, 0, renderable);
-            }
-        } else {
-            dataSource.splice(indexOrId, 0, renderable);
+            this._dataSource = new LinkedListViewSequence();
+            this._viewSequence = this._dataSource;
         }
+        this._viewSequence.insert(indexOrId, renderable);
     }
     if (insertSpec) {
         this._nodes.insertNode(this._nodes.createNode(renderable, insertSpec));
@@ -1934,6 +1912,9 @@ LayoutController.prototype.push = function (renderable, insertSpec) {
     return this.insert(-1, renderable, insertSpec);
 };
 function _getViewSequenceAtIndex(index, startViewSequence) {
+    if (this._viewSequence.getAtIndex) {
+        return this._viewSequence.getAtIndex(index, startViewSequence);
+    }
     var viewSequence = startViewSequence || this._viewSequence;
     var i = viewSequence ? viewSequence.getIndex() : index;
     if (index > i) {
@@ -1965,14 +1946,6 @@ function _getViewSequenceAtIndex(index, startViewSequence) {
     }
     return viewSequence;
 }
-function _getDataSourceArray() {
-    if (Array.isArray(this._dataSource)) {
-        return this._dataSource;
-    } else if (this._viewSequence || this._viewSequence._) {
-        return this._viewSequence._.array;
-    }
-    return undefined;
-}
 LayoutController.prototype.get = function (indexOrId) {
     if (this._nodesById || indexOrId instanceof String || typeof indexOrId === 'string') {
         return this._nodesById ? this._nodesById[indexOrId] : undefined;
@@ -1981,22 +1954,7 @@ LayoutController.prototype.get = function (indexOrId) {
     return viewSequence ? viewSequence.get() : undefined;
 };
 LayoutController.prototype.swap = function (index, index2) {
-    var array = _getDataSourceArray.call(this);
-    if (!array) {
-        throw '.swap is only supported for dataSources of type Array or ViewSequence';
-    }
-    if (index === index2) {
-        return this;
-    }
-    if (index < 0 || index >= array.length) {
-        throw 'Invalid index (' + index + ') specified to .swap';
-    }
-    if (index2 < 0 || index2 >= array.length) {
-        throw 'Invalid second index (' + index2 + ') specified to .swap';
-    }
-    var renderNode = array[index];
-    array[index] = array[index2];
-    array[index2] = renderNode;
+    this._viewSequence.swap(index, index2);
     this._isDirty = true;
     return this;
 };
@@ -2016,33 +1974,24 @@ LayoutController.prototype.replace = function (indexOrId, renderable, noAnimatio
         }
         return oldRenderable;
     }
-    var array = _getDataSourceArray.call(this);
-    if (!array) {
-        return undefined;
-    }
-    if (indexOrId < 0 || indexOrId >= array.length) {
+    var sequence = this._viewSequence.findByIndex(indexOrId);
+    if (!sequence) {
         throw 'Invalid index (' + indexOrId + ') specified to .replace';
     }
-    oldRenderable = array[indexOrId];
+    oldRenderable = sequence.get();
+    sequence.set(renderable);
     if (oldRenderable !== renderable) {
-        array[indexOrId] = renderable;
         this._isDirty = true;
     }
     return oldRenderable;
 };
 LayoutController.prototype.move = function (index, newIndex) {
-    var array = _getDataSourceArray.call(this);
-    if (!array) {
-        throw '.move is only supported for dataSources of type Array or ViewSequence';
-    }
-    if (index < 0 || index >= array.length) {
+    var sequence = this._viewSequence.findByIndex(index);
+    if (!sequence) {
         throw 'Invalid index (' + index + ') specified to .move';
     }
-    if (newIndex < 0 || newIndex >= array.length) {
-        throw 'Invalid newIndex (' + newIndex + ') specified to .move';
-    }
-    var item = array.splice(index, 1)[0];
-    array.splice(newIndex, 0, item);
+    this._viewSequence = this._viewSequence.remove(sequence);
+    this._viewSequence.insert(newIndex, sequence.get());
     this._isDirty = true;
     return this;
 };
@@ -2063,25 +2012,17 @@ LayoutController.prototype.remove = function (indexOrId, removeSpec) {
                 }
             }
         }
-    } else if (indexOrId instanceof Number || typeof indexOrId === 'number') {
-        var array = _getDataSourceArray.call(this);
-        if (!array || indexOrId < 0 || indexOrId >= array.length) {
-            throw 'Invalid index (' + indexOrId + ') specified to .remove (or dataSource doesn\'t support remove)';
-        }
-        renderNode = array[indexOrId];
-        this._dataSource.splice(indexOrId, 1);
     } else {
-        indexOrId = this._dataSource.indexOf(indexOrId);
-        if (indexOrId >= 0) {
-            this._dataSource.splice(indexOrId, 1);
-            renderNode = indexOrId;
+        var sequence;
+        if (indexOrId instanceof Number || typeof indexOrId === 'number') {
+            sequence = this._viewSequence.findByIndex(indexOrId);
+        } else {
+            sequence = this._viewSequence.findByValue(indexOrId);
+        }
+        if (sequence) {
+            renderNode = sequence.get();
+            this._viewSequence = this._viewSequence.remove(sequence);
         }
-    }
-    if (this._viewSequence && renderNode) {
-        var viewSequence = _getViewSequenceAtIndex.call(this, this._viewSequence.getIndex(), this._initialViewSequence);
-        viewSequence = viewSequence || _getViewSequenceAtIndex.call(this, this._viewSequence.getIndex() - 1, this._initialViewSequence);
-        viewSequence = viewSequence || this._dataSource;
-        this._viewSequence = viewSequence;
     }
     if (renderNode && removeSpec) {
         var node = this._nodes.getNodeByRenderNode(renderNode);
@@ -2104,8 +2045,8 @@ LayoutController.prototype.removeAll = function (removeSpec) {
         if (dirty) {
             this._isDirty = true;
         }
-    } else if (this._dataSource) {
-        this.setDataSource([]);
+    } else if (this._viewSequence) {
+        this._viewSequence = this._viewSequence.clear();
     }
     if (removeSpec) {
         var node = this._nodes.getStartEnumNode();
@@ -2232,7 +2173,7 @@ LayoutController.prototype.cleanup = function (context) {
     }
 };
 module.exports = LayoutController;
-},{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./helpers/LayoutDockHelper":11}],6:[function(require,module,exports){
+},{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./LinkedListViewSequence":9,"./helpers/LayoutDockHelper":12}],6:[function(require,module,exports){
 var Transform = window.famous.core.Transform;
 var LayoutUtility = require('./LayoutUtility');
 function LayoutNode(renderNode, spec) {
@@ -3077,6 +3018,211 @@ LayoutUtility.getRegisteredHelper = function (name) {
 };
 module.exports = LayoutUtility;
 },{}],9:[function(require,module,exports){
+function LinkedListViewSequence(items) {
+    if (Array.isArray(items)) {
+        this._ = new this.constructor.Backing(this);
+        for (var i = 0; i < items.length; i++) {
+            this.push(items[i]);
+        }
+    } else {
+        this._ = items || new this.constructor.Backing(this);
+    }
+}
+LinkedListViewSequence.Backing = function Backing() {
+    this.length = 0;
+};
+LinkedListViewSequence.prototype.getHead = function () {
+    return this._.head;
+};
+LinkedListViewSequence.prototype.getTail = function () {
+    return this._.tail;
+};
+LinkedListViewSequence.prototype.getPrevious = function () {
+    return this._prev;
+};
+LinkedListViewSequence.prototype.getNext = function () {
+    return this._next;
+};
+LinkedListViewSequence.prototype.get = function () {
+    return this._value;
+};
+LinkedListViewSequence.prototype.set = function (value) {
+    this._value = value;
+    return this;
+};
+LinkedListViewSequence.prototype.getIndex = function () {
+    return this._value ? this.indexOf(this._value) : 0;
+};
+LinkedListViewSequence.prototype.toString = function () {
+    return '' + this.getIndex();
+};
+LinkedListViewSequence.prototype.indexOf = function (item) {
+    var sequence = this._.head;
+    var index = 0;
+    while (sequence) {
+        if (sequence._value === item) {
+            return index;
+        }
+        index++;
+        sequence = sequence._next;
+    }
+    return -1;
+};
+LinkedListViewSequence.prototype.findByIndex = function (index) {
+    index = index === -1 ? this._.length - 1 : index;
+    if (index < 0 || index >= this._.length) {
+        return undefined;
+    }
+    var searchIndex;
+    var searchSequence;
+    if (index > this._.length / 2) {
+        searchSequence = this._.tail;
+        searchIndex = this._.length - 1;
+        while (searchIndex > index) {
+            searchSequence = searchSequence._prev;
+            searchIndex--;
+        }
+    } else {
+        searchSequence = this._.head;
+        searchIndex = 0;
+        while (searchIndex < index) {
+            searchSequence = searchSequence._next;
+            searchIndex++;
+        }
+    }
+    return searchSequence;
+};
+LinkedListViewSequence.prototype.findByValue = function (value) {
+    var sequence = this._.head;
+    while (sequence) {
+        if (sequence.get() === value) {
+            return sequence;
+        }
+        sequence = sequence._next;
+    }
+    return undefined;
+};
+LinkedListViewSequence.prototype.insert = function (index, renderNode) {
+    index = index === -1 ? this._.length : index;
+    if (!this._.length) {
+        assert(index === 0, 'inserting in empty view-sequence, but not at index 0 (but ' + index + ' instead)');
+        this._value = renderNode;
+        this._.head = this;
+        this._.tail = this;
+        this._.length = 1;
+        return this;
+    }
+    var sequence;
+    if (index === 0) {
+        sequence = new LinkedListViewSequence(this._);
+        sequence._value = renderNode;
+        sequence._next = this._.head;
+        this._.head._prev = sequence;
+        this._.head = sequence;
+    } else if (index === this._.length) {
+        sequence = new LinkedListViewSequence(this._);
+        sequence._value = renderNode;
+        sequence._prev = this._.tail;
+        this._.tail._next = sequence;
+        this._.tail = sequence;
+    } else {
+        var searchIndex;
+        var searchSequence;
+        assert(index > 0 && index < this._.length, 'invalid insert index: ' + index + ' (length: ' + this._.length + ')');
+        if (index > this._.length / 2) {
+            searchSequence = this._.tail;
+            searchIndex = this._.length - 1;
+            while (searchIndex >= index) {
+                searchSequence = searchSequence._prev;
+                searchIndex--;
+            }
+        } else {
+            searchSequence = this._.head;
+            searchIndex = 1;
+            while (searchIndex < index) {
+                searchSequence = searchSequence._next;
+                searchIndex++;
+            }
+        }
+        sequence = new LinkedListViewSequence(this._);
+        sequence._value = renderNode;
+        sequence._prev = searchSequence;
+        sequence._next = searchSequence._next;
+        searchSequence._next._prev = sequence;
+        searchSequence._next = sequence;
+    }
+    this._.length++;
+    return sequence;
+};
+LinkedListViewSequence.prototype.remove = function (sequence) {
+    if (sequence._prev && sequence._next) {
+        sequence._prev._next = sequence._next;
+        sequence._next._prev = sequence._prev;
+        this._.length--;
+        return sequence === this ? sequence._prev : this;
+    } else if (!sequence._prev && !sequence._next) {
+        assert(sequence === this, 'only one sequence exists, should be this one');
+        assert(this._value, 'last node should have a value');
+        assert(this._.head, 'head is invalid');
+        assert(this._.tail, 'tail is invalid');
+        assert(this._.length === 1, 'length should be 1');
+        this._value = undefined;
+        this._.head = undefined;
+        this._.tail = undefined;
+        this._.length--;
+        return this;
+    } else if (!sequence._prev) {
+        assert(this._.head === sequence, 'head is invalid');
+        sequence._next._prev = undefined;
+        this._.head = sequence._next;
+        this._.length--;
+        return sequence === this ? this._.head : this;
+    } else {
+        assert(!sequence._next, 'next should be empty');
+        assert(this._.tail === sequence, 'tail is invalid');
+        sequence._prev._next = undefined;
+        this._.tail = sequence._prev;
+        this._.length--;
+        return sequence === this ? this._.tail : this;
+    }
+};
+LinkedListViewSequence.prototype.getLength = function () {
+    return this._.length;
+};
+LinkedListViewSequence.prototype.clear = function () {
+    var sequence = this;
+    while (this._.length) {
+        sequence = sequence.remove(this._.tail);
+    }
+    return sequence;
+};
+LinkedListViewSequence.prototype.unshift = function (renderNode) {
+    return this.insert(0, renderNode);
+};
+LinkedListViewSequence.prototype.push = function (renderNode) {
+    return this.insert(-1, renderNode);
+};
+LinkedListViewSequence.prototype.splice = function (index, remove, items) {
+    if (console.error) {
+        console.error('LinkedListViewSequence.splice is not supported');
+    }
+};
+LinkedListViewSequence.prototype.swap = function (index, index2) {
+    var sequence1 = this.findByIndex(index);
+    if (!sequence1) {
+        throw new Error('Invalid first index specified to swap: ' + index);
+    }
+    var sequence2 = this.findByIndex(index2);
+    if (!sequence2) {
+        throw new Error('Invalid second index specified to swap: ' + index2);
+    }
+    var swap = sequence1._value;
+    sequence1._value = sequence2._value;
+    sequence2._value = swap;
+    return this;
+};
+module.exports = LinkedListViewSequence;
+},{}],10:[function(require,module,exports){
 var LayoutUtility = require('./LayoutUtility');
 var LayoutController = require('./LayoutController');
 var LayoutNode = require('./LayoutNode');
@@ -3092,7 +3238,7 @@ var Particle = window.famous.physics.bodies.Particle;
 var Drag = window.famous.physics.forces.Drag;
 var Spring = window.famous.physics.forces.Spring;
 var ScrollSync = window.famous.inputs.ScrollSync;
-var ViewSequence = window.famous.core.ViewSequence;
+var LinkedListViewSequence = require('./LinkedListViewSequence');
 var Bounds = {
         NONE: 0,
         PREV: 1,
@@ -3460,6 +3606,9 @@ function _setParticle(position, velocity, phase) {
     if (position !== undefined) {
         this._scroll.particleValue = position;
         this._scroll.particle.setPosition1D(position);
+        if (this._scroll.springValue !== undefined) {
+            this._scroll.pe.wake();
+        }
     }
     if (velocity !== undefined) {
         var oldVelocity = this._scroll.particle.getVelocity1D();
@@ -3728,8 +3877,10 @@ function _normalizePrevViewSequence(scrollOffset) {
             if (this.options.alignment) {
                 normalizeNextPrev = scrollOffset >= 0;
             } else {
-                this._viewSequence = node._viewSequence;
-                normalizedScrollOffset = scrollOffset;
+                if (Math.round(scrollOffset) >= 0) {
+                    this._viewSequence = node._viewSequence;
+                    normalizedScrollOffset = scrollOffset;
+                }
             }
         }
         node = node._prev;
@@ -3741,7 +3892,7 @@ function _normalizeNextViewSequence(scrollOffset) {
     var normalizedScrollOffset = scrollOffset;
     var node = this._nodes.getStartEnumNode(true);
     while (node) {
-        if (!node._invalidated || node.scrollLength === undefined || node.trueSizeRequested || !node._viewSequence || scrollOffset > 0 && (!this.options.alignment || node.scrollLength !== 0)) {
+        if (!node._invalidated || node.scrollLength === undefined || node.trueSizeRequested || !node._viewSequence || Math.round(scrollOffset) > 0 && (!this.options.alignment || node.scrollLength !== 0)) {
             break;
         }
         if (this.options.alignment) {
@@ -4024,7 +4175,7 @@ ScrollController.prototype.goToRenderNode = function (node, noAnimation) {
     return this;
 };
 ScrollController.prototype.ensureVisible = function (node) {
-    if (node instanceof ViewSequence) {
+    if (node instanceof LinkedListViewSequence) {
         node = node.get();
     } else if (node instanceof Number || typeof node === 'number') {
         var viewSequence = this._viewSequence;
@@ -4205,6 +4356,17 @@ function _layout(size, scrollOffset, nested) {
     this._debug.layoutCount++;
     var scrollStart = 0 - Math.max(this.options.extraBoundsSpace[0], 1);
     var scrollEnd = size[this._direction] + Math.max(this.options.extraBoundsSpace[1], 1);
+    if (this.options.paginated && this.options.paginationMode === PaginationMode.PAGE) {
+        scrollStart = scrollOffset - this.options.extraBoundsSpace[0];
+        scrollEnd = scrollOffset + size[this._direction] + this.options.extraBoundsSpace[1];
+        if (scrollOffset + size[this._direction] < 0) {
+            scrollStart += size[this._direction];
+            scrollEnd += size[this._direction];
+        } else if (scrollOffset - size[this._direction] > 0) {
+            scrollStart -= size[this._direction];
+            scrollEnd -= size[this._direction];
+        }
+    }
     if (this.options.layoutAll) {
         scrollStart = -1000000;
         scrollEnd = 1000000;
@@ -4389,7 +4551,7 @@ ScrollController.prototype.render = function render() {
     }
 };
 module.exports = ScrollController;
-},{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8}],10:[function(require,module,exports){
+},{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./LinkedListViewSequence":9}],11:[function(require,module,exports){
 var EventHandler = window.famous.core.EventHandler;
 function VirtualViewSequence(options) {
     options = options || {};
@@ -4512,8 +4674,18 @@ VirtualViewSequence.prototype.swap = function () {
         console.error('VirtualViewSequence.swap is not supported and should not be called');
     }
 };
+VirtualViewSequence.prototype.insert = function () {
+    if (console.error) {
+        console.error('VirtualViewSequence.insert is not supported and should not be called');
+    }
+};
+VirtualViewSequence.prototype.remove = function () {
+    if (console.error) {
+        console.error('VirtualViewSequence.remove is not supported and should not be called');
+    }
+};
 module.exports = VirtualViewSequence;
-},{}],11:[function(require,module,exports){
+},{}],12:[function(require,module,exports){
 var LayoutUtility = require('../LayoutUtility');
 function LayoutDockHelper(context, options) {
     var size = context.size;
@@ -4716,7 +4888,7 @@ LayoutDockHelper.prototype.get = function () {
 };
 LayoutUtility.registerHelper('dock', LayoutDockHelper);
 module.exports = LayoutDockHelper;
-},{"../LayoutUtility":8}],12:[function(require,module,exports){
+},{"../LayoutUtility":8}],13:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var LayoutUtility = require('../LayoutUtility');
 var capabilities = {
@@ -4932,31 +5104,45 @@ CollectionLayout.Capabilities = capabilities;
 CollectionLayout.Name = 'CollectionLayout';
 CollectionLayout.Description = 'Multi-cell collection-layout with margins & spacing';
 module.exports = CollectionLayout;
-},{"../LayoutUtility":8}],13:[function(require,module,exports){
+},{"../LayoutUtility":8}],14:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var capabilities = {
         sequence: true,
         direction: [
-            Utility.Direction.X,
-            Utility.Direction.Y
+            Utility.Direction.Y,
+            Utility.Direction.X
         ],
         scrolling: true,
+        trueSize: true,
         sequentialScrollingOptimized: false
     };
-function CoverLayout(context, options) {
-    var node = context.next();
-    if (!node) {
-        return;
-    }
-    var size = context.size;
-    var direction = context.direction;
-    var itemSize = options.itemSize;
-    var opacityStep = 0.2;
-    var scaleStep = 0.1;
-    var translateStep = 30;
-    var zStart = 100;
-    context.set(node, {
-        size: itemSize,
+var size;
+var direction;
+var revDirection;
+var node;
+var itemSize;
+var offset;
+var bound;
+var angle;
+var itemAngle;
+var radialOpacity;
+var zOffset;
+var set = {
+        opacity: 1,
+        size: [
+            0,
+            0
+        ],
+        translate: [
+            0,
+            0,
+            0
+        ],
+        rotate: [
+            0,
+            0,
+            0
+        ],
         origin: [
             0.5,
             0.5
@@ -4965,81 +5151,71 @@ function CoverLayout(context, options) {
             0.5,
             0.5
         ],
-        translate: [
-            0,
-            0,
-            zStart
-        ],
-        scrollLength: itemSize[direction]
-    });
-    var translate = itemSize[0] / 2;
-    var opacity = 1 - opacityStep;
-    var zIndex = zStart - 1;
-    var scale = 1 - scaleStep;
-    var prev = false;
-    var endReached = false;
-    node = context.next();
-    if (!node) {
-        node = context.prev();
-        prev = true;
-    }
-    while (node) {
-        context.set(node, {
-            size: itemSize,
-            origin: [
-                0.5,
-                0.5
-            ],
-            align: [
-                0.5,
-                0.5
-            ],
-            translate: direction ? [
-                0,
-                prev ? -translate : translate,
-                zIndex
-            ] : [
-                prev ? -translate : translate,
-                0,
-                zIndex
-            ],
-            scale: [
-                scale,
-                scale,
-                1
-            ],
-            opacity: opacity,
-            scrollLength: itemSize[direction]
-        });
-        opacity -= opacityStep;
-        scale -= scaleStep;
-        translate += translateStep;
-        zIndex--;
-        if (translate >= size[direction] / 2) {
-            endReached = true;
-        } else {
-            node = prev ? context.prev() : context.next();
-            endReached = !node;
+        scrollLength: undefined
+    };
+function CoverLayout(context, options) {
+    size = context.size;
+    zOffset = options.zOffset;
+    itemAngle = options.itemAngle;
+    direction = context.direction;
+    revDirection = direction ? 0 : 1;
+    itemSize = options.itemSize || size[direction] / 2;
+    radialOpacity = options.radialOpacity === undefined ? 1 : options.radialOpacity;
+    set.opacity = 1;
+    set.size[0] = size[0];
+    set.size[1] = size[1];
+    set.size[revDirection] = itemSize;
+    set.size[direction] = itemSize;
+    set.translate[0] = 0;
+    set.translate[1] = 0;
+    set.translate[2] = 0;
+    set.rotate[0] = 0;
+    set.rotate[1] = 0;
+    set.rotate[2] = 0;
+    set.scrollLength = itemSize;
+    offset = context.scrollOffset;
+    bound = Math.PI / 2 / itemAngle * itemSize + itemSize;
+    while (offset <= bound) {
+        node = context.next();
+        if (!node) {
+            break;
         }
-        if (endReached) {
-            if (prev) {
-                break;
+        if (offset >= -bound) {
+            set.translate[direction] = offset;
+            set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
+            set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : Math.abs(offset) * (itemAngle / itemSize);
+            if (offset > 0 && !direction || offset < 0 && direction) {
+                set.rotate[revDirection] = 0 - set.rotate[revDirection];
             }
-            endReached = false;
-            prev = true;
-            node = context.prev();
-            if (node) {
-                translate = itemSize[direction] / 2;
-                opacity = 1 - opacityStep;
-                zIndex = zStart - 1;
-                scale = 1 - scaleStep;
+            set.opacity = 1 - Math.abs(angle) / (Math.PI / 2) * (1 - radialOpacity);
+            context.set(node, set);
+        }
+        offset += itemSize;
+    }
+    offset = context.scrollOffset - itemSize;
+    while (offset >= -bound) {
+        node = context.prev();
+        if (!node) {
+            break;
+        }
+        if (offset <= bound) {
+            set.translate[direction] = offset;
+            set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
+            set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : Math.abs(offset) * (itemAngle / itemSize);
+            if (offset > 0 && !direction || offset < 0 && direction) {
+                set.rotate[revDirection] = 0 - set.rotate[revDirection];
             }
+            set.opacity = 1 - Math.abs(angle) / (Math.PI / 2) * (1 - radialOpacity);
+            context.set(node, set);
         }
+        offset -= itemSize;
     }
 }
 CoverLayout.Capabilities = capabilities;
+CoverLayout.Name = 'CoverLayout';
+CoverLayout.Description = 'CoverLayout';
 module.exports = CoverLayout;
-},{}],14:[function(require,module,exports){
+},{}],15:[function(require,module,exports){
 module.exports = function CubeLayout(context, options) {
     var itemSize = options.itemSize;
     context.set(context.next(), {
@@ -5111,12 +5287,12 @@ module.exports = function CubeLayout(context, options) {
         ]
     });
 };
-},{}],15:[function(require,module,exports){
+},{}],16:[function(require,module,exports){
 if (console.warn) {
     console.warn('GridLayout has been deprecated and will be removed in the future, use CollectionLayout instead');
 }
 module.exports = require('./CollectionLayout');
-},{"./CollectionLayout":12}],16:[function(require,module,exports){
+},{"./CollectionLayout":13}],17:[function(require,module,exports){
 var LayoutDockHelper = require('../helpers/LayoutDockHelper');
 module.exports = function HeaderFooterLayout(context, options) {
     var dock = new LayoutDockHelper(context, options);
@@ -5124,7 +5300,7 @@ module.exports = function HeaderFooterLayout(context, options) {
     dock.bottom('footer', options.footerSize !== undefined ? options.footerSize : options.footerHeight);
     dock.fill('content');
 };
-},{"../helpers/LayoutDockHelper":11}],17:[function(require,module,exports){
+},{"../helpers/LayoutDockHelper":12}],18:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var LayoutUtility = require('../LayoutUtility');
 var capabilities = {
@@ -5202,7 +5378,7 @@ function ListLayout(context, options) {
         if (!node) {
             break;
         }
-        nodeSize = getItemSize ? getItemSize(node.renderNode) : itemSize;
+        nodeSize = getItemSize ? getItemSize(node.renderNode, context.size) : itemSize;
         nodeSize = nodeSize === true ? context.resolveSize(node, size)[direction] : nodeSize;
         set.size[direction] = nodeSize;
         set.translate[direction] = offset + (alignment ? spacing : 0);
@@ -5241,7 +5417,7 @@ function ListLayout(context, options) {
         if (!node) {
             break;
         }
-        nodeSize = getItemSize ? getItemSize(node.renderNode) : itemSize;
+        nodeSize = getItemSize ? getItemSize(node.renderNode, context.size) : itemSize;
         nodeSize = nodeSize === true ? context.resolveSize(node, size)[direction] : nodeSize;
         set.scrollLength = nodeSize + spacing;
         offset -= set.scrollLength;
@@ -5305,7 +5481,7 @@ ListLayout.Capabilities = capabilities;
 ListLayout.Name = 'ListLayout';
 ListLayout.Description = 'List-layout with margins, spacing and sticky headers';
 module.exports = ListLayout;
-},{"../LayoutUtility":8}],18:[function(require,module,exports){
+},{"../LayoutUtility":8}],19:[function(require,module,exports){
 var LayoutDockHelper = require('../helpers/LayoutDockHelper');
 module.exports = function NavBarLayout(context, options) {
     var dock = new LayoutDockHelper(context, {
@@ -5361,7 +5537,7 @@ module.exports = function NavBarLayout(context, options) {
         });
     }
 };
-},{"../helpers/LayoutDockHelper":11}],19:[function(require,module,exports){
+},{"../helpers/LayoutDockHelper":12}],20:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var capabilities = {
         sequence: true,
@@ -5416,7 +5592,7 @@ function ProportionalLayout(context, options) {
 }
 ProportionalLayout.Capabilities = capabilities;
 module.exports = ProportionalLayout;
-},{}],20:[function(require,module,exports){
+},{}],21:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var LayoutUtility = require('../LayoutUtility');
 var capabilities = {
@@ -5534,7 +5710,7 @@ TabBarLayout.Capabilities = capabilities;
 TabBarLayout.Name = 'TabBarLayout';
 TabBarLayout.Description = 'TabBar widget layout';
 module.exports = TabBarLayout;
-},{"../LayoutUtility":8}],21:[function(require,module,exports){
+},{"../LayoutUtility":8}],22:[function(require,module,exports){
 var Utility = window.famous.utilities.Utility;
 var capabilities = {
         sequence: true,
@@ -5643,7 +5819,7 @@ WheelLayout.Capabilities = capabilities;
 WheelLayout.Name = 'WheelLayout';
 WheelLayout.Description = 'Spinner-wheel/slot-machine layout';
 module.exports = WheelLayout;
-},{}],22:[function(require,module,exports){
+},{}],23:[function(require,module,exports){
 var View = window.famous.core.View;
 var Surface = window.famous.core.Surface;
 var Utility = window.famous.utilities.Utility;
@@ -5931,7 +6107,7 @@ function _createOverlay() {
     this.add(this.overlay);
 }
 module.exports = DatePicker;
-},{"../LayoutController":5,"../LayoutUtility":8,"../ScrollController":9,"../VirtualViewSequence":10,"../layouts/ProportionalLayout":19,"../layouts/WheelLayout":21,"./DatePickerComponents":23}],23:[function(require,module,exports){
+},{"../LayoutController":5,"../LayoutUtility":8,"../ScrollController":10,"../VirtualViewSequence":11,"../layouts/ProportionalLayout":20,"../layouts/WheelLayout":22,"./DatePickerComponents":24}],24:[function(require,module,exports){
 var Surface = window.famous.core.Surface;
 var EventHandler = window.famous.core.EventHandler;
 function decimal1(date) {
@@ -6219,7 +6395,7 @@ module.exports = {
     Second: Second,
     Millisecond: Millisecond
 };
-},{}],24:[function(require,module,exports){
+},{}],25:[function(require,module,exports){
 var Surface = window.famous.core.Surface;
 var View = window.famous.core.View;
 var LayoutController = require('../LayoutController');
@@ -6381,7 +6557,7 @@ TabBar.prototype.getSize = function () {
     return this.options.size || (this.layout ? this.layout.getSize() : View.prototype.getSize.call(this));
 };
 module.exports = TabBar;
-},{"../LayoutController":5,"../layouts/TabBarLayout":20}],25:[function(require,module,exports){
+},{"../LayoutController":5,"../layouts/TabBarLayout":21}],26:[function(require,module,exports){
 var View = window.famous.core.View;
 var AnimationController = require('../AnimationController');
 var TabBar = require('./TabBar');
@@ -6509,7 +6685,7 @@ TabBarController.prototype.getSelectedItemIndex = function () {
     return this.tabBar.getSelectedItemIndex();
 };
 module.exports = TabBarController;
-},{"../AnimationController":1,"../LayoutController":5,"../helpers/LayoutDockHelper":11,"./TabBar":24}],26:[function(require,module,exports){
+},{"../AnimationController":1,"../LayoutController":5,"../helpers/LayoutDockHelper":12,"./TabBar":25}],27:[function(require,module,exports){
 if (typeof famousflex === 'undefined') {
     famousflex = {};
 }
@@ -6544,4 +6720,4 @@ famousflex.layouts.WheelLayout = require('./src/layouts/WheelLayout');
 famousflex.helpers = famousflex.helpers || {};
 famousflex.helpers.LayoutDockHelper = require('./src/helpers/LayoutDockHelper');
 
-},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/ScrollController":9,"./src/VirtualViewSequence":10,"./src/helpers/LayoutDockHelper":11,"./src/layouts/CollectionLayout":12,"./src/layouts/CoverLayout":13,"./src/layouts/CubeLayout":14,"./src/layouts/GridLayout":15,"./src/layouts/HeaderFooterLayout":16,"./src/layouts/ListLayout":17,"./src/layouts/NavBarLayout":18,"./src/layouts/ProportionalLayout":19,"./src/layouts/WheelLayout":21,"./src/widgets/DatePicker":22,"./src/widgets/TabBar":24,"./src/widgets/TabBarController":25}]},{},[26]);
+},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/ScrollController":10,"./src/VirtualViewSequence":11,"./src/helpers/LayoutDockHelper":12,"./src/layouts/CollectionLayout":13,"./src/layouts/CoverLayout":14,"./src/layouts/CubeLayout":15,"./src/layouts/GridLayout":16,"./src/layouts/HeaderFooterLayout":17,"./src/layouts/ListLayout":18,"./src/layouts/NavBarLayout":19,"./src/layouts/ProportionalLayout":20,"./src/layouts/WheelLayout":22,"./src/widgets/DatePicker":23,"./src/widgets/TabBar":25,"./src/widgets/TabBarController":26}]},{},[27]);
diff --git a/dist/famous-flex-global.min.js b/dist/famous-flex-global.min.js
index 3486ac9..4589d14 100644
--- a/dist/famous-flex-global.min.js
+++ b/dist/famous-flex-global.min.js
@@ -8,10 +8,10 @@
 * @copyright Gloey Apps, 2014/2015
 *
 * @library famous-flex
-* @version 0.3.5
-* @generated 07-09-2015
+* @version 0.3.6
+* @generated 09-11-2015
 */
-!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){w.apply(this,arguments),this._size=[0,0],f.call(this),a&&this.setOptions(a)}function e(a,b){var c={size:a.size,translate:[0,0,0]};this._size[0]=a.size[0],this._size[1]=a.size[1];for(var d=a.get("views"),e=a.get("transferables"),f=0,g=0;g<d.length;g++){var h=this._viewStack[g];switch(h.state){case E.HIDDEN:a.set(d[g],{size:a.size,translate:[2*a.size[0],2*a.size[1],0]});break;case E.HIDE:case E.HIDING:case E.VISIBLE:case E.SHOW:case E.SHOWING:if(2>f){f++;var i=d[g];a.set(i,c);for(var j=0;j<e.length;j++)for(var k=0;k<h.transferables.length;k++)e[j].renderNode===h.transferables[k].renderNode&&a.set(e[j],{translate:[0,0,c.translate[2]],size:[a.size[0],a.size[1]]});c.translate[2]+=b.zIndexOffset}}}}function f(){this._renderables={views:[],transferables:[]},this._viewStack=[],this.layout=new x({layout:e.bind(this),layoutOptions:this.options,dataSource:this._renderables}),this.add(this.layout),this.layout.on("layoutend",m.bind(this))}function g(a,b,c,d){if(a.view){var e=b.getSpec(c);e&&!e.trueSizeRequested?d(e):C.after(g.bind(this,a,b,c,d),1)}}function h(a,b,c){return b.getTransferable?b.getTransferable(c):b.getSpec&&b.get&&b.replace&&void 0!==b.get(c)?{get:function(){return b.get(c)},show:function(a){b.replace(c,a)},getSpec:g.bind(this,a,b,c)}:b.layout?h.call(this,a,b.layout,c):void 0}function i(a,b,c){function d(){e--,0===e&&c()}var e=0;for(var f in a.options.transfer.items)j.call(this,a,b,f,d)&&e++;e||c()}function j(a,b,c,d){var e=a.options.transfer.items[c],f={};if(f.source=h.call(this,b,b.view,c),Array.isArray(e))for(var g=0;g<e.length&&(f.target=h.call(this,a,a.view,e[g]),!f.target);g++);else f.target=h.call(this,a,a.view,e);return f.source&&f.target?(f.source.getSpec(function(b){f.sourceSpec=b,f.originalSource=f.source.get(),f.source.show(new B(new z(b))),f.originalTarget=f.target.get();var c=new B(new z({opacity:0}));c.add(f.originalTarget),f.target.show(c);var e=new z({transform:y.translate(0,0,a.options.transfer.zIndex)});f.mod=new A(b),f.renderNode=new B(e),f.renderNode.add(f.mod).add(f.originalSource),a.transferables.push(f),this._renderables.transferables.push(f.renderNode),this.layout.reflowLayout(),C.after(function(){var a;f.target.getSpec(function(b,c){f.targetSpec=b,f.transition=c,a||d()},!0)},1)}.bind(this),!1),!0):!1}function k(a,b){for(var c=0;c<a.transferables.length;c++){var d=a.transferables[c];if(d.mod.halt(),(void 0!==d.sourceSpec.opacity||void 0!==d.targetSpec.opacity)&&d.mod.setOpacity(void 0===d.targetSpec.opacity?1:d.targetSpec.opacity,d.transition||a.options.transfer.transition),a.options.transfer.fastResize){if(d.sourceSpec.transform||d.targetSpec.transform||d.sourceSpec.size||d.targetSpec.size){var e=d.targetSpec.transform||y.identity;d.sourceSpec.size&&d.targetSpec.size&&(e=y.multiply(e,y.scale(d.targetSpec.size[0]/d.sourceSpec.size[0],d.targetSpec.size[1]/d.sourceSpec.size[1],1))),d.mod.setTransform(e,d.transition||a.options.transfer.transition,b),b=void 0}}else(d.sourceSpec.transform||d.targetSpec.transform)&&(d.mod.setTransform(d.targetSpec.transform||y.identity,d.transition||a.options.transfer.transition,b),b=void 0),(d.sourceSpec.size||d.targetSpec.size)&&(d.mod.setSize(d.targetSpec.size||d.sourceSpec.size,d.transition||a.options.transfer.transition,b),b=void 0)}b&&b()}function l(a){for(var b=0;b<a.transferables.length;b++){for(var c=a.transferables[b],d=0;d<this._renderables.transferables.length;d++)if(this._renderables.transferables[d]===c.renderNode){this._renderables.transferables.splice(d,1);break}c.source.show(c.originalSource),c.target.show(c.originalTarget)}a.transferables=[],this.layout.reflowLayout()}function m(a){for(var b,c=0;c<this._viewStack.length;c++){var d=this._viewStack[c];switch(d.state){case E.HIDE:d.state=E.HIDING,r.call(this,d,b,a.size),u.call(this);break;case E.SHOW:d.state=E.SHOWING,n.call(this,d,b,a.size),u.call(this)}b=d}}function n(a,b,c){var d=a.options.show.animation?a.options.show.animation.call(void 0,!0,c):{};a.startSpec=d,a.endSpec={opacity:1,transform:y.identity},a.mod.halt(),d.transform&&a.mod.setTransform(d.transform),void 0!==d.opacity&&a.mod.setOpacity(d.opacity),d.align&&a.mod.setAlign(d.align),d.origin&&a.mod.setOrigin(d.origin);var e=o.bind(this,a,d),f=a.wait?function(){a.wait.then(e,e)}:e;b?i.call(this,a,b,f):f()}function o(a,b){if(!a.halted){var c=a.showCallback;b.transform&&(a.mod.setTransform(y.identity,a.options.show.transition,c),c=void 0),void 0!==b.opacity&&(a.mod.setOpacity(1,a.options.show.transition,c),c=void 0),k.call(this,a,c)}}function p(a,b,c){return a+(b-a)*c}function q(a,b){if(a.mod.halt(),a.halted=!0,a.startSpec&&void 0!==b&&(void 0!==a.startSpec.opacity&&void 0!==a.endSpec.opacity&&a.mod.setOpacity(p(a.startSpec.opacity,a.endSpec.opacity,b)),a.startSpec.transform&&a.endSpec.transform)){for(var c=[],d=0;d<a.startSpec.transform.length;d++)c.push(p(a.startSpec.transform[d],a.endSpec.transform[d],b));a.mod.setTransform(c)}}function r(a,b,c){var d=s.bind(this,a,b,c);a.wait?a.wait.then(d,d):d()}function s(a,b,c){var d=a.options.hide.animation?a.options.hide.animation.call(void 0,!1,c):{};if(a.endSpec=d,a.startSpec={opacity:1,transform:y.identity},!a.halted){a.mod.halt();var e=a.hideCallback;d.transform&&(a.mod.setTransform(d.transform,a.options.hide.transition,e),e=void 0),void 0!==d.opacity&&(a.mod.setOpacity(d.opacity,a.options.hide.transition,e),e=void 0),e&&e()}}function t(a,b,c){a.options={show:{transition:this.options.show.transition||this.options.transition,animation:this.options.show.animation||this.options.animation},hide:{transition:this.options.hide.transition||this.options.transition,animation:this.options.hide.animation||this.options.animation},transfer:{transition:this.options.transfer.transition||this.options.transition,items:this.options.transfer.items||{},zIndex:this.options.transfer.zIndex,fastResize:this.options.transfer.fastResize}},b&&(a.options.show.transition=(b.show?b.show.transition:void 0)||b.transition||a.options.show.transition,b&&b.show&&void 0!==b.show.animation?a.options.show.animation=b.show.animation:b&&void 0!==b.animation&&(a.options.show.animation=b.animation),a.options.transfer.transition=(b.transfer?b.transfer.transition:void 0)||b.transition||a.options.transfer.transition,a.options.transfer.items=(b.transfer?b.transfer.items:void 0)||a.options.transfer.items,a.options.transfer.zIndex=b.transfer&&void 0!==b.transfer.zIndex?b.transfer.zIndex:a.options.transfer.zIndex,a.options.transfer.fastResize=b.transfer&&void 0!==b.transfer.fastResize?b.transfer.fastResize:a.options.transfer.fastResize),a.showCallback=function(){a.showCallback=void 0,a.state=E.VISIBLE,u.call(this),l.call(this,a),a.endSpec=void 0,a.startSpec=void 0,c&&c()}.bind(this)}function u(){for(var a,b=!1,c=0,d=0;d<this._viewStack.length;){if(this._viewStack[d].state===E.HIDDEN){c++;for(var e=0;e<this._viewStack.length;e++)if(this._viewStack[e].state!==E.HIDDEN&&this._viewStack[e].view===this._viewStack[d].view){this._viewStack[d].view=void 0,this._renderables.views.splice(d,1),this._viewStack.splice(d,1),d--,c--;break}}d++}for(;c>this.options.keepHiddenViewsInDOMCount;)this._viewStack[0].view=void 0,this._renderables.views.splice(0,1),this._viewStack.splice(0,1),c--;for(d=c;d<Math.min(this._viewStack.length-c,2)+c;d++){var f=this._viewStack[d];if(f.state===E.QUEUED){a&&a.state!==E.VISIBLE&&a.state!==E.HIDING||(a&&a.state===E.VISIBLE&&(a.state=E.HIDE,a.wait=f.wait),f.state=E.SHOW,b=!0);break}f.state===E.VISIBLE&&f.hide&&(f.state=E.HIDE),(f.state===E.SHOW||f.state===E.HIDE)&&this.layout.reflowLayout(),a=f}b&&(u.call(this),this.layout.reflowLayout())}function v(){for(var a=0;a<Math.min(this._viewStack.length,2);a++){var b=this._viewStack[a];if(b.halted&&(b.halted=!1,b.endSpec)){var c;switch(b.state){case E.HIDE:case E.HIDING:c=b.hideCallback;break;case E.SHOW:case E.SHOWING:c=b.showCallback}b.mod.halt(),b.endSpec.transform&&(b.mod.setTransform(b.endSpec.transform,b.options.show.transition,c),c=void 0),void 0!==b.endSpec.opacity&&b.mod.setOpacity(b.endSpec.opacity,b.options.show.transition,c),c&&c()}}}var w=window.famous.core.View,x=a("./LayoutController"),y=window.famous.core.Transform,z=window.famous.core.Modifier,A=window.famous.modifiers.StateModifier,B=window.famous.core.RenderNode,C=window.famous.utilities.Timer,D=window.famous.transitions.Easing;d.prototype=Object.create(w.prototype),d.prototype.constructor=d,d.Animation={Slide:{Left:function(a,b){return{transform:y.translate(a?b[0]:-b[0],0,0)}},Right:function(a,b){return{transform:y.translate(a?-b[0]:b[0],0,0)}},Up:function(a,b){return{transform:y.translate(0,a?b[1]:-b[1],0)}},Down:function(a,b){return{transform:y.translate(0,a?-b[1]:b[1],0)}}},Fade:function(a,b){return{opacity:this&&void 0!==this.opacity?this.opacity:0}},Zoom:function(a,b){var c=this&&void 0!==this.scale?this.scale:.5;return{transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}},FadedZoom:function(a,b){var c=a?this&&void 0!==this.showScale?this.showScale:.9:this&&void 0!==this.hideScale?this.hideScale:1.1;return{opacity:this&&void 0!==this.opacity?this.opacity:0,transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}}},d.DEFAULT_OPTIONS={transition:{duration:400,curve:D.inOutQuad},animation:d.Animation.Fade,show:{},hide:{},transfer:{fastResize:!0,zIndex:10},zIndexOffset:0,keepHiddenViewsInDOMCount:0};var E={NONE:0,HIDE:1,HIDING:2,HIDDEN:3,SHOW:4,SHOWING:5,VISIBLE:6,QUEUED:7};d.prototype.show=function(a,b,c){if(v.call(this,a),!a)return this.hide(b,c);var d=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return d&&d.view===a&&d.state!==E.HIDDEN?(d.hide=!1,d.state===E.HIDE?(d.state=E.QUEUED,t.call(this,d,b,c),u.call(this)):c&&c(),this):(d&&d.state!==E.HIDING&&b&&(d.options.hide.transition=(b.hide?b.hide.transition:void 0)||b.transition||d.options.hide.transition,b&&b.hide&&void 0!==b.hide.animation?d.options.hide.animation=b.hide.animation:b&&void 0!==b.animation&&(d.options.hide.animation=b.animation)),d={view:a,mod:new A,state:E.QUEUED,callback:c,transferables:[],wait:b?b.wait:void 0},d.node=new B(d.mod),d.node.add(a),t.call(this,d,b,c),d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),this._renderables.views.push(d.node),this._viewStack.push(d),u.call(this),this)},d.prototype.hide=function(a,b){v.call(this);var c=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return c&&c.state!==E.HIDING?(c.hide=!0,a&&(c.options.hide.transition=(a.hide?a.hide.transition:void 0)||a.transition||c.options.hide.transition,a&&a.hide&&void 0!==a.hide.animation?c.options.hide.animation=a.hide.animation:a&&void 0!==a.animation&&(c.options.hide.animation=a.animation)),c.hideCallback=function(){c.hideCallback=void 0,c.state=E.HIDDEN,u.call(this),this.layout.reflowLayout(),b&&b()}.bind(this),u.call(this),this):this},d.prototype.halt=function(a,b){for(var c,d=0;d<this._viewStack.length;d++)if(a)switch(c=this._viewStack[d],c.state){case E.SHOW:case E.SHOWING:case E.HIDE:case E.HIDING:case E.VISIBLE:q(c,b)}else{if(c=this._viewStack[this._viewStack.length-1],c.state!==E.QUEUED&&c.state!==E.SHOW)break;this._renderables.views.splice(this._viewStack.length-1,1),this._viewStack.splice(this._viewStack.length-1,1),c.view=void 0}return this},d.prototype.abort=function(a){if(this._viewStack.length>=2&&this._viewStack[0].state===E.HIDING&&this._viewStack[1].state===E.SHOWING){var b,c=this._viewStack[0],d=this._viewStack[1];d.halted=!0,b=d.endSpec,d.endSpec=d.startSpec,d.startSpec=b,d.state=E.HIDING,d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=E.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=E.VISIBLE,u.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),v.call(this)}return this},d.prototype.get=function(){for(var a=0;a<this._viewStack.length;a++){var b=this._viewStack[a];if(b.state===E.VISIBLE||b.state===E.SHOW||b.state===E.SHOWING)return b.view}return void 0},d.prototype.getSize=function(){return this._size||this.options.size},b.exports=d},{"./LayoutController":5}],2:[function(a,b,c){function d(a){h.call(this,g.combineOptions(d.DEFAULT_OPTIONS,a)),this._thisScrollViewDelta=0,this._leadingScrollViewDelta=0,this._trailingScrollViewDelta=0}function e(a,b){a.state!==b&&(a.state=b,a.node&&a.node.setPullToRefreshStatus&&a.node.setPullToRefreshStatus(b))}function f(a){return this._pullToRefresh?this._pullToRefresh[a?1:0]:void 0}var g=a("./LayoutUtility"),h=a("./ScrollController"),i=a("./layouts/ListLayout"),j={HIDDEN:0,PULLING:1,ACTIVE:2,COMPLETED:3,HIDDING:4};d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.PullToRefreshState=j,d.Bounds=h.Bounds,d.PaginationMode=h.PaginationMode,d.DEFAULT_OPTIONS={layout:i,direction:void 0,paginated:!1,alignment:0,flow:!1,mouseMove:!1,useContainer:!1,visibleItemThresshold:.5,pullToRefreshHeader:void 0,pullToRefreshFooter:void 0,leadingScrollView:void 0,trailingScrollView:void 0},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),(a.pullToRefreshHeader||a.pullToRefreshFooter||this._pullToRefresh)&&(a.pullToRefreshHeader?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[0]||(this._pullToRefresh[0]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!1}),this._pullToRefresh[0].node=a.pullToRefreshHeader):!this.options.pullToRefreshHeader&&this._pullToRefresh&&(this._pullToRefresh[0]=void 0),a.pullToRefreshFooter?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[1]||(this._pullToRefresh[1]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!0}),this._pullToRefresh[1].node=a.pullToRefreshFooter):!this.options.pullToRefreshFooter&&this._pullToRefresh&&(this._pullToRefresh[1]=void 0),!this._pullToRefresh||this._pullToRefresh[0]||this._pullToRefresh[1]||(this._pullToRefresh=void 0)),this},d.prototype.sequenceFrom=function(a){return this.setDataSource(a)},d.prototype.getCurrentIndex=function(){var a=this.getFirstVisibleItem();return a?a.viewSequence.getIndex():-1},d.prototype.goToPage=function(a,b){var c=this._viewSequence;if(!c)return this;for(;c.getIndex()<a;)if(c=c.getNext(),!c)return this;for(;c.getIndex()>a;)if(c=c.getPrevious(),!c)return this;return this.goToRenderNode(c.get(),b),this},d.prototype.getOffset=function(){return this._scrollOffsetCache},d.prototype.getPosition=d.prototype.getOffset,d.prototype.getAbsolutePosition=function(){return-(this._scrollOffsetCache+this._scroll.groupStart)},d.prototype._postLayout=function(a,b){if(this._pullToRefresh){this.options.alignment&&(b+=a[this._direction]);for(var c,d,f,g=0;2>g;g++){var h=this._pullToRefresh[g];if(h){var i,k=h.node.getSize()[this._direction],l=h.node.getPullToRefreshSize?h.node.getPullToRefreshSize()[this._direction]:k;h.footer?(d=void 0===d?d=this._calcScrollHeight(!0):d,d=void 0===d?-1:d,i=d>=0?b+d:a[this._direction]+1,this.options.alignment||(c=void 0===c?this._calcScrollHeight(!1):c,c=void 0===c?-1:c,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-c+a[this._direction]))),i=-(i-a[this._direction])):(c=this._calcScrollHeight(!1),c=void 0===c?-1:c,i=c>=0?b-c:c,this.options.alignment&&(d=this._calcScrollHeight(!0),d=void 0===d?-1:d,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-a[this._direction]+d))));var m=Math.max(Math.min(i/l,1),0);switch(h.state){case j.HIDDEN:this._scroll.scrollForceCount&&(m>=1?e(h,j.ACTIVE):i>=.2&&e(h,j.PULLING));break;case j.PULLING:this._scroll.scrollForceCount&&m>=1?e(h,j.ACTIVE):.2>i&&e(h,j.HIDDEN);break;case j.ACTIVE:break;case j.COMPLETED:this._scroll.scrollForceCount||(i>=.2?e(h,j.HIDDING):e(h,j.HIDDEN));break;case j.HIDDING:.2>i&&e(h,j.HIDDEN)}if(h.state!==j.HIDDEN){var n,o={renderNode:h.node,prev:!h.footer,next:h.footer,index:h.footer?++this._nodes._contextState.nextGetIndex:--this._nodes._contextState.prevGetIndex};h.state===j.ACTIVE?n=k:this._scroll.scrollForceCount&&(n=Math.min(i,k));var p={size:[a[0],a[1]],translate:[0,0,-.001],scrollLength:n};p.size[this._direction]=Math.max(Math.min(i,l),0),p.translate[this._direction]=h.footer?a[this._direction]-k:0,this._nodes._context.set(o,p)}}}}},d.prototype.showPullToRefresh=function(a){var b=f.call(this,a);b&&(e(b,j.ACTIVE),this._scroll.scrollDirty=!0)},d.prototype.hidePullToRefresh=function(a){var b=f.call(this,a);return b&&b.state===j.ACTIVE&&(e(b,j.COMPLETED),this._scroll.scrollDirty=!0),this},d.prototype.isPullToRefreshVisible=function(a){var b=f.call(this,a);return b?b.state===j.ACTIVE:!1},d.prototype.applyScrollForce=function(a){var b=this.options.leadingScrollView,c=this.options.trailingScrollView;if(!b&&!c)return h.prototype.applyScrollForce.call(this,a);var d;return 0>a?(b&&(d=b.canScroll(a),this._leadingScrollViewDelta+=d,b.applyScrollForce(d),a-=d),c?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,c.applyScrollForce(a),this._trailingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)):(c&&(d=c.canScroll(a),c.applyScrollForce(d),this._trailingScrollViewDelta+=d,a-=d),b?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,b.applyScrollForce(a),this._leadingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)),this},d.prototype.updateScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.updateScrollForce.call(this,a,b);var e,f=b-a;return 0>f?(c&&(e=c.canScroll(f),c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+e),this._leadingScrollViewDelta+=e,f-=e),d&&f?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,this._trailingScrollViewDelta+=f,d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+f)):f&&(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)):(d&&(e=d.canScroll(f),d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+e),this._trailingScrollViewDelta+=e,f-=e),c?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+f),this._leadingScrollViewDelta+=f):(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)),this},d.prototype.releaseScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.releaseScrollForce.call(this,a,b);var e;return 0>a?(c&&(e=Math.max(this._leadingScrollViewDelta,a),this._leadingScrollViewDelta-=e,a-=e,c.releaseScrollForce(this._leadingScrollViewDelta,a?0:b)),d?(e=Math.max(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._trailingScrollViewDelta-=a,d.releaseScrollForce(this._trailingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?b:0))):(d&&(e=Math.min(this._trailingScrollViewDelta,a),this._trailingScrollViewDelta-=e,a-=e,d.releaseScrollForce(this._trailingScrollViewDelta,a?0:b)),c?(e=Math.min(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._leadingScrollViewDelta-=a,c.releaseScrollForce(this._leadingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,a?b:0))),this},d.prototype.commit=function(a){var b=h.prototype.commit.call(this,a);if(this._pullToRefresh)for(var c=0;2>c;c++){var d=this._pullToRefresh[c];d&&(d.state===j.ACTIVE&&d.prevState!==j.ACTIVE&&this._eventOutput.emit("refresh",{target:this,footer:d.footer}),d.prevState=d.state)}return b},b.exports=d},{"./LayoutUtility":8,"./ScrollController":9,"./layouts/ListLayout":17}],3:[function(a,b,c){function d(a,b){if(o.apply(this,arguments),this.options||(this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this._optionsManager=new i(this.options)),this._pe||(this._pe=new n,this._pe.sleep()),this._properties)for(var c in this._properties)this._properties[c].init=!1;else this._properties={};this._lockTransitionable?(this._lockTransitionable.halt(),this._lockTransitionable.reset(1)):this._lockTransitionable=new p(1),this._specModified=!0,this._initial=!0,this._spec.endState={},b&&this.setSpec(b)}function e(a,b,c,d){return a&&a.init?[a.enabled[0]?Math.round((a.curState.x+(a.endState.x-a.curState.x)*d)/c)*c:a.endState.x,a.enabled[1]?Math.round((a.curState.y+(a.endState.y-a.curState.y)*d)/c)*c:a.endState.y,a.enabled[2]?Math.round((a.curState.z+(a.endState.z-a.curState.z)*d)/c)*c:a.endState.z]:b}function f(a,b,c,d,e,f){if(a=a||this._properties[b],a&&a.init){a.invalidated=!0;var g=d;return void 0!==c?g=c:this._removing&&(g=a.particle.getPosition()),a.endState.x=g[0],a.endState.y=g.length>1?g[1]:0,a.endState.z=g.length>2?g[2]:0,void(e?(a.curState.x=a.endState.x,a.curState.y=a.endState.y,a.curState.z=a.endState.z,a.velocity.x=0,a.velocity.y=0,a.velocity.z=0):(a.endState.x!==a.curState.x||a.endState.y!==a.curState.y||a.endState.z!==a.curState.z)&&this._pe.wake())}var h=this._pe.isSleeping();a?(a.particle.setPosition(this._initial||e?c:d),a.endState.set(c)):(a={particle:new l({position:this._initial||e?c:d}),endState:new k(c)},a.curState=a.particle.position,a.velocity=a.particle.velocity,a.force=new m(this.options.spring),a.force.setOptions({anchor:a.endState}),this._pe.addBody(a.particle),a.forceId=this._pe.attach(a.force,a.particle),this._properties[b]=a),this._initial||e?h&&this._pe.sleep():this._pe.wake(),this.options.properties[b]&&this.options.properties[b].length?a.enabled=this.options.properties[b]:a.enabled=[this.options.properties[b],this.options.properties[b],this.options.properties[b]],a.init=!0,a.invalidated=!0}function g(a,b){return a[0]===b[0]&&a[1]===b[1]?void 0:a}function h(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]?void 0:a}var i=window.famous.core.OptionsManager,j=window.famous.core.Transform,k=window.famous.math.Vector,l=window.famous.physics.bodies.Particle,m=window.famous.physics.forces.Spring,n=window.famous.physics.PhysicsEngine,o=a("./LayoutNode"),p=window.famous.transitions.Transitionable;d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.DEFAULT_OPTIONS={spring:{dampingRatio:.8,period:300},properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},particleRounding:.001};var q={opacity:1,opacity2D:[1,0],size:[0,0],origin:[0,0],align:[0,0],scale:[1,1,1],translate:[0,0,0],rotate:[0,0,0],skew:[0,0,0]};d.prototype.setOptions=function(a){this._optionsManager.setOptions(a);var b=this._pe.isSleeping();for(var c in this._properties){var d=this._properties[c];a.spring&&d.force&&d.force.setOptions(this.options.spring),a.properties&&void 0!==a.properties[c]&&(this.options.properties[c].length?d.enabled=this.options.properties[c]:d.enabled=[this.options.properties[c],this.options.properties[c],this.options.properties[c]])}return b&&this._pe.sleep(),this},d.prototype.setSpec=function(a){var b;a.transform&&(b=j.interpret(a.transform)),b||(b={}),b.opacity=a.opacity,b.size=a.size,b.align=a.align,b.origin=a.origin;var c=this._removing,d=this._invalidated;this.set(b),this._removing=c,this._invalidated=d},d.prototype.reset=function(){if(this._invalidated){for(var a in this._properties)this._properties[a].invalidated=!1;this._invalidated=!1}this.trueSizeRequested=!1,this.usesTrueSize=!1},d.prototype.remove=function(a){this._removing=!0,a?this.setSpec(a):(this._pe.sleep(),this._specModified=!1),this._invalidated=!1},d.prototype.releaseLock=function(a){this._lockTransitionable.halt(),this._lockTransitionable.reset(0),a&&this._lockTransitionable.set(1,{duration:this.options.spring.period||1e3})},d.prototype.getSpec=function(){var a=this._pe.isSleeping();if(!this._specModified&&a)return this._spec.removed=!this._invalidated,this._spec;this._initial=!1,this._specModified=!a,this._spec.removed=!1,a||this._pe.step();var b=this._spec,c=this.options.particleRounding,d=this._lockTransitionable.get(),f=this._properties.opacity;f&&f.init?(b.opacity=f.enabled[0]?Math.round(Math.max(0,Math.min(1,f.curState.x))/c)*c:f.endState.x,b.endState.opacity=f.endState.x):(b.opacity=void 0,b.endState.opacity=void 0),f=this._properties.size,f&&f.init?(b.size=b.size||[0,0],b.size[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.size[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.size=b.endState.size||[0,0],b.endState.size[0]=f.endState.x,b.endState.size[1]=f.endState.y):(b.size=void 0,b.endState.size=void 0),f=this._properties.align,f&&f.init?(b.align=b.align||[0,0],b.align[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.align[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.align=b.endState.align||[0,0],b.endState.align[0]=f.endState.x,b.endState.align[1]=f.endState.y):(b.align=void 0,b.endState.align=void 0),f=this._properties.origin,f&&f.init?(b.origin=b.origin||[0,0],b.origin[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.origin[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.origin=b.endState.origin||[0,0],b.endState.origin[0]=f.endState.x,b.endState.origin[1]=f.endState.y):(b.origin=void 0,b.endState.origin=void 0);var g,h,i,k=this._properties.translate;k&&k.init?(g=k.enabled[0]?Math.round((k.curState.x+(k.endState.x-k.curState.x)*d)/c)*c:k.endState.x,h=k.enabled[1]?Math.round((k.curState.y+(k.endState.y-k.curState.y)*d)/c)*c:k.endState.y,i=k.enabled[2]?Math.round((k.curState.z+(k.endState.z-k.curState.z)*d)/c)*c:k.endState.z):(g=0,h=0,i=0);var l=this._properties.scale,m=this._properties.skew,n=this._properties.rotate;return l||m||n?(b.transform=j.build({translate:[g,h,i],skew:e.call(this,m,q.skew,this.options.particleRounding,d),scale:e.call(this,l,q.scale,this.options.particleRounding,d),rotate:e.call(this,n,q.rotate,this.options.particleRounding,d)}),b.endState.transform=j.build({translate:k?[k.endState.x,k.endState.y,k.endState.z]:q.translate,scale:l?[l.endState.x,l.endState.y,l.endState.z]:q.scale,skew:m?[m.endState.x,m.endState.y,m.endState.z]:q.skew,rotate:n?[n.endState.x,n.endState.y,n.endState.z]:q.rotate})):k?(b.transform?(b.transform[12]=g,b.transform[13]=h,b.transform[14]=i):b.transform=j.translate(g,h,i),b.endState.transform?(b.endState.transform[12]=k.endState.x,b.endState.transform[13]=k.endState.y,b.endState.transform[14]=k.endState.z):b.endState.transform=j.translate(k.endState.x,k.endState.y,k.endState.z)):(b.transform=void 0,b.endState.transform=void 0),this._spec},d.prototype.set=function(a,b){b&&(this._removing=!1),this._invalidated=!0,this.scrollLength=a.scrollLength,this._specModified=!0;var c=this._properties.opacity,d=a.opacity===q.opacity?void 0:a.opacity;(void 0!==d||c&&c.init)&&f.call(this,c,"opacity",void 0===d?void 0:[d,0],q.opacity2D),c=this._properties.align,d=a.align?g(a.align,q.align):void 0,(d||c&&c.init)&&f.call(this,c,"align",d,q.align),c=this._properties.origin,d=a.origin?g(a.origin,q.origin):void 0,(d||c&&c.init)&&f.call(this,c,"origin",d,q.origin),c=this._properties.size,d=a.size||b,(d||c&&c.init)&&f.call(this,c,"size",d,b,this.usesTrueSize),c=this._properties.translate,d=a.translate,(d||c&&c.init)&&f.call(this,c,"translate",d,q.translate,void 0,!0),c=this._properties.scale,d=a.scale?h(a.scale,q.scale):void 0,(d||c&&c.init)&&f.call(this,c,"scale",d,q.scale),c=this._properties.rotate,d=a.rotate?h(a.rotate,q.rotate):void 0,(d||c&&c.init)&&f.call(this,c,"rotate",d,q.rotate),c=this._properties.skew,d=a.skew?h(a.skew,q.skew):void 0,(d||c&&c.init)&&f.call(this,c,"skew",d,q.skew)},b.exports=d},{"./LayoutNode":6}],4:[function(a,b,c){function d(a){for(var b in a)this[b]=a[b]}d.prototype.size=void 0,d.prototype.direction=void 0,d.prototype.scrollOffset=void 0,d.prototype.scrollStart=void 0,d.prototype.scrollEnd=void 0,d.prototype.next=function(){},d.prototype.prev=function(){},d.prototype.get=function(a){},d.prototype.set=function(a,b){},d.prototype.resolveSize=function(a){},b.exports=d},{}],5:[function(a,b,c){function d(a,b){this.id=k.register(this),this._isDirty=!0,this._contextSizeCache=[0,0],this._commitOutput={},this._cleanupRegistration={commit:function(){return void 0},cleanup:function(a){this.cleanup(a)}.bind(this)},this._cleanupRegistration.target=k.register(this._cleanupRegistration),this._cleanupRegistration.render=function(){return this.target}.bind(this._cleanupRegistration),this._eventInput=new n,n.setInputHandler(this,this._eventInput),this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput),this._layout={options:Object.create({})},this._layout.optionsManager=new m(this._layout.options),this._layout.optionsManager.on("change",function(){this._isDirty=!0}.bind(this)),this.options=Object.create(d.DEFAULT_OPTIONS),this._optionsManager=new m(this.options),b?this._nodes=b:a&&a.flow?this._nodes=new p(r,e.bind(this)):this._nodes=new p(q),this.setDirection(void 0),a&&this.setOptions(a)}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(a){var b=this._dataSource;if(b instanceof Array)for(var c=0,d=b.length;d>c;c++)a(b[c]);else if(b instanceof l)for(var e;b&&(e=b.get());)a(e),b=b.getNext();else for(var f in b)a(b[f])}function g(a){if(this._layout.capabilities&&this._layout.capabilities.direction){if(Array.isArray(this._layout.capabilities.direction)){for(var b=0;b<this._layout.capabilities.direction.length;b++)if(this._layout.capabilities.direction[b]===a)return a;return this._layout.capabilities.direction[0]}return this._layout.capabilities.direction}return void 0===a?j.Direction.Y:a}function h(a,b){var c=b||this._viewSequence,d=c?c.getIndex():a;if(a>d)for(;c;){if(c=c.getNext(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(d>a)return void 0}else if(d>a)for(;c;){if(c=c.getPrevious(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(a>d)return void 0}return c}function i(){return Array.isArray(this._dataSource)?this._dataSource:this._viewSequence||this._viewSequence._?this._viewSequence._.array:void 0}var j=window.famous.utilities.Utility,k=window.famous.core.Entity,l=window.famous.core.ViewSequence,m=window.famous.core.OptionsManager,n=window.famous.core.EventHandler,o=a("./LayoutUtility"),p=a("./LayoutNodeManager"),q=a("./LayoutNode"),r=a("./FlowLayoutNode"),s=window.famous.core.Transform;a("./helpers/LayoutDockHelper"),d.DEFAULT_OPTIONS={flow:!1,flowOptions:{reflowOnResize:!0,properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},spring:{dampingRatio:.8,period:300}}},d.prototype.setOptions=function(a){return void 0!==a.alignment&&a.alignment!==this.options.alignment&&(this._isDirty=!0),this._optionsManager.setOptions(a),a.nodeSpring&&(console.warn("nodeSpring options have been moved inside `flowOptions`. Use `flowOptions.spring` instead."),this._optionsManager.setOptions({flowOptions:{spring:a.nodeSpring
-}}),this._nodes.setNodeOptions(this.options.flowOptions)),void 0!==a.reflowOnResize&&(console.warn("reflowOnResize options have been moved inside `flowOptions`. Use `flowOptions.reflowOnResize` instead."),this._optionsManager.setOptions({flowOptions:{reflowOnResize:a.reflowOnResize}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.insertSpec&&(console.warn("insertSpec options have been moved inside `flowOptions`. Use `flowOptions.insertSpec` instead."),this._optionsManager.setOptions({flowOptions:{insertSpec:a.insertSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.removeSpec&&(console.warn("removeSpec options have been moved inside `flowOptions`. Use `flowOptions.removeSpec` instead."),this._optionsManager.setOptions({flowOptions:{removeSpec:a.removeSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.dataSource&&this.setDataSource(a.dataSource),a.layout?this.setLayout(a.layout,a.layoutOptions):a.layoutOptions&&this.setLayoutOptions(a.layoutOptions),void 0!==a.direction&&this.setDirection(a.direction),a.flowOptions&&this.options.flow&&this._nodes.setNodeOptions(this.options.flowOptions),a.preallocateNodes&&this._nodes.preallocateNodes(a.preallocateNodes.count||0,a.preallocateNodes.spec),this},d.prototype.setDataSource=function(a){return this._dataSource=a,this._initialViewSequence=void 0,this._nodesById=void 0,a instanceof Array?(this._viewSequence=new l(a),this._initialViewSequence=this._viewSequence):a instanceof l||a.getNext?(this._viewSequence=a,this._initialViewSequence=a):a instanceof Object&&(this._nodesById=a),this.options.autoPipeEvents&&(this._dataSource.pipe?(this._dataSource.pipe(this),this._dataSource.pipe(this._eventOutput)):f.call(this,function(a){a&&a.pipe&&(a.pipe(this),a.pipe(this._eventOutput))}.bind(this))),this._isDirty=!0,this},d.prototype.getDataSource=function(){return this._dataSource},d.prototype.setLayout=function(a,b){if(a instanceof Function)this._layout._function=a,this._layout.capabilities=a.Capabilities,this._layout.literal=void 0;else if(a instanceof Object){this._layout.literal=a,this._layout.capabilities=void 0;var c=Object.keys(a)[0],d=o.getRegisteredHelper(c);this._layout._function=d?function(b,e){var f=new d(b,e);f.parse(a[c])}:void 0}else this._layout._function=void 0,this._layout.capabilities=void 0,this._layout.literal=void 0;return b&&this.setLayoutOptions(b),this.setDirection(this._configuredDirection),this._isDirty=!0,this},d.prototype.getLayout=function(){return this._layout.literal||this._layout._function},d.prototype.setLayoutOptions=function(a){return this._layout.optionsManager.setOptions(a),this},d.prototype.getLayoutOptions=function(){return this._layout.options},d.prototype.setDirection=function(a){this._configuredDirection=a;var b=g.call(this,a);b!==this._direction&&(this._direction=b,this._isDirty=!0)},d.prototype.getDirection=function(a){return a?this._direction:this._configuredDirection},d.prototype.getSpec=function(a,b,c){if(!a)return void 0;if(a instanceof String||"string"==typeof a){if(!this._nodesById)return void 0;if(a=this._nodesById[a],!a)return void 0;if(a instanceof Array)return a}if(this._specs)for(var d=0;d<this._specs.length;d++){var e=this._specs[d];if(e.renderNode===a){if(c&&e.endState&&(e=e.endState),b&&e.transform&&e.size&&(e.align||e.origin)){var f=e.transform;return e.align&&(e.align[0]||e.align[1])&&(f=s.thenMove(f,[e.align[0]*this._contextSizeCache[0],e.align[1]*this._contextSizeCache[1],0])),e.origin&&(e.origin[0]||e.origin[1])&&(f=s.moveThen([-e.origin[0]*e.size[0],-e.origin[1]*e.size[1],0],f)),{opacity:e.opacity,size:e.size,transform:f}}return e}}return void 0},d.prototype.reflowLayout=function(){return this._isDirty=!0,this},d.prototype.resetFlowState=function(){return this.options.flow&&(this._resetFlowState=!0),this},d.prototype.insert=function(a,b,c){if(a instanceof String||"string"==typeof a){if(void 0===this._dataSource&&(this._dataSource={},this._nodesById=this._dataSource),this._nodesById[a]===b)return this;this._nodesById[a]=b}else{void 0===this._dataSource&&(this._dataSource=[],this._viewSequence=new l(this._dataSource),this._initialViewSequence=this._viewSequence);var d=this._viewSequence||this._dataSource,e=i.call(this);if(e&&a===e.length&&(a=-1),-1===a)d.push(b);else if(0===a)if(d===this._viewSequence){if(d.splice(0,0,b),0===this._viewSequence.getIndex()){var f=this._viewSequence.getNext();f&&f.get()&&(this._viewSequence=f)}}else d.splice(0,0,b);else d.splice(a,0,b)}return c&&this._nodes.insertNode(this._nodes.createNode(b,c)),this.options.autoPipeEvents&&b&&b.pipe&&(b.pipe(this),b.pipe(this._eventOutput)),this._isDirty=!0,this},d.prototype.push=function(a,b){return this.insert(-1,a,b)},d.prototype.get=function(a){if(this._nodesById||a instanceof String||"string"==typeof a)return this._nodesById?this._nodesById[a]:void 0;var b=h.call(this,a);return b?b.get():void 0},d.prototype.swap=function(a,b){var c=i.call(this);if(!c)throw".swap is only supported for dataSources of type Array or ViewSequence";if(a===b)return this;if(0>a||a>=c.length)throw"Invalid index ("+a+") specified to .swap";if(0>b||b>=c.length)throw"Invalid second index ("+b+") specified to .swap";var d=c[a];return c[a]=c[b],c[b]=d,this._isDirty=!0,this},d.prototype.replace=function(a,b,c){var d;if(this._nodesById||a instanceof String||"string"==typeof a){if(d=this._nodesById[a],d!==b){if(c&&d){var e=this._nodes.getNodeByRenderNode(d);e&&e.setRenderNode(b)}this._nodesById[a]=b,this._isDirty=!0}return d}var f=i.call(this);if(!f)return void 0;if(0>a||a>=f.length)throw"Invalid index ("+a+") specified to .replace";return d=f[a],d!==b&&(f[a]=b,this._isDirty=!0),d},d.prototype.move=function(a,b){var c=i.call(this);if(!c)throw".move is only supported for dataSources of type Array or ViewSequence";if(0>a||a>=c.length)throw"Invalid index ("+a+") specified to .move";if(0>b||b>=c.length)throw"Invalid newIndex ("+b+") specified to .move";var d=c.splice(a,1)[0];return c.splice(b,0,d),this._isDirty=!0,this},d.prototype.remove=function(a,b){var c;if(this._nodesById||a instanceof String||"string"==typeof a){if(a instanceof String||"string"==typeof a)c=this._nodesById[a],c&&delete this._nodesById[a];else for(var d in this._nodesById)if(this._nodesById[d]===a){delete this._nodesById[d],c=a;break}}else if(a instanceof Number||"number"==typeof a){var e=i.call(this);if(!e||0>a||a>=e.length)throw"Invalid index ("+a+") specified to .remove (or dataSource doesn't support remove)";c=e[a],this._dataSource.splice(a,1)}else a=this._dataSource.indexOf(a),a>=0&&(this._dataSource.splice(a,1),c=a);if(this._viewSequence&&c){var f=h.call(this,this._viewSequence.getIndex(),this._initialViewSequence);f=f||h.call(this,this._viewSequence.getIndex()-1,this._initialViewSequence),f=f||this._dataSource,this._viewSequence=f}if(c&&b){var g=this._nodes.getNodeByRenderNode(c);g&&g.remove(b||this.options.flowOptions.removeSpec)}return c&&(this._isDirty=!0),c},d.prototype.removeAll=function(a){if(this._nodesById){var b=!1;for(var c in this._nodesById)delete this._nodesById[c],b=!0;b&&(this._isDirty=!0)}else this._dataSource&&this.setDataSource([]);if(a)for(var d=this._nodes.getStartEnumNode();d;)d.remove(a||this.options.flowOptions.removeSpec),d=d._next;return this},d.prototype.getSize=function(){return this._size||this.options.size},d.prototype.render=function(){return this.id},d.prototype.commit=function(a){var b=a.transform,c=a.origin,d=a.size,e=a.opacity;if(this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll()),d[0]!==this._contextSizeCache[0]||d[1]!==this._contextSizeCache[1]||this._isDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout){var f={target:this,oldSize:this._contextSizeCache,size:d,dirty:this._isDirty,trueSizeRequested:this._nodes._trueSizeRequested};if(this._eventOutput.emit("layoutstart",f),this.options.flow){var g=!1;if(this.options.flowOptions.reflowOnResize||(g=this._isDirty||d[0]===this._contextSizeCache[0]&&d[1]===this._contextSizeCache[1]?!0:void 0),void 0!==g)for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(g),h=h._next}this._contextSizeCache[0]=d[0],this._contextSizeCache[1]=d[1],this._isDirty=!1;var i;this.options.size&&this.options.size[this._direction]===!0&&(i=1e6);var j=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:d,direction:this._direction,scrollEnd:i});if(this._layout._function&&this._layout._function(j,this._layout.options),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),this._nodes.removeVirtualViewSequenceNodes(),i){for(i=0,h=this._nodes.getStartEnumNode();h;)h._invalidated&&h.scrollLength&&(i+=h.scrollLength),h=h._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}var k=this._nodes.buildSpecAndDestroyUnrenderedNodes();this._specs=k.specs,this._commitOutput.target=k.specs,this._eventOutput.emit("layoutend",f),this._eventOutput.emit("reflow",{target:this})}else this.options.flow&&(k=this._nodes.buildSpecAndDestroyUnrenderedNodes(),this._specs=k.specs,this._commitOutput.target=k.specs,k.modified&&this._eventOutput.emit("reflow",{target:this}));for(var l=this._commitOutput.target,m=0,n=l.length;n>m;m++)l[m].renderNode&&(l[m].target=l[m].renderNode.render());return l.length&&l[l.length-1]===this._cleanupRegistration||l.push(this._cleanupRegistration),!c||0===c[0]&&0===c[1]||(b=s.moveThen([-d[0]*c[0],-d[1]*c[1],0],b)),this._commitOutput.size=d,this._commitOutput.opacity=e,this._commitOutput.transform=b,this._commitOutput},d.prototype.cleanup=function(a){this.options.flow&&(this._resetFlowState=!0)},b.exports=d},{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./helpers/LayoutDockHelper":11}],6:[function(a,b,c){function d(a,b){this.renderNode=a,this._spec=b?f.cloneSpec(b):{},this._spec.renderNode=a,this._specModified=!0,this._invalidated=!1,this._removing=!1}var e=window.famous.core.Transform,f=a("./LayoutUtility");d.prototype.setRenderNode=function(a){this.renderNode=a,this._spec.renderNode=a},d.prototype.setOptions=function(a){},d.prototype.destroy=function(){this.renderNode=void 0,this._spec.renderNode=void 0,this._viewSequence=void 0},d.prototype.reset=function(){this._invalidated=!1,this.trueSizeRequested=!1},d.prototype.setSpec=function(a){if(this._specModified=!0,a.align?(a.align||(this._spec.align=[0,0]),this._spec.align[0]=a.align[0],this._spec.align[1]=a.align[1]):this._spec.align=void 0,a.origin?(a.origin||(this._spec.origin=[0,0]),this._spec.origin[0]=a.origin[0],this._spec.origin[1]=a.origin[1]):this._spec.origin=void 0,a.size?(a.size||(this._spec.size=[0,0]),this._spec.size[0]=a.size[0],this._spec.size[1]=a.size[1]):this._spec.size=void 0,a.transform)if(a.transform)for(var b=0;16>b;b++)this._spec.transform[b]=a.transform[b];else this._spec.transform=a.transform.slice(0);else this._spec.transform=void 0;this._spec.opacity=a.opacity},d.prototype.set=function(a,b){this._invalidated=!0,this._specModified=!0,this._removing=!1;var c=this._spec;c.opacity=a.opacity,a.size?(c.size||(c.size=[0,0]),c.size[0]=a.size[0],c.size[1]=a.size[1]):c.size=void 0,a.origin?(c.origin||(c.origin=[0,0]),c.origin[0]=a.origin[0],c.origin[1]=a.origin[1]):c.origin=void 0,a.align?(c.align||(c.align=[0,0]),c.align[0]=a.align[0],c.align[1]=a.align[1]):c.align=void 0,a.skew||a.rotate||a.scale?this._spec.transform=e.build({translate:a.translate||[0,0,0],skew:a.skew||[0,0,0],scale:a.scale||[1,1,1],rotate:a.rotate||[0,0,0]}):a.translate?this._spec.transform=e.translate(a.translate[0],a.translate[1],a.translate[2]):this._spec.transform=void 0,this.scrollLength=a.scrollLength},d.prototype.getSpec=function(){return this._specModified=!1,this._spec.removed=!this._invalidated,this._spec},d.prototype.remove=function(a){this._removing=!0},b.exports=d},{"./LayoutUtility":8}],7:[function(a,b,c){function d(a,b){this.LayoutNode=a,this._initLayoutNodeFn=b,this._layoutCount=0,this._context=new m({next:g.bind(this),prev:h.bind(this),get:i.bind(this),set:j.bind(this),resolveSize:l.bind(this),size:[0,0]}),this._contextState={},this._pool={layoutNodes:{size:0},resolveSize:[0,0]}}function e(a){a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._first=a._next,a.destroy(),this._pool.layoutNodes.size<q&&(this._pool.layoutNodes.size++,a._prev=void 0,a._next=this._pool.layoutNodes.first,this._pool.layoutNodes.first=a)}function f(a,b){var c,d=this._contextState;if(!d.start){for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c||(c=this.createNode(a),c._next=this._first,this._first&&(this._first._prev=c),this._first=c),d.start=c,d.startPrev=b,d.prev=c,d.next=c,c}if(b){if(d.prev._prev&&d.prev._prev.renderNode===a)return d.prev=d.prev._prev,d.prev}else if(d.next._next&&d.next._next.renderNode===a)return d.next=d.next._next,d.next;for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c?(c._next&&(c._next._prev=c._prev),c._prev?c._prev._next=c._next:this._first=c._next,c._next=void 0,c._prev=void 0):c=this.createNode(a),b?(d.prev._prev?(c._prev=d.prev._prev,d.prev._prev._next=c):this._first=c,d.prev._prev=c,c._next=d.prev,d.prev=c):(d.next._next&&(c._next=d.next._next,d.next._next._prev=c),d.next._next=c,c._prev=d.next,d.next=c),c}function g(){if(!this._contextState.nextSequence)return void 0;if(this._context.reverse&&(this._contextState.nextSequence=this._contextState.nextSequence.getNext(),!this._contextState.nextSequence))return void 0;var a=this._contextState.nextSequence.get();if(!a)return void(this._contextState.nextSequence=void 0);var b=this._contextState.nextSequence;if(this._context.reverse||(this._contextState.nextSequence=this._contextState.nextSequence.getNext()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,next:!0,index:++this._contextState.nextGetIndex}}function h(){if(!this._contextState.prevSequence)return void 0;if(!this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious(),!this._contextState.prevSequence))return void 0;var a=this._contextState.prevSequence.get();if(!a)return void(this._contextState.prevSequence=void 0);var b=this._contextState.prevSequence;if(this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,prev:!0,index:--this._contextState.prevGetIndex}}function i(a){if(this._nodesById&&(a instanceof String||"string"==typeof a)){var b=this._nodesById[a];if(!b)return void 0;if(b instanceof Array){for(var c=[],d=0,e=b.length;e>d;d++)c.push({renderNode:b[d],arrayElement:!0});return c}return{renderNode:b,byId:!0}}return a}function j(a,b){var c=this._nodesById?i.call(this,a):a;if(c){var d=c.node;d||(c.next?(c.index<this._contextState.nextSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.nextSetIndex=c.index):c.prev&&(c.index>this._contextState.prevSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.prevSetIndex=c.index),d=f.call(this,c.renderNode,c.prev),d._viewSequence=c.viewSequence,d._layoutCount++,1===d._layoutCount&&this._contextState.addCount++,c.node=d),d.usesTrueSize=c.usesTrueSize,d.trueSizeRequested=c.trueSizeRequested,d.set(b,this._context.size),c.set=b}return b}function k(a){if(a instanceof p){var b=null,c=a.get();if(c&&(b=k(c)))return b;if(a._child)return k(a._child)}else{if(a instanceof o)return a.size?{renderNode:a,size:a.size}:void 0;if(a.options&&a.options.size)return{renderNode:a,size:a.options.size}}return void 0}function l(a,b){var c=this._nodesById?i.call(this,a):a,d=this._pool.resolveSize;if(!c)return d[0]=0,d[1]=0,d;var e=c.renderNode,f=e.getSize();if(!f)return b;var g=k(e);if(g&&(g.size[0]===!0||g.size[1]===!0))if(c.usesTrueSize=!0,g.renderNode instanceof o){var h=g.renderNode._backupSize;if((g.renderNode._contentDirty||g.renderNode._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),g.renderNode._trueSizeCheck&&h&&g.size!==f){var j=g.size[0]===!0?Math.max(h[0],f[0]):f[0],l=g.size[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=l,f=h,g.renderNode._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(g.renderNode._trueSizeCheck=!0,g.renderNode._sizeDirty=!0,this._trueSizeRequested=!0),h||(g.renderNode._backupSize=[0,0],h=g.renderNode._backupSize),h[0]=f[0],h[1]=f[1]}else g.renderNode._nodes&&(this._reevalTrueSize||g.renderNode._nodes._trueSizeRequested)&&(c.trueSizeRequested=!0,this._trueSizeRequested=!0);return(void 0===f[0]||f[0]===!0||void 0===f[1]||f[1]===!0)&&(d[0]=f[0],d[1]=f[1],f=d,void 0===f[0]?f[0]=b[0]:f[0]===!0&&(f[0]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0),void 0===f[1]?f[1]=b[1]:f[1]===!0&&(f[1]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0)),f}var m=a("./LayoutContext"),n=a("./LayoutUtility"),o=window.famous.core.Surface,p=window.famous.core.RenderNode,q=100;d.prototype.prepareForLayout=function(a,b,c){for(var d=this._first;d;)d.reset(),d=d._next;var e=this._context;this._layoutCount++,this._nodesById=b,this._trueSizeRequested=!1,this._reevalTrueSize=c.reevalTrueSize||!e.size||e.size[0]!==c.size[0]||e.size[1]!==c.size[1];var f=this._contextState;return f.startSequence=a,f.nextSequence=a,f.prevSequence=a,f.start=void 0,f.nextGetIndex=0,f.prevGetIndex=0,f.nextSetIndex=0,f.prevSetIndex=0,f.addCount=0,f.removeCount=0,f.lastRenderNode=void 0,e.size[0]=c.size[0],e.size[1]=c.size[1],e.direction=c.direction,e.reverse=c.reverse,e.alignment=c.reverse?1:0,e.scrollOffset=c.scrollOffset||0,e.scrollStart=c.scrollStart||0,e.scrollEnd=c.scrollEnd||e.size[e.direction],e},d.prototype.removeNonInvalidatedNodes=function(a){for(var b=this._first;b;)b._invalidated||b._removing||b.remove(a),b=b._next},d.prototype.removeVirtualViewSequenceNodes=function(){this._contextState.startSequence&&this._contextState.startSequence.cleanup&&this._contextState.startSequence.cleanup()},d.prototype.buildSpecAndDestroyUnrenderedNodes=function(a){for(var b=[],c={specs:b,modified:!1},d=this._first;d;){var f=d._specModified,g=d.getSpec();if(g.removed){var h=d;d=d._next,e.call(this,h),c.modified=!0}else f&&(g.transform&&a&&(g.transform[12]+=a[0],g.transform[13]+=a[1],g.transform[14]+=a[2],g.transform[12]=Math.round(1e5*g.transform[12])/1e5,g.transform[13]=Math.round(1e5*g.transform[13])/1e5,g.endState&&(g.endState.transform[12]+=a[0],g.endState.transform[13]+=a[1],g.endState.transform[14]+=a[2],g.endState.transform[12]=Math.round(1e5*g.endState.transform[12])/1e5,g.endState.transform[13]=Math.round(1e5*g.endState.transform[13])/1e5)),c.modified=!0),g.usesTrueSize=d.usesTrueSize,g.trueSizeRequested=d.trueSizeRequested,b.push(g),d=d._next}return this._contextState.addCount=0,this._contextState.removeCount=0,c},d.prototype.getNodeByRenderNode=function(a){for(var b=this._first;b;){if(b.renderNode===a)return b;b=b._next}return void 0},d.prototype.insertNode=function(a){a._next=this._first,this._first&&(this._first._prev=a),this._first=a},d.prototype.setNodeOptions=function(a){this._nodeOptions=a;for(var b=this._first;b;)b.setOptions(a),b=b._next;for(b=this._pool.layoutNodes.first;b;)b.setOptions(a),b=b._next},d.prototype.preallocateNodes=function(a,b){for(var c=[],d=0;a>d;d++)c.push(this.createNode(void 0,b));for(d=0;a>d;d++)e.call(this,c[d])},d.prototype.createNode=function(a,b){var c;return this._pool.layoutNodes.first?(c=this._pool.layoutNodes.first,this._pool.layoutNodes.first=c._next,this._pool.layoutNodes.size--,c.constructor.apply(c,arguments)):(c=new this.LayoutNode(a,b),this._nodeOptions&&c.setOptions(this._nodeOptions)),c._prev=void 0,c._next=void 0,c._viewSequence=void 0,c._layoutCount=0,this._initLayoutNodeFn&&this._initLayoutNodeFn.call(this,c,b),c},d.prototype.removeAll=function(){for(var a=this._first;a;){var b=a._next;e.call(this,a),a=b}this._first=void 0},d.prototype.getStartEnumNode=function(a){return void 0===a?this._first:a===!0?this._contextState.start&&this._contextState.startPrev?this._contextState.start._next:this._contextState.start:a===!1?this._contextState.start&&!this._contextState.startPrev?this._contextState.start._prev:this._contextState.start:void 0},b.exports=d},{"./LayoutContext":4,"./LayoutUtility":8}],8:[function(a,b,c){function d(){}function e(a,b){if(a===b)return!0;if(void 0===a||void 0===b)return!1;var c=a.length;if(c!==b.length)return!1;for(;c--;)if(a[c]!==b[c])return!1;return!0}var f=window.famous.utilities.Utility;d.registeredHelpers={};var g={SEQUENCE:1,DIRECTION_X:2,DIRECTION_Y:4,SCROLLING:8};d.Capabilities=g,d.normalizeMargins=function(a){return a?Array.isArray(a)?0===a.length?[0,0,0,0]:1===a.length?[a[0],a[0],a[0],a[0]]:2===a.length?[a[0],a[1],a[0],a[1]]:a:[a,a,a,a]:[0,0,0,0]},d.cloneSpec=function(a){var b={};return void 0!==a.opacity&&(b.opacity=a.opacity),void 0!==a.size&&(b.size=a.size.slice(0)),void 0!==a.transform&&(b.transform=a.transform.slice(0)),void 0!==a.origin&&(b.origin=a.origin.slice(0)),void 0!==a.align&&(b.align=a.align.slice(0)),b},d.isEqualSpec=function(a,b){return a.opacity!==b.opacity?!1:e(a.size,b.size)&&e(a.transform,b.transform)&&e(a.origin,b.origin)&&e(a.align,b.align)?!0:!1},d.getSpecDiffText=function(a,b){var c="spec diff:";return a.opacity!==b.opacity&&(c+="\nopacity: "+a.opacity+" != "+b.opacity),e(a.size,b.size)||(c+="\nsize: "+JSON.stringify(a.size)+" != "+JSON.stringify(b.size)),e(a.transform,b.transform)||(c+="\ntransform: "+JSON.stringify(a.transform)+" != "+JSON.stringify(b.transform)),e(a.origin,b.origin)||(c+="\norigin: "+JSON.stringify(a.origin)+" != "+JSON.stringify(b.origin)),e(a.align,b.align)||(c+="\nalign: "+JSON.stringify(a.align)+" != "+JSON.stringify(b.align)),c},d.error=function(a){throw console.log("ERROR: "+a),a},d.warning=function(a){console.log("WARNING: "+a)},d.log=function(a){for(var b="",c=0;c<arguments.length;c++){var d=arguments[c];b+=d instanceof Object||d instanceof Array?JSON.stringify(d):d}console.log(b)},d.combineOptions=function(a,b,c){if(a&&!b&&!c)return a;if(!a&&b&&!c)return b;var d=f.clone(a||{});if(b)for(var e in b)d[e]=b[e];return d},d.registerHelper=function(a,b){b.prototype.parse||d.error('The layout-helper for name "'+a+'" is required to support the "parse" method'),void 0!==this.registeredHelpers[a]&&d.warning('A layout-helper with the name "'+a+'" is already registered and will be overwritten'),this.registeredHelpers[a]=b},d.unregisterHelper=function(a){delete this.registeredHelpers[a]},d.getRegisteredHelper=function(a){return this.registeredHelpers[a]},b.exports=d},{}],9:[function(a,b,c){function d(a){a=D.combineOptions(d.DEFAULT_OPTIONS,a);var b=new H(a.flow?G:F,e.bind(this));E.call(this,a,b),this._scroll={activeTouches:[],pe:new N(this.options.scrollPhysicsEngine),particle:new O(this.options.scrollParticle),dragForce:new P(this.options.scrollDrag),frictionForce:new P(this.options.scrollFriction),springValue:void 0,springForce:new Q(this.options.scrollSpring),springEndState:new M([0,0,0]),groupStart:0,groupTranslate:[0,0,0],scrollDelta:0,normalizedScrollDelta:0,scrollForce:0,scrollForceCount:0,unnormalizedScrollOffset:0,isScrolling:!1},this._debug={layoutCount:0,commitCount:0},this.group=new L,this.group.add({render:C.bind(this)}),this._scroll.pe.addBody(this._scroll.particle),this.options.scrollDrag.disabled||(this._scroll.dragForceId=this._scroll.pe.attach(this._scroll.dragForce,this._scroll.particle)),this.options.scrollFriction.disabled||(this._scroll.frictionForceId=this._scroll.pe.attach(this._scroll.frictionForce,this._scroll.particle)),this._scroll.springForce.setOptions({anchor:this._scroll.springEndState}),this._eventInput.on("touchstart",l.bind(this)),this._eventInput.on("touchmove",m.bind(this)),this._eventInput.on("touchend",n.bind(this)),this._eventInput.on("touchcancel",n.bind(this)),this._eventInput.on("mousedown",i.bind(this)),this._eventInput.on("mouseup",k.bind(this)),this._eventInput.on("mousemove",j.bind(this)),this._scrollSync=new R(this.options.scrollSync),this._eventInput.pipe(this._scrollSync),this._scrollSync.on("update",o.bind(this)),this.options.useContainer&&(this.container=new I(this.options.container),this.container.add({render:function(){return this.id}.bind(this)}),this.options.autoPipeEvents||(this.subscribe(this.container),K.setInputHandler(this.container,this),K.setOutputHandler(this.container,this)))}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(){return!this._layout.capabilities||void 0===this._layout.capabilities.sequentialScrollingOptimized||this._layout.capabilities.sequentialScrollingOptimized}function g(){var a=this._scroll.scrollForceCount?void 0:this._scroll.springPosition;this._scroll.springValue!==a&&(this._scroll.springValue=a,void 0===a?void 0!==this._scroll.springForceId&&(this._scroll.pe.detach(this._scroll.springForceId),this._scroll.springForceId=void 0):(void 0===this._scroll.springForceId&&(this._scroll.springForceId=this._scroll.pe.attach(this._scroll.springForce,this._scroll.particle)),this._scroll.springEndState.set1D(a),this._scroll.pe.wake()))}function h(a){return a.timeStamp||Date.now()}function i(a){if(this.options.mouseMove){this._scroll.mouseMove&&this.releaseScrollForce(this._scroll.mouseMove.delta);var b=[a.clientX,a.clientY],c=h(a);this._scroll.mouseMove={delta:0,start:b,current:b,prev:b,time:c,prevTime:c},this.applyScrollForce(this._scroll.mouseMove.delta)}}function j(a){if(this._scroll.mouseMove&&this.options.enabled){var b=Math.atan2(Math.abs(a.clientY-this._scroll.mouseMove.prev[1]),Math.abs(a.clientX-this._scroll.mouseMove.prev[0]))/(Math.PI/2),c=Math.abs(this._direction-b);(void 0===this.options.touchMoveDirectionThreshold||c<=this.options.touchMoveDirectionThreshold)&&(this._scroll.mouseMove.prev=this._scroll.mouseMove.current,this._scroll.mouseMove.current=[a.clientX,a.clientY],this._scroll.mouseMove.prevTime=this._scroll.mouseMove.time,this._scroll.mouseMove.direction=b,this._scroll.mouseMove.time=h(a));var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.start[this._direction];this.updateScrollForce(this._scroll.mouseMove.delta,d),this._scroll.mouseMove.delta=d}}function k(a){if(this._scroll.mouseMove){var b=0,c=this._scroll.mouseMove.time-this._scroll.mouseMove.prevTime;if(c>0&&h(a)-this._scroll.mouseMove.time<=this.options.touchMoveNoVelocityDuration){var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.prev[this._direction];b=d/c}this.releaseScrollForce(this._scroll.mouseMove.delta,b),this._scroll.mouseMove=void 0}}function l(a){this._touchEndEventListener||(this._touchEndEventListener=function(a){a.target.removeEventListener("touchend",this._touchEndEventListener),n.call(this,a)}.bind(this));for(var b,c,d=this._scroll.activeTouches.length,e=0;e<this._scroll.activeTouches.length;){var f=this._scroll.activeTouches[e];for(c=!1,b=0;b<a.touches.length;b++){var g=a.touches[b];if(g.identifier===f.id){c=!0;break}}c?e++:this._scroll.activeTouches.splice(e,1)}for(e=0;e<a.touches.length;e++){var i=a.touches[e];for(c=!1,b=0;b<this._scroll.activeTouches.length;b++)if(this._scroll.activeTouches[b].id===i.identifier){c=!0;break}if(!c){var j=[i.clientX,i.clientY],k=h(a);this._scroll.activeTouches.push({id:i.identifier,start:j,current:j,prev:j,time:k,prevTime:k}),i.target.addEventListener("touchend",this._touchEndEventListener)}}!d&&this._scroll.activeTouches.length&&(this.applyScrollForce(0),this._scroll.touchDelta=0)}function m(a){if(this.options.enabled){for(var b,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){var g=Math.atan2(Math.abs(d.clientY-f.prev[1]),Math.abs(d.clientX-f.prev[0]))/(Math.PI/2),i=Math.abs(this._direction-g);(void 0===this.options.touchMoveDirectionThreshold||i<=this.options.touchMoveDirectionThreshold)&&(f.prev=f.current,f.current=[d.clientX,d.clientY],f.prevTime=f.time,f.direction=g,f.time=h(a),b=0===e?f:void 0)}}if(b){var j=b.current[this._direction]-b.start[this._direction];this.updateScrollForce(this._scroll.touchDelta,j),this._scroll.touchDelta=j}}}function n(a){for(var b=this._scroll.activeTouches.length?this._scroll.activeTouches[0]:void 0,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){if(this._scroll.activeTouches.splice(e,1),0===e&&this._scroll.activeTouches.length){var g=this._scroll.activeTouches[0];g.start[0]=g.current[0]-(f.current[0]-f.start[0]),g.start[1]=g.current[1]-(f.current[1]-f.start[1])}break}}if(b&&!this._scroll.activeTouches.length){var i=0,j=b.time-b.prevTime;if(j>0&&h(a)-b.time<=this.options.touchMoveNoVelocityDuration){var k=b.current[this._direction]-b.prev[this._direction];i=k/j}var l=this._scroll.touchDelta;this.releaseScrollForce(l,i),this._scroll.touchDelta=0}}function o(a){if(this.options.enabled){var b=Array.isArray(a.delta)?a.delta[this._direction]:a.delta;this.scroll(b)}}function p(a,b,c){if(void 0!==a&&(this._scroll.particleValue=a,this._scroll.particle.setPosition1D(a)),void 0!==b){var d=this._scroll.particle.getVelocity1D();d!==b&&this._scroll.particle.setVelocity1D(b)}}function q(a,b){(b||void 0===this._scroll.particleValue)&&(this._scroll.particleValue=this._scroll.particle.getPosition1D(),this._scroll.particleValue=Math.round(1e3*this._scroll.particleValue)/1e3);var c=this._scroll.particleValue;return(this._scroll.scrollDelta||this._scroll.normalizedScrollDelta)&&(c+=this._scroll.scrollDelta+this._scroll.normalizedScrollDelta,(this._scroll.boundsReached&T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached&T.NEXT&&c<this._scroll.springPosition||this._scroll.boundsReached===T.BOTH)&&(c=this._scroll.springPosition),a&&(this._scroll.scrollDelta||(this._scroll.normalizedScrollDelta=0,p.call(this,c,void 0,"_calcScrollOffset")),this._scroll.normalizedScrollDelta+=this._scroll.scrollDelta,this._scroll.scrollDelta=0)),this._scroll.scrollForceCount&&this._scroll.scrollForce&&(void 0!==this._scroll.springPosition?c=(c+this._scroll.scrollForce+this._scroll.springPosition)/2:c+=this._scroll.scrollForce),this.options.overscroll||(this._scroll.boundsReached===T.BOTH||this._scroll.boundsReached===T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c<this._scroll.springPosition)&&(c=this._scroll.springPosition),c}function r(a,b){var c,d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0),g=f.call(this);if(g&&(void 0!==e&&void 0!==d&&(c=d+e),void 0!==c&&c<=a[this._direction]))return this._scroll.boundsReached=T.BOTH,this._scroll.springPosition=this.options.alignment?-e:d,void(this._scroll.springSource=U.MINSIZE);if(this.options.alignment)if(g){if(void 0!==e&&0>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=-e,void(this._scroll.springSource=U.NEXTBOUNDS)}else{var h=this._calcScrollHeight(!1,!0);if(void 0!==e&&h&&b+e+a[this._direction]<=h)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=e-(a[this._direction]-h),void(this._scroll.springSource=U.NEXTBOUNDS)}else if(void 0!==d&&b-d>=0)return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=d,void(this._scroll.springSource=U.PREVBOUNDS);if(this.options.alignment){if(void 0!==d&&b-d>=-a[this._direction])return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=-a[this._direction]+d,void(this._scroll.springSource=U.PREVBOUNDS)}else{var i=g?a[this._direction]:this._calcScrollHeight(!0,!0);if(void 0!==e&&i>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=i-e,void(this._scroll.springSource=U.NEXTBOUNDS)}this._scroll.boundsReached=T.NONE,
-this._scroll.springPosition=void 0,this._scroll.springSource=U.NONE}function s(a,b){var c=this._scroll.scrollToRenderNode||this._scroll.ensureVisibleRenderNode;if(c&&!(this._scroll.boundsReached===T.BOTH||!this._scroll.scrollToDirection&&this._scroll.boundsReached===T.PREV||this._scroll.scrollToDirection&&this._scroll.boundsReached===T.NEXT)){for(var d,e=0,f=this._nodes.getStartEnumNode(!0),g=0;f&&(g++,f._invalidated&&void 0!==f.scrollLength);){if(this.options.alignment&&(e-=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment||(e-=f.scrollLength),f=f._next}if(!d)for(e=0,f=this._nodes.getStartEnumNode(!1);f&&f._invalidated&&void 0!==f.scrollLength;){if(this.options.alignment||(e+=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment&&(e+=f.scrollLength),f=f._prev}if(d)return void(this._scroll.ensureVisibleRenderNode?this.options.alignment?e-d.scrollLength<0?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e>a[this._direction]?(this._scroll.springPosition=a[this._direction]-e,this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0):(e=-e,0>e?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e+d.scrollLength>a[this._direction]?(this._scroll.springPosition=a[this._direction]-(e+d.scrollLength),this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0)):(this._scroll.springPosition=e,this._scroll.springSource=U.GOTOSEQUENCE));if(this._scroll.scrollToDirection?(this._scroll.springPosition=b-a[this._direction],this._scroll.springSource=U.GOTONEXTDIRECTION):(this._scroll.springPosition=b+a[this._direction],this._scroll.springSource=U.GOTOPREVDIRECTION),this._viewSequence.cleanup)for(var h=this._viewSequence;h.get()!==c&&(h=this._scroll.scrollToDirection?h.getNext(!0):h.getPrevious(!0)););}}function t(){if(this.options.paginated&&!this._scroll.scrollForceCount&&void 0===this._scroll.springPosition){var a;switch(this.options.paginationMode){case V.SCROLL:(!this.options.paginationEnergyThreshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThreshold)&&(a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode));break;case V.PAGE:a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode)}}}function u(a){for(var b=0,c=a,d=!1,e=this._nodes.getStartEnumNode(!1);e&&e._invalidated&&e._viewSequence&&(d&&(this._viewSequence=e._viewSequence,c=a,d=!1),!(void 0===e.scrollLength||e.trueSizeRequested||0>a));)a-=e.scrollLength,b++,e.scrollLength&&(this.options.alignment?d=a>=0:(this._viewSequence=e._viewSequence,c=a)),e=e._prev;return c}function v(a){for(var b=0,c=a,d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!d.trueSizeRequested&&d._viewSequence&&(!(a>0)||this.options.alignment&&0===d.scrollLength);)this.options.alignment&&(a+=d.scrollLength,b++),(d.scrollLength||this.options.alignment)&&(this._viewSequence=d._viewSequence,c=a),this.options.alignment||(a+=d.scrollLength,b++),d=d._next;return c}function w(a,b){var c=this._layout.capabilities;if(c&&c.debug&&void 0!==c.debug.normalize&&!c.debug.normalize)return b;if(this._scroll.scrollForceCount)return b;var d=b;if(this.options.alignment&&0>b?d=v.call(this,b):!this.options.alignment&&b>0&&(d=u.call(this,b)),d===b&&(this.options.alignment&&b>0?d=u.call(this,b):!this.options.alignment&&0>b&&(d=v.call(this,b))),d!==b){var e=d-b,g=this._scroll.particle.getPosition1D();p.call(this,g+e,void 0,"normalize"),void 0!==this._scroll.springPosition&&(this._scroll.springPosition+=e),f.call(this)&&(this._scroll.groupStart-=e)}return d}function x(a){for(var b,c={},d=1e7,e=a&&this.options.alignment?-this._contextSizeCache[this._direction]:a||this.options.alignment?0:this._contextSizeCache[this._direction],f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!0);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g,f+=g.scrollLength}g=g._next}for(f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!1);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(f-=g.scrollLength,b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g}g=g._prev}return c._node?(c.scrollLength=c._node.scrollLength,this.options.alignment?c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,0)-Math.max(c.scrollOffset,-this._contextSizeCache[this._direction]))/c.scrollLength:c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,this._contextSizeCache[this._direction])-Math.max(c.scrollOffset,0))/c.scrollLength,c.index=c._node._viewSequence.getIndex(),c.viewSequence=c._node._viewSequence,c.renderNode=c._node.renderNode,c):void 0}function y(a,b,c){c?(this._viewSequence=a,this._scroll.springPosition=void 0,g.call(this),this.halt(),this._scroll.scrollDelta=0,p.call(this,0,0,"_goToSequence"),this._scroll.scrollDirty=!0):(this._scroll.scrollToSequence=a,this._scroll.scrollToRenderNode=a.get(),this._scroll.ensureVisibleRenderNode=void 0,this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0)}function z(a,b){this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=a.get(),this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0}function A(a,b){var c=(b?void 0:this._scroll.scrollToSequence)||this._viewSequence;if(!this._scroll.scrollToSequence&&!b){var d=this.getFirstVisibleItem();d&&(c=d.viewSequence,(0>a&&d.scrollOffset<0||a>0&&d.scrollOffset>0)&&(a=0))}if(c){for(var e=0;e<Math.abs(a);e++){var f=a>0?c.getNext():c.getPrevious();if(!f)break;c=f}y.call(this,c,a>=0,b)}}function B(a,b,c){this._debug.layoutCount++;var d=0-Math.max(this.options.extraBoundsSpace[0],1),e=a[this._direction]+Math.max(this.options.extraBoundsSpace[1],1);this.options.layoutAll&&(d=-1e6,e=1e6);var f=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:a,direction:this._direction,reverse:this.options.alignment?!0:!1,scrollOffset:this.options.alignment?b+a[this._direction]:b,scrollStart:d,scrollEnd:e});this._layout._function&&this._layout._function(f,this._layout.options),this._scroll.unnormalizedScrollOffset=b,this._postLayout&&this._postLayout(a,b),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),r.call(this,a,b),s.call(this,a,b),t.call(this);var h=q.call(this,!0);if(!c&&h!==b)return B.call(this,a,h,!0);if(b=w.call(this,a,b),g.call(this),this._nodes.removeVirtualViewSequenceNodes(),this.options.size&&this.options.size[this._direction]===!0){for(var i=0,j=this._nodes.getStartEnumNode();j;)j._invalidated&&j.scrollLength&&(i+=j.scrollLength),j=j._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}return b}function C(){for(var a=this._specs,b=0,c=a.length;c>b;b++)a[b].renderNode&&(a[b].target=a[b].renderNode.render());return a.length&&a[a.length-1]===this._cleanupRegistration||a.push(this._cleanupRegistration),a}var D=a("./LayoutUtility"),E=a("./LayoutController"),F=a("./LayoutNode"),G=a("./FlowLayoutNode"),H=a("./LayoutNodeManager"),I=window.famous.surfaces.ContainerSurface,J=window.famous.core.Transform,K=window.famous.core.EventHandler,L=window.famous.core.Group,M=window.famous.math.Vector,N=window.famous.physics.PhysicsEngine,O=window.famous.physics.bodies.Particle,P=window.famous.physics.forces.Drag,Q=window.famous.physics.forces.Spring,R=window.famous.inputs.ScrollSync,S=window.famous.core.ViewSequence,T={NONE:0,PREV:1,NEXT:2,BOTH:3},U={NONE:"none",NEXTBOUNDS:"next-bounds",PREVBOUNDS:"prev-bounds",MINSIZE:"minimal-size",GOTOSEQUENCE:"goto-sequence",ENSUREVISIBLE:"ensure-visible",GOTOPREVDIRECTION:"goto-prev-direction",GOTONEXTDIRECTION:"goto-next-direction"},V={PAGE:0,SCROLL:1};d.prototype=Object.create(E.prototype),d.prototype.constructor=d,d.Bounds=T,d.PaginationMode=V,d.DEFAULT_OPTIONS={useContainer:!1,container:{properties:{overflow:"hidden"}},scrollPhysicsEngine:{},scrollParticle:{},scrollDrag:{forceFunction:P.FORCE_FUNCTIONS.QUADRATIC,strength:.001,disabled:!0},scrollFriction:{forceFunction:P.FORCE_FUNCTIONS.LINEAR,strength:.0025,disabled:!1},scrollSpring:{dampingRatio:1,period:350},scrollSync:{scale:.2},overscroll:!0,paginated:!1,paginationMode:V.PAGE,paginationEnergyThreshold:.01,alignment:0,touchMoveDirectionThreshold:void 0,touchMoveNoVelocityDuration:100,mouseMove:!1,enabled:!0,layoutAll:!1,alwaysLayout:!1,extraBoundsSpace:[100,100],debug:!1},d.prototype.setOptions=function(a){return E.prototype.setOptions.call(this,a),a.hasOwnProperty("paginationEnergyThresshold")&&(console.warn("option `paginationEnergyThresshold` has been deprecated, please rename to `paginationEnergyThreshold`."),this.setOptions({paginationEnergyThreshold:a.paginationEnergyThresshold})),a.hasOwnProperty("touchMoveDirectionThresshold")&&(console.warn("option `touchMoveDirectionThresshold` has been deprecated, please rename to `touchMoveDirectionThreshold`."),this.setOptions({touchMoveDirectionThreshold:a.touchMoveDirectionThresshold})),this._scroll&&(a.scrollSpring&&this._scroll.springForce.setOptions(a.scrollSpring),a.scrollDrag&&this._scroll.dragForce.setOptions(a.scrollDrag)),a.scrollSync&&this._scrollSync&&this._scrollSync.setOptions(a.scrollSync),this},d.prototype._calcScrollHeight=function(a,b){for(var c=0,d=this._nodes.getStartEnumNode(a);d;){if(d._invalidated){if(d.trueSizeRequested){c=void 0;break}if(void 0!==d.scrollLength&&(c=b?d.scrollLength:c+d.scrollLength,!a&&b))break}d=a?d._next:d._prev}return c},d.prototype.getVisibleItems=function(){for(var a=this._contextSizeCache,b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,c=[],d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!(b>a[this._direction]);)b+=d.scrollLength,b>=0&&d._viewSequence&&c.push({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b,a[this._direction])-Math.max(b-d.scrollLength,0))/d.scrollLength:1,scrollOffset:b-d.scrollLength,scrollLength:d.scrollLength,_node:d}),d=d._next;for(b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,d=this._nodes.getStartEnumNode(!1);d&&d._invalidated&&void 0!==d.scrollLength&&!(0>b);)b-=d.scrollLength,b<a[this._direction]&&d._viewSequence&&c.unshift({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b+d.scrollLength,a[this._direction])-Math.max(b,0))/d.scrollLength:1,scrollOffset:b,scrollLength:d.scrollLength,_node:d}),d=d._prev;return c},d.prototype.getFirstVisibleItem=function(){return x.call(this,!0)},d.prototype.getLastVisibleItem=function(){return x.call(this,!1)},d.prototype.goToFirstPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to first item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getPrevious();if(!c||!c.get())break;b=c}return y.call(this,b,!1,a),this},d.prototype.goToPreviousPage=function(a){return A.call(this,-1,a),this},d.prototype.goToNextPage=function(a){return A.call(this,1,a),this},d.prototype.goToLastPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to last item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getNext();if(!c||!c.get())break;b=c}return y.call(this,b,!0,a),this},d.prototype.goToRenderNode=function(a,b){if(!this._viewSequence||!a)return this;if(this._viewSequence.get()===a){var c=q.call(this)>=0;return y.call(this,this._viewSequence,c,b),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){y.call(this,d,!0,b);break}var g=e?e.get():void 0;if(g===a){y.call(this,e,!1,b);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.ensureVisible=function(a){if(a instanceof S)a=a.get();else if(a instanceof Number||"number"==typeof a){for(var b=this._viewSequence;b.getIndex()<a;)if(b=b.getNext(),!b)return this;for(;b.getIndex()>a;)if(b=b.getPrevious(),!b)return this}if(this._viewSequence.get()===a){var c=q.call(this)>=0;return z.call(this,this._viewSequence,c),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){z.call(this,d,!0);break}var g=e?e.get():void 0;if(g===a){z.call(this,e,!1);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.scroll=function(a){return this.halt(),this._scroll.scrollDelta+=a,this},d.prototype.canScroll=function(a){var b,c=q.call(this),d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0);if(void 0!==e&&void 0!==d&&(b=d+e),void 0!==b&&b<=this._contextSizeCache[this._direction])return 0;if(0>a&&void 0!==e){var f=this._contextSizeCache[this._direction]-(c+e);return Math.max(f,a)}if(a>0&&void 0!==d){var g=-(c-d);return Math.min(g,a)}return a},d.prototype.halt=function(){return this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=void 0,p.call(this,void 0,0,"halt"),this},d.prototype.isScrolling=function(){return this._scroll.isScrolling},d.prototype.getBoundsReached=function(){return this._scroll.boundsReached},d.prototype.getVelocity=function(){return this._scroll.particle.getVelocity1D()},d.prototype.getEnergy=function(){return this._scroll.particle.getEnergy()},d.prototype.setVelocity=function(a){return this._scroll.particle.setVelocity1D(a)},d.prototype.applyScrollForce=function(a){return this.halt(),0===this._scroll.scrollForceCount&&(this._scroll.scrollForceStartItem=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem()),this._scroll.scrollForceCount++,this._scroll.scrollForce+=a,this._eventOutput.emit(1===this._scroll.scrollForceCount?"swipestart":"swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a}),this},d.prototype.updateScrollForce=function(a,b){return this.halt(),b-=a,this._scroll.scrollForce+=b,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:b}),this},d.prototype.releaseScrollForce=function(a,b){if(this.halt(),1===this._scroll.scrollForceCount){var c=q.call(this);if(p.call(this,c,b,"releaseScrollForce"),this._scroll.pe.wake(),this._scroll.scrollForce=0,this._scroll.scrollDirty=!0,this._scroll.scrollForceStartItem&&this.options.paginated&&this.options.paginationMode===V.PAGE){var d=this.options.alignment?this.getLastVisibleItem(!0):this.getFirstVisibleItem(!0);d&&(d.renderNode!==this._scroll.scrollForceStartItem.renderNode?this.goToRenderNode(d.renderNode):this.options.paginationEnergyThreshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThreshold?(b=b||0,0>b&&d._node._next&&d._node._next.renderNode?this.goToRenderNode(d._node._next.renderNode):b>=0&&d._node._prev&&d._node._prev.renderNode&&this.goToRenderNode(d._node._prev.renderNode)):this.goToRenderNode(d.renderNode))}this._scroll.scrollForceStartItem=void 0,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeend",{target:this,total:a,delta:0,velocity:b})}else this._scroll.scrollForce-=a,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a});return this},d.prototype.getSpec=function(a,b){var c=E.prototype.getSpec.apply(this,arguments);if(c&&f.call(this)){c={origin:c.origin,align:c.align,opacity:c.opacity,size:c.size,renderNode:c.renderNode,transform:c.transform};var d=[0,0,0];d[this._direction]=this._scrollOffsetCache+this._scroll.groupStart,c.transform=J.thenMove(c.transform,d)}return c},d.prototype.commit=function(a){var b=a.size;this._debug.commitCount++,this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll());var c=q.call(this,!0,!0);void 0===this._scrollOffsetCache&&(this._scrollOffsetCache=c);var d,e=!1,g=!1;if(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1]||this._isDirty||this._scroll.scrollDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout||this._scrollOffsetCache!==c){if(d={target:this,oldSize:this._contextSizeCache,size:b,oldScrollOffset:-(this._scrollOffsetCache+this._scroll.groupStart),scrollOffset:-(c+this._scroll.groupStart)},this._scrollOffsetCache!==c?(this._scroll.isScrolling||(this._scroll.isScrolling=!0,this._eventOutput.emit("scrollstart",d)),g=!0):this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0),this._eventOutput.emit("layoutstart",d),this.options.flow&&(this._isDirty||this.options.flowOptions.reflowOnResize&&(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1])))for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(!0),h=h._next;this._contextSizeCache[0]=b[0],this._contextSizeCache[1]=b[1],this._isDirty=!1,this._scroll.scrollDirty=!1,c=B.call(this,b,c),this._scrollOffsetCache=c,d.scrollOffset=-(this._scrollOffsetCache+this._scroll.groupStart)}else this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0);var i=this._scroll.groupTranslate;i[0]=0,i[1]=0,i[2]=0,i[this._direction]=-this._scroll.groupStart-c;var j=f.call(this),k=this._nodes.buildSpecAndDestroyUnrenderedNodes(j?i:void 0);if(this._specs=k.specs,this._specs.length||(this._scroll.groupStart=0),d&&this._eventOutput.emit("layoutend",d),k.modified&&this._eventOutput.emit("reflow",{target:this}),g&&this._eventOutput.emit("scroll",d),d){var l=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem();(l&&!this._visibleItemCache||!l&&this._visibleItemCache||l&&this._visibleItemCache&&l.renderNode!==this._visibleItemCache.renderNode)&&(this._eventOutput.emit("pagechange",{target:this,oldViewSequence:this._visibleItemCache?this._visibleItemCache.viewSequence:void 0,viewSequence:l?l.viewSequence:void 0,oldIndex:this._visibleItemCache?this._visibleItemCache.index:void 0,index:l?l.index:void 0,renderNode:l?l.renderNode:void 0,oldRenderNode:this._visibleItemCache?this._visibleItemCache.renderNode:void 0}),this._visibleItemCache=l)}e&&(this._scroll.isScrolling=!1,d={target:this,oldSize:b,size:b,oldScrollOffset:-(this._scroll.groupStart+c),scrollOffset:-(this._scroll.groupStart+c)},this._eventOutput.emit("scrollend",d));var m=a.transform;if(j){var n=c+this._scroll.groupStart,o=[0,0,0];o[this._direction]=n,m=J.thenMove(m,o)}return{transform:m,size:b,opacity:a.opacity,origin:a.origin,target:this.group.render()}},d.prototype.render=function(){return this.container?this.container.render.apply(this.container,arguments):this.id},b.exports=d},{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8}],10:[function(a,b,c){function d(a){a=a||{},this._=a._||new this.constructor.Backing(a),this.touched=!0,this.value=a.value||this._.factory.create(),this.index=a.index||0,this.next=a.next,this.prev=a.prev,e.setOutputHandler(this,this._.eventOutput),this.value.pipe(this._.eventOutput)}var e=window.famous.core.EventHandler;d.Backing=function(a){this.factory=a.factory,this.eventOutput=new e},d.prototype.getPrevious=function(a){if(this.prev)return this.prev.touched=!0,this.prev;if(a)return void 0;var b=this._.factory.createPrevious(this.get());return b?(this.prev=new d({_:this._,value:b,index:this.index-1,next:this}),this.prev):void 0},d.prototype.getNext=function(a){if(this.next)return this.next.touched=!0,this.next;if(a)return void 0;var b=this._.factory.createNext(this.get());return b?(this.next=new d({_:this._,value:b,index:this.index+1,prev:this}),this.next):void 0},d.prototype.get=function(){return this.touched=!0,this.value},d.prototype.getIndex=function(){return this.touched=!0,this.index},d.prototype.toString=function(){return""+this.index},d.prototype.cleanup=function(){for(var a=this.prev;a;){if(!a.touched){if(a.next.prev=void 0,a.next=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.prev;break}a.touched=!1,a=a.prev}for(a=this.next;a;){if(!a.touched){if(a.prev.next=void 0,a.prev=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.next;break}a.touched=!1,a=a.next}return this},d.prototype.unshift=function(){console.error&&console.error("VirtualViewSequence.unshift is not supported and should not be called")},d.prototype.push=function(){console.error&&console.error("VirtualViewSequence.push is not supported and should not be called")},d.prototype.splice=function(){console.error&&console.error("VirtualViewSequence.splice is not supported and should not be called")},d.prototype.swap=function(){console.error&&console.error("VirtualViewSequence.swap is not supported and should not be called")},b.exports=d},{}],11:[function(a,b,c){function d(a,b){var c=a.size;if(this._size=c,this._context=a,this._options=b,this._data={z:b&&b.translateZ?b.translateZ:0},b&&b.margins){var d=e.normalizeMargins(b.margins);this._data.left=d[3],this._data.top=d[0],this._data.right=c[0]-d[1],this._data.bottom=c[1]-d[2]}else this._data.left=0,this._data.top=0,this._data.right=c[0],this._data.bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=c.length>=3?c[2]:void 0;"top"===c[0]?this.top(c[1],d,c.length>=4?c[3]:void 0):"left"===c[0]?this.left(c[1],d,c.length>=4?c[3]:void 0):"right"===c[0]?this.right(c[1],d,c.length>=4?c[3]:void 0):"bottom"===c[0]?this.bottom(c[1],d,c.length>=4?c[3]:void 0):"fill"===c[0]?this.fill(c[1],c.length>=3?c[2]:void 0):"margins"===c[0]&&this.margins(c[1])}},d.prototype.top=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.top+=b,this},d.prototype.left=function(a,b,c){if(b instanceof Array&&(b=b[0]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}return this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.left+=b,this},d.prototype.bottom=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,1],align:[0,1],translate:[this._data.left,-(this._size[1]-this._data.bottom),void 0===c?this._data.z:c]}),this._data.bottom-=b,this},d.prototype.right=function(a,b,c){if(b instanceof Array&&(b=b[0]),a){if(void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._data.right),this._data.top,void 0===c?this._data.z:c]})}return b&&(this._data.right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._data.right-this._data.left,this._data.bottom-this._data.top],translate:[this._data.left,this._data.top,void 0===b?this._data.z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._data.left+=a[3],this._data.top+=a[0],this._data.right-=a[1],this._data.bottom-=a[2],this},d.prototype.get=function(){return this._data},e.registerHelper("dock",d),b.exports=d},{"../LayoutUtility":8}],12:[function(a,b,c){function d(a,b){if(!s.length)return 0;var c,d,e=[0,0];for(c=0;c<s.length;c++)e[i]=Math.max(e[i],s[c].size[i]),e[k]+=(c>0?o[k]:0)+s[c].size[k];var f,h=p[k]?(l-e[k])/(2*s.length):0,q=(i?n[3]:n[0])+h;for(c=0;c<s.length;c++){d=s[c];var r=[0,0,0];r[k]=q,r[i]=a?m:m-e[i],f=0,0===c&&(f=e[i],f+=b&&(a&&!j||!a&&j)?i?n[0]+n[2]:n[3]+n[1]:o[i]),d.set={size:d.size,translate:r,scrollLength:f},q+=d.size[k]+o[k]+2*h}for(c=0;c<s.length;c++)d=a?s[c]:s[s.length-1-c],g.set(d.node,d.set);return s=[],e[i]+o[i]}function e(a){var b=q;if(r&&(b=r(a.renderNode,h)),b[0]===!0||b[1]===!0){var c=g.resolveSize(a,h);return b[0]!==!0&&(c[0]=q[0]),b[1]!==!0&&(c[1]=q[1]),c}return b}function f(a,b){if(g=a,h=g.size,i=g.direction,j=g.alignment,k=(i+1)%2,void 0!==b.gutter&&console.warn&&!b.suppressWarnings&&console.warn("option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead"),!b.gutter||b.margins||b.spacing)n=u.normalizeMargins(b.margins),o=b.spacing||0,o=Array.isArray(o)?o:[o,o];else{var c=Array.isArray(b.gutter)?b.gutter:[b.gutter,b.gutter];n=[c[1],c[0],c[1],c[0]],o=c}w[0]=n[i?0:3],w[1]=-n[i?2:1],p=Array.isArray(b.justify)?b.justify:b.justify?[!0,!0]:[!1,!1],l=h[k]-(i?n[3]+n[1]:n[0]+n[2]);var f,t,v,x;for(b.cells?(b.itemSize&&console.warn&&!b.suppressWarnings&&console.warn("options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two"),q=[[void 0,!0].indexOf(b.cells[0])>-1?b.cells[0]:(h[0]-(n[1]+n[3]+o[0]*(b.cells[0]-1)))/b.cells[0],[void 0,!0].indexOf(b.cells[1])>-1?b.cells[1]:(h[1]-(n[0]+n[2]+o[1]*(b.cells[1]-1)))/b.cells[1]]):b.itemSize?b.itemSize instanceof Function?r=b.itemSize:q=void 0===b.itemSize[0]||void 0===b.itemSize[0]?[void 0===b.itemSize[0]?h[0]:b.itemSize[0],void 0===b.itemSize[1]?h[1]:b.itemSize[1]]:b.itemSize:q=[!0,!0],m=g.scrollOffset+w[j]+(j?o[i]:0),x=g.scrollEnd+(j?0:w[j]),v=0,s=[];x>m;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+w[j]-(j?0:o[i]),x=g.scrollStart+(j?w[j]:0),v=0,s=[];m>x;){if(f=g.prev(),!f){d(!1,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m-=d(!1,!f),v=t[k]),s.unshift({node:f,size:t})}}var g,h,i,j,k,l,m,n,o,p,q,r,s,t=window.famous.utilities.Utility,u=a("../LayoutUtility"),v={sequence:!0,direction:[t.Direction.Y,t.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},w=[0,0];f.Capabilities=v,f.Name="CollectionLayout",f.Description="Multi-cell collection-layout with margins & spacing",b.exports=f},{"../LayoutUtility":8}],13:[function(a,b,c){function d(a,b){var c=a.next();if(c){var d=a.size,e=a.direction,f=b.itemSize,g=.2,h=.1,i=30,j=100;a.set(c,{size:f,origin:[.5,.5],align:[.5,.5],translate:[0,0,j],scrollLength:f[e]});var k=f[0]/2,l=1-g,m=j-1,n=1-h,o=!1,p=!1;for(c=a.next(),c||(c=a.prev(),o=!0);c;)if(a.set(c,{size:f,origin:[.5,.5],align:[.5,.5],translate:e?[0,o?-k:k,m]:[o?-k:k,0,m],scale:[n,n,1],opacity:l,scrollLength:f[e]}),l-=g,n-=h,k+=i,m--,k>=d[e]/2?p=!0:(c=o?a.prev():a.next(),p=!c),p){if(o)break;p=!1,o=!0,c=a.prev(),c&&(k=f[e]/2,l=1-g,m=j-1,n=1-h)}}}var e=window.famous.utilities.Utility,f={sequence:!0,direction:[e.Direction.X,e.Direction.Y],scrolling:!0,sequentialScrollingOptimized:!1};d.Capabilities=f,b.exports=d},{}],14:[function(a,b,c){b.exports=function(a,b){var c=b.itemSize;a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[c[0]/2,0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[-(c[0]/2),0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,-(c[1]/2),0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,c[1]/2,0]})}},{}],15:[function(a,b,c){console.warn&&console.warn("GridLayout has been deprecated and will be removed in the future, use CollectionLayout instead"),b.exports=a("./CollectionLayout")},{"./CollectionLayout":12}],16:[function(a,b,c){var d=a("../helpers/LayoutDockHelper");b.exports=function(a,b){var c=new d(a,b);c.top("header",void 0!==b.headerSize?b.headerSize:b.headerHeight),c.bottom("footer",void 0!==b.footerSize?b.footerSize:b.footerHeight),c.fill("content")}},{"../helpers/LayoutDockHelper":11}],17:[function(a,b,c){function d(a,b){var c,d,e,g,j,k,l,m,n,o,p,q,r,s,t=a.size,u=a.direction,v=a.alignment,w=u?0:1,x=f.normalizeMargins(b.margins),y=b.spacing||0,z=b.isSectionCallback;for(y&&"number"!=typeof y&&console.log("Famous-flex warning: ListLayout was initialized with a non-numeric spacing option. The CollectionLayout supports an array spacing argument, but the ListLayout does not."),h.size[0]=t[0],h.size[1]=t[1],h.size[w]-=x[1-w]+x[3-w],h.translate[0]=0,h.translate[1]=0,h.translate[2]=0,h.translate[w]=x[u?3:0],b.itemSize!==!0&&b.hasOwnProperty("itemSize")?b.itemSize instanceof Function?j=b.itemSize:g=void 0===b.itemSize?t[u]:b.itemSize:g=!0,i[0]=x[u?0:3],i[1]=-x[u?2:1],c=a.scrollOffset+i[v],s=a.scrollEnd+i[v];s+y>c&&(q=d,d=a.next());)e=j?j(d.renderNode):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.size[u]=e,h.translate[u]=c+(v?y:0),h.scrollLength=e+y,a.set(d,h),c+=h.scrollLength,z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),p?void 0===r&&(r=c-e):(k=d,l=c-e,m=e,n=e)):!p&&c>=0&&(p=d);for(!q||d||v||(h.scrollLength=e+i[0]+-i[1],a.set(q,h)),q=void 0,d=void 0,c=a.scrollOffset+i[v],s=a.scrollStart+i[v];c>s-y&&(q=d,d=a.prev());)e=j?j(d.renderNode):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.scrollLength=e+y,c-=h.scrollLength,h.size[u]=e,h.translate[u]=c+(v?y:0),a.set(d,h),z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),k||(k=d,l=c,m=e,n=h.scrollLength)):c+e>=0&&(p=d,k&&(r=c+e),k=void 0);if(q&&!d&&v&&(h.scrollLength=e+i[0]+-i[1],a.set(q,h),k===q&&(n=h.scrollLength)),z&&!k)for(d=a.prev();d;){if(z(d.renderNode)){k=d,e=b.itemSize||a.resolveSize(d,t)[u],l=c-e,m=e,n=void 0;break}d=a.prev()}if(k){var A=Math.max(i[0],l);void 0!==r&&m>r-i[0]&&(A=r-m),h.size[u]=m,h.translate[u]=A,h.scrollLength=n,a.set(k,h)}}var e=window.famous.utilities.Utility,f=a("../LayoutUtility"),g={sequence:!0,direction:[e.Direction.Y,e.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},h={size:[0,0],translate:[0,0,0],scrollLength:void 0},i=[0,0];d.Capabilities=g,d.Name="ListLayout",d.Description="List-layout with margins, spacing and sticky headers",b.exports=d},{"../LayoutUtility":8}],18:[function(a,b,c){var d=a("../helpers/LayoutDockHelper");b.exports=function(a,b){var c=new d(a,{margins:b.margins,translateZ:b.hasOwnProperty("zIncrement")?b.zIncrement:2});a.set("background",{size:a.size});var e=a.get("backIcon");e&&(c.left(e,b.backIconWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var f=a.get("backItem");f&&(c.left(f,b.backItemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var g,h,i=a.get("rightItems");if(i)for(h=0;h<i.length;h++)g=a.get(i[h]),c.right(g,b.rightItemWidth||b.itemWidth),c.right(void 0,b.rightItemSpacer||b.itemSpacer);var j=a.get("leftItems");if(j)for(h=0;h<j.length;h++)g=a.get(j[h]),c.left(g,b.leftItemWidth||b.itemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer);var k=a.get("title");if(k){var l=a.resolveSize(k,a.size),m=Math.max((a.size[0]-l[0])/2,c.get().left),n=Math.min((a.size[0]+l[0])/2,c.get().right);m=Math.max(m,a.size[0]-n),n=Math.min(n,a.size[0]-m),a.set(k,{size:[n-m,a.size[1]],translate:[m,0,c.get().z]})}}},{"../helpers/LayoutDockHelper":11}],19:[function(a,b,c){function d(a,b){for(f=a.size,e=a.direction,g=b.ratios,h=0,j=0;j<g.length;j++)h+=g[j];for(n.size[0]=f[0],n.size[1]=f[1],n.translate[0]=0,n.translate[1]=0,k=a.next(),i=0,j=0;k&&j<g.length;)n.size[e]=(f[e]-i)/h*g[j],n.translate[e]=i,a.set(k,n),i+=n.size[e],h-=g[j],j++,k=a.next()}var e,f,g,h,i,j,k,l=window.famous.utilities.Utility,m={sequence:!0,direction:[l.Direction.Y,l.Direction.X],scrolling:!1},n={size:[0,0],translate:[0,0,0]};d.Capabilities=m,b.exports=d},{}],20:[function(a,b,c){function d(a,b){e=a.size,f=a.direction,g=f?0:1,k=b.spacing||0,h=a.get("items"),i=a.get("spacers"),j=q.normalizeMargins(b.margins),o=b.zIncrement||2,s.size[0]=a.size[0],
-s.size[1]=a.size[1],s.size[g]-=j[1-g]+j[3-g],s.translate[0]=0,s.translate[1]=0,s.translate[2]=o,s.translate[g]=j[f?3:0],s.align[0]=0,s.align[1]=0,s.origin[0]=0,s.origin[1]=0,n=f?j[0]:j[3],l=e[f]-(n+(f?j[2]:j[1])),l-=(h.length-1)*k;for(var c=0;c<h.length;c++)m=void 0===b.itemSize?Math.round(l/(h.length-c)):b.itemSize===!0?a.resolveSize(h[c],e)[f]:b.itemSize,s.scrollLength=m,0===c&&(s.scrollLength+=f?j[0]:j[3]),c===h.length-1?s.scrollLength+=f?j[2]:j[1]:s.scrollLength+=k,s.size[f]=m,s.translate[f]=n,a.set(h[c],s),n+=m,l-=m,c===b.selectedItemIndex&&(s.scrollLength=0,s.translate[f]+=m/2,s.translate[2]=2*o,s.origin[f]=.5,a.set("selectedItemOverlay",s),s.origin[f]=0,s.translate[2]=o),c<h.length-1?(i&&c<i.length&&(s.size[f]=k,s.translate[f]=n,a.set(i[c],s)),n+=k):n+=f?j[2]:j[1];s.scrollLength=0,s.size[0]=e[0],s.size[1]=e[1],s.size[f]=e[f],s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.translate[f]=0,a.set("background",s)}var e,f,g,h,i,j,k,l,m,n,o,p=window.famous.utilities.Utility,q=a("../LayoutUtility"),r={sequence:!0,direction:[p.Direction.X,p.Direction.Y],trueSize:!0},s={size:[0,0],translate:[0,0,0],align:[0,0],origin:[0,0]};d.Capabilities=r,d.Name="TabBarLayout",d.Description="TabBar widget layout",b.exports=d},{"../LayoutUtility":8}],21:[function(a,b,c){function d(a,b){for(e=a.size,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,j=b.diameter||3*i,n=j/2,o=2*Math.atan2(i/2,n),p=void 0===b.radialOpacity?1:b.radialOpacity,s.opacity=1,s.size[0]=e[0],s.size[1]=e[1],s.size[g]=e[g],s.size[f]=i,s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.rotate[0]=0,s.rotate[1]=0,s.rotate[2]=0,s.scrollLength=i,k=a.scrollOffset,l=Math.PI/2/o*i+i;l>=k&&(h=a.next());)k>=-l&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k+=i;for(k=a.scrollOffset-i;k>=-l&&(h=a.prev());)l>=k&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k-=i}var e,f,g,h,i,j,k,l,m,n,o,p,q=window.famous.utilities.Utility,r={sequence:!0,direction:[q.Direction.Y,q.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},s={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=r,d.Name="WheelLayout",d.Description="Spinner-wheel/slot-machine layout",b.exports=d},{}],22:[function(a,b,c){function d(a){p.apply(this,arguments),a=a||{},this._date=new Date(a.date?a.date.getTime():void 0),this._components=[],this.classes=a.classes?this.classes.concat(a.classes):this.classes,h.call(this),m.call(this),this._overlayRenderables={top:e.call(this,"top"),middle:e.call(this,"middle"),bottom:e.call(this,"bottom")},o.call(this),this.setOptions(this.options)}function e(a,b){var c=this.options.createRenderables[Array.isArray(a)?a[0]:a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new q({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});if(Array.isArray(a))for(var e=0;e<a.length;e++)d.addClass(a[e]);else d.addClass(a);return d}function f(a){for(var b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();if(e&&e.viewSequence){var f=e.viewSequence,g=e.viewSequence.get(),h=d.getComponent(g.date),i=d.getComponent(a),j=0;if(h!==i&&(j=i-h,d.loop)){var k=0>j?j+d.upperBound:j-d.upperBound;Math.abs(k)<Math.abs(j)&&(j=k)}if(j)for(;h!==i&&(f=j>0?f.getNext():f.getPrevious(),g=f?f.get():void 0);)h=d.getComponent(g.date),j>0?c.scrollController.goToNextPage():c.scrollController.goToPreviousPage();else c.scrollController.goToRenderNode(g)}}}function g(){for(var a=new Date(this._date),b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();e&&e.renderNode&&d.setComponent(a,d.getComponent(e.renderNode.date))}return a}function h(){this.container=new s(this.options.container),this.container.setClasses(this.classes),this.layout=new t({layout:w,layoutOptions:{ratios:[]},direction:r.Direction.X}),this.container.add(this.layout),this.add(this.container)}function i(a,b){}function j(){this._scrollingCount++,1===this._scrollingCount&&this._eventOutput.emit("scrollstart",{target:this})}function k(){this._scrollingCount--,0===this._scrollingCount&&this._eventOutput.emit("scrollend",{target:this,date:this._date})}function l(){this._date=g.call(this),this._eventOutput.emit("datechange",{target:this,date:this._date})}function m(){this.scrollWheels=[],this._scrollingCount=0;for(var a=[],b=[],c=0;c<this._components.length;c++){var d=this._components[c];d.createRenderable=e.bind(this);var f=new x({factory:d,value:d.create(this._date)}),g=z.combineOptions(this.options.scrollController,{layout:v,layoutOptions:this.options.wheelLayout,flow:!1,direction:r.Direction.Y,dataSource:f,autoPipeEvents:!0}),h=new u(g);h.on("scrollstart",j.bind(this)),h.on("scrollend",k.bind(this)),h.on("pagechange",l.bind(this));var m={component:d,scrollController:h,viewSequence:f};this.scrollWheels.push(m),d.on("click",i.bind(this,m)),a.push(h),b.push(d.sizeRatio)}this.layout.setDataSource(a),this.layout.setLayoutOptions({ratios:b})}function n(a,b){var c=(a.size[1]-b.itemSize)/2;a.set("top",{size:[a.size[0],c],translate:[0,0,1]}),a.set("middle",{size:[a.size[0],a.size[1]-2*c],translate:[0,c,1]}),a.set("bottom",{size:[a.size[0],c],translate:[0,a.size[1]-c,1]})}function o(){this.overlay=new t({layout:n,layoutOptions:{itemSize:this.options.wheelLayout.itemSize},dataSource:this._overlayRenderables}),this.add(this.overlay)}var p=window.famous.core.View,q=window.famous.core.Surface,r=window.famous.utilities.Utility,s=window.famous.surfaces.ContainerSurface,t=a("../LayoutController"),u=a("../ScrollController"),v=a("../layouts/WheelLayout"),w=a("../layouts/ProportionalLayout"),x=a("../VirtualViewSequence"),y=a("./DatePickerComponents"),z=a("../LayoutUtility");d.prototype=Object.create(p.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-datepicker"],d.Component=y,d.DEFAULT_OPTIONS={perspective:500,wheelLayout:{itemSize:100,diameter:500},createRenderables:{item:!0,top:!1,middle:!1,bottom:!1},scrollController:{enabled:!0,paginated:!0,paginationMode:u.PaginationMode.SCROLL,mouseMove:!0,scrollSpring:{dampingRatio:1,period:800}}},d.prototype.setOptions=function(a){if(p.prototype.setOptions.call(this,a),!this.layout)return this;void 0!==a.perspective&&this.container.context.setPerspective(a.perspective);var b;if(void 0!==a.wheelLayout){for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setLayoutOptions(a.wheelLayout);this.overlay.setLayoutOptions({itemSize:this.options.wheelLayout.itemSize})}if(void 0!==a.scrollController)for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setOptions(a.scrollController);return this},d.prototype.setComponents=function(a){return this._components=a,m.call(this),this},d.prototype.getComponents=function(){return this._components},d.prototype.setDate=function(a){return this._date.setTime(a.getTime()),f.call(this,this._date),this},d.prototype.getDate=function(){return this._date},b.exports=d},{"../LayoutController":5,"../LayoutUtility":8,"../ScrollController":9,"../VirtualViewSequence":10,"../layouts/ProportionalLayout":19,"../layouts/WheelLayout":21,"./DatePickerComponents":23}],23:[function(a,b,c){function d(a){return""+a[this.get]()}function e(a){return("0"+a[this.get]()).slice(-2)}function f(a){return("00"+a[this.get]()).slice(-3)}function g(a){return("000"+a[this.get]()).slice(-4)}function h(a){if(this._eventOutput=new s,this._pool=[],s.setOutputHandler(this,this._eventOutput),a)for(var b in a)this[b]=a[b]}function i(){h.apply(this,arguments)}function j(){h.apply(this,arguments)}function k(){h.apply(this,arguments)}function l(){h.apply(this,arguments)}function m(){h.apply(this,arguments)}function n(){h.apply(this,arguments)}function o(){h.apply(this,arguments)}function p(){h.apply(this,arguments)}function q(){h.apply(this,arguments)}var r=window.famous.core.Surface,s=window.famous.core.EventHandler;h.prototype.step=1,h.prototype.classes=["item"],h.prototype.getComponent=function(a){return a[this.get]()},h.prototype.setComponent=function(a,b){return a[this.set](b)},h.prototype.format=function(a){return"overide to implement"},h.prototype.createNext=function(a){var b=this.getNext(a.date);return b?this.create(b):void 0},h.prototype.getNext=function(a){a=new Date(a.getTime());var b=this.getComponent(a)+this.step;if(void 0!==this.upperBound&&b>=this.upperBound){if(!this.loop)return void 0;b=Math.max(b%this.upperBound,this.lowerBound||0)}return this.setComponent(a,b),a},h.prototype.createPrevious=function(a){var b=this.getPrevious(a.date);return b?this.create(b):void 0},h.prototype.getPrevious=function(a){a=new Date(a.getTime());var b=this.getComponent(a)-this.step;if(void 0!==this.lowerBound&&b<this.lowerBound){if(!this.loop)return void 0;b%=this.upperBound}return this.setComponent(a,b),a},h.prototype.installClickHandler=function(a){a.on("click",function(b){this._eventOutput.emit("click",{target:a,event:b})}.bind(this))},h.prototype.createRenderable=function(a,b){return new r({classes:a,content:"<div>"+b+"</div>"})},h.prototype.create=function(a){a=a||new Date;var b;return this._pool.length?(b=this._pool[0],this._pool.splice(0,1),b.setContent(this.format(a))):(b=this.createRenderable(this.classes,this.format(a)),this.installClickHandler(b)),b.date=a,b},h.prototype.destroy=function(a){this._pool.push(a)},i.prototype=Object.create(h.prototype),i.prototype.constructor=i,i.prototype.classes=["item","year"],i.prototype.format=g,i.prototype.sizeRatio=1,i.prototype.step=1,i.prototype.loop=!1,i.prototype.set="setFullYear",i.prototype.get="getFullYear",j.prototype=Object.create(h.prototype),j.prototype.constructor=j,j.prototype.classes=["item","month"],j.prototype.sizeRatio=2,j.prototype.lowerBound=0,j.prototype.upperBound=12,j.prototype.step=1,j.prototype.loop=!0,j.prototype.set="setMonth",j.prototype.get="getMonth",j.prototype.strings=["January","February","March","April","May","June","July","August","September","October","November","December"],j.prototype.format=function(a){return this.strings[a.getMonth()]},k.prototype=Object.create(h.prototype),k.prototype.constructor=k,k.prototype.classes=["item","fullday"],k.prototype.sizeRatio=2,k.prototype.step=1,k.prototype.set="setDate",k.prototype.get="getDate",k.prototype.format=function(a){return a.toLocaleDateString()},l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.classes=["item","weekday"],l.prototype.sizeRatio=2,l.prototype.lowerBound=0,l.prototype.upperBound=7,l.prototype.step=1,l.prototype.loop=!0,l.prototype.set="setDate",l.prototype.get="getDate",l.prototype.strings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l.prototype.format=function(a){return this.strings[a.getDay()]},m.prototype=Object.create(h.prototype),m.prototype.constructor=m,m.prototype.classes=["item","day"],m.prototype.format=d,m.prototype.sizeRatio=1,m.prototype.lowerBound=1,m.prototype.upperBound=32,m.prototype.step=1,m.prototype.loop=!0,m.prototype.set="setDate",m.prototype.get="getDate",n.prototype=Object.create(h.prototype),n.prototype.constructor=n,n.prototype.classes=["item","hour"],n.prototype.format=e,n.prototype.sizeRatio=1,n.prototype.lowerBound=0,n.prototype.upperBound=24,n.prototype.step=1,n.prototype.loop=!0,n.prototype.set="setHours",n.prototype.get="getHours",o.prototype=Object.create(h.prototype),o.prototype.constructor=o,o.prototype.classes=["item","minute"],o.prototype.format=e,o.prototype.sizeRatio=1,o.prototype.lowerBound=0,o.prototype.upperBound=60,o.prototype.step=1,o.prototype.loop=!0,o.prototype.set="setMinutes",o.prototype.get="getMinutes",p.prototype=Object.create(h.prototype),p.prototype.constructor=p,p.prototype.classes=["item","second"],p.prototype.format=e,p.prototype.sizeRatio=1,p.prototype.lowerBound=0,p.prototype.upperBound=60,p.prototype.step=1,p.prototype.loop=!0,p.prototype.set="setSeconds",p.prototype.get="getSeconds",q.prototype=Object.create(h.prototype),q.prototype.constructor=q,q.prototype.classes=["item","millisecond"],q.prototype.format=f,q.prototype.sizeRatio=1,q.prototype.lowerBound=0,q.prototype.upperBound=1e3,q.prototype.step=1,q.prototype.loop=!0,q.prototype.set="setMilliseconds",q.prototype.get="getMilliseconds",b.exports={Base:h,Year:i,Month:j,FullDay:k,WeekDay:l,Day:m,Hour:n,Minute:o,Second:p,Millisecond:q}},{}],24:[function(a,b,c){function d(a){h.apply(this,arguments),this._selectedItemIndex=-1,a=a||{},this.classes=a.classes?this.classes.concat(a.classes):this.classes,this.layout=new i(this.options.layoutController),this.add(this.layout),this.layout.pipe(this._eventOutput),this._renderables={items:[],spacers:[],background:f.call(this,"background"),selectedItemOverlay:f.call(this,"selectedItemOverlay")},this.setOptions(this.options)}function e(a){if(a!==this._selectedItemIndex){var b=this._selectedItemIndex;this._selectedItemIndex=a,this.layout.setLayoutOptions({selectedItemIndex:a}),b>=0&&this._renderables.items[b].removeClass&&this._renderables.items[b].removeClass("selected"),this._renderables.items[a].addClass&&this._renderables.items[a].addClass("selected"),b>=0&&this._eventOutput.emit("tabchange",{target:this,index:a,oldIndex:b,item:this._renderables.items[a],oldItem:b>=0&&b<this._renderables.items.length?this._renderables.items[b]:void 0})}}function f(a,b){var c=this.options.createRenderables[a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new g({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});return d.addClass(a),"item"===a&&this.options.tabBarLayout&&this.options.tabBarLayout.itemSize&&this.options.tabBarLayout.itemSize===!0&&d.setSize(this.layout.getDirection()?[void 0,!0]:[!0,void 0]),d}var g=window.famous.core.Surface,h=window.famous.core.View,i=a("../LayoutController"),j=a("../layouts/TabBarLayout");d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-tabbar"],d.DEFAULT_OPTIONS={tabBarLayout:{margins:[0,0,0,0],spacing:0},createRenderables:{item:!0,background:!1,selectedItemOverlay:!1,spacer:!1},layoutController:{autoPipeEvents:!0,layout:j,flow:!0,flowOptions:{reflowOnResize:!1,spring:{dampingRatio:.8,period:300}}}},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),this.layout?(void 0!==a.tabBarLayout&&this.layout.setLayoutOptions(a.tabBarLayout),a.layoutController&&this.layout.setOptions(a.layoutController),this):this},d.prototype.setItems=function(a){var b=this._selectedItemIndex;if(this._selectedItemIndex=-1,this._renderables.items=[],this._renderables.spacers=[],a)for(var c=0;c<a.length;c++){var d=f.call(this,"item",a[c]);if(d.on&&d.on("click",e.bind(this,c)),this._renderables.items.push(d),c<a.length-1){var g=f.call(this,"spacer"," ");g&&this._renderables.spacers.push(g)}}return this.layout.setDataSource(this._renderables),this._renderables.items.length&&e.call(this,Math.max(Math.min(b,this._renderables.items.length-1),0)),this},d.prototype.getItems=function(){return this._renderables.items},d.prototype.getItemSpec=function(a,b){return this.layout.getSpec(this._renderables.items[a],b)},d.prototype.setSelectedItemIndex=function(a){return e.call(this,a),this},d.prototype.getSelectedItemIndex=function(){return this._selectedItemIndex},d.prototype.getSize=function(){return this.options.size||(this.layout?this.layout.getSize():h.prototype.getSize.call(this))},b.exports=d},{"../LayoutController":5,"../layouts/TabBarLayout":20}],25:[function(a,b,c){function d(a){i.apply(this,arguments),e.call(this),f.call(this),g.call(this),this.tabBar.setOptions({layoutController:{direction:this.options.tabBarPosition===d.Position.TOP||this.options.tabBarPosition===d.Position.BOTTOM?0:1}})}function e(){this.tabBar=new k(this.options.tabBar),this.animationController=new j(this.options.animationController),this._renderables={tabBar:this.tabBar,content:this.animationController}}function f(){this.layout=new m(this.options.layoutController),this.layout.setLayout(d.DEFAULT_LAYOUT.bind(this)),this.layout.setDataSource(this._renderables),this.add(this.layout)}function g(){this.tabBar.on("tabchange",function(a){h.call(this,a),this._eventOutput.emit("tabchange",{target:this,index:a.index,oldIndex:a.oldIndex,item:this._items[a.index],oldItem:a.oldIndex>=0&&a.oldIndex<this._items.length?this._items[a.oldIndex]:void 0})}.bind(this))}function h(a){var b=this.tabBar.getSelectedItemIndex();this.animationController.halt(),b>=0?this.animationController.show(this._items[b].view):this.animationController.hide()}var i=window.famous.core.View,j=a("../AnimationController"),k=a("./TabBar"),l=a("../helpers/LayoutDockHelper"),m=a("../LayoutController"),n=window.famous.transitions.Easing;d.prototype=Object.create(i.prototype),d.prototype.constructor=d,d.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3},d.DEFAULT_LAYOUT=function(a,b){var c=new l(a,b);switch(this.options.tabBarPosition){case d.Position.TOP:c.top("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.BOTTOM:c.bottom("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.LEFT:c.left("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.RIGHT:c.right("tabBar",this.options.tabBarSize,this.options.tabBarZIndex)}c.fill("content")},d.DEFAULT_OPTIONS={tabBarPosition:d.Position.BOTTOM,tabBarSize:50,tabBarZIndex:10,tabBar:{createRenderables:{background:!0}},animationController:{transition:{duration:300,curve:n.inOutQuad},animation:j.Animation.FadedZoom}},d.prototype.setOptions=function(a){return i.prototype.setOptions.call(this,a),this.layout&&a.layoutController&&this.layout.setOptions(a.layoutController),this.tabBar&&a.tabBar&&this.tabBar.setOptions(a.tabBar),this.animationController&&a.animationController&&this.animationController(a.animationController),this.layout&&void 0!==a.tabBarPosition&&this.tabBar.setOptions({layoutController:{direction:a.tabBarPosition===d.Position.TOP||a.tabBarPosition===d.Position.BOTTOM?0:1}}),this.layout&&this.layout.reflowLayout(),this},d.prototype.setItems=function(a){this._items=a;for(var b=[],c=0;c<a.length;c++)b.push(a[c].tabItem);return this.tabBar.setItems(b),h.call(this),this},d.prototype.getItems=function(){return this._items},d.prototype.setSelectedItemIndex=function(a){return this.tabBar.setSelectedItemIndex(a),this},d.prototype.getSelectedItemIndex=function(){return this.tabBar.getSelectedItemIndex()},b.exports=d},{"../AnimationController":1,"../LayoutController":5,"../helpers/LayoutDockHelper":11,"./TabBar":24}],26:[function(a,b,c){"undefined"==typeof famousflex&&(famousflex={}),famousflex.FlexScrollView=a("./src/FlexScrollView"),famousflex.FlowLayoutNode=a("./src/FlowLayoutNode"),famousflex.LayoutContext=a("./src/LayoutContext"),famousflex.LayoutController=a("./src/LayoutController"),famousflex.LayoutNode=a("./src/LayoutNode"),famousflex.LayoutNodeManager=a("./src/LayoutNodeManager"),famousflex.LayoutUtility=a("./src/LayoutUtility"),famousflex.ScrollController=a("./src/ScrollController"),famousflex.VirtualViewSequence=a("./src/VirtualViewSequence"),famousflex.AnimationController=a("./src/AnimationController"),famousflex.widgets=famousflex.widgets||{},famousflex.widgets.DatePicker=a("./src/widgets/DatePicker"),famousflex.widgets.TabBar=a("./src/widgets/TabBar"),famousflex.widgets.TabBarController=a("./src/widgets/TabBarController"),famousflex.layouts=famousflex.layouts||{},famousflex.layouts.CollectionLayout=a("./src/layouts/CollectionLayout"),famousflex.layouts.CoverLayout=a("./src/layouts/CoverLayout"),famousflex.layouts.CubeLayout=a("./src/layouts/CubeLayout"),famousflex.layouts.GridLayout=a("./src/layouts/GridLayout"),famousflex.layouts.HeaderFooterLayout=a("./src/layouts/HeaderFooterLayout"),famousflex.layouts.ListLayout=a("./src/layouts/ListLayout"),famousflex.layouts.NavBarLayout=a("./src/layouts/NavBarLayout"),famousflex.layouts.ProportionalLayout=a("./src/layouts/ProportionalLayout"),famousflex.layouts.WheelLayout=a("./src/layouts/WheelLayout"),famousflex.helpers=famousflex.helpers||{},famousflex.helpers.LayoutDockHelper=a("./src/helpers/LayoutDockHelper")},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/ScrollController":9,"./src/VirtualViewSequence":10,"./src/helpers/LayoutDockHelper":11,"./src/layouts/CollectionLayout":12,"./src/layouts/CoverLayout":13,"./src/layouts/CubeLayout":14,"./src/layouts/GridLayout":15,"./src/layouts/HeaderFooterLayout":16,"./src/layouts/ListLayout":17,"./src/layouts/NavBarLayout":18,"./src/layouts/ProportionalLayout":19,"./src/layouts/WheelLayout":21,"./src/widgets/DatePicker":22,"./src/widgets/TabBar":24,"./src/widgets/TabBarController":25}]},{},[26]);
\ No newline at end of file
+!function a(b,c,d){function e(g,h){if(!c[g]){if(!b[g]){var i="function"==typeof require&&require;if(!h&&i)return i(g,!0);if(f)return f(g,!0);var j=new Error("Cannot find module '"+g+"'");throw j.code="MODULE_NOT_FOUND",j}var k=c[g]={exports:{}};b[g][0].call(k.exports,function(a){var c=b[g][1][a];return e(c?c:a)},k,k.exports,a,b,c,d)}return c[g].exports}for(var f="function"==typeof require&&require,g=0;g<d.length;g++)e(d[g]);return e}({1:[function(a,b,c){function d(a){w.apply(this,arguments),this._size=[0,0],f.call(this),a&&this.setOptions(a)}function e(a,b){var c={size:a.size,translate:[0,0,0]};this._size[0]=a.size[0],this._size[1]=a.size[1];for(var d=a.get("views"),e=a.get("transferables"),f=0,g=0;g<d.length;g++){var h=this._viewStack[g];switch(h.state){case E.HIDDEN:a.set(d[g],{size:a.size,translate:[2*a.size[0],2*a.size[1],0]});break;case E.HIDE:case E.HIDING:case E.VISIBLE:case E.SHOW:case E.SHOWING:if(2>f){f++;var i=d[g];a.set(i,c);for(var j=0;j<e.length;j++)for(var k=0;k<h.transferables.length;k++)e[j].renderNode===h.transferables[k].renderNode&&a.set(e[j],{translate:[0,0,c.translate[2]],size:[a.size[0],a.size[1]]});c.translate[2]+=b.zIndexOffset}}}}function f(){this._renderables={views:[],transferables:[]},this._viewStack=[],this.layout=new x({layout:e.bind(this),layoutOptions:this.options,dataSource:this._renderables}),this.add(this.layout),this.layout.on("layoutend",m.bind(this))}function g(a,b,c,d){if(a.view){var e=b.getSpec(c);e&&!e.trueSizeRequested?d(e):C.after(g.bind(this,a,b,c,d),1)}}function h(a,b,c){return b.getTransferable?b.getTransferable(c):b.getSpec&&b.get&&b.replace&&void 0!==b.get(c)?{get:function(){return b.get(c)},show:function(a){b.replace(c,a)},getSpec:g.bind(this,a,b,c)}:b.layout?h.call(this,a,b.layout,c):void 0}function i(a,b,c){function d(){e--,0===e&&c()}var e=0;for(var f in a.options.transfer.items)j.call(this,a,b,f,d)&&e++;e||c()}function j(a,b,c,d){var e=a.options.transfer.items[c],f={};if(f.source=h.call(this,b,b.view,c),Array.isArray(e))for(var g=0;g<e.length&&(f.target=h.call(this,a,a.view,e[g]),!f.target);g++);else f.target=h.call(this,a,a.view,e);return f.source&&f.target?(f.source.getSpec(function(b){f.sourceSpec=b,f.originalSource=f.source.get(),f.source.show(new B(new z(b))),f.originalTarget=f.target.get();var c=new B(new z({opacity:0}));c.add(f.originalTarget),f.target.show(c);var e=new z({transform:y.translate(0,0,a.options.transfer.zIndex)});f.mod=new A(b),f.renderNode=new B(e),f.renderNode.add(f.mod).add(f.originalSource),a.transferables.push(f),this._renderables.transferables.push(f.renderNode),this.layout.reflowLayout(),C.after(function(){var a;f.target.getSpec(function(b,c){f.targetSpec=b,f.transition=c,a||d()},!0)},1)}.bind(this),!1),!0):!1}function k(a,b){for(var c=0;c<a.transferables.length;c++){var d=a.transferables[c];if(d.mod.halt(),(void 0!==d.sourceSpec.opacity||void 0!==d.targetSpec.opacity)&&d.mod.setOpacity(void 0===d.targetSpec.opacity?1:d.targetSpec.opacity,d.transition||a.options.transfer.transition),a.options.transfer.fastResize){if(d.sourceSpec.transform||d.targetSpec.transform||d.sourceSpec.size||d.targetSpec.size){var e=d.targetSpec.transform||y.identity;d.sourceSpec.size&&d.targetSpec.size&&(e=y.multiply(e,y.scale(d.targetSpec.size[0]/d.sourceSpec.size[0],d.targetSpec.size[1]/d.sourceSpec.size[1],1))),d.mod.setTransform(e,d.transition||a.options.transfer.transition,b),b=void 0}}else(d.sourceSpec.transform||d.targetSpec.transform)&&(d.mod.setTransform(d.targetSpec.transform||y.identity,d.transition||a.options.transfer.transition,b),b=void 0),(d.sourceSpec.size||d.targetSpec.size)&&(d.mod.setSize(d.targetSpec.size||d.sourceSpec.size,d.transition||a.options.transfer.transition,b),b=void 0)}b&&b()}function l(a){for(var b=0;b<a.transferables.length;b++){for(var c=a.transferables[b],d=0;d<this._renderables.transferables.length;d++)if(this._renderables.transferables[d]===c.renderNode){this._renderables.transferables.splice(d,1);break}c.source.show(c.originalSource),c.target.show(c.originalTarget)}a.transferables=[],this.layout.reflowLayout()}function m(a){for(var b,c=0;c<this._viewStack.length;c++){var d=this._viewStack[c];switch(d.state){case E.HIDE:d.state=E.HIDING,r.call(this,d,b,a.size),u.call(this);break;case E.SHOW:d.state=E.SHOWING,n.call(this,d,b,a.size),u.call(this)}b=d}}function n(a,b,c){var d=a.options.show.animation?a.options.show.animation.call(void 0,!0,c):{};a.startSpec=d,a.endSpec={opacity:1,transform:y.identity},a.mod.halt(),d.transform&&a.mod.setTransform(d.transform),void 0!==d.opacity&&a.mod.setOpacity(d.opacity),d.align&&a.mod.setAlign(d.align),d.origin&&a.mod.setOrigin(d.origin);var e=o.bind(this,a,d),f=a.wait?function(){a.wait.then(e,e)}:e;b?i.call(this,a,b,f):f()}function o(a,b){if(!a.halted){var c=a.showCallback;b.transform&&(a.mod.setTransform(y.identity,a.options.show.transition,c),c=void 0),void 0!==b.opacity&&(a.mod.setOpacity(1,a.options.show.transition,c),c=void 0),k.call(this,a,c)}}function p(a,b,c){return a+(b-a)*c}function q(a,b){if(a.mod.halt(),a.halted=!0,a.startSpec&&void 0!==b&&(void 0!==a.startSpec.opacity&&void 0!==a.endSpec.opacity&&a.mod.setOpacity(p(a.startSpec.opacity,a.endSpec.opacity,b)),a.startSpec.transform&&a.endSpec.transform)){for(var c=[],d=0;d<a.startSpec.transform.length;d++)c.push(p(a.startSpec.transform[d],a.endSpec.transform[d],b));a.mod.setTransform(c)}}function r(a,b,c){var d=s.bind(this,a,b,c);a.wait?a.wait.then(d,d):d()}function s(a,b,c){var d=a.options.hide.animation?a.options.hide.animation.call(void 0,!1,c):{};if(a.endSpec=d,a.startSpec={opacity:1,transform:y.identity},!a.halted){a.mod.halt();var e=a.hideCallback;d.transform&&(a.mod.setTransform(d.transform,a.options.hide.transition,e),e=void 0),void 0!==d.opacity&&(a.mod.setOpacity(d.opacity,a.options.hide.transition,e),e=void 0),e&&e()}}function t(a,b,c){a.options={show:{transition:this.options.show.transition||this.options.transition,animation:this.options.show.animation||this.options.animation},hide:{transition:this.options.hide.transition||this.options.transition,animation:this.options.hide.animation||this.options.animation},transfer:{transition:this.options.transfer.transition||this.options.transition,items:this.options.transfer.items||{},zIndex:this.options.transfer.zIndex,fastResize:this.options.transfer.fastResize}},b&&(a.options.show.transition=(b.show?b.show.transition:void 0)||b.transition||a.options.show.transition,b&&b.show&&void 0!==b.show.animation?a.options.show.animation=b.show.animation:b&&void 0!==b.animation&&(a.options.show.animation=b.animation),a.options.transfer.transition=(b.transfer?b.transfer.transition:void 0)||b.transition||a.options.transfer.transition,a.options.transfer.items=(b.transfer?b.transfer.items:void 0)||a.options.transfer.items,a.options.transfer.zIndex=b.transfer&&void 0!==b.transfer.zIndex?b.transfer.zIndex:a.options.transfer.zIndex,a.options.transfer.fastResize=b.transfer&&void 0!==b.transfer.fastResize?b.transfer.fastResize:a.options.transfer.fastResize),a.showCallback=function(){a.showCallback=void 0,a.state=E.VISIBLE,u.call(this),l.call(this,a),a.endSpec=void 0,a.startSpec=void 0,c&&c()}.bind(this)}function u(){for(var a,b=!1,c=0,d=0;d<this._viewStack.length;){if(this._viewStack[d].state===E.HIDDEN){c++;for(var e=0;e<this._viewStack.length;e++)if(this._viewStack[e].state!==E.HIDDEN&&this._viewStack[e].view===this._viewStack[d].view){this._viewStack[d].view=void 0,this._renderables.views.splice(d,1),this._viewStack.splice(d,1),d--,c--;break}}d++}for(;c>this.options.keepHiddenViewsInDOMCount;)this._viewStack[0].view=void 0,this._renderables.views.splice(0,1),this._viewStack.splice(0,1),c--;for(d=c;d<Math.min(this._viewStack.length-c,2)+c;d++){var f=this._viewStack[d];if(f.state===E.QUEUED){a&&a.state!==E.VISIBLE&&a.state!==E.HIDING||(a&&a.state===E.VISIBLE&&(a.state=E.HIDE,a.wait=f.wait),f.state=E.SHOW,b=!0);break}f.state===E.VISIBLE&&f.hide&&(f.state=E.HIDE),(f.state===E.SHOW||f.state===E.HIDE)&&this.layout.reflowLayout(),a=f}b&&(u.call(this),this.layout.reflowLayout())}function v(){for(var a=0;a<Math.min(this._viewStack.length,2);a++){var b=this._viewStack[a];if(b.halted&&(b.halted=!1,b.endSpec)){var c;switch(b.state){case E.HIDE:case E.HIDING:c=b.hideCallback;break;case E.SHOW:case E.SHOWING:c=b.showCallback}b.mod.halt(),b.endSpec.transform&&(b.mod.setTransform(b.endSpec.transform,b.options.show.transition,c),c=void 0),void 0!==b.endSpec.opacity&&b.mod.setOpacity(b.endSpec.opacity,b.options.show.transition,c),c&&c()}}}var w=window.famous.core.View,x=a("./LayoutController"),y=window.famous.core.Transform,z=window.famous.core.Modifier,A=window.famous.modifiers.StateModifier,B=window.famous.core.RenderNode,C=window.famous.utilities.Timer,D=window.famous.transitions.Easing;d.prototype=Object.create(w.prototype),d.prototype.constructor=d,d.Animation={Slide:{Left:function(a,b){return{transform:y.translate(a?b[0]:-b[0],0,0)}},Right:function(a,b){return{transform:y.translate(a?-b[0]:b[0],0,0)}},Up:function(a,b){return{transform:y.translate(0,a?b[1]:-b[1],0)}},Down:function(a,b){return{transform:y.translate(0,a?-b[1]:b[1],0)}}},Fade:function(a,b){return{opacity:this&&void 0!==this.opacity?this.opacity:0}},Zoom:function(a,b){var c=this&&void 0!==this.scale?this.scale:.5;return{transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}},FadedZoom:function(a,b){var c=a?this&&void 0!==this.showScale?this.showScale:.9:this&&void 0!==this.hideScale?this.hideScale:1.1;return{opacity:this&&void 0!==this.opacity?this.opacity:0,transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}}},d.DEFAULT_OPTIONS={transition:{duration:400,curve:D.inOutQuad},animation:d.Animation.Fade,show:{},hide:{},transfer:{fastResize:!0,zIndex:10},zIndexOffset:0,keepHiddenViewsInDOMCount:0};var E={NONE:0,HIDE:1,HIDING:2,HIDDEN:3,SHOW:4,SHOWING:5,VISIBLE:6,QUEUED:7};d.prototype.show=function(a,b,c){if(v.call(this,a),!a)return this.hide(b,c);var d=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return d&&d.view===a&&d.state!==E.HIDDEN?(d.hide=!1,d.state===E.HIDE?(d.state=E.QUEUED,t.call(this,d,b,c),u.call(this)):c&&c(),this):(d&&d.state!==E.HIDING&&b&&(d.options.hide.transition=(b.hide?b.hide.transition:void 0)||b.transition||d.options.hide.transition,b&&b.hide&&void 0!==b.hide.animation?d.options.hide.animation=b.hide.animation:b&&void 0!==b.animation&&(d.options.hide.animation=b.animation)),d={view:a,mod:new A,state:E.QUEUED,callback:c,transferables:[],wait:b?b.wait:void 0},d.node=new B(d.mod),d.node.add(a),t.call(this,d,b,c),d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),this._renderables.views.push(d.node),this._viewStack.push(d),u.call(this),this)},d.prototype.hide=function(a,b){v.call(this);var c=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return c&&c.state!==E.HIDING?(c.hide=!0,a&&(c.options.hide.transition=(a.hide?a.hide.transition:void 0)||a.transition||c.options.hide.transition,a&&a.hide&&void 0!==a.hide.animation?c.options.hide.animation=a.hide.animation:a&&void 0!==a.animation&&(c.options.hide.animation=a.animation)),c.hideCallback=function(){c.hideCallback=void 0,c.state=E.HIDDEN,u.call(this),this.layout.reflowLayout(),b&&b()}.bind(this),u.call(this),this):this},d.prototype.halt=function(a,b){for(var c,d=0;d<this._viewStack.length;d++)if(a)switch(c=this._viewStack[d],c.state){case E.SHOW:case E.SHOWING:case E.HIDE:case E.HIDING:case E.VISIBLE:q(c,b)}else{if(c=this._viewStack[this._viewStack.length-1],c.state!==E.QUEUED&&c.state!==E.SHOW)break;this._renderables.views.splice(this._viewStack.length-1,1),this._viewStack.splice(this._viewStack.length-1,1),c.view=void 0}return this},d.prototype.abort=function(a){if(this._viewStack.length>=2&&this._viewStack[0].state===E.HIDING&&this._viewStack[1].state===E.SHOWING){var b,c=this._viewStack[0],d=this._viewStack[1];d.halted=!0,b=d.endSpec,d.endSpec=d.startSpec,d.startSpec=b,d.state=E.HIDING,d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=E.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=E.VISIBLE,u.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),v.call(this)}return this},d.prototype.get=function(){for(var a=0;a<this._viewStack.length;a++){var b=this._viewStack[a];if(b.state===E.VISIBLE||b.state===E.SHOW||b.state===E.SHOWING)return b.view}return void 0},d.prototype.getSize=function(){return this._size||this.options.size},b.exports=d},{"./LayoutController":5}],2:[function(a,b,c){function d(a){h.call(this,g.combineOptions(d.DEFAULT_OPTIONS,a)),this._thisScrollViewDelta=0,this._leadingScrollViewDelta=0,this._trailingScrollViewDelta=0}function e(a,b){a.state!==b&&(a.state=b,a.node&&a.node.setPullToRefreshStatus&&a.node.setPullToRefreshStatus(b))}function f(a){return this._pullToRefresh?this._pullToRefresh[a?1:0]:void 0}var g=a("./LayoutUtility"),h=a("./ScrollController"),i=a("./layouts/ListLayout"),j={HIDDEN:0,PULLING:1,ACTIVE:2,COMPLETED:3,HIDDING:4};d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.PullToRefreshState=j,d.Bounds=h.Bounds,d.PaginationMode=h.PaginationMode,d.DEFAULT_OPTIONS={layout:i,direction:void 0,paginated:!1,alignment:0,flow:!1,mouseMove:!1,useContainer:!1,visibleItemThresshold:.5,pullToRefreshHeader:void 0,pullToRefreshFooter:void 0,leadingScrollView:void 0,trailingScrollView:void 0},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),(a.pullToRefreshHeader||a.pullToRefreshFooter||this._pullToRefresh)&&(a.pullToRefreshHeader?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[0]||(this._pullToRefresh[0]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!1}),this._pullToRefresh[0].node=a.pullToRefreshHeader):!this.options.pullToRefreshHeader&&this._pullToRefresh&&(this._pullToRefresh[0]=void 0),a.pullToRefreshFooter?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[1]||(this._pullToRefresh[1]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!0}),this._pullToRefresh[1].node=a.pullToRefreshFooter):!this.options.pullToRefreshFooter&&this._pullToRefresh&&(this._pullToRefresh[1]=void 0),!this._pullToRefresh||this._pullToRefresh[0]||this._pullToRefresh[1]||(this._pullToRefresh=void 0)),this},d.prototype.sequenceFrom=function(a){return this.setDataSource(a)},d.prototype.getCurrentIndex=function(){var a=this.getFirstVisibleItem();return a?a.viewSequence.getIndex():-1},d.prototype.goToPage=function(a,b){var c=this._viewSequence;if(!c)return this;for(;c.getIndex()<a;)if(c=c.getNext(),!c)return this;for(;c.getIndex()>a;)if(c=c.getPrevious(),!c)return this;return this.goToRenderNode(c.get(),b),this},d.prototype.getOffset=function(){return this._scrollOffsetCache},d.prototype.getPosition=d.prototype.getOffset,d.prototype.getAbsolutePosition=function(){return-(this._scrollOffsetCache+this._scroll.groupStart)},d.prototype._postLayout=function(a,b){if(this._pullToRefresh){this.options.alignment&&(b+=a[this._direction]);for(var c,d,f,g=0;2>g;g++){var h=this._pullToRefresh[g];if(h){var i,k=h.node.getSize()[this._direction],l=h.node.getPullToRefreshSize?h.node.getPullToRefreshSize()[this._direction]:k;h.footer?(d=void 0===d?d=this._calcScrollHeight(!0):d,d=void 0===d?-1:d,i=d>=0?b+d:a[this._direction]+1,this.options.alignment||(c=void 0===c?this._calcScrollHeight(!1):c,c=void 0===c?-1:c,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-c+a[this._direction]))),i=-(i-a[this._direction])):(c=this._calcScrollHeight(!1),c=void 0===c?-1:c,i=c>=0?b-c:c,this.options.alignment&&(d=this._calcScrollHeight(!0),d=void 0===d?-1:d,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-a[this._direction]+d))));var m=Math.max(Math.min(i/l,1),0);switch(h.state){case j.HIDDEN:this._scroll.scrollForceCount&&(m>=1?e(h,j.ACTIVE):i>=.2&&e(h,j.PULLING));break;case j.PULLING:this._scroll.scrollForceCount&&m>=1?e(h,j.ACTIVE):.2>i&&e(h,j.HIDDEN);break;case j.ACTIVE:break;case j.COMPLETED:this._scroll.scrollForceCount||(i>=.2?e(h,j.HIDDING):e(h,j.HIDDEN));break;case j.HIDDING:.2>i&&e(h,j.HIDDEN)}if(h.state!==j.HIDDEN){var n,o={renderNode:h.node,prev:!h.footer,next:h.footer,index:h.footer?++this._nodes._contextState.nextGetIndex:--this._nodes._contextState.prevGetIndex};h.state===j.ACTIVE?n=k:this._scroll.scrollForceCount&&(n=Math.min(i,k));var p={size:[a[0],a[1]],translate:[0,0,-.001],scrollLength:n};p.size[this._direction]=Math.max(Math.min(i,l),0),p.translate[this._direction]=h.footer?a[this._direction]-k:0,this._nodes._context.set(o,p)}}}}},d.prototype.showPullToRefresh=function(a){var b=f.call(this,a);b&&(e(b,j.ACTIVE),this._scroll.scrollDirty=!0)},d.prototype.hidePullToRefresh=function(a){var b=f.call(this,a);return b&&b.state===j.ACTIVE&&(e(b,j.COMPLETED),this._scroll.scrollDirty=!0),this},d.prototype.isPullToRefreshVisible=function(a){var b=f.call(this,a);return b?b.state===j.ACTIVE:!1},d.prototype.applyScrollForce=function(a){var b=this.options.leadingScrollView,c=this.options.trailingScrollView;if(!b&&!c)return h.prototype.applyScrollForce.call(this,a);var d;return 0>a?(b&&(d=b.canScroll(a),this._leadingScrollViewDelta+=d,b.applyScrollForce(d),a-=d),c?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,c.applyScrollForce(a),this._trailingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)):(c&&(d=c.canScroll(a),c.applyScrollForce(d),this._trailingScrollViewDelta+=d,a-=d),b?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,b.applyScrollForce(a),this._leadingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)),this},d.prototype.updateScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.updateScrollForce.call(this,a,b);var e,f=b-a;return 0>f?(c&&(e=c.canScroll(f),c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+e),this._leadingScrollViewDelta+=e,f-=e),d&&f?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,this._trailingScrollViewDelta+=f,d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+f)):f&&(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)):(d&&(e=d.canScroll(f),d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+e),this._trailingScrollViewDelta+=e,f-=e),c?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+f),this._leadingScrollViewDelta+=f):(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)),this},d.prototype.releaseScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.releaseScrollForce.call(this,a,b);var e;return 0>a?(c&&(e=Math.max(this._leadingScrollViewDelta,a),this._leadingScrollViewDelta-=e,a-=e,c.releaseScrollForce(this._leadingScrollViewDelta,a?0:b)),d?(e=Math.max(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._trailingScrollViewDelta-=a,d.releaseScrollForce(this._trailingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?b:0))):(d&&(e=Math.min(this._trailingScrollViewDelta,a),this._trailingScrollViewDelta-=e,a-=e,d.releaseScrollForce(this._trailingScrollViewDelta,a?0:b)),c?(e=Math.min(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._leadingScrollViewDelta-=a,c.releaseScrollForce(this._leadingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,a?b:0))),this},d.prototype.commit=function(a){var b=h.prototype.commit.call(this,a);if(this._pullToRefresh)for(var c=0;2>c;c++){var d=this._pullToRefresh[c];d&&(d.state===j.ACTIVE&&d.prevState!==j.ACTIVE&&this._eventOutput.emit("refresh",{target:this,footer:d.footer}),d.prevState=d.state)}return b},b.exports=d},{"./LayoutUtility":8,"./ScrollController":10,"./layouts/ListLayout":18}],3:[function(a,b,c){function d(a,b){if(o.apply(this,arguments),this.options||(this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this._optionsManager=new i(this.options)),this._pe||(this._pe=new n,this._pe.sleep()),this._properties)for(var c in this._properties)this._properties[c].init=!1;else this._properties={};this._lockTransitionable?(this._lockTransitionable.halt(),this._lockTransitionable.reset(1)):this._lockTransitionable=new p(1),this._specModified=!0,this._initial=!0,this._spec.endState={},b&&this.setSpec(b)}function e(a,b,c,d){return a&&a.init?[a.enabled[0]?Math.round((a.curState.x+(a.endState.x-a.curState.x)*d)/c)*c:a.endState.x,a.enabled[1]?Math.round((a.curState.y+(a.endState.y-a.curState.y)*d)/c)*c:a.endState.y,a.enabled[2]?Math.round((a.curState.z+(a.endState.z-a.curState.z)*d)/c)*c:a.endState.z]:b}function f(a,b,c,d,e,f){if(a=a||this._properties[b],a&&a.init){a.invalidated=!0;var g=d;return void 0!==c?g=c:this._removing&&(g=a.particle.getPosition()),a.endState.x=g[0],a.endState.y=g.length>1?g[1]:0,a.endState.z=g.length>2?g[2]:0,void(e?(a.curState.x=a.endState.x,a.curState.y=a.endState.y,a.curState.z=a.endState.z,a.velocity.x=0,a.velocity.y=0,a.velocity.z=0):(a.endState.x!==a.curState.x||a.endState.y!==a.curState.y||a.endState.z!==a.curState.z)&&this._pe.wake())}var h=this._pe.isSleeping();a?(a.particle.setPosition(this._initial||e?c:d),a.endState.set(c)):(a={particle:new l({position:this._initial||e?c:d}),endState:new k(c)},a.curState=a.particle.position,a.velocity=a.particle.velocity,a.force=new m(this.options.spring),a.force.setOptions({anchor:a.endState}),this._pe.addBody(a.particle),a.forceId=this._pe.attach(a.force,a.particle),this._properties[b]=a),this._initial||e?h&&this._pe.sleep():this._pe.wake(),this.options.properties[b]&&this.options.properties[b].length?a.enabled=this.options.properties[b]:a.enabled=[this.options.properties[b],this.options.properties[b],this.options.properties[b]],a.init=!0,a.invalidated=!0}function g(a,b){return a[0]===b[0]&&a[1]===b[1]?void 0:a}function h(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]?void 0:a}var i=window.famous.core.OptionsManager,j=window.famous.core.Transform,k=window.famous.math.Vector,l=window.famous.physics.bodies.Particle,m=window.famous.physics.forces.Spring,n=window.famous.physics.PhysicsEngine,o=a("./LayoutNode"),p=window.famous.transitions.Transitionable;d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.DEFAULT_OPTIONS={spring:{dampingRatio:.8,period:300},properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},particleRounding:.001};var q={opacity:1,opacity2D:[1,0],size:[0,0],origin:[0,0],align:[0,0],scale:[1,1,1],translate:[0,0,0],rotate:[0,0,0],skew:[0,0,0]};d.prototype.setOptions=function(a){this._optionsManager.setOptions(a);var b=this._pe.isSleeping();for(var c in this._properties){var d=this._properties[c];a.spring&&d.force&&d.force.setOptions(this.options.spring),a.properties&&void 0!==a.properties[c]&&(this.options.properties[c].length?d.enabled=this.options.properties[c]:d.enabled=[this.options.properties[c],this.options.properties[c],this.options.properties[c]])}return b&&this._pe.sleep(),this},d.prototype.setSpec=function(a){var b;a.transform&&(b=j.interpret(a.transform)),b||(b={}),b.opacity=a.opacity,b.size=a.size,b.align=a.align,b.origin=a.origin;var c=this._removing,d=this._invalidated;this.set(b),this._removing=c,this._invalidated=d},d.prototype.reset=function(){if(this._invalidated){for(var a in this._properties)this._properties[a].invalidated=!1;this._invalidated=!1}this.trueSizeRequested=!1,this.usesTrueSize=!1},d.prototype.remove=function(a){this._removing=!0,a?this.setSpec(a):(this._pe.sleep(),this._specModified=!1),this._invalidated=!1},d.prototype.releaseLock=function(a){this._lockTransitionable.halt(),this._lockTransitionable.reset(0),a&&this._lockTransitionable.set(1,{duration:this.options.spring.period||1e3})},d.prototype.getSpec=function(){var a=this._pe.isSleeping();if(!this._specModified&&a)return this._spec.removed=!this._invalidated,this._spec;this._initial=!1,this._specModified=!a,this._spec.removed=!1,a||this._pe.step();var b=this._spec,c=this.options.particleRounding,d=this._lockTransitionable.get(),f=this._properties.opacity;f&&f.init?(b.opacity=f.enabled[0]?Math.round(Math.max(0,Math.min(1,f.curState.x))/c)*c:f.endState.x,b.endState.opacity=f.endState.x):(b.opacity=void 0,b.endState.opacity=void 0),f=this._properties.size,f&&f.init?(b.size=b.size||[0,0],b.size[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.size[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.size=b.endState.size||[0,0],b.endState.size[0]=f.endState.x,b.endState.size[1]=f.endState.y):(b.size=void 0,b.endState.size=void 0),f=this._properties.align,f&&f.init?(b.align=b.align||[0,0],b.align[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.align[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.align=b.endState.align||[0,0],b.endState.align[0]=f.endState.x,b.endState.align[1]=f.endState.y):(b.align=void 0,b.endState.align=void 0),f=this._properties.origin,f&&f.init?(b.origin=b.origin||[0,0],b.origin[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.origin[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.origin=b.endState.origin||[0,0],b.endState.origin[0]=f.endState.x,b.endState.origin[1]=f.endState.y):(b.origin=void 0,b.endState.origin=void 0);var g,h,i,k=this._properties.translate;k&&k.init?(g=k.enabled[0]?Math.round((k.curState.x+(k.endState.x-k.curState.x)*d)/c)*c:k.endState.x,h=k.enabled[1]?Math.round((k.curState.y+(k.endState.y-k.curState.y)*d)/c)*c:k.endState.y,i=k.enabled[2]?Math.round((k.curState.z+(k.endState.z-k.curState.z)*d)/c)*c:k.endState.z):(g=0,h=0,i=0);var l=this._properties.scale,m=this._properties.skew,n=this._properties.rotate;return l||m||n?(b.transform=j.build({translate:[g,h,i],skew:e.call(this,m,q.skew,this.options.particleRounding,d),scale:e.call(this,l,q.scale,this.options.particleRounding,d),rotate:e.call(this,n,q.rotate,this.options.particleRounding,d)}),b.endState.transform=j.build({translate:k?[k.endState.x,k.endState.y,k.endState.z]:q.translate,scale:l?[l.endState.x,l.endState.y,l.endState.z]:q.scale,skew:m?[m.endState.x,m.endState.y,m.endState.z]:q.skew,rotate:n?[n.endState.x,n.endState.y,n.endState.z]:q.rotate})):k?(b.transform?(b.transform[12]=g,b.transform[13]=h,b.transform[14]=i):b.transform=j.translate(g,h,i),b.endState.transform?(b.endState.transform[12]=k.endState.x,b.endState.transform[13]=k.endState.y,b.endState.transform[14]=k.endState.z):b.endState.transform=j.translate(k.endState.x,k.endState.y,k.endState.z)):(b.transform=void 0,b.endState.transform=void 0),this._spec},d.prototype.set=function(a,b){b&&(this._removing=!1),this._invalidated=!0,this.scrollLength=a.scrollLength,this._specModified=!0;var c=this._properties.opacity,d=a.opacity===q.opacity?void 0:a.opacity;(void 0!==d||c&&c.init)&&f.call(this,c,"opacity",void 0===d?void 0:[d,0],q.opacity2D),c=this._properties.align,d=a.align?g(a.align,q.align):void 0,(d||c&&c.init)&&f.call(this,c,"align",d,q.align),c=this._properties.origin,d=a.origin?g(a.origin,q.origin):void 0,(d||c&&c.init)&&f.call(this,c,"origin",d,q.origin),c=this._properties.size,d=a.size||b,(d||c&&c.init)&&f.call(this,c,"size",d,b,this.usesTrueSize),c=this._properties.translate,d=a.translate,(d||c&&c.init)&&f.call(this,c,"translate",d,q.translate,void 0,!0),c=this._properties.scale,d=a.scale?h(a.scale,q.scale):void 0,(d||c&&c.init)&&f.call(this,c,"scale",d,q.scale),c=this._properties.rotate,d=a.rotate?h(a.rotate,q.rotate):void 0,(d||c&&c.init)&&f.call(this,c,"rotate",d,q.rotate),c=this._properties.skew,d=a.skew?h(a.skew,q.skew):void 0,(d||c&&c.init)&&f.call(this,c,"skew",d,q.skew)},b.exports=d},{"./LayoutNode":6}],4:[function(a,b,c){function d(a){for(var b in a)this[b]=a[b]}d.prototype.size=void 0,d.prototype.direction=void 0,d.prototype.scrollOffset=void 0,d.prototype.scrollStart=void 0,d.prototype.scrollEnd=void 0,d.prototype.next=function(){},d.prototype.prev=function(){},d.prototype.get=function(a){},d.prototype.set=function(a,b){},d.prototype.resolveSize=function(a){},b.exports=d},{}],5:[function(a,b,c){function d(a,b){this.id=j.register(this),this._isDirty=!0,this._contextSizeCache=[0,0],this._commitOutput={},this._cleanupRegistration={commit:function(){return void 0},cleanup:function(a){this.cleanup(a)}.bind(this)},this._cleanupRegistration.target=j.register(this._cleanupRegistration),this._cleanupRegistration.render=function(){return this.target}.bind(this._cleanupRegistration),this._eventInput=new n,n.setInputHandler(this,this._eventInput),this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput),this._layout={options:Object.create({})},this._layout.optionsManager=new m(this._layout.options),this._layout.optionsManager.on("change",function(){this._isDirty=!0}.bind(this)),this.options=Object.create(d.DEFAULT_OPTIONS),this._optionsManager=new m(this.options),b?this._nodes=b:a&&a.flow?this._nodes=new p(r,e.bind(this)):this._nodes=new p(q),this.setDirection(void 0),a&&this.setOptions(a)}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(a){if(this._nodesById)for(var b in this._nodesById)a(this._nodesById[b]);else for(var c=this._viewSequence.getHead();c;){var d=c.get();d&&a(d),c=c.getNext()}}function g(a){if(this._layout.capabilities&&this._layout.capabilities.direction){if(Array.isArray(this._layout.capabilities.direction)){for(var b=0;b<this._layout.capabilities.direction.length;b++)if(this._layout.capabilities.direction[b]===a)return a;return this._layout.capabilities.direction[0]}return this._layout.capabilities.direction}return void 0===a?i.Direction.Y:a}function h(a,b){if(this._viewSequence.getAtIndex)return this._viewSequence.getAtIndex(a,b);var c=b||this._viewSequence,d=c?c.getIndex():a;if(a>d)for(;c;){if(c=c.getNext(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(d>a)return void 0}else if(d>a)for(;c;){if(c=c.getPrevious(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(a>d)return void 0}return c}var i=window.famous.utilities.Utility,j=window.famous.core.Entity,k=window.famous.core.ViewSequence,l=a("./LinkedListViewSequence"),m=window.famous.core.OptionsManager,n=window.famous.core.EventHandler,o=a("./LayoutUtility"),p=a("./LayoutNodeManager"),q=a("./LayoutNode"),r=a("./FlowLayoutNode"),s=window.famous.core.Transform;a("./helpers/LayoutDockHelper"),d.DEFAULT_OPTIONS={flow:!1,flowOptions:{reflowOnResize:!0,properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},spring:{dampingRatio:.8,period:300}}},d.prototype.setOptions=function(a){return void 0!==a.alignment&&a.alignment!==this.options.alignment&&(this._isDirty=!0),this._optionsManager.setOptions(a),a.nodeSpring&&(console.warn("nodeSpring options have been moved inside `flowOptions`. Use `flowOptions.spring` instead."),this._optionsManager.setOptions({flowOptions:{spring:a.nodeSpring}}),this._nodes.setNodeOptions(this.options.flowOptions)),
+void 0!==a.reflowOnResize&&(console.warn("reflowOnResize options have been moved inside `flowOptions`. Use `flowOptions.reflowOnResize` instead."),this._optionsManager.setOptions({flowOptions:{reflowOnResize:a.reflowOnResize}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.insertSpec&&(console.warn("insertSpec options have been moved inside `flowOptions`. Use `flowOptions.insertSpec` instead."),this._optionsManager.setOptions({flowOptions:{insertSpec:a.insertSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.removeSpec&&(console.warn("removeSpec options have been moved inside `flowOptions`. Use `flowOptions.removeSpec` instead."),this._optionsManager.setOptions({flowOptions:{removeSpec:a.removeSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.dataSource&&this.setDataSource(a.dataSource),a.layout?this.setLayout(a.layout,a.layoutOptions):a.layoutOptions&&this.setLayoutOptions(a.layoutOptions),void 0!==a.direction&&this.setDirection(a.direction),a.flowOptions&&this.options.flow&&this._nodes.setNodeOptions(this.options.flowOptions),a.preallocateNodes&&this._nodes.preallocateNodes(a.preallocateNodes.count||0,a.preallocateNodes.spec),this},d.prototype.setDataSource=function(a){return this._dataSource=a,this._nodesById=void 0,a instanceof k?(console.warn("The stock famo.us ViewSequence is no longer supported as it is too buggy"),console.warn("It has been automatically converted to the safe LinkedListViewSequence."),console.warn("Please refactor your code by using LinkedListViewSequence."),this._dataSource=new l(a._.array),this._viewSequence=this._dataSource):a instanceof Array?this._viewSequence=new l(a):a instanceof l?this._viewSequence=a:a.getNext?this._viewSequence=a:a instanceof Object&&(this._nodesById=a),this.options.autoPipeEvents&&(this._dataSource.pipe?(this._dataSource.pipe(this),this._dataSource.pipe(this._eventOutput)):f.call(this,function(a){a&&a.pipe&&(a.pipe(this),a.pipe(this._eventOutput))}.bind(this))),this._isDirty=!0,this},d.prototype.getDataSource=function(){return this._dataSource},d.prototype.setLayout=function(a,b){if(a instanceof Function)this._layout._function=a,this._layout.capabilities=a.Capabilities,this._layout.literal=void 0;else if(a instanceof Object){this._layout.literal=a,this._layout.capabilities=void 0;var c=Object.keys(a)[0],d=o.getRegisteredHelper(c);this._layout._function=d?function(b,e){var f=new d(b,e);f.parse(a[c])}:void 0}else this._layout._function=void 0,this._layout.capabilities=void 0,this._layout.literal=void 0;return b&&this.setLayoutOptions(b),this.setDirection(this._configuredDirection),this._isDirty=!0,this},d.prototype.getLayout=function(){return this._layout.literal||this._layout._function},d.prototype.setLayoutOptions=function(a){return this._layout.optionsManager.setOptions(a),this},d.prototype.getLayoutOptions=function(){return this._layout.options},d.prototype.setDirection=function(a){this._configuredDirection=a;var b=g.call(this,a);b!==this._direction&&(this._direction=b,this._isDirty=!0)},d.prototype.getDirection=function(a){return a?this._direction:this._configuredDirection},d.prototype.getSpec=function(a,b,c){if(!a)return void 0;if(a instanceof String||"string"==typeof a){if(!this._nodesById)return void 0;if(a=this._nodesById[a],!a)return void 0;if(a instanceof Array)return a}if(this._specs)for(var d=0;d<this._specs.length;d++){var e=this._specs[d];if(e.renderNode===a){if(c&&e.endState&&(e=e.endState),b&&e.transform&&e.size&&(e.align||e.origin)){var f=e.transform;return e.align&&(e.align[0]||e.align[1])&&(f=s.thenMove(f,[e.align[0]*this._contextSizeCache[0],e.align[1]*this._contextSizeCache[1],0])),e.origin&&(e.origin[0]||e.origin[1])&&(f=s.moveThen([-e.origin[0]*e.size[0],-e.origin[1]*e.size[1],0],f)),{opacity:e.opacity,size:e.size,transform:f}}return e}}return void 0},d.prototype.reflowLayout=function(){return this._isDirty=!0,this},d.prototype.resetFlowState=function(){return this.options.flow&&(this._resetFlowState=!0),this},d.prototype.insert=function(a,b,c){if(a instanceof String||"string"==typeof a){if(void 0===this._dataSource&&(this._dataSource={},this._nodesById=this._dataSource),this._nodesById[a]===b)return this;this._nodesById[a]=b}else void 0===this._dataSource&&(this._dataSource=new l,this._viewSequence=this._dataSource),this._viewSequence.insert(a,b);return c&&this._nodes.insertNode(this._nodes.createNode(b,c)),this.options.autoPipeEvents&&b&&b.pipe&&(b.pipe(this),b.pipe(this._eventOutput)),this._isDirty=!0,this},d.prototype.push=function(a,b){return this.insert(-1,a,b)},d.prototype.get=function(a){if(this._nodesById||a instanceof String||"string"==typeof a)return this._nodesById?this._nodesById[a]:void 0;var b=h.call(this,a);return b?b.get():void 0},d.prototype.swap=function(a,b){return this._viewSequence.swap(a,b),this._isDirty=!0,this},d.prototype.replace=function(a,b,c){var d;if(this._nodesById||a instanceof String||"string"==typeof a){if(d=this._nodesById[a],d!==b){if(c&&d){var e=this._nodes.getNodeByRenderNode(d);e&&e.setRenderNode(b)}this._nodesById[a]=b,this._isDirty=!0}return d}var f=this._viewSequence.findByIndex(a);if(!f)throw"Invalid index ("+a+") specified to .replace";return d=f.get(),f.set(b),d!==b&&(this._isDirty=!0),d},d.prototype.move=function(a,b){var c=this._viewSequence.findByIndex(a);if(!c)throw"Invalid index ("+a+") specified to .move";return this._viewSequence=this._viewSequence.remove(c),this._viewSequence.insert(b,c.get()),this._isDirty=!0,this},d.prototype.remove=function(a,b){var c;if(this._nodesById||a instanceof String||"string"==typeof a){if(a instanceof String||"string"==typeof a)c=this._nodesById[a],c&&delete this._nodesById[a];else for(var d in this._nodesById)if(this._nodesById[d]===a){delete this._nodesById[d],c=a;break}}else{var e;e=a instanceof Number||"number"==typeof a?this._viewSequence.findByIndex(a):this._viewSequence.findByValue(a),e&&(c=e.get(),this._viewSequence=this._viewSequence.remove(e))}if(c&&b){var f=this._nodes.getNodeByRenderNode(c);f&&f.remove(b||this.options.flowOptions.removeSpec)}return c&&(this._isDirty=!0),c},d.prototype.removeAll=function(a){if(this._nodesById){var b=!1;for(var c in this._nodesById)delete this._nodesById[c],b=!0;b&&(this._isDirty=!0)}else this._viewSequence&&(this._viewSequence=this._viewSequence.clear());if(a)for(var d=this._nodes.getStartEnumNode();d;)d.remove(a||this.options.flowOptions.removeSpec),d=d._next;return this},d.prototype.getSize=function(){return this._size||this.options.size},d.prototype.render=function(){return this.id},d.prototype.commit=function(a){var b=a.transform,c=a.origin,d=a.size,e=a.opacity;if(this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll()),d[0]!==this._contextSizeCache[0]||d[1]!==this._contextSizeCache[1]||this._isDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout){var f={target:this,oldSize:this._contextSizeCache,size:d,dirty:this._isDirty,trueSizeRequested:this._nodes._trueSizeRequested};if(this._eventOutput.emit("layoutstart",f),this.options.flow){var g=!1;if(this.options.flowOptions.reflowOnResize||(g=this._isDirty||d[0]===this._contextSizeCache[0]&&d[1]===this._contextSizeCache[1]?!0:void 0),void 0!==g)for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(g),h=h._next}this._contextSizeCache[0]=d[0],this._contextSizeCache[1]=d[1],this._isDirty=!1;var i;this.options.size&&this.options.size[this._direction]===!0&&(i=1e6);var j=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:d,direction:this._direction,scrollEnd:i});if(this._layout._function&&this._layout._function(j,this._layout.options),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),this._nodes.removeVirtualViewSequenceNodes(),i){for(i=0,h=this._nodes.getStartEnumNode();h;)h._invalidated&&h.scrollLength&&(i+=h.scrollLength),h=h._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}var k=this._nodes.buildSpecAndDestroyUnrenderedNodes();this._specs=k.specs,this._commitOutput.target=k.specs,this._eventOutput.emit("layoutend",f),this._eventOutput.emit("reflow",{target:this})}else this.options.flow&&(k=this._nodes.buildSpecAndDestroyUnrenderedNodes(),this._specs=k.specs,this._commitOutput.target=k.specs,k.modified&&this._eventOutput.emit("reflow",{target:this}));for(var l=this._commitOutput.target,m=0,n=l.length;n>m;m++)l[m].renderNode&&(l[m].target=l[m].renderNode.render());return l.length&&l[l.length-1]===this._cleanupRegistration||l.push(this._cleanupRegistration),!c||0===c[0]&&0===c[1]||(b=s.moveThen([-d[0]*c[0],-d[1]*c[1],0],b)),this._commitOutput.size=d,this._commitOutput.opacity=e,this._commitOutput.transform=b,this._commitOutput},d.prototype.cleanup=function(a){this.options.flow&&(this._resetFlowState=!0)},b.exports=d},{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./LinkedListViewSequence":9,"./helpers/LayoutDockHelper":12}],6:[function(a,b,c){function d(a,b){this.renderNode=a,this._spec=b?f.cloneSpec(b):{},this._spec.renderNode=a,this._specModified=!0,this._invalidated=!1,this._removing=!1}var e=window.famous.core.Transform,f=a("./LayoutUtility");d.prototype.setRenderNode=function(a){this.renderNode=a,this._spec.renderNode=a},d.prototype.setOptions=function(a){},d.prototype.destroy=function(){this.renderNode=void 0,this._spec.renderNode=void 0,this._viewSequence=void 0},d.prototype.reset=function(){this._invalidated=!1,this.trueSizeRequested=!1},d.prototype.setSpec=function(a){if(this._specModified=!0,a.align?(a.align||(this._spec.align=[0,0]),this._spec.align[0]=a.align[0],this._spec.align[1]=a.align[1]):this._spec.align=void 0,a.origin?(a.origin||(this._spec.origin=[0,0]),this._spec.origin[0]=a.origin[0],this._spec.origin[1]=a.origin[1]):this._spec.origin=void 0,a.size?(a.size||(this._spec.size=[0,0]),this._spec.size[0]=a.size[0],this._spec.size[1]=a.size[1]):this._spec.size=void 0,a.transform)if(a.transform)for(var b=0;16>b;b++)this._spec.transform[b]=a.transform[b];else this._spec.transform=a.transform.slice(0);else this._spec.transform=void 0;this._spec.opacity=a.opacity},d.prototype.set=function(a,b){this._invalidated=!0,this._specModified=!0,this._removing=!1;var c=this._spec;c.opacity=a.opacity,a.size?(c.size||(c.size=[0,0]),c.size[0]=a.size[0],c.size[1]=a.size[1]):c.size=void 0,a.origin?(c.origin||(c.origin=[0,0]),c.origin[0]=a.origin[0],c.origin[1]=a.origin[1]):c.origin=void 0,a.align?(c.align||(c.align=[0,0]),c.align[0]=a.align[0],c.align[1]=a.align[1]):c.align=void 0,a.skew||a.rotate||a.scale?this._spec.transform=e.build({translate:a.translate||[0,0,0],skew:a.skew||[0,0,0],scale:a.scale||[1,1,1],rotate:a.rotate||[0,0,0]}):a.translate?this._spec.transform=e.translate(a.translate[0],a.translate[1],a.translate[2]):this._spec.transform=void 0,this.scrollLength=a.scrollLength},d.prototype.getSpec=function(){return this._specModified=!1,this._spec.removed=!this._invalidated,this._spec},d.prototype.remove=function(a){this._removing=!0},b.exports=d},{"./LayoutUtility":8}],7:[function(a,b,c){function d(a,b){this.LayoutNode=a,this._initLayoutNodeFn=b,this._layoutCount=0,this._context=new m({next:g.bind(this),prev:h.bind(this),get:i.bind(this),set:j.bind(this),resolveSize:l.bind(this),size:[0,0]}),this._contextState={},this._pool={layoutNodes:{size:0},resolveSize:[0,0]}}function e(a){a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._first=a._next,a.destroy(),this._pool.layoutNodes.size<q&&(this._pool.layoutNodes.size++,a._prev=void 0,a._next=this._pool.layoutNodes.first,this._pool.layoutNodes.first=a)}function f(a,b){var c,d=this._contextState;if(!d.start){for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c||(c=this.createNode(a),c._next=this._first,this._first&&(this._first._prev=c),this._first=c),d.start=c,d.startPrev=b,d.prev=c,d.next=c,c}if(b){if(d.prev._prev&&d.prev._prev.renderNode===a)return d.prev=d.prev._prev,d.prev}else if(d.next._next&&d.next._next.renderNode===a)return d.next=d.next._next,d.next;for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c?(c._next&&(c._next._prev=c._prev),c._prev?c._prev._next=c._next:this._first=c._next,c._next=void 0,c._prev=void 0):c=this.createNode(a),b?(d.prev._prev?(c._prev=d.prev._prev,d.prev._prev._next=c):this._first=c,d.prev._prev=c,c._next=d.prev,d.prev=c):(d.next._next&&(c._next=d.next._next,d.next._next._prev=c),d.next._next=c,c._prev=d.next,d.next=c),c}function g(){if(!this._contextState.nextSequence)return void 0;if(this._context.reverse&&(this._contextState.nextSequence=this._contextState.nextSequence.getNext(),!this._contextState.nextSequence))return void 0;var a=this._contextState.nextSequence.get();if(!a)return void(this._contextState.nextSequence=void 0);var b=this._contextState.nextSequence;if(this._context.reverse||(this._contextState.nextSequence=this._contextState.nextSequence.getNext()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,next:!0,index:++this._contextState.nextGetIndex}}function h(){if(!this._contextState.prevSequence)return void 0;if(!this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious(),!this._contextState.prevSequence))return void 0;var a=this._contextState.prevSequence.get();if(!a)return void(this._contextState.prevSequence=void 0);var b=this._contextState.prevSequence;if(this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,prev:!0,index:--this._contextState.prevGetIndex}}function i(a){if(this._nodesById&&(a instanceof String||"string"==typeof a)){var b=this._nodesById[a];if(!b)return void 0;if(b instanceof Array){for(var c=[],d=0,e=b.length;e>d;d++)c.push({renderNode:b[d],arrayElement:!0});return c}return{renderNode:b,byId:!0}}return a}function j(a,b){var c=this._nodesById?i.call(this,a):a;if(c){var d=c.node;d||(c.next?(c.index<this._contextState.nextSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.nextSetIndex=c.index):c.prev&&(c.index>this._contextState.prevSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.prevSetIndex=c.index),d=f.call(this,c.renderNode,c.prev),d._viewSequence=c.viewSequence,d._layoutCount++,1===d._layoutCount&&this._contextState.addCount++,c.node=d),d.usesTrueSize=c.usesTrueSize,d.trueSizeRequested=c.trueSizeRequested,d.set(b,this._context.size),c.set=b}return b}function k(a){if(a instanceof p){var b=null,c=a.get();if(c&&(b=k(c)))return b;if(a._child)return k(a._child)}else{if(a instanceof o)return a.size?{renderNode:a,size:a.size}:void 0;if(a.options&&a.options.size)return{renderNode:a,size:a.options.size}}return void 0}function l(a,b){var c=this._nodesById?i.call(this,a):a,d=this._pool.resolveSize;if(!c)return d[0]=0,d[1]=0,d;var e=c.renderNode,f=e.getSize();if(!f)return b;var g=k(e);if(g&&(g.size[0]===!0||g.size[1]===!0))if(c.usesTrueSize=!0,g.renderNode instanceof o){var h=g.renderNode._backupSize;if((g.renderNode._contentDirty||g.renderNode._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),g.renderNode._trueSizeCheck&&h&&g.size!==f){var j=g.size[0]===!0?Math.max(h[0],f[0]):f[0],l=g.size[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=l,f=h,g.renderNode._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(g.renderNode._trueSizeCheck=!0,g.renderNode._sizeDirty=!0,this._trueSizeRequested=!0),h||(g.renderNode._backupSize=[0,0],h=g.renderNode._backupSize),h[0]=f[0],h[1]=f[1]}else g.renderNode._nodes&&(this._reevalTrueSize||g.renderNode._nodes._trueSizeRequested)&&(c.trueSizeRequested=!0,this._trueSizeRequested=!0);return(void 0===f[0]||f[0]===!0||void 0===f[1]||f[1]===!0)&&(d[0]=f[0],d[1]=f[1],f=d,void 0===f[0]?f[0]=b[0]:f[0]===!0&&(f[0]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0),void 0===f[1]?f[1]=b[1]:f[1]===!0&&(f[1]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0)),f}var m=a("./LayoutContext"),n=a("./LayoutUtility"),o=window.famous.core.Surface,p=window.famous.core.RenderNode,q=100;d.prototype.prepareForLayout=function(a,b,c){for(var d=this._first;d;)d.reset(),d=d._next;var e=this._context;this._layoutCount++,this._nodesById=b,this._trueSizeRequested=!1,this._reevalTrueSize=c.reevalTrueSize||!e.size||e.size[0]!==c.size[0]||e.size[1]!==c.size[1];var f=this._contextState;return f.startSequence=a,f.nextSequence=a,f.prevSequence=a,f.start=void 0,f.nextGetIndex=0,f.prevGetIndex=0,f.nextSetIndex=0,f.prevSetIndex=0,f.addCount=0,f.removeCount=0,f.lastRenderNode=void 0,e.size[0]=c.size[0],e.size[1]=c.size[1],e.direction=c.direction,e.reverse=c.reverse,e.alignment=c.reverse?1:0,e.scrollOffset=c.scrollOffset||0,e.scrollStart=c.scrollStart||0,e.scrollEnd=c.scrollEnd||e.size[e.direction],e},d.prototype.removeNonInvalidatedNodes=function(a){for(var b=this._first;b;)b._invalidated||b._removing||b.remove(a),b=b._next},d.prototype.removeVirtualViewSequenceNodes=function(){this._contextState.startSequence&&this._contextState.startSequence.cleanup&&this._contextState.startSequence.cleanup()},d.prototype.buildSpecAndDestroyUnrenderedNodes=function(a){for(var b=[],c={specs:b,modified:!1},d=this._first;d;){var f=d._specModified,g=d.getSpec();if(g.removed){var h=d;d=d._next,e.call(this,h),c.modified=!0}else f&&(g.transform&&a&&(g.transform[12]+=a[0],g.transform[13]+=a[1],g.transform[14]+=a[2],g.transform[12]=Math.round(1e5*g.transform[12])/1e5,g.transform[13]=Math.round(1e5*g.transform[13])/1e5,g.endState&&(g.endState.transform[12]+=a[0],g.endState.transform[13]+=a[1],g.endState.transform[14]+=a[2],g.endState.transform[12]=Math.round(1e5*g.endState.transform[12])/1e5,g.endState.transform[13]=Math.round(1e5*g.endState.transform[13])/1e5)),c.modified=!0),g.usesTrueSize=d.usesTrueSize,g.trueSizeRequested=d.trueSizeRequested,b.push(g),d=d._next}return this._contextState.addCount=0,this._contextState.removeCount=0,c},d.prototype.getNodeByRenderNode=function(a){for(var b=this._first;b;){if(b.renderNode===a)return b;b=b._next}return void 0},d.prototype.insertNode=function(a){a._next=this._first,this._first&&(this._first._prev=a),this._first=a},d.prototype.setNodeOptions=function(a){this._nodeOptions=a;for(var b=this._first;b;)b.setOptions(a),b=b._next;for(b=this._pool.layoutNodes.first;b;)b.setOptions(a),b=b._next},d.prototype.preallocateNodes=function(a,b){for(var c=[],d=0;a>d;d++)c.push(this.createNode(void 0,b));for(d=0;a>d;d++)e.call(this,c[d])},d.prototype.createNode=function(a,b){var c;return this._pool.layoutNodes.first?(c=this._pool.layoutNodes.first,this._pool.layoutNodes.first=c._next,this._pool.layoutNodes.size--,c.constructor.apply(c,arguments)):(c=new this.LayoutNode(a,b),this._nodeOptions&&c.setOptions(this._nodeOptions)),c._prev=void 0,c._next=void 0,c._viewSequence=void 0,c._layoutCount=0,this._initLayoutNodeFn&&this._initLayoutNodeFn.call(this,c,b),c},d.prototype.removeAll=function(){for(var a=this._first;a;){var b=a._next;e.call(this,a),a=b}this._first=void 0},d.prototype.getStartEnumNode=function(a){return void 0===a?this._first:a===!0?this._contextState.start&&this._contextState.startPrev?this._contextState.start._next:this._contextState.start:a===!1?this._contextState.start&&!this._contextState.startPrev?this._contextState.start._prev:this._contextState.start:void 0},b.exports=d},{"./LayoutContext":4,"./LayoutUtility":8}],8:[function(a,b,c){function d(){}function e(a,b){if(a===b)return!0;if(void 0===a||void 0===b)return!1;var c=a.length;if(c!==b.length)return!1;for(;c--;)if(a[c]!==b[c])return!1;return!0}var f=window.famous.utilities.Utility;d.registeredHelpers={};var g={SEQUENCE:1,DIRECTION_X:2,DIRECTION_Y:4,SCROLLING:8};d.Capabilities=g,d.normalizeMargins=function(a){return a?Array.isArray(a)?0===a.length?[0,0,0,0]:1===a.length?[a[0],a[0],a[0],a[0]]:2===a.length?[a[0],a[1],a[0],a[1]]:a:[a,a,a,a]:[0,0,0,0]},d.cloneSpec=function(a){var b={};return void 0!==a.opacity&&(b.opacity=a.opacity),void 0!==a.size&&(b.size=a.size.slice(0)),void 0!==a.transform&&(b.transform=a.transform.slice(0)),void 0!==a.origin&&(b.origin=a.origin.slice(0)),void 0!==a.align&&(b.align=a.align.slice(0)),b},d.isEqualSpec=function(a,b){return a.opacity!==b.opacity?!1:e(a.size,b.size)&&e(a.transform,b.transform)&&e(a.origin,b.origin)&&e(a.align,b.align)?!0:!1},d.getSpecDiffText=function(a,b){var c="spec diff:";return a.opacity!==b.opacity&&(c+="\nopacity: "+a.opacity+" != "+b.opacity),e(a.size,b.size)||(c+="\nsize: "+JSON.stringify(a.size)+" != "+JSON.stringify(b.size)),e(a.transform,b.transform)||(c+="\ntransform: "+JSON.stringify(a.transform)+" != "+JSON.stringify(b.transform)),e(a.origin,b.origin)||(c+="\norigin: "+JSON.stringify(a.origin)+" != "+JSON.stringify(b.origin)),e(a.align,b.align)||(c+="\nalign: "+JSON.stringify(a.align)+" != "+JSON.stringify(b.align)),c},d.error=function(a){throw console.log("ERROR: "+a),a},d.warning=function(a){console.log("WARNING: "+a)},d.log=function(a){for(var b="",c=0;c<arguments.length;c++){var d=arguments[c];b+=d instanceof Object||d instanceof Array?JSON.stringify(d):d}console.log(b)},d.combineOptions=function(a,b,c){if(a&&!b&&!c)return a;if(!a&&b&&!c)return b;var d=f.clone(a||{});if(b)for(var e in b)d[e]=b[e];return d},d.registerHelper=function(a,b){b.prototype.parse||d.error('The layout-helper for name "'+a+'" is required to support the "parse" method'),void 0!==this.registeredHelpers[a]&&d.warning('A layout-helper with the name "'+a+'" is already registered and will be overwritten'),this.registeredHelpers[a]=b},d.unregisterHelper=function(a){delete this.registeredHelpers[a]},d.getRegisteredHelper=function(a){return this.registeredHelpers[a]},b.exports=d},{}],9:[function(a,b,c){function d(a){if(Array.isArray(a)){this._=new this.constructor.Backing(this);for(var b=0;b<a.length;b++)this.push(a[b])}else this._=a||new this.constructor.Backing(this)}d.Backing=function(){this.length=0},d.prototype.getHead=function(){return this._.head},d.prototype.getTail=function(){return this._.tail},d.prototype.getPrevious=function(){return this._prev},d.prototype.getNext=function(){return this._next},d.prototype.get=function(){return this._value},d.prototype.set=function(a){return this._value=a,this},d.prototype.getIndex=function(){return this._value?this.indexOf(this._value):0},d.prototype.toString=function(){return""+this.getIndex()},d.prototype.indexOf=function(a){for(var b=this._.head,c=0;b;){if(b._value===a)return c;c++,b=b._next}return-1},d.prototype.findByIndex=function(a){if(a=-1===a?this._.length-1:a,0>a||a>=this._.length)return void 0;var b,c;if(a>this._.length/2)for(c=this._.tail,b=this._.length-1;b>a;)c=c._prev,b--;else for(c=this._.head,b=0;a>b;)c=c._next,b++;return c},d.prototype.findByValue=function(a){for(var b=this._.head;b;){if(b.get()===a)return b;b=b._next}return void 0},d.prototype.insert=function(a,b){if(a=-1===a?this._.length:a,!this._.length)return assert(0===a,"inserting in empty view-sequence, but not at index 0 (but "+a+" instead)"),this._value=b,this._.head=this,this._.tail=this,this._.length=1,this;var c;if(0===a)c=new d(this._),c._value=b,c._next=this._.head,this._.head._prev=c,this._.head=c;else if(a===this._.length)c=new d(this._),c._value=b,c._prev=this._.tail,this._.tail._next=c,this._.tail=c;else{var e,f;if(assert(a>0&&a<this._.length,"invalid insert index: "+a+" (length: "+this._.length+")"),a>this._.length/2)for(f=this._.tail,e=this._.length-1;e>=a;)f=f._prev,e--;else for(f=this._.head,e=1;a>e;)f=f._next,e++;c=new d(this._),c._value=b,c._prev=f,c._next=f._next,f._next._prev=c,f._next=c}return this._.length++,c},d.prototype.remove=function(a){return a._prev&&a._next?(a._prev._next=a._next,a._next._prev=a._prev,this._.length--,a===this?a._prev:this):a._prev||a._next?a._prev?(assert(!a._next,"next should be empty"),assert(this._.tail===a,"tail is invalid"),a._prev._next=void 0,this._.tail=a._prev,this._.length--,a===this?this._.tail:this):(assert(this._.head===a,"head is invalid"),a._next._prev=void 0,this._.head=a._next,this._.length--,a===this?this._.head:this):(assert(a===this,"only one sequence exists, should be this one"),assert(this._value,"last node should have a value"),assert(this._.head,"head is invalid"),assert(this._.tail,"tail is invalid"),assert(1===this._.length,"length should be 1"),this._value=void 0,this._.head=void 0,this._.tail=void 0,this._.length--,this)},d.prototype.getLength=function(){return this._.length},d.prototype.clear=function(){for(var a=this;this._.length;)a=a.remove(this._.tail);return a},d.prototype.unshift=function(a){return this.insert(0,a)},d.prototype.push=function(a){return this.insert(-1,a)},d.prototype.splice=function(a,b,c){console.error&&console.error("LinkedListViewSequence.splice is not supported")},d.prototype.swap=function(a,b){var c=this.findByIndex(a);if(!c)throw new Error("Invalid first index specified to swap: "+a);var d=this.findByIndex(b);if(!d)throw new Error("Invalid second index specified to swap: "+b);var e=c._value;return c._value=d._value,d._value=e,this},b.exports=d},{}],10:[function(a,b,c){function d(a){a=D.combineOptions(d.DEFAULT_OPTIONS,a);var b=new H(a.flow?G:F,e.bind(this));E.call(this,a,b),this._scroll={activeTouches:[],pe:new N(this.options.scrollPhysicsEngine),particle:new O(this.options.scrollParticle),dragForce:new P(this.options.scrollDrag),frictionForce:new P(this.options.scrollFriction),springValue:void 0,springForce:new Q(this.options.scrollSpring),springEndState:new M([0,0,0]),groupStart:0,groupTranslate:[0,0,0],scrollDelta:0,normalizedScrollDelta:0,scrollForce:0,scrollForceCount:0,unnormalizedScrollOffset:0,isScrolling:!1},this._debug={layoutCount:0,commitCount:0},this.group=new L,this.group.add({render:C.bind(this)}),this._scroll.pe.addBody(this._scroll.particle),this.options.scrollDrag.disabled||(this._scroll.dragForceId=this._scroll.pe.attach(this._scroll.dragForce,this._scroll.particle)),this.options.scrollFriction.disabled||(this._scroll.frictionForceId=this._scroll.pe.attach(this._scroll.frictionForce,this._scroll.particle)),this._scroll.springForce.setOptions({anchor:this._scroll.springEndState}),this._eventInput.on("touchstart",l.bind(this)),this._eventInput.on("touchmove",m.bind(this)),this._eventInput.on("touchend",n.bind(this)),this._eventInput.on("touchcancel",n.bind(this)),this._eventInput.on("mousedown",i.bind(this)),this._eventInput.on("mouseup",k.bind(this)),this._eventInput.on("mousemove",j.bind(this)),this._scrollSync=new R(this.options.scrollSync),this._eventInput.pipe(this._scrollSync),this._scrollSync.on("update",o.bind(this)),this.options.useContainer&&(this.container=new I(this.options.container),this.container.add({render:function(){return this.id}.bind(this)}),this.options.autoPipeEvents||(this.subscribe(this.container),K.setInputHandler(this.container,this),K.setOutputHandler(this.container,this)))}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(){return!this._layout.capabilities||void 0===this._layout.capabilities.sequentialScrollingOptimized||this._layout.capabilities.sequentialScrollingOptimized}function g(){var a=this._scroll.scrollForceCount?void 0:this._scroll.springPosition;this._scroll.springValue!==a&&(this._scroll.springValue=a,void 0===a?void 0!==this._scroll.springForceId&&(this._scroll.pe.detach(this._scroll.springForceId),this._scroll.springForceId=void 0):(void 0===this._scroll.springForceId&&(this._scroll.springForceId=this._scroll.pe.attach(this._scroll.springForce,this._scroll.particle)),this._scroll.springEndState.set1D(a),this._scroll.pe.wake()))}function h(a){return a.timeStamp||Date.now()}function i(a){if(this.options.mouseMove){this._scroll.mouseMove&&this.releaseScrollForce(this._scroll.mouseMove.delta);var b=[a.clientX,a.clientY],c=h(a);this._scroll.mouseMove={delta:0,start:b,current:b,prev:b,time:c,prevTime:c},this.applyScrollForce(this._scroll.mouseMove.delta)}}function j(a){if(this._scroll.mouseMove&&this.options.enabled){var b=Math.atan2(Math.abs(a.clientY-this._scroll.mouseMove.prev[1]),Math.abs(a.clientX-this._scroll.mouseMove.prev[0]))/(Math.PI/2),c=Math.abs(this._direction-b);(void 0===this.options.touchMoveDirectionThreshold||c<=this.options.touchMoveDirectionThreshold)&&(this._scroll.mouseMove.prev=this._scroll.mouseMove.current,this._scroll.mouseMove.current=[a.clientX,a.clientY],this._scroll.mouseMove.prevTime=this._scroll.mouseMove.time,this._scroll.mouseMove.direction=b,this._scroll.mouseMove.time=h(a));var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.start[this._direction];this.updateScrollForce(this._scroll.mouseMove.delta,d),this._scroll.mouseMove.delta=d}}function k(a){if(this._scroll.mouseMove){var b=0,c=this._scroll.mouseMove.time-this._scroll.mouseMove.prevTime;if(c>0&&h(a)-this._scroll.mouseMove.time<=this.options.touchMoveNoVelocityDuration){var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.prev[this._direction];b=d/c}this.releaseScrollForce(this._scroll.mouseMove.delta,b),this._scroll.mouseMove=void 0}}function l(a){this._touchEndEventListener||(this._touchEndEventListener=function(a){a.target.removeEventListener("touchend",this._touchEndEventListener),n.call(this,a)}.bind(this));for(var b,c,d=this._scroll.activeTouches.length,e=0;e<this._scroll.activeTouches.length;){var f=this._scroll.activeTouches[e];for(c=!1,b=0;b<a.touches.length;b++){var g=a.touches[b];if(g.identifier===f.id){c=!0;break}}c?e++:this._scroll.activeTouches.splice(e,1)}for(e=0;e<a.touches.length;e++){var i=a.touches[e];for(c=!1,b=0;b<this._scroll.activeTouches.length;b++)if(this._scroll.activeTouches[b].id===i.identifier){c=!0;break}if(!c){var j=[i.clientX,i.clientY],k=h(a);this._scroll.activeTouches.push({id:i.identifier,start:j,current:j,prev:j,time:k,prevTime:k}),i.target.addEventListener("touchend",this._touchEndEventListener)}}!d&&this._scroll.activeTouches.length&&(this.applyScrollForce(0),this._scroll.touchDelta=0)}function m(a){if(this.options.enabled){for(var b,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){var g=Math.atan2(Math.abs(d.clientY-f.prev[1]),Math.abs(d.clientX-f.prev[0]))/(Math.PI/2),i=Math.abs(this._direction-g);(void 0===this.options.touchMoveDirectionThreshold||i<=this.options.touchMoveDirectionThreshold)&&(f.prev=f.current,f.current=[d.clientX,d.clientY],f.prevTime=f.time,f.direction=g,f.time=h(a),b=0===e?f:void 0)}}if(b){var j=b.current[this._direction]-b.start[this._direction];this.updateScrollForce(this._scroll.touchDelta,j),this._scroll.touchDelta=j}}}function n(a){for(var b=this._scroll.activeTouches.length?this._scroll.activeTouches[0]:void 0,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){if(this._scroll.activeTouches.splice(e,1),0===e&&this._scroll.activeTouches.length){var g=this._scroll.activeTouches[0];g.start[0]=g.current[0]-(f.current[0]-f.start[0]),g.start[1]=g.current[1]-(f.current[1]-f.start[1])}break}}if(b&&!this._scroll.activeTouches.length){var i=0,j=b.time-b.prevTime;if(j>0&&h(a)-b.time<=this.options.touchMoveNoVelocityDuration){var k=b.current[this._direction]-b.prev[this._direction];i=k/j}var l=this._scroll.touchDelta;this.releaseScrollForce(l,i),this._scroll.touchDelta=0}}function o(a){if(this.options.enabled){var b=Array.isArray(a.delta)?a.delta[this._direction]:a.delta;this.scroll(b)}}function p(a,b,c){if(void 0!==a&&(this._scroll.particleValue=a,this._scroll.particle.setPosition1D(a),
+void 0!==this._scroll.springValue&&this._scroll.pe.wake()),void 0!==b){var d=this._scroll.particle.getVelocity1D();d!==b&&this._scroll.particle.setVelocity1D(b)}}function q(a,b){(b||void 0===this._scroll.particleValue)&&(this._scroll.particleValue=this._scroll.particle.getPosition1D(),this._scroll.particleValue=Math.round(1e3*this._scroll.particleValue)/1e3);var c=this._scroll.particleValue;return(this._scroll.scrollDelta||this._scroll.normalizedScrollDelta)&&(c+=this._scroll.scrollDelta+this._scroll.normalizedScrollDelta,(this._scroll.boundsReached&T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached&T.NEXT&&c<this._scroll.springPosition||this._scroll.boundsReached===T.BOTH)&&(c=this._scroll.springPosition),a&&(this._scroll.scrollDelta||(this._scroll.normalizedScrollDelta=0,p.call(this,c,void 0,"_calcScrollOffset")),this._scroll.normalizedScrollDelta+=this._scroll.scrollDelta,this._scroll.scrollDelta=0)),this._scroll.scrollForceCount&&this._scroll.scrollForce&&(void 0!==this._scroll.springPosition?c=(c+this._scroll.scrollForce+this._scroll.springPosition)/2:c+=this._scroll.scrollForce),this.options.overscroll||(this._scroll.boundsReached===T.BOTH||this._scroll.boundsReached===T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c<this._scroll.springPosition)&&(c=this._scroll.springPosition),c}function r(a,b){var c,d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0),g=f.call(this);if(g&&(void 0!==e&&void 0!==d&&(c=d+e),void 0!==c&&c<=a[this._direction]))return this._scroll.boundsReached=T.BOTH,this._scroll.springPosition=this.options.alignment?-e:d,void(this._scroll.springSource=U.MINSIZE);if(this.options.alignment)if(g){if(void 0!==e&&0>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=-e,void(this._scroll.springSource=U.NEXTBOUNDS)}else{var h=this._calcScrollHeight(!1,!0);if(void 0!==e&&h&&b+e+a[this._direction]<=h)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=e-(a[this._direction]-h),void(this._scroll.springSource=U.NEXTBOUNDS)}else if(void 0!==d&&b-d>=0)return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=d,void(this._scroll.springSource=U.PREVBOUNDS);if(this.options.alignment){if(void 0!==d&&b-d>=-a[this._direction])return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=-a[this._direction]+d,void(this._scroll.springSource=U.PREVBOUNDS)}else{var i=g?a[this._direction]:this._calcScrollHeight(!0,!0);if(void 0!==e&&i>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=i-e,void(this._scroll.springSource=U.NEXTBOUNDS)}this._scroll.boundsReached=T.NONE,this._scroll.springPosition=void 0,this._scroll.springSource=U.NONE}function s(a,b){var c=this._scroll.scrollToRenderNode||this._scroll.ensureVisibleRenderNode;if(c&&!(this._scroll.boundsReached===T.BOTH||!this._scroll.scrollToDirection&&this._scroll.boundsReached===T.PREV||this._scroll.scrollToDirection&&this._scroll.boundsReached===T.NEXT)){for(var d,e=0,f=this._nodes.getStartEnumNode(!0),g=0;f&&(g++,f._invalidated&&void 0!==f.scrollLength);){if(this.options.alignment&&(e-=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment||(e-=f.scrollLength),f=f._next}if(!d)for(e=0,f=this._nodes.getStartEnumNode(!1);f&&f._invalidated&&void 0!==f.scrollLength;){if(this.options.alignment||(e+=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment&&(e+=f.scrollLength),f=f._prev}if(d)return void(this._scroll.ensureVisibleRenderNode?this.options.alignment?e-d.scrollLength<0?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e>a[this._direction]?(this._scroll.springPosition=a[this._direction]-e,this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0):(e=-e,0>e?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e+d.scrollLength>a[this._direction]?(this._scroll.springPosition=a[this._direction]-(e+d.scrollLength),this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0)):(this._scroll.springPosition=e,this._scroll.springSource=U.GOTOSEQUENCE));if(this._scroll.scrollToDirection?(this._scroll.springPosition=b-a[this._direction],this._scroll.springSource=U.GOTONEXTDIRECTION):(this._scroll.springPosition=b+a[this._direction],this._scroll.springSource=U.GOTOPREVDIRECTION),this._viewSequence.cleanup)for(var h=this._viewSequence;h.get()!==c&&(h=this._scroll.scrollToDirection?h.getNext(!0):h.getPrevious(!0)););}}function t(){if(this.options.paginated&&!this._scroll.scrollForceCount&&void 0===this._scroll.springPosition){var a;switch(this.options.paginationMode){case V.SCROLL:(!this.options.paginationEnergyThreshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThreshold)&&(a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode));break;case V.PAGE:a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode)}}}function u(a){for(var b=0,c=a,d=!1,e=this._nodes.getStartEnumNode(!1);e&&e._invalidated&&e._viewSequence&&(d&&(this._viewSequence=e._viewSequence,c=a,d=!1),!(void 0===e.scrollLength||e.trueSizeRequested||0>a));)a-=e.scrollLength,b++,e.scrollLength&&(this.options.alignment?d=a>=0:Math.round(a)>=0&&(this._viewSequence=e._viewSequence,c=a)),e=e._prev;return c}function v(a){for(var b=0,c=a,d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!d.trueSizeRequested&&d._viewSequence&&(!(Math.round(a)>0)||this.options.alignment&&0===d.scrollLength);)this.options.alignment&&(a+=d.scrollLength,b++),(d.scrollLength||this.options.alignment)&&(this._viewSequence=d._viewSequence,c=a),this.options.alignment||(a+=d.scrollLength,b++),d=d._next;return c}function w(a,b){var c=this._layout.capabilities;if(c&&c.debug&&void 0!==c.debug.normalize&&!c.debug.normalize)return b;if(this._scroll.scrollForceCount)return b;var d=b;if(this.options.alignment&&0>b?d=v.call(this,b):!this.options.alignment&&b>0&&(d=u.call(this,b)),d===b&&(this.options.alignment&&b>0?d=u.call(this,b):!this.options.alignment&&0>b&&(d=v.call(this,b))),d!==b){var e=d-b,g=this._scroll.particle.getPosition1D();p.call(this,g+e,void 0,"normalize"),void 0!==this._scroll.springPosition&&(this._scroll.springPosition+=e),f.call(this)&&(this._scroll.groupStart-=e)}return d}function x(a){for(var b,c={},d=1e7,e=a&&this.options.alignment?-this._contextSizeCache[this._direction]:a||this.options.alignment?0:this._contextSizeCache[this._direction],f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!0);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g,f+=g.scrollLength}g=g._next}for(f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!1);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(f-=g.scrollLength,b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g}g=g._prev}return c._node?(c.scrollLength=c._node.scrollLength,this.options.alignment?c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,0)-Math.max(c.scrollOffset,-this._contextSizeCache[this._direction]))/c.scrollLength:c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,this._contextSizeCache[this._direction])-Math.max(c.scrollOffset,0))/c.scrollLength,c.index=c._node._viewSequence.getIndex(),c.viewSequence=c._node._viewSequence,c.renderNode=c._node.renderNode,c):void 0}function y(a,b,c){c?(this._viewSequence=a,this._scroll.springPosition=void 0,g.call(this),this.halt(),this._scroll.scrollDelta=0,p.call(this,0,0,"_goToSequence"),this._scroll.scrollDirty=!0):(this._scroll.scrollToSequence=a,this._scroll.scrollToRenderNode=a.get(),this._scroll.ensureVisibleRenderNode=void 0,this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0)}function z(a,b){this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=a.get(),this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0}function A(a,b){var c=(b?void 0:this._scroll.scrollToSequence)||this._viewSequence;if(!this._scroll.scrollToSequence&&!b){var d=this.getFirstVisibleItem();d&&(c=d.viewSequence,(0>a&&d.scrollOffset<0||a>0&&d.scrollOffset>0)&&(a=0))}if(c){for(var e=0;e<Math.abs(a);e++){var f=a>0?c.getNext():c.getPrevious();if(!f)break;c=f}y.call(this,c,a>=0,b)}}function B(a,b,c){this._debug.layoutCount++;var d=0-Math.max(this.options.extraBoundsSpace[0],1),e=a[this._direction]+Math.max(this.options.extraBoundsSpace[1],1);this.options.paginated&&this.options.paginationMode===V.PAGE&&(d=b-this.options.extraBoundsSpace[0],e=b+a[this._direction]+this.options.extraBoundsSpace[1],b+a[this._direction]<0?(d+=a[this._direction],e+=a[this._direction]):b-a[this._direction]>0&&(d-=a[this._direction],e-=a[this._direction])),this.options.layoutAll&&(d=-1e6,e=1e6);var f=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:a,direction:this._direction,reverse:this.options.alignment?!0:!1,scrollOffset:this.options.alignment?b+a[this._direction]:b,scrollStart:d,scrollEnd:e});this._layout._function&&this._layout._function(f,this._layout.options),this._scroll.unnormalizedScrollOffset=b,this._postLayout&&this._postLayout(a,b),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),r.call(this,a,b),s.call(this,a,b),t.call(this);var h=q.call(this,!0);if(!c&&h!==b)return B.call(this,a,h,!0);if(b=w.call(this,a,b),g.call(this),this._nodes.removeVirtualViewSequenceNodes(),this.options.size&&this.options.size[this._direction]===!0){for(var i=0,j=this._nodes.getStartEnumNode();j;)j._invalidated&&j.scrollLength&&(i+=j.scrollLength),j=j._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}return b}function C(){for(var a=this._specs,b=0,c=a.length;c>b;b++)a[b].renderNode&&(a[b].target=a[b].renderNode.render());return a.length&&a[a.length-1]===this._cleanupRegistration||a.push(this._cleanupRegistration),a}var D=a("./LayoutUtility"),E=a("./LayoutController"),F=a("./LayoutNode"),G=a("./FlowLayoutNode"),H=a("./LayoutNodeManager"),I=window.famous.surfaces.ContainerSurface,J=window.famous.core.Transform,K=window.famous.core.EventHandler,L=window.famous.core.Group,M=window.famous.math.Vector,N=window.famous.physics.PhysicsEngine,O=window.famous.physics.bodies.Particle,P=window.famous.physics.forces.Drag,Q=window.famous.physics.forces.Spring,R=window.famous.inputs.ScrollSync,S=a("./LinkedListViewSequence"),T={NONE:0,PREV:1,NEXT:2,BOTH:3},U={NONE:"none",NEXTBOUNDS:"next-bounds",PREVBOUNDS:"prev-bounds",MINSIZE:"minimal-size",GOTOSEQUENCE:"goto-sequence",ENSUREVISIBLE:"ensure-visible",GOTOPREVDIRECTION:"goto-prev-direction",GOTONEXTDIRECTION:"goto-next-direction"},V={PAGE:0,SCROLL:1};d.prototype=Object.create(E.prototype),d.prototype.constructor=d,d.Bounds=T,d.PaginationMode=V,d.DEFAULT_OPTIONS={useContainer:!1,container:{properties:{overflow:"hidden"}},scrollPhysicsEngine:{},scrollParticle:{},scrollDrag:{forceFunction:P.FORCE_FUNCTIONS.QUADRATIC,strength:.001,disabled:!0},scrollFriction:{forceFunction:P.FORCE_FUNCTIONS.LINEAR,strength:.0025,disabled:!1},scrollSpring:{dampingRatio:1,period:350},scrollSync:{scale:.2},overscroll:!0,paginated:!1,paginationMode:V.PAGE,paginationEnergyThreshold:.01,alignment:0,touchMoveDirectionThreshold:void 0,touchMoveNoVelocityDuration:100,mouseMove:!1,enabled:!0,layoutAll:!1,alwaysLayout:!1,extraBoundsSpace:[100,100],debug:!1},d.prototype.setOptions=function(a){return E.prototype.setOptions.call(this,a),a.hasOwnProperty("paginationEnergyThresshold")&&(console.warn("option `paginationEnergyThresshold` has been deprecated, please rename to `paginationEnergyThreshold`."),this.setOptions({paginationEnergyThreshold:a.paginationEnergyThresshold})),a.hasOwnProperty("touchMoveDirectionThresshold")&&(console.warn("option `touchMoveDirectionThresshold` has been deprecated, please rename to `touchMoveDirectionThreshold`."),this.setOptions({touchMoveDirectionThreshold:a.touchMoveDirectionThresshold})),this._scroll&&(a.scrollSpring&&this._scroll.springForce.setOptions(a.scrollSpring),a.scrollDrag&&this._scroll.dragForce.setOptions(a.scrollDrag)),a.scrollSync&&this._scrollSync&&this._scrollSync.setOptions(a.scrollSync),this},d.prototype._calcScrollHeight=function(a,b){for(var c=0,d=this._nodes.getStartEnumNode(a);d;){if(d._invalidated){if(d.trueSizeRequested){c=void 0;break}if(void 0!==d.scrollLength&&(c=b?d.scrollLength:c+d.scrollLength,!a&&b))break}d=a?d._next:d._prev}return c},d.prototype.getVisibleItems=function(){for(var a=this._contextSizeCache,b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,c=[],d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!(b>a[this._direction]);)b+=d.scrollLength,b>=0&&d._viewSequence&&c.push({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b,a[this._direction])-Math.max(b-d.scrollLength,0))/d.scrollLength:1,scrollOffset:b-d.scrollLength,scrollLength:d.scrollLength,_node:d}),d=d._next;for(b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,d=this._nodes.getStartEnumNode(!1);d&&d._invalidated&&void 0!==d.scrollLength&&!(0>b);)b-=d.scrollLength,b<a[this._direction]&&d._viewSequence&&c.unshift({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b+d.scrollLength,a[this._direction])-Math.max(b,0))/d.scrollLength:1,scrollOffset:b,scrollLength:d.scrollLength,_node:d}),d=d._prev;return c},d.prototype.getFirstVisibleItem=function(){return x.call(this,!0)},d.prototype.getLastVisibleItem=function(){return x.call(this,!1)},d.prototype.goToFirstPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to first item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getPrevious();if(!c||!c.get())break;b=c}return y.call(this,b,!1,a),this},d.prototype.goToPreviousPage=function(a){return A.call(this,-1,a),this},d.prototype.goToNextPage=function(a){return A.call(this,1,a),this},d.prototype.goToLastPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to last item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getNext();if(!c||!c.get())break;b=c}return y.call(this,b,!0,a),this},d.prototype.goToRenderNode=function(a,b){if(!this._viewSequence||!a)return this;if(this._viewSequence.get()===a){var c=q.call(this)>=0;return y.call(this,this._viewSequence,c,b),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){y.call(this,d,!0,b);break}var g=e?e.get():void 0;if(g===a){y.call(this,e,!1,b);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.ensureVisible=function(a){if(a instanceof S)a=a.get();else if(a instanceof Number||"number"==typeof a){for(var b=this._viewSequence;b.getIndex()<a;)if(b=b.getNext(),!b)return this;for(;b.getIndex()>a;)if(b=b.getPrevious(),!b)return this}if(this._viewSequence.get()===a){var c=q.call(this)>=0;return z.call(this,this._viewSequence,c),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){z.call(this,d,!0);break}var g=e?e.get():void 0;if(g===a){z.call(this,e,!1);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.scroll=function(a){return this.halt(),this._scroll.scrollDelta+=a,this},d.prototype.canScroll=function(a){var b,c=q.call(this),d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0);if(void 0!==e&&void 0!==d&&(b=d+e),void 0!==b&&b<=this._contextSizeCache[this._direction])return 0;if(0>a&&void 0!==e){var f=this._contextSizeCache[this._direction]-(c+e);return Math.max(f,a)}if(a>0&&void 0!==d){var g=-(c-d);return Math.min(g,a)}return a},d.prototype.halt=function(){return this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=void 0,p.call(this,void 0,0,"halt"),this},d.prototype.isScrolling=function(){return this._scroll.isScrolling},d.prototype.getBoundsReached=function(){return this._scroll.boundsReached},d.prototype.getVelocity=function(){return this._scroll.particle.getVelocity1D()},d.prototype.getEnergy=function(){return this._scroll.particle.getEnergy()},d.prototype.setVelocity=function(a){return this._scroll.particle.setVelocity1D(a)},d.prototype.applyScrollForce=function(a){return this.halt(),0===this._scroll.scrollForceCount&&(this._scroll.scrollForceStartItem=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem()),this._scroll.scrollForceCount++,this._scroll.scrollForce+=a,this._eventOutput.emit(1===this._scroll.scrollForceCount?"swipestart":"swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a}),this},d.prototype.updateScrollForce=function(a,b){return this.halt(),b-=a,this._scroll.scrollForce+=b,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:b}),this},d.prototype.releaseScrollForce=function(a,b){if(this.halt(),1===this._scroll.scrollForceCount){var c=q.call(this);if(p.call(this,c,b,"releaseScrollForce"),this._scroll.pe.wake(),this._scroll.scrollForce=0,this._scroll.scrollDirty=!0,this._scroll.scrollForceStartItem&&this.options.paginated&&this.options.paginationMode===V.PAGE){var d=this.options.alignment?this.getLastVisibleItem(!0):this.getFirstVisibleItem(!0);d&&(d.renderNode!==this._scroll.scrollForceStartItem.renderNode?this.goToRenderNode(d.renderNode):this.options.paginationEnergyThreshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThreshold?(b=b||0,0>b&&d._node._next&&d._node._next.renderNode?this.goToRenderNode(d._node._next.renderNode):b>=0&&d._node._prev&&d._node._prev.renderNode&&this.goToRenderNode(d._node._prev.renderNode)):this.goToRenderNode(d.renderNode))}this._scroll.scrollForceStartItem=void 0,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeend",{target:this,total:a,delta:0,velocity:b})}else this._scroll.scrollForce-=a,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a});return this},d.prototype.getSpec=function(a,b){var c=E.prototype.getSpec.apply(this,arguments);if(c&&f.call(this)){c={origin:c.origin,align:c.align,opacity:c.opacity,size:c.size,renderNode:c.renderNode,transform:c.transform};var d=[0,0,0];d[this._direction]=this._scrollOffsetCache+this._scroll.groupStart,c.transform=J.thenMove(c.transform,d)}return c},d.prototype.commit=function(a){var b=a.size;this._debug.commitCount++,this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll());var c=q.call(this,!0,!0);void 0===this._scrollOffsetCache&&(this._scrollOffsetCache=c);var d,e=!1,g=!1;if(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1]||this._isDirty||this._scroll.scrollDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout||this._scrollOffsetCache!==c){if(d={target:this,oldSize:this._contextSizeCache,size:b,oldScrollOffset:-(this._scrollOffsetCache+this._scroll.groupStart),scrollOffset:-(c+this._scroll.groupStart)},this._scrollOffsetCache!==c?(this._scroll.isScrolling||(this._scroll.isScrolling=!0,this._eventOutput.emit("scrollstart",d)),g=!0):this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0),this._eventOutput.emit("layoutstart",d),this.options.flow&&(this._isDirty||this.options.flowOptions.reflowOnResize&&(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1])))for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(!0),h=h._next;this._contextSizeCache[0]=b[0],this._contextSizeCache[1]=b[1],this._isDirty=!1,this._scroll.scrollDirty=!1,c=B.call(this,b,c),this._scrollOffsetCache=c,d.scrollOffset=-(this._scrollOffsetCache+this._scroll.groupStart)}else this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0);var i=this._scroll.groupTranslate;i[0]=0,i[1]=0,i[2]=0,i[this._direction]=-this._scroll.groupStart-c;var j=f.call(this),k=this._nodes.buildSpecAndDestroyUnrenderedNodes(j?i:void 0);if(this._specs=k.specs,this._specs.length||(this._scroll.groupStart=0),d&&this._eventOutput.emit("layoutend",d),k.modified&&this._eventOutput.emit("reflow",{target:this}),g&&this._eventOutput.emit("scroll",d),d){var l=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem();(l&&!this._visibleItemCache||!l&&this._visibleItemCache||l&&this._visibleItemCache&&l.renderNode!==this._visibleItemCache.renderNode)&&(this._eventOutput.emit("pagechange",{target:this,oldViewSequence:this._visibleItemCache?this._visibleItemCache.viewSequence:void 0,viewSequence:l?l.viewSequence:void 0,oldIndex:this._visibleItemCache?this._visibleItemCache.index:void 0,index:l?l.index:void 0,renderNode:l?l.renderNode:void 0,oldRenderNode:this._visibleItemCache?this._visibleItemCache.renderNode:void 0}),this._visibleItemCache=l)}e&&(this._scroll.isScrolling=!1,d={target:this,oldSize:b,size:b,oldScrollOffset:-(this._scroll.groupStart+c),scrollOffset:-(this._scroll.groupStart+c)},this._eventOutput.emit("scrollend",d));var m=a.transform;if(j){var n=c+this._scroll.groupStart,o=[0,0,0];o[this._direction]=n,m=J.thenMove(m,o)}return{transform:m,size:b,opacity:a.opacity,origin:a.origin,target:this.group.render()}},d.prototype.render=function(){return this.container?this.container.render.apply(this.container,arguments):this.id},b.exports=d},{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./LinkedListViewSequence":9}],11:[function(a,b,c){function d(a){a=a||{},this._=a._||new this.constructor.Backing(a),this.touched=!0,this.value=a.value||this._.factory.create(),this.index=a.index||0,this.next=a.next,this.prev=a.prev,e.setOutputHandler(this,this._.eventOutput),this.value.pipe(this._.eventOutput)}var e=window.famous.core.EventHandler;d.Backing=function(a){this.factory=a.factory,this.eventOutput=new e},d.prototype.getPrevious=function(a){if(this.prev)return this.prev.touched=!0,this.prev;if(a)return void 0;var b=this._.factory.createPrevious(this.get());return b?(this.prev=new d({_:this._,value:b,index:this.index-1,next:this}),this.prev):void 0},d.prototype.getNext=function(a){if(this.next)return this.next.touched=!0,this.next;if(a)return void 0;var b=this._.factory.createNext(this.get());return b?(this.next=new d({_:this._,value:b,index:this.index+1,prev:this}),this.next):void 0},d.prototype.get=function(){return this.touched=!0,this.value},d.prototype.getIndex=function(){return this.touched=!0,this.index},d.prototype.toString=function(){return""+this.index},d.prototype.cleanup=function(){for(var a=this.prev;a;){if(!a.touched){if(a.next.prev=void 0,a.next=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.prev;break}a.touched=!1,a=a.prev}for(a=this.next;a;){if(!a.touched){if(a.prev.next=void 0,a.prev=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.next;break}a.touched=!1,a=a.next}return this},d.prototype.unshift=function(){console.error&&console.error("VirtualViewSequence.unshift is not supported and should not be called")},d.prototype.push=function(){console.error&&console.error("VirtualViewSequence.push is not supported and should not be called")},d.prototype.splice=function(){console.error&&console.error("VirtualViewSequence.splice is not supported and should not be called")},d.prototype.swap=function(){console.error&&console.error("VirtualViewSequence.swap is not supported and should not be called")},d.prototype.insert=function(){console.error&&console.error("VirtualViewSequence.insert is not supported and should not be called")},d.prototype.remove=function(){console.error&&console.error("VirtualViewSequence.remove is not supported and should not be called")},b.exports=d},{}],12:[function(a,b,c){function d(a,b){var c=a.size;if(this._size=c,this._context=a,this._options=b,this._data={z:b&&b.translateZ?b.translateZ:0},b&&b.margins){var d=e.normalizeMargins(b.margins);this._data.left=d[3],this._data.top=d[0],this._data.right=c[0]-d[1],this._data.bottom=c[1]-d[2]}else this._data.left=0,this._data.top=0,this._data.right=c[0],this._data.bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=c.length>=3?c[2]:void 0;"top"===c[0]?this.top(c[1],d,c.length>=4?c[3]:void 0):"left"===c[0]?this.left(c[1],d,c.length>=4?c[3]:void 0):"right"===c[0]?this.right(c[1],d,c.length>=4?c[3]:void 0):"bottom"===c[0]?this.bottom(c[1],d,c.length>=4?c[3]:void 0):"fill"===c[0]?this.fill(c[1],c.length>=3?c[2]:void 0):"margins"===c[0]&&this.margins(c[1])}},d.prototype.top=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.top+=b,this},d.prototype.left=function(a,b,c){if(b instanceof Array&&(b=b[0]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}return this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.left+=b,this},d.prototype.bottom=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,1],align:[0,1],translate:[this._data.left,-(this._size[1]-this._data.bottom),void 0===c?this._data.z:c]}),this._data.bottom-=b,this},d.prototype.right=function(a,b,c){if(b instanceof Array&&(b=b[0]),a){if(void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._data.right),this._data.top,void 0===c?this._data.z:c]})}return b&&(this._data.right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._data.right-this._data.left,this._data.bottom-this._data.top],translate:[this._data.left,this._data.top,void 0===b?this._data.z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._data.left+=a[3],this._data.top+=a[0],this._data.right-=a[1],this._data.bottom-=a[2],this},d.prototype.get=function(){return this._data},e.registerHelper("dock",d),b.exports=d},{"../LayoutUtility":8}],13:[function(a,b,c){function d(a,b){if(!s.length)return 0;var c,d,e=[0,0];for(c=0;c<s.length;c++)e[i]=Math.max(e[i],s[c].size[i]),e[k]+=(c>0?o[k]:0)+s[c].size[k];var f,h=p[k]?(l-e[k])/(2*s.length):0,q=(i?n[3]:n[0])+h;for(c=0;c<s.length;c++){d=s[c];var r=[0,0,0];r[k]=q,r[i]=a?m:m-e[i],f=0,0===c&&(f=e[i],f+=b&&(a&&!j||!a&&j)?i?n[0]+n[2]:n[3]+n[1]:o[i]),d.set={size:d.size,translate:r,scrollLength:f},q+=d.size[k]+o[k]+2*h}for(c=0;c<s.length;c++)d=a?s[c]:s[s.length-1-c],g.set(d.node,d.set);return s=[],e[i]+o[i]}function e(a){var b=q;if(r&&(b=r(a.renderNode,h)),b[0]===!0||b[1]===!0){var c=g.resolveSize(a,h);return b[0]!==!0&&(c[0]=q[0]),b[1]!==!0&&(c[1]=q[1]),c}return b}function f(a,b){if(g=a,h=g.size,i=g.direction,j=g.alignment,k=(i+1)%2,void 0!==b.gutter&&console.warn&&!b.suppressWarnings&&console.warn("option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead"),!b.gutter||b.margins||b.spacing)n=u.normalizeMargins(b.margins),o=b.spacing||0,o=Array.isArray(o)?o:[o,o];else{var c=Array.isArray(b.gutter)?b.gutter:[b.gutter,b.gutter];n=[c[1],c[0],c[1],c[0]],o=c}w[0]=n[i?0:3],w[1]=-n[i?2:1],p=Array.isArray(b.justify)?b.justify:b.justify?[!0,!0]:[!1,!1],l=h[k]-(i?n[3]+n[1]:n[0]+n[2]);var f,t,v,x;for(b.cells?(b.itemSize&&console.warn&&!b.suppressWarnings&&console.warn("options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two"),q=[[void 0,!0].indexOf(b.cells[0])>-1?b.cells[0]:(h[0]-(n[1]+n[3]+o[0]*(b.cells[0]-1)))/b.cells[0],[void 0,!0].indexOf(b.cells[1])>-1?b.cells[1]:(h[1]-(n[0]+n[2]+o[1]*(b.cells[1]-1)))/b.cells[1]]):b.itemSize?b.itemSize instanceof Function?r=b.itemSize:q=void 0===b.itemSize[0]||void 0===b.itemSize[0]?[void 0===b.itemSize[0]?h[0]:b.itemSize[0],void 0===b.itemSize[1]?h[1]:b.itemSize[1]]:b.itemSize:q=[!0,!0],m=g.scrollOffset+w[j]+(j?o[i]:0),x=g.scrollEnd+(j?0:w[j]),v=0,s=[];x>m;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+w[j]-(j?0:o[i]),x=g.scrollStart+(j?w[j]:0),v=0,s=[];m>x;){if(f=g.prev(),!f){d(!1,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m-=d(!1,!f),v=t[k]),s.unshift({node:f,size:t})}}var g,h,i,j,k,l,m,n,o,p,q,r,s,t=window.famous.utilities.Utility,u=a("../LayoutUtility"),v={sequence:!0,direction:[t.Direction.Y,t.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},w=[0,0];f.Capabilities=v,f.Name="CollectionLayout",f.Description="Multi-cell collection-layout with margins & spacing",b.exports=f},{"../LayoutUtility":8}],14:[function(a,b,c){function d(a,b){for(e=a.size,o=b.zOffset,m=b.itemAngle,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,n=void 0===b.radialOpacity?1:b.radialOpacity,r.opacity=1,r.size[0]=e[0],r.size[1]=e[1],r.size[g]=i,r.size[f]=i,r.translate[0]=0,r.translate[1]=0,r.translate[2]=0,r.rotate[0]=0,r.rotate[1]=0,r.rotate[2]=0,r.scrollLength=i,j=a.scrollOffset,k=Math.PI/2/m*i+i;k>=j&&(h=a.next());)j>=-k&&(r.translate[f]=j,r.translate[2]=Math.abs(j)>i?-o:-(Math.abs(j)*(o/i)),r.rotate[g]=Math.abs(j)>i?m:Math.abs(j)*(m/i),(j>0&&!f||0>j&&f)&&(r.rotate[g]=0-r.rotate[g]),r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-n),a.set(h,r)),j+=i;for(j=a.scrollOffset-i;j>=-k&&(h=a.prev());)k>=j&&(r.translate[f]=j,r.translate[2]=Math.abs(j)>i?-o:-(Math.abs(j)*(o/i)),r.rotate[g]=Math.abs(j)>i?m:Math.abs(j)*(m/i),(j>0&&!f||0>j&&f)&&(r.rotate[g]=0-r.rotate[g]),r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-n),a.set(h,r)),j-=i}var e,f,g,h,i,j,k,l,m,n,o,p=window.famous.utilities.Utility,q={sequence:!0,direction:[p.Direction.Y,p.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},r={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=q,d.Name="CoverLayout",d.Description="CoverLayout",b.exports=d},{}],15:[function(a,b,c){b.exports=function(a,b){var c=b.itemSize;a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[c[0]/2,0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[-(c[0]/2),0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,-(c[1]/2),0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,c[1]/2,0]})}},{}],16:[function(a,b,c){console.warn&&console.warn("GridLayout has been deprecated and will be removed in the future, use CollectionLayout instead"),b.exports=a("./CollectionLayout")},{"./CollectionLayout":13}],17:[function(a,b,c){var d=a("../helpers/LayoutDockHelper");b.exports=function(a,b){var c=new d(a,b);c.top("header",void 0!==b.headerSize?b.headerSize:b.headerHeight),c.bottom("footer",void 0!==b.footerSize?b.footerSize:b.footerHeight),c.fill("content")}},{"../helpers/LayoutDockHelper":12}],18:[function(a,b,c){function d(a,b){var c,d,e,g,j,k,l,m,n,o,p,q,r,s,t=a.size,u=a.direction,v=a.alignment,w=u?0:1,x=f.normalizeMargins(b.margins),y=b.spacing||0,z=b.isSectionCallback;
+for(y&&"number"!=typeof y&&console.log("Famous-flex warning: ListLayout was initialized with a non-numeric spacing option. The CollectionLayout supports an array spacing argument, but the ListLayout does not."),h.size[0]=t[0],h.size[1]=t[1],h.size[w]-=x[1-w]+x[3-w],h.translate[0]=0,h.translate[1]=0,h.translate[2]=0,h.translate[w]=x[u?3:0],b.itemSize!==!0&&b.hasOwnProperty("itemSize")?b.itemSize instanceof Function?j=b.itemSize:g=void 0===b.itemSize?t[u]:b.itemSize:g=!0,i[0]=x[u?0:3],i[1]=-x[u?2:1],c=a.scrollOffset+i[v],s=a.scrollEnd+i[v];s+y>c&&(q=d,d=a.next());)e=j?j(d.renderNode,a.size):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.size[u]=e,h.translate[u]=c+(v?y:0),h.scrollLength=e+y,a.set(d,h),c+=h.scrollLength,z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),p?void 0===r&&(r=c-e):(k=d,l=c-e,m=e,n=e)):!p&&c>=0&&(p=d);for(!q||d||v||(h.scrollLength=e+i[0]+-i[1],a.set(q,h)),q=void 0,d=void 0,c=a.scrollOffset+i[v],s=a.scrollStart+i[v];c>s-y&&(q=d,d=a.prev());)e=j?j(d.renderNode,a.size):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.scrollLength=e+y,c-=h.scrollLength,h.size[u]=e,h.translate[u]=c+(v?y:0),a.set(d,h),z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),k||(k=d,l=c,m=e,n=h.scrollLength)):c+e>=0&&(p=d,k&&(r=c+e),k=void 0);if(q&&!d&&v&&(h.scrollLength=e+i[0]+-i[1],a.set(q,h),k===q&&(n=h.scrollLength)),z&&!k)for(d=a.prev();d;){if(z(d.renderNode)){k=d,e=b.itemSize||a.resolveSize(d,t)[u],l=c-e,m=e,n=void 0;break}d=a.prev()}if(k){var A=Math.max(i[0],l);void 0!==r&&m>r-i[0]&&(A=r-m),h.size[u]=m,h.translate[u]=A,h.scrollLength=n,a.set(k,h)}}var e=window.famous.utilities.Utility,f=a("../LayoutUtility"),g={sequence:!0,direction:[e.Direction.Y,e.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},h={size:[0,0],translate:[0,0,0],scrollLength:void 0},i=[0,0];d.Capabilities=g,d.Name="ListLayout",d.Description="List-layout with margins, spacing and sticky headers",b.exports=d},{"../LayoutUtility":8}],19:[function(a,b,c){var d=a("../helpers/LayoutDockHelper");b.exports=function(a,b){var c=new d(a,{margins:b.margins,translateZ:b.hasOwnProperty("zIncrement")?b.zIncrement:2});a.set("background",{size:a.size});var e=a.get("backIcon");e&&(c.left(e,b.backIconWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var f=a.get("backItem");f&&(c.left(f,b.backItemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var g,h,i=a.get("rightItems");if(i)for(h=0;h<i.length;h++)g=a.get(i[h]),c.right(g,b.rightItemWidth||b.itemWidth),c.right(void 0,b.rightItemSpacer||b.itemSpacer);var j=a.get("leftItems");if(j)for(h=0;h<j.length;h++)g=a.get(j[h]),c.left(g,b.leftItemWidth||b.itemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer);var k=a.get("title");if(k){var l=a.resolveSize(k,a.size),m=Math.max((a.size[0]-l[0])/2,c.get().left),n=Math.min((a.size[0]+l[0])/2,c.get().right);m=Math.max(m,a.size[0]-n),n=Math.min(n,a.size[0]-m),a.set(k,{size:[n-m,a.size[1]],translate:[m,0,c.get().z]})}}},{"../helpers/LayoutDockHelper":12}],20:[function(a,b,c){function d(a,b){for(f=a.size,e=a.direction,g=b.ratios,h=0,j=0;j<g.length;j++)h+=g[j];for(n.size[0]=f[0],n.size[1]=f[1],n.translate[0]=0,n.translate[1]=0,k=a.next(),i=0,j=0;k&&j<g.length;)n.size[e]=(f[e]-i)/h*g[j],n.translate[e]=i,a.set(k,n),i+=n.size[e],h-=g[j],j++,k=a.next()}var e,f,g,h,i,j,k,l=window.famous.utilities.Utility,m={sequence:!0,direction:[l.Direction.Y,l.Direction.X],scrolling:!1},n={size:[0,0],translate:[0,0,0]};d.Capabilities=m,b.exports=d},{}],21:[function(a,b,c){function d(a,b){e=a.size,f=a.direction,g=f?0:1,k=b.spacing||0,h=a.get("items"),i=a.get("spacers"),j=q.normalizeMargins(b.margins),o=b.zIncrement||2,s.size[0]=a.size[0],s.size[1]=a.size[1],s.size[g]-=j[1-g]+j[3-g],s.translate[0]=0,s.translate[1]=0,s.translate[2]=o,s.translate[g]=j[f?3:0],s.align[0]=0,s.align[1]=0,s.origin[0]=0,s.origin[1]=0,n=f?j[0]:j[3],l=e[f]-(n+(f?j[2]:j[1])),l-=(h.length-1)*k;for(var c=0;c<h.length;c++)m=void 0===b.itemSize?Math.round(l/(h.length-c)):b.itemSize===!0?a.resolveSize(h[c],e)[f]:b.itemSize,s.scrollLength=m,0===c&&(s.scrollLength+=f?j[0]:j[3]),c===h.length-1?s.scrollLength+=f?j[2]:j[1]:s.scrollLength+=k,s.size[f]=m,s.translate[f]=n,a.set(h[c],s),n+=m,l-=m,c===b.selectedItemIndex&&(s.scrollLength=0,s.translate[f]+=m/2,s.translate[2]=2*o,s.origin[f]=.5,a.set("selectedItemOverlay",s),s.origin[f]=0,s.translate[2]=o),c<h.length-1?(i&&c<i.length&&(s.size[f]=k,s.translate[f]=n,a.set(i[c],s)),n+=k):n+=f?j[2]:j[1];s.scrollLength=0,s.size[0]=e[0],s.size[1]=e[1],s.size[f]=e[f],s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.translate[f]=0,a.set("background",s)}var e,f,g,h,i,j,k,l,m,n,o,p=window.famous.utilities.Utility,q=a("../LayoutUtility"),r={sequence:!0,direction:[p.Direction.X,p.Direction.Y],trueSize:!0},s={size:[0,0],translate:[0,0,0],align:[0,0],origin:[0,0]};d.Capabilities=r,d.Name="TabBarLayout",d.Description="TabBar widget layout",b.exports=d},{"../LayoutUtility":8}],22:[function(a,b,c){function d(a,b){for(e=a.size,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,j=b.diameter||3*i,n=j/2,o=2*Math.atan2(i/2,n),p=void 0===b.radialOpacity?1:b.radialOpacity,s.opacity=1,s.size[0]=e[0],s.size[1]=e[1],s.size[g]=e[g],s.size[f]=i,s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.rotate[0]=0,s.rotate[1]=0,s.rotate[2]=0,s.scrollLength=i,k=a.scrollOffset,l=Math.PI/2/o*i+i;l>=k&&(h=a.next());)k>=-l&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k+=i;for(k=a.scrollOffset-i;k>=-l&&(h=a.prev());)l>=k&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k-=i}var e,f,g,h,i,j,k,l,m,n,o,p,q=window.famous.utilities.Utility,r={sequence:!0,direction:[q.Direction.Y,q.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},s={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=r,d.Name="WheelLayout",d.Description="Spinner-wheel/slot-machine layout",b.exports=d},{}],23:[function(a,b,c){function d(a){p.apply(this,arguments),a=a||{},this._date=new Date(a.date?a.date.getTime():void 0),this._components=[],this.classes=a.classes?this.classes.concat(a.classes):this.classes,h.call(this),m.call(this),this._overlayRenderables={top:e.call(this,"top"),middle:e.call(this,"middle"),bottom:e.call(this,"bottom")},o.call(this),this.setOptions(this.options)}function e(a,b){var c=this.options.createRenderables[Array.isArray(a)?a[0]:a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new q({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});if(Array.isArray(a))for(var e=0;e<a.length;e++)d.addClass(a[e]);else d.addClass(a);return d}function f(a){for(var b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();if(e&&e.viewSequence){var f=e.viewSequence,g=e.viewSequence.get(),h=d.getComponent(g.date),i=d.getComponent(a),j=0;if(h!==i&&(j=i-h,d.loop)){var k=0>j?j+d.upperBound:j-d.upperBound;Math.abs(k)<Math.abs(j)&&(j=k)}if(j)for(;h!==i&&(f=j>0?f.getNext():f.getPrevious(),g=f?f.get():void 0);)h=d.getComponent(g.date),j>0?c.scrollController.goToNextPage():c.scrollController.goToPreviousPage();else c.scrollController.goToRenderNode(g)}}}function g(){for(var a=new Date(this._date),b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();e&&e.renderNode&&d.setComponent(a,d.getComponent(e.renderNode.date))}return a}function h(){this.container=new s(this.options.container),this.container.setClasses(this.classes),this.layout=new t({layout:w,layoutOptions:{ratios:[]},direction:r.Direction.X}),this.container.add(this.layout),this.add(this.container)}function i(a,b){}function j(){this._scrollingCount++,1===this._scrollingCount&&this._eventOutput.emit("scrollstart",{target:this})}function k(){this._scrollingCount--,0===this._scrollingCount&&this._eventOutput.emit("scrollend",{target:this,date:this._date})}function l(){this._date=g.call(this),this._eventOutput.emit("datechange",{target:this,date:this._date})}function m(){this.scrollWheels=[],this._scrollingCount=0;for(var a=[],b=[],c=0;c<this._components.length;c++){var d=this._components[c];d.createRenderable=e.bind(this);var f=new x({factory:d,value:d.create(this._date)}),g=z.combineOptions(this.options.scrollController,{layout:v,layoutOptions:this.options.wheelLayout,flow:!1,direction:r.Direction.Y,dataSource:f,autoPipeEvents:!0}),h=new u(g);h.on("scrollstart",j.bind(this)),h.on("scrollend",k.bind(this)),h.on("pagechange",l.bind(this));var m={component:d,scrollController:h,viewSequence:f};this.scrollWheels.push(m),d.on("click",i.bind(this,m)),a.push(h),b.push(d.sizeRatio)}this.layout.setDataSource(a),this.layout.setLayoutOptions({ratios:b})}function n(a,b){var c=(a.size[1]-b.itemSize)/2;a.set("top",{size:[a.size[0],c],translate:[0,0,1]}),a.set("middle",{size:[a.size[0],a.size[1]-2*c],translate:[0,c,1]}),a.set("bottom",{size:[a.size[0],c],translate:[0,a.size[1]-c,1]})}function o(){this.overlay=new t({layout:n,layoutOptions:{itemSize:this.options.wheelLayout.itemSize},dataSource:this._overlayRenderables}),this.add(this.overlay)}var p=window.famous.core.View,q=window.famous.core.Surface,r=window.famous.utilities.Utility,s=window.famous.surfaces.ContainerSurface,t=a("../LayoutController"),u=a("../ScrollController"),v=a("../layouts/WheelLayout"),w=a("../layouts/ProportionalLayout"),x=a("../VirtualViewSequence"),y=a("./DatePickerComponents"),z=a("../LayoutUtility");d.prototype=Object.create(p.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-datepicker"],d.Component=y,d.DEFAULT_OPTIONS={perspective:500,wheelLayout:{itemSize:100,diameter:500},createRenderables:{item:!0,top:!1,middle:!1,bottom:!1},scrollController:{enabled:!0,paginated:!0,paginationMode:u.PaginationMode.SCROLL,mouseMove:!0,scrollSpring:{dampingRatio:1,period:800}}},d.prototype.setOptions=function(a){if(p.prototype.setOptions.call(this,a),!this.layout)return this;void 0!==a.perspective&&this.container.context.setPerspective(a.perspective);var b;if(void 0!==a.wheelLayout){for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setLayoutOptions(a.wheelLayout);this.overlay.setLayoutOptions({itemSize:this.options.wheelLayout.itemSize})}if(void 0!==a.scrollController)for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setOptions(a.scrollController);return this},d.prototype.setComponents=function(a){return this._components=a,m.call(this),this},d.prototype.getComponents=function(){return this._components},d.prototype.setDate=function(a){return this._date.setTime(a.getTime()),f.call(this,this._date),this},d.prototype.getDate=function(){return this._date},b.exports=d},{"../LayoutController":5,"../LayoutUtility":8,"../ScrollController":10,"../VirtualViewSequence":11,"../layouts/ProportionalLayout":20,"../layouts/WheelLayout":22,"./DatePickerComponents":24}],24:[function(a,b,c){function d(a){return""+a[this.get]()}function e(a){return("0"+a[this.get]()).slice(-2)}function f(a){return("00"+a[this.get]()).slice(-3)}function g(a){return("000"+a[this.get]()).slice(-4)}function h(a){if(this._eventOutput=new s,this._pool=[],s.setOutputHandler(this,this._eventOutput),a)for(var b in a)this[b]=a[b]}function i(){h.apply(this,arguments)}function j(){h.apply(this,arguments)}function k(){h.apply(this,arguments)}function l(){h.apply(this,arguments)}function m(){h.apply(this,arguments)}function n(){h.apply(this,arguments)}function o(){h.apply(this,arguments)}function p(){h.apply(this,arguments)}function q(){h.apply(this,arguments)}var r=window.famous.core.Surface,s=window.famous.core.EventHandler;h.prototype.step=1,h.prototype.classes=["item"],h.prototype.getComponent=function(a){return a[this.get]()},h.prototype.setComponent=function(a,b){return a[this.set](b)},h.prototype.format=function(a){return"overide to implement"},h.prototype.createNext=function(a){var b=this.getNext(a.date);return b?this.create(b):void 0},h.prototype.getNext=function(a){a=new Date(a.getTime());var b=this.getComponent(a)+this.step;if(void 0!==this.upperBound&&b>=this.upperBound){if(!this.loop)return void 0;b=Math.max(b%this.upperBound,this.lowerBound||0)}return this.setComponent(a,b),a},h.prototype.createPrevious=function(a){var b=this.getPrevious(a.date);return b?this.create(b):void 0},h.prototype.getPrevious=function(a){a=new Date(a.getTime());var b=this.getComponent(a)-this.step;if(void 0!==this.lowerBound&&b<this.lowerBound){if(!this.loop)return void 0;b%=this.upperBound}return this.setComponent(a,b),a},h.prototype.installClickHandler=function(a){a.on("click",function(b){this._eventOutput.emit("click",{target:a,event:b})}.bind(this))},h.prototype.createRenderable=function(a,b){return new r({classes:a,content:"<div>"+b+"</div>"})},h.prototype.create=function(a){a=a||new Date;var b;return this._pool.length?(b=this._pool[0],this._pool.splice(0,1),b.setContent(this.format(a))):(b=this.createRenderable(this.classes,this.format(a)),this.installClickHandler(b)),b.date=a,b},h.prototype.destroy=function(a){this._pool.push(a)},i.prototype=Object.create(h.prototype),i.prototype.constructor=i,i.prototype.classes=["item","year"],i.prototype.format=g,i.prototype.sizeRatio=1,i.prototype.step=1,i.prototype.loop=!1,i.prototype.set="setFullYear",i.prototype.get="getFullYear",j.prototype=Object.create(h.prototype),j.prototype.constructor=j,j.prototype.classes=["item","month"],j.prototype.sizeRatio=2,j.prototype.lowerBound=0,j.prototype.upperBound=12,j.prototype.step=1,j.prototype.loop=!0,j.prototype.set="setMonth",j.prototype.get="getMonth",j.prototype.strings=["January","February","March","April","May","June","July","August","September","October","November","December"],j.prototype.format=function(a){return this.strings[a.getMonth()]},k.prototype=Object.create(h.prototype),k.prototype.constructor=k,k.prototype.classes=["item","fullday"],k.prototype.sizeRatio=2,k.prototype.step=1,k.prototype.set="setDate",k.prototype.get="getDate",k.prototype.format=function(a){return a.toLocaleDateString()},l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.classes=["item","weekday"],l.prototype.sizeRatio=2,l.prototype.lowerBound=0,l.prototype.upperBound=7,l.prototype.step=1,l.prototype.loop=!0,l.prototype.set="setDate",l.prototype.get="getDate",l.prototype.strings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l.prototype.format=function(a){return this.strings[a.getDay()]},m.prototype=Object.create(h.prototype),m.prototype.constructor=m,m.prototype.classes=["item","day"],m.prototype.format=d,m.prototype.sizeRatio=1,m.prototype.lowerBound=1,m.prototype.upperBound=32,m.prototype.step=1,m.prototype.loop=!0,m.prototype.set="setDate",m.prototype.get="getDate",n.prototype=Object.create(h.prototype),n.prototype.constructor=n,n.prototype.classes=["item","hour"],n.prototype.format=e,n.prototype.sizeRatio=1,n.prototype.lowerBound=0,n.prototype.upperBound=24,n.prototype.step=1,n.prototype.loop=!0,n.prototype.set="setHours",n.prototype.get="getHours",o.prototype=Object.create(h.prototype),o.prototype.constructor=o,o.prototype.classes=["item","minute"],o.prototype.format=e,o.prototype.sizeRatio=1,o.prototype.lowerBound=0,o.prototype.upperBound=60,o.prototype.step=1,o.prototype.loop=!0,o.prototype.set="setMinutes",o.prototype.get="getMinutes",p.prototype=Object.create(h.prototype),p.prototype.constructor=p,p.prototype.classes=["item","second"],p.prototype.format=e,p.prototype.sizeRatio=1,p.prototype.lowerBound=0,p.prototype.upperBound=60,p.prototype.step=1,p.prototype.loop=!0,p.prototype.set="setSeconds",p.prototype.get="getSeconds",q.prototype=Object.create(h.prototype),q.prototype.constructor=q,q.prototype.classes=["item","millisecond"],q.prototype.format=f,q.prototype.sizeRatio=1,q.prototype.lowerBound=0,q.prototype.upperBound=1e3,q.prototype.step=1,q.prototype.loop=!0,q.prototype.set="setMilliseconds",q.prototype.get="getMilliseconds",b.exports={Base:h,Year:i,Month:j,FullDay:k,WeekDay:l,Day:m,Hour:n,Minute:o,Second:p,Millisecond:q}},{}],25:[function(a,b,c){function d(a){h.apply(this,arguments),this._selectedItemIndex=-1,a=a||{},this.classes=a.classes?this.classes.concat(a.classes):this.classes,this.layout=new i(this.options.layoutController),this.add(this.layout),this.layout.pipe(this._eventOutput),this._renderables={items:[],spacers:[],background:f.call(this,"background"),selectedItemOverlay:f.call(this,"selectedItemOverlay")},this.setOptions(this.options)}function e(a){if(a!==this._selectedItemIndex){var b=this._selectedItemIndex;this._selectedItemIndex=a,this.layout.setLayoutOptions({selectedItemIndex:a}),b>=0&&this._renderables.items[b].removeClass&&this._renderables.items[b].removeClass("selected"),this._renderables.items[a].addClass&&this._renderables.items[a].addClass("selected"),b>=0&&this._eventOutput.emit("tabchange",{target:this,index:a,oldIndex:b,item:this._renderables.items[a],oldItem:b>=0&&b<this._renderables.items.length?this._renderables.items[b]:void 0})}}function f(a,b){var c=this.options.createRenderables[a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new g({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});return d.addClass(a),"item"===a&&this.options.tabBarLayout&&this.options.tabBarLayout.itemSize&&this.options.tabBarLayout.itemSize===!0&&d.setSize(this.layout.getDirection()?[void 0,!0]:[!0,void 0]),d}var g=window.famous.core.Surface,h=window.famous.core.View,i=a("../LayoutController"),j=a("../layouts/TabBarLayout");d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-tabbar"],d.DEFAULT_OPTIONS={tabBarLayout:{margins:[0,0,0,0],spacing:0},createRenderables:{item:!0,background:!1,selectedItemOverlay:!1,spacer:!1},layoutController:{autoPipeEvents:!0,layout:j,flow:!0,flowOptions:{reflowOnResize:!1,spring:{dampingRatio:.8,period:300}}}},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),this.layout?(void 0!==a.tabBarLayout&&this.layout.setLayoutOptions(a.tabBarLayout),a.layoutController&&this.layout.setOptions(a.layoutController),this):this},d.prototype.setItems=function(a){var b=this._selectedItemIndex;if(this._selectedItemIndex=-1,this._renderables.items=[],this._renderables.spacers=[],a)for(var c=0;c<a.length;c++){var d=f.call(this,"item",a[c]);if(d.on&&d.on("click",e.bind(this,c)),this._renderables.items.push(d),c<a.length-1){var g=f.call(this,"spacer"," ");g&&this._renderables.spacers.push(g)}}return this.layout.setDataSource(this._renderables),this._renderables.items.length&&e.call(this,Math.max(Math.min(b,this._renderables.items.length-1),0)),this},d.prototype.getItems=function(){return this._renderables.items},d.prototype.getItemSpec=function(a,b){return this.layout.getSpec(this._renderables.items[a],b)},d.prototype.setSelectedItemIndex=function(a){return e.call(this,a),this},d.prototype.getSelectedItemIndex=function(){return this._selectedItemIndex},d.prototype.getSize=function(){return this.options.size||(this.layout?this.layout.getSize():h.prototype.getSize.call(this))},b.exports=d},{"../LayoutController":5,"../layouts/TabBarLayout":21}],26:[function(a,b,c){function d(a){i.apply(this,arguments),e.call(this),f.call(this),g.call(this),this.tabBar.setOptions({layoutController:{direction:this.options.tabBarPosition===d.Position.TOP||this.options.tabBarPosition===d.Position.BOTTOM?0:1}})}function e(){this.tabBar=new k(this.options.tabBar),this.animationController=new j(this.options.animationController),this._renderables={tabBar:this.tabBar,content:this.animationController}}function f(){this.layout=new m(this.options.layoutController),this.layout.setLayout(d.DEFAULT_LAYOUT.bind(this)),this.layout.setDataSource(this._renderables),this.add(this.layout)}function g(){this.tabBar.on("tabchange",function(a){h.call(this,a),this._eventOutput.emit("tabchange",{target:this,index:a.index,oldIndex:a.oldIndex,item:this._items[a.index],oldItem:a.oldIndex>=0&&a.oldIndex<this._items.length?this._items[a.oldIndex]:void 0})}.bind(this))}function h(a){var b=this.tabBar.getSelectedItemIndex();this.animationController.halt(),b>=0?this.animationController.show(this._items[b].view):this.animationController.hide()}var i=window.famous.core.View,j=a("../AnimationController"),k=a("./TabBar"),l=a("../helpers/LayoutDockHelper"),m=a("../LayoutController"),n=window.famous.transitions.Easing;d.prototype=Object.create(i.prototype),d.prototype.constructor=d,d.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3},d.DEFAULT_LAYOUT=function(a,b){var c=new l(a,b);switch(this.options.tabBarPosition){case d.Position.TOP:c.top("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.BOTTOM:c.bottom("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.LEFT:c.left("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.RIGHT:c.right("tabBar",this.options.tabBarSize,this.options.tabBarZIndex)}c.fill("content")},d.DEFAULT_OPTIONS={tabBarPosition:d.Position.BOTTOM,tabBarSize:50,tabBarZIndex:10,tabBar:{createRenderables:{background:!0}},animationController:{transition:{duration:300,curve:n.inOutQuad},animation:j.Animation.FadedZoom}},d.prototype.setOptions=function(a){return i.prototype.setOptions.call(this,a),this.layout&&a.layoutController&&this.layout.setOptions(a.layoutController),this.tabBar&&a.tabBar&&this.tabBar.setOptions(a.tabBar),this.animationController&&a.animationController&&this.animationController(a.animationController),this.layout&&void 0!==a.tabBarPosition&&this.tabBar.setOptions({layoutController:{direction:a.tabBarPosition===d.Position.TOP||a.tabBarPosition===d.Position.BOTTOM?0:1}}),this.layout&&this.layout.reflowLayout(),this},d.prototype.setItems=function(a){this._items=a;for(var b=[],c=0;c<a.length;c++)b.push(a[c].tabItem);return this.tabBar.setItems(b),h.call(this),this},d.prototype.getItems=function(){return this._items},d.prototype.setSelectedItemIndex=function(a){return this.tabBar.setSelectedItemIndex(a),this},d.prototype.getSelectedItemIndex=function(){return this.tabBar.getSelectedItemIndex()},b.exports=d},{"../AnimationController":1,"../LayoutController":5,"../helpers/LayoutDockHelper":12,"./TabBar":25}],27:[function(a,b,c){"undefined"==typeof famousflex&&(famousflex={}),famousflex.FlexScrollView=a("./src/FlexScrollView"),famousflex.FlowLayoutNode=a("./src/FlowLayoutNode"),famousflex.LayoutContext=a("./src/LayoutContext"),famousflex.LayoutController=a("./src/LayoutController"),famousflex.LayoutNode=a("./src/LayoutNode"),famousflex.LayoutNodeManager=a("./src/LayoutNodeManager"),famousflex.LayoutUtility=a("./src/LayoutUtility"),famousflex.ScrollController=a("./src/ScrollController"),famousflex.VirtualViewSequence=a("./src/VirtualViewSequence"),famousflex.AnimationController=a("./src/AnimationController"),famousflex.widgets=famousflex.widgets||{},famousflex.widgets.DatePicker=a("./src/widgets/DatePicker"),famousflex.widgets.TabBar=a("./src/widgets/TabBar"),famousflex.widgets.TabBarController=a("./src/widgets/TabBarController"),famousflex.layouts=famousflex.layouts||{},famousflex.layouts.CollectionLayout=a("./src/layouts/CollectionLayout"),famousflex.layouts.CoverLayout=a("./src/layouts/CoverLayout"),famousflex.layouts.CubeLayout=a("./src/layouts/CubeLayout"),famousflex.layouts.GridLayout=a("./src/layouts/GridLayout"),famousflex.layouts.HeaderFooterLayout=a("./src/layouts/HeaderFooterLayout"),famousflex.layouts.ListLayout=a("./src/layouts/ListLayout"),famousflex.layouts.NavBarLayout=a("./src/layouts/NavBarLayout"),famousflex.layouts.ProportionalLayout=a("./src/layouts/ProportionalLayout"),famousflex.layouts.WheelLayout=a("./src/layouts/WheelLayout"),famousflex.helpers=famousflex.helpers||{},famousflex.helpers.LayoutDockHelper=a("./src/helpers/LayoutDockHelper")},{"./src/AnimationController":1,"./src/FlexScrollView":2,"./src/FlowLayoutNode":3,"./src/LayoutContext":4,"./src/LayoutController":5,"./src/LayoutNode":6,"./src/LayoutNodeManager":7,"./src/LayoutUtility":8,"./src/ScrollController":10,"./src/VirtualViewSequence":11,"./src/helpers/LayoutDockHelper":12,"./src/layouts/CollectionLayout":13,"./src/layouts/CoverLayout":14,"./src/layouts/CubeLayout":15,"./src/layouts/GridLayout":16,"./src/layouts/HeaderFooterLayout":17,"./src/layouts/ListLayout":18,"./src/layouts/NavBarLayout":19,"./src/layouts/ProportionalLayout":20,"./src/layouts/WheelLayout":22,"./src/widgets/DatePicker":23,"./src/widgets/TabBar":25,"./src/widgets/TabBarController":26}]},{},[27]);
\ No newline at end of file
diff --git a/dist/famous-flex.js b/dist/famous-flex.js
index a5be9af..a338d61 100644
--- a/dist/famous-flex.js
+++ b/dist/famous-flex.js
@@ -8,8 +8,8 @@
 * @copyright Gloey Apps, 2014/2015
 *
 * @library famous-flex
-* @version 0.3.5
-* @generated 07-09-2015
+* @version 0.3.6
+* @generated 09-11-2015
 */
 /**
  * This Source Code is licensed under the MIT license. If a copy of the
@@ -301,6 +301,424 @@ define('famous-flex/LayoutUtility',['require','exports','module','famous/utiliti
     module.exports = LayoutUtility;
 });
 
+/**
+ * This Source Code is licensed under the MIT license. If a copy of the
+ * MIT-license was not distributed with this file, You can obtain one at:
+ * http://opensource.org/licenses/mit-license.html.
+ *
+ * @author: Hein Rutjes (IjzerenHein)
+ * @license MIT
+ * @copyright Gloey Apps, 2015
+ */
+
+/*global console*/
+/*eslint no-console:0 */
+
+/**
+ * @private
+ */
+function assert(value, message) {
+    if (!value) {
+        //debugger;
+        throw new Error(message);
+    }
+}
+
+/**
+ * Linked-list based implementation of a view-sequence which fixes
+ * several issues in the stock famo.us ViewSequence.
+ *
+ * @module
+ */
+define('famous-flex/LinkedListViewSequence',['require','exports','module'],function(require, exports, module) {
+
+    /**
+     * @class
+     * @param {Object} options Configurable options.
+     * @alias module:LinkedListViewSequence
+     */
+    function LinkedListViewSequence(items) {
+        if (Array.isArray(items)) {
+            this._ = new (this.constructor.Backing)(this);
+            for (var i = 0; i < items.length; i++) {
+                this.push(items[i]);
+            }
+        }
+        else {
+            this._ = items || new (this.constructor.Backing)(this);
+        }
+    }
+
+    LinkedListViewSequence.Backing = function Backing() {
+        this.length = 0;
+        //this.head = undefined;
+        //this.tail = undefined;
+    };
+
+    /*LinkedListViewSequence.prototype.verifyIntegrity = function() {
+        var item = this._.head;
+        var count = 0;
+        while (item) {
+          assert(item._value, 'no rendernode at index: ' + count);
+          count++;
+          assert(count <= this._.length, 'head -> tail, node-count exceeds length: ' + count + ' > ' + this._.length);
+          item = item._next;
+        }
+        assert(count === this._.length, 'head -> tail, different count: ' + count + ' != ' + this._.length);
+        item = this._.tail;
+        count = 0;
+        while (item) {
+          count++;
+          assert(count <= this._.length, 'tail -> head, node-count exceeds length: ' + count + ' > ' + this._.length);
+          item = item._prev;
+        }
+        assert(count === this._.length, 'tail -> head, different count: ' + count + ' != ' + this._.length);
+    };*/
+
+    /**
+     * Get head node.
+     *
+     * @return {LinkedListViewSequence} head node.
+     */
+    LinkedListViewSequence.prototype.getHead = function() {
+        return this._.head;
+    };
+
+    /**
+     * Get tail node.
+     *
+     * @return {LinkedListViewSequence} tail node.
+     */
+    LinkedListViewSequence.prototype.getTail = function() {
+        return this._.tail;
+    };
+
+    /**
+     * Get previous node.
+     *
+     * @return {LinkedListViewSequence} previous node.
+     */
+    LinkedListViewSequence.prototype.getPrevious = function() {
+        return this._prev;
+    };
+
+    /**
+     * Get next node.
+     *
+     * @return {LinkedListViewSequence} next node.
+     */
+    LinkedListViewSequence.prototype.getNext = function() {
+        return this._next;
+    };
+
+    /**
+     * Gets the value of this node.
+     *
+     * @return {Renderable} surface/view
+     */
+    LinkedListViewSequence.prototype.get = function() {
+        return this._value;
+    };
+
+    /**
+     * Sets the value of this node.
+     *
+     * @param {Renderable} value surface/view
+     * @return {LinkedListViewSequence} this
+     */
+    LinkedListViewSequence.prototype.set = function(value) {
+        this._value = value;
+        return this;
+    };
+
+    /**
+     * Get the index of the node.
+     *
+     * @return {Number} Index of node.
+     */
+    LinkedListViewSequence.prototype.getIndex = function() {
+        return this._value ? this.indexOf(this._value) : 0;
+    };
+
+    /**
+     * Get human readable string verion of the node.
+     *
+     * @return {String} node as a human readable string
+     */
+    LinkedListViewSequence.prototype.toString = function() {
+        return '' + this.getIndex();
+    };
+
+    /**
+     * Finds the index of a given render-node.
+     *
+     * @param {Renderable} item Render-node to find.
+     * @return {Number} Index or -1 when not found.
+     */
+    LinkedListViewSequence.prototype.indexOf = function(item) {
+        var sequence = this._.head;
+        var index = 0;
+        while (sequence) {
+            if (sequence._value === item) {
+                return index;
+            }
+            index++;
+            sequence = sequence._next;
+        }
+        return -1;
+    };
+
+    /**
+     * Finds the view-sequence item at the given index.
+     *
+     * @param {Number} index 0-based index.
+     * @return {LinkedListViewSequence} View-sequence node or undefined.
+     */
+    LinkedListViewSequence.prototype.findByIndex = function(index) {
+        index = (index === -1) ? (this._.length - 1) : index;
+        if ((index < 0) || (index >= this._.length)) {
+            return undefined;
+        }
+
+        // search for specific index
+        var searchIndex;
+        var searchSequence;
+        if (index > (this._.length / 2)) {
+            // start searching from the tail
+            searchSequence = this._.tail;
+            searchIndex = this._.length - 1;
+            while (searchIndex > index) {
+                searchSequence = searchSequence._prev;
+                searchIndex--;
+            }
+        }
+        else {
+            // start searching from the head
+            searchSequence = this._.head;
+            searchIndex = 0;
+            while (searchIndex < index) {
+                searchSequence = searchSequence._next;
+                searchIndex++;
+            }
+        }
+        return searchSequence;
+    };
+
+    /**
+     * Finds the view-sequence node by the given renderable.
+     *
+     * @param {Renderable} value Render-node to search for.
+     * @return {LinkedListViewSequence} View-sequence node or undefined.
+     */
+    LinkedListViewSequence.prototype.findByValue = function(value) {
+        var sequence = this._.head;
+        while (sequence) {
+            if (sequence.get() === value) {
+                return sequence;
+            }
+            sequence = sequence._next;
+        }
+        return undefined;
+    };
+
+    /**
+     * Inserts an item into the view-sequence.
+     *
+     * @param {Number} index 0-based index (-1 inserts at the tail).
+     * @param {Renderable} renderNode Renderable to insert.
+     * @return {LinkedListViewSequence} newly inserted view-sequence node.
+     */
+    LinkedListViewSequence.prototype.insert = function(index, renderNode) {
+        index = (index === -1) ? this._.length : index;
+        /*if (this._.debug) {
+            console.log(this._.logName + ': insert (length: ' + this._.length + ')');
+        }*/
+        if (!this._.length) {
+            assert(index === 0, 'inserting in empty view-sequence, but not at index 0 (but ' + index + ' instead)');
+            this._value = renderNode;
+            this._.head = this;
+            this._.tail = this;
+            this._.length = 1;
+            //this.verifyIntegrity();
+            return this;
+        }
+        var sequence;
+        if (index === 0) {
+            // insert at head (quick!)
+            sequence = new LinkedListViewSequence(this._);
+            sequence._value = renderNode;
+            sequence._next = this._.head;
+            this._.head._prev = sequence;
+            this._.head = sequence;
+        }
+        else if (index === this._.length) {
+            // insert at tail (quick!)
+            sequence = new LinkedListViewSequence(this._);
+            sequence._value = renderNode;
+            sequence._prev = this._.tail;
+            this._.tail._next = sequence;
+            this._.tail = sequence;
+        }
+        else {
+            // search for specific index (slow!) ... but fricking solid famo.us...
+            var searchIndex;
+            var searchSequence;
+            assert((index > 0) && (index < this._.length), 'invalid insert index: ' + index + ' (length: ' + this._.length + ')');
+            if (index > (this._.length / 2)) {
+                // start searching from the tail
+                searchSequence = this._.tail;
+                searchIndex = this._.length - 1;
+                while (searchIndex >= index) {
+                    searchSequence = searchSequence._prev;
+                    searchIndex--;
+                }
+            }
+            else {
+                // start searching from the head
+                searchSequence = this._.head;
+                searchIndex = 1;
+                while (searchIndex < index) {
+                    searchSequence = searchSequence._next;
+                    searchIndex++;
+                }
+            }
+            // insert after searchSequence
+            sequence = new LinkedListViewSequence(this._);
+            sequence._value = renderNode;
+            sequence._prev = searchSequence;
+            sequence._next = searchSequence._next;
+            searchSequence._next._prev = sequence;
+            searchSequence._next = sequence;
+        }
+        this._.length++;
+        //this.verifyIntegrity();
+        return sequence;
+    };
+
+    /**
+     * Removes the view-sequence item at the given index.
+     *
+     * @param {LinkedListViewSequence} sequence Node to remove
+     * @return {LinkedListViewSequence} New current view-sequence node to display.
+     */
+    LinkedListViewSequence.prototype.remove = function(sequence) {
+        /*if (this._.debug) {
+            console.log(this._.logName + ': remove (length: ' + this._.length + ')');
+        }*/
+        if (sequence._prev && sequence._next) {
+            sequence._prev._next = sequence._next;
+            sequence._next._prev = sequence._prev;
+            this._.length--;
+            //this.verifyIntegrity();
+            return (sequence === this) ? sequence._prev : this;
+        }
+        else if (!sequence._prev && !sequence._next) {
+            assert(sequence === this, 'only one sequence exists, should be this one');
+            assert(this._value, 'last node should have a value');
+            assert(this._.head, 'head is invalid');
+            assert(this._.tail, 'tail is invalid');
+            assert(this._.length === 1, 'length should be 1');
+            this._value = undefined;
+            this._.head = undefined;
+            this._.tail = undefined;
+            this._.length--;
+            //this.verifyIntegrity();
+            return this;
+        }
+        else if (!sequence._prev) {
+            assert(this._.head === sequence, 'head is invalid');
+            sequence._next._prev = undefined;
+            this._.head = sequence._next;
+            this._.length--;
+            //this.verifyIntegrity();
+            return (sequence === this) ? this._.head : this;
+        }
+        else {
+            assert(!sequence._next, 'next should be empty');
+            assert(this._.tail === sequence, 'tail is invalid');
+            sequence._prev._next = undefined;
+            this._.tail = sequence._prev;
+            this._.length--;
+            //this.verifyIntegrity();
+            return (sequence === this) ? this._.tail : this;
+        }
+    };
+
+    /**
+     * Gets the number of items in the view-sequence.
+     *
+     * @return {Number} length.
+     */
+    LinkedListViewSequence.prototype.getLength = function() {
+        return this._.length;
+    };
+
+    /**
+     * Removes all items.
+     *
+     * @return {LinkedListViewSequence} Last remaining view-sequence node.
+     */
+    LinkedListViewSequence.prototype.clear = function() {
+        var sequence = this; //eslint-disable-line consistent-this
+        while (this._.length) {
+          sequence = sequence.remove(this._.tail);
+        }
+        //sequence.verifyIntegrity();
+        return sequence;
+    };
+
+    /**
+     * Inserts an item at the beginning of the view-sequence.
+     *
+     * @param {Renderable} renderNode Renderable to insert.
+     * @return {LinkedListViewSequence} newly inserted view-sequence node.
+     */
+    LinkedListViewSequence.prototype.unshift = function(renderNode) {
+        return this.insert(0, renderNode);
+    };
+
+    /**
+     * Inserts an item at the end of the view-sequence.
+     *
+     * @param {Renderable} renderNode Renderable to insert.
+     * @return {LinkedListViewSequence} newly inserted view-sequence node.
+     */
+    LinkedListViewSequence.prototype.push = function(renderNode) {
+        return this.insert(-1, renderNode);
+    };
+
+    LinkedListViewSequence.prototype.splice = function(index, remove, items) {
+        if (console.error) {
+            console.error('LinkedListViewSequence.splice is not supported');
+        }
+    };
+
+    /**
+     * Swaps the values of two view-sequence nodes.
+     *
+     * @param {Number} index Index of the first item to swap.
+     * @param {Number} index2 Index of item to swap with.
+     * @return {LinkedListViewSequence} this
+     */
+    LinkedListViewSequence.prototype.swap = function(index, index2) {
+        var sequence1 = this.findByIndex(index);
+        if (!sequence1) {
+            throw new Error('Invalid first index specified to swap: ' + index);
+        }
+        var sequence2 = this.findByIndex(index2);
+        if (!sequence2) {
+            throw new Error('Invalid second index specified to swap: ' + index2);
+        }
+        var swap = sequence1._value;
+        sequence1._value = sequence2._value;
+        sequence2._value = swap;
+        //this.verifyIntegrity();
+        return this;
+    };
+
+    module.exports = LinkedListViewSequence;
+});
+
 /**
  * This Source Code is licensed under the MIT license. If a copy of the
  * MIT-license was not distributed with this file, You can obtain one at:
@@ -2427,12 +2845,13 @@ define('famous-flex/helpers/LayoutDockHelper',['require','exports','module','../
  *
  * @module
  */
-define('famous-flex/LayoutController',['require','exports','module','famous/utilities/Utility','famous/core/Entity','famous/core/ViewSequence','famous/core/OptionsManager','famous/core/EventHandler','./LayoutUtility','./LayoutNodeManager','./LayoutNode','./FlowLayoutNode','famous/core/Transform','./helpers/LayoutDockHelper'],function(require, exports, module) {
+define('famous-flex/LayoutController',['require','exports','module','famous/utilities/Utility','famous/core/Entity','famous/core/ViewSequence','./LinkedListViewSequence','famous/core/OptionsManager','famous/core/EventHandler','./LayoutUtility','./LayoutNodeManager','./LayoutNode','./FlowLayoutNode','famous/core/Transform','./helpers/LayoutDockHelper'],function(require, exports, module) {
 
     // import dependencies
     var Utility = require('famous/utilities/Utility');
     var Entity = require('famous/core/Entity');
     var ViewSequence = require('famous/core/ViewSequence');
+    var LinkedListViewSequence = require('./LinkedListViewSequence');
     var OptionsManager = require('famous/core/OptionsManager');
     var EventHandler = require('famous/core/EventHandler');
     var LayoutUtility = require('./LayoutUtility');
@@ -2447,7 +2866,7 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
      * @param {Object} options Options.
      * @param {Function|Object} [options.layout] Layout function or layout-literal.
      * @param {Object} [options.layoutOptions] Options to pass in to the layout-function.
-     * @param {Array|ViewSequence|Object} [options.dataSource] Array, ViewSequence or Object with key/value pairs.
+     * @param {Array|LinkedListViewSequence|Object} [options.dataSource] Array, LinkedListViewSequence or Object with key/value pairs.
      * @param {Utility.Direction} [options.direction] Direction to layout into (e.g. Utility.Direction.Y) (when omitted the default direction of the layout is used)
      * @param {Bool} [options.flow] Enables flow animations when the layout changes (default: `false`).
      * @param {Object} [options.flowOptions] Options used by nodes when reflowing.
@@ -2583,7 +3002,7 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
      * @param {Options} options An object of configurable options for the LayoutController instance.
      * @param {Function|Object} [options.layout] Layout function or layout-literal.
      * @param {Object} [options.layoutOptions] Options to pass in to the layout-function.
-     * @param {Array|ViewSequence|Object} [options.dataSource] Array, ViewSequence or Object with key/value pairs.
+     * @param {Array|LinkedListViewSequence|Object} [options.dataSource] Array, LinkedListViewSequence or Object with key/value pairs.
      * @param {Utility.Direction} [options.direction] Direction to layout into (e.g. Utility.Direction.Y) (when omitted the default direction of the layout is used)
      * @param {Object} [options.flowOptions] Options used by nodes when reflowing.
      * @param {Bool} [options.flowOptions.reflowOnResize] Smoothly reflows renderables on resize (only used when flow = true) (default: `true`).
@@ -2660,26 +3079,19 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
      * Helper function to enumerate all the renderables in the datasource
      */
     function _forEachRenderable(callback) {
-        var dataSource = this._dataSource;
-        if (dataSource instanceof Array) {
-            for (var i = 0, j = dataSource.length; i < j; i++) {
-                callback(dataSource[i]);
-            }
-        }
-        else if (dataSource instanceof ViewSequence) {
-            var renderable;
-            while (dataSource) {
-                renderable = dataSource.get();
-                if (!renderable) {
-                    break;
-                }
-                callback(renderable);
-                dataSource = dataSource.getNext();
+        if (this._nodesById) {
+            for (var key in this._nodesById) {
+                callback(this._nodesById[key]);
             }
         }
         else {
-            for (var key in dataSource) {
-                callback(dataSource[key]);
+            var sequence = this._viewSequence.getHead();
+            while (sequence) {
+                var renderable = sequence.get();
+                if (renderable) {
+                    callback(renderable);
+                }
+                sequence = sequence.getNext();
             }
         }
     }
@@ -2688,23 +3100,30 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
      * Sets the collection of renderables which are layed out according to
      * the layout-function.
      *
-     * The data-source can be either an Array, ViewSequence or Object
+     * The data-source can be either an Array, LinkedListViewSequence or Object
      * with key/value pairs.
      *
-     * @param {Array|Object|ViewSequence} dataSource Array, ViewSequence or Object.
+     * @param {Array|Object|LinkedListViewSequence} dataSource Array, LinkedListViewSequence or Object.
      * @return {LayoutController} this
      */
     LayoutController.prototype.setDataSource = function(dataSource) {
         this._dataSource = dataSource;
-        this._initialViewSequence = undefined;
         this._nodesById = undefined;
-        if (dataSource instanceof Array) {
-            this._viewSequence = new ViewSequence(dataSource);
-            this._initialViewSequence = this._viewSequence;
+        if (dataSource instanceof ViewSequence) {
+            console.warn('The stock famo.us ViewSequence is no longer supported as it is too buggy');
+            console.warn('It has been automatically converted to the safe LinkedListViewSequence.');
+            console.warn('Please refactor your code by using LinkedListViewSequence.');
+            this._dataSource = new LinkedListViewSequence(dataSource._.array);
+            this._viewSequence = this._dataSource;
+        }
+        else if (dataSource instanceof Array) {
+            this._viewSequence = new LinkedListViewSequence(dataSource);
         }
-        else if ((dataSource instanceof ViewSequence) || dataSource.getNext) {
+        else if (dataSource instanceof LinkedListViewSequence) {
+            this._viewSequence = dataSource;
+        }
+        else if (dataSource.getNext) {
             this._viewSequence = dataSource;
-            this._initialViewSequence = dataSource;
         }
         else if (dataSource instanceof Object){
             this._nodesById = dataSource;
@@ -2730,7 +3149,7 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
     /**
      * Get the data-source.
      *
-     * @return {Array|ViewSequence|Object} data-source
+     * @return {Array|LinkedListViewSequence|Object} data-source
      */
     LayoutController.prototype.getDataSource = function() {
         return this._dataSource;
@@ -2984,39 +3403,14 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
         // Add the renderable using an index
         else {
 
-            // Create data-source if neccesary
+            // Create own data-source if neccesary
             if (this._dataSource === undefined) {
-                this._dataSource = [];
-                this._viewSequence = new ViewSequence(this._dataSource);
-                this._initialViewSequence = this._viewSequence;
-            }
-
-            // Insert into array
-            var dataSource = this._viewSequence || this._dataSource;
-            var array = _getDataSourceArray.call(this);
-            if (array && (indexOrId === array.length)) {
-                indexOrId = -1;
-            }
-            if (indexOrId === -1) {
-                dataSource.push(renderable);
-            }
-            else if (indexOrId === 0) {
-                if (dataSource === this._viewSequence) {
-                    dataSource.splice(0, 0, renderable);
-                    if (this._viewSequence.getIndex() === 0) {
-                        var nextViewSequence = this._viewSequence.getNext();
-                        if (nextViewSequence && nextViewSequence.get()) {
-                            this._viewSequence = nextViewSequence;
-                        }
-                    }
-                }
-                else {
-                    dataSource.splice(0, 0, renderable);
-                }
-            }
-            else {
-                dataSource.splice(indexOrId, 0, renderable);
+                this._dataSource = new LinkedListViewSequence();
+                this._viewSequence = this._dataSource;
             }
+
+            // Insert data
+            this._viewSequence.insert(indexOrId, renderable);
         }
 
         // When a custom insert-spec was specified, store that in the layout-node
@@ -3055,6 +3449,9 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
      * Helper function for finding the view-sequence node at the given position.
      */
     function _getViewSequenceAtIndex(index, startViewSequence) {
+        if (this._viewSequence.getAtIndex) {
+            return this._viewSequence.getAtIndex(index, startViewSequence);
+        }
         var viewSequence = startViewSequence || this._viewSequence;
         var i = viewSequence ? viewSequence.getIndex() : index;
         if (index > i) {
@@ -3090,19 +3487,6 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
         return viewSequence;
     }
 
-    /**
-     * Helper that return the underlying array datasource if available.
-     */
-    function _getDataSourceArray() {
-      if (Array.isArray(this._dataSource)) {
-        return this._dataSource;
-      }
-      else if (this._viewSequence || this._viewSequence._) {
-        return this._viewSequence._.array;
-      }
-      return undefined;
-    }
-
     /**
      * Get the renderable at the given index or Id.
      *
@@ -3120,29 +3504,14 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
     /**
      * Swaps two renderables at the given positions.
      *
-     * This method is only supported for dataSources of type Array or ViewSequence.
+     * This method is only supported for dataSources of type Array or LinkedListViewSequence.
      *
      * @param {Number} index Index of the renderable to swap
      * @param {Number} index2 Index of the renderable to swap with
      * @return {LayoutController} this
      */
     LayoutController.prototype.swap = function(index, index2) {
-        var array = _getDataSourceArray.call(this);
-        if (!array) {
-            throw '.swap is only supported for dataSources of type Array or ViewSequence';
-        }
-        if (index === index2) {
-          return this;
-        }
-        if ((index < 0) || (index >= array.length)) {
-          throw 'Invalid index (' + index + ') specified to .swap';
-        }
-        if ((index2 < 0) || (index2 >= array.length)) {
-          throw 'Invalid second index (' + index2 + ') specified to .swap';
-        }
-        var renderNode = array[index];
-        array[index] = array[index2];
-        array[index2] = renderNode;
+        this._viewSequence.swap(index, index2);
         this._isDirty = true;
         return this;
     };
@@ -3171,16 +3540,13 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
             }
             return oldRenderable;
         }
-        var array = _getDataSourceArray.call(this);
-        if (!array) {
-          return undefined;
-        }
-        if ((indexOrId < 0) || (indexOrId >= array.length)) {
-          throw 'Invalid index (' + indexOrId + ') specified to .replace';
+        var sequence = this._viewSequence.findByIndex(indexOrId);
+        if (!sequence) {
+            throw 'Invalid index (' + indexOrId + ') specified to .replace';
         }
-        oldRenderable = array[indexOrId];
+        oldRenderable = sequence.get();
+        sequence.set(renderable);
         if (oldRenderable !== renderable) {
-          array[indexOrId] = renderable;
           this._isDirty = true;
         }
         return oldRenderable;
@@ -3189,25 +3555,19 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
     /**
      * Moves a renderable to a new index.
      *
-     * This method is only supported for dataSources of type Array or ViewSequence.
+     * This method is only supported for dataSources of type Array or LinkedListViewSequence.
      *
      * @param {Number} index Index of the renderable to move.
      * @param {Number} newIndex New index of the renderable.
      * @return {LayoutController} this
      */
     LayoutController.prototype.move = function(index, newIndex) {
-        var array = _getDataSourceArray.call(this);
-        if (!array) {
-            throw '.move is only supported for dataSources of type Array or ViewSequence';
-        }
-        if ((index < 0) || (index >= array.length)) {
+        var sequence = this._viewSequence.findByIndex(index);
+        if (!sequence) {
           throw 'Invalid index (' + index + ') specified to .move';
         }
-        if ((newIndex < 0) || (newIndex >= array.length)) {
-          throw 'Invalid newIndex (' + newIndex + ') specified to .move';
-        }
-        var item = array.splice(index, 1)[0];
-        array.splice(newIndex, 0, item);
+        this._viewSequence = this._viewSequence.remove(sequence);
+        this._viewSequence.insert(newIndex, sequence.get());
         this._isDirty = true;
         return this;
     };
@@ -3246,35 +3606,20 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
                 }
             }
         }
+        else {
 
-        // Remove the renderable using an index
-        else if ((indexOrId instanceof Number) || (typeof indexOrId === 'number')) {
-            var array = _getDataSourceArray.call(this);
-            if (!array || (indexOrId < 0) || (indexOrId >= array.length)) {
-                throw 'Invalid index (' + indexOrId + ') specified to .remove (or dataSource doesn\'t support remove)';
+            // Remove the renderable
+            var sequence;
+            if ((indexOrId instanceof Number) || (typeof indexOrId === 'number')) {
+                sequence = this._viewSequence.findByIndex(indexOrId);
             }
-            renderNode = array[indexOrId];
-            this._dataSource.splice(indexOrId, 1);
-        }
-
-        // Remove by renderable
-        else {
-            indexOrId = this._dataSource.indexOf(indexOrId);
-            if (indexOrId >= 0) {
-                this._dataSource.splice(indexOrId, 1);
-                renderNode = indexOrId;
+            else {
+                sequence = this._viewSequence.findByValue(indexOrId);
+            }
+            if (sequence) {
+                renderNode = sequence.get();
+                this._viewSequence = this._viewSequence.remove(sequence);
             }
-        }
-
-        // When a node is removed from the view-sequence, the current this._viewSequence
-        // node may not be part of the valid view-sequence anymore. This seems to be a bug
-        // in the famo.us ViewSequence implementation/concept. The following check was added
-        // to ensure that always a valid viewSequence node is selected into the ScrollView.
-        if (this._viewSequence && renderNode) {
-            var viewSequence = _getViewSequenceAtIndex.call(this, this._viewSequence.getIndex(), this._initialViewSequence);
-            viewSequence = viewSequence || _getViewSequenceAtIndex.call(this, this._viewSequence.getIndex() - 1, this._initialViewSequence);
-            viewSequence = viewSequence || this._dataSource;
-            this._viewSequence = viewSequence;
         }
 
         // When a custom remove-spec was specified, store that in the layout-node
@@ -3314,8 +3659,8 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
                 this._isDirty = true;
             }
         }
-        else if (this._dataSource){
-            this.setDataSource([]);
+        else if (this._viewSequence){
+            this._viewSequence = this._viewSequence.clear();
         }
         if (removeSpec) {
             var node = this._nodes.getStartEnumNode();
@@ -3558,7 +3903,7 @@ define('famous-flex/LayoutController',['require','exports','module','famous/util
  * Inherited from: [LayoutController](./LayoutController.md)
  * @module
  */
-define('famous-flex/ScrollController',['require','exports','module','./LayoutUtility','./LayoutController','./LayoutNode','./FlowLayoutNode','./LayoutNodeManager','famous/surfaces/ContainerSurface','famous/core/Transform','famous/core/EventHandler','famous/core/Group','famous/math/Vector','famous/physics/PhysicsEngine','famous/physics/bodies/Particle','famous/physics/forces/Drag','famous/physics/forces/Spring','famous/inputs/ScrollSync','famous/core/ViewSequence'],function(require, exports, module) {
+define('famous-flex/ScrollController',['require','exports','module','./LayoutUtility','./LayoutController','./LayoutNode','./FlowLayoutNode','./LayoutNodeManager','famous/surfaces/ContainerSurface','famous/core/Transform','famous/core/EventHandler','famous/core/Group','famous/math/Vector','famous/physics/PhysicsEngine','famous/physics/bodies/Particle','famous/physics/forces/Drag','famous/physics/forces/Spring','famous/inputs/ScrollSync','./LinkedListViewSequence'],function(require, exports, module) {
 
     // import dependencies
     var LayoutUtility = require('./LayoutUtility');
@@ -3576,7 +3921,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
     var Drag = require('famous/physics/forces/Drag');
     var Spring = require('famous/physics/forces/Spring');
     var ScrollSync = require('famous/inputs/ScrollSync');
-    var ViewSequence = require('famous/core/ViewSequence');
+    var LinkedListViewSequence = require('./LinkedListViewSequence');
 
     /**
      * Boudary reached detection
@@ -4157,6 +4502,9 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
             this._scroll.particleValue = position;
             this._scroll.particle.setPosition1D(position);
             //_log.call(this, 'setParticle.position: ', position, ' (old: ', oldPosition, ', delta: ', position - oldPosition, ', phase: ', phase, ')');
+            if (this._scroll.springValue !== undefined) {
+                this._scroll.pe.wake();
+            }
         }
         if (velocity !== undefined) {
             var oldVelocity = this._scroll.particle.getVelocity1D();
@@ -4430,7 +4778,6 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
         if (this._scroll.scrollToDirection) {
             this._scroll.springPosition = scrollOffset - size[this._direction];
             this._scroll.springSource = SpringSource.GOTONEXTDIRECTION;
-
         }
         else {
             this._scroll.springPosition = scrollOffset + size[this._direction];
@@ -4509,8 +4856,10 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
                     normalizeNextPrev = (scrollOffset >= 0);
                 }
                 else {
-                    this._viewSequence = node._viewSequence;
-                    normalizedScrollOffset = scrollOffset;
+                    if (Math.round(scrollOffset) >= 0) {
+                        this._viewSequence = node._viewSequence;
+                        normalizedScrollOffset = scrollOffset;
+                    }
                 }
             }
             node = node._prev;
@@ -4523,7 +4872,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
         var node = this._nodes.getStartEnumNode(true);
         while (node) {
             if (!node._invalidated || (node.scrollLength === undefined) || node.trueSizeRequested || !node._viewSequence ||
-                ((scrollOffset > 0) && (!this.options.alignment || (node.scrollLength !== 0)))) {
+                ((Math.round(scrollOffset) > 0) && (!this.options.alignment || (node.scrollLength !== 0)))) {
                 break;
             }
             if (this.options.alignment) {
@@ -4584,7 +4933,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
             var particleValue = this._scroll.particle.getPosition1D();
             //var particleValue = this._scroll.particleValue;
             _setParticle.call(this, particleValue + delta, undefined, 'normalize');
-            //_log.call(this, 'normalized scrollOffset: ', normalizedScrollOffset, ', old: ', scrollOffset, ', particle: ', particleValue + delta);
+            //console.log('normalized scrollOffset: ', normalizedScrollOffset, ', old: ', scrollOffset, ', particle: ', particleValue + delta);
 
             // Adjust scroll spring
             if (this._scroll.springPosition !== undefined) {
@@ -4606,7 +4955,7 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
      * following properties. Example:
      * ```javascript
      * {
-     *   viewSequence: {ViewSequence},
+     *   viewSequence: {LinkedListViewSequence},
      *   index: {Number},
      *   renderNode: {renderable},
      *   visiblePerc: {Number} 0..1
@@ -4942,13 +5291,13 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
      * When the node is already visible, nothing happens. If the node is not entirely visible
      * the view is scrolled as much as needed to make it entirely visibl.
      *
-     * @param {Number|ViewSequence|Renderable} node index, renderNode or ViewSequence
+     * @param {Number|LinkedListViewSequence|Renderable} node index, renderNode or LinkedListViewSequence
      * @return {ScrollController} this
      */
     ScrollController.prototype.ensureVisible = function(node) {
 
         // Convert argument into renderNode
-        if (node instanceof ViewSequence) {
+        if (node instanceof LinkedListViewSequence) {
             node = node.get();
         }
         else if ((node instanceof Number) || (typeof node === 'number')) {
@@ -5257,6 +5606,18 @@ define('famous-flex/ScrollController',['require','exports','module','./LayoutUti
         // Determine start & end
         var scrollStart = 0 - Math.max(this.options.extraBoundsSpace[0], 1);
         var scrollEnd = size[this._direction] + Math.max(this.options.extraBoundsSpace[1], 1);
+        if (this.options.paginated && (this.options.paginationMode === PaginationMode.PAGE)) {
+            scrollStart = scrollOffset - this.options.extraBoundsSpace[0];
+            scrollEnd = scrollOffset + size[this._direction] + this.options.extraBoundsSpace[1];
+            if ((scrollOffset + size[this._direction]) < 0) {
+                scrollStart += size[this._direction];
+                scrollEnd += size[this._direction];
+            }
+            else if ((scrollOffset - size[this._direction]) > 0) {
+                scrollStart -= size[this._direction];
+                scrollEnd -= size[this._direction];
+            }
+        }
         if (this.options.layoutAll) {
             scrollStart = -1000000;
             scrollEnd = 1000000;
@@ -5724,7 +6085,7 @@ define('famous-flex/layouts/ListLayout',['require','exports','module','famous/ut
             //
             // Get node size
             //
-            nodeSize = getItemSize ? getItemSize(node.renderNode) : itemSize;
+            nodeSize = getItemSize ? getItemSize(node.renderNode, context.size) : itemSize;
             nodeSize = (nodeSize === true) ? context.resolveSize(node, size)[direction] : nodeSize;
 
             //
@@ -5781,7 +6142,7 @@ define('famous-flex/layouts/ListLayout',['require','exports','module','famous/ut
             //
             // Get node size
             //
-            nodeSize = getItemSize ? getItemSize(node.renderNode) : itemSize;
+            nodeSize = getItemSize ? getItemSize(node.renderNode, context.size) : itemSize;
             nodeSize = (nodeSize === true) ? context.resolveSize(node, size)[direction] : nodeSize;
 
             //
@@ -6006,7 +6367,7 @@ define('famous-flex/FlexScrollView',['require','exports','module','./LayoutUtili
      *
      * This function is a shim provided for compatibility with the stock famo.us Scrollview.
      *
-     * @param {Array|ViewSequence} node Either an array of renderables or a Famous viewSequence.
+     * @param {Array|LinkedListViewSequence} node Either an array of renderables or a viewSequence.
      * @return {FlexScrollView} this
      */
     FlexScrollView.prototype.sequenceFrom = function(node) {
@@ -6018,7 +6379,7 @@ define('famous-flex/FlexScrollView',['require','exports','module','./LayoutUtili
      *
      * This function is a shim provided for compatibility with the stock famo.us Scrollview.
      *
-     * @return {Number} The current index of the ViewSequence
+     * @return {Number} Index of the first visible renderable.
      */
     FlexScrollView.prototype.getCurrentIndex = function() {
         var item = this.getFirstVisibleItem();
@@ -6736,6 +7097,26 @@ define('famous-flex/VirtualViewSequence',['require','exports','module','famous/c
         }
     };
 
+    /**
+     * Not supported
+     * @private
+     */
+    VirtualViewSequence.prototype.insert = function() {
+        if (console.error) {
+            console.error('VirtualViewSequence.insert is not supported and should not be called');
+        }
+    };
+
+    /**
+     * Not supported
+     * @private
+     */
+    VirtualViewSequence.prototype.remove = function() {
+        if (console.error) {
+            console.error('VirtualViewSequence.remove is not supported and should not be called');
+        }
+    };
+
     module.exports = VirtualViewSequence;
 });
 
@@ -9755,18 +10136,18 @@ define('famous-flex/layouts/CollectionLayout',['require','exports','module','fam
  *
  * @author: Hein Rutjes (IjzerenHein)
  * @license MIT
- * @copyright Gloey Apps, 2014
+ * @copyright Gloey Apps, 2015
  */
 
 /**
- * Lays a collection of renderables from left to right, and when the right edge is reached,
- * continues at the left of the next line.
+ * Lays out renderables in scrollable coverflow.
  *
  * |options|type|description|
  * |---|---|---|
  * |`itemSize`|Size|Size of an item to layout|
- * |`[gutter]`|Size|Gutter-space between renderables|
- *
+ * |`zOffset`|Size|Z-space offset for all the renderables except the current 'selected' renderable|
+ * |`itemAngle`|Angle|Angle of the renderables, in radians|
+ * |`[radialOpacity]`|Number|Opacity (0..1) at the edges of the layout (default: 1).|
  * Example:
  *
  * ```javascript
@@ -9775,9 +10156,10 @@ define('famous-flex/layouts/CollectionLayout',['require','exports','module','fam
  * new LayoutController({
  *   layout: CoverLayout,
  *   layoutOptions: {
- *     itemSize: [100, 100],  // item has width and height of 100 pixels
- *     gutter: [5, 5],        // gutter of 5 pixels in between cells
- *     justify: true          // justify the items neatly across the whole width and height
+ *        itemSize: 400,
+ *        zOffset: 400,      // z-space offset for all the renderables except the current 'selected' renderable
+ *        itemAngle: 0.78,   // Angle of the renderables, in radians
+ *        radialOpacity: 1   // make items at the edges more transparent
  *   },
  *   dataSource: [
  *     new Surface({content: 'item 1'}),
@@ -9796,94 +10178,115 @@ define('famous-flex/layouts/CoverLayout',['require','exports','module','famous/u
     // Define capabilities of this layout function
     var capabilities = {
         sequence: true,
-        direction: [Utility.Direction.X, Utility.Direction.Y],
+        direction: [Utility.Direction.Y, Utility.Direction.X],
         scrolling: true,
+        trueSize: true,
         sequentialScrollingOptimized: false
     };
 
-    function CoverLayout(context, options) {
+    // Data
+    var size;
+    var direction;
+    var revDirection;
+    var node;
+    var itemSize;
+    var offset;
+    var bound;
+    var angle;
+    var itemAngle;
+    var radialOpacity;
+    var zOffset;
+    var set = {
+        opacity: 1,
+        size: [0, 0],
+        translate: [0, 0, 0],
+        rotate: [0, 0, 0],
+        origin: [0.5, 0.5],
+        align: [0.5, 0.5],
+        scrollLength: undefined
+    };
 
-        // Get first renderable
-        var node = context.next();
-        if (!node) {
-            return;
-        }
+    /**
+     * CoverLayout
+     */
+    function CoverLayout(context, options) {
 
+        //
         // Prepare
-        var size = context.size;
-        var direction = context.direction;
-        var itemSize = options.itemSize;
-        var opacityStep = 0.2;
-        var scaleStep = 0.1;
-        var translateStep = 30;
-        var zStart = 100;
-
-        // Layout the first renderable in the center
-        context.set(node, {
-            size: itemSize,
-            origin: [0.5, 0.5],
-            align: [0.5, 0.5],
-            translate: [0, 0, zStart],
-            scrollLength: itemSize[direction]
-        });
-
-        // Layout renderables
-        var translate = itemSize[0] / 2;
-        var opacity = 1 - opacityStep;
-        var zIndex = zStart - 1;
-        var scale = 1 - scaleStep;
-        var prev = false;
-        var endReached = false;
-        node = context.next();
-        if (!node) {
-            node = context.prev();
-            prev = true;
-        }
-        while (node) {
+        //
+        size = context.size;
+        zOffset = options.zOffset;
+        itemAngle = options.itemAngle;
+        direction = context.direction;
+        revDirection = direction ? 0 : 1;
+        itemSize = options.itemSize || (size[direction] / 2);
+        radialOpacity = (options.radialOpacity === undefined) ? 1 : options.radialOpacity;
 
-            // Layout next node
-            context.set(node, {
-                size: itemSize,
-                origin: [0.5, 0.5],
-                align: [0.5, 0.5],
-                translate: direction ? [0, prev ? -translate : translate, zIndex] : [prev ? -translate : translate, 0, zIndex],
-                scale: [scale, scale, 1],
-                opacity: opacity,
-                scrollLength: itemSize[direction]
-            });
-            opacity -= opacityStep;
-            scale -= scaleStep;
-            translate += translateStep;
-            zIndex--;
+        //
+        // reset size & translation
+        //
+        set.opacity = 1;
+        set.size[0] = size[0];
+        set.size[1] = size[1];
+        set.size[revDirection] = itemSize;
+        set.size[direction] = itemSize;
+        set.translate[0] = 0;
+        set.translate[1] = 0;
+        set.translate[2] = 0;
+        set.rotate[0] = 0;
+        set.rotate[1] = 0;
+        set.rotate[2] = 0;
+        set.scrollLength = itemSize;
 
-            // Check if the end is reached
-            if (translate >= (size[direction]/2)) {
-                endReached = true;
+        //
+        // process next nodes
+        //
+        offset = context.scrollOffset;
+        bound = (((Math.PI / 2) / itemAngle) * itemSize) + itemSize;
+        while (offset <= bound) {
+            node = context.next();
+            if (!node) {
+                break;
             }
-            else {
-                node = prev ? context.prev() : context.next();
-                endReached = !node;
+            if (offset >= -bound) {
+                set.translate[direction] = offset;
+                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
+                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
+                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
+                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
+                }
+                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
+                context.set(node, set);
             }
+            offset += itemSize;
+        }
 
-            // When end is reached for next, start processing prev
-            if (endReached) {
-                if (prev) {
-                    break;
-                }
-                endReached = false;
-                prev = true;
-                node = context.prev();
-                if (node) {
-                    translate = (itemSize[direction] / 2);
-                    opacity = 1 - opacityStep;
-                    zIndex = zStart - 1;
-                    scale = 1 - scaleStep;
+        //
+        // process previous nodes
+        //
+        offset = context.scrollOffset - itemSize;
+        while (offset >= -bound) {
+            node = context.prev();
+            if (!node) {
+                break;
+            }
+            if (offset <= bound) {
+                set.translate[direction] = offset;
+                set.translate[2] = Math.abs(offset) > itemSize ? -zOffset : -(Math.abs(offset) * (zOffset / itemSize));
+                set.rotate[revDirection] = Math.abs(offset) > itemSize ? itemAngle : (Math.abs(offset) * (itemAngle / itemSize));
+                if (((offset > 0) && !direction) || ((offset < 0) && direction)) {
+                    set.rotate[revDirection] = 0 - set.rotate[revDirection];
                 }
+                set.opacity = 1 - ((Math.abs(angle) / (Math.PI / 2)) * (1 - radialOpacity));
+                context.set(node, set);
             }
+            offset -= itemSize;
         }
     }
 
     CoverLayout.Capabilities = capabilities;
+    CoverLayout.Name = 'CoverLayout';
+    CoverLayout.Description = 'CoverLayout';
     module.exports = CoverLayout;
 });
 
diff --git a/dist/famous-flex.min.js b/dist/famous-flex.min.js
index e02b87c..3a2dc6f 100644
--- a/dist/famous-flex.min.js
+++ b/dist/famous-flex.min.js
@@ -8,10 +8,10 @@
 * @copyright Gloey Apps, 2014/2015
 *
 * @library famous-flex
-* @version 0.3.5
-* @generated 07-09-2015
+* @version 0.3.6
+* @generated 09-11-2015
 */
-define("famous-flex/LayoutUtility",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(){}function e(a,b){if(a===b)return!0;if(void 0===a||void 0===b)return!1;var c=a.length;if(c!==b.length)return!1;for(;c--;)if(a[c]!==b[c])return!1;return!0}var f=a("famous/utilities/Utility");d.registeredHelpers={};var g={SEQUENCE:1,DIRECTION_X:2,DIRECTION_Y:4,SCROLLING:8};d.Capabilities=g,d.normalizeMargins=function(a){return a?Array.isArray(a)?0===a.length?[0,0,0,0]:1===a.length?[a[0],a[0],a[0],a[0]]:2===a.length?[a[0],a[1],a[0],a[1]]:a:[a,a,a,a]:[0,0,0,0]},d.cloneSpec=function(a){var b={};return void 0!==a.opacity&&(b.opacity=a.opacity),void 0!==a.size&&(b.size=a.size.slice(0)),void 0!==a.transform&&(b.transform=a.transform.slice(0)),void 0!==a.origin&&(b.origin=a.origin.slice(0)),void 0!==a.align&&(b.align=a.align.slice(0)),b},d.isEqualSpec=function(a,b){return a.opacity!==b.opacity?!1:e(a.size,b.size)&&e(a.transform,b.transform)&&e(a.origin,b.origin)&&e(a.align,b.align)?!0:!1},d.getSpecDiffText=function(a,b){var c="spec diff:";return a.opacity!==b.opacity&&(c+="\nopacity: "+a.opacity+" != "+b.opacity),e(a.size,b.size)||(c+="\nsize: "+JSON.stringify(a.size)+" != "+JSON.stringify(b.size)),e(a.transform,b.transform)||(c+="\ntransform: "+JSON.stringify(a.transform)+" != "+JSON.stringify(b.transform)),e(a.origin,b.origin)||(c+="\norigin: "+JSON.stringify(a.origin)+" != "+JSON.stringify(b.origin)),e(a.align,b.align)||(c+="\nalign: "+JSON.stringify(a.align)+" != "+JSON.stringify(b.align)),c},d.error=function(a){throw console.log("ERROR: "+a),a},d.warning=function(a){console.log("WARNING: "+a)},d.log=function(a){for(var b="",c=0;c<arguments.length;c++){var d=arguments[c];b+=d instanceof Object||d instanceof Array?JSON.stringify(d):d}console.log(b)},d.combineOptions=function(a,b,c){if(a&&!b&&!c)return a;if(!a&&b&&!c)return b;var d=f.clone(a||{});if(b)for(var e in b)d[e]=b[e];return d},d.registerHelper=function(a,b){b.prototype.parse||d.error('The layout-helper for name "'+a+'" is required to support the "parse" method'),void 0!==this.registeredHelpers[a]&&d.warning('A layout-helper with the name "'+a+'" is already registered and will be overwritten'),this.registeredHelpers[a]=b},d.unregisterHelper=function(a){delete this.registeredHelpers[a]},d.getRegisteredHelper=function(a){return this.registeredHelpers[a]},c.exports=d}),define("famous-flex/LayoutContext",["require","exports","module"],function(a,b,c){function d(a){for(var b in a)this[b]=a[b]}d.prototype.size=void 0,d.prototype.direction=void 0,d.prototype.scrollOffset=void 0,d.prototype.scrollStart=void 0,d.prototype.scrollEnd=void 0,d.prototype.next=function(){},d.prototype.prev=function(){},d.prototype.get=function(a){},d.prototype.set=function(a,b){},d.prototype.resolveSize=function(a){},c.exports=d}),define("famous-flex/LayoutNodeManager",["require","exports","module","./LayoutContext","./LayoutUtility","famous/core/Surface","famous/core/RenderNode"],function(a,b,c){function d(a,b){this.LayoutNode=a,this._initLayoutNodeFn=b,this._layoutCount=0,this._context=new m({next:g.bind(this),prev:h.bind(this),get:i.bind(this),set:j.bind(this),resolveSize:l.bind(this),size:[0,0]}),this._contextState={},this._pool={layoutNodes:{size:0},resolveSize:[0,0]}}function e(a){a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._first=a._next,a.destroy(),this._pool.layoutNodes.size<q&&(this._pool.layoutNodes.size++,a._prev=void 0,a._next=this._pool.layoutNodes.first,this._pool.layoutNodes.first=a)}function f(a,b){var c,d=this._contextState;if(!d.start){for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c||(c=this.createNode(a),c._next=this._first,this._first&&(this._first._prev=c),this._first=c),d.start=c,d.startPrev=b,d.prev=c,d.next=c,c}if(b){if(d.prev._prev&&d.prev._prev.renderNode===a)return d.prev=d.prev._prev,d.prev}else if(d.next._next&&d.next._next.renderNode===a)return d.next=d.next._next,d.next;for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c?(c._next&&(c._next._prev=c._prev),c._prev?c._prev._next=c._next:this._first=c._next,c._next=void 0,c._prev=void 0):c=this.createNode(a),b?(d.prev._prev?(c._prev=d.prev._prev,d.prev._prev._next=c):this._first=c,d.prev._prev=c,c._next=d.prev,d.prev=c):(d.next._next&&(c._next=d.next._next,d.next._next._prev=c),d.next._next=c,c._prev=d.next,d.next=c),c}function g(){if(!this._contextState.nextSequence)return void 0;if(this._context.reverse&&(this._contextState.nextSequence=this._contextState.nextSequence.getNext(),!this._contextState.nextSequence))return void 0;var a=this._contextState.nextSequence.get();if(!a)return void(this._contextState.nextSequence=void 0);var b=this._contextState.nextSequence;if(this._context.reverse||(this._contextState.nextSequence=this._contextState.nextSequence.getNext()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,next:!0,index:++this._contextState.nextGetIndex}}function h(){if(!this._contextState.prevSequence)return void 0;if(!this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious(),!this._contextState.prevSequence))return void 0;var a=this._contextState.prevSequence.get();if(!a)return void(this._contextState.prevSequence=void 0);var b=this._contextState.prevSequence;if(this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,prev:!0,index:--this._contextState.prevGetIndex}}function i(a){if(this._nodesById&&(a instanceof String||"string"==typeof a)){var b=this._nodesById[a];if(!b)return void 0;if(b instanceof Array){for(var c=[],d=0,e=b.length;e>d;d++)c.push({renderNode:b[d],arrayElement:!0});return c}return{renderNode:b,byId:!0}}return a}function j(a,b){var c=this._nodesById?i.call(this,a):a;if(c){var d=c.node;d||(c.next?(c.index<this._contextState.nextSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.nextSetIndex=c.index):c.prev&&(c.index>this._contextState.prevSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.prevSetIndex=c.index),d=f.call(this,c.renderNode,c.prev),d._viewSequence=c.viewSequence,d._layoutCount++,1===d._layoutCount&&this._contextState.addCount++,c.node=d),d.usesTrueSize=c.usesTrueSize,d.trueSizeRequested=c.trueSizeRequested,d.set(b,this._context.size),c.set=b}return b}function k(a){if(a instanceof p){var b=null,c=a.get();if(c&&(b=k(c)))return b;if(a._child)return k(a._child)}else{if(a instanceof o)return a.size?{renderNode:a,size:a.size}:void 0;if(a.options&&a.options.size)return{renderNode:a,size:a.options.size}}return void 0}function l(a,b){var c=this._nodesById?i.call(this,a):a,d=this._pool.resolveSize;if(!c)return d[0]=0,d[1]=0,d;var e=c.renderNode,f=e.getSize();if(!f)return b;var g=k(e);if(g&&(g.size[0]===!0||g.size[1]===!0))if(c.usesTrueSize=!0,g.renderNode instanceof o){var h=g.renderNode._backupSize;if((g.renderNode._contentDirty||g.renderNode._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),g.renderNode._trueSizeCheck&&h&&g.size!==f){var j=g.size[0]===!0?Math.max(h[0],f[0]):f[0],l=g.size[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=l,f=h,g.renderNode._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(g.renderNode._trueSizeCheck=!0,g.renderNode._sizeDirty=!0,this._trueSizeRequested=!0),h||(g.renderNode._backupSize=[0,0],h=g.renderNode._backupSize),h[0]=f[0],h[1]=f[1]}else g.renderNode._nodes&&(this._reevalTrueSize||g.renderNode._nodes._trueSizeRequested)&&(c.trueSizeRequested=!0,this._trueSizeRequested=!0);return(void 0===f[0]||f[0]===!0||void 0===f[1]||f[1]===!0)&&(d[0]=f[0],d[1]=f[1],f=d,void 0===f[0]?f[0]=b[0]:f[0]===!0&&(f[0]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0),void 0===f[1]?f[1]=b[1]:f[1]===!0&&(f[1]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0)),f}var m=a("./LayoutContext"),n=a("./LayoutUtility"),o=a("famous/core/Surface"),p=a("famous/core/RenderNode"),q=100;d.prototype.prepareForLayout=function(a,b,c){for(var d=this._first;d;)d.reset(),d=d._next;var e=this._context;this._layoutCount++,this._nodesById=b,this._trueSizeRequested=!1,this._reevalTrueSize=c.reevalTrueSize||!e.size||e.size[0]!==c.size[0]||e.size[1]!==c.size[1];var f=this._contextState;return f.startSequence=a,f.nextSequence=a,f.prevSequence=a,f.start=void 0,f.nextGetIndex=0,f.prevGetIndex=0,f.nextSetIndex=0,f.prevSetIndex=0,f.addCount=0,f.removeCount=0,f.lastRenderNode=void 0,e.size[0]=c.size[0],e.size[1]=c.size[1],e.direction=c.direction,e.reverse=c.reverse,e.alignment=c.reverse?1:0,e.scrollOffset=c.scrollOffset||0,e.scrollStart=c.scrollStart||0,e.scrollEnd=c.scrollEnd||e.size[e.direction],e},d.prototype.removeNonInvalidatedNodes=function(a){for(var b=this._first;b;)b._invalidated||b._removing||b.remove(a),b=b._next},d.prototype.removeVirtualViewSequenceNodes=function(){this._contextState.startSequence&&this._contextState.startSequence.cleanup&&this._contextState.startSequence.cleanup()},d.prototype.buildSpecAndDestroyUnrenderedNodes=function(a){for(var b=[],c={specs:b,modified:!1},d=this._first;d;){var f=d._specModified,g=d.getSpec();if(g.removed){var h=d;d=d._next,e.call(this,h),c.modified=!0}else f&&(g.transform&&a&&(g.transform[12]+=a[0],g.transform[13]+=a[1],g.transform[14]+=a[2],g.transform[12]=Math.round(1e5*g.transform[12])/1e5,g.transform[13]=Math.round(1e5*g.transform[13])/1e5,g.endState&&(g.endState.transform[12]+=a[0],g.endState.transform[13]+=a[1],g.endState.transform[14]+=a[2],g.endState.transform[12]=Math.round(1e5*g.endState.transform[12])/1e5,g.endState.transform[13]=Math.round(1e5*g.endState.transform[13])/1e5)),c.modified=!0),g.usesTrueSize=d.usesTrueSize,g.trueSizeRequested=d.trueSizeRequested,b.push(g),d=d._next}return this._contextState.addCount=0,this._contextState.removeCount=0,c},d.prototype.getNodeByRenderNode=function(a){for(var b=this._first;b;){if(b.renderNode===a)return b;b=b._next}return void 0},d.prototype.insertNode=function(a){a._next=this._first,this._first&&(this._first._prev=a),this._first=a},d.prototype.setNodeOptions=function(a){this._nodeOptions=a;for(var b=this._first;b;)b.setOptions(a),b=b._next;for(b=this._pool.layoutNodes.first;b;)b.setOptions(a),b=b._next},d.prototype.preallocateNodes=function(a,b){for(var c=[],d=0;a>d;d++)c.push(this.createNode(void 0,b));for(d=0;a>d;d++)e.call(this,c[d])},d.prototype.createNode=function(a,b){var c;return this._pool.layoutNodes.first?(c=this._pool.layoutNodes.first,this._pool.layoutNodes.first=c._next,this._pool.layoutNodes.size--,c.constructor.apply(c,arguments)):(c=new this.LayoutNode(a,b),this._nodeOptions&&c.setOptions(this._nodeOptions)),c._prev=void 0,c._next=void 0,c._viewSequence=void 0,c._layoutCount=0,this._initLayoutNodeFn&&this._initLayoutNodeFn.call(this,c,b),c},d.prototype.removeAll=function(){for(var a=this._first;a;){var b=a._next;e.call(this,a),a=b}this._first=void 0},d.prototype.getStartEnumNode=function(a){return void 0===a?this._first:a===!0?this._contextState.start&&this._contextState.startPrev?this._contextState.start._next:this._contextState.start:a===!1?this._contextState.start&&!this._contextState.startPrev?this._contextState.start._prev:this._contextState.start:void 0},c.exports=d}),define("famous-flex/LayoutNode",["require","exports","module","famous/core/Transform","./LayoutUtility"],function(a,b,c){function d(a,b){this.renderNode=a,this._spec=b?f.cloneSpec(b):{},this._spec.renderNode=a,this._specModified=!0,this._invalidated=!1,this._removing=!1}var e=a("famous/core/Transform"),f=a("./LayoutUtility");d.prototype.setRenderNode=function(a){this.renderNode=a,this._spec.renderNode=a},d.prototype.setOptions=function(a){},d.prototype.destroy=function(){this.renderNode=void 0,this._spec.renderNode=void 0,this._viewSequence=void 0},d.prototype.reset=function(){this._invalidated=!1,this.trueSizeRequested=!1},d.prototype.setSpec=function(a){if(this._specModified=!0,a.align?(a.align||(this._spec.align=[0,0]),this._spec.align[0]=a.align[0],this._spec.align[1]=a.align[1]):this._spec.align=void 0,a.origin?(a.origin||(this._spec.origin=[0,0]),this._spec.origin[0]=a.origin[0],this._spec.origin[1]=a.origin[1]):this._spec.origin=void 0,a.size?(a.size||(this._spec.size=[0,0]),this._spec.size[0]=a.size[0],this._spec.size[1]=a.size[1]):this._spec.size=void 0,a.transform)if(a.transform)for(var b=0;16>b;b++)this._spec.transform[b]=a.transform[b];else this._spec.transform=a.transform.slice(0);else this._spec.transform=void 0;this._spec.opacity=a.opacity},d.prototype.set=function(a,b){this._invalidated=!0,this._specModified=!0,this._removing=!1;var c=this._spec;c.opacity=a.opacity,a.size?(c.size||(c.size=[0,0]),c.size[0]=a.size[0],c.size[1]=a.size[1]):c.size=void 0,a.origin?(c.origin||(c.origin=[0,0]),c.origin[0]=a.origin[0],c.origin[1]=a.origin[1]):c.origin=void 0,a.align?(c.align||(c.align=[0,0]),c.align[0]=a.align[0],c.align[1]=a.align[1]):c.align=void 0,a.skew||a.rotate||a.scale?this._spec.transform=e.build({translate:a.translate||[0,0,0],skew:a.skew||[0,0,0],scale:a.scale||[1,1,1],rotate:a.rotate||[0,0,0]}):a.translate?this._spec.transform=e.translate(a.translate[0],a.translate[1],a.translate[2]):this._spec.transform=void 0,this.scrollLength=a.scrollLength},d.prototype.getSpec=function(){return this._specModified=!1,this._spec.removed=!this._invalidated,this._spec},d.prototype.remove=function(a){this._removing=!0},c.exports=d}),define("famous-flex/FlowLayoutNode",["require","exports","module","famous/core/OptionsManager","famous/core/Transform","famous/math/Vector","famous/physics/bodies/Particle","famous/physics/forces/Spring","famous/physics/PhysicsEngine","./LayoutNode","famous/transitions/Transitionable"],function(a,b,c){function d(a,b){if(o.apply(this,arguments),this.options||(this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this._optionsManager=new i(this.options)),this._pe||(this._pe=new n,this._pe.sleep()),this._properties)for(var c in this._properties)this._properties[c].init=!1;else this._properties={};this._lockTransitionable?(this._lockTransitionable.halt(),this._lockTransitionable.reset(1)):this._lockTransitionable=new p(1),this._specModified=!0,this._initial=!0,this._spec.endState={},b&&this.setSpec(b)}function e(a,b,c,d){return a&&a.init?[a.enabled[0]?Math.round((a.curState.x+(a.endState.x-a.curState.x)*d)/c)*c:a.endState.x,a.enabled[1]?Math.round((a.curState.y+(a.endState.y-a.curState.y)*d)/c)*c:a.endState.y,a.enabled[2]?Math.round((a.curState.z+(a.endState.z-a.curState.z)*d)/c)*c:a.endState.z]:b}function f(a,b,c,d,e,f){if(a=a||this._properties[b],a&&a.init){a.invalidated=!0;var g=d;return void 0!==c?g=c:this._removing&&(g=a.particle.getPosition()),a.endState.x=g[0],a.endState.y=g.length>1?g[1]:0,a.endState.z=g.length>2?g[2]:0,void(e?(a.curState.x=a.endState.x,a.curState.y=a.endState.y,a.curState.z=a.endState.z,a.velocity.x=0,a.velocity.y=0,a.velocity.z=0):(a.endState.x!==a.curState.x||a.endState.y!==a.curState.y||a.endState.z!==a.curState.z)&&this._pe.wake())}var h=this._pe.isSleeping();a?(a.particle.setPosition(this._initial||e?c:d),a.endState.set(c)):(a={particle:new l({position:this._initial||e?c:d}),endState:new k(c)},a.curState=a.particle.position,a.velocity=a.particle.velocity,a.force=new m(this.options.spring),a.force.setOptions({anchor:a.endState}),this._pe.addBody(a.particle),a.forceId=this._pe.attach(a.force,a.particle),this._properties[b]=a),this._initial||e?h&&this._pe.sleep():this._pe.wake(),this.options.properties[b]&&this.options.properties[b].length?a.enabled=this.options.properties[b]:a.enabled=[this.options.properties[b],this.options.properties[b],this.options.properties[b]],a.init=!0,a.invalidated=!0}function g(a,b){return a[0]===b[0]&&a[1]===b[1]?void 0:a}function h(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]?void 0:a}var i=a("famous/core/OptionsManager"),j=a("famous/core/Transform"),k=a("famous/math/Vector"),l=a("famous/physics/bodies/Particle"),m=a("famous/physics/forces/Spring"),n=a("famous/physics/PhysicsEngine"),o=a("./LayoutNode"),p=a("famous/transitions/Transitionable");d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.DEFAULT_OPTIONS={spring:{dampingRatio:.8,period:300},properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},particleRounding:.001};var q={opacity:1,opacity2D:[1,0],size:[0,0],origin:[0,0],align:[0,0],scale:[1,1,1],translate:[0,0,0],rotate:[0,0,0],skew:[0,0,0]};d.prototype.setOptions=function(a){this._optionsManager.setOptions(a);var b=this._pe.isSleeping();for(var c in this._properties){var d=this._properties[c];a.spring&&d.force&&d.force.setOptions(this.options.spring),a.properties&&void 0!==a.properties[c]&&(this.options.properties[c].length?d.enabled=this.options.properties[c]:d.enabled=[this.options.properties[c],this.options.properties[c],this.options.properties[c]])}return b&&this._pe.sleep(),this},d.prototype.setSpec=function(a){var b;a.transform&&(b=j.interpret(a.transform)),b||(b={}),b.opacity=a.opacity,b.size=a.size,b.align=a.align,b.origin=a.origin;var c=this._removing,d=this._invalidated;this.set(b),this._removing=c,this._invalidated=d},d.prototype.reset=function(){if(this._invalidated){for(var a in this._properties)this._properties[a].invalidated=!1;this._invalidated=!1}this.trueSizeRequested=!1,this.usesTrueSize=!1},d.prototype.remove=function(a){this._removing=!0,a?this.setSpec(a):(this._pe.sleep(),this._specModified=!1),this._invalidated=!1},d.prototype.releaseLock=function(a){this._lockTransitionable.halt(),this._lockTransitionable.reset(0),a&&this._lockTransitionable.set(1,{duration:this.options.spring.period||1e3})},d.prototype.getSpec=function(){var a=this._pe.isSleeping();if(!this._specModified&&a)return this._spec.removed=!this._invalidated,this._spec;this._initial=!1,this._specModified=!a,this._spec.removed=!1,a||this._pe.step();var b=this._spec,c=this.options.particleRounding,d=this._lockTransitionable.get(),f=this._properties.opacity;f&&f.init?(b.opacity=f.enabled[0]?Math.round(Math.max(0,Math.min(1,f.curState.x))/c)*c:f.endState.x,b.endState.opacity=f.endState.x):(b.opacity=void 0,b.endState.opacity=void 0),f=this._properties.size,f&&f.init?(b.size=b.size||[0,0],b.size[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.size[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.size=b.endState.size||[0,0],b.endState.size[0]=f.endState.x,b.endState.size[1]=f.endState.y):(b.size=void 0,b.endState.size=void 0),f=this._properties.align,f&&f.init?(b.align=b.align||[0,0],b.align[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.align[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.align=b.endState.align||[0,0],b.endState.align[0]=f.endState.x,b.endState.align[1]=f.endState.y):(b.align=void 0,b.endState.align=void 0),f=this._properties.origin,f&&f.init?(b.origin=b.origin||[0,0],b.origin[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.origin[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.origin=b.endState.origin||[0,0],b.endState.origin[0]=f.endState.x,b.endState.origin[1]=f.endState.y):(b.origin=void 0,b.endState.origin=void 0);var g,h,i,k=this._properties.translate;k&&k.init?(g=k.enabled[0]?Math.round((k.curState.x+(k.endState.x-k.curState.x)*d)/c)*c:k.endState.x,h=k.enabled[1]?Math.round((k.curState.y+(k.endState.y-k.curState.y)*d)/c)*c:k.endState.y,i=k.enabled[2]?Math.round((k.curState.z+(k.endState.z-k.curState.z)*d)/c)*c:k.endState.z):(g=0,h=0,i=0);var l=this._properties.scale,m=this._properties.skew,n=this._properties.rotate;return l||m||n?(b.transform=j.build({translate:[g,h,i],skew:e.call(this,m,q.skew,this.options.particleRounding,d),scale:e.call(this,l,q.scale,this.options.particleRounding,d),rotate:e.call(this,n,q.rotate,this.options.particleRounding,d)}),b.endState.transform=j.build({translate:k?[k.endState.x,k.endState.y,k.endState.z]:q.translate,scale:l?[l.endState.x,l.endState.y,l.endState.z]:q.scale,skew:m?[m.endState.x,m.endState.y,m.endState.z]:q.skew,rotate:n?[n.endState.x,n.endState.y,n.endState.z]:q.rotate})):k?(b.transform?(b.transform[12]=g,b.transform[13]=h,b.transform[14]=i):b.transform=j.translate(g,h,i),b.endState.transform?(b.endState.transform[12]=k.endState.x,b.endState.transform[13]=k.endState.y,b.endState.transform[14]=k.endState.z):b.endState.transform=j.translate(k.endState.x,k.endState.y,k.endState.z)):(b.transform=void 0,b.endState.transform=void 0),this._spec},d.prototype.set=function(a,b){b&&(this._removing=!1),this._invalidated=!0,this.scrollLength=a.scrollLength,this._specModified=!0;var c=this._properties.opacity,d=a.opacity===q.opacity?void 0:a.opacity;(void 0!==d||c&&c.init)&&f.call(this,c,"opacity",void 0===d?void 0:[d,0],q.opacity2D),c=this._properties.align,d=a.align?g(a.align,q.align):void 0,(d||c&&c.init)&&f.call(this,c,"align",d,q.align),c=this._properties.origin,d=a.origin?g(a.origin,q.origin):void 0,(d||c&&c.init)&&f.call(this,c,"origin",d,q.origin),c=this._properties.size,d=a.size||b,(d||c&&c.init)&&f.call(this,c,"size",d,b,this.usesTrueSize),c=this._properties.translate,d=a.translate,(d||c&&c.init)&&f.call(this,c,"translate",d,q.translate,void 0,!0),c=this._properties.scale,d=a.scale?h(a.scale,q.scale):void 0,(d||c&&c.init)&&f.call(this,c,"scale",d,q.scale),c=this._properties.rotate,d=a.rotate?h(a.rotate,q.rotate):void 0,(d||c&&c.init)&&f.call(this,c,"rotate",d,q.rotate),c=this._properties.skew,d=a.skew?h(a.skew,q.skew):void 0,(d||c&&c.init)&&f.call(this,c,"skew",d,q.skew)},c.exports=d}),define("famous-flex/helpers/LayoutDockHelper",["require","exports","module","../LayoutUtility"],function(a,b,c){function d(a,b){var c=a.size;if(this._size=c,this._context=a,this._options=b,this._data={z:b&&b.translateZ?b.translateZ:0},b&&b.margins){var d=e.normalizeMargins(b.margins);this._data.left=d[3],this._data.top=d[0],this._data.right=c[0]-d[1],this._data.bottom=c[1]-d[2]}else this._data.left=0,this._data.top=0,this._data.right=c[0],this._data.bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=c.length>=3?c[2]:void 0;"top"===c[0]?this.top(c[1],d,c.length>=4?c[3]:void 0):"left"===c[0]?this.left(c[1],d,c.length>=4?c[3]:void 0):"right"===c[0]?this.right(c[1],d,c.length>=4?c[3]:void 0):"bottom"===c[0]?this.bottom(c[1],d,c.length>=4?c[3]:void 0):"fill"===c[0]?this.fill(c[1],c.length>=3?c[2]:void 0):"margins"===c[0]&&this.margins(c[1])}},d.prototype.top=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.top+=b,this},d.prototype.left=function(a,b,c){if(b instanceof Array&&(b=b[0]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}return this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.left+=b,this},d.prototype.bottom=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,1],align:[0,1],translate:[this._data.left,-(this._size[1]-this._data.bottom),void 0===c?this._data.z:c]}),this._data.bottom-=b,this},d.prototype.right=function(a,b,c){if(b instanceof Array&&(b=b[0]),a){if(void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._data.right),this._data.top,void 0===c?this._data.z:c]})}return b&&(this._data.right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._data.right-this._data.left,this._data.bottom-this._data.top],translate:[this._data.left,this._data.top,void 0===b?this._data.z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._data.left+=a[3],this._data.top+=a[0],this._data.right-=a[1],this._data.bottom-=a[2],this},d.prototype.get=function(){return this._data},e.registerHelper("dock",d),c.exports=d}),define("famous-flex/LayoutController",["require","exports","module","famous/utilities/Utility","famous/core/Entity","famous/core/ViewSequence","famous/core/OptionsManager","famous/core/EventHandler","./LayoutUtility","./LayoutNodeManager","./LayoutNode","./FlowLayoutNode","famous/core/Transform","./helpers/LayoutDockHelper"],function(a,b,c){function d(a,b){this.id=k.register(this),this._isDirty=!0,this._contextSizeCache=[0,0],this._commitOutput={},this._cleanupRegistration={commit:function(){return void 0},cleanup:function(a){this.cleanup(a)}.bind(this)},this._cleanupRegistration.target=k.register(this._cleanupRegistration),this._cleanupRegistration.render=function(){return this.target}.bind(this._cleanupRegistration),this._eventInput=new n,n.setInputHandler(this,this._eventInput),this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput),this._layout={options:Object.create({})},this._layout.optionsManager=new m(this._layout.options),this._layout.optionsManager.on("change",function(){this._isDirty=!0}.bind(this)),this.options=Object.create(d.DEFAULT_OPTIONS),this._optionsManager=new m(this.options),b?this._nodes=b:a&&a.flow?this._nodes=new p(r,e.bind(this)):this._nodes=new p(q),this.setDirection(void 0),a&&this.setOptions(a)}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(a){var b=this._dataSource;if(b instanceof Array)for(var c=0,d=b.length;d>c;c++)a(b[c]);else if(b instanceof l)for(var e;b&&(e=b.get());)a(e),b=b.getNext();else for(var f in b)a(b[f])}function g(a){if(this._layout.capabilities&&this._layout.capabilities.direction){if(Array.isArray(this._layout.capabilities.direction)){for(var b=0;b<this._layout.capabilities.direction.length;b++)if(this._layout.capabilities.direction[b]===a)return a;return this._layout.capabilities.direction[0]}return this._layout.capabilities.direction}return void 0===a?j.Direction.Y:a}function h(a,b){var c=b||this._viewSequence,d=c?c.getIndex():a;if(a>d)for(;c;){if(c=c.getNext(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(d>a)return void 0}else if(d>a)for(;c;){if(c=c.getPrevious(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(a>d)return void 0}return c}function i(){return Array.isArray(this._dataSource)?this._dataSource:this._viewSequence||this._viewSequence._?this._viewSequence._.array:void 0}var j=a("famous/utilities/Utility"),k=a("famous/core/Entity"),l=a("famous/core/ViewSequence"),m=a("famous/core/OptionsManager"),n=a("famous/core/EventHandler"),o=a("./LayoutUtility"),p=a("./LayoutNodeManager"),q=a("./LayoutNode"),r=a("./FlowLayoutNode"),s=a("famous/core/Transform");a("./helpers/LayoutDockHelper"),d.DEFAULT_OPTIONS={flow:!1,flowOptions:{reflowOnResize:!0,properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},spring:{dampingRatio:.8,period:300}}},d.prototype.setOptions=function(a){return void 0!==a.alignment&&a.alignment!==this.options.alignment&&(this._isDirty=!0),this._optionsManager.setOptions(a),a.nodeSpring&&(console.warn("nodeSpring options have been moved inside `flowOptions`. Use `flowOptions.spring` instead."),this._optionsManager.setOptions({flowOptions:{spring:a.nodeSpring}}),this._nodes.setNodeOptions(this.options.flowOptions)),void 0!==a.reflowOnResize&&(console.warn("reflowOnResize options have been moved inside `flowOptions`. Use `flowOptions.reflowOnResize` instead."),this._optionsManager.setOptions({flowOptions:{reflowOnResize:a.reflowOnResize}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.insertSpec&&(console.warn("insertSpec options have been moved inside `flowOptions`. Use `flowOptions.insertSpec` instead."),this._optionsManager.setOptions({flowOptions:{insertSpec:a.insertSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.removeSpec&&(console.warn("removeSpec options have been moved inside `flowOptions`. Use `flowOptions.removeSpec` instead."),this._optionsManager.setOptions({flowOptions:{removeSpec:a.removeSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.dataSource&&this.setDataSource(a.dataSource),a.layout?this.setLayout(a.layout,a.layoutOptions):a.layoutOptions&&this.setLayoutOptions(a.layoutOptions),void 0!==a.direction&&this.setDirection(a.direction),a.flowOptions&&this.options.flow&&this._nodes.setNodeOptions(this.options.flowOptions),a.preallocateNodes&&this._nodes.preallocateNodes(a.preallocateNodes.count||0,a.preallocateNodes.spec),this},d.prototype.setDataSource=function(a){return this._dataSource=a,this._initialViewSequence=void 0,this._nodesById=void 0,a instanceof Array?(this._viewSequence=new l(a),this._initialViewSequence=this._viewSequence):a instanceof l||a.getNext?(this._viewSequence=a,this._initialViewSequence=a):a instanceof Object&&(this._nodesById=a),this.options.autoPipeEvents&&(this._dataSource.pipe?(this._dataSource.pipe(this),this._dataSource.pipe(this._eventOutput)):f.call(this,function(a){a&&a.pipe&&(a.pipe(this),a.pipe(this._eventOutput))}.bind(this))),this._isDirty=!0,this},d.prototype.getDataSource=function(){return this._dataSource},d.prototype.setLayout=function(a,b){if(a instanceof Function)this._layout._function=a,this._layout.capabilities=a.Capabilities,this._layout.literal=void 0;else if(a instanceof Object){this._layout.literal=a,this._layout.capabilities=void 0;var c=Object.keys(a)[0],d=o.getRegisteredHelper(c);this._layout._function=d?function(b,e){var f=new d(b,e);f.parse(a[c])}:void 0}else this._layout._function=void 0,this._layout.capabilities=void 0,this._layout.literal=void 0;return b&&this.setLayoutOptions(b),this.setDirection(this._configuredDirection),this._isDirty=!0,this},d.prototype.getLayout=function(){return this._layout.literal||this._layout._function},d.prototype.setLayoutOptions=function(a){return this._layout.optionsManager.setOptions(a),this},d.prototype.getLayoutOptions=function(){return this._layout.options},d.prototype.setDirection=function(a){this._configuredDirection=a;var b=g.call(this,a);b!==this._direction&&(this._direction=b,this._isDirty=!0)},d.prototype.getDirection=function(a){return a?this._direction:this._configuredDirection},d.prototype.getSpec=function(a,b,c){if(!a)return void 0;if(a instanceof String||"string"==typeof a){if(!this._nodesById)return void 0;if(a=this._nodesById[a],!a)return void 0;if(a instanceof Array)return a}if(this._specs)for(var d=0;d<this._specs.length;d++){var e=this._specs[d];if(e.renderNode===a){if(c&&e.endState&&(e=e.endState),b&&e.transform&&e.size&&(e.align||e.origin)){var f=e.transform;return e.align&&(e.align[0]||e.align[1])&&(f=s.thenMove(f,[e.align[0]*this._contextSizeCache[0],e.align[1]*this._contextSizeCache[1],0])),e.origin&&(e.origin[0]||e.origin[1])&&(f=s.moveThen([-e.origin[0]*e.size[0],-e.origin[1]*e.size[1],0],f)),{opacity:e.opacity,size:e.size,transform:f}}return e}}return void 0},d.prototype.reflowLayout=function(){return this._isDirty=!0,this},d.prototype.resetFlowState=function(){return this.options.flow&&(this._resetFlowState=!0),
-this},d.prototype.insert=function(a,b,c){if(a instanceof String||"string"==typeof a){if(void 0===this._dataSource&&(this._dataSource={},this._nodesById=this._dataSource),this._nodesById[a]===b)return this;this._nodesById[a]=b}else{void 0===this._dataSource&&(this._dataSource=[],this._viewSequence=new l(this._dataSource),this._initialViewSequence=this._viewSequence);var d=this._viewSequence||this._dataSource,e=i.call(this);if(e&&a===e.length&&(a=-1),-1===a)d.push(b);else if(0===a)if(d===this._viewSequence){if(d.splice(0,0,b),0===this._viewSequence.getIndex()){var f=this._viewSequence.getNext();f&&f.get()&&(this._viewSequence=f)}}else d.splice(0,0,b);else d.splice(a,0,b)}return c&&this._nodes.insertNode(this._nodes.createNode(b,c)),this.options.autoPipeEvents&&b&&b.pipe&&(b.pipe(this),b.pipe(this._eventOutput)),this._isDirty=!0,this},d.prototype.push=function(a,b){return this.insert(-1,a,b)},d.prototype.get=function(a){if(this._nodesById||a instanceof String||"string"==typeof a)return this._nodesById?this._nodesById[a]:void 0;var b=h.call(this,a);return b?b.get():void 0},d.prototype.swap=function(a,b){var c=i.call(this);if(!c)throw".swap is only supported for dataSources of type Array or ViewSequence";if(a===b)return this;if(0>a||a>=c.length)throw"Invalid index ("+a+") specified to .swap";if(0>b||b>=c.length)throw"Invalid second index ("+b+") specified to .swap";var d=c[a];return c[a]=c[b],c[b]=d,this._isDirty=!0,this},d.prototype.replace=function(a,b,c){var d;if(this._nodesById||a instanceof String||"string"==typeof a){if(d=this._nodesById[a],d!==b){if(c&&d){var e=this._nodes.getNodeByRenderNode(d);e&&e.setRenderNode(b)}this._nodesById[a]=b,this._isDirty=!0}return d}var f=i.call(this);if(!f)return void 0;if(0>a||a>=f.length)throw"Invalid index ("+a+") specified to .replace";return d=f[a],d!==b&&(f[a]=b,this._isDirty=!0),d},d.prototype.move=function(a,b){var c=i.call(this);if(!c)throw".move is only supported for dataSources of type Array or ViewSequence";if(0>a||a>=c.length)throw"Invalid index ("+a+") specified to .move";if(0>b||b>=c.length)throw"Invalid newIndex ("+b+") specified to .move";var d=c.splice(a,1)[0];return c.splice(b,0,d),this._isDirty=!0,this},d.prototype.remove=function(a,b){var c;if(this._nodesById||a instanceof String||"string"==typeof a){if(a instanceof String||"string"==typeof a)c=this._nodesById[a],c&&delete this._nodesById[a];else for(var d in this._nodesById)if(this._nodesById[d]===a){delete this._nodesById[d],c=a;break}}else if(a instanceof Number||"number"==typeof a){var e=i.call(this);if(!e||0>a||a>=e.length)throw"Invalid index ("+a+") specified to .remove (or dataSource doesn't support remove)";c=e[a],this._dataSource.splice(a,1)}else a=this._dataSource.indexOf(a),a>=0&&(this._dataSource.splice(a,1),c=a);if(this._viewSequence&&c){var f=h.call(this,this._viewSequence.getIndex(),this._initialViewSequence);f=f||h.call(this,this._viewSequence.getIndex()-1,this._initialViewSequence),f=f||this._dataSource,this._viewSequence=f}if(c&&b){var g=this._nodes.getNodeByRenderNode(c);g&&g.remove(b||this.options.flowOptions.removeSpec)}return c&&(this._isDirty=!0),c},d.prototype.removeAll=function(a){if(this._nodesById){var b=!1;for(var c in this._nodesById)delete this._nodesById[c],b=!0;b&&(this._isDirty=!0)}else this._dataSource&&this.setDataSource([]);if(a)for(var d=this._nodes.getStartEnumNode();d;)d.remove(a||this.options.flowOptions.removeSpec),d=d._next;return this},d.prototype.getSize=function(){return this._size||this.options.size},d.prototype.render=function(){return this.id},d.prototype.commit=function(a){var b=a.transform,c=a.origin,d=a.size,e=a.opacity;if(this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll()),d[0]!==this._contextSizeCache[0]||d[1]!==this._contextSizeCache[1]||this._isDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout){var f={target:this,oldSize:this._contextSizeCache,size:d,dirty:this._isDirty,trueSizeRequested:this._nodes._trueSizeRequested};if(this._eventOutput.emit("layoutstart",f),this.options.flow){var g=!1;if(this.options.flowOptions.reflowOnResize||(g=this._isDirty||d[0]===this._contextSizeCache[0]&&d[1]===this._contextSizeCache[1]?!0:void 0),void 0!==g)for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(g),h=h._next}this._contextSizeCache[0]=d[0],this._contextSizeCache[1]=d[1],this._isDirty=!1;var i;this.options.size&&this.options.size[this._direction]===!0&&(i=1e6);var j=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:d,direction:this._direction,scrollEnd:i});if(this._layout._function&&this._layout._function(j,this._layout.options),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),this._nodes.removeVirtualViewSequenceNodes(),i){for(i=0,h=this._nodes.getStartEnumNode();h;)h._invalidated&&h.scrollLength&&(i+=h.scrollLength),h=h._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}var k=this._nodes.buildSpecAndDestroyUnrenderedNodes();this._specs=k.specs,this._commitOutput.target=k.specs,this._eventOutput.emit("layoutend",f),this._eventOutput.emit("reflow",{target:this})}else this.options.flow&&(k=this._nodes.buildSpecAndDestroyUnrenderedNodes(),this._specs=k.specs,this._commitOutput.target=k.specs,k.modified&&this._eventOutput.emit("reflow",{target:this}));for(var l=this._commitOutput.target,m=0,n=l.length;n>m;m++)l[m].renderNode&&(l[m].target=l[m].renderNode.render());return l.length&&l[l.length-1]===this._cleanupRegistration||l.push(this._cleanupRegistration),!c||0===c[0]&&0===c[1]||(b=s.moveThen([-d[0]*c[0],-d[1]*c[1],0],b)),this._commitOutput.size=d,this._commitOutput.opacity=e,this._commitOutput.transform=b,this._commitOutput},d.prototype.cleanup=function(a){this.options.flow&&(this._resetFlowState=!0)},c.exports=d}),define("famous-flex/ScrollController",["require","exports","module","./LayoutUtility","./LayoutController","./LayoutNode","./FlowLayoutNode","./LayoutNodeManager","famous/surfaces/ContainerSurface","famous/core/Transform","famous/core/EventHandler","famous/core/Group","famous/math/Vector","famous/physics/PhysicsEngine","famous/physics/bodies/Particle","famous/physics/forces/Drag","famous/physics/forces/Spring","famous/inputs/ScrollSync","famous/core/ViewSequence"],function(a,b,c){function d(a){a=D.combineOptions(d.DEFAULT_OPTIONS,a);var b=new H(a.flow?G:F,e.bind(this));E.call(this,a,b),this._scroll={activeTouches:[],pe:new N(this.options.scrollPhysicsEngine),particle:new O(this.options.scrollParticle),dragForce:new P(this.options.scrollDrag),frictionForce:new P(this.options.scrollFriction),springValue:void 0,springForce:new Q(this.options.scrollSpring),springEndState:new M([0,0,0]),groupStart:0,groupTranslate:[0,0,0],scrollDelta:0,normalizedScrollDelta:0,scrollForce:0,scrollForceCount:0,unnormalizedScrollOffset:0,isScrolling:!1},this._debug={layoutCount:0,commitCount:0},this.group=new L,this.group.add({render:C.bind(this)}),this._scroll.pe.addBody(this._scroll.particle),this.options.scrollDrag.disabled||(this._scroll.dragForceId=this._scroll.pe.attach(this._scroll.dragForce,this._scroll.particle)),this.options.scrollFriction.disabled||(this._scroll.frictionForceId=this._scroll.pe.attach(this._scroll.frictionForce,this._scroll.particle)),this._scroll.springForce.setOptions({anchor:this._scroll.springEndState}),this._eventInput.on("touchstart",l.bind(this)),this._eventInput.on("touchmove",m.bind(this)),this._eventInput.on("touchend",n.bind(this)),this._eventInput.on("touchcancel",n.bind(this)),this._eventInput.on("mousedown",i.bind(this)),this._eventInput.on("mouseup",k.bind(this)),this._eventInput.on("mousemove",j.bind(this)),this._scrollSync=new R(this.options.scrollSync),this._eventInput.pipe(this._scrollSync),this._scrollSync.on("update",o.bind(this)),this.options.useContainer&&(this.container=new I(this.options.container),this.container.add({render:function(){return this.id}.bind(this)}),this.options.autoPipeEvents||(this.subscribe(this.container),K.setInputHandler(this.container,this),K.setOutputHandler(this.container,this)))}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(){return!this._layout.capabilities||void 0===this._layout.capabilities.sequentialScrollingOptimized||this._layout.capabilities.sequentialScrollingOptimized}function g(){var a=this._scroll.scrollForceCount?void 0:this._scroll.springPosition;this._scroll.springValue!==a&&(this._scroll.springValue=a,void 0===a?void 0!==this._scroll.springForceId&&(this._scroll.pe.detach(this._scroll.springForceId),this._scroll.springForceId=void 0):(void 0===this._scroll.springForceId&&(this._scroll.springForceId=this._scroll.pe.attach(this._scroll.springForce,this._scroll.particle)),this._scroll.springEndState.set1D(a),this._scroll.pe.wake()))}function h(a){return a.timeStamp||Date.now()}function i(a){if(this.options.mouseMove){this._scroll.mouseMove&&this.releaseScrollForce(this._scroll.mouseMove.delta);var b=[a.clientX,a.clientY],c=h(a);this._scroll.mouseMove={delta:0,start:b,current:b,prev:b,time:c,prevTime:c},this.applyScrollForce(this._scroll.mouseMove.delta)}}function j(a){if(this._scroll.mouseMove&&this.options.enabled){var b=Math.atan2(Math.abs(a.clientY-this._scroll.mouseMove.prev[1]),Math.abs(a.clientX-this._scroll.mouseMove.prev[0]))/(Math.PI/2),c=Math.abs(this._direction-b);(void 0===this.options.touchMoveDirectionThreshold||c<=this.options.touchMoveDirectionThreshold)&&(this._scroll.mouseMove.prev=this._scroll.mouseMove.current,this._scroll.mouseMove.current=[a.clientX,a.clientY],this._scroll.mouseMove.prevTime=this._scroll.mouseMove.time,this._scroll.mouseMove.direction=b,this._scroll.mouseMove.time=h(a));var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.start[this._direction];this.updateScrollForce(this._scroll.mouseMove.delta,d),this._scroll.mouseMove.delta=d}}function k(a){if(this._scroll.mouseMove){var b=0,c=this._scroll.mouseMove.time-this._scroll.mouseMove.prevTime;if(c>0&&h(a)-this._scroll.mouseMove.time<=this.options.touchMoveNoVelocityDuration){var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.prev[this._direction];b=d/c}this.releaseScrollForce(this._scroll.mouseMove.delta,b),this._scroll.mouseMove=void 0}}function l(a){this._touchEndEventListener||(this._touchEndEventListener=function(a){a.target.removeEventListener("touchend",this._touchEndEventListener),n.call(this,a)}.bind(this));for(var b,c,d=this._scroll.activeTouches.length,e=0;e<this._scroll.activeTouches.length;){var f=this._scroll.activeTouches[e];for(c=!1,b=0;b<a.touches.length;b++){var g=a.touches[b];if(g.identifier===f.id){c=!0;break}}c?e++:this._scroll.activeTouches.splice(e,1)}for(e=0;e<a.touches.length;e++){var i=a.touches[e];for(c=!1,b=0;b<this._scroll.activeTouches.length;b++)if(this._scroll.activeTouches[b].id===i.identifier){c=!0;break}if(!c){var j=[i.clientX,i.clientY],k=h(a);this._scroll.activeTouches.push({id:i.identifier,start:j,current:j,prev:j,time:k,prevTime:k}),i.target.addEventListener("touchend",this._touchEndEventListener)}}!d&&this._scroll.activeTouches.length&&(this.applyScrollForce(0),this._scroll.touchDelta=0)}function m(a){if(this.options.enabled){for(var b,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){var g=Math.atan2(Math.abs(d.clientY-f.prev[1]),Math.abs(d.clientX-f.prev[0]))/(Math.PI/2),i=Math.abs(this._direction-g);(void 0===this.options.touchMoveDirectionThreshold||i<=this.options.touchMoveDirectionThreshold)&&(f.prev=f.current,f.current=[d.clientX,d.clientY],f.prevTime=f.time,f.direction=g,f.time=h(a),b=0===e?f:void 0)}}if(b){var j=b.current[this._direction]-b.start[this._direction];this.updateScrollForce(this._scroll.touchDelta,j),this._scroll.touchDelta=j}}}function n(a){for(var b=this._scroll.activeTouches.length?this._scroll.activeTouches[0]:void 0,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){if(this._scroll.activeTouches.splice(e,1),0===e&&this._scroll.activeTouches.length){var g=this._scroll.activeTouches[0];g.start[0]=g.current[0]-(f.current[0]-f.start[0]),g.start[1]=g.current[1]-(f.current[1]-f.start[1])}break}}if(b&&!this._scroll.activeTouches.length){var i=0,j=b.time-b.prevTime;if(j>0&&h(a)-b.time<=this.options.touchMoveNoVelocityDuration){var k=b.current[this._direction]-b.prev[this._direction];i=k/j}var l=this._scroll.touchDelta;this.releaseScrollForce(l,i),this._scroll.touchDelta=0}}function o(a){if(this.options.enabled){var b=Array.isArray(a.delta)?a.delta[this._direction]:a.delta;this.scroll(b)}}function p(a,b,c){if(void 0!==a&&(this._scroll.particleValue=a,this._scroll.particle.setPosition1D(a)),void 0!==b){var d=this._scroll.particle.getVelocity1D();d!==b&&this._scroll.particle.setVelocity1D(b)}}function q(a,b){(b||void 0===this._scroll.particleValue)&&(this._scroll.particleValue=this._scroll.particle.getPosition1D(),this._scroll.particleValue=Math.round(1e3*this._scroll.particleValue)/1e3);var c=this._scroll.particleValue;return(this._scroll.scrollDelta||this._scroll.normalizedScrollDelta)&&(c+=this._scroll.scrollDelta+this._scroll.normalizedScrollDelta,(this._scroll.boundsReached&T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached&T.NEXT&&c<this._scroll.springPosition||this._scroll.boundsReached===T.BOTH)&&(c=this._scroll.springPosition),a&&(this._scroll.scrollDelta||(this._scroll.normalizedScrollDelta=0,p.call(this,c,void 0,"_calcScrollOffset")),this._scroll.normalizedScrollDelta+=this._scroll.scrollDelta,this._scroll.scrollDelta=0)),this._scroll.scrollForceCount&&this._scroll.scrollForce&&(void 0!==this._scroll.springPosition?c=(c+this._scroll.scrollForce+this._scroll.springPosition)/2:c+=this._scroll.scrollForce),this.options.overscroll||(this._scroll.boundsReached===T.BOTH||this._scroll.boundsReached===T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c<this._scroll.springPosition)&&(c=this._scroll.springPosition),c}function r(a,b){var c,d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0),g=f.call(this);if(g&&(void 0!==e&&void 0!==d&&(c=d+e),void 0!==c&&c<=a[this._direction]))return this._scroll.boundsReached=T.BOTH,this._scroll.springPosition=this.options.alignment?-e:d,void(this._scroll.springSource=U.MINSIZE);if(this.options.alignment)if(g){if(void 0!==e&&0>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=-e,void(this._scroll.springSource=U.NEXTBOUNDS)}else{var h=this._calcScrollHeight(!1,!0);if(void 0!==e&&h&&b+e+a[this._direction]<=h)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=e-(a[this._direction]-h),void(this._scroll.springSource=U.NEXTBOUNDS)}else if(void 0!==d&&b-d>=0)return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=d,void(this._scroll.springSource=U.PREVBOUNDS);if(this.options.alignment){if(void 0!==d&&b-d>=-a[this._direction])return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=-a[this._direction]+d,void(this._scroll.springSource=U.PREVBOUNDS)}else{var i=g?a[this._direction]:this._calcScrollHeight(!0,!0);if(void 0!==e&&i>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=i-e,void(this._scroll.springSource=U.NEXTBOUNDS)}this._scroll.boundsReached=T.NONE,this._scroll.springPosition=void 0,this._scroll.springSource=U.NONE}function s(a,b){var c=this._scroll.scrollToRenderNode||this._scroll.ensureVisibleRenderNode;if(c&&!(this._scroll.boundsReached===T.BOTH||!this._scroll.scrollToDirection&&this._scroll.boundsReached===T.PREV||this._scroll.scrollToDirection&&this._scroll.boundsReached===T.NEXT)){for(var d,e=0,f=this._nodes.getStartEnumNode(!0),g=0;f&&(g++,f._invalidated&&void 0!==f.scrollLength);){if(this.options.alignment&&(e-=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment||(e-=f.scrollLength),f=f._next}if(!d)for(e=0,f=this._nodes.getStartEnumNode(!1);f&&f._invalidated&&void 0!==f.scrollLength;){if(this.options.alignment||(e+=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment&&(e+=f.scrollLength),f=f._prev}if(d)return void(this._scroll.ensureVisibleRenderNode?this.options.alignment?e-d.scrollLength<0?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e>a[this._direction]?(this._scroll.springPosition=a[this._direction]-e,this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0):(e=-e,0>e?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e+d.scrollLength>a[this._direction]?(this._scroll.springPosition=a[this._direction]-(e+d.scrollLength),this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0)):(this._scroll.springPosition=e,this._scroll.springSource=U.GOTOSEQUENCE));if(this._scroll.scrollToDirection?(this._scroll.springPosition=b-a[this._direction],this._scroll.springSource=U.GOTONEXTDIRECTION):(this._scroll.springPosition=b+a[this._direction],this._scroll.springSource=U.GOTOPREVDIRECTION),this._viewSequence.cleanup)for(var h=this._viewSequence;h.get()!==c&&(h=this._scroll.scrollToDirection?h.getNext(!0):h.getPrevious(!0)););}}function t(){if(this.options.paginated&&!this._scroll.scrollForceCount&&void 0===this._scroll.springPosition){var a;switch(this.options.paginationMode){case V.SCROLL:(!this.options.paginationEnergyThreshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThreshold)&&(a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode));break;case V.PAGE:a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode)}}}function u(a){for(var b=0,c=a,d=!1,e=this._nodes.getStartEnumNode(!1);e&&e._invalidated&&e._viewSequence&&(d&&(this._viewSequence=e._viewSequence,c=a,d=!1),!(void 0===e.scrollLength||e.trueSizeRequested||0>a));)a-=e.scrollLength,b++,e.scrollLength&&(this.options.alignment?d=a>=0:(this._viewSequence=e._viewSequence,c=a)),e=e._prev;return c}function v(a){for(var b=0,c=a,d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!d.trueSizeRequested&&d._viewSequence&&(!(a>0)||this.options.alignment&&0===d.scrollLength);)this.options.alignment&&(a+=d.scrollLength,b++),(d.scrollLength||this.options.alignment)&&(this._viewSequence=d._viewSequence,c=a),this.options.alignment||(a+=d.scrollLength,b++),d=d._next;return c}function w(a,b){var c=this._layout.capabilities;if(c&&c.debug&&void 0!==c.debug.normalize&&!c.debug.normalize)return b;if(this._scroll.scrollForceCount)return b;var d=b;if(this.options.alignment&&0>b?d=v.call(this,b):!this.options.alignment&&b>0&&(d=u.call(this,b)),d===b&&(this.options.alignment&&b>0?d=u.call(this,b):!this.options.alignment&&0>b&&(d=v.call(this,b))),d!==b){var e=d-b,g=this._scroll.particle.getPosition1D();p.call(this,g+e,void 0,"normalize"),void 0!==this._scroll.springPosition&&(this._scroll.springPosition+=e),f.call(this)&&(this._scroll.groupStart-=e)}return d}function x(a){for(var b,c={},d=1e7,e=a&&this.options.alignment?-this._contextSizeCache[this._direction]:a||this.options.alignment?0:this._contextSizeCache[this._direction],f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!0);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g,f+=g.scrollLength}g=g._next}for(f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!1);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(f-=g.scrollLength,b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g}g=g._prev}return c._node?(c.scrollLength=c._node.scrollLength,this.options.alignment?c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,0)-Math.max(c.scrollOffset,-this._contextSizeCache[this._direction]))/c.scrollLength:c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,this._contextSizeCache[this._direction])-Math.max(c.scrollOffset,0))/c.scrollLength,c.index=c._node._viewSequence.getIndex(),c.viewSequence=c._node._viewSequence,c.renderNode=c._node.renderNode,c):void 0}function y(a,b,c){c?(this._viewSequence=a,this._scroll.springPosition=void 0,g.call(this),this.halt(),this._scroll.scrollDelta=0,p.call(this,0,0,"_goToSequence"),this._scroll.scrollDirty=!0):(this._scroll.scrollToSequence=a,this._scroll.scrollToRenderNode=a.get(),this._scroll.ensureVisibleRenderNode=void 0,this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0)}function z(a,b){this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=a.get(),this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0}function A(a,b){var c=(b?void 0:this._scroll.scrollToSequence)||this._viewSequence;if(!this._scroll.scrollToSequence&&!b){var d=this.getFirstVisibleItem();d&&(c=d.viewSequence,(0>a&&d.scrollOffset<0||a>0&&d.scrollOffset>0)&&(a=0))}if(c){for(var e=0;e<Math.abs(a);e++){var f=a>0?c.getNext():c.getPrevious();if(!f)break;c=f}y.call(this,c,a>=0,b)}}function B(a,b,c){this._debug.layoutCount++;var d=0-Math.max(this.options.extraBoundsSpace[0],1),e=a[this._direction]+Math.max(this.options.extraBoundsSpace[1],1);this.options.layoutAll&&(d=-1e6,e=1e6);var f=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:a,direction:this._direction,reverse:this.options.alignment?!0:!1,scrollOffset:this.options.alignment?b+a[this._direction]:b,scrollStart:d,scrollEnd:e});this._layout._function&&this._layout._function(f,this._layout.options),this._scroll.unnormalizedScrollOffset=b,this._postLayout&&this._postLayout(a,b),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),r.call(this,a,b),s.call(this,a,b),t.call(this);var h=q.call(this,!0);if(!c&&h!==b)return B.call(this,a,h,!0);if(b=w.call(this,a,b),g.call(this),this._nodes.removeVirtualViewSequenceNodes(),this.options.size&&this.options.size[this._direction]===!0){for(var i=0,j=this._nodes.getStartEnumNode();j;)j._invalidated&&j.scrollLength&&(i+=j.scrollLength),j=j._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}return b}function C(){for(var a=this._specs,b=0,c=a.length;c>b;b++)a[b].renderNode&&(a[b].target=a[b].renderNode.render());return a.length&&a[a.length-1]===this._cleanupRegistration||a.push(this._cleanupRegistration),a}var D=a("./LayoutUtility"),E=a("./LayoutController"),F=a("./LayoutNode"),G=a("./FlowLayoutNode"),H=a("./LayoutNodeManager"),I=a("famous/surfaces/ContainerSurface"),J=a("famous/core/Transform"),K=a("famous/core/EventHandler"),L=a("famous/core/Group"),M=a("famous/math/Vector"),N=a("famous/physics/PhysicsEngine"),O=a("famous/physics/bodies/Particle"),P=a("famous/physics/forces/Drag"),Q=a("famous/physics/forces/Spring"),R=a("famous/inputs/ScrollSync"),S=a("famous/core/ViewSequence"),T={NONE:0,PREV:1,NEXT:2,BOTH:3},U={NONE:"none",NEXTBOUNDS:"next-bounds",PREVBOUNDS:"prev-bounds",MINSIZE:"minimal-size",GOTOSEQUENCE:"goto-sequence",ENSUREVISIBLE:"ensure-visible",GOTOPREVDIRECTION:"goto-prev-direction",GOTONEXTDIRECTION:"goto-next-direction"},V={PAGE:0,SCROLL:1};d.prototype=Object.create(E.prototype),d.prototype.constructor=d,d.Bounds=T,d.PaginationMode=V,d.DEFAULT_OPTIONS={useContainer:!1,container:{properties:{overflow:"hidden"}},scrollPhysicsEngine:{},scrollParticle:{},scrollDrag:{forceFunction:P.FORCE_FUNCTIONS.QUADRATIC,strength:.001,disabled:!0},scrollFriction:{forceFunction:P.FORCE_FUNCTIONS.LINEAR,strength:.0025,disabled:!1},scrollSpring:{dampingRatio:1,period:350},scrollSync:{scale:.2},overscroll:!0,paginated:!1,paginationMode:V.PAGE,paginationEnergyThreshold:.01,alignment:0,touchMoveDirectionThreshold:void 0,touchMoveNoVelocityDuration:100,mouseMove:!1,enabled:!0,layoutAll:!1,alwaysLayout:!1,extraBoundsSpace:[100,100],debug:!1},d.prototype.setOptions=function(a){return E.prototype.setOptions.call(this,a),a.hasOwnProperty("paginationEnergyThresshold")&&(console.warn("option `paginationEnergyThresshold` has been deprecated, please rename to `paginationEnergyThreshold`."),this.setOptions({paginationEnergyThreshold:a.paginationEnergyThresshold})),a.hasOwnProperty("touchMoveDirectionThresshold")&&(console.warn("option `touchMoveDirectionThresshold` has been deprecated, please rename to `touchMoveDirectionThreshold`."),this.setOptions({touchMoveDirectionThreshold:a.touchMoveDirectionThresshold})),this._scroll&&(a.scrollSpring&&this._scroll.springForce.setOptions(a.scrollSpring),a.scrollDrag&&this._scroll.dragForce.setOptions(a.scrollDrag)),a.scrollSync&&this._scrollSync&&this._scrollSync.setOptions(a.scrollSync),this},d.prototype._calcScrollHeight=function(a,b){for(var c=0,d=this._nodes.getStartEnumNode(a);d;){if(d._invalidated){if(d.trueSizeRequested){c=void 0;break}if(void 0!==d.scrollLength&&(c=b?d.scrollLength:c+d.scrollLength,!a&&b))break}d=a?d._next:d._prev}return c},d.prototype.getVisibleItems=function(){for(var a=this._contextSizeCache,b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,c=[],d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!(b>a[this._direction]);)b+=d.scrollLength,b>=0&&d._viewSequence&&c.push({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b,a[this._direction])-Math.max(b-d.scrollLength,0))/d.scrollLength:1,scrollOffset:b-d.scrollLength,scrollLength:d.scrollLength,_node:d}),d=d._next;for(b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,d=this._nodes.getStartEnumNode(!1);d&&d._invalidated&&void 0!==d.scrollLength&&!(0>b);)b-=d.scrollLength,b<a[this._direction]&&d._viewSequence&&c.unshift({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b+d.scrollLength,a[this._direction])-Math.max(b,0))/d.scrollLength:1,scrollOffset:b,scrollLength:d.scrollLength,_node:d}),d=d._prev;return c},d.prototype.getFirstVisibleItem=function(){return x.call(this,!0)},d.prototype.getLastVisibleItem=function(){return x.call(this,!1)},d.prototype.goToFirstPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to first item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getPrevious();if(!c||!c.get())break;b=c}return y.call(this,b,!1,a),this},d.prototype.goToPreviousPage=function(a){return A.call(this,-1,a),this},d.prototype.goToNextPage=function(a){return A.call(this,1,a),this},d.prototype.goToLastPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to last item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getNext();if(!c||!c.get())break;b=c}return y.call(this,b,!0,a),this},d.prototype.goToRenderNode=function(a,b){if(!this._viewSequence||!a)return this;if(this._viewSequence.get()===a){var c=q.call(this)>=0;return y.call(this,this._viewSequence,c,b),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){y.call(this,d,!0,b);break}var g=e?e.get():void 0;if(g===a){y.call(this,e,!1,b);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.ensureVisible=function(a){if(a instanceof S)a=a.get();else if(a instanceof Number||"number"==typeof a){for(var b=this._viewSequence;b.getIndex()<a;)if(b=b.getNext(),!b)return this;for(;b.getIndex()>a;)if(b=b.getPrevious(),!b)return this}if(this._viewSequence.get()===a){var c=q.call(this)>=0;return z.call(this,this._viewSequence,c),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){z.call(this,d,!0);break}var g=e?e.get():void 0;if(g===a){z.call(this,e,!1);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.scroll=function(a){return this.halt(),this._scroll.scrollDelta+=a,this},d.prototype.canScroll=function(a){var b,c=q.call(this),d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0);if(void 0!==e&&void 0!==d&&(b=d+e),void 0!==b&&b<=this._contextSizeCache[this._direction])return 0;if(0>a&&void 0!==e){var f=this._contextSizeCache[this._direction]-(c+e);return Math.max(f,a)}if(a>0&&void 0!==d){var g=-(c-d);return Math.min(g,a)}return a},d.prototype.halt=function(){return this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=void 0,p.call(this,void 0,0,"halt"),this},d.prototype.isScrolling=function(){return this._scroll.isScrolling},d.prototype.getBoundsReached=function(){return this._scroll.boundsReached},d.prototype.getVelocity=function(){return this._scroll.particle.getVelocity1D()},d.prototype.getEnergy=function(){return this._scroll.particle.getEnergy()},d.prototype.setVelocity=function(a){return this._scroll.particle.setVelocity1D(a)},d.prototype.applyScrollForce=function(a){return this.halt(),0===this._scroll.scrollForceCount&&(this._scroll.scrollForceStartItem=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem()),this._scroll.scrollForceCount++,this._scroll.scrollForce+=a,this._eventOutput.emit(1===this._scroll.scrollForceCount?"swipestart":"swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a}),this},d.prototype.updateScrollForce=function(a,b){return this.halt(),b-=a,this._scroll.scrollForce+=b,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:b}),this},d.prototype.releaseScrollForce=function(a,b){if(this.halt(),1===this._scroll.scrollForceCount){var c=q.call(this);if(p.call(this,c,b,"releaseScrollForce"),this._scroll.pe.wake(),this._scroll.scrollForce=0,this._scroll.scrollDirty=!0,this._scroll.scrollForceStartItem&&this.options.paginated&&this.options.paginationMode===V.PAGE){var d=this.options.alignment?this.getLastVisibleItem(!0):this.getFirstVisibleItem(!0);d&&(d.renderNode!==this._scroll.scrollForceStartItem.renderNode?this.goToRenderNode(d.renderNode):this.options.paginationEnergyThreshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThreshold?(b=b||0,0>b&&d._node._next&&d._node._next.renderNode?this.goToRenderNode(d._node._next.renderNode):b>=0&&d._node._prev&&d._node._prev.renderNode&&this.goToRenderNode(d._node._prev.renderNode)):this.goToRenderNode(d.renderNode))}this._scroll.scrollForceStartItem=void 0,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeend",{target:this,total:a,delta:0,velocity:b})}else this._scroll.scrollForce-=a,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a});return this},d.prototype.getSpec=function(a,b){var c=E.prototype.getSpec.apply(this,arguments);if(c&&f.call(this)){c={origin:c.origin,align:c.align,opacity:c.opacity,size:c.size,renderNode:c.renderNode,transform:c.transform};var d=[0,0,0];d[this._direction]=this._scrollOffsetCache+this._scroll.groupStart,c.transform=J.thenMove(c.transform,d)}return c},d.prototype.commit=function(a){var b=a.size;this._debug.commitCount++,this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll());var c=q.call(this,!0,!0);void 0===this._scrollOffsetCache&&(this._scrollOffsetCache=c);var d,e=!1,g=!1;if(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1]||this._isDirty||this._scroll.scrollDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout||this._scrollOffsetCache!==c){
-if(d={target:this,oldSize:this._contextSizeCache,size:b,oldScrollOffset:-(this._scrollOffsetCache+this._scroll.groupStart),scrollOffset:-(c+this._scroll.groupStart)},this._scrollOffsetCache!==c?(this._scroll.isScrolling||(this._scroll.isScrolling=!0,this._eventOutput.emit("scrollstart",d)),g=!0):this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0),this._eventOutput.emit("layoutstart",d),this.options.flow&&(this._isDirty||this.options.flowOptions.reflowOnResize&&(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1])))for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(!0),h=h._next;this._contextSizeCache[0]=b[0],this._contextSizeCache[1]=b[1],this._isDirty=!1,this._scroll.scrollDirty=!1,c=B.call(this,b,c),this._scrollOffsetCache=c,d.scrollOffset=-(this._scrollOffsetCache+this._scroll.groupStart)}else this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0);var i=this._scroll.groupTranslate;i[0]=0,i[1]=0,i[2]=0,i[this._direction]=-this._scroll.groupStart-c;var j=f.call(this),k=this._nodes.buildSpecAndDestroyUnrenderedNodes(j?i:void 0);if(this._specs=k.specs,this._specs.length||(this._scroll.groupStart=0),d&&this._eventOutput.emit("layoutend",d),k.modified&&this._eventOutput.emit("reflow",{target:this}),g&&this._eventOutput.emit("scroll",d),d){var l=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem();(l&&!this._visibleItemCache||!l&&this._visibleItemCache||l&&this._visibleItemCache&&l.renderNode!==this._visibleItemCache.renderNode)&&(this._eventOutput.emit("pagechange",{target:this,oldViewSequence:this._visibleItemCache?this._visibleItemCache.viewSequence:void 0,viewSequence:l?l.viewSequence:void 0,oldIndex:this._visibleItemCache?this._visibleItemCache.index:void 0,index:l?l.index:void 0,renderNode:l?l.renderNode:void 0,oldRenderNode:this._visibleItemCache?this._visibleItemCache.renderNode:void 0}),this._visibleItemCache=l)}e&&(this._scroll.isScrolling=!1,d={target:this,oldSize:b,size:b,oldScrollOffset:-(this._scroll.groupStart+c),scrollOffset:-(this._scroll.groupStart+c)},this._eventOutput.emit("scrollend",d));var m=a.transform;if(j){var n=c+this._scroll.groupStart,o=[0,0,0];o[this._direction]=n,m=J.thenMove(m,o)}return{transform:m,size:b,opacity:a.opacity,origin:a.origin,target:this.group.render()}},d.prototype.render=function(){return this.container?this.container.render.apply(this.container,arguments):this.id},c.exports=d}),define("famous-flex/layouts/ListLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){var c,d,e,g,j,k,l,m,n,o,p,q,r,s,t=a.size,u=a.direction,v=a.alignment,w=u?0:1,x=f.normalizeMargins(b.margins),y=b.spacing||0,z=b.isSectionCallback;for(y&&"number"!=typeof y&&console.log("Famous-flex warning: ListLayout was initialized with a non-numeric spacing option. The CollectionLayout supports an array spacing argument, but the ListLayout does not."),h.size[0]=t[0],h.size[1]=t[1],h.size[w]-=x[1-w]+x[3-w],h.translate[0]=0,h.translate[1]=0,h.translate[2]=0,h.translate[w]=x[u?3:0],b.itemSize!==!0&&b.hasOwnProperty("itemSize")?b.itemSize instanceof Function?j=b.itemSize:g=void 0===b.itemSize?t[u]:b.itemSize:g=!0,i[0]=x[u?0:3],i[1]=-x[u?2:1],c=a.scrollOffset+i[v],s=a.scrollEnd+i[v];s+y>c&&(q=d,d=a.next());)e=j?j(d.renderNode):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.size[u]=e,h.translate[u]=c+(v?y:0),h.scrollLength=e+y,a.set(d,h),c+=h.scrollLength,z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),p?void 0===r&&(r=c-e):(k=d,l=c-e,m=e,n=e)):!p&&c>=0&&(p=d);for(!q||d||v||(h.scrollLength=e+i[0]+-i[1],a.set(q,h)),q=void 0,d=void 0,c=a.scrollOffset+i[v],s=a.scrollStart+i[v];c>s-y&&(q=d,d=a.prev());)e=j?j(d.renderNode):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.scrollLength=e+y,c-=h.scrollLength,h.size[u]=e,h.translate[u]=c+(v?y:0),a.set(d,h),z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),k||(k=d,l=c,m=e,n=h.scrollLength)):c+e>=0&&(p=d,k&&(r=c+e),k=void 0);if(q&&!d&&v&&(h.scrollLength=e+i[0]+-i[1],a.set(q,h),k===q&&(n=h.scrollLength)),z&&!k)for(d=a.prev();d;){if(z(d.renderNode)){k=d,e=b.itemSize||a.resolveSize(d,t)[u],l=c-e,m=e,n=void 0;break}d=a.prev()}if(k){var A=Math.max(i[0],l);void 0!==r&&m>r-i[0]&&(A=r-m),h.size[u]=m,h.translate[u]=A,h.scrollLength=n,a.set(k,h)}}var e=a("famous/utilities/Utility"),f=a("../LayoutUtility"),g={sequence:!0,direction:[e.Direction.Y,e.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},h={size:[0,0],translate:[0,0,0],scrollLength:void 0},i=[0,0];d.Capabilities=g,d.Name="ListLayout",d.Description="List-layout with margins, spacing and sticky headers",c.exports=d}),define("famous-flex/FlexScrollView",["require","exports","module","./LayoutUtility","./ScrollController","./layouts/ListLayout"],function(a,b,c){function d(a){h.call(this,g.combineOptions(d.DEFAULT_OPTIONS,a)),this._thisScrollViewDelta=0,this._leadingScrollViewDelta=0,this._trailingScrollViewDelta=0}function e(a,b){a.state!==b&&(a.state=b,a.node&&a.node.setPullToRefreshStatus&&a.node.setPullToRefreshStatus(b))}function f(a){return this._pullToRefresh?this._pullToRefresh[a?1:0]:void 0}var g=a("./LayoutUtility"),h=a("./ScrollController"),i=a("./layouts/ListLayout"),j={HIDDEN:0,PULLING:1,ACTIVE:2,COMPLETED:3,HIDDING:4};d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.PullToRefreshState=j,d.Bounds=h.Bounds,d.PaginationMode=h.PaginationMode,d.DEFAULT_OPTIONS={layout:i,direction:void 0,paginated:!1,alignment:0,flow:!1,mouseMove:!1,useContainer:!1,visibleItemThresshold:.5,pullToRefreshHeader:void 0,pullToRefreshFooter:void 0,leadingScrollView:void 0,trailingScrollView:void 0},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),(a.pullToRefreshHeader||a.pullToRefreshFooter||this._pullToRefresh)&&(a.pullToRefreshHeader?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[0]||(this._pullToRefresh[0]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!1}),this._pullToRefresh[0].node=a.pullToRefreshHeader):!this.options.pullToRefreshHeader&&this._pullToRefresh&&(this._pullToRefresh[0]=void 0),a.pullToRefreshFooter?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[1]||(this._pullToRefresh[1]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!0}),this._pullToRefresh[1].node=a.pullToRefreshFooter):!this.options.pullToRefreshFooter&&this._pullToRefresh&&(this._pullToRefresh[1]=void 0),!this._pullToRefresh||this._pullToRefresh[0]||this._pullToRefresh[1]||(this._pullToRefresh=void 0)),this},d.prototype.sequenceFrom=function(a){return this.setDataSource(a)},d.prototype.getCurrentIndex=function(){var a=this.getFirstVisibleItem();return a?a.viewSequence.getIndex():-1},d.prototype.goToPage=function(a,b){var c=this._viewSequence;if(!c)return this;for(;c.getIndex()<a;)if(c=c.getNext(),!c)return this;for(;c.getIndex()>a;)if(c=c.getPrevious(),!c)return this;return this.goToRenderNode(c.get(),b),this},d.prototype.getOffset=function(){return this._scrollOffsetCache},d.prototype.getPosition=d.prototype.getOffset,d.prototype.getAbsolutePosition=function(){return-(this._scrollOffsetCache+this._scroll.groupStart)},d.prototype._postLayout=function(a,b){if(this._pullToRefresh){this.options.alignment&&(b+=a[this._direction]);for(var c,d,f,g=0;2>g;g++){var h=this._pullToRefresh[g];if(h){var i,k=h.node.getSize()[this._direction],l=h.node.getPullToRefreshSize?h.node.getPullToRefreshSize()[this._direction]:k;h.footer?(d=void 0===d?d=this._calcScrollHeight(!0):d,d=void 0===d?-1:d,i=d>=0?b+d:a[this._direction]+1,this.options.alignment||(c=void 0===c?this._calcScrollHeight(!1):c,c=void 0===c?-1:c,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-c+a[this._direction]))),i=-(i-a[this._direction])):(c=this._calcScrollHeight(!1),c=void 0===c?-1:c,i=c>=0?b-c:c,this.options.alignment&&(d=this._calcScrollHeight(!0),d=void 0===d?-1:d,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-a[this._direction]+d))));var m=Math.max(Math.min(i/l,1),0);switch(h.state){case j.HIDDEN:this._scroll.scrollForceCount&&(m>=1?e(h,j.ACTIVE):i>=.2&&e(h,j.PULLING));break;case j.PULLING:this._scroll.scrollForceCount&&m>=1?e(h,j.ACTIVE):.2>i&&e(h,j.HIDDEN);break;case j.ACTIVE:break;case j.COMPLETED:this._scroll.scrollForceCount||(i>=.2?e(h,j.HIDDING):e(h,j.HIDDEN));break;case j.HIDDING:.2>i&&e(h,j.HIDDEN)}if(h.state!==j.HIDDEN){var n,o={renderNode:h.node,prev:!h.footer,next:h.footer,index:h.footer?++this._nodes._contextState.nextGetIndex:--this._nodes._contextState.prevGetIndex};h.state===j.ACTIVE?n=k:this._scroll.scrollForceCount&&(n=Math.min(i,k));var p={size:[a[0],a[1]],translate:[0,0,-.001],scrollLength:n};p.size[this._direction]=Math.max(Math.min(i,l),0),p.translate[this._direction]=h.footer?a[this._direction]-k:0,this._nodes._context.set(o,p)}}}}},d.prototype.showPullToRefresh=function(a){var b=f.call(this,a);b&&(e(b,j.ACTIVE),this._scroll.scrollDirty=!0)},d.prototype.hidePullToRefresh=function(a){var b=f.call(this,a);return b&&b.state===j.ACTIVE&&(e(b,j.COMPLETED),this._scroll.scrollDirty=!0),this},d.prototype.isPullToRefreshVisible=function(a){var b=f.call(this,a);return b?b.state===j.ACTIVE:!1},d.prototype.applyScrollForce=function(a){var b=this.options.leadingScrollView,c=this.options.trailingScrollView;if(!b&&!c)return h.prototype.applyScrollForce.call(this,a);var d;return 0>a?(b&&(d=b.canScroll(a),this._leadingScrollViewDelta+=d,b.applyScrollForce(d),a-=d),c?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,c.applyScrollForce(a),this._trailingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)):(c&&(d=c.canScroll(a),c.applyScrollForce(d),this._trailingScrollViewDelta+=d,a-=d),b?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,b.applyScrollForce(a),this._leadingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)),this},d.prototype.updateScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.updateScrollForce.call(this,a,b);var e,f=b-a;return 0>f?(c&&(e=c.canScroll(f),c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+e),this._leadingScrollViewDelta+=e,f-=e),d&&f?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,this._trailingScrollViewDelta+=f,d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+f)):f&&(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)):(d&&(e=d.canScroll(f),d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+e),this._trailingScrollViewDelta+=e,f-=e),c?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+f),this._leadingScrollViewDelta+=f):(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)),this},d.prototype.releaseScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.releaseScrollForce.call(this,a,b);var e;return 0>a?(c&&(e=Math.max(this._leadingScrollViewDelta,a),this._leadingScrollViewDelta-=e,a-=e,c.releaseScrollForce(this._leadingScrollViewDelta,a?0:b)),d?(e=Math.max(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._trailingScrollViewDelta-=a,d.releaseScrollForce(this._trailingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?b:0))):(d&&(e=Math.min(this._trailingScrollViewDelta,a),this._trailingScrollViewDelta-=e,a-=e,d.releaseScrollForce(this._trailingScrollViewDelta,a?0:b)),c?(e=Math.min(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._leadingScrollViewDelta-=a,c.releaseScrollForce(this._leadingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,a?b:0))),this},d.prototype.commit=function(a){var b=h.prototype.commit.call(this,a);if(this._pullToRefresh)for(var c=0;2>c;c++){var d=this._pullToRefresh[c];d&&(d.state===j.ACTIVE&&d.prevState!==j.ACTIVE&&this._eventOutput.emit("refresh",{target:this,footer:d.footer}),d.prevState=d.state)}return b},c.exports=d}),define("famous-flex/VirtualViewSequence",["require","exports","module","famous/core/EventHandler"],function(a,b,c){function d(a){a=a||{},this._=a._||new this.constructor.Backing(a),this.touched=!0,this.value=a.value||this._.factory.create(),this.index=a.index||0,this.next=a.next,this.prev=a.prev,e.setOutputHandler(this,this._.eventOutput),this.value.pipe(this._.eventOutput)}var e=a("famous/core/EventHandler");d.Backing=function(a){this.factory=a.factory,this.eventOutput=new e},d.prototype.getPrevious=function(a){if(this.prev)return this.prev.touched=!0,this.prev;if(a)return void 0;var b=this._.factory.createPrevious(this.get());return b?(this.prev=new d({_:this._,value:b,index:this.index-1,next:this}),this.prev):void 0},d.prototype.getNext=function(a){if(this.next)return this.next.touched=!0,this.next;if(a)return void 0;var b=this._.factory.createNext(this.get());return b?(this.next=new d({_:this._,value:b,index:this.index+1,prev:this}),this.next):void 0},d.prototype.get=function(){return this.touched=!0,this.value},d.prototype.getIndex=function(){return this.touched=!0,this.index},d.prototype.toString=function(){return""+this.index},d.prototype.cleanup=function(){for(var a=this.prev;a;){if(!a.touched){if(a.next.prev=void 0,a.next=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.prev;break}a.touched=!1,a=a.prev}for(a=this.next;a;){if(!a.touched){if(a.prev.next=void 0,a.prev=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.next;break}a.touched=!1,a=a.next}return this},d.prototype.unshift=function(){console.error&&console.error("VirtualViewSequence.unshift is not supported and should not be called")},d.prototype.push=function(){console.error&&console.error("VirtualViewSequence.push is not supported and should not be called")},d.prototype.splice=function(){console.error&&console.error("VirtualViewSequence.splice is not supported and should not be called")},d.prototype.swap=function(){console.error&&console.error("VirtualViewSequence.swap is not supported and should not be called")},c.exports=d}),define("famous-flex/AnimationController",["require","exports","module","famous/core/View","./LayoutController","famous/core/Transform","famous/core/Modifier","famous/modifiers/StateModifier","famous/core/RenderNode","famous/utilities/Timer","famous/transitions/Easing"],function(a,b,c){function d(a){w.apply(this,arguments),this._size=[0,0],f.call(this),a&&this.setOptions(a)}function e(a,b){var c={size:a.size,translate:[0,0,0]};this._size[0]=a.size[0],this._size[1]=a.size[1];for(var d=a.get("views"),e=a.get("transferables"),f=0,g=0;g<d.length;g++){var h=this._viewStack[g];switch(h.state){case E.HIDDEN:a.set(d[g],{size:a.size,translate:[2*a.size[0],2*a.size[1],0]});break;case E.HIDE:case E.HIDING:case E.VISIBLE:case E.SHOW:case E.SHOWING:if(2>f){f++;var i=d[g];a.set(i,c);for(var j=0;j<e.length;j++)for(var k=0;k<h.transferables.length;k++)e[j].renderNode===h.transferables[k].renderNode&&a.set(e[j],{translate:[0,0,c.translate[2]],size:[a.size[0],a.size[1]]});c.translate[2]+=b.zIndexOffset}}}}function f(){this._renderables={views:[],transferables:[]},this._viewStack=[],this.layout=new x({layout:e.bind(this),layoutOptions:this.options,dataSource:this._renderables}),this.add(this.layout),this.layout.on("layoutend",m.bind(this))}function g(a,b,c,d){if(a.view){var e=b.getSpec(c);e&&!e.trueSizeRequested?d(e):C.after(g.bind(this,a,b,c,d),1)}}function h(a,b,c){return b.getTransferable?b.getTransferable(c):b.getSpec&&b.get&&b.replace&&void 0!==b.get(c)?{get:function(){return b.get(c)},show:function(a){b.replace(c,a)},getSpec:g.bind(this,a,b,c)}:b.layout?h.call(this,a,b.layout,c):void 0}function i(a,b,c){function d(){e--,0===e&&c()}var e=0;for(var f in a.options.transfer.items)j.call(this,a,b,f,d)&&e++;e||c()}function j(a,b,c,d){var e=a.options.transfer.items[c],f={};if(f.source=h.call(this,b,b.view,c),Array.isArray(e))for(var g=0;g<e.length&&(f.target=h.call(this,a,a.view,e[g]),!f.target);g++);else f.target=h.call(this,a,a.view,e);return f.source&&f.target?(f.source.getSpec(function(b){f.sourceSpec=b,f.originalSource=f.source.get(),f.source.show(new B(new z(b))),f.originalTarget=f.target.get();var c=new B(new z({opacity:0}));c.add(f.originalTarget),f.target.show(c);var e=new z({transform:y.translate(0,0,a.options.transfer.zIndex)});f.mod=new A(b),f.renderNode=new B(e),f.renderNode.add(f.mod).add(f.originalSource),a.transferables.push(f),this._renderables.transferables.push(f.renderNode),this.layout.reflowLayout(),C.after(function(){var a;f.target.getSpec(function(b,c){f.targetSpec=b,f.transition=c,a||d()},!0)},1)}.bind(this),!1),!0):!1}function k(a,b){for(var c=0;c<a.transferables.length;c++){var d=a.transferables[c];if(d.mod.halt(),(void 0!==d.sourceSpec.opacity||void 0!==d.targetSpec.opacity)&&d.mod.setOpacity(void 0===d.targetSpec.opacity?1:d.targetSpec.opacity,d.transition||a.options.transfer.transition),a.options.transfer.fastResize){if(d.sourceSpec.transform||d.targetSpec.transform||d.sourceSpec.size||d.targetSpec.size){var e=d.targetSpec.transform||y.identity;d.sourceSpec.size&&d.targetSpec.size&&(e=y.multiply(e,y.scale(d.targetSpec.size[0]/d.sourceSpec.size[0],d.targetSpec.size[1]/d.sourceSpec.size[1],1))),d.mod.setTransform(e,d.transition||a.options.transfer.transition,b),b=void 0}}else(d.sourceSpec.transform||d.targetSpec.transform)&&(d.mod.setTransform(d.targetSpec.transform||y.identity,d.transition||a.options.transfer.transition,b),b=void 0),(d.sourceSpec.size||d.targetSpec.size)&&(d.mod.setSize(d.targetSpec.size||d.sourceSpec.size,d.transition||a.options.transfer.transition,b),b=void 0)}b&&b()}function l(a){for(var b=0;b<a.transferables.length;b++){for(var c=a.transferables[b],d=0;d<this._renderables.transferables.length;d++)if(this._renderables.transferables[d]===c.renderNode){this._renderables.transferables.splice(d,1);break}c.source.show(c.originalSource),c.target.show(c.originalTarget)}a.transferables=[],this.layout.reflowLayout()}function m(a){for(var b,c=0;c<this._viewStack.length;c++){var d=this._viewStack[c];switch(d.state){case E.HIDE:d.state=E.HIDING,r.call(this,d,b,a.size),u.call(this);break;case E.SHOW:d.state=E.SHOWING,n.call(this,d,b,a.size),u.call(this)}b=d}}function n(a,b,c){var d=a.options.show.animation?a.options.show.animation.call(void 0,!0,c):{};a.startSpec=d,a.endSpec={opacity:1,transform:y.identity},a.mod.halt(),d.transform&&a.mod.setTransform(d.transform),void 0!==d.opacity&&a.mod.setOpacity(d.opacity),d.align&&a.mod.setAlign(d.align),d.origin&&a.mod.setOrigin(d.origin);var e=o.bind(this,a,d),f=a.wait?function(){a.wait.then(e,e)}:e;b?i.call(this,a,b,f):f()}function o(a,b){if(!a.halted){var c=a.showCallback;b.transform&&(a.mod.setTransform(y.identity,a.options.show.transition,c),c=void 0),void 0!==b.opacity&&(a.mod.setOpacity(1,a.options.show.transition,c),c=void 0),k.call(this,a,c)}}function p(a,b,c){return a+(b-a)*c}function q(a,b){if(a.mod.halt(),a.halted=!0,a.startSpec&&void 0!==b&&(void 0!==a.startSpec.opacity&&void 0!==a.endSpec.opacity&&a.mod.setOpacity(p(a.startSpec.opacity,a.endSpec.opacity,b)),a.startSpec.transform&&a.endSpec.transform)){for(var c=[],d=0;d<a.startSpec.transform.length;d++)c.push(p(a.startSpec.transform[d],a.endSpec.transform[d],b));a.mod.setTransform(c)}}function r(a,b,c){var d=s.bind(this,a,b,c);a.wait?a.wait.then(d,d):d()}function s(a,b,c){var d=a.options.hide.animation?a.options.hide.animation.call(void 0,!1,c):{};if(a.endSpec=d,a.startSpec={opacity:1,transform:y.identity},!a.halted){a.mod.halt();var e=a.hideCallback;d.transform&&(a.mod.setTransform(d.transform,a.options.hide.transition,e),e=void 0),void 0!==d.opacity&&(a.mod.setOpacity(d.opacity,a.options.hide.transition,e),e=void 0),e&&e()}}function t(a,b,c){a.options={show:{transition:this.options.show.transition||this.options.transition,animation:this.options.show.animation||this.options.animation},hide:{transition:this.options.hide.transition||this.options.transition,animation:this.options.hide.animation||this.options.animation},transfer:{transition:this.options.transfer.transition||this.options.transition,items:this.options.transfer.items||{},zIndex:this.options.transfer.zIndex,fastResize:this.options.transfer.fastResize}},b&&(a.options.show.transition=(b.show?b.show.transition:void 0)||b.transition||a.options.show.transition,b&&b.show&&void 0!==b.show.animation?a.options.show.animation=b.show.animation:b&&void 0!==b.animation&&(a.options.show.animation=b.animation),a.options.transfer.transition=(b.transfer?b.transfer.transition:void 0)||b.transition||a.options.transfer.transition,a.options.transfer.items=(b.transfer?b.transfer.items:void 0)||a.options.transfer.items,a.options.transfer.zIndex=b.transfer&&void 0!==b.transfer.zIndex?b.transfer.zIndex:a.options.transfer.zIndex,a.options.transfer.fastResize=b.transfer&&void 0!==b.transfer.fastResize?b.transfer.fastResize:a.options.transfer.fastResize),a.showCallback=function(){a.showCallback=void 0,a.state=E.VISIBLE,u.call(this),l.call(this,a),a.endSpec=void 0,a.startSpec=void 0,c&&c()}.bind(this)}function u(){for(var a,b=!1,c=0,d=0;d<this._viewStack.length;){if(this._viewStack[d].state===E.HIDDEN){c++;for(var e=0;e<this._viewStack.length;e++)if(this._viewStack[e].state!==E.HIDDEN&&this._viewStack[e].view===this._viewStack[d].view){this._viewStack[d].view=void 0,this._renderables.views.splice(d,1),this._viewStack.splice(d,1),d--,c--;break}}d++}for(;c>this.options.keepHiddenViewsInDOMCount;)this._viewStack[0].view=void 0,this._renderables.views.splice(0,1),this._viewStack.splice(0,1),c--;for(d=c;d<Math.min(this._viewStack.length-c,2)+c;d++){var f=this._viewStack[d];if(f.state===E.QUEUED){a&&a.state!==E.VISIBLE&&a.state!==E.HIDING||(a&&a.state===E.VISIBLE&&(a.state=E.HIDE,a.wait=f.wait),f.state=E.SHOW,b=!0);break}f.state===E.VISIBLE&&f.hide&&(f.state=E.HIDE),(f.state===E.SHOW||f.state===E.HIDE)&&this.layout.reflowLayout(),a=f}b&&(u.call(this),this.layout.reflowLayout())}function v(){for(var a=0;a<Math.min(this._viewStack.length,2);a++){var b=this._viewStack[a];if(b.halted&&(b.halted=!1,b.endSpec)){var c;switch(b.state){case E.HIDE:case E.HIDING:c=b.hideCallback;break;case E.SHOW:case E.SHOWING:c=b.showCallback}b.mod.halt(),b.endSpec.transform&&(b.mod.setTransform(b.endSpec.transform,b.options.show.transition,c),c=void 0),void 0!==b.endSpec.opacity&&b.mod.setOpacity(b.endSpec.opacity,b.options.show.transition,c),c&&c()}}}var w=a("famous/core/View"),x=a("./LayoutController"),y=a("famous/core/Transform"),z=a("famous/core/Modifier"),A=a("famous/modifiers/StateModifier"),B=a("famous/core/RenderNode"),C=a("famous/utilities/Timer"),D=a("famous/transitions/Easing");d.prototype=Object.create(w.prototype),d.prototype.constructor=d,d.Animation={Slide:{Left:function(a,b){return{transform:y.translate(a?b[0]:-b[0],0,0)}},Right:function(a,b){return{transform:y.translate(a?-b[0]:b[0],0,0)}},Up:function(a,b){return{transform:y.translate(0,a?b[1]:-b[1],0)}},Down:function(a,b){return{transform:y.translate(0,a?-b[1]:b[1],0)}}},Fade:function(a,b){return{opacity:this&&void 0!==this.opacity?this.opacity:0}},Zoom:function(a,b){var c=this&&void 0!==this.scale?this.scale:.5;return{transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}},FadedZoom:function(a,b){var c=a?this&&void 0!==this.showScale?this.showScale:.9:this&&void 0!==this.hideScale?this.hideScale:1.1;return{opacity:this&&void 0!==this.opacity?this.opacity:0,transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}}},d.DEFAULT_OPTIONS={transition:{duration:400,curve:D.inOutQuad},animation:d.Animation.Fade,show:{},hide:{},transfer:{fastResize:!0,zIndex:10},zIndexOffset:0,keepHiddenViewsInDOMCount:0};var E={NONE:0,HIDE:1,HIDING:2,HIDDEN:3,SHOW:4,SHOWING:5,VISIBLE:6,QUEUED:7};d.prototype.show=function(a,b,c){if(v.call(this,a),!a)return this.hide(b,c);var d=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return d&&d.view===a&&d.state!==E.HIDDEN?(d.hide=!1,d.state===E.HIDE?(d.state=E.QUEUED,t.call(this,d,b,c),u.call(this)):c&&c(),this):(d&&d.state!==E.HIDING&&b&&(d.options.hide.transition=(b.hide?b.hide.transition:void 0)||b.transition||d.options.hide.transition,b&&b.hide&&void 0!==b.hide.animation?d.options.hide.animation=b.hide.animation:b&&void 0!==b.animation&&(d.options.hide.animation=b.animation)),d={view:a,mod:new A,state:E.QUEUED,callback:c,transferables:[],wait:b?b.wait:void 0},d.node=new B(d.mod),d.node.add(a),t.call(this,d,b,c),d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),this._renderables.views.push(d.node),this._viewStack.push(d),u.call(this),this)},d.prototype.hide=function(a,b){v.call(this);var c=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return c&&c.state!==E.HIDING?(c.hide=!0,a&&(c.options.hide.transition=(a.hide?a.hide.transition:void 0)||a.transition||c.options.hide.transition,a&&a.hide&&void 0!==a.hide.animation?c.options.hide.animation=a.hide.animation:a&&void 0!==a.animation&&(c.options.hide.animation=a.animation)),c.hideCallback=function(){c.hideCallback=void 0,c.state=E.HIDDEN,u.call(this),this.layout.reflowLayout(),b&&b()}.bind(this),u.call(this),this):this},d.prototype.halt=function(a,b){for(var c,d=0;d<this._viewStack.length;d++)if(a)switch(c=this._viewStack[d],c.state){case E.SHOW:case E.SHOWING:case E.HIDE:case E.HIDING:case E.VISIBLE:q(c,b)}else{if(c=this._viewStack[this._viewStack.length-1],c.state!==E.QUEUED&&c.state!==E.SHOW)break;this._renderables.views.splice(this._viewStack.length-1,1),this._viewStack.splice(this._viewStack.length-1,1),c.view=void 0}return this},d.prototype.abort=function(a){if(this._viewStack.length>=2&&this._viewStack[0].state===E.HIDING&&this._viewStack[1].state===E.SHOWING){var b,c=this._viewStack[0],d=this._viewStack[1];d.halted=!0,b=d.endSpec,d.endSpec=d.startSpec,d.startSpec=b,d.state=E.HIDING,d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=E.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=E.VISIBLE,u.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),v.call(this)}return this},d.prototype.get=function(){for(var a=0;a<this._viewStack.length;a++){var b=this._viewStack[a];if(b.state===E.VISIBLE||b.state===E.SHOW||b.state===E.SHOWING)return b.view}return void 0},d.prototype.getSize=function(){return this._size||this.options.size},c.exports=d}),define("famous-flex/layouts/WheelLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){for(e=a.size,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,j=b.diameter||3*i,n=j/2,o=2*Math.atan2(i/2,n),p=void 0===b.radialOpacity?1:b.radialOpacity,s.opacity=1,s.size[0]=e[0],s.size[1]=e[1],s.size[g]=e[g],s.size[f]=i,s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.rotate[0]=0,s.rotate[1]=0,s.rotate[2]=0,s.scrollLength=i,k=a.scrollOffset,l=Math.PI/2/o*i+i;l>=k&&(h=a.next());)k>=-l&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k+=i;for(k=a.scrollOffset-i;k>=-l&&(h=a.prev());)l>=k&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k-=i}var e,f,g,h,i,j,k,l,m,n,o,p,q=a("famous/utilities/Utility"),r={sequence:!0,direction:[q.Direction.Y,q.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},s={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=r,d.Name="WheelLayout",d.Description="Spinner-wheel/slot-machine layout",c.exports=d}),define("famous-flex/layouts/ProportionalLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){for(f=a.size,e=a.direction,g=b.ratios,h=0,j=0;j<g.length;j++)h+=g[j];for(n.size[0]=f[0],n.size[1]=f[1],n.translate[0]=0,n.translate[1]=0,k=a.next(),i=0,j=0;k&&j<g.length;)n.size[e]=(f[e]-i)/h*g[j],n.translate[e]=i,a.set(k,n),i+=n.size[e],h-=g[j],j++,k=a.next()}var e,f,g,h,i,j,k,l=a("famous/utilities/Utility"),m={sequence:!0,direction:[l.Direction.Y,l.Direction.X],scrolling:!1},n={size:[0,0],translate:[0,0,0]};d.Capabilities=m,c.exports=d}),define("famous-flex/widgets/DatePickerComponents",["require","exports","module","famous/core/Surface","famous/core/EventHandler"],function(a,b,c){function d(a){return""+a[this.get]()}function e(a){return("0"+a[this.get]()).slice(-2)}function f(a){return("00"+a[this.get]()).slice(-3)}function g(a){return("000"+a[this.get]()).slice(-4)}function h(a){if(this._eventOutput=new s,this._pool=[],s.setOutputHandler(this,this._eventOutput),a)for(var b in a)this[b]=a[b]}function i(){h.apply(this,arguments)}function j(){h.apply(this,arguments)}function k(){h.apply(this,arguments)}function l(){h.apply(this,arguments)}function m(){h.apply(this,arguments)}function n(){h.apply(this,arguments)}function o(){h.apply(this,arguments)}function p(){h.apply(this,arguments)}function q(){h.apply(this,arguments)}var r=a("famous/core/Surface"),s=a("famous/core/EventHandler");h.prototype.step=1,h.prototype.classes=["item"],h.prototype.getComponent=function(a){return a[this.get]()},h.prototype.setComponent=function(a,b){return a[this.set](b)},h.prototype.format=function(a){return"overide to implement"},h.prototype.createNext=function(a){var b=this.getNext(a.date);return b?this.create(b):void 0},h.prototype.getNext=function(a){a=new Date(a.getTime());var b=this.getComponent(a)+this.step;if(void 0!==this.upperBound&&b>=this.upperBound){if(!this.loop)return void 0;b=Math.max(b%this.upperBound,this.lowerBound||0)}return this.setComponent(a,b),a},h.prototype.createPrevious=function(a){var b=this.getPrevious(a.date);return b?this.create(b):void 0},h.prototype.getPrevious=function(a){a=new Date(a.getTime());var b=this.getComponent(a)-this.step;if(void 0!==this.lowerBound&&b<this.lowerBound){if(!this.loop)return void 0;b%=this.upperBound}return this.setComponent(a,b),a},h.prototype.installClickHandler=function(a){a.on("click",function(b){this._eventOutput.emit("click",{target:a,event:b})}.bind(this))},h.prototype.createRenderable=function(a,b){return new r({classes:a,content:"<div>"+b+"</div>"})},h.prototype.create=function(a){a=a||new Date;var b;return this._pool.length?(b=this._pool[0],this._pool.splice(0,1),b.setContent(this.format(a))):(b=this.createRenderable(this.classes,this.format(a)),this.installClickHandler(b)),b.date=a,b},h.prototype.destroy=function(a){this._pool.push(a)},i.prototype=Object.create(h.prototype),i.prototype.constructor=i,i.prototype.classes=["item","year"],i.prototype.format=g,i.prototype.sizeRatio=1,i.prototype.step=1,i.prototype.loop=!1,i.prototype.set="setFullYear",i.prototype.get="getFullYear",j.prototype=Object.create(h.prototype),j.prototype.constructor=j,j.prototype.classes=["item","month"],j.prototype.sizeRatio=2,j.prototype.lowerBound=0,j.prototype.upperBound=12,j.prototype.step=1,j.prototype.loop=!0,j.prototype.set="setMonth",j.prototype.get="getMonth",j.prototype.strings=["January","February","March","April","May","June","July","August","September","October","November","December"],
-j.prototype.format=function(a){return this.strings[a.getMonth()]},k.prototype=Object.create(h.prototype),k.prototype.constructor=k,k.prototype.classes=["item","fullday"],k.prototype.sizeRatio=2,k.prototype.step=1,k.prototype.set="setDate",k.prototype.get="getDate",k.prototype.format=function(a){return a.toLocaleDateString()},l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.classes=["item","weekday"],l.prototype.sizeRatio=2,l.prototype.lowerBound=0,l.prototype.upperBound=7,l.prototype.step=1,l.prototype.loop=!0,l.prototype.set="setDate",l.prototype.get="getDate",l.prototype.strings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l.prototype.format=function(a){return this.strings[a.getDay()]},m.prototype=Object.create(h.prototype),m.prototype.constructor=m,m.prototype.classes=["item","day"],m.prototype.format=d,m.prototype.sizeRatio=1,m.prototype.lowerBound=1,m.prototype.upperBound=32,m.prototype.step=1,m.prototype.loop=!0,m.prototype.set="setDate",m.prototype.get="getDate",n.prototype=Object.create(h.prototype),n.prototype.constructor=n,n.prototype.classes=["item","hour"],n.prototype.format=e,n.prototype.sizeRatio=1,n.prototype.lowerBound=0,n.prototype.upperBound=24,n.prototype.step=1,n.prototype.loop=!0,n.prototype.set="setHours",n.prototype.get="getHours",o.prototype=Object.create(h.prototype),o.prototype.constructor=o,o.prototype.classes=["item","minute"],o.prototype.format=e,o.prototype.sizeRatio=1,o.prototype.lowerBound=0,o.prototype.upperBound=60,o.prototype.step=1,o.prototype.loop=!0,o.prototype.set="setMinutes",o.prototype.get="getMinutes",p.prototype=Object.create(h.prototype),p.prototype.constructor=p,p.prototype.classes=["item","second"],p.prototype.format=e,p.prototype.sizeRatio=1,p.prototype.lowerBound=0,p.prototype.upperBound=60,p.prototype.step=1,p.prototype.loop=!0,p.prototype.set="setSeconds",p.prototype.get="getSeconds",q.prototype=Object.create(h.prototype),q.prototype.constructor=q,q.prototype.classes=["item","millisecond"],q.prototype.format=f,q.prototype.sizeRatio=1,q.prototype.lowerBound=0,q.prototype.upperBound=1e3,q.prototype.step=1,q.prototype.loop=!0,q.prototype.set="setMilliseconds",q.prototype.get="getMilliseconds",c.exports={Base:h,Year:i,Month:j,FullDay:k,WeekDay:l,Day:m,Hour:n,Minute:o,Second:p,Millisecond:q}}),define("famous-flex/widgets/DatePicker",["require","exports","module","famous/core/View","famous/core/Surface","famous/utilities/Utility","famous/surfaces/ContainerSurface","../LayoutController","../ScrollController","../layouts/WheelLayout","../layouts/ProportionalLayout","../VirtualViewSequence","./DatePickerComponents","../LayoutUtility"],function(a,b,c){function d(a){p.apply(this,arguments),a=a||{},this._date=new Date(a.date?a.date.getTime():void 0),this._components=[],this.classes=a.classes?this.classes.concat(a.classes):this.classes,h.call(this),m.call(this),this._overlayRenderables={top:e.call(this,"top"),middle:e.call(this,"middle"),bottom:e.call(this,"bottom")},o.call(this),this.setOptions(this.options)}function e(a,b){var c=this.options.createRenderables[Array.isArray(a)?a[0]:a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new q({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});if(Array.isArray(a))for(var e=0;e<a.length;e++)d.addClass(a[e]);else d.addClass(a);return d}function f(a){for(var b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();if(e&&e.viewSequence){var f=e.viewSequence,g=e.viewSequence.get(),h=d.getComponent(g.date),i=d.getComponent(a),j=0;if(h!==i&&(j=i-h,d.loop)){var k=0>j?j+d.upperBound:j-d.upperBound;Math.abs(k)<Math.abs(j)&&(j=k)}if(j)for(;h!==i&&(f=j>0?f.getNext():f.getPrevious(),g=f?f.get():void 0);)h=d.getComponent(g.date),j>0?c.scrollController.goToNextPage():c.scrollController.goToPreviousPage();else c.scrollController.goToRenderNode(g)}}}function g(){for(var a=new Date(this._date),b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();e&&e.renderNode&&d.setComponent(a,d.getComponent(e.renderNode.date))}return a}function h(){this.container=new s(this.options.container),this.container.setClasses(this.classes),this.layout=new t({layout:w,layoutOptions:{ratios:[]},direction:r.Direction.X}),this.container.add(this.layout),this.add(this.container)}function i(a,b){}function j(){this._scrollingCount++,1===this._scrollingCount&&this._eventOutput.emit("scrollstart",{target:this})}function k(){this._scrollingCount--,0===this._scrollingCount&&this._eventOutput.emit("scrollend",{target:this,date:this._date})}function l(){this._date=g.call(this),this._eventOutput.emit("datechange",{target:this,date:this._date})}function m(){this.scrollWheels=[],this._scrollingCount=0;for(var a=[],b=[],c=0;c<this._components.length;c++){var d=this._components[c];d.createRenderable=e.bind(this);var f=new x({factory:d,value:d.create(this._date)}),g=z.combineOptions(this.options.scrollController,{layout:v,layoutOptions:this.options.wheelLayout,flow:!1,direction:r.Direction.Y,dataSource:f,autoPipeEvents:!0}),h=new u(g);h.on("scrollstart",j.bind(this)),h.on("scrollend",k.bind(this)),h.on("pagechange",l.bind(this));var m={component:d,scrollController:h,viewSequence:f};this.scrollWheels.push(m),d.on("click",i.bind(this,m)),a.push(h),b.push(d.sizeRatio)}this.layout.setDataSource(a),this.layout.setLayoutOptions({ratios:b})}function n(a,b){var c=(a.size[1]-b.itemSize)/2;a.set("top",{size:[a.size[0],c],translate:[0,0,1]}),a.set("middle",{size:[a.size[0],a.size[1]-2*c],translate:[0,c,1]}),a.set("bottom",{size:[a.size[0],c],translate:[0,a.size[1]-c,1]})}function o(){this.overlay=new t({layout:n,layoutOptions:{itemSize:this.options.wheelLayout.itemSize},dataSource:this._overlayRenderables}),this.add(this.overlay)}var p=a("famous/core/View"),q=a("famous/core/Surface"),r=a("famous/utilities/Utility"),s=a("famous/surfaces/ContainerSurface"),t=a("../LayoutController"),u=a("../ScrollController"),v=a("../layouts/WheelLayout"),w=a("../layouts/ProportionalLayout"),x=a("../VirtualViewSequence"),y=a("./DatePickerComponents"),z=a("../LayoutUtility");d.prototype=Object.create(p.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-datepicker"],d.Component=y,d.DEFAULT_OPTIONS={perspective:500,wheelLayout:{itemSize:100,diameter:500},createRenderables:{item:!0,top:!1,middle:!1,bottom:!1},scrollController:{enabled:!0,paginated:!0,paginationMode:u.PaginationMode.SCROLL,mouseMove:!0,scrollSpring:{dampingRatio:1,period:800}}},d.prototype.setOptions=function(a){if(p.prototype.setOptions.call(this,a),!this.layout)return this;void 0!==a.perspective&&this.container.context.setPerspective(a.perspective);var b;if(void 0!==a.wheelLayout){for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setLayoutOptions(a.wheelLayout);this.overlay.setLayoutOptions({itemSize:this.options.wheelLayout.itemSize})}if(void 0!==a.scrollController)for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setOptions(a.scrollController);return this},d.prototype.setComponents=function(a){return this._components=a,m.call(this),this},d.prototype.getComponents=function(){return this._components},d.prototype.setDate=function(a){return this._date.setTime(a.getTime()),f.call(this,this._date),this},d.prototype.getDate=function(){return this._date},c.exports=d}),define("famous-flex/layouts/TabBarLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){e=a.size,f=a.direction,g=f?0:1,k=b.spacing||0,h=a.get("items"),i=a.get("spacers"),j=q.normalizeMargins(b.margins),o=b.zIncrement||2,s.size[0]=a.size[0],s.size[1]=a.size[1],s.size[g]-=j[1-g]+j[3-g],s.translate[0]=0,s.translate[1]=0,s.translate[2]=o,s.translate[g]=j[f?3:0],s.align[0]=0,s.align[1]=0,s.origin[0]=0,s.origin[1]=0,n=f?j[0]:j[3],l=e[f]-(n+(f?j[2]:j[1])),l-=(h.length-1)*k;for(var c=0;c<h.length;c++)m=void 0===b.itemSize?Math.round(l/(h.length-c)):b.itemSize===!0?a.resolveSize(h[c],e)[f]:b.itemSize,s.scrollLength=m,0===c&&(s.scrollLength+=f?j[0]:j[3]),c===h.length-1?s.scrollLength+=f?j[2]:j[1]:s.scrollLength+=k,s.size[f]=m,s.translate[f]=n,a.set(h[c],s),n+=m,l-=m,c===b.selectedItemIndex&&(s.scrollLength=0,s.translate[f]+=m/2,s.translate[2]=2*o,s.origin[f]=.5,a.set("selectedItemOverlay",s),s.origin[f]=0,s.translate[2]=o),c<h.length-1?(i&&c<i.length&&(s.size[f]=k,s.translate[f]=n,a.set(i[c],s)),n+=k):n+=f?j[2]:j[1];s.scrollLength=0,s.size[0]=e[0],s.size[1]=e[1],s.size[f]=e[f],s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.translate[f]=0,a.set("background",s)}var e,f,g,h,i,j,k,l,m,n,o,p=a("famous/utilities/Utility"),q=a("../LayoutUtility"),r={sequence:!0,direction:[p.Direction.X,p.Direction.Y],trueSize:!0},s={size:[0,0],translate:[0,0,0],align:[0,0],origin:[0,0]};d.Capabilities=r,d.Name="TabBarLayout",d.Description="TabBar widget layout",c.exports=d}),define("famous-flex/widgets/TabBar",["require","exports","module","famous/core/Surface","famous/core/View","../LayoutController","../layouts/TabBarLayout"],function(a,b,c){function d(a){h.apply(this,arguments),this._selectedItemIndex=-1,a=a||{},this.classes=a.classes?this.classes.concat(a.classes):this.classes,this.layout=new i(this.options.layoutController),this.add(this.layout),this.layout.pipe(this._eventOutput),this._renderables={items:[],spacers:[],background:f.call(this,"background"),selectedItemOverlay:f.call(this,"selectedItemOverlay")},this.setOptions(this.options)}function e(a){if(a!==this._selectedItemIndex){var b=this._selectedItemIndex;this._selectedItemIndex=a,this.layout.setLayoutOptions({selectedItemIndex:a}),b>=0&&this._renderables.items[b].removeClass&&this._renderables.items[b].removeClass("selected"),this._renderables.items[a].addClass&&this._renderables.items[a].addClass("selected"),b>=0&&this._eventOutput.emit("tabchange",{target:this,index:a,oldIndex:b,item:this._renderables.items[a],oldItem:b>=0&&b<this._renderables.items.length?this._renderables.items[b]:void 0})}}function f(a,b){var c=this.options.createRenderables[a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new g({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});return d.addClass(a),"item"===a&&this.options.tabBarLayout&&this.options.tabBarLayout.itemSize&&this.options.tabBarLayout.itemSize===!0&&d.setSize(this.layout.getDirection()?[void 0,!0]:[!0,void 0]),d}var g=a("famous/core/Surface"),h=a("famous/core/View"),i=a("../LayoutController"),j=a("../layouts/TabBarLayout");d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-tabbar"],d.DEFAULT_OPTIONS={tabBarLayout:{margins:[0,0,0,0],spacing:0},createRenderables:{item:!0,background:!1,selectedItemOverlay:!1,spacer:!1},layoutController:{autoPipeEvents:!0,layout:j,flow:!0,flowOptions:{reflowOnResize:!1,spring:{dampingRatio:.8,period:300}}}},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),this.layout?(void 0!==a.tabBarLayout&&this.layout.setLayoutOptions(a.tabBarLayout),a.layoutController&&this.layout.setOptions(a.layoutController),this):this},d.prototype.setItems=function(a){var b=this._selectedItemIndex;if(this._selectedItemIndex=-1,this._renderables.items=[],this._renderables.spacers=[],a)for(var c=0;c<a.length;c++){var d=f.call(this,"item",a[c]);if(d.on&&d.on("click",e.bind(this,c)),this._renderables.items.push(d),c<a.length-1){var g=f.call(this,"spacer"," ");g&&this._renderables.spacers.push(g)}}return this.layout.setDataSource(this._renderables),this._renderables.items.length&&e.call(this,Math.max(Math.min(b,this._renderables.items.length-1),0)),this},d.prototype.getItems=function(){return this._renderables.items},d.prototype.getItemSpec=function(a,b){return this.layout.getSpec(this._renderables.items[a],b)},d.prototype.setSelectedItemIndex=function(a){return e.call(this,a),this},d.prototype.getSelectedItemIndex=function(){return this._selectedItemIndex},d.prototype.getSize=function(){return this.options.size||(this.layout?this.layout.getSize():h.prototype.getSize.call(this))},c.exports=d}),define("famous-flex/widgets/TabBarController",["require","exports","module","famous/core/View","../AnimationController","./TabBar","../helpers/LayoutDockHelper","../LayoutController","famous/transitions/Easing"],function(a,b,c){function d(a){i.apply(this,arguments),e.call(this),f.call(this),g.call(this),this.tabBar.setOptions({layoutController:{direction:this.options.tabBarPosition===d.Position.TOP||this.options.tabBarPosition===d.Position.BOTTOM?0:1}})}function e(){this.tabBar=new k(this.options.tabBar),this.animationController=new j(this.options.animationController),this._renderables={tabBar:this.tabBar,content:this.animationController}}function f(){this.layout=new m(this.options.layoutController),this.layout.setLayout(d.DEFAULT_LAYOUT.bind(this)),this.layout.setDataSource(this._renderables),this.add(this.layout)}function g(){this.tabBar.on("tabchange",function(a){h.call(this,a),this._eventOutput.emit("tabchange",{target:this,index:a.index,oldIndex:a.oldIndex,item:this._items[a.index],oldItem:a.oldIndex>=0&&a.oldIndex<this._items.length?this._items[a.oldIndex]:void 0})}.bind(this))}function h(a){var b=this.tabBar.getSelectedItemIndex();this.animationController.halt(),b>=0?this.animationController.show(this._items[b].view):this.animationController.hide()}var i=a("famous/core/View"),j=a("../AnimationController"),k=a("./TabBar"),l=a("../helpers/LayoutDockHelper"),m=a("../LayoutController"),n=a("famous/transitions/Easing");d.prototype=Object.create(i.prototype),d.prototype.constructor=d,d.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3},d.DEFAULT_LAYOUT=function(a,b){var c=new l(a,b);switch(this.options.tabBarPosition){case d.Position.TOP:c.top("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.BOTTOM:c.bottom("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.LEFT:c.left("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.RIGHT:c.right("tabBar",this.options.tabBarSize,this.options.tabBarZIndex)}c.fill("content")},d.DEFAULT_OPTIONS={tabBarPosition:d.Position.BOTTOM,tabBarSize:50,tabBarZIndex:10,tabBar:{createRenderables:{background:!0}},animationController:{transition:{duration:300,curve:n.inOutQuad},animation:j.Animation.FadedZoom}},d.prototype.setOptions=function(a){return i.prototype.setOptions.call(this,a),this.layout&&a.layoutController&&this.layout.setOptions(a.layoutController),this.tabBar&&a.tabBar&&this.tabBar.setOptions(a.tabBar),this.animationController&&a.animationController&&this.animationController(a.animationController),this.layout&&void 0!==a.tabBarPosition&&this.tabBar.setOptions({layoutController:{direction:a.tabBarPosition===d.Position.TOP||a.tabBarPosition===d.Position.BOTTOM?0:1}}),this.layout&&this.layout.reflowLayout(),this},d.prototype.setItems=function(a){this._items=a;for(var b=[],c=0;c<a.length;c++)b.push(a[c].tabItem);return this.tabBar.setItems(b),h.call(this),this},d.prototype.getItems=function(){return this._items},d.prototype.setSelectedItemIndex=function(a){return this.tabBar.setSelectedItemIndex(a),this},d.prototype.getSelectedItemIndex=function(){return this.tabBar.getSelectedItemIndex()},c.exports=d}),define("famous-flex/layouts/CollectionLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){if(!s.length)return 0;var c,d,e=[0,0];for(c=0;c<s.length;c++)e[i]=Math.max(e[i],s[c].size[i]),e[k]+=(c>0?o[k]:0)+s[c].size[k];var f,h=p[k]?(l-e[k])/(2*s.length):0,q=(i?n[3]:n[0])+h;for(c=0;c<s.length;c++){d=s[c];var r=[0,0,0];r[k]=q,r[i]=a?m:m-e[i],f=0,0===c&&(f=e[i],f+=b&&(a&&!j||!a&&j)?i?n[0]+n[2]:n[3]+n[1]:o[i]),d.set={size:d.size,translate:r,scrollLength:f},q+=d.size[k]+o[k]+2*h}for(c=0;c<s.length;c++)d=a?s[c]:s[s.length-1-c],g.set(d.node,d.set);return s=[],e[i]+o[i]}function e(a){var b=q;if(r&&(b=r(a.renderNode,h)),b[0]===!0||b[1]===!0){var c=g.resolveSize(a,h);return b[0]!==!0&&(c[0]=q[0]),b[1]!==!0&&(c[1]=q[1]),c}return b}function f(a,b){if(g=a,h=g.size,i=g.direction,j=g.alignment,k=(i+1)%2,void 0!==b.gutter&&console.warn&&!b.suppressWarnings&&console.warn("option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead"),!b.gutter||b.margins||b.spacing)n=u.normalizeMargins(b.margins),o=b.spacing||0,o=Array.isArray(o)?o:[o,o];else{var c=Array.isArray(b.gutter)?b.gutter:[b.gutter,b.gutter];n=[c[1],c[0],c[1],c[0]],o=c}w[0]=n[i?0:3],w[1]=-n[i?2:1],p=Array.isArray(b.justify)?b.justify:b.justify?[!0,!0]:[!1,!1],l=h[k]-(i?n[3]+n[1]:n[0]+n[2]);var f,t,v,x;for(b.cells?(b.itemSize&&console.warn&&!b.suppressWarnings&&console.warn("options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two"),q=[[void 0,!0].indexOf(b.cells[0])>-1?b.cells[0]:(h[0]-(n[1]+n[3]+o[0]*(b.cells[0]-1)))/b.cells[0],[void 0,!0].indexOf(b.cells[1])>-1?b.cells[1]:(h[1]-(n[0]+n[2]+o[1]*(b.cells[1]-1)))/b.cells[1]]):b.itemSize?b.itemSize instanceof Function?r=b.itemSize:q=void 0===b.itemSize[0]||void 0===b.itemSize[0]?[void 0===b.itemSize[0]?h[0]:b.itemSize[0],void 0===b.itemSize[1]?h[1]:b.itemSize[1]]:b.itemSize:q=[!0,!0],m=g.scrollOffset+w[j]+(j?o[i]:0),x=g.scrollEnd+(j?0:w[j]),v=0,s=[];x>m;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+w[j]-(j?0:o[i]),x=g.scrollStart+(j?w[j]:0),v=0,s=[];m>x;){if(f=g.prev(),!f){d(!1,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m-=d(!1,!f),v=t[k]),s.unshift({node:f,size:t})}}var g,h,i,j,k,l,m,n,o,p,q,r,s,t=a("famous/utilities/Utility"),u=a("../LayoutUtility"),v={sequence:!0,direction:[t.Direction.Y,t.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},w=[0,0];f.Capabilities=v,f.Name="CollectionLayout",f.Description="Multi-cell collection-layout with margins & spacing",c.exports=f}),define("famous-flex/layouts/CoverLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){var c=a.next();if(c){var d=a.size,e=a.direction,f=b.itemSize,g=.2,h=.1,i=30,j=100;a.set(c,{size:f,origin:[.5,.5],align:[.5,.5],translate:[0,0,j],scrollLength:f[e]});var k=f[0]/2,l=1-g,m=j-1,n=1-h,o=!1,p=!1;for(c=a.next(),c||(c=a.prev(),o=!0);c;)if(a.set(c,{size:f,origin:[.5,.5],align:[.5,.5],translate:e?[0,o?-k:k,m]:[o?-k:k,0,m],scale:[n,n,1],opacity:l,scrollLength:f[e]}),l-=g,n-=h,k+=i,m--,k>=d[e]/2?p=!0:(c=o?a.prev():a.next(),p=!c),p){if(o)break;p=!1,o=!0,c=a.prev(),c&&(k=f[e]/2,l=1-g,m=j-1,n=1-h)}}}var e=a("famous/utilities/Utility"),f={sequence:!0,direction:[e.Direction.X,e.Direction.Y],scrolling:!0,sequentialScrollingOptimized:!1};d.Capabilities=f,c.exports=d}),define("famous-flex/layouts/CubeLayout",["require","exports","module"],function(a,b,c){c.exports=function(a,b){var c=b.itemSize;a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[c[0]/2,0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[-(c[0]/2),0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,-(c[1]/2),0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,c[1]/2,0]})}}),define("famous-flex/layouts/GridLayout",["require","exports","module","./CollectionLayout"],function(a,b,c){console.warn&&console.warn("GridLayout has been deprecated and will be removed in the future, use CollectionLayout instead"),c.exports=a("./CollectionLayout")}),define("famous-flex/layouts/HeaderFooterLayout",["require","exports","module","../helpers/LayoutDockHelper"],function(a,b,c){var d=a("../helpers/LayoutDockHelper");c.exports=function(a,b){var c=new d(a,b);c.top("header",void 0!==b.headerSize?b.headerSize:b.headerHeight),c.bottom("footer",void 0!==b.footerSize?b.footerSize:b.footerHeight),c.fill("content")}}),define("famous-flex/layouts/NavBarLayout",["require","exports","module","../helpers/LayoutDockHelper"],function(a,b,c){var d=a("../helpers/LayoutDockHelper");c.exports=function(a,b){var c=new d(a,{margins:b.margins,translateZ:b.hasOwnProperty("zIncrement")?b.zIncrement:2});a.set("background",{size:a.size});var e=a.get("backIcon");e&&(c.left(e,b.backIconWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var f=a.get("backItem");f&&(c.left(f,b.backItemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var g,h,i=a.get("rightItems");if(i)for(h=0;h<i.length;h++)g=a.get(i[h]),c.right(g,b.rightItemWidth||b.itemWidth),c.right(void 0,b.rightItemSpacer||b.itemSpacer);var j=a.get("leftItems");if(j)for(h=0;h<j.length;h++)g=a.get(j[h]),c.left(g,b.leftItemWidth||b.itemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer);var k=a.get("title");if(k){var l=a.resolveSize(k,a.size),m=Math.max((a.size[0]-l[0])/2,c.get().left),n=Math.min((a.size[0]+l[0])/2,c.get().right);m=Math.max(m,a.size[0]-n),n=Math.min(n,a.size[0]-m),a.set(k,{size:[n-m,a.size[1]],translate:[m,0,c.get().z]})}}}),define("template.js",["require","famous-flex/FlexScrollView","famous-flex/FlowLayoutNode","famous-flex/LayoutContext","famous-flex/LayoutController","famous-flex/LayoutNode","famous-flex/LayoutNodeManager","famous-flex/LayoutUtility","famous-flex/ScrollController","famous-flex/VirtualViewSequence","famous-flex/AnimationController","famous-flex/widgets/DatePicker","famous-flex/widgets/TabBar","famous-flex/widgets/TabBarController","famous-flex/layouts/CollectionLayout","famous-flex/layouts/CoverLayout","famous-flex/layouts/CubeLayout","famous-flex/layouts/GridLayout","famous-flex/layouts/HeaderFooterLayout","famous-flex/layouts/ListLayout","famous-flex/layouts/NavBarLayout","famous-flex/layouts/ProportionalLayout","famous-flex/layouts/WheelLayout","famous-flex/helpers/LayoutDockHelper"],function(a){a("famous-flex/FlexScrollView"),a("famous-flex/FlowLayoutNode"),a("famous-flex/LayoutContext"),a("famous-flex/LayoutController"),a("famous-flex/LayoutNode"),a("famous-flex/LayoutNodeManager"),a("famous-flex/LayoutUtility"),a("famous-flex/ScrollController"),a("famous-flex/VirtualViewSequence"),a("famous-flex/AnimationController"),a("famous-flex/widgets/DatePicker"),a("famous-flex/widgets/TabBar"),a("famous-flex/widgets/TabBarController"),a("famous-flex/layouts/CollectionLayout"),a("famous-flex/layouts/CoverLayout"),a("famous-flex/layouts/CubeLayout"),a("famous-flex/layouts/GridLayout"),a("famous-flex/layouts/HeaderFooterLayout"),a("famous-flex/layouts/ListLayout"),a("famous-flex/layouts/NavBarLayout"),a("famous-flex/layouts/ProportionalLayout"),a("famous-flex/layouts/WheelLayout"),a("famous-flex/helpers/LayoutDockHelper")});
\ No newline at end of file
+function assert(a,b){if(!a)throw new Error(b)}define("famous-flex/LayoutUtility",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(){}function e(a,b){if(a===b)return!0;if(void 0===a||void 0===b)return!1;var c=a.length;if(c!==b.length)return!1;for(;c--;)if(a[c]!==b[c])return!1;return!0}var f=a("famous/utilities/Utility");d.registeredHelpers={};var g={SEQUENCE:1,DIRECTION_X:2,DIRECTION_Y:4,SCROLLING:8};d.Capabilities=g,d.normalizeMargins=function(a){return a?Array.isArray(a)?0===a.length?[0,0,0,0]:1===a.length?[a[0],a[0],a[0],a[0]]:2===a.length?[a[0],a[1],a[0],a[1]]:a:[a,a,a,a]:[0,0,0,0]},d.cloneSpec=function(a){var b={};return void 0!==a.opacity&&(b.opacity=a.opacity),void 0!==a.size&&(b.size=a.size.slice(0)),void 0!==a.transform&&(b.transform=a.transform.slice(0)),void 0!==a.origin&&(b.origin=a.origin.slice(0)),void 0!==a.align&&(b.align=a.align.slice(0)),b},d.isEqualSpec=function(a,b){return a.opacity!==b.opacity?!1:e(a.size,b.size)&&e(a.transform,b.transform)&&e(a.origin,b.origin)&&e(a.align,b.align)?!0:!1},d.getSpecDiffText=function(a,b){var c="spec diff:";return a.opacity!==b.opacity&&(c+="\nopacity: "+a.opacity+" != "+b.opacity),e(a.size,b.size)||(c+="\nsize: "+JSON.stringify(a.size)+" != "+JSON.stringify(b.size)),e(a.transform,b.transform)||(c+="\ntransform: "+JSON.stringify(a.transform)+" != "+JSON.stringify(b.transform)),e(a.origin,b.origin)||(c+="\norigin: "+JSON.stringify(a.origin)+" != "+JSON.stringify(b.origin)),e(a.align,b.align)||(c+="\nalign: "+JSON.stringify(a.align)+" != "+JSON.stringify(b.align)),c},d.error=function(a){throw console.log("ERROR: "+a),a},d.warning=function(a){console.log("WARNING: "+a)},d.log=function(a){for(var b="",c=0;c<arguments.length;c++){var d=arguments[c];b+=d instanceof Object||d instanceof Array?JSON.stringify(d):d}console.log(b)},d.combineOptions=function(a,b,c){if(a&&!b&&!c)return a;if(!a&&b&&!c)return b;var d=f.clone(a||{});if(b)for(var e in b)d[e]=b[e];return d},d.registerHelper=function(a,b){b.prototype.parse||d.error('The layout-helper for name "'+a+'" is required to support the "parse" method'),void 0!==this.registeredHelpers[a]&&d.warning('A layout-helper with the name "'+a+'" is already registered and will be overwritten'),this.registeredHelpers[a]=b},d.unregisterHelper=function(a){delete this.registeredHelpers[a]},d.getRegisteredHelper=function(a){return this.registeredHelpers[a]},c.exports=d}),define("famous-flex/LinkedListViewSequence",["require","exports","module"],function(a,b,c){function d(a){if(Array.isArray(a)){this._=new this.constructor.Backing(this);for(var b=0;b<a.length;b++)this.push(a[b])}else this._=a||new this.constructor.Backing(this)}d.Backing=function(){this.length=0},d.prototype.getHead=function(){return this._.head},d.prototype.getTail=function(){return this._.tail},d.prototype.getPrevious=function(){return this._prev},d.prototype.getNext=function(){return this._next},d.prototype.get=function(){return this._value},d.prototype.set=function(a){return this._value=a,this},d.prototype.getIndex=function(){return this._value?this.indexOf(this._value):0},d.prototype.toString=function(){return""+this.getIndex()},d.prototype.indexOf=function(a){for(var b=this._.head,c=0;b;){if(b._value===a)return c;c++,b=b._next}return-1},d.prototype.findByIndex=function(a){if(a=-1===a?this._.length-1:a,0>a||a>=this._.length)return void 0;var b,c;if(a>this._.length/2)for(c=this._.tail,b=this._.length-1;b>a;)c=c._prev,b--;else for(c=this._.head,b=0;a>b;)c=c._next,b++;return c},d.prototype.findByValue=function(a){for(var b=this._.head;b;){if(b.get()===a)return b;b=b._next}return void 0},d.prototype.insert=function(a,b){if(a=-1===a?this._.length:a,!this._.length)return assert(0===a,"inserting in empty view-sequence, but not at index 0 (but "+a+" instead)"),this._value=b,this._.head=this,this._.tail=this,this._.length=1,this;var c;if(0===a)c=new d(this._),c._value=b,c._next=this._.head,this._.head._prev=c,this._.head=c;else if(a===this._.length)c=new d(this._),c._value=b,c._prev=this._.tail,this._.tail._next=c,this._.tail=c;else{var e,f;if(assert(a>0&&a<this._.length,"invalid insert index: "+a+" (length: "+this._.length+")"),a>this._.length/2)for(f=this._.tail,e=this._.length-1;e>=a;)f=f._prev,e--;else for(f=this._.head,e=1;a>e;)f=f._next,e++;c=new d(this._),c._value=b,c._prev=f,c._next=f._next,f._next._prev=c,f._next=c}return this._.length++,c},d.prototype.remove=function(a){return a._prev&&a._next?(a._prev._next=a._next,a._next._prev=a._prev,this._.length--,a===this?a._prev:this):a._prev||a._next?a._prev?(assert(!a._next,"next should be empty"),assert(this._.tail===a,"tail is invalid"),a._prev._next=void 0,this._.tail=a._prev,this._.length--,a===this?this._.tail:this):(assert(this._.head===a,"head is invalid"),a._next._prev=void 0,this._.head=a._next,this._.length--,a===this?this._.head:this):(assert(a===this,"only one sequence exists, should be this one"),assert(this._value,"last node should have a value"),assert(this._.head,"head is invalid"),assert(this._.tail,"tail is invalid"),assert(1===this._.length,"length should be 1"),this._value=void 0,this._.head=void 0,this._.tail=void 0,this._.length--,this)},d.prototype.getLength=function(){return this._.length},d.prototype.clear=function(){for(var a=this;this._.length;)a=a.remove(this._.tail);return a},d.prototype.unshift=function(a){return this.insert(0,a)},d.prototype.push=function(a){return this.insert(-1,a)},d.prototype.splice=function(a,b,c){console.error&&console.error("LinkedListViewSequence.splice is not supported")},d.prototype.swap=function(a,b){var c=this.findByIndex(a);if(!c)throw new Error("Invalid first index specified to swap: "+a);var d=this.findByIndex(b);if(!d)throw new Error("Invalid second index specified to swap: "+b);var e=c._value;return c._value=d._value,d._value=e,this},c.exports=d}),define("famous-flex/LayoutContext",["require","exports","module"],function(a,b,c){function d(a){for(var b in a)this[b]=a[b]}d.prototype.size=void 0,d.prototype.direction=void 0,d.prototype.scrollOffset=void 0,d.prototype.scrollStart=void 0,d.prototype.scrollEnd=void 0,d.prototype.next=function(){},d.prototype.prev=function(){},d.prototype.get=function(a){},d.prototype.set=function(a,b){},d.prototype.resolveSize=function(a){},c.exports=d}),define("famous-flex/LayoutNodeManager",["require","exports","module","./LayoutContext","./LayoutUtility","famous/core/Surface","famous/core/RenderNode"],function(a,b,c){function d(a,b){this.LayoutNode=a,this._initLayoutNodeFn=b,this._layoutCount=0,this._context=new m({next:g.bind(this),prev:h.bind(this),get:i.bind(this),set:j.bind(this),resolveSize:l.bind(this),size:[0,0]}),this._contextState={},this._pool={layoutNodes:{size:0},resolveSize:[0,0]}}function e(a){a._next&&(a._next._prev=a._prev),a._prev?a._prev._next=a._next:this._first=a._next,a.destroy(),this._pool.layoutNodes.size<q&&(this._pool.layoutNodes.size++,a._prev=void 0,a._next=this._pool.layoutNodes.first,this._pool.layoutNodes.first=a)}function f(a,b){var c,d=this._contextState;if(!d.start){for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c||(c=this.createNode(a),c._next=this._first,this._first&&(this._first._prev=c),this._first=c),d.start=c,d.startPrev=b,d.prev=c,d.next=c,c}if(b){if(d.prev._prev&&d.prev._prev.renderNode===a)return d.prev=d.prev._prev,d.prev}else if(d.next._next&&d.next._next.renderNode===a)return d.next=d.next._next,d.next;for(c=this._first;c&&c.renderNode!==a;)c=c._next;return c?(c._next&&(c._next._prev=c._prev),c._prev?c._prev._next=c._next:this._first=c._next,c._next=void 0,c._prev=void 0):c=this.createNode(a),b?(d.prev._prev?(c._prev=d.prev._prev,d.prev._prev._next=c):this._first=c,d.prev._prev=c,c._next=d.prev,d.prev=c):(d.next._next&&(c._next=d.next._next,d.next._next._prev=c),d.next._next=c,c._prev=d.next,d.next=c),c}function g(){if(!this._contextState.nextSequence)return void 0;if(this._context.reverse&&(this._contextState.nextSequence=this._contextState.nextSequence.getNext(),!this._contextState.nextSequence))return void 0;var a=this._contextState.nextSequence.get();if(!a)return void(this._contextState.nextSequence=void 0);var b=this._contextState.nextSequence;if(this._context.reverse||(this._contextState.nextSequence=this._contextState.nextSequence.getNext()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,next:!0,index:++this._contextState.nextGetIndex}}function h(){if(!this._contextState.prevSequence)return void 0;if(!this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious(),!this._contextState.prevSequence))return void 0;var a=this._contextState.prevSequence.get();if(!a)return void(this._contextState.prevSequence=void 0);var b=this._contextState.prevSequence;if(this._context.reverse&&(this._contextState.prevSequence=this._contextState.prevSequence.getPrevious()),this._contextState.lastRenderNode===a)throw"ViewSequence is corrupted, should never contain the same renderNode twice, index: "+b.getIndex();return this._contextState.lastRenderNode=a,{renderNode:a,viewSequence:b,prev:!0,index:--this._contextState.prevGetIndex}}function i(a){if(this._nodesById&&(a instanceof String||"string"==typeof a)){var b=this._nodesById[a];if(!b)return void 0;if(b instanceof Array){for(var c=[],d=0,e=b.length;e>d;d++)c.push({renderNode:b[d],arrayElement:!0});return c}return{renderNode:b,byId:!0}}return a}function j(a,b){var c=this._nodesById?i.call(this,a):a;if(c){var d=c.node;d||(c.next?(c.index<this._contextState.nextSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.nextSetIndex=c.index):c.prev&&(c.index>this._contextState.prevSetIndex&&n.error("Nodes must be layed out in the same order as they were requested!"),this._contextState.prevSetIndex=c.index),d=f.call(this,c.renderNode,c.prev),d._viewSequence=c.viewSequence,d._layoutCount++,1===d._layoutCount&&this._contextState.addCount++,c.node=d),d.usesTrueSize=c.usesTrueSize,d.trueSizeRequested=c.trueSizeRequested,d.set(b,this._context.size),c.set=b}return b}function k(a){if(a instanceof p){var b=null,c=a.get();if(c&&(b=k(c)))return b;if(a._child)return k(a._child)}else{if(a instanceof o)return a.size?{renderNode:a,size:a.size}:void 0;if(a.options&&a.options.size)return{renderNode:a,size:a.options.size}}return void 0}function l(a,b){var c=this._nodesById?i.call(this,a):a,d=this._pool.resolveSize;if(!c)return d[0]=0,d[1]=0,d;var e=c.renderNode,f=e.getSize();if(!f)return b;var g=k(e);if(g&&(g.size[0]===!0||g.size[1]===!0))if(c.usesTrueSize=!0,g.renderNode instanceof o){var h=g.renderNode._backupSize;if((g.renderNode._contentDirty||g.renderNode._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),g.renderNode._trueSizeCheck&&h&&g.size!==f){var j=g.size[0]===!0?Math.max(h[0],f[0]):f[0],l=g.size[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=l,f=h,g.renderNode._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(g.renderNode._trueSizeCheck=!0,g.renderNode._sizeDirty=!0,this._trueSizeRequested=!0),h||(g.renderNode._backupSize=[0,0],h=g.renderNode._backupSize),h[0]=f[0],h[1]=f[1]}else g.renderNode._nodes&&(this._reevalTrueSize||g.renderNode._nodes._trueSizeRequested)&&(c.trueSizeRequested=!0,this._trueSizeRequested=!0);return(void 0===f[0]||f[0]===!0||void 0===f[1]||f[1]===!0)&&(d[0]=f[0],d[1]=f[1],f=d,void 0===f[0]?f[0]=b[0]:f[0]===!0&&(f[0]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0),void 0===f[1]?f[1]=b[1]:f[1]===!0&&(f[1]=0,this._trueSizeRequested=!0,c.trueSizeRequested=!0)),f}var m=a("./LayoutContext"),n=a("./LayoutUtility"),o=a("famous/core/Surface"),p=a("famous/core/RenderNode"),q=100;d.prototype.prepareForLayout=function(a,b,c){for(var d=this._first;d;)d.reset(),d=d._next;var e=this._context;this._layoutCount++,this._nodesById=b,this._trueSizeRequested=!1,this._reevalTrueSize=c.reevalTrueSize||!e.size||e.size[0]!==c.size[0]||e.size[1]!==c.size[1];var f=this._contextState;return f.startSequence=a,f.nextSequence=a,f.prevSequence=a,f.start=void 0,f.nextGetIndex=0,f.prevGetIndex=0,f.nextSetIndex=0,f.prevSetIndex=0,f.addCount=0,f.removeCount=0,f.lastRenderNode=void 0,e.size[0]=c.size[0],e.size[1]=c.size[1],e.direction=c.direction,e.reverse=c.reverse,e.alignment=c.reverse?1:0,e.scrollOffset=c.scrollOffset||0,e.scrollStart=c.scrollStart||0,e.scrollEnd=c.scrollEnd||e.size[e.direction],e},d.prototype.removeNonInvalidatedNodes=function(a){for(var b=this._first;b;)b._invalidated||b._removing||b.remove(a),b=b._next},d.prototype.removeVirtualViewSequenceNodes=function(){this._contextState.startSequence&&this._contextState.startSequence.cleanup&&this._contextState.startSequence.cleanup()},d.prototype.buildSpecAndDestroyUnrenderedNodes=function(a){for(var b=[],c={specs:b,modified:!1},d=this._first;d;){var f=d._specModified,g=d.getSpec();if(g.removed){var h=d;d=d._next,e.call(this,h),c.modified=!0}else f&&(g.transform&&a&&(g.transform[12]+=a[0],g.transform[13]+=a[1],g.transform[14]+=a[2],g.transform[12]=Math.round(1e5*g.transform[12])/1e5,g.transform[13]=Math.round(1e5*g.transform[13])/1e5,g.endState&&(g.endState.transform[12]+=a[0],g.endState.transform[13]+=a[1],g.endState.transform[14]+=a[2],g.endState.transform[12]=Math.round(1e5*g.endState.transform[12])/1e5,g.endState.transform[13]=Math.round(1e5*g.endState.transform[13])/1e5)),c.modified=!0),g.usesTrueSize=d.usesTrueSize,g.trueSizeRequested=d.trueSizeRequested,b.push(g),d=d._next}return this._contextState.addCount=0,this._contextState.removeCount=0,c},d.prototype.getNodeByRenderNode=function(a){for(var b=this._first;b;){if(b.renderNode===a)return b;b=b._next}return void 0},d.prototype.insertNode=function(a){a._next=this._first,this._first&&(this._first._prev=a),this._first=a},d.prototype.setNodeOptions=function(a){this._nodeOptions=a;for(var b=this._first;b;)b.setOptions(a),b=b._next;for(b=this._pool.layoutNodes.first;b;)b.setOptions(a),b=b._next},d.prototype.preallocateNodes=function(a,b){for(var c=[],d=0;a>d;d++)c.push(this.createNode(void 0,b));for(d=0;a>d;d++)e.call(this,c[d])},d.prototype.createNode=function(a,b){var c;return this._pool.layoutNodes.first?(c=this._pool.layoutNodes.first,this._pool.layoutNodes.first=c._next,this._pool.layoutNodes.size--,c.constructor.apply(c,arguments)):(c=new this.LayoutNode(a,b),this._nodeOptions&&c.setOptions(this._nodeOptions)),c._prev=void 0,c._next=void 0,c._viewSequence=void 0,c._layoutCount=0,this._initLayoutNodeFn&&this._initLayoutNodeFn.call(this,c,b),c},d.prototype.removeAll=function(){for(var a=this._first;a;){var b=a._next;e.call(this,a),a=b}this._first=void 0},d.prototype.getStartEnumNode=function(a){return void 0===a?this._first:a===!0?this._contextState.start&&this._contextState.startPrev?this._contextState.start._next:this._contextState.start:a===!1?this._contextState.start&&!this._contextState.startPrev?this._contextState.start._prev:this._contextState.start:void 0},c.exports=d}),define("famous-flex/LayoutNode",["require","exports","module","famous/core/Transform","./LayoutUtility"],function(a,b,c){function d(a,b){this.renderNode=a,this._spec=b?f.cloneSpec(b):{},this._spec.renderNode=a,this._specModified=!0,this._invalidated=!1,this._removing=!1}var e=a("famous/core/Transform"),f=a("./LayoutUtility");d.prototype.setRenderNode=function(a){this.renderNode=a,this._spec.renderNode=a},d.prototype.setOptions=function(a){},d.prototype.destroy=function(){this.renderNode=void 0,this._spec.renderNode=void 0,this._viewSequence=void 0},d.prototype.reset=function(){this._invalidated=!1,this.trueSizeRequested=!1},d.prototype.setSpec=function(a){if(this._specModified=!0,a.align?(a.align||(this._spec.align=[0,0]),this._spec.align[0]=a.align[0],this._spec.align[1]=a.align[1]):this._spec.align=void 0,a.origin?(a.origin||(this._spec.origin=[0,0]),this._spec.origin[0]=a.origin[0],this._spec.origin[1]=a.origin[1]):this._spec.origin=void 0,a.size?(a.size||(this._spec.size=[0,0]),this._spec.size[0]=a.size[0],this._spec.size[1]=a.size[1]):this._spec.size=void 0,a.transform)if(a.transform)for(var b=0;16>b;b++)this._spec.transform[b]=a.transform[b];else this._spec.transform=a.transform.slice(0);else this._spec.transform=void 0;this._spec.opacity=a.opacity},d.prototype.set=function(a,b){this._invalidated=!0,this._specModified=!0,this._removing=!1;var c=this._spec;c.opacity=a.opacity,a.size?(c.size||(c.size=[0,0]),c.size[0]=a.size[0],c.size[1]=a.size[1]):c.size=void 0,a.origin?(c.origin||(c.origin=[0,0]),c.origin[0]=a.origin[0],c.origin[1]=a.origin[1]):c.origin=void 0,a.align?(c.align||(c.align=[0,0]),c.align[0]=a.align[0],c.align[1]=a.align[1]):c.align=void 0,a.skew||a.rotate||a.scale?this._spec.transform=e.build({translate:a.translate||[0,0,0],skew:a.skew||[0,0,0],scale:a.scale||[1,1,1],rotate:a.rotate||[0,0,0]}):a.translate?this._spec.transform=e.translate(a.translate[0],a.translate[1],a.translate[2]):this._spec.transform=void 0,this.scrollLength=a.scrollLength},d.prototype.getSpec=function(){return this._specModified=!1,this._spec.removed=!this._invalidated,this._spec},d.prototype.remove=function(a){this._removing=!0},c.exports=d}),define("famous-flex/FlowLayoutNode",["require","exports","module","famous/core/OptionsManager","famous/core/Transform","famous/math/Vector","famous/physics/bodies/Particle","famous/physics/forces/Spring","famous/physics/PhysicsEngine","./LayoutNode","famous/transitions/Transitionable"],function(a,b,c){function d(a,b){if(o.apply(this,arguments),this.options||(this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this._optionsManager=new i(this.options)),this._pe||(this._pe=new n,this._pe.sleep()),this._properties)for(var c in this._properties)this._properties[c].init=!1;else this._properties={};this._lockTransitionable?(this._lockTransitionable.halt(),this._lockTransitionable.reset(1)):this._lockTransitionable=new p(1),this._specModified=!0,this._initial=!0,this._spec.endState={},b&&this.setSpec(b)}function e(a,b,c,d){return a&&a.init?[a.enabled[0]?Math.round((a.curState.x+(a.endState.x-a.curState.x)*d)/c)*c:a.endState.x,a.enabled[1]?Math.round((a.curState.y+(a.endState.y-a.curState.y)*d)/c)*c:a.endState.y,a.enabled[2]?Math.round((a.curState.z+(a.endState.z-a.curState.z)*d)/c)*c:a.endState.z]:b}function f(a,b,c,d,e,f){if(a=a||this._properties[b],a&&a.init){a.invalidated=!0;var g=d;return void 0!==c?g=c:this._removing&&(g=a.particle.getPosition()),a.endState.x=g[0],a.endState.y=g.length>1?g[1]:0,a.endState.z=g.length>2?g[2]:0,void(e?(a.curState.x=a.endState.x,a.curState.y=a.endState.y,a.curState.z=a.endState.z,a.velocity.x=0,a.velocity.y=0,a.velocity.z=0):(a.endState.x!==a.curState.x||a.endState.y!==a.curState.y||a.endState.z!==a.curState.z)&&this._pe.wake())}var h=this._pe.isSleeping();a?(a.particle.setPosition(this._initial||e?c:d),a.endState.set(c)):(a={particle:new l({position:this._initial||e?c:d}),endState:new k(c)},a.curState=a.particle.position,a.velocity=a.particle.velocity,a.force=new m(this.options.spring),a.force.setOptions({anchor:a.endState}),this._pe.addBody(a.particle),a.forceId=this._pe.attach(a.force,a.particle),this._properties[b]=a),this._initial||e?h&&this._pe.sleep():this._pe.wake(),this.options.properties[b]&&this.options.properties[b].length?a.enabled=this.options.properties[b]:a.enabled=[this.options.properties[b],this.options.properties[b],this.options.properties[b]],a.init=!0,a.invalidated=!0}function g(a,b){return a[0]===b[0]&&a[1]===b[1]?void 0:a}function h(a,b){return a[0]===b[0]&&a[1]===b[1]&&a[2]===b[2]?void 0:a}var i=a("famous/core/OptionsManager"),j=a("famous/core/Transform"),k=a("famous/math/Vector"),l=a("famous/physics/bodies/Particle"),m=a("famous/physics/forces/Spring"),n=a("famous/physics/PhysicsEngine"),o=a("./LayoutNode"),p=a("famous/transitions/Transitionable");d.prototype=Object.create(o.prototype),d.prototype.constructor=d,d.DEFAULT_OPTIONS={spring:{dampingRatio:.8,period:300},properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},particleRounding:.001};var q={opacity:1,opacity2D:[1,0],size:[0,0],origin:[0,0],align:[0,0],scale:[1,1,1],translate:[0,0,0],rotate:[0,0,0],skew:[0,0,0]};d.prototype.setOptions=function(a){this._optionsManager.setOptions(a);var b=this._pe.isSleeping();for(var c in this._properties){var d=this._properties[c];a.spring&&d.force&&d.force.setOptions(this.options.spring),a.properties&&void 0!==a.properties[c]&&(this.options.properties[c].length?d.enabled=this.options.properties[c]:d.enabled=[this.options.properties[c],this.options.properties[c],this.options.properties[c]])}return b&&this._pe.sleep(),this},d.prototype.setSpec=function(a){var b;a.transform&&(b=j.interpret(a.transform)),b||(b={}),b.opacity=a.opacity,b.size=a.size,b.align=a.align,b.origin=a.origin;var c=this._removing,d=this._invalidated;this.set(b),this._removing=c,this._invalidated=d},d.prototype.reset=function(){if(this._invalidated){for(var a in this._properties)this._properties[a].invalidated=!1;this._invalidated=!1}this.trueSizeRequested=!1,this.usesTrueSize=!1},d.prototype.remove=function(a){this._removing=!0,a?this.setSpec(a):(this._pe.sleep(),this._specModified=!1),this._invalidated=!1},d.prototype.releaseLock=function(a){this._lockTransitionable.halt(),this._lockTransitionable.reset(0),a&&this._lockTransitionable.set(1,{duration:this.options.spring.period||1e3})},d.prototype.getSpec=function(){var a=this._pe.isSleeping();if(!this._specModified&&a)return this._spec.removed=!this._invalidated,this._spec;this._initial=!1,this._specModified=!a,this._spec.removed=!1,a||this._pe.step();var b=this._spec,c=this.options.particleRounding,d=this._lockTransitionable.get(),f=this._properties.opacity;f&&f.init?(b.opacity=f.enabled[0]?Math.round(Math.max(0,Math.min(1,f.curState.x))/c)*c:f.endState.x,b.endState.opacity=f.endState.x):(b.opacity=void 0,b.endState.opacity=void 0),f=this._properties.size,f&&f.init?(b.size=b.size||[0,0],b.size[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.size[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.size=b.endState.size||[0,0],b.endState.size[0]=f.endState.x,b.endState.size[1]=f.endState.y):(b.size=void 0,b.endState.size=void 0),f=this._properties.align,f&&f.init?(b.align=b.align||[0,0],b.align[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.align[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.align=b.endState.align||[0,0],b.endState.align[0]=f.endState.x,b.endState.align[1]=f.endState.y):(b.align=void 0,b.endState.align=void 0),f=this._properties.origin,f&&f.init?(b.origin=b.origin||[0,0],b.origin[0]=f.enabled[0]?.1*Math.round((f.curState.x+(f.endState.x-f.curState.x)*d)/.1):f.endState.x,b.origin[1]=f.enabled[1]?.1*Math.round((f.curState.y+(f.endState.y-f.curState.y)*d)/.1):f.endState.y,b.endState.origin=b.endState.origin||[0,0],b.endState.origin[0]=f.endState.x,b.endState.origin[1]=f.endState.y):(b.origin=void 0,b.endState.origin=void 0);var g,h,i,k=this._properties.translate;k&&k.init?(g=k.enabled[0]?Math.round((k.curState.x+(k.endState.x-k.curState.x)*d)/c)*c:k.endState.x,h=k.enabled[1]?Math.round((k.curState.y+(k.endState.y-k.curState.y)*d)/c)*c:k.endState.y,i=k.enabled[2]?Math.round((k.curState.z+(k.endState.z-k.curState.z)*d)/c)*c:k.endState.z):(g=0,h=0,i=0);var l=this._properties.scale,m=this._properties.skew,n=this._properties.rotate;return l||m||n?(b.transform=j.build({translate:[g,h,i],skew:e.call(this,m,q.skew,this.options.particleRounding,d),scale:e.call(this,l,q.scale,this.options.particleRounding,d),rotate:e.call(this,n,q.rotate,this.options.particleRounding,d)}),b.endState.transform=j.build({translate:k?[k.endState.x,k.endState.y,k.endState.z]:q.translate,scale:l?[l.endState.x,l.endState.y,l.endState.z]:q.scale,skew:m?[m.endState.x,m.endState.y,m.endState.z]:q.skew,rotate:n?[n.endState.x,n.endState.y,n.endState.z]:q.rotate})):k?(b.transform?(b.transform[12]=g,b.transform[13]=h,b.transform[14]=i):b.transform=j.translate(g,h,i),b.endState.transform?(b.endState.transform[12]=k.endState.x,b.endState.transform[13]=k.endState.y,b.endState.transform[14]=k.endState.z):b.endState.transform=j.translate(k.endState.x,k.endState.y,k.endState.z)):(b.transform=void 0,b.endState.transform=void 0),this._spec},d.prototype.set=function(a,b){b&&(this._removing=!1),this._invalidated=!0,this.scrollLength=a.scrollLength,this._specModified=!0;var c=this._properties.opacity,d=a.opacity===q.opacity?void 0:a.opacity;(void 0!==d||c&&c.init)&&f.call(this,c,"opacity",void 0===d?void 0:[d,0],q.opacity2D),c=this._properties.align,d=a.align?g(a.align,q.align):void 0,(d||c&&c.init)&&f.call(this,c,"align",d,q.align),c=this._properties.origin,d=a.origin?g(a.origin,q.origin):void 0,(d||c&&c.init)&&f.call(this,c,"origin",d,q.origin),c=this._properties.size,d=a.size||b,(d||c&&c.init)&&f.call(this,c,"size",d,b,this.usesTrueSize),c=this._properties.translate,d=a.translate,(d||c&&c.init)&&f.call(this,c,"translate",d,q.translate,void 0,!0),c=this._properties.scale,d=a.scale?h(a.scale,q.scale):void 0,(d||c&&c.init)&&f.call(this,c,"scale",d,q.scale),c=this._properties.rotate,d=a.rotate?h(a.rotate,q.rotate):void 0,(d||c&&c.init)&&f.call(this,c,"rotate",d,q.rotate),c=this._properties.skew,d=a.skew?h(a.skew,q.skew):void 0,(d||c&&c.init)&&f.call(this,c,"skew",d,q.skew)},c.exports=d}),define("famous-flex/helpers/LayoutDockHelper",["require","exports","module","../LayoutUtility"],function(a,b,c){function d(a,b){var c=a.size;if(this._size=c,this._context=a,this._options=b,this._data={z:b&&b.translateZ?b.translateZ:0},b&&b.margins){var d=e.normalizeMargins(b.margins);this._data.left=d[3],this._data.top=d[0],this._data.right=c[0]-d[1],this._data.bottom=c[1]-d[2]}else this._data.left=0,this._data.top=0,this._data.right=c[0],this._data.bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b<a.length;b++){var c=a[b],d=c.length>=3?c[2]:void 0;"top"===c[0]?this.top(c[1],d,c.length>=4?c[3]:void 0):"left"===c[0]?this.left(c[1],d,c.length>=4?c[3]:void 0):"right"===c[0]?this.right(c[1],d,c.length>=4?c[3]:void 0):"bottom"===c[0]?this.bottom(c[1],d,c.length>=4?c[3]:void 0):"fill"===c[0]?this.fill(c[1],c.length>=3?c[2]:void 0):"margins"===c[0]&&this.margins(c[1])}},d.prototype.top=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.top+=b,this},d.prototype.left=function(a,b,c){if(b instanceof Array&&(b=b[0]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}return this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[0,0],align:[0,0],translate:[this._data.left,this._data.top,void 0===c?this._data.z:c]}),this._data.left+=b,this},d.prototype.bottom=function(a,b,c){if(b instanceof Array&&(b=b[1]),void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[1]}return this._context.set(a,{size:[this._data.right-this._data.left,b],origin:[0,1],align:[0,1],translate:[this._data.left,-(this._size[1]-this._data.bottom),void 0===c?this._data.z:c]}),this._data.bottom-=b,this},d.prototype.right=function(a,b,c){if(b instanceof Array&&(b=b[0]),a){if(void 0===b){var d=this._context.resolveSize(a,[this._data.right-this._data.left,this._data.bottom-this._data.top]);b=d[0]}this._context.set(a,{size:[b,this._data.bottom-this._data.top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._data.right),this._data.top,void 0===c?this._data.z:c]})}return b&&(this._data.right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._data.right-this._data.left,this._data.bottom-this._data.top],translate:[this._data.left,this._data.top,void 0===b?this._data.z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._data.left+=a[3],this._data.top+=a[0],this._data.right-=a[1],this._data.bottom-=a[2],this},d.prototype.get=function(){return this._data},e.registerHelper("dock",d),c.exports=d}),define("famous-flex/LayoutController",["require","exports","module","famous/utilities/Utility","famous/core/Entity","famous/core/ViewSequence","./LinkedListViewSequence","famous/core/OptionsManager","famous/core/EventHandler","./LayoutUtility","./LayoutNodeManager","./LayoutNode","./FlowLayoutNode","famous/core/Transform","./helpers/LayoutDockHelper"],function(a,b,c){function d(a,b){this.id=j.register(this),this._isDirty=!0,this._contextSizeCache=[0,0],this._commitOutput={},this._cleanupRegistration={commit:function(){return void 0},cleanup:function(a){this.cleanup(a)}.bind(this)},this._cleanupRegistration.target=j.register(this._cleanupRegistration),this._cleanupRegistration.render=function(){return this.target}.bind(this._cleanupRegistration),this._eventInput=new n,n.setInputHandler(this,this._eventInput),this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput),this._layout={options:Object.create({})},this._layout.optionsManager=new m(this._layout.options),this._layout.optionsManager.on("change",function(){this._isDirty=!0}.bind(this)),this.options=Object.create(d.DEFAULT_OPTIONS),this._optionsManager=new m(this.options),b?this._nodes=b:a&&a.flow?this._nodes=new p(r,e.bind(this)):this._nodes=new p(q),this.setDirection(void 0),a&&this.setOptions(a)}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(a){if(this._nodesById)for(var b in this._nodesById)a(this._nodesById[b]);else for(var c=this._viewSequence.getHead();c;){var d=c.get();d&&a(d),c=c.getNext()}}function g(a){if(this._layout.capabilities&&this._layout.capabilities.direction){if(Array.isArray(this._layout.capabilities.direction)){for(var b=0;b<this._layout.capabilities.direction.length;b++)if(this._layout.capabilities.direction[b]===a)return a;return this._layout.capabilities.direction[0]}return this._layout.capabilities.direction}return void 0===a?i.Direction.Y:a}function h(a,b){if(this._viewSequence.getAtIndex)return this._viewSequence.getAtIndex(a,b);var c=b||this._viewSequence,d=c?c.getIndex():a;if(a>d)for(;c;){if(c=c.getNext(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(d>a)return void 0}else if(d>a)for(;c;){if(c=c.getPrevious(),!c)return void 0;if(d=c.getIndex(),d===a)return c;if(a>d)return void 0}return c}var i=a("famous/utilities/Utility"),j=a("famous/core/Entity"),k=a("famous/core/ViewSequence"),l=a("./LinkedListViewSequence"),m=a("famous/core/OptionsManager"),n=a("famous/core/EventHandler"),o=a("./LayoutUtility"),p=a("./LayoutNodeManager"),q=a("./LayoutNode"),r=a("./FlowLayoutNode"),s=a("famous/core/Transform");a("./helpers/LayoutDockHelper"),d.DEFAULT_OPTIONS={flow:!1,flowOptions:{reflowOnResize:!0,properties:{opacity:!0,align:!0,origin:!0,size:!0,translate:!0,skew:!0,rotate:!0,scale:!0},spring:{dampingRatio:.8,period:300}}},d.prototype.setOptions=function(a){return void 0!==a.alignment&&a.alignment!==this.options.alignment&&(this._isDirty=!0),this._optionsManager.setOptions(a),a.nodeSpring&&(console.warn("nodeSpring options have been moved inside `flowOptions`. Use `flowOptions.spring` instead."),this._optionsManager.setOptions({flowOptions:{spring:a.nodeSpring}}),this._nodes.setNodeOptions(this.options.flowOptions)),void 0!==a.reflowOnResize&&(console.warn("reflowOnResize options have been moved inside `flowOptions`. Use `flowOptions.reflowOnResize` instead."),this._optionsManager.setOptions({flowOptions:{reflowOnResize:a.reflowOnResize}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.insertSpec&&(console.warn("insertSpec options have been moved inside `flowOptions`. Use `flowOptions.insertSpec` instead."),
+this._optionsManager.setOptions({flowOptions:{insertSpec:a.insertSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.removeSpec&&(console.warn("removeSpec options have been moved inside `flowOptions`. Use `flowOptions.removeSpec` instead."),this._optionsManager.setOptions({flowOptions:{removeSpec:a.removeSpec}}),this._nodes.setNodeOptions(this.options.flowOptions)),a.dataSource&&this.setDataSource(a.dataSource),a.layout?this.setLayout(a.layout,a.layoutOptions):a.layoutOptions&&this.setLayoutOptions(a.layoutOptions),void 0!==a.direction&&this.setDirection(a.direction),a.flowOptions&&this.options.flow&&this._nodes.setNodeOptions(this.options.flowOptions),a.preallocateNodes&&this._nodes.preallocateNodes(a.preallocateNodes.count||0,a.preallocateNodes.spec),this},d.prototype.setDataSource=function(a){return this._dataSource=a,this._nodesById=void 0,a instanceof k?(console.warn("The stock famo.us ViewSequence is no longer supported as it is too buggy"),console.warn("It has been automatically converted to the safe LinkedListViewSequence."),console.warn("Please refactor your code by using LinkedListViewSequence."),this._dataSource=new l(a._.array),this._viewSequence=this._dataSource):a instanceof Array?this._viewSequence=new l(a):a instanceof l?this._viewSequence=a:a.getNext?this._viewSequence=a:a instanceof Object&&(this._nodesById=a),this.options.autoPipeEvents&&(this._dataSource.pipe?(this._dataSource.pipe(this),this._dataSource.pipe(this._eventOutput)):f.call(this,function(a){a&&a.pipe&&(a.pipe(this),a.pipe(this._eventOutput))}.bind(this))),this._isDirty=!0,this},d.prototype.getDataSource=function(){return this._dataSource},d.prototype.setLayout=function(a,b){if(a instanceof Function)this._layout._function=a,this._layout.capabilities=a.Capabilities,this._layout.literal=void 0;else if(a instanceof Object){this._layout.literal=a,this._layout.capabilities=void 0;var c=Object.keys(a)[0],d=o.getRegisteredHelper(c);this._layout._function=d?function(b,e){var f=new d(b,e);f.parse(a[c])}:void 0}else this._layout._function=void 0,this._layout.capabilities=void 0,this._layout.literal=void 0;return b&&this.setLayoutOptions(b),this.setDirection(this._configuredDirection),this._isDirty=!0,this},d.prototype.getLayout=function(){return this._layout.literal||this._layout._function},d.prototype.setLayoutOptions=function(a){return this._layout.optionsManager.setOptions(a),this},d.prototype.getLayoutOptions=function(){return this._layout.options},d.prototype.setDirection=function(a){this._configuredDirection=a;var b=g.call(this,a);b!==this._direction&&(this._direction=b,this._isDirty=!0)},d.prototype.getDirection=function(a){return a?this._direction:this._configuredDirection},d.prototype.getSpec=function(a,b,c){if(!a)return void 0;if(a instanceof String||"string"==typeof a){if(!this._nodesById)return void 0;if(a=this._nodesById[a],!a)return void 0;if(a instanceof Array)return a}if(this._specs)for(var d=0;d<this._specs.length;d++){var e=this._specs[d];if(e.renderNode===a){if(c&&e.endState&&(e=e.endState),b&&e.transform&&e.size&&(e.align||e.origin)){var f=e.transform;return e.align&&(e.align[0]||e.align[1])&&(f=s.thenMove(f,[e.align[0]*this._contextSizeCache[0],e.align[1]*this._contextSizeCache[1],0])),e.origin&&(e.origin[0]||e.origin[1])&&(f=s.moveThen([-e.origin[0]*e.size[0],-e.origin[1]*e.size[1],0],f)),{opacity:e.opacity,size:e.size,transform:f}}return e}}return void 0},d.prototype.reflowLayout=function(){return this._isDirty=!0,this},d.prototype.resetFlowState=function(){return this.options.flow&&(this._resetFlowState=!0),this},d.prototype.insert=function(a,b,c){if(a instanceof String||"string"==typeof a){if(void 0===this._dataSource&&(this._dataSource={},this._nodesById=this._dataSource),this._nodesById[a]===b)return this;this._nodesById[a]=b}else void 0===this._dataSource&&(this._dataSource=new l,this._viewSequence=this._dataSource),this._viewSequence.insert(a,b);return c&&this._nodes.insertNode(this._nodes.createNode(b,c)),this.options.autoPipeEvents&&b&&b.pipe&&(b.pipe(this),b.pipe(this._eventOutput)),this._isDirty=!0,this},d.prototype.push=function(a,b){return this.insert(-1,a,b)},d.prototype.get=function(a){if(this._nodesById||a instanceof String||"string"==typeof a)return this._nodesById?this._nodesById[a]:void 0;var b=h.call(this,a);return b?b.get():void 0},d.prototype.swap=function(a,b){return this._viewSequence.swap(a,b),this._isDirty=!0,this},d.prototype.replace=function(a,b,c){var d;if(this._nodesById||a instanceof String||"string"==typeof a){if(d=this._nodesById[a],d!==b){if(c&&d){var e=this._nodes.getNodeByRenderNode(d);e&&e.setRenderNode(b)}this._nodesById[a]=b,this._isDirty=!0}return d}var f=this._viewSequence.findByIndex(a);if(!f)throw"Invalid index ("+a+") specified to .replace";return d=f.get(),f.set(b),d!==b&&(this._isDirty=!0),d},d.prototype.move=function(a,b){var c=this._viewSequence.findByIndex(a);if(!c)throw"Invalid index ("+a+") specified to .move";return this._viewSequence=this._viewSequence.remove(c),this._viewSequence.insert(b,c.get()),this._isDirty=!0,this},d.prototype.remove=function(a,b){var c;if(this._nodesById||a instanceof String||"string"==typeof a){if(a instanceof String||"string"==typeof a)c=this._nodesById[a],c&&delete this._nodesById[a];else for(var d in this._nodesById)if(this._nodesById[d]===a){delete this._nodesById[d],c=a;break}}else{var e;e=a instanceof Number||"number"==typeof a?this._viewSequence.findByIndex(a):this._viewSequence.findByValue(a),e&&(c=e.get(),this._viewSequence=this._viewSequence.remove(e))}if(c&&b){var f=this._nodes.getNodeByRenderNode(c);f&&f.remove(b||this.options.flowOptions.removeSpec)}return c&&(this._isDirty=!0),c},d.prototype.removeAll=function(a){if(this._nodesById){var b=!1;for(var c in this._nodesById)delete this._nodesById[c],b=!0;b&&(this._isDirty=!0)}else this._viewSequence&&(this._viewSequence=this._viewSequence.clear());if(a)for(var d=this._nodes.getStartEnumNode();d;)d.remove(a||this.options.flowOptions.removeSpec),d=d._next;return this},d.prototype.getSize=function(){return this._size||this.options.size},d.prototype.render=function(){return this.id},d.prototype.commit=function(a){var b=a.transform,c=a.origin,d=a.size,e=a.opacity;if(this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll()),d[0]!==this._contextSizeCache[0]||d[1]!==this._contextSizeCache[1]||this._isDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout){var f={target:this,oldSize:this._contextSizeCache,size:d,dirty:this._isDirty,trueSizeRequested:this._nodes._trueSizeRequested};if(this._eventOutput.emit("layoutstart",f),this.options.flow){var g=!1;if(this.options.flowOptions.reflowOnResize||(g=this._isDirty||d[0]===this._contextSizeCache[0]&&d[1]===this._contextSizeCache[1]?!0:void 0),void 0!==g)for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(g),h=h._next}this._contextSizeCache[0]=d[0],this._contextSizeCache[1]=d[1],this._isDirty=!1;var i;this.options.size&&this.options.size[this._direction]===!0&&(i=1e6);var j=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:d,direction:this._direction,scrollEnd:i});if(this._layout._function&&this._layout._function(j,this._layout.options),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),this._nodes.removeVirtualViewSequenceNodes(),i){for(i=0,h=this._nodes.getStartEnumNode();h;)h._invalidated&&h.scrollLength&&(i+=h.scrollLength),h=h._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}var k=this._nodes.buildSpecAndDestroyUnrenderedNodes();this._specs=k.specs,this._commitOutput.target=k.specs,this._eventOutput.emit("layoutend",f),this._eventOutput.emit("reflow",{target:this})}else this.options.flow&&(k=this._nodes.buildSpecAndDestroyUnrenderedNodes(),this._specs=k.specs,this._commitOutput.target=k.specs,k.modified&&this._eventOutput.emit("reflow",{target:this}));for(var l=this._commitOutput.target,m=0,n=l.length;n>m;m++)l[m].renderNode&&(l[m].target=l[m].renderNode.render());return l.length&&l[l.length-1]===this._cleanupRegistration||l.push(this._cleanupRegistration),!c||0===c[0]&&0===c[1]||(b=s.moveThen([-d[0]*c[0],-d[1]*c[1],0],b)),this._commitOutput.size=d,this._commitOutput.opacity=e,this._commitOutput.transform=b,this._commitOutput},d.prototype.cleanup=function(a){this.options.flow&&(this._resetFlowState=!0)},c.exports=d}),define("famous-flex/ScrollController",["require","exports","module","./LayoutUtility","./LayoutController","./LayoutNode","./FlowLayoutNode","./LayoutNodeManager","famous/surfaces/ContainerSurface","famous/core/Transform","famous/core/EventHandler","famous/core/Group","famous/math/Vector","famous/physics/PhysicsEngine","famous/physics/bodies/Particle","famous/physics/forces/Drag","famous/physics/forces/Spring","famous/inputs/ScrollSync","./LinkedListViewSequence"],function(a,b,c){function d(a){a=D.combineOptions(d.DEFAULT_OPTIONS,a);var b=new H(a.flow?G:F,e.bind(this));E.call(this,a,b),this._scroll={activeTouches:[],pe:new N(this.options.scrollPhysicsEngine),particle:new O(this.options.scrollParticle),dragForce:new P(this.options.scrollDrag),frictionForce:new P(this.options.scrollFriction),springValue:void 0,springForce:new Q(this.options.scrollSpring),springEndState:new M([0,0,0]),groupStart:0,groupTranslate:[0,0,0],scrollDelta:0,normalizedScrollDelta:0,scrollForce:0,scrollForceCount:0,unnormalizedScrollOffset:0,isScrolling:!1},this._debug={layoutCount:0,commitCount:0},this.group=new L,this.group.add({render:C.bind(this)}),this._scroll.pe.addBody(this._scroll.particle),this.options.scrollDrag.disabled||(this._scroll.dragForceId=this._scroll.pe.attach(this._scroll.dragForce,this._scroll.particle)),this.options.scrollFriction.disabled||(this._scroll.frictionForceId=this._scroll.pe.attach(this._scroll.frictionForce,this._scroll.particle)),this._scroll.springForce.setOptions({anchor:this._scroll.springEndState}),this._eventInput.on("touchstart",l.bind(this)),this._eventInput.on("touchmove",m.bind(this)),this._eventInput.on("touchend",n.bind(this)),this._eventInput.on("touchcancel",n.bind(this)),this._eventInput.on("mousedown",i.bind(this)),this._eventInput.on("mouseup",k.bind(this)),this._eventInput.on("mousemove",j.bind(this)),this._scrollSync=new R(this.options.scrollSync),this._eventInput.pipe(this._scrollSync),this._scrollSync.on("update",o.bind(this)),this.options.useContainer&&(this.container=new I(this.options.container),this.container.add({render:function(){return this.id}.bind(this)}),this.options.autoPipeEvents||(this.subscribe(this.container),K.setInputHandler(this.container,this),K.setOutputHandler(this.container,this)))}function e(a,b){!b&&this.options.flowOptions.insertSpec&&a.setSpec(this.options.flowOptions.insertSpec)}function f(){return!this._layout.capabilities||void 0===this._layout.capabilities.sequentialScrollingOptimized||this._layout.capabilities.sequentialScrollingOptimized}function g(){var a=this._scroll.scrollForceCount?void 0:this._scroll.springPosition;this._scroll.springValue!==a&&(this._scroll.springValue=a,void 0===a?void 0!==this._scroll.springForceId&&(this._scroll.pe.detach(this._scroll.springForceId),this._scroll.springForceId=void 0):(void 0===this._scroll.springForceId&&(this._scroll.springForceId=this._scroll.pe.attach(this._scroll.springForce,this._scroll.particle)),this._scroll.springEndState.set1D(a),this._scroll.pe.wake()))}function h(a){return a.timeStamp||Date.now()}function i(a){if(this.options.mouseMove){this._scroll.mouseMove&&this.releaseScrollForce(this._scroll.mouseMove.delta);var b=[a.clientX,a.clientY],c=h(a);this._scroll.mouseMove={delta:0,start:b,current:b,prev:b,time:c,prevTime:c},this.applyScrollForce(this._scroll.mouseMove.delta)}}function j(a){if(this._scroll.mouseMove&&this.options.enabled){var b=Math.atan2(Math.abs(a.clientY-this._scroll.mouseMove.prev[1]),Math.abs(a.clientX-this._scroll.mouseMove.prev[0]))/(Math.PI/2),c=Math.abs(this._direction-b);(void 0===this.options.touchMoveDirectionThreshold||c<=this.options.touchMoveDirectionThreshold)&&(this._scroll.mouseMove.prev=this._scroll.mouseMove.current,this._scroll.mouseMove.current=[a.clientX,a.clientY],this._scroll.mouseMove.prevTime=this._scroll.mouseMove.time,this._scroll.mouseMove.direction=b,this._scroll.mouseMove.time=h(a));var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.start[this._direction];this.updateScrollForce(this._scroll.mouseMove.delta,d),this._scroll.mouseMove.delta=d}}function k(a){if(this._scroll.mouseMove){var b=0,c=this._scroll.mouseMove.time-this._scroll.mouseMove.prevTime;if(c>0&&h(a)-this._scroll.mouseMove.time<=this.options.touchMoveNoVelocityDuration){var d=this._scroll.mouseMove.current[this._direction]-this._scroll.mouseMove.prev[this._direction];b=d/c}this.releaseScrollForce(this._scroll.mouseMove.delta,b),this._scroll.mouseMove=void 0}}function l(a){this._touchEndEventListener||(this._touchEndEventListener=function(a){a.target.removeEventListener("touchend",this._touchEndEventListener),n.call(this,a)}.bind(this));for(var b,c,d=this._scroll.activeTouches.length,e=0;e<this._scroll.activeTouches.length;){var f=this._scroll.activeTouches[e];for(c=!1,b=0;b<a.touches.length;b++){var g=a.touches[b];if(g.identifier===f.id){c=!0;break}}c?e++:this._scroll.activeTouches.splice(e,1)}for(e=0;e<a.touches.length;e++){var i=a.touches[e];for(c=!1,b=0;b<this._scroll.activeTouches.length;b++)if(this._scroll.activeTouches[b].id===i.identifier){c=!0;break}if(!c){var j=[i.clientX,i.clientY],k=h(a);this._scroll.activeTouches.push({id:i.identifier,start:j,current:j,prev:j,time:k,prevTime:k}),i.target.addEventListener("touchend",this._touchEndEventListener)}}!d&&this._scroll.activeTouches.length&&(this.applyScrollForce(0),this._scroll.touchDelta=0)}function m(a){if(this.options.enabled){for(var b,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){var g=Math.atan2(Math.abs(d.clientY-f.prev[1]),Math.abs(d.clientX-f.prev[0]))/(Math.PI/2),i=Math.abs(this._direction-g);(void 0===this.options.touchMoveDirectionThreshold||i<=this.options.touchMoveDirectionThreshold)&&(f.prev=f.current,f.current=[d.clientX,d.clientY],f.prevTime=f.time,f.direction=g,f.time=h(a),b=0===e?f:void 0)}}if(b){var j=b.current[this._direction]-b.start[this._direction];this.updateScrollForce(this._scroll.touchDelta,j),this._scroll.touchDelta=j}}}function n(a){for(var b=this._scroll.activeTouches.length?this._scroll.activeTouches[0]:void 0,c=0;c<a.changedTouches.length;c++)for(var d=a.changedTouches[c],e=0;e<this._scroll.activeTouches.length;e++){var f=this._scroll.activeTouches[e];if(f.id===d.identifier){if(this._scroll.activeTouches.splice(e,1),0===e&&this._scroll.activeTouches.length){var g=this._scroll.activeTouches[0];g.start[0]=g.current[0]-(f.current[0]-f.start[0]),g.start[1]=g.current[1]-(f.current[1]-f.start[1])}break}}if(b&&!this._scroll.activeTouches.length){var i=0,j=b.time-b.prevTime;if(j>0&&h(a)-b.time<=this.options.touchMoveNoVelocityDuration){var k=b.current[this._direction]-b.prev[this._direction];i=k/j}var l=this._scroll.touchDelta;this.releaseScrollForce(l,i),this._scroll.touchDelta=0}}function o(a){if(this.options.enabled){var b=Array.isArray(a.delta)?a.delta[this._direction]:a.delta;this.scroll(b)}}function p(a,b,c){if(void 0!==a&&(this._scroll.particleValue=a,this._scroll.particle.setPosition1D(a),void 0!==this._scroll.springValue&&this._scroll.pe.wake()),void 0!==b){var d=this._scroll.particle.getVelocity1D();d!==b&&this._scroll.particle.setVelocity1D(b)}}function q(a,b){(b||void 0===this._scroll.particleValue)&&(this._scroll.particleValue=this._scroll.particle.getPosition1D(),this._scroll.particleValue=Math.round(1e3*this._scroll.particleValue)/1e3);var c=this._scroll.particleValue;return(this._scroll.scrollDelta||this._scroll.normalizedScrollDelta)&&(c+=this._scroll.scrollDelta+this._scroll.normalizedScrollDelta,(this._scroll.boundsReached&T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached&T.NEXT&&c<this._scroll.springPosition||this._scroll.boundsReached===T.BOTH)&&(c=this._scroll.springPosition),a&&(this._scroll.scrollDelta||(this._scroll.normalizedScrollDelta=0,p.call(this,c,void 0,"_calcScrollOffset")),this._scroll.normalizedScrollDelta+=this._scroll.scrollDelta,this._scroll.scrollDelta=0)),this._scroll.scrollForceCount&&this._scroll.scrollForce&&(void 0!==this._scroll.springPosition?c=(c+this._scroll.scrollForce+this._scroll.springPosition)/2:c+=this._scroll.scrollForce),this.options.overscroll||(this._scroll.boundsReached===T.BOTH||this._scroll.boundsReached===T.PREV&&c>this._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c<this._scroll.springPosition)&&(c=this._scroll.springPosition),c}function r(a,b){var c,d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0),g=f.call(this);if(g&&(void 0!==e&&void 0!==d&&(c=d+e),void 0!==c&&c<=a[this._direction]))return this._scroll.boundsReached=T.BOTH,this._scroll.springPosition=this.options.alignment?-e:d,void(this._scroll.springSource=U.MINSIZE);if(this.options.alignment)if(g){if(void 0!==e&&0>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=-e,void(this._scroll.springSource=U.NEXTBOUNDS)}else{var h=this._calcScrollHeight(!1,!0);if(void 0!==e&&h&&b+e+a[this._direction]<=h)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=e-(a[this._direction]-h),void(this._scroll.springSource=U.NEXTBOUNDS)}else if(void 0!==d&&b-d>=0)return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=d,void(this._scroll.springSource=U.PREVBOUNDS);if(this.options.alignment){if(void 0!==d&&b-d>=-a[this._direction])return this._scroll.boundsReached=T.PREV,this._scroll.springPosition=-a[this._direction]+d,void(this._scroll.springSource=U.PREVBOUNDS)}else{var i=g?a[this._direction]:this._calcScrollHeight(!0,!0);if(void 0!==e&&i>=b+e)return this._scroll.boundsReached=T.NEXT,this._scroll.springPosition=i-e,void(this._scroll.springSource=U.NEXTBOUNDS)}this._scroll.boundsReached=T.NONE,this._scroll.springPosition=void 0,this._scroll.springSource=U.NONE}function s(a,b){var c=this._scroll.scrollToRenderNode||this._scroll.ensureVisibleRenderNode;if(c&&!(this._scroll.boundsReached===T.BOTH||!this._scroll.scrollToDirection&&this._scroll.boundsReached===T.PREV||this._scroll.scrollToDirection&&this._scroll.boundsReached===T.NEXT)){for(var d,e=0,f=this._nodes.getStartEnumNode(!0),g=0;f&&(g++,f._invalidated&&void 0!==f.scrollLength);){if(this.options.alignment&&(e-=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment||(e-=f.scrollLength),f=f._next}if(!d)for(e=0,f=this._nodes.getStartEnumNode(!1);f&&f._invalidated&&void 0!==f.scrollLength;){if(this.options.alignment||(e+=f.scrollLength),f.renderNode===c){d=f;break}this.options.alignment&&(e+=f.scrollLength),f=f._prev}if(d)return void(this._scroll.ensureVisibleRenderNode?this.options.alignment?e-d.scrollLength<0?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e>a[this._direction]?(this._scroll.springPosition=a[this._direction]-e,this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0):(e=-e,0>e?(this._scroll.springPosition=e,this._scroll.springSource=U.ENSUREVISIBLE):e+d.scrollLength>a[this._direction]?(this._scroll.springPosition=a[this._direction]-(e+d.scrollLength),this._scroll.springSource=U.ENSUREVISIBLE):d.trueSizeRequested||(this._scroll.ensureVisibleRenderNode=void 0)):(this._scroll.springPosition=e,this._scroll.springSource=U.GOTOSEQUENCE));if(this._scroll.scrollToDirection?(this._scroll.springPosition=b-a[this._direction],this._scroll.springSource=U.GOTONEXTDIRECTION):(this._scroll.springPosition=b+a[this._direction],this._scroll.springSource=U.GOTOPREVDIRECTION),this._viewSequence.cleanup)for(var h=this._viewSequence;h.get()!==c&&(h=this._scroll.scrollToDirection?h.getNext(!0):h.getPrevious(!0)););}}function t(){if(this.options.paginated&&!this._scroll.scrollForceCount&&void 0===this._scroll.springPosition){var a;switch(this.options.paginationMode){case V.SCROLL:(!this.options.paginationEnergyThreshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThreshold)&&(a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode));break;case V.PAGE:a=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem(),a&&a.renderNode&&this.goToRenderNode(a.renderNode)}}}function u(a){for(var b=0,c=a,d=!1,e=this._nodes.getStartEnumNode(!1);e&&e._invalidated&&e._viewSequence&&(d&&(this._viewSequence=e._viewSequence,c=a,d=!1),!(void 0===e.scrollLength||e.trueSizeRequested||0>a));)a-=e.scrollLength,b++,e.scrollLength&&(this.options.alignment?d=a>=0:Math.round(a)>=0&&(this._viewSequence=e._viewSequence,c=a)),e=e._prev;return c}function v(a){for(var b=0,c=a,d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!d.trueSizeRequested&&d._viewSequence&&(!(Math.round(a)>0)||this.options.alignment&&0===d.scrollLength);)this.options.alignment&&(a+=d.scrollLength,b++),(d.scrollLength||this.options.alignment)&&(this._viewSequence=d._viewSequence,c=a),this.options.alignment||(a+=d.scrollLength,b++),d=d._next;return c}function w(a,b){var c=this._layout.capabilities;if(c&&c.debug&&void 0!==c.debug.normalize&&!c.debug.normalize)return b;if(this._scroll.scrollForceCount)return b;var d=b;if(this.options.alignment&&0>b?d=v.call(this,b):!this.options.alignment&&b>0&&(d=u.call(this,b)),d===b&&(this.options.alignment&&b>0?d=u.call(this,b):!this.options.alignment&&0>b&&(d=v.call(this,b))),d!==b){var e=d-b,g=this._scroll.particle.getPosition1D();p.call(this,g+e,void 0,"normalize"),void 0!==this._scroll.springPosition&&(this._scroll.springPosition+=e),f.call(this)&&(this._scroll.groupStart-=e)}return d}function x(a){for(var b,c={},d=1e7,e=a&&this.options.alignment?-this._contextSizeCache[this._direction]:a||this.options.alignment?0:this._contextSizeCache[this._direction],f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!0);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g,f+=g.scrollLength}g=g._next}for(f=this._scroll.unnormalizedScrollOffset,g=this._nodes.getStartEnumNode(!1);g&&g._invalidated&&void 0!==g.scrollLength;){if(g._viewSequence){if(f-=g.scrollLength,b=Math.abs(e-(f+(a?0:g.scrollLength))),b>=d)break;d=b,c.scrollOffset=f,c._node=g}g=g._prev}return c._node?(c.scrollLength=c._node.scrollLength,this.options.alignment?c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,0)-Math.max(c.scrollOffset,-this._contextSizeCache[this._direction]))/c.scrollLength:c.visiblePerc=(Math.min(c.scrollOffset+c.scrollLength,this._contextSizeCache[this._direction])-Math.max(c.scrollOffset,0))/c.scrollLength,c.index=c._node._viewSequence.getIndex(),c.viewSequence=c._node._viewSequence,c.renderNode=c._node.renderNode,c):void 0}function y(a,b,c){c?(this._viewSequence=a,this._scroll.springPosition=void 0,g.call(this),this.halt(),this._scroll.scrollDelta=0,p.call(this,0,0,"_goToSequence"),this._scroll.scrollDirty=!0):(this._scroll.scrollToSequence=a,this._scroll.scrollToRenderNode=a.get(),this._scroll.ensureVisibleRenderNode=void 0,this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0)}function z(a,b){this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=a.get(),this._scroll.scrollToDirection=b,this._scroll.scrollDirty=!0}function A(a,b){var c=(b?void 0:this._scroll.scrollToSequence)||this._viewSequence;if(!this._scroll.scrollToSequence&&!b){var d=this.getFirstVisibleItem();d&&(c=d.viewSequence,(0>a&&d.scrollOffset<0||a>0&&d.scrollOffset>0)&&(a=0))}if(c){for(var e=0;e<Math.abs(a);e++){var f=a>0?c.getNext():c.getPrevious();if(!f)break;c=f}y.call(this,c,a>=0,b)}}function B(a,b,c){this._debug.layoutCount++;var d=0-Math.max(this.options.extraBoundsSpace[0],1),e=a[this._direction]+Math.max(this.options.extraBoundsSpace[1],1);this.options.paginated&&this.options.paginationMode===V.PAGE&&(d=b-this.options.extraBoundsSpace[0],e=b+a[this._direction]+this.options.extraBoundsSpace[1],b+a[this._direction]<0?(d+=a[this._direction],e+=a[this._direction]):b-a[this._direction]>0&&(d-=a[this._direction],e-=a[this._direction])),this.options.layoutAll&&(d=-1e6,e=1e6);var f=this._nodes.prepareForLayout(this._viewSequence,this._nodesById,{size:a,direction:this._direction,reverse:this.options.alignment?!0:!1,scrollOffset:this.options.alignment?b+a[this._direction]:b,scrollStart:d,scrollEnd:e});this._layout._function&&this._layout._function(f,this._layout.options),this._scroll.unnormalizedScrollOffset=b,this._postLayout&&this._postLayout(a,b),this._nodes.removeNonInvalidatedNodes(this.options.flowOptions.removeSpec),r.call(this,a,b),s.call(this,a,b),t.call(this);var h=q.call(this,!0);if(!c&&h!==b)return B.call(this,a,h,!0);if(b=w.call(this,a,b),g.call(this),this._nodes.removeVirtualViewSequenceNodes(),this.options.size&&this.options.size[this._direction]===!0){for(var i=0,j=this._nodes.getStartEnumNode();j;)j._invalidated&&j.scrollLength&&(i+=j.scrollLength),j=j._next;this._size=this._size||[0,0],this._size[0]=this.options.size[0],this._size[1]=this.options.size[1],this._size[this._direction]=i}return b}function C(){for(var a=this._specs,b=0,c=a.length;c>b;b++)a[b].renderNode&&(a[b].target=a[b].renderNode.render());return a.length&&a[a.length-1]===this._cleanupRegistration||a.push(this._cleanupRegistration),a}var D=a("./LayoutUtility"),E=a("./LayoutController"),F=a("./LayoutNode"),G=a("./FlowLayoutNode"),H=a("./LayoutNodeManager"),I=a("famous/surfaces/ContainerSurface"),J=a("famous/core/Transform"),K=a("famous/core/EventHandler"),L=a("famous/core/Group"),M=a("famous/math/Vector"),N=a("famous/physics/PhysicsEngine"),O=a("famous/physics/bodies/Particle"),P=a("famous/physics/forces/Drag"),Q=a("famous/physics/forces/Spring"),R=a("famous/inputs/ScrollSync"),S=a("./LinkedListViewSequence"),T={NONE:0,PREV:1,NEXT:2,BOTH:3},U={NONE:"none",NEXTBOUNDS:"next-bounds",PREVBOUNDS:"prev-bounds",MINSIZE:"minimal-size",GOTOSEQUENCE:"goto-sequence",ENSUREVISIBLE:"ensure-visible",GOTOPREVDIRECTION:"goto-prev-direction",GOTONEXTDIRECTION:"goto-next-direction"},V={PAGE:0,SCROLL:1};d.prototype=Object.create(E.prototype),d.prototype.constructor=d,d.Bounds=T,d.PaginationMode=V,d.DEFAULT_OPTIONS={useContainer:!1,container:{properties:{overflow:"hidden"}},scrollPhysicsEngine:{},scrollParticle:{},scrollDrag:{forceFunction:P.FORCE_FUNCTIONS.QUADRATIC,strength:.001,disabled:!0},scrollFriction:{forceFunction:P.FORCE_FUNCTIONS.LINEAR,strength:.0025,disabled:!1},scrollSpring:{dampingRatio:1,period:350},scrollSync:{scale:.2},overscroll:!0,paginated:!1,paginationMode:V.PAGE,paginationEnergyThreshold:.01,alignment:0,touchMoveDirectionThreshold:void 0,touchMoveNoVelocityDuration:100,mouseMove:!1,enabled:!0,layoutAll:!1,alwaysLayout:!1,extraBoundsSpace:[100,100],debug:!1},d.prototype.setOptions=function(a){return E.prototype.setOptions.call(this,a),a.hasOwnProperty("paginationEnergyThresshold")&&(console.warn("option `paginationEnergyThresshold` has been deprecated, please rename to `paginationEnergyThreshold`."),this.setOptions({paginationEnergyThreshold:a.paginationEnergyThresshold})),a.hasOwnProperty("touchMoveDirectionThresshold")&&(console.warn("option `touchMoveDirectionThresshold` has been deprecated, please rename to `touchMoveDirectionThreshold`."),this.setOptions({touchMoveDirectionThreshold:a.touchMoveDirectionThresshold})),this._scroll&&(a.scrollSpring&&this._scroll.springForce.setOptions(a.scrollSpring),a.scrollDrag&&this._scroll.dragForce.setOptions(a.scrollDrag)),a.scrollSync&&this._scrollSync&&this._scrollSync.setOptions(a.scrollSync),this},d.prototype._calcScrollHeight=function(a,b){for(var c=0,d=this._nodes.getStartEnumNode(a);d;){if(d._invalidated){if(d.trueSizeRequested){c=void 0;break}if(void 0!==d.scrollLength&&(c=b?d.scrollLength:c+d.scrollLength,!a&&b))break}d=a?d._next:d._prev}return c},d.prototype.getVisibleItems=function(){for(var a=this._contextSizeCache,b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,c=[],d=this._nodes.getStartEnumNode(!0);d&&d._invalidated&&void 0!==d.scrollLength&&!(b>a[this._direction]);)b+=d.scrollLength,b>=0&&d._viewSequence&&c.push({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b,a[this._direction])-Math.max(b-d.scrollLength,0))/d.scrollLength:1,scrollOffset:b-d.scrollLength,scrollLength:d.scrollLength,_node:d}),d=d._next;for(b=this.options.alignment?this._scroll.unnormalizedScrollOffset+a[this._direction]:this._scroll.unnormalizedScrollOffset,d=this._nodes.getStartEnumNode(!1);d&&d._invalidated&&void 0!==d.scrollLength&&!(0>b);)b-=d.scrollLength,b<a[this._direction]&&d._viewSequence&&c.unshift({index:d._viewSequence.getIndex(),viewSequence:d._viewSequence,renderNode:d.renderNode,visiblePerc:d.scrollLength?(Math.min(b+d.scrollLength,a[this._direction])-Math.max(b,0))/d.scrollLength:1,scrollOffset:b,scrollLength:d.scrollLength,_node:d}),d=d._prev;return c},d.prototype.getFirstVisibleItem=function(){return x.call(this,!0)},d.prototype.getLastVisibleItem=function(){return x.call(this,!1)},d.prototype.goToFirstPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to first item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getPrevious();if(!c||!c.get())break;b=c}return y.call(this,b,!1,a),this},d.prototype.goToPreviousPage=function(a){return A.call(this,-1,a),this},d.prototype.goToNextPage=function(a){return A.call(this,1,a),this},d.prototype.goToLastPage=function(a){if(!this._viewSequence)return this;if(this._viewSequence._&&this._viewSequence._.loop)return D.error("Unable to go to last item of looped ViewSequence"),this;for(var b=this._viewSequence;b;){var c=b.getNext();if(!c||!c.get())break;b=c}return y.call(this,b,!0,a),this},d.prototype.goToRenderNode=function(a,b){if(!this._viewSequence||!a)return this;if(this._viewSequence.get()===a){var c=q.call(this)>=0;return y.call(this,this._viewSequence,c,b),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){y.call(this,d,!0,b);break}var g=e?e.get():void 0;if(g===a){y.call(this,e,!1,b);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.ensureVisible=function(a){if(a instanceof S)a=a.get();else if(a instanceof Number||"number"==typeof a){for(var b=this._viewSequence;b.getIndex()<a;)if(b=b.getNext(),!b)return this;for(;b.getIndex()>a;)if(b=b.getPrevious(),!b)return this}if(this._viewSequence.get()===a){var c=q.call(this)>=0;return z.call(this,this._viewSequence,c),this}for(var d=this._viewSequence.getNext(),e=this._viewSequence.getPrevious();(d||e)&&d!==this._viewSequence;){var f=d?d.get():void 0;if(f===a){z.call(this,d,!0);break}var g=e?e.get():void 0;if(g===a){z.call(this,e,!1);break}d=f?d.getNext():void 0,e=g?e.getPrevious():void 0}return this},d.prototype.scroll=function(a){return this.halt(),this._scroll.scrollDelta+=a,this},d.prototype.canScroll=function(a){var b,c=q.call(this),d=this._calcScrollHeight(!1),e=this._calcScrollHeight(!0);if(void 0!==e&&void 0!==d&&(b=d+e),void 0!==b&&b<=this._contextSizeCache[this._direction])return 0;if(0>a&&void 0!==e){var f=this._contextSizeCache[this._direction]-(c+e);return Math.max(f,a)}if(a>0&&void 0!==d){var g=-(c-d);return Math.min(g,a)}return a},d.prototype.halt=function(){return this._scroll.scrollToSequence=void 0,this._scroll.scrollToRenderNode=void 0,this._scroll.ensureVisibleRenderNode=void 0,p.call(this,void 0,0,"halt"),this},
+d.prototype.isScrolling=function(){return this._scroll.isScrolling},d.prototype.getBoundsReached=function(){return this._scroll.boundsReached},d.prototype.getVelocity=function(){return this._scroll.particle.getVelocity1D()},d.prototype.getEnergy=function(){return this._scroll.particle.getEnergy()},d.prototype.setVelocity=function(a){return this._scroll.particle.setVelocity1D(a)},d.prototype.applyScrollForce=function(a){return this.halt(),0===this._scroll.scrollForceCount&&(this._scroll.scrollForceStartItem=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem()),this._scroll.scrollForceCount++,this._scroll.scrollForce+=a,this._eventOutput.emit(1===this._scroll.scrollForceCount?"swipestart":"swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a}),this},d.prototype.updateScrollForce=function(a,b){return this.halt(),b-=a,this._scroll.scrollForce+=b,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:b}),this},d.prototype.releaseScrollForce=function(a,b){if(this.halt(),1===this._scroll.scrollForceCount){var c=q.call(this);if(p.call(this,c,b,"releaseScrollForce"),this._scroll.pe.wake(),this._scroll.scrollForce=0,this._scroll.scrollDirty=!0,this._scroll.scrollForceStartItem&&this.options.paginated&&this.options.paginationMode===V.PAGE){var d=this.options.alignment?this.getLastVisibleItem(!0):this.getFirstVisibleItem(!0);d&&(d.renderNode!==this._scroll.scrollForceStartItem.renderNode?this.goToRenderNode(d.renderNode):this.options.paginationEnergyThreshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThreshold?(b=b||0,0>b&&d._node._next&&d._node._next.renderNode?this.goToRenderNode(d._node._next.renderNode):b>=0&&d._node._prev&&d._node._prev.renderNode&&this.goToRenderNode(d._node._prev.renderNode)):this.goToRenderNode(d.renderNode))}this._scroll.scrollForceStartItem=void 0,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeend",{target:this,total:a,delta:0,velocity:b})}else this._scroll.scrollForce-=a,this._scroll.scrollForceCount--,this._eventOutput.emit("swipeupdate",{target:this,total:this._scroll.scrollForce,delta:a});return this},d.prototype.getSpec=function(a,b){var c=E.prototype.getSpec.apply(this,arguments);if(c&&f.call(this)){c={origin:c.origin,align:c.align,opacity:c.opacity,size:c.size,renderNode:c.renderNode,transform:c.transform};var d=[0,0,0];d[this._direction]=this._scrollOffsetCache+this._scroll.groupStart,c.transform=J.thenMove(c.transform,d)}return c},d.prototype.commit=function(a){var b=a.size;this._debug.commitCount++,this._resetFlowState&&(this._resetFlowState=!1,this._isDirty=!0,this._nodes.removeAll());var c=q.call(this,!0,!0);void 0===this._scrollOffsetCache&&(this._scrollOffsetCache=c);var d,e=!1,g=!1;if(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1]||this._isDirty||this._scroll.scrollDirty||this._nodes._trueSizeRequested||this.options.alwaysLayout||this._scrollOffsetCache!==c){if(d={target:this,oldSize:this._contextSizeCache,size:b,oldScrollOffset:-(this._scrollOffsetCache+this._scroll.groupStart),scrollOffset:-(c+this._scroll.groupStart)},this._scrollOffsetCache!==c?(this._scroll.isScrolling||(this._scroll.isScrolling=!0,this._eventOutput.emit("scrollstart",d)),g=!0):this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0),this._eventOutput.emit("layoutstart",d),this.options.flow&&(this._isDirty||this.options.flowOptions.reflowOnResize&&(b[0]!==this._contextSizeCache[0]||b[1]!==this._contextSizeCache[1])))for(var h=this._nodes.getStartEnumNode();h;)h.releaseLock(!0),h=h._next;this._contextSizeCache[0]=b[0],this._contextSizeCache[1]=b[1],this._isDirty=!1,this._scroll.scrollDirty=!1,c=B.call(this,b,c),this._scrollOffsetCache=c,d.scrollOffset=-(this._scrollOffsetCache+this._scroll.groupStart)}else this._scroll.isScrolling&&!this._scroll.scrollForceCount&&(e=!0);var i=this._scroll.groupTranslate;i[0]=0,i[1]=0,i[2]=0,i[this._direction]=-this._scroll.groupStart-c;var j=f.call(this),k=this._nodes.buildSpecAndDestroyUnrenderedNodes(j?i:void 0);if(this._specs=k.specs,this._specs.length||(this._scroll.groupStart=0),d&&this._eventOutput.emit("layoutend",d),k.modified&&this._eventOutput.emit("reflow",{target:this}),g&&this._eventOutput.emit("scroll",d),d){var l=this.options.alignment?this.getLastVisibleItem():this.getFirstVisibleItem();(l&&!this._visibleItemCache||!l&&this._visibleItemCache||l&&this._visibleItemCache&&l.renderNode!==this._visibleItemCache.renderNode)&&(this._eventOutput.emit("pagechange",{target:this,oldViewSequence:this._visibleItemCache?this._visibleItemCache.viewSequence:void 0,viewSequence:l?l.viewSequence:void 0,oldIndex:this._visibleItemCache?this._visibleItemCache.index:void 0,index:l?l.index:void 0,renderNode:l?l.renderNode:void 0,oldRenderNode:this._visibleItemCache?this._visibleItemCache.renderNode:void 0}),this._visibleItemCache=l)}e&&(this._scroll.isScrolling=!1,d={target:this,oldSize:b,size:b,oldScrollOffset:-(this._scroll.groupStart+c),scrollOffset:-(this._scroll.groupStart+c)},this._eventOutput.emit("scrollend",d));var m=a.transform;if(j){var n=c+this._scroll.groupStart,o=[0,0,0];o[this._direction]=n,m=J.thenMove(m,o)}return{transform:m,size:b,opacity:a.opacity,origin:a.origin,target:this.group.render()}},d.prototype.render=function(){return this.container?this.container.render.apply(this.container,arguments):this.id},c.exports=d}),define("famous-flex/layouts/ListLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){var c,d,e,g,j,k,l,m,n,o,p,q,r,s,t=a.size,u=a.direction,v=a.alignment,w=u?0:1,x=f.normalizeMargins(b.margins),y=b.spacing||0,z=b.isSectionCallback;for(y&&"number"!=typeof y&&console.log("Famous-flex warning: ListLayout was initialized with a non-numeric spacing option. The CollectionLayout supports an array spacing argument, but the ListLayout does not."),h.size[0]=t[0],h.size[1]=t[1],h.size[w]-=x[1-w]+x[3-w],h.translate[0]=0,h.translate[1]=0,h.translate[2]=0,h.translate[w]=x[u?3:0],b.itemSize!==!0&&b.hasOwnProperty("itemSize")?b.itemSize instanceof Function?j=b.itemSize:g=void 0===b.itemSize?t[u]:b.itemSize:g=!0,i[0]=x[u?0:3],i[1]=-x[u?2:1],c=a.scrollOffset+i[v],s=a.scrollEnd+i[v];s+y>c&&(q=d,d=a.next());)e=j?j(d.renderNode,a.size):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.size[u]=e,h.translate[u]=c+(v?y:0),h.scrollLength=e+y,a.set(d,h),c+=h.scrollLength,z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),p?void 0===r&&(r=c-e):(k=d,l=c-e,m=e,n=e)):!p&&c>=0&&(p=d);for(!q||d||v||(h.scrollLength=e+i[0]+-i[1],a.set(q,h)),q=void 0,d=void 0,c=a.scrollOffset+i[v],s=a.scrollStart+i[v];c>s-y&&(q=d,d=a.prev());)e=j?j(d.renderNode,a.size):g,e=e===!0?a.resolveSize(d,t)[u]:e,h.scrollLength=e+y,c-=h.scrollLength,h.size[u]=e,h.translate[u]=c+(v?y:0),a.set(d,h),z&&z(d.renderNode)?(h.translate[u]<=i[0]&&!o&&(o=!0,h.translate[u]=i[0],a.set(d,h)),k||(k=d,l=c,m=e,n=h.scrollLength)):c+e>=0&&(p=d,k&&(r=c+e),k=void 0);if(q&&!d&&v&&(h.scrollLength=e+i[0]+-i[1],a.set(q,h),k===q&&(n=h.scrollLength)),z&&!k)for(d=a.prev();d;){if(z(d.renderNode)){k=d,e=b.itemSize||a.resolveSize(d,t)[u],l=c-e,m=e,n=void 0;break}d=a.prev()}if(k){var A=Math.max(i[0],l);void 0!==r&&m>r-i[0]&&(A=r-m),h.size[u]=m,h.translate[u]=A,h.scrollLength=n,a.set(k,h)}}var e=a("famous/utilities/Utility"),f=a("../LayoutUtility"),g={sequence:!0,direction:[e.Direction.Y,e.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},h={size:[0,0],translate:[0,0,0],scrollLength:void 0},i=[0,0];d.Capabilities=g,d.Name="ListLayout",d.Description="List-layout with margins, spacing and sticky headers",c.exports=d}),define("famous-flex/FlexScrollView",["require","exports","module","./LayoutUtility","./ScrollController","./layouts/ListLayout"],function(a,b,c){function d(a){h.call(this,g.combineOptions(d.DEFAULT_OPTIONS,a)),this._thisScrollViewDelta=0,this._leadingScrollViewDelta=0,this._trailingScrollViewDelta=0}function e(a,b){a.state!==b&&(a.state=b,a.node&&a.node.setPullToRefreshStatus&&a.node.setPullToRefreshStatus(b))}function f(a){return this._pullToRefresh?this._pullToRefresh[a?1:0]:void 0}var g=a("./LayoutUtility"),h=a("./ScrollController"),i=a("./layouts/ListLayout"),j={HIDDEN:0,PULLING:1,ACTIVE:2,COMPLETED:3,HIDDING:4};d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.PullToRefreshState=j,d.Bounds=h.Bounds,d.PaginationMode=h.PaginationMode,d.DEFAULT_OPTIONS={layout:i,direction:void 0,paginated:!1,alignment:0,flow:!1,mouseMove:!1,useContainer:!1,visibleItemThresshold:.5,pullToRefreshHeader:void 0,pullToRefreshFooter:void 0,leadingScrollView:void 0,trailingScrollView:void 0},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),(a.pullToRefreshHeader||a.pullToRefreshFooter||this._pullToRefresh)&&(a.pullToRefreshHeader?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[0]||(this._pullToRefresh[0]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!1}),this._pullToRefresh[0].node=a.pullToRefreshHeader):!this.options.pullToRefreshHeader&&this._pullToRefresh&&(this._pullToRefresh[0]=void 0),a.pullToRefreshFooter?(this._pullToRefresh=this._pullToRefresh||[void 0,void 0],this._pullToRefresh[1]||(this._pullToRefresh[1]={state:j.HIDDEN,prevState:j.HIDDEN,footer:!0}),this._pullToRefresh[1].node=a.pullToRefreshFooter):!this.options.pullToRefreshFooter&&this._pullToRefresh&&(this._pullToRefresh[1]=void 0),!this._pullToRefresh||this._pullToRefresh[0]||this._pullToRefresh[1]||(this._pullToRefresh=void 0)),this},d.prototype.sequenceFrom=function(a){return this.setDataSource(a)},d.prototype.getCurrentIndex=function(){var a=this.getFirstVisibleItem();return a?a.viewSequence.getIndex():-1},d.prototype.goToPage=function(a,b){var c=this._viewSequence;if(!c)return this;for(;c.getIndex()<a;)if(c=c.getNext(),!c)return this;for(;c.getIndex()>a;)if(c=c.getPrevious(),!c)return this;return this.goToRenderNode(c.get(),b),this},d.prototype.getOffset=function(){return this._scrollOffsetCache},d.prototype.getPosition=d.prototype.getOffset,d.prototype.getAbsolutePosition=function(){return-(this._scrollOffsetCache+this._scroll.groupStart)},d.prototype._postLayout=function(a,b){if(this._pullToRefresh){this.options.alignment&&(b+=a[this._direction]);for(var c,d,f,g=0;2>g;g++){var h=this._pullToRefresh[g];if(h){var i,k=h.node.getSize()[this._direction],l=h.node.getPullToRefreshSize?h.node.getPullToRefreshSize()[this._direction]:k;h.footer?(d=void 0===d?d=this._calcScrollHeight(!0):d,d=void 0===d?-1:d,i=d>=0?b+d:a[this._direction]+1,this.options.alignment||(c=void 0===c?this._calcScrollHeight(!1):c,c=void 0===c?-1:c,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-c+a[this._direction]))),i=-(i-a[this._direction])):(c=this._calcScrollHeight(!1),c=void 0===c?-1:c,i=c>=0?b-c:c,this.options.alignment&&(d=this._calcScrollHeight(!0),d=void 0===d?-1:d,f=c>=0&&d>=0?c+d:-1,f>=0&&f<a[this._direction]&&(i=Math.round(b-a[this._direction]+d))));var m=Math.max(Math.min(i/l,1),0);switch(h.state){case j.HIDDEN:this._scroll.scrollForceCount&&(m>=1?e(h,j.ACTIVE):i>=.2&&e(h,j.PULLING));break;case j.PULLING:this._scroll.scrollForceCount&&m>=1?e(h,j.ACTIVE):.2>i&&e(h,j.HIDDEN);break;case j.ACTIVE:break;case j.COMPLETED:this._scroll.scrollForceCount||(i>=.2?e(h,j.HIDDING):e(h,j.HIDDEN));break;case j.HIDDING:.2>i&&e(h,j.HIDDEN)}if(h.state!==j.HIDDEN){var n,o={renderNode:h.node,prev:!h.footer,next:h.footer,index:h.footer?++this._nodes._contextState.nextGetIndex:--this._nodes._contextState.prevGetIndex};h.state===j.ACTIVE?n=k:this._scroll.scrollForceCount&&(n=Math.min(i,k));var p={size:[a[0],a[1]],translate:[0,0,-.001],scrollLength:n};p.size[this._direction]=Math.max(Math.min(i,l),0),p.translate[this._direction]=h.footer?a[this._direction]-k:0,this._nodes._context.set(o,p)}}}}},d.prototype.showPullToRefresh=function(a){var b=f.call(this,a);b&&(e(b,j.ACTIVE),this._scroll.scrollDirty=!0)},d.prototype.hidePullToRefresh=function(a){var b=f.call(this,a);return b&&b.state===j.ACTIVE&&(e(b,j.COMPLETED),this._scroll.scrollDirty=!0),this},d.prototype.isPullToRefreshVisible=function(a){var b=f.call(this,a);return b?b.state===j.ACTIVE:!1},d.prototype.applyScrollForce=function(a){var b=this.options.leadingScrollView,c=this.options.trailingScrollView;if(!b&&!c)return h.prototype.applyScrollForce.call(this,a);var d;return 0>a?(b&&(d=b.canScroll(a),this._leadingScrollViewDelta+=d,b.applyScrollForce(d),a-=d),c?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,c.applyScrollForce(a),this._trailingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)):(c&&(d=c.canScroll(a),c.applyScrollForce(d),this._trailingScrollViewDelta+=d,a-=d),b?(d=this.canScroll(a),h.prototype.applyScrollForce.call(this,d),this._thisScrollViewDelta+=d,a-=d,b.applyScrollForce(a),this._leadingScrollViewDelta+=a):(h.prototype.applyScrollForce.call(this,a),this._thisScrollViewDelta+=a)),this},d.prototype.updateScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.updateScrollForce.call(this,a,b);var e,f=b-a;return 0>f?(c&&(e=c.canScroll(f),c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+e),this._leadingScrollViewDelta+=e,f-=e),d&&f?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,this._trailingScrollViewDelta+=f,d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+f)):f&&(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)):(d&&(e=d.canScroll(f),d.updateScrollForce(this._trailingScrollViewDelta,this._trailingScrollViewDelta+e),this._trailingScrollViewDelta+=e,f-=e),c?(e=this.canScroll(f),h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+e),this._thisScrollViewDelta+=e,f-=e,c.updateScrollForce(this._leadingScrollViewDelta,this._leadingScrollViewDelta+f),this._leadingScrollViewDelta+=f):(h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,this._thisScrollViewDelta+f),this._thisScrollViewDelta+=f)),this},d.prototype.releaseScrollForce=function(a,b){var c=this.options.leadingScrollView,d=this.options.trailingScrollView;if(!c&&!d)return h.prototype.releaseScrollForce.call(this,a,b);var e;return 0>a?(c&&(e=Math.max(this._leadingScrollViewDelta,a),this._leadingScrollViewDelta-=e,a-=e,c.releaseScrollForce(this._leadingScrollViewDelta,a?0:b)),d?(e=Math.max(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._trailingScrollViewDelta-=a,d.releaseScrollForce(this._trailingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?b:0))):(d&&(e=Math.min(this._trailingScrollViewDelta,a),this._trailingScrollViewDelta-=e,a-=e,d.releaseScrollForce(this._trailingScrollViewDelta,a?0:b)),c?(e=Math.min(this._thisScrollViewDelta,a),this._thisScrollViewDelta-=e,a-=e,h.prototype.releaseScrollForce.call(this,this._thisScrollViewDelta,a?0:b),this._leadingScrollViewDelta-=a,c.releaseScrollForce(this._leadingScrollViewDelta,a?b:0)):(this._thisScrollViewDelta-=a,h.prototype.updateScrollForce.call(this,this._thisScrollViewDelta,a?b:0))),this},d.prototype.commit=function(a){var b=h.prototype.commit.call(this,a);if(this._pullToRefresh)for(var c=0;2>c;c++){var d=this._pullToRefresh[c];d&&(d.state===j.ACTIVE&&d.prevState!==j.ACTIVE&&this._eventOutput.emit("refresh",{target:this,footer:d.footer}),d.prevState=d.state)}return b},c.exports=d}),define("famous-flex/VirtualViewSequence",["require","exports","module","famous/core/EventHandler"],function(a,b,c){function d(a){a=a||{},this._=a._||new this.constructor.Backing(a),this.touched=!0,this.value=a.value||this._.factory.create(),this.index=a.index||0,this.next=a.next,this.prev=a.prev,e.setOutputHandler(this,this._.eventOutput),this.value.pipe(this._.eventOutput)}var e=a("famous/core/EventHandler");d.Backing=function(a){this.factory=a.factory,this.eventOutput=new e},d.prototype.getPrevious=function(a){if(this.prev)return this.prev.touched=!0,this.prev;if(a)return void 0;var b=this._.factory.createPrevious(this.get());return b?(this.prev=new d({_:this._,value:b,index:this.index-1,next:this}),this.prev):void 0},d.prototype.getNext=function(a){if(this.next)return this.next.touched=!0,this.next;if(a)return void 0;var b=this._.factory.createNext(this.get());return b?(this.next=new d({_:this._,value:b,index:this.index+1,prev:this}),this.next):void 0},d.prototype.get=function(){return this.touched=!0,this.value},d.prototype.getIndex=function(){return this.touched=!0,this.index},d.prototype.toString=function(){return""+this.index},d.prototype.cleanup=function(){for(var a=this.prev;a;){if(!a.touched){if(a.next.prev=void 0,a.next=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.prev;break}a.touched=!1,a=a.prev}for(a=this.next;a;){if(!a.touched){if(a.prev.next=void 0,a.prev=void 0,this._.factory.destroy)for(;a;)this._.factory.destroy(a.value),a=a.next;break}a.touched=!1,a=a.next}return this},d.prototype.unshift=function(){console.error&&console.error("VirtualViewSequence.unshift is not supported and should not be called")},d.prototype.push=function(){console.error&&console.error("VirtualViewSequence.push is not supported and should not be called")},d.prototype.splice=function(){console.error&&console.error("VirtualViewSequence.splice is not supported and should not be called")},d.prototype.swap=function(){console.error&&console.error("VirtualViewSequence.swap is not supported and should not be called")},d.prototype.insert=function(){console.error&&console.error("VirtualViewSequence.insert is not supported and should not be called")},d.prototype.remove=function(){console.error&&console.error("VirtualViewSequence.remove is not supported and should not be called")},c.exports=d}),define("famous-flex/AnimationController",["require","exports","module","famous/core/View","./LayoutController","famous/core/Transform","famous/core/Modifier","famous/modifiers/StateModifier","famous/core/RenderNode","famous/utilities/Timer","famous/transitions/Easing"],function(a,b,c){function d(a){w.apply(this,arguments),this._size=[0,0],f.call(this),a&&this.setOptions(a)}function e(a,b){var c={size:a.size,translate:[0,0,0]};this._size[0]=a.size[0],this._size[1]=a.size[1];for(var d=a.get("views"),e=a.get("transferables"),f=0,g=0;g<d.length;g++){var h=this._viewStack[g];switch(h.state){case E.HIDDEN:a.set(d[g],{size:a.size,translate:[2*a.size[0],2*a.size[1],0]});break;case E.HIDE:case E.HIDING:case E.VISIBLE:case E.SHOW:case E.SHOWING:if(2>f){f++;var i=d[g];a.set(i,c);for(var j=0;j<e.length;j++)for(var k=0;k<h.transferables.length;k++)e[j].renderNode===h.transferables[k].renderNode&&a.set(e[j],{translate:[0,0,c.translate[2]],size:[a.size[0],a.size[1]]});c.translate[2]+=b.zIndexOffset}}}}function f(){this._renderables={views:[],transferables:[]},this._viewStack=[],this.layout=new x({layout:e.bind(this),layoutOptions:this.options,dataSource:this._renderables}),this.add(this.layout),this.layout.on("layoutend",m.bind(this))}function g(a,b,c,d){if(a.view){var e=b.getSpec(c);e&&!e.trueSizeRequested?d(e):C.after(g.bind(this,a,b,c,d),1)}}function h(a,b,c){return b.getTransferable?b.getTransferable(c):b.getSpec&&b.get&&b.replace&&void 0!==b.get(c)?{get:function(){return b.get(c)},show:function(a){b.replace(c,a)},getSpec:g.bind(this,a,b,c)}:b.layout?h.call(this,a,b.layout,c):void 0}function i(a,b,c){function d(){e--,0===e&&c()}var e=0;for(var f in a.options.transfer.items)j.call(this,a,b,f,d)&&e++;e||c()}function j(a,b,c,d){var e=a.options.transfer.items[c],f={};if(f.source=h.call(this,b,b.view,c),Array.isArray(e))for(var g=0;g<e.length&&(f.target=h.call(this,a,a.view,e[g]),!f.target);g++);else f.target=h.call(this,a,a.view,e);return f.source&&f.target?(f.source.getSpec(function(b){f.sourceSpec=b,f.originalSource=f.source.get(),f.source.show(new B(new z(b))),f.originalTarget=f.target.get();var c=new B(new z({opacity:0}));c.add(f.originalTarget),f.target.show(c);var e=new z({transform:y.translate(0,0,a.options.transfer.zIndex)});f.mod=new A(b),f.renderNode=new B(e),f.renderNode.add(f.mod).add(f.originalSource),a.transferables.push(f),this._renderables.transferables.push(f.renderNode),this.layout.reflowLayout(),C.after(function(){var a;f.target.getSpec(function(b,c){f.targetSpec=b,f.transition=c,a||d()},!0)},1)}.bind(this),!1),!0):!1}function k(a,b){for(var c=0;c<a.transferables.length;c++){var d=a.transferables[c];if(d.mod.halt(),(void 0!==d.sourceSpec.opacity||void 0!==d.targetSpec.opacity)&&d.mod.setOpacity(void 0===d.targetSpec.opacity?1:d.targetSpec.opacity,d.transition||a.options.transfer.transition),a.options.transfer.fastResize){if(d.sourceSpec.transform||d.targetSpec.transform||d.sourceSpec.size||d.targetSpec.size){var e=d.targetSpec.transform||y.identity;d.sourceSpec.size&&d.targetSpec.size&&(e=y.multiply(e,y.scale(d.targetSpec.size[0]/d.sourceSpec.size[0],d.targetSpec.size[1]/d.sourceSpec.size[1],1))),d.mod.setTransform(e,d.transition||a.options.transfer.transition,b),b=void 0}}else(d.sourceSpec.transform||d.targetSpec.transform)&&(d.mod.setTransform(d.targetSpec.transform||y.identity,d.transition||a.options.transfer.transition,b),b=void 0),(d.sourceSpec.size||d.targetSpec.size)&&(d.mod.setSize(d.targetSpec.size||d.sourceSpec.size,d.transition||a.options.transfer.transition,b),b=void 0)}b&&b()}function l(a){for(var b=0;b<a.transferables.length;b++){for(var c=a.transferables[b],d=0;d<this._renderables.transferables.length;d++)if(this._renderables.transferables[d]===c.renderNode){this._renderables.transferables.splice(d,1);break}c.source.show(c.originalSource),c.target.show(c.originalTarget)}a.transferables=[],this.layout.reflowLayout()}function m(a){for(var b,c=0;c<this._viewStack.length;c++){var d=this._viewStack[c];switch(d.state){case E.HIDE:d.state=E.HIDING,r.call(this,d,b,a.size),u.call(this);break;case E.SHOW:d.state=E.SHOWING,n.call(this,d,b,a.size),u.call(this)}b=d}}function n(a,b,c){var d=a.options.show.animation?a.options.show.animation.call(void 0,!0,c):{};a.startSpec=d,a.endSpec={opacity:1,transform:y.identity},a.mod.halt(),d.transform&&a.mod.setTransform(d.transform),void 0!==d.opacity&&a.mod.setOpacity(d.opacity),d.align&&a.mod.setAlign(d.align),d.origin&&a.mod.setOrigin(d.origin);var e=o.bind(this,a,d),f=a.wait?function(){a.wait.then(e,e)}:e;b?i.call(this,a,b,f):f()}function o(a,b){if(!a.halted){var c=a.showCallback;b.transform&&(a.mod.setTransform(y.identity,a.options.show.transition,c),c=void 0),void 0!==b.opacity&&(a.mod.setOpacity(1,a.options.show.transition,c),c=void 0),k.call(this,a,c)}}function p(a,b,c){return a+(b-a)*c}function q(a,b){if(a.mod.halt(),a.halted=!0,a.startSpec&&void 0!==b&&(void 0!==a.startSpec.opacity&&void 0!==a.endSpec.opacity&&a.mod.setOpacity(p(a.startSpec.opacity,a.endSpec.opacity,b)),a.startSpec.transform&&a.endSpec.transform)){for(var c=[],d=0;d<a.startSpec.transform.length;d++)c.push(p(a.startSpec.transform[d],a.endSpec.transform[d],b));a.mod.setTransform(c)}}function r(a,b,c){var d=s.bind(this,a,b,c);a.wait?a.wait.then(d,d):d()}function s(a,b,c){var d=a.options.hide.animation?a.options.hide.animation.call(void 0,!1,c):{};if(a.endSpec=d,a.startSpec={opacity:1,transform:y.identity},!a.halted){a.mod.halt();var e=a.hideCallback;d.transform&&(a.mod.setTransform(d.transform,a.options.hide.transition,e),e=void 0),void 0!==d.opacity&&(a.mod.setOpacity(d.opacity,a.options.hide.transition,e),e=void 0),e&&e()}}function t(a,b,c){a.options={show:{transition:this.options.show.transition||this.options.transition,animation:this.options.show.animation||this.options.animation},hide:{transition:this.options.hide.transition||this.options.transition,animation:this.options.hide.animation||this.options.animation},transfer:{transition:this.options.transfer.transition||this.options.transition,items:this.options.transfer.items||{},zIndex:this.options.transfer.zIndex,fastResize:this.options.transfer.fastResize}},b&&(a.options.show.transition=(b.show?b.show.transition:void 0)||b.transition||a.options.show.transition,b&&b.show&&void 0!==b.show.animation?a.options.show.animation=b.show.animation:b&&void 0!==b.animation&&(a.options.show.animation=b.animation),a.options.transfer.transition=(b.transfer?b.transfer.transition:void 0)||b.transition||a.options.transfer.transition,a.options.transfer.items=(b.transfer?b.transfer.items:void 0)||a.options.transfer.items,a.options.transfer.zIndex=b.transfer&&void 0!==b.transfer.zIndex?b.transfer.zIndex:a.options.transfer.zIndex,a.options.transfer.fastResize=b.transfer&&void 0!==b.transfer.fastResize?b.transfer.fastResize:a.options.transfer.fastResize),a.showCallback=function(){a.showCallback=void 0,a.state=E.VISIBLE,u.call(this),l.call(this,a),a.endSpec=void 0,a.startSpec=void 0,c&&c()}.bind(this)}function u(){for(var a,b=!1,c=0,d=0;d<this._viewStack.length;){if(this._viewStack[d].state===E.HIDDEN){c++;for(var e=0;e<this._viewStack.length;e++)if(this._viewStack[e].state!==E.HIDDEN&&this._viewStack[e].view===this._viewStack[d].view){this._viewStack[d].view=void 0,this._renderables.views.splice(d,1),this._viewStack.splice(d,1),d--,c--;break}}d++}for(;c>this.options.keepHiddenViewsInDOMCount;)this._viewStack[0].view=void 0,this._renderables.views.splice(0,1),this._viewStack.splice(0,1),c--;for(d=c;d<Math.min(this._viewStack.length-c,2)+c;d++){var f=this._viewStack[d];if(f.state===E.QUEUED){a&&a.state!==E.VISIBLE&&a.state!==E.HIDING||(a&&a.state===E.VISIBLE&&(a.state=E.HIDE,a.wait=f.wait),f.state=E.SHOW,b=!0);break}f.state===E.VISIBLE&&f.hide&&(f.state=E.HIDE),(f.state===E.SHOW||f.state===E.HIDE)&&this.layout.reflowLayout(),a=f}b&&(u.call(this),this.layout.reflowLayout())}function v(){for(var a=0;a<Math.min(this._viewStack.length,2);a++){var b=this._viewStack[a];if(b.halted&&(b.halted=!1,b.endSpec)){var c;switch(b.state){case E.HIDE:case E.HIDING:c=b.hideCallback;break;case E.SHOW:case E.SHOWING:c=b.showCallback}b.mod.halt(),b.endSpec.transform&&(b.mod.setTransform(b.endSpec.transform,b.options.show.transition,c),c=void 0),void 0!==b.endSpec.opacity&&b.mod.setOpacity(b.endSpec.opacity,b.options.show.transition,c),c&&c()}}}var w=a("famous/core/View"),x=a("./LayoutController"),y=a("famous/core/Transform"),z=a("famous/core/Modifier"),A=a("famous/modifiers/StateModifier"),B=a("famous/core/RenderNode"),C=a("famous/utilities/Timer"),D=a("famous/transitions/Easing");d.prototype=Object.create(w.prototype),d.prototype.constructor=d,d.Animation={Slide:{Left:function(a,b){return{transform:y.translate(a?b[0]:-b[0],0,0)}},Right:function(a,b){return{transform:y.translate(a?-b[0]:b[0],0,0)}},Up:function(a,b){return{transform:y.translate(0,a?b[1]:-b[1],0)}},Down:function(a,b){return{transform:y.translate(0,a?-b[1]:b[1],0)}}},Fade:function(a,b){return{opacity:this&&void 0!==this.opacity?this.opacity:0}},Zoom:function(a,b){var c=this&&void 0!==this.scale?this.scale:.5;return{transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}},FadedZoom:function(a,b){var c=a?this&&void 0!==this.showScale?this.showScale:.9:this&&void 0!==this.hideScale?this.hideScale:1.1;return{opacity:this&&void 0!==this.opacity?this.opacity:0,transform:y.scale(c,c,1),align:[.5,.5],origin:[.5,.5]}}},d.DEFAULT_OPTIONS={transition:{duration:400,curve:D.inOutQuad},animation:d.Animation.Fade,show:{},hide:{},transfer:{fastResize:!0,zIndex:10},zIndexOffset:0,keepHiddenViewsInDOMCount:0};var E={NONE:0,HIDE:1,HIDING:2,HIDDEN:3,SHOW:4,SHOWING:5,VISIBLE:6,QUEUED:7};d.prototype.show=function(a,b,c){if(v.call(this,a),!a)return this.hide(b,c);var d=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return d&&d.view===a&&d.state!==E.HIDDEN?(d.hide=!1,d.state===E.HIDE?(d.state=E.QUEUED,t.call(this,d,b,c),u.call(this)):c&&c(),this):(d&&d.state!==E.HIDING&&b&&(d.options.hide.transition=(b.hide?b.hide.transition:void 0)||b.transition||d.options.hide.transition,b&&b.hide&&void 0!==b.hide.animation?d.options.hide.animation=b.hide.animation:b&&void 0!==b.animation&&(d.options.hide.animation=b.animation)),d={view:a,mod:new A,state:E.QUEUED,callback:c,transferables:[],wait:b?b.wait:void 0},d.node=new B(d.mod),d.node.add(a),t.call(this,d,b,c),d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),this._renderables.views.push(d.node),this._viewStack.push(d),u.call(this),this)},d.prototype.hide=function(a,b){v.call(this);var c=this._viewStack.length?this._viewStack[this._viewStack.length-1]:void 0;return c&&c.state!==E.HIDING?(c.hide=!0,a&&(c.options.hide.transition=(a.hide?a.hide.transition:void 0)||a.transition||c.options.hide.transition,a&&a.hide&&void 0!==a.hide.animation?c.options.hide.animation=a.hide.animation:a&&void 0!==a.animation&&(c.options.hide.animation=a.animation)),c.hideCallback=function(){c.hideCallback=void 0,c.state=E.HIDDEN,u.call(this),this.layout.reflowLayout(),b&&b()}.bind(this),u.call(this),this):this},d.prototype.halt=function(a,b){for(var c,d=0;d<this._viewStack.length;d++)if(a)switch(c=this._viewStack[d],c.state){case E.SHOW:case E.SHOWING:case E.HIDE:case E.HIDING:case E.VISIBLE:q(c,b)}else{if(c=this._viewStack[this._viewStack.length-1],c.state!==E.QUEUED&&c.state!==E.SHOW)break;this._renderables.views.splice(this._viewStack.length-1,1),this._viewStack.splice(this._viewStack.length-1,1),c.view=void 0}return this},d.prototype.abort=function(a){if(this._viewStack.length>=2&&this._viewStack[0].state===E.HIDING&&this._viewStack[1].state===E.SHOWING){var b,c=this._viewStack[0],d=this._viewStack[1];d.halted=!0,b=d.endSpec,d.endSpec=d.startSpec,d.startSpec=b,d.state=E.HIDING,d.hideCallback=function(){d.hideCallback=void 0,d.state=E.HIDDEN,u.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=E.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=E.VISIBLE,u.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),v.call(this)}return this},d.prototype.get=function(){for(var a=0;a<this._viewStack.length;a++){var b=this._viewStack[a];if(b.state===E.VISIBLE||b.state===E.SHOW||b.state===E.SHOWING)return b.view}return void 0},d.prototype.getSize=function(){return this._size||this.options.size},c.exports=d}),define("famous-flex/layouts/WheelLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){for(e=a.size,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,j=b.diameter||3*i,n=j/2,o=2*Math.atan2(i/2,n),p=void 0===b.radialOpacity?1:b.radialOpacity,s.opacity=1,s.size[0]=e[0],s.size[1]=e[1],s.size[g]=e[g],s.size[f]=i,s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.rotate[0]=0,s.rotate[1]=0,s.rotate[2]=0,s.scrollLength=i,k=a.scrollOffset,l=Math.PI/2/o*i+i;l>=k&&(h=a.next());)k>=-l&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k+=i;for(k=a.scrollOffset-i;k>=-l&&(h=a.prev());)l>=k&&(m=k/i*o,s.translate[f]=n*Math.sin(m),s.translate[2]=n*Math.cos(m)-n,s.rotate[g]=f?-m:m,s.opacity=1-Math.abs(m)/(Math.PI/2)*(1-p),a.set(h,s)),k-=i}var e,f,g,h,i,j,k,l,m,n,o,p,q=a("famous/utilities/Utility"),r={sequence:!0,direction:[q.Direction.Y,q.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},s={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=r,d.Name="WheelLayout",d.Description="Spinner-wheel/slot-machine layout",c.exports=d}),define("famous-flex/layouts/ProportionalLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){for(f=a.size,e=a.direction,g=b.ratios,h=0,j=0;j<g.length;j++)h+=g[j];for(n.size[0]=f[0],
+n.size[1]=f[1],n.translate[0]=0,n.translate[1]=0,k=a.next(),i=0,j=0;k&&j<g.length;)n.size[e]=(f[e]-i)/h*g[j],n.translate[e]=i,a.set(k,n),i+=n.size[e],h-=g[j],j++,k=a.next()}var e,f,g,h,i,j,k,l=a("famous/utilities/Utility"),m={sequence:!0,direction:[l.Direction.Y,l.Direction.X],scrolling:!1},n={size:[0,0],translate:[0,0,0]};d.Capabilities=m,c.exports=d}),define("famous-flex/widgets/DatePickerComponents",["require","exports","module","famous/core/Surface","famous/core/EventHandler"],function(a,b,c){function d(a){return""+a[this.get]()}function e(a){return("0"+a[this.get]()).slice(-2)}function f(a){return("00"+a[this.get]()).slice(-3)}function g(a){return("000"+a[this.get]()).slice(-4)}function h(a){if(this._eventOutput=new s,this._pool=[],s.setOutputHandler(this,this._eventOutput),a)for(var b in a)this[b]=a[b]}function i(){h.apply(this,arguments)}function j(){h.apply(this,arguments)}function k(){h.apply(this,arguments)}function l(){h.apply(this,arguments)}function m(){h.apply(this,arguments)}function n(){h.apply(this,arguments)}function o(){h.apply(this,arguments)}function p(){h.apply(this,arguments)}function q(){h.apply(this,arguments)}var r=a("famous/core/Surface"),s=a("famous/core/EventHandler");h.prototype.step=1,h.prototype.classes=["item"],h.prototype.getComponent=function(a){return a[this.get]()},h.prototype.setComponent=function(a,b){return a[this.set](b)},h.prototype.format=function(a){return"overide to implement"},h.prototype.createNext=function(a){var b=this.getNext(a.date);return b?this.create(b):void 0},h.prototype.getNext=function(a){a=new Date(a.getTime());var b=this.getComponent(a)+this.step;if(void 0!==this.upperBound&&b>=this.upperBound){if(!this.loop)return void 0;b=Math.max(b%this.upperBound,this.lowerBound||0)}return this.setComponent(a,b),a},h.prototype.createPrevious=function(a){var b=this.getPrevious(a.date);return b?this.create(b):void 0},h.prototype.getPrevious=function(a){a=new Date(a.getTime());var b=this.getComponent(a)-this.step;if(void 0!==this.lowerBound&&b<this.lowerBound){if(!this.loop)return void 0;b%=this.upperBound}return this.setComponent(a,b),a},h.prototype.installClickHandler=function(a){a.on("click",function(b){this._eventOutput.emit("click",{target:a,event:b})}.bind(this))},h.prototype.createRenderable=function(a,b){return new r({classes:a,content:"<div>"+b+"</div>"})},h.prototype.create=function(a){a=a||new Date;var b;return this._pool.length?(b=this._pool[0],this._pool.splice(0,1),b.setContent(this.format(a))):(b=this.createRenderable(this.classes,this.format(a)),this.installClickHandler(b)),b.date=a,b},h.prototype.destroy=function(a){this._pool.push(a)},i.prototype=Object.create(h.prototype),i.prototype.constructor=i,i.prototype.classes=["item","year"],i.prototype.format=g,i.prototype.sizeRatio=1,i.prototype.step=1,i.prototype.loop=!1,i.prototype.set="setFullYear",i.prototype.get="getFullYear",j.prototype=Object.create(h.prototype),j.prototype.constructor=j,j.prototype.classes=["item","month"],j.prototype.sizeRatio=2,j.prototype.lowerBound=0,j.prototype.upperBound=12,j.prototype.step=1,j.prototype.loop=!0,j.prototype.set="setMonth",j.prototype.get="getMonth",j.prototype.strings=["January","February","March","April","May","June","July","August","September","October","November","December"],j.prototype.format=function(a){return this.strings[a.getMonth()]},k.prototype=Object.create(h.prototype),k.prototype.constructor=k,k.prototype.classes=["item","fullday"],k.prototype.sizeRatio=2,k.prototype.step=1,k.prototype.set="setDate",k.prototype.get="getDate",k.prototype.format=function(a){return a.toLocaleDateString()},l.prototype=Object.create(h.prototype),l.prototype.constructor=l,l.prototype.classes=["item","weekday"],l.prototype.sizeRatio=2,l.prototype.lowerBound=0,l.prototype.upperBound=7,l.prototype.step=1,l.prototype.loop=!0,l.prototype.set="setDate",l.prototype.get="getDate",l.prototype.strings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],l.prototype.format=function(a){return this.strings[a.getDay()]},m.prototype=Object.create(h.prototype),m.prototype.constructor=m,m.prototype.classes=["item","day"],m.prototype.format=d,m.prototype.sizeRatio=1,m.prototype.lowerBound=1,m.prototype.upperBound=32,m.prototype.step=1,m.prototype.loop=!0,m.prototype.set="setDate",m.prototype.get="getDate",n.prototype=Object.create(h.prototype),n.prototype.constructor=n,n.prototype.classes=["item","hour"],n.prototype.format=e,n.prototype.sizeRatio=1,n.prototype.lowerBound=0,n.prototype.upperBound=24,n.prototype.step=1,n.prototype.loop=!0,n.prototype.set="setHours",n.prototype.get="getHours",o.prototype=Object.create(h.prototype),o.prototype.constructor=o,o.prototype.classes=["item","minute"],o.prototype.format=e,o.prototype.sizeRatio=1,o.prototype.lowerBound=0,o.prototype.upperBound=60,o.prototype.step=1,o.prototype.loop=!0,o.prototype.set="setMinutes",o.prototype.get="getMinutes",p.prototype=Object.create(h.prototype),p.prototype.constructor=p,p.prototype.classes=["item","second"],p.prototype.format=e,p.prototype.sizeRatio=1,p.prototype.lowerBound=0,p.prototype.upperBound=60,p.prototype.step=1,p.prototype.loop=!0,p.prototype.set="setSeconds",p.prototype.get="getSeconds",q.prototype=Object.create(h.prototype),q.prototype.constructor=q,q.prototype.classes=["item","millisecond"],q.prototype.format=f,q.prototype.sizeRatio=1,q.prototype.lowerBound=0,q.prototype.upperBound=1e3,q.prototype.step=1,q.prototype.loop=!0,q.prototype.set="setMilliseconds",q.prototype.get="getMilliseconds",c.exports={Base:h,Year:i,Month:j,FullDay:k,WeekDay:l,Day:m,Hour:n,Minute:o,Second:p,Millisecond:q}}),define("famous-flex/widgets/DatePicker",["require","exports","module","famous/core/View","famous/core/Surface","famous/utilities/Utility","famous/surfaces/ContainerSurface","../LayoutController","../ScrollController","../layouts/WheelLayout","../layouts/ProportionalLayout","../VirtualViewSequence","./DatePickerComponents","../LayoutUtility"],function(a,b,c){function d(a){p.apply(this,arguments),a=a||{},this._date=new Date(a.date?a.date.getTime():void 0),this._components=[],this.classes=a.classes?this.classes.concat(a.classes):this.classes,h.call(this),m.call(this),this._overlayRenderables={top:e.call(this,"top"),middle:e.call(this,"middle"),bottom:e.call(this,"bottom")},o.call(this),this.setOptions(this.options)}function e(a,b){var c=this.options.createRenderables[Array.isArray(a)?a[0]:a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new q({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});if(Array.isArray(a))for(var e=0;e<a.length;e++)d.addClass(a[e]);else d.addClass(a);return d}function f(a){for(var b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();if(e&&e.viewSequence){var f=e.viewSequence,g=e.viewSequence.get(),h=d.getComponent(g.date),i=d.getComponent(a),j=0;if(h!==i&&(j=i-h,d.loop)){var k=0>j?j+d.upperBound:j-d.upperBound;Math.abs(k)<Math.abs(j)&&(j=k)}if(j)for(;h!==i&&(f=j>0?f.getNext():f.getPrevious(),g=f?f.get():void 0);)h=d.getComponent(g.date),j>0?c.scrollController.goToNextPage():c.scrollController.goToPreviousPage();else c.scrollController.goToRenderNode(g)}}}function g(){for(var a=new Date(this._date),b=0;b<this.scrollWheels.length;b++){var c=this.scrollWheels[b],d=c.component,e=c.scrollController.getFirstVisibleItem();e&&e.renderNode&&d.setComponent(a,d.getComponent(e.renderNode.date))}return a}function h(){this.container=new s(this.options.container),this.container.setClasses(this.classes),this.layout=new t({layout:w,layoutOptions:{ratios:[]},direction:r.Direction.X}),this.container.add(this.layout),this.add(this.container)}function i(a,b){}function j(){this._scrollingCount++,1===this._scrollingCount&&this._eventOutput.emit("scrollstart",{target:this})}function k(){this._scrollingCount--,0===this._scrollingCount&&this._eventOutput.emit("scrollend",{target:this,date:this._date})}function l(){this._date=g.call(this),this._eventOutput.emit("datechange",{target:this,date:this._date})}function m(){this.scrollWheels=[],this._scrollingCount=0;for(var a=[],b=[],c=0;c<this._components.length;c++){var d=this._components[c];d.createRenderable=e.bind(this);var f=new x({factory:d,value:d.create(this._date)}),g=z.combineOptions(this.options.scrollController,{layout:v,layoutOptions:this.options.wheelLayout,flow:!1,direction:r.Direction.Y,dataSource:f,autoPipeEvents:!0}),h=new u(g);h.on("scrollstart",j.bind(this)),h.on("scrollend",k.bind(this)),h.on("pagechange",l.bind(this));var m={component:d,scrollController:h,viewSequence:f};this.scrollWheels.push(m),d.on("click",i.bind(this,m)),a.push(h),b.push(d.sizeRatio)}this.layout.setDataSource(a),this.layout.setLayoutOptions({ratios:b})}function n(a,b){var c=(a.size[1]-b.itemSize)/2;a.set("top",{size:[a.size[0],c],translate:[0,0,1]}),a.set("middle",{size:[a.size[0],a.size[1]-2*c],translate:[0,c,1]}),a.set("bottom",{size:[a.size[0],c],translate:[0,a.size[1]-c,1]})}function o(){this.overlay=new t({layout:n,layoutOptions:{itemSize:this.options.wheelLayout.itemSize},dataSource:this._overlayRenderables}),this.add(this.overlay)}var p=a("famous/core/View"),q=a("famous/core/Surface"),r=a("famous/utilities/Utility"),s=a("famous/surfaces/ContainerSurface"),t=a("../LayoutController"),u=a("../ScrollController"),v=a("../layouts/WheelLayout"),w=a("../layouts/ProportionalLayout"),x=a("../VirtualViewSequence"),y=a("./DatePickerComponents"),z=a("../LayoutUtility");d.prototype=Object.create(p.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-datepicker"],d.Component=y,d.DEFAULT_OPTIONS={perspective:500,wheelLayout:{itemSize:100,diameter:500},createRenderables:{item:!0,top:!1,middle:!1,bottom:!1},scrollController:{enabled:!0,paginated:!0,paginationMode:u.PaginationMode.SCROLL,mouseMove:!0,scrollSpring:{dampingRatio:1,period:800}}},d.prototype.setOptions=function(a){if(p.prototype.setOptions.call(this,a),!this.layout)return this;void 0!==a.perspective&&this.container.context.setPerspective(a.perspective);var b;if(void 0!==a.wheelLayout){for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setLayoutOptions(a.wheelLayout);this.overlay.setLayoutOptions({itemSize:this.options.wheelLayout.itemSize})}if(void 0!==a.scrollController)for(b=0;b<this.scrollWheels.length;b++)this.scrollWheels[b].scrollController.setOptions(a.scrollController);return this},d.prototype.setComponents=function(a){return this._components=a,m.call(this),this},d.prototype.getComponents=function(){return this._components},d.prototype.setDate=function(a){return this._date.setTime(a.getTime()),f.call(this,this._date),this},d.prototype.getDate=function(){return this._date},c.exports=d}),define("famous-flex/layouts/TabBarLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){e=a.size,f=a.direction,g=f?0:1,k=b.spacing||0,h=a.get("items"),i=a.get("spacers"),j=q.normalizeMargins(b.margins),o=b.zIncrement||2,s.size[0]=a.size[0],s.size[1]=a.size[1],s.size[g]-=j[1-g]+j[3-g],s.translate[0]=0,s.translate[1]=0,s.translate[2]=o,s.translate[g]=j[f?3:0],s.align[0]=0,s.align[1]=0,s.origin[0]=0,s.origin[1]=0,n=f?j[0]:j[3],l=e[f]-(n+(f?j[2]:j[1])),l-=(h.length-1)*k;for(var c=0;c<h.length;c++)m=void 0===b.itemSize?Math.round(l/(h.length-c)):b.itemSize===!0?a.resolveSize(h[c],e)[f]:b.itemSize,s.scrollLength=m,0===c&&(s.scrollLength+=f?j[0]:j[3]),c===h.length-1?s.scrollLength+=f?j[2]:j[1]:s.scrollLength+=k,s.size[f]=m,s.translate[f]=n,a.set(h[c],s),n+=m,l-=m,c===b.selectedItemIndex&&(s.scrollLength=0,s.translate[f]+=m/2,s.translate[2]=2*o,s.origin[f]=.5,a.set("selectedItemOverlay",s),s.origin[f]=0,s.translate[2]=o),c<h.length-1?(i&&c<i.length&&(s.size[f]=k,s.translate[f]=n,a.set(i[c],s)),n+=k):n+=f?j[2]:j[1];s.scrollLength=0,s.size[0]=e[0],s.size[1]=e[1],s.size[f]=e[f],s.translate[0]=0,s.translate[1]=0,s.translate[2]=0,s.translate[f]=0,a.set("background",s)}var e,f,g,h,i,j,k,l,m,n,o,p=a("famous/utilities/Utility"),q=a("../LayoutUtility"),r={sequence:!0,direction:[p.Direction.X,p.Direction.Y],trueSize:!0},s={size:[0,0],translate:[0,0,0],align:[0,0],origin:[0,0]};d.Capabilities=r,d.Name="TabBarLayout",d.Description="TabBar widget layout",c.exports=d}),define("famous-flex/widgets/TabBar",["require","exports","module","famous/core/Surface","famous/core/View","../LayoutController","../layouts/TabBarLayout"],function(a,b,c){function d(a){h.apply(this,arguments),this._selectedItemIndex=-1,a=a||{},this.classes=a.classes?this.classes.concat(a.classes):this.classes,this.layout=new i(this.options.layoutController),this.add(this.layout),this.layout.pipe(this._eventOutput),this._renderables={items:[],spacers:[],background:f.call(this,"background"),selectedItemOverlay:f.call(this,"selectedItemOverlay")},this.setOptions(this.options)}function e(a){if(a!==this._selectedItemIndex){var b=this._selectedItemIndex;this._selectedItemIndex=a,this.layout.setLayoutOptions({selectedItemIndex:a}),b>=0&&this._renderables.items[b].removeClass&&this._renderables.items[b].removeClass("selected"),this._renderables.items[a].addClass&&this._renderables.items[a].addClass("selected"),b>=0&&this._eventOutput.emit("tabchange",{target:this,index:a,oldIndex:b,item:this._renderables.items[a],oldItem:b>=0&&b<this._renderables.items.length?this._renderables.items[b]:void 0})}}function f(a,b){var c=this.options.createRenderables[a];if(c instanceof Function)return c.call(this,a,b);if(!c)return void 0;if(void 0!==b&&b instanceof Object)return b;var d=new g({classes:this.classes,content:b?"<div>"+b+"</div>":void 0});return d.addClass(a),"item"===a&&this.options.tabBarLayout&&this.options.tabBarLayout.itemSize&&this.options.tabBarLayout.itemSize===!0&&d.setSize(this.layout.getDirection()?[void 0,!0]:[!0,void 0]),d}var g=a("famous/core/Surface"),h=a("famous/core/View"),i=a("../LayoutController"),j=a("../layouts/TabBarLayout");d.prototype=Object.create(h.prototype),d.prototype.constructor=d,d.prototype.classes=["ff-widget","ff-tabbar"],d.DEFAULT_OPTIONS={tabBarLayout:{margins:[0,0,0,0],spacing:0},createRenderables:{item:!0,background:!1,selectedItemOverlay:!1,spacer:!1},layoutController:{autoPipeEvents:!0,layout:j,flow:!0,flowOptions:{reflowOnResize:!1,spring:{dampingRatio:.8,period:300}}}},d.prototype.setOptions=function(a){return h.prototype.setOptions.call(this,a),this.layout?(void 0!==a.tabBarLayout&&this.layout.setLayoutOptions(a.tabBarLayout),a.layoutController&&this.layout.setOptions(a.layoutController),this):this},d.prototype.setItems=function(a){var b=this._selectedItemIndex;if(this._selectedItemIndex=-1,this._renderables.items=[],this._renderables.spacers=[],a)for(var c=0;c<a.length;c++){var d=f.call(this,"item",a[c]);if(d.on&&d.on("click",e.bind(this,c)),this._renderables.items.push(d),c<a.length-1){var g=f.call(this,"spacer"," ");g&&this._renderables.spacers.push(g)}}return this.layout.setDataSource(this._renderables),this._renderables.items.length&&e.call(this,Math.max(Math.min(b,this._renderables.items.length-1),0)),this},d.prototype.getItems=function(){return this._renderables.items},d.prototype.getItemSpec=function(a,b){return this.layout.getSpec(this._renderables.items[a],b)},d.prototype.setSelectedItemIndex=function(a){return e.call(this,a),this},d.prototype.getSelectedItemIndex=function(){return this._selectedItemIndex},d.prototype.getSize=function(){return this.options.size||(this.layout?this.layout.getSize():h.prototype.getSize.call(this))},c.exports=d}),define("famous-flex/widgets/TabBarController",["require","exports","module","famous/core/View","../AnimationController","./TabBar","../helpers/LayoutDockHelper","../LayoutController","famous/transitions/Easing"],function(a,b,c){function d(a){i.apply(this,arguments),e.call(this),f.call(this),g.call(this),this.tabBar.setOptions({layoutController:{direction:this.options.tabBarPosition===d.Position.TOP||this.options.tabBarPosition===d.Position.BOTTOM?0:1}})}function e(){this.tabBar=new k(this.options.tabBar),this.animationController=new j(this.options.animationController),this._renderables={tabBar:this.tabBar,content:this.animationController}}function f(){this.layout=new m(this.options.layoutController),this.layout.setLayout(d.DEFAULT_LAYOUT.bind(this)),this.layout.setDataSource(this._renderables),this.add(this.layout)}function g(){this.tabBar.on("tabchange",function(a){h.call(this,a),this._eventOutput.emit("tabchange",{target:this,index:a.index,oldIndex:a.oldIndex,item:this._items[a.index],oldItem:a.oldIndex>=0&&a.oldIndex<this._items.length?this._items[a.oldIndex]:void 0})}.bind(this))}function h(a){var b=this.tabBar.getSelectedItemIndex();this.animationController.halt(),b>=0?this.animationController.show(this._items[b].view):this.animationController.hide()}var i=a("famous/core/View"),j=a("../AnimationController"),k=a("./TabBar"),l=a("../helpers/LayoutDockHelper"),m=a("../LayoutController"),n=a("famous/transitions/Easing");d.prototype=Object.create(i.prototype),d.prototype.constructor=d,d.Position={TOP:0,BOTTOM:1,LEFT:2,RIGHT:3},d.DEFAULT_LAYOUT=function(a,b){var c=new l(a,b);switch(this.options.tabBarPosition){case d.Position.TOP:c.top("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.BOTTOM:c.bottom("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.LEFT:c.left("tabBar",this.options.tabBarSize,this.options.tabBarZIndex);break;case d.Position.RIGHT:c.right("tabBar",this.options.tabBarSize,this.options.tabBarZIndex)}c.fill("content")},d.DEFAULT_OPTIONS={tabBarPosition:d.Position.BOTTOM,tabBarSize:50,tabBarZIndex:10,tabBar:{createRenderables:{background:!0}},animationController:{transition:{duration:300,curve:n.inOutQuad},animation:j.Animation.FadedZoom}},d.prototype.setOptions=function(a){return i.prototype.setOptions.call(this,a),this.layout&&a.layoutController&&this.layout.setOptions(a.layoutController),this.tabBar&&a.tabBar&&this.tabBar.setOptions(a.tabBar),this.animationController&&a.animationController&&this.animationController(a.animationController),this.layout&&void 0!==a.tabBarPosition&&this.tabBar.setOptions({layoutController:{direction:a.tabBarPosition===d.Position.TOP||a.tabBarPosition===d.Position.BOTTOM?0:1}}),this.layout&&this.layout.reflowLayout(),this},d.prototype.setItems=function(a){this._items=a;for(var b=[],c=0;c<a.length;c++)b.push(a[c].tabItem);return this.tabBar.setItems(b),h.call(this),this},d.prototype.getItems=function(){return this._items},d.prototype.setSelectedItemIndex=function(a){return this.tabBar.setSelectedItemIndex(a),this},d.prototype.getSelectedItemIndex=function(){return this.tabBar.getSelectedItemIndex()},c.exports=d}),define("famous-flex/layouts/CollectionLayout",["require","exports","module","famous/utilities/Utility","../LayoutUtility"],function(a,b,c){function d(a,b){if(!s.length)return 0;var c,d,e=[0,0];for(c=0;c<s.length;c++)e[i]=Math.max(e[i],s[c].size[i]),e[k]+=(c>0?o[k]:0)+s[c].size[k];var f,h=p[k]?(l-e[k])/(2*s.length):0,q=(i?n[3]:n[0])+h;for(c=0;c<s.length;c++){d=s[c];var r=[0,0,0];r[k]=q,r[i]=a?m:m-e[i],f=0,0===c&&(f=e[i],f+=b&&(a&&!j||!a&&j)?i?n[0]+n[2]:n[3]+n[1]:o[i]),d.set={size:d.size,translate:r,scrollLength:f},q+=d.size[k]+o[k]+2*h}for(c=0;c<s.length;c++)d=a?s[c]:s[s.length-1-c],g.set(d.node,d.set);return s=[],e[i]+o[i]}function e(a){var b=q;if(r&&(b=r(a.renderNode,h)),b[0]===!0||b[1]===!0){var c=g.resolveSize(a,h);return b[0]!==!0&&(c[0]=q[0]),b[1]!==!0&&(c[1]=q[1]),c}return b}function f(a,b){if(g=a,h=g.size,i=g.direction,j=g.alignment,k=(i+1)%2,void 0!==b.gutter&&console.warn&&!b.suppressWarnings&&console.warn("option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead"),!b.gutter||b.margins||b.spacing)n=u.normalizeMargins(b.margins),o=b.spacing||0,o=Array.isArray(o)?o:[o,o];else{var c=Array.isArray(b.gutter)?b.gutter:[b.gutter,b.gutter];n=[c[1],c[0],c[1],c[0]],o=c}w[0]=n[i?0:3],w[1]=-n[i?2:1],p=Array.isArray(b.justify)?b.justify:b.justify?[!0,!0]:[!1,!1],l=h[k]-(i?n[3]+n[1]:n[0]+n[2]);var f,t,v,x;for(b.cells?(b.itemSize&&console.warn&&!b.suppressWarnings&&console.warn("options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two"),q=[[void 0,!0].indexOf(b.cells[0])>-1?b.cells[0]:(h[0]-(n[1]+n[3]+o[0]*(b.cells[0]-1)))/b.cells[0],[void 0,!0].indexOf(b.cells[1])>-1?b.cells[1]:(h[1]-(n[0]+n[2]+o[1]*(b.cells[1]-1)))/b.cells[1]]):b.itemSize?b.itemSize instanceof Function?r=b.itemSize:q=void 0===b.itemSize[0]||void 0===b.itemSize[0]?[void 0===b.itemSize[0]?h[0]:b.itemSize[0],void 0===b.itemSize[1]?h[1]:b.itemSize[1]]:b.itemSize:q=[!0,!0],m=g.scrollOffset+w[j]+(j?o[i]:0),x=g.scrollEnd+(j?0:w[j]),v=0,s=[];x>m;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+w[j]-(j?0:o[i]),x=g.scrollStart+(j?w[j]:0),v=0,s=[];m>x;){if(f=g.prev(),!f){d(!1,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],Math.round(100*v)/100>l&&(m-=d(!1,!f),v=t[k]),s.unshift({node:f,size:t})}}var g,h,i,j,k,l,m,n,o,p,q,r,s,t=a("famous/utilities/Utility"),u=a("../LayoutUtility"),v={sequence:!0,direction:[t.Direction.Y,t.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!0},w=[0,0];f.Capabilities=v,f.Name="CollectionLayout",f.Description="Multi-cell collection-layout with margins & spacing",c.exports=f}),define("famous-flex/layouts/CoverLayout",["require","exports","module","famous/utilities/Utility"],function(a,b,c){function d(a,b){for(e=a.size,o=b.zOffset,m=b.itemAngle,f=a.direction,g=f?0:1,i=b.itemSize||e[f]/2,n=void 0===b.radialOpacity?1:b.radialOpacity,r.opacity=1,r.size[0]=e[0],r.size[1]=e[1],r.size[g]=i,r.size[f]=i,r.translate[0]=0,r.translate[1]=0,r.translate[2]=0,r.rotate[0]=0,r.rotate[1]=0,r.rotate[2]=0,r.scrollLength=i,j=a.scrollOffset,k=Math.PI/2/m*i+i;k>=j&&(h=a.next());)j>=-k&&(r.translate[f]=j,r.translate[2]=Math.abs(j)>i?-o:-(Math.abs(j)*(o/i)),r.rotate[g]=Math.abs(j)>i?m:Math.abs(j)*(m/i),(j>0&&!f||0>j&&f)&&(r.rotate[g]=0-r.rotate[g]),r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-n),a.set(h,r)),j+=i;for(j=a.scrollOffset-i;j>=-k&&(h=a.prev());)k>=j&&(r.translate[f]=j,r.translate[2]=Math.abs(j)>i?-o:-(Math.abs(j)*(o/i)),r.rotate[g]=Math.abs(j)>i?m:Math.abs(j)*(m/i),(j>0&&!f||0>j&&f)&&(r.rotate[g]=0-r.rotate[g]),r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-n),a.set(h,r)),j-=i}var e,f,g,h,i,j,k,l,m,n,o,p=a("famous/utilities/Utility"),q={sequence:!0,direction:[p.Direction.Y,p.Direction.X],scrolling:!0,trueSize:!0,sequentialScrollingOptimized:!1},r={opacity:1,size:[0,0],translate:[0,0,0],rotate:[0,0,0],origin:[.5,.5],align:[.5,.5],scrollLength:void 0};d.Capabilities=q,d.Name="CoverLayout",d.Description="CoverLayout",c.exports=d}),define("famous-flex/layouts/CubeLayout",["require","exports","module"],function(a,b,c){c.exports=function(a,b){var c=b.itemSize;a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[c[0]/2,0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[0,Math.PI/2,0],translate:[-(c[0]/2),0,0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,-(c[1]/2),0]}),a.set(a.next(),{size:c,origin:[.5,.5],rotate:[Math.PI/2,0,0],translate:[0,c[1]/2,0]})}}),define("famous-flex/layouts/GridLayout",["require","exports","module","./CollectionLayout"],function(a,b,c){console.warn&&console.warn("GridLayout has been deprecated and will be removed in the future, use CollectionLayout instead"),c.exports=a("./CollectionLayout")}),define("famous-flex/layouts/HeaderFooterLayout",["require","exports","module","../helpers/LayoutDockHelper"],function(a,b,c){var d=a("../helpers/LayoutDockHelper");c.exports=function(a,b){var c=new d(a,b);c.top("header",void 0!==b.headerSize?b.headerSize:b.headerHeight),c.bottom("footer",void 0!==b.footerSize?b.footerSize:b.footerHeight),c.fill("content")}}),define("famous-flex/layouts/NavBarLayout",["require","exports","module","../helpers/LayoutDockHelper"],function(a,b,c){var d=a("../helpers/LayoutDockHelper");c.exports=function(a,b){var c=new d(a,{margins:b.margins,translateZ:b.hasOwnProperty("zIncrement")?b.zIncrement:2});a.set("background",{size:a.size});var e=a.get("backIcon");e&&(c.left(e,b.backIconWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var f=a.get("backItem");f&&(c.left(f,b.backItemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer));var g,h,i=a.get("rightItems");if(i)for(h=0;h<i.length;h++)g=a.get(i[h]),c.right(g,b.rightItemWidth||b.itemWidth),c.right(void 0,b.rightItemSpacer||b.itemSpacer);var j=a.get("leftItems");if(j)for(h=0;h<j.length;h++)g=a.get(j[h]),c.left(g,b.leftItemWidth||b.itemWidth),c.left(void 0,b.leftItemSpacer||b.itemSpacer);var k=a.get("title");if(k){var l=a.resolveSize(k,a.size),m=Math.max((a.size[0]-l[0])/2,c.get().left),n=Math.min((a.size[0]+l[0])/2,c.get().right);m=Math.max(m,a.size[0]-n),n=Math.min(n,a.size[0]-m),a.set(k,{size:[n-m,a.size[1]],translate:[m,0,c.get().z]})}}}),define("template.js",["require","famous-flex/FlexScrollView","famous-flex/FlowLayoutNode","famous-flex/LayoutContext","famous-flex/LayoutController","famous-flex/LayoutNode","famous-flex/LayoutNodeManager","famous-flex/LayoutUtility","famous-flex/ScrollController","famous-flex/VirtualViewSequence","famous-flex/AnimationController","famous-flex/widgets/DatePicker","famous-flex/widgets/TabBar","famous-flex/widgets/TabBarController","famous-flex/layouts/CollectionLayout","famous-flex/layouts/CoverLayout","famous-flex/layouts/CubeLayout","famous-flex/layouts/GridLayout","famous-flex/layouts/HeaderFooterLayout","famous-flex/layouts/ListLayout","famous-flex/layouts/NavBarLayout","famous-flex/layouts/ProportionalLayout","famous-flex/layouts/WheelLayout","famous-flex/helpers/LayoutDockHelper"],function(a){a("famous-flex/FlexScrollView"),a("famous-flex/FlowLayoutNode"),a("famous-flex/LayoutContext"),a("famous-flex/LayoutController"),a("famous-flex/LayoutNode"),a("famous-flex/LayoutNodeManager"),a("famous-flex/LayoutUtility"),a("famous-flex/ScrollController"),a("famous-flex/VirtualViewSequence"),a("famous-flex/AnimationController"),a("famous-flex/widgets/DatePicker"),a("famous-flex/widgets/TabBar"),a("famous-flex/widgets/TabBarController"),a("famous-flex/layouts/CollectionLayout"),a("famous-flex/layouts/CoverLayout"),a("famous-flex/layouts/CubeLayout"),a("famous-flex/layouts/GridLayout"),a("famous-flex/layouts/HeaderFooterLayout"),a("famous-flex/layouts/ListLayout"),a("famous-flex/layouts/NavBarLayout"),a("famous-flex/layouts/ProportionalLayout"),a("famous-flex/layouts/WheelLayout"),a("famous-flex/helpers/LayoutDockHelper")});
\ No newline at end of file