From 0f9b1e22aeed2f2e6164dbda7fa8097e7f5cd4a9 Mon Sep 17 00:00:00 2001 From: IjzerenHein Date: Tue, 9 Jun 2015 18:45:16 +0200 Subject: [PATCH] Updated dist/* --- dist/famous-flex-global.js | 694 +++++++++++++++++++++------------ dist/famous-flex-global.min.js | 12 +- dist/famous-flex.js | 630 ++++++++++++++++++++++-------- dist/famous-flex.min.js | 12 +- 4 files changed, 929 insertions(+), 419 deletions(-) diff --git a/dist/famous-flex-global.js b/dist/famous-flex-global.js index 4ef3053..c0bf8be 100644 --- a/dist/famous-flex-global.js +++ b/dist/famous-flex-global.js @@ -8,21 +8,24 @@ * @copyright Gloey Apps, 2014/2015 * * @library famous-flex -* @version 0.3.2 -* @generated 07-05-2015 +* @version 0.3.3 +* @generated 09-06-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= 2 && this._viewStack[0].state === ItemState.HIDING && this._viewStack[1].state === ItemState.SHOWING) { + var prevItem = this._viewStack[0]; + var item = this._viewStack[1]; + var swapSpec; + item.halted = true; + swapSpec = item.endSpec; + item.endSpec = item.startSpec; + item.startSpec = swapSpec; + item.state = ItemState.HIDING; + item.hideCallback = function () { + item.hideCallback = undefined; + var index = this._viewStack.indexOf(item); + this._renderables.views.splice(index, 1); + this._viewStack.splice(index, 1); + item.view = undefined; + _updateState.call(this); + this.layout.reflowLayout(); + }.bind(this); + prevItem.halted = true; + swapSpec = prevItem.endSpec; + prevItem.endSpec = prevItem.startSpec; + prevItem.startSpec = swapSpec; + prevItem.state = ItemState.SHOWING; + prevItem.showCallback = function () { + prevItem.showCallback = undefined; + prevItem.state = ItemState.VISIBLE; + _updateState.call(this); + _endTransferableAnimations.call(this, prevItem); + prevItem.endSpec = undefined; + prevItem.startSpec = undefined; + if (callback) { + callback(); + } + }.bind(this); + _resume.call(this); + } + return this; +}; AnimationController.prototype.get = function () { for (var i = 0; i < this._viewStack.length; i++) { var item = this._viewStack[i]; @@ -489,8 +659,10 @@ AnimationController.prototype.get = function () { } return undefined; }; +AnimationController.prototype.getSize = function () { + return this._size || this.options.size; +}; module.exports = AnimationController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./LayoutController":5}],2:[function(require,module,exports){ var LayoutUtility = require('./LayoutUtility'); var ScrollController = require('./ScrollController'); @@ -900,15 +1072,14 @@ FlexScrollView.prototype.commit = function (context) { }; module.exports = FlexScrollView; },{"./LayoutUtility":8,"./ScrollController":9,"./layouts/ListLayout":17}],3:[function(require,module,exports){ -(function (global){ -var OptionsManager = typeof window !== 'undefined' ? window.famous.core.OptionsManager : typeof global !== 'undefined' ? global.famous.core.OptionsManager : null; -var Transform = typeof window !== 'undefined' ? window.famous.core.Transform : typeof global !== 'undefined' ? global.famous.core.Transform : null; -var Vector = typeof window !== 'undefined' ? window.famous.math.Vector : typeof global !== 'undefined' ? global.famous.math.Vector : null; -var Particle = typeof window !== 'undefined' ? window.famous.physics.bodies.Particle : typeof global !== 'undefined' ? global.famous.physics.bodies.Particle : null; -var Spring = typeof window !== 'undefined' ? window.famous.physics.forces.Spring : typeof global !== 'undefined' ? global.famous.physics.forces.Spring : null; -var PhysicsEngine = typeof window !== 'undefined' ? window.famous.physics.PhysicsEngine : typeof global !== 'undefined' ? global.famous.physics.PhysicsEngine : null; +var OptionsManager = window.famous.core.OptionsManager; +var Transform = window.famous.core.Transform; +var Vector = window.famous.math.Vector; +var Particle = window.famous.physics.bodies.Particle; +var Spring = window.famous.physics.forces.Spring; +var PhysicsEngine = window.famous.physics.PhysicsEngine; var LayoutNode = require('./LayoutNode'); -var Transitionable = typeof window !== 'undefined' ? window.famous.transitions.Transitionable : typeof global !== 'undefined' ? global.famous.transitions.Transitionable : null; +var Transitionable = window.famous.transitions.Transitionable; function FlowLayoutNode(renderNode, spec) { LayoutNode.apply(this, arguments); if (!this.options) { @@ -1342,7 +1513,6 @@ FlowLayoutNode.prototype.set = function (set, defaultSize) { } }; module.exports = FlowLayoutNode; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./LayoutNode":6}],4:[function(require,module,exports){ function LayoutContext(methods) { for (var n in methods) { @@ -1366,17 +1536,16 @@ LayoutContext.prototype.resolveSize = function (node) { }; module.exports = LayoutContext; },{}],5:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; -var Entity = typeof window !== 'undefined' ? window.famous.core.Entity : typeof global !== 'undefined' ? global.famous.core.Entity : null; -var ViewSequence = typeof window !== 'undefined' ? window.famous.core.ViewSequence : typeof global !== 'undefined' ? global.famous.core.ViewSequence : null; -var OptionsManager = typeof window !== 'undefined' ? window.famous.core.OptionsManager : typeof global !== 'undefined' ? global.famous.core.OptionsManager : null; -var EventHandler = typeof window !== 'undefined' ? window.famous.core.EventHandler : typeof global !== 'undefined' ? global.famous.core.EventHandler : null; +var Utility = window.famous.utilities.Utility; +var Entity = window.famous.core.Entity; +var ViewSequence = window.famous.core.ViewSequence; +var OptionsManager = window.famous.core.OptionsManager; +var EventHandler = window.famous.core.EventHandler; var LayoutUtility = require('./LayoutUtility'); var LayoutNodeManager = require('./LayoutNodeManager'); var LayoutNode = require('./LayoutNode'); var FlowLayoutNode = require('./FlowLayoutNode'); -var Transform = typeof window !== 'undefined' ? window.famous.core.Transform : typeof global !== 'undefined' ? global.famous.core.Transform : null; +var Transform = window.famous.core.Transform; require('./helpers/LayoutDockHelper'); function LayoutController(options, nodeManager) { this.id = Entity.register(this); @@ -1761,7 +1930,7 @@ function _getDataSourceArray() { } LayoutController.prototype.get = function (indexOrId) { if (this._nodesById || indexOrId instanceof String || typeof indexOrId === 'string') { - return this._nodesById[indexOrId]; + return this._nodesById ? this._nodesById[indexOrId] : undefined; } var viewSequence = _getViewSequenceAtIndex.call(this, indexOrId); return viewSequence ? viewSequence.get() : undefined; @@ -2018,10 +2187,8 @@ LayoutController.prototype.cleanup = function (context) { } }; module.exports = LayoutController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./helpers/LayoutDockHelper":11}],6:[function(require,module,exports){ -(function (global){ -var Transform = typeof window !== 'undefined' ? window.famous.core.Transform : typeof global !== 'undefined' ? global.famous.core.Transform : null; +var Transform = window.famous.core.Transform; var LayoutUtility = require('./LayoutUtility'); function LayoutNode(renderNode, spec) { this.renderNode = renderNode; @@ -2178,10 +2345,11 @@ LayoutNode.prototype.remove = function (removeSpec) { this._removing = true; }; module.exports = LayoutNode; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./LayoutUtility":8}],7:[function(require,module,exports){ var LayoutContext = require('./LayoutContext'); var LayoutUtility = require('./LayoutUtility'); +var Surface = window.famous.core.Surface; +var RenderNode = window.famous.core.RenderNode; var MAX_POOL_SIZE = 100; function LayoutNodeManager(LayoutNode, initLayoutNodeFn) { this.LayoutNode = LayoutNode; @@ -2287,6 +2455,8 @@ LayoutNodeManager.prototype.buildSpecAndDestroyUnrenderedNodes = function (trans } result.modified = true; } + spec.usesTrueSize = node.usesTrueSize; + spec.trueSizeRequested = node.trueSizeRequested; specs.push(spec); node = node._next; } @@ -2584,6 +2754,32 @@ function _contextSet(contextNodeOrId, set) { } return set; } +function _resolveConfigSize(renderNode) { + if (renderNode instanceof RenderNode) { + var result = null; + var target = renderNode.get(); + if (target) { + result = _resolveConfigSize(target); + if (result) { + return result; + } + } + if (renderNode._child) { + return _resolveConfigSize(renderNode._child); + } + } else if (renderNode instanceof Surface) { + return renderNode.size ? { + renderNode: renderNode, + size: renderNode.size + } : undefined; + } else if (renderNode.options && renderNode.options.size) { + return { + renderNode: renderNode, + size: renderNode.options.size + }; + } + return undefined; +} function _contextResolveSize(contextNodeOrId, parentSize) { var contextNode = this._nodesById ? _contextGet.call(this, contextNodeOrId) : contextNodeOrId; var resolveSize = this._pool.resolveSize; @@ -2597,46 +2793,45 @@ function _contextResolveSize(contextNodeOrId, parentSize) { if (!size) { return parentSize; } - var configSize = renderNode.size && renderNode._trueSizeCheck !== undefined ? renderNode.size : undefined; - if (configSize && (configSize[0] === true || configSize[1] === true)) { + var configSize = _resolveConfigSize(renderNode); + if (configSize && (configSize.size[0] === true || configSize.size[1] === true)) { contextNode.usesTrueSize = true; - var backupSize = renderNode._backupSize; - if (renderNode._contentDirty || renderNode._trueSizeCheck) { - this._trueSizeRequested = true; - contextNode.trueSizeRequested = true; - } - if (renderNode._trueSizeCheck) { - if (backupSize && configSize !== size) { - var newWidth = configSize[0] === true ? Math.max(backupSize[0], size[0]) : size[0]; - var newHeight = configSize[1] === true ? Math.max(backupSize[1], size[1]) : size[1]; - backupSize[0] = newWidth; - backupSize[1] = newHeight; - size = backupSize; - renderNode._backupSize = undefined; - backupSize = undefined; + if (configSize.renderNode instanceof Surface) { + var backupSize = configSize.renderNode._backupSize; + if (configSize.renderNode._contentDirty || configSize.renderNode._trueSizeCheck) { + this._trueSizeRequested = true; + contextNode.trueSizeRequested = true; + } + if (configSize.renderNode._trueSizeCheck) { + if (backupSize && configSize.size !== size) { + var newWidth = configSize.size[0] === true ? Math.max(backupSize[0], size[0]) : size[0]; + var newHeight = configSize.size[1] === true ? Math.max(backupSize[1], size[1]) : size[1]; + backupSize[0] = newWidth; + backupSize[1] = newHeight; + size = backupSize; + configSize.renderNode._backupSize = undefined; + backupSize = undefined; + } + } + if (this._reevalTrueSize || backupSize && (backupSize[0] !== size[0] || backupSize[1] !== size[1])) { + configSize.renderNode._trueSizeCheck = true; + configSize.renderNode._sizeDirty = true; + this._trueSizeRequested = true; + } + if (!backupSize) { + configSize.renderNode._backupSize = [ + 0, + 0 + ]; + backupSize = configSize.renderNode._backupSize; + } + backupSize[0] = size[0]; + backupSize[1] = size[1]; + } else if (configSize.renderNode._nodes) { + if (this._reevalTrueSize || configSize.renderNode._nodes._trueSizeRequested) { + contextNode.trueSizeRequested = true; + this._trueSizeRequested = true; } - } - if (this._reevalTrueSize || backupSize && (backupSize[0] !== size[0] || backupSize[1] !== size[1])) { - renderNode._trueSizeCheck = true; - renderNode._sizeDirty = true; - this._trueSizeRequested = true; - } - if (!backupSize) { - renderNode._backupSize = [ - 0, - 0 - ]; - backupSize = renderNode._backupSize; - } - backupSize[0] = size[0]; - backupSize[1] = size[1]; - } - configSize = renderNode._nodes ? renderNode.options.size : undefined; - if (configSize && (configSize[0] === true || configSize[1] === true)) { - if (this._reevalTrueSize || renderNode._nodes._trueSizeRequested) { - contextNode.usesTrueSize = true; - contextNode.trueSizeRequested = true; - this._trueSizeRequested = true; } } if (size[0] === undefined || size[0] === true || size[1] === undefined || size[1] === true) { @@ -2662,8 +2857,7 @@ function _contextResolveSize(contextNodeOrId, parentSize) { } module.exports = LayoutNodeManager; },{"./LayoutContext":4,"./LayoutUtility":8}],8:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; function LayoutUtility() { } LayoutUtility.registeredHelpers = {}; @@ -2837,25 +3031,23 @@ LayoutUtility.getRegisteredHelper = function (name) { return this.registeredHelpers[name]; }; module.exports = LayoutUtility; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],9:[function(require,module,exports){ -(function (global){ var LayoutUtility = require('./LayoutUtility'); var LayoutController = require('./LayoutController'); var LayoutNode = require('./LayoutNode'); var FlowLayoutNode = require('./FlowLayoutNode'); var LayoutNodeManager = require('./LayoutNodeManager'); -var ContainerSurface = typeof window !== 'undefined' ? window.famous.surfaces.ContainerSurface : typeof global !== 'undefined' ? global.famous.surfaces.ContainerSurface : null; -var Transform = typeof window !== 'undefined' ? window.famous.core.Transform : typeof global !== 'undefined' ? global.famous.core.Transform : null; -var EventHandler = typeof window !== 'undefined' ? window.famous.core.EventHandler : typeof global !== 'undefined' ? global.famous.core.EventHandler : null; -var Group = typeof window !== 'undefined' ? window.famous.core.Group : typeof global !== 'undefined' ? global.famous.core.Group : null; -var Vector = typeof window !== 'undefined' ? window.famous.math.Vector : typeof global !== 'undefined' ? global.famous.math.Vector : null; -var PhysicsEngine = typeof window !== 'undefined' ? window.famous.physics.PhysicsEngine : typeof global !== 'undefined' ? global.famous.physics.PhysicsEngine : null; -var Particle = typeof window !== 'undefined' ? window.famous.physics.bodies.Particle : typeof global !== 'undefined' ? global.famous.physics.bodies.Particle : null; -var Drag = typeof window !== 'undefined' ? window.famous.physics.forces.Drag : typeof global !== 'undefined' ? global.famous.physics.forces.Drag : null; -var Spring = typeof window !== 'undefined' ? window.famous.physics.forces.Spring : typeof global !== 'undefined' ? global.famous.physics.forces.Spring : null; -var ScrollSync = typeof window !== 'undefined' ? window.famous.inputs.ScrollSync : typeof global !== 'undefined' ? global.famous.inputs.ScrollSync : null; -var ViewSequence = typeof window !== 'undefined' ? window.famous.core.ViewSequence : typeof global !== 'undefined' ? global.famous.core.ViewSequence : null; +var ContainerSurface = window.famous.surfaces.ContainerSurface; +var Transform = window.famous.core.Transform; +var EventHandler = window.famous.core.EventHandler; +var Group = window.famous.core.Group; +var Vector = window.famous.math.Vector; +var PhysicsEngine = window.famous.physics.PhysicsEngine; +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 Bounds = { NONE: 0, PREV: 1, @@ -2970,9 +3162,9 @@ ScrollController.DEFAULT_OPTIONS = { overscroll: true, paginated: false, paginationMode: PaginationMode.PAGE, - paginationEnergyThresshold: 0.01, + paginationEnergyThreshold: 0.01, alignment: 0, - touchMoveDirectionThresshold: undefined, + touchMoveDirectionThreshold: undefined, touchMoveNoVelocityDuration: 100, mouseMove: false, enabled: true, @@ -2986,6 +3178,14 @@ ScrollController.DEFAULT_OPTIONS = { }; ScrollController.prototype.setOptions = function (options) { LayoutController.prototype.setOptions.call(this, options); + if (options.hasOwnProperty('paginationEnergyThresshold')) { + console.warn('option `paginationEnergyThresshold` has been deprecated, please rename to `paginationEnergyThreshold`.'); + this.setOptions({ paginationEnergyThreshold: options.paginationEnergyThresshold }); + } + if (options.hasOwnProperty('touchMoveDirectionThresshold')) { + console.warn('option `touchMoveDirectionThresshold` has been deprecated, please rename to `touchMoveDirectionThreshold`.'); + this.setOptions({ touchMoveDirectionThreshold: options.touchMoveDirectionThresshold }); + } if (this._scroll) { if (options.scrollSpring) { this._scroll.springForce.setOptions(options.scrollSpring); @@ -3056,7 +3256,7 @@ function _mouseMove(event) { } var moveDirection = Math.atan2(Math.abs(event.clientY - this._scroll.mouseMove.prev[1]), Math.abs(event.clientX - this._scroll.mouseMove.prev[0])) / (Math.PI / 2); var directionDiff = Math.abs(this._direction - moveDirection); - if (this.options.touchMoveDirectionThresshold === undefined || directionDiff <= this.options.touchMoveDirectionThresshold) { + if (this.options.touchMoveDirectionThreshold === undefined || directionDiff <= this.options.touchMoveDirectionThreshold) { this._scroll.mouseMove.prev = this._scroll.mouseMove.current; this._scroll.mouseMove.current = [ event.clientX, @@ -3153,7 +3353,7 @@ function _touchMove(event) { if (touch.id === changedTouch.identifier) { var moveDirection = Math.atan2(Math.abs(changedTouch.clientY - touch.prev[1]), Math.abs(changedTouch.clientX - touch.prev[0])) / (Math.PI / 2); var directionDiff = Math.abs(this._direction - moveDirection); - if (this.options.touchMoveDirectionThresshold === undefined || directionDiff <= this.options.touchMoveDirectionThresshold) { + if (this.options.touchMoveDirectionThreshold === undefined || directionDiff <= this.options.touchMoveDirectionThreshold) { touch.prev = touch.current; touch.current = [ changedTouch.clientX, @@ -3444,7 +3644,7 @@ function _snapToPage() { var item; switch (this.options.paginationMode) { case PaginationMode.SCROLL: - if (!this.options.paginationEnergyThresshold || Math.abs(this._scroll.particle.getEnergy()) <= this.options.paginationEnergyThresshold) { + if (!this.options.paginationEnergyThreshold || Math.abs(this._scroll.particle.getEnergy()) <= this.options.paginationEnergyThreshold) { item = this.options.alignment ? this.getLastVisibleItem() : this.getFirstVisibleItem(); if (item && item.renderNode) { this.goToRenderNode(item.renderNode); @@ -3662,7 +3862,7 @@ function _goToSequence(viewSequence, next, noAnimation) { this.halt(); this._scroll.scrollDelta = 0; _setParticle.call(this, 0, 0, '_goToSequence'); - this._isDirty = true; + this._scroll.scrollDirty = true; } else { this._scroll.scrollToSequence = viewSequence; this._scroll.scrollToRenderNode = viewSequence.get(); @@ -3903,7 +4103,7 @@ ScrollController.prototype.releaseScrollForce = function (delta, velocity) { if (item) { if (item.renderNode !== this._scroll.scrollForceStartItem.renderNode) { this.goToRenderNode(item.renderNode); - } else if (this.options.paginationEnergyThresshold && Math.abs(this._scroll.particle.getEnergy()) >= this.options.paginationEnergyThresshold) { + } else if (this.options.paginationEnergyThreshold && Math.abs(this._scroll.particle.getEnergy()) >= this.options.paginationEnergyThreshold) { velocity = velocity || 0; if (velocity < 0 && item._node._next && item._node._next.renderNode) { this.goToRenderNode(item._node._next.renderNode); @@ -4143,10 +4343,8 @@ ScrollController.prototype.render = function render() { } }; module.exports = ScrollController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8}],10:[function(require,module,exports){ -(function (global){ -var EventHandler = typeof window !== 'undefined' ? window.famous.core.EventHandler : typeof global !== 'undefined' ? global.famous.core.EventHandler : null; +var EventHandler = window.famous.core.EventHandler; function VirtualViewSequence(options) { options = options || {}; this._ = options._ || new this.constructor.Backing(options); @@ -4269,7 +4467,6 @@ VirtualViewSequence.prototype.swap = function () { } }; module.exports = VirtualViewSequence; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],11:[function(require,module,exports){ var LayoutUtility = require('../LayoutUtility'); function LayoutDockHelper(context, options) { @@ -4277,18 +4474,18 @@ function LayoutDockHelper(context, options) { this._size = size; this._context = context; this._options = options; - this._z = options && options.translateZ ? options.translateZ : 0; + this._data = { z: options && options.translateZ ? options.translateZ : 0 }; if (options && options.margins) { var margins = LayoutUtility.normalizeMargins(options.margins); - this._left = margins[3]; - this._top = margins[0]; - this._right = size[0] - margins[1]; - this._bottom = size[1] - margins[2]; + this._data.left = margins[3]; + this._data.top = margins[0]; + this._data.right = size[0] - margins[1]; + this._data.bottom = size[1] - margins[2]; } else { - this._left = 0; - this._top = 0; - this._right = size[0]; - this._bottom = size[1]; + this._data.left = 0; + this._data.top = 0; + this._data.right = size[0]; + this._data.bottom = size[1]; } } LayoutDockHelper.prototype.parse = function (data) { @@ -4316,14 +4513,14 @@ LayoutDockHelper.prototype.top = function (node, height, z) { } if (height === undefined) { var size = this._context.resolveSize(node, [ - this._right - this._left, - this._bottom - this._top + this._data.right - this._data.left, + this._data.bottom - this._data.top ]); height = size[1]; } this._context.set(node, { size: [ - this._right - this._left, + this._data.right - this._data.left, height ], origin: [ @@ -4335,12 +4532,12 @@ LayoutDockHelper.prototype.top = function (node, height, z) { 0 ], translate: [ - this._left, - this._top, - z === undefined ? this._z : z + this._data.left, + this._data.top, + z === undefined ? this._data.z : z ] }); - this._top += height; + this._data.top += height; return this; }; LayoutDockHelper.prototype.left = function (node, width, z) { @@ -4349,15 +4546,15 @@ LayoutDockHelper.prototype.left = function (node, width, z) { } if (width === undefined) { var size = this._context.resolveSize(node, [ - this._right - this._left, - this._bottom - this._top + this._data.right - this._data.left, + this._data.bottom - this._data.top ]); width = size[0]; } this._context.set(node, { size: [ width, - this._bottom - this._top + this._data.bottom - this._data.top ], origin: [ 0, @@ -4368,12 +4565,12 @@ LayoutDockHelper.prototype.left = function (node, width, z) { 0 ], translate: [ - this._left, - this._top, - z === undefined ? this._z : z + this._data.left, + this._data.top, + z === undefined ? this._data.z : z ] }); - this._left += width; + this._data.left += width; return this; }; LayoutDockHelper.prototype.bottom = function (node, height, z) { @@ -4382,14 +4579,14 @@ LayoutDockHelper.prototype.bottom = function (node, height, z) { } if (height === undefined) { var size = this._context.resolveSize(node, [ - this._right - this._left, - this._bottom - this._top + this._data.right - this._data.left, + this._data.bottom - this._data.top ]); height = size[1]; } this._context.set(node, { size: [ - this._right - this._left, + this._data.right - this._data.left, height ], origin: [ @@ -4401,12 +4598,12 @@ LayoutDockHelper.prototype.bottom = function (node, height, z) { 1 ], translate: [ - this._left, - -(this._size[1] - this._bottom), - z === undefined ? this._z : z + this._data.left, + -(this._size[1] - this._data.bottom), + z === undefined ? this._data.z : z ] }); - this._bottom -= height; + this._data.bottom -= height; return this; }; LayoutDockHelper.prototype.right = function (node, width, z) { @@ -4416,15 +4613,15 @@ LayoutDockHelper.prototype.right = function (node, width, z) { if (node) { if (width === undefined) { var size = this._context.resolveSize(node, [ - this._right - this._left, - this._bottom - this._top + this._data.right - this._data.left, + this._data.bottom - this._data.top ]); width = size[0]; } this._context.set(node, { size: [ width, - this._bottom - this._top + this._data.bottom - this._data.top ], origin: [ 1, @@ -4435,44 +4632,46 @@ LayoutDockHelper.prototype.right = function (node, width, z) { 0 ], translate: [ - -(this._size[0] - this._right), - this._top, - z === undefined ? this._z : z + -(this._size[0] - this._data.right), + this._data.top, + z === undefined ? this._data.z : z ] }); } if (width) { - this._right -= width; + this._data.right -= width; } return this; }; LayoutDockHelper.prototype.fill = function (node, z) { this._context.set(node, { size: [ - this._right - this._left, - this._bottom - this._top + this._data.right - this._data.left, + this._data.bottom - this._data.top ], translate: [ - this._left, - this._top, - z === undefined ? this._z : z + this._data.left, + this._data.top, + z === undefined ? this._data.z : z ] }); return this; }; LayoutDockHelper.prototype.margins = function (margins) { margins = LayoutUtility.normalizeMargins(margins); - this._left += margins[3]; - this._top += margins[0]; - this._right -= margins[1]; - this._bottom -= margins[2]; + this._data.left += margins[3]; + this._data.top += margins[0]; + this._data.right -= margins[1]; + this._data.bottom -= margins[2]; return this; }; +LayoutDockHelper.prototype.get = function () { + return this._data; +}; LayoutUtility.registerHelper('dock', LayoutDockHelper); module.exports = LayoutDockHelper; },{"../LayoutUtility":8}],12:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var LayoutUtility = require('../LayoutUtility'); var capabilities = { sequence: true, @@ -4616,8 +4815,14 @@ function CollectionLayout(context_, options) { console.warn('options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two'); } itemSize = [ - (size[0] - (margins[1] + margins[3] + spacing[0] * (options.cells[0] - 1))) / options.cells[0], - (size[1] - (margins[0] + margins[2] + spacing[1] * (options.cells[1] - 1))) / options.cells[1] + [ + undefined, + true + ].indexOf(options.cells[0]) > -1 ? options.cells[0] : (size[0] - (margins[1] + margins[3] + spacing[0] * (options.cells[0] - 1))) / options.cells[0], + [ + undefined, + true + ].indexOf(options.cells[1]) > -1 ? options.cells[1] : (size[1] - (margins[0] + margins[2] + spacing[1] * (options.cells[1] - 1))) / options.cells[1] ]; } else if (!options.itemSize) { itemSize = [ @@ -4681,10 +4886,8 @@ CollectionLayout.Capabilities = capabilities; CollectionLayout.Name = 'CollectionLayout'; CollectionLayout.Description = 'Multi-cell collection-layout with margins & spacing'; module.exports = CollectionLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../LayoutUtility":8}],13:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var capabilities = { sequence: true, direction: [ @@ -4790,7 +4993,6 @@ function CoverLayout(context, options) { } CoverLayout.Capabilities = capabilities; module.exports = CoverLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],14:[function(require,module,exports){ module.exports = function CubeLayout(context, options) { var itemSize = options.itemSize; @@ -4877,8 +5079,7 @@ module.exports = function HeaderFooterLayout(context, options) { dock.fill('content'); }; },{"../helpers/LayoutDockHelper":11}],17:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var LayoutUtility = require('../LayoutUtility'); var capabilities = { sequence: true, @@ -5055,15 +5256,24 @@ ListLayout.Capabilities = capabilities; ListLayout.Name = 'ListLayout'; ListLayout.Description = 'List-layout with margins, spacing and sticky headers'; module.exports = ListLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../LayoutUtility":8}],18:[function(require,module,exports){ var LayoutDockHelper = require('../helpers/LayoutDockHelper'); module.exports = function NavBarLayout(context, options) { var dock = new LayoutDockHelper(context, { margins: options.margins, - translateZ: 1 + translateZ: options.hasOwnProperty('zIncrement') ? options.zIncrement : 2 }); context.set('background', { size: context.size }); + var backIcon = context.get('backIcon'); + if (backIcon) { + dock.left(backIcon, options.backIconWidth); + dock.left(undefined, options.leftItemSpacer || options.itemSpacer); + } + var backItem = context.get('backItem'); + if (backItem) { + dock.left(backItem, options.backItemWidth); + dock.left(undefined, options.leftItemSpacer || options.itemSpacer); + } var node; var i; var rightItems = context.get('rightItems'); @@ -5082,11 +5292,28 @@ module.exports = function NavBarLayout(context, options) { dock.left(undefined, options.leftItemSpacer || options.itemSpacer); } } - dock.fill('title'); + var title = context.get('title'); + if (title) { + var titleSize = context.resolveSize(title, context.size); + var left = Math.max((context.size[0] - titleSize[0]) / 2, dock.get().left); + var right = Math.min((context.size[0] + titleSize[0]) / 2, dock.get().right); + left = Math.max(left, context.size[0] - right); + right = Math.min(right, context.size[0] - left); + context.set(title, { + size: [ + right - left, + context.size[1] + ], + translate: [ + left, + 0, + dock.get().z + ] + }); + } }; },{"../helpers/LayoutDockHelper":11}],19:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var capabilities = { sequence: true, direction: [ @@ -5140,10 +5367,8 @@ function ProportionalLayout(context, options) { } ProportionalLayout.Capabilities = capabilities; module.exports = ProportionalLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],20:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var LayoutUtility = require('../LayoutUtility'); var capabilities = { sequence: true, @@ -5191,7 +5416,7 @@ function TabBarLayout(context, options) { items = context.get('items'); spacers = context.get('spacers'); margins = LayoutUtility.normalizeMargins(options.margins); - zIncrement = options.zIncrement || 0.001; + zIncrement = options.zIncrement || 2; set.size[0] = context.size[0]; set.size[1] = context.size[1]; set.size[revDirection] -= margins[1 - revDirection] + margins[3 - revDirection]; @@ -5260,10 +5485,8 @@ TabBarLayout.Capabilities = capabilities; TabBarLayout.Name = 'TabBarLayout'; TabBarLayout.Description = 'TabBar widget layout'; module.exports = TabBarLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../LayoutUtility":8}],21:[function(require,module,exports){ -(function (global){ -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; +var Utility = window.famous.utilities.Utility; var capabilities = { sequence: true, direction: [ @@ -5371,13 +5594,11 @@ WheelLayout.Capabilities = capabilities; WheelLayout.Name = 'WheelLayout'; WheelLayout.Description = 'Spinner-wheel/slot-machine layout'; module.exports = WheelLayout; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],22:[function(require,module,exports){ -(function (global){ -var View = typeof window !== 'undefined' ? window.famous.core.View : typeof global !== 'undefined' ? global.famous.core.View : null; -var Surface = typeof window !== 'undefined' ? window.famous.core.Surface : typeof global !== 'undefined' ? global.famous.core.Surface : null; -var Utility = typeof window !== 'undefined' ? window.famous.utilities.Utility : typeof global !== 'undefined' ? global.famous.utilities.Utility : null; -var ContainerSurface = typeof window !== 'undefined' ? window.famous.surfaces.ContainerSurface : typeof global !== 'undefined' ? global.famous.surfaces.ContainerSurface : null; +var View = window.famous.core.View; +var Surface = window.famous.core.Surface; +var Utility = window.famous.utilities.Utility; +var ContainerSurface = window.famous.surfaces.ContainerSurface; var LayoutController = require('../LayoutController'); var ScrollController = require('../ScrollController'); var WheelLayout = require('../layouts/WheelLayout'); @@ -5661,11 +5882,9 @@ function _createOverlay() { this.add(this.overlay); } module.exports = DatePicker; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../LayoutController":5,"../LayoutUtility":8,"../ScrollController":9,"../VirtualViewSequence":10,"../layouts/ProportionalLayout":19,"../layouts/WheelLayout":21,"./DatePickerComponents":23}],23:[function(require,module,exports){ -(function (global){ -var Surface = typeof window !== 'undefined' ? window.famous.core.Surface : typeof global !== 'undefined' ? global.famous.core.Surface : null; -var EventHandler = typeof window !== 'undefined' ? window.famous.core.EventHandler : typeof global !== 'undefined' ? global.famous.core.EventHandler : null; +var Surface = window.famous.core.Surface; +var EventHandler = window.famous.core.EventHandler; function decimal1(date) { return '' + date[this.get](); } @@ -5951,11 +6170,9 @@ module.exports = { Second: Second, Millisecond: Millisecond }; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{}],24:[function(require,module,exports){ -(function (global){ -var Surface = typeof window !== 'undefined' ? window.famous.core.Surface : typeof global !== 'undefined' ? global.famous.core.Surface : null; -var View = typeof window !== 'undefined' ? window.famous.core.View : typeof global !== 'undefined' ? global.famous.core.View : null; +var Surface = window.famous.core.Surface; +var View = window.famous.core.View; var LayoutController = require('../LayoutController'); var TabBarLayout = require('../layouts/TabBarLayout'); function TabBar(options) { @@ -6115,15 +6332,13 @@ TabBar.prototype.getSize = function () { return this.options.size || (this.layout ? this.layout.getSize() : View.prototype.getSize.call(this)); }; module.exports = TabBar; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../LayoutController":5,"../layouts/TabBarLayout":20}],25:[function(require,module,exports){ -(function (global){ -var View = typeof window !== 'undefined' ? window.famous.core.View : typeof global !== 'undefined' ? global.famous.core.View : null; +var View = window.famous.core.View; var AnimationController = require('../AnimationController'); var TabBar = require('./TabBar'); var LayoutDockHelper = require('../helpers/LayoutDockHelper'); var LayoutController = require('../LayoutController'); -var Easing = typeof window !== 'undefined' ? window.famous.transitions.Easing : typeof global !== 'undefined' ? global.famous.transitions.Easing : null; +var Easing = window.famous.transitions.Easing; function TabBarController(options) { View.apply(this, arguments); _createRenderables.call(this); @@ -6245,7 +6460,6 @@ TabBarController.prototype.getSelectedItemIndex = function () { return this.tabBar.getSelectedItemIndex(); }; module.exports = TabBarController; -}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {}) },{"../AnimationController":1,"../LayoutController":5,"../helpers/LayoutDockHelper":11,"./TabBar":24}],26:[function(require,module,exports){ if (typeof famousflex === 'undefined') { famousflex = {}; diff --git a/dist/famous-flex-global.min.js b/dist/famous-flex-global.min.js index 901d39d..08abc7a 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.2 -* @generated 07-05-2015 +* @version 0.3.3 +* @generated 09-06-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;ga;)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=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=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(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="undefined"!=typeof window?window.famous.core.OptionsManager:"undefined"!=typeof c?c.famous.core.OptionsManager:null,j="undefined"!=typeof window?window.famous.core.Transform:"undefined"!=typeof c?c.famous.core.Transform:null,k="undefined"!=typeof window?window.famous.math.Vector:"undefined"!=typeof c?c.famous.math.Vector:null,l="undefined"!=typeof window?window.famous.physics.bodies.Particle:"undefined"!=typeof c?c.famous.physics.bodies.Particle:null,m="undefined"!=typeof window?window.famous.physics.forces.Spring:"undefined"!=typeof c?c.famous.physics.forces.Spring:null,n="undefined"!=typeof window?window.famous.physics.PhysicsEngine:"undefined"!=typeof c?c.famous.physics.PhysicsEngine:null,o=a("./LayoutNode"),p="undefined"!=typeof window?window.famous.transitions.Transitionable:"undefined"!=typeof c?c.famous.transitions.Transitionable:null;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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./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(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;bd)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="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof c?c.famous.utilities.Utility:null,k="undefined"!=typeof window?window.famous.core.Entity:"undefined"!=typeof c?c.famous.core.Entity:null,l="undefined"!=typeof window?window.famous.core.ViewSequence:"undefined"!=typeof c?c.famous.core.ViewSequence:null,m="undefined"!=typeof window?window.famous.core.OptionsManager:"undefined"!=typeof c?c.famous.core.OptionsManager:null,n="undefined"!=typeof window?window.famous.core.EventHandler:"undefined"!=typeof c?c.famous.core.EventHandler:null,o=a("./LayoutUtility"),p=a("./LayoutNodeManager"),q=a("./LayoutNode"),r=a("./FlowLayoutNode"),s="undefined"!=typeof window?window.famous.core.Transform:"undefined"!=typeof c?c.famous.core.Transform:null;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;da||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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./FlowLayoutNode":3,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8,"./helpers/LayoutDockHelper":11}],6:[function(a,b,c){(function(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="undefined"!=typeof window?window.famous.core.Transform:"undefined"!=typeof c?c.famous.core.Transform:null,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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./LayoutUtility":8}],7:[function(a,b,c){function d(a,b){this.LayoutNode=a,this._initLayoutNodeFn=b,this._layoutCount=0,this._context=new l({next:g.bind(this),prev:h.bind(this),get:i.bind(this),set:j.bind(this),resolveSize:k.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.sized;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.indexthis._contextState.prevSetIndex&&m.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,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=e.size&&void 0!==e._trueSizeCheck?e.size:void 0;if(g&&(g[0]===!0||g[1]===!0)){c.usesTrueSize=!0;var h=e._backupSize;if((e._contentDirty||e._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),e._trueSizeCheck&&h&&g!==f){var j=g[0]===!0?Math.max(h[0],f[0]):f[0],k=g[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=k,f=h,e._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(e._trueSizeCheck=!0,e._sizeDirty=!0,this._trueSizeRequested=!0),h||(e._backupSize=[0,0],h=e._backupSize),h[0]=f[0],h[1]=f[1]}return g=e._nodes?e.options.size:void 0,!g||g[0]!==!0&&g[1]!==!0||(this._reevalTrueSize||e._nodes._trueSizeRequested)&&(c.usesTrueSize=!0,c.trueSizeRequested=!0,this._trueSizeRequested=!0),(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 l=a("./LayoutContext"),m=a("./LayoutUtility"),n=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),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(a){function c(){}function d(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 e="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof a?a.famous.utilities.Utility:null;c.registeredHelpers={};var f={SEQUENCE:1,DIRECTION_X:2,DIRECTION_Y:4,SCROLLING:8};c.Capabilities=f,c.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]},c.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},c.isEqualSpec=function(a,b){return a.opacity!==b.opacity?!1:d(a.size,b.size)&&d(a.transform,b.transform)&&d(a.origin,b.origin)&&d(a.align,b.align)?!0:!1},c.getSpecDiffText=function(a,b){var c="spec diff:";return a.opacity!==b.opacity&&(c+="\nopacity: "+a.opacity+" != "+b.opacity),d(a.size,b.size)||(c+="\nsize: "+JSON.stringify(a.size)+" != "+JSON.stringify(b.size)),d(a.transform,b.transform)||(c+="\ntransform: "+JSON.stringify(a.transform)+" != "+JSON.stringify(b.transform)),d(a.origin,b.origin)||(c+="\norigin: "+JSON.stringify(a.origin)+" != "+JSON.stringify(b.origin)),d(a.align,b.align)||(c+="\nalign: "+JSON.stringify(a.align)+" != "+JSON.stringify(b.align)),c},c.error=function(a){throw console.log("ERROR: "+a),a},c.warning=function(a){console.log("WARNING: "+a)},c.log=function(a){for(var b="",c=0;c0&&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;e0&&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&&cthis._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c=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.paginationEnergyThresshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThresshold)&&(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._isDirty=!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;e0?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="undefined"!=typeof window?window.famous.surfaces.ContainerSurface:"undefined"!=typeof c?c.famous.surfaces.ContainerSurface:null,J="undefined"!=typeof window?window.famous.core.Transform:"undefined"!=typeof c?c.famous.core.Transform:null,K="undefined"!=typeof window?window.famous.core.EventHandler:"undefined"!=typeof c?c.famous.core.EventHandler:null,L="undefined"!=typeof window?window.famous.core.Group:"undefined"!=typeof c?c.famous.core.Group:null,M="undefined"!=typeof window?window.famous.math.Vector:"undefined"!=typeof c?c.famous.math.Vector:null,N="undefined"!=typeof window?window.famous.physics.PhysicsEngine:"undefined"!=typeof c?c.famous.physics.PhysicsEngine:null,O="undefined"!=typeof window?window.famous.physics.bodies.Particle:"undefined"!=typeof c?c.famous.physics.bodies.Particle:null,P="undefined"!=typeof window?window.famous.physics.forces.Drag:"undefined"!=typeof c?c.famous.physics.forces.Drag:null,Q="undefined"!=typeof window?window.famous.physics.forces.Spring:"undefined"!=typeof c?c.famous.physics.forces.Spring:null,R="undefined"!=typeof window?window.famous.inputs.ScrollSync:"undefined"!=typeof c?c.famous.inputs.ScrollSync:null,S="undefined"!=typeof window?window.famous.core.ViewSequence:"undefined"!=typeof c?c.famous.core.ViewSequence:null,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"}},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,paginationEnergyThresshold:.01,alignment:0,touchMoveDirectionThresshold: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),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=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.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.paginationEnergyThresshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThresshold?(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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"./FlowLayoutNode":3,"./LayoutController":5,"./LayoutNode":6,"./LayoutNodeManager":7,"./LayoutUtility":8}],10:[function(a,b,c){(function(a){function c(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,d.setOutputHandler(this,this._.eventOutput),this.value.pipe(this._.eventOutput)}var d="undefined"!=typeof window?window.famous.core.EventHandler:"undefined"!=typeof a?a.famous.core.EventHandler:null;c.Backing=function(a){this.factory=a.factory,this.eventOutput=new d},c.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 c({_:this._,value:b,index:this.index-1,next:this}),this.prev):void 0},c.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 c({_:this._,value:b,index:this.index+1,prev:this}),this.next):void 0},c.prototype.get=function(){return this.touched=!0,this.value},c.prototype.getIndex=function(){return this.touched=!0,this.index},c.prototype.toString=function(){return""+this.index},c.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},c.prototype.unshift=function(){console.error&&console.error("VirtualViewSequence.unshift is not supported and should not be called")},c.prototype.push=function(){console.error&&console.error("VirtualViewSequence.push is not supported and should not be called")},c.prototype.splice=function(){console.error&&console.error("VirtualViewSequence.splice is not supported and should not be called")},c.prototype.swap=function(){console.error&&console.error("VirtualViewSequence.swap is not supported and should not be called")},b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],11:[function(a,b,c){function d(a,b){var c=a.size;if(this._size=c,this._context=a,this._options=b,this._z=b&&b.translateZ?b.translateZ:0,b&&b.margins){var d=e.normalizeMargins(b.margins);this._left=d[3],this._top=d[0],this._right=c[0]-d[1],this._bottom=c[1]-d[2]}else this._left=0,this._top=0,this._right=c[0],this._bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b=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._right-this._left,this._bottom-this._top]);b=d[1]}return this._context.set(a,{size:[this._right-this._left,b],origin:[0,0],align:[0,0],translate:[this._left,this._top,void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[0]}return this._context.set(a,{size:[b,this._bottom-this._top],origin:[0,0],align:[0,0],translate:[this._left,this._top,void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[1]}return this._context.set(a,{size:[this._right-this._left,b],origin:[0,1],align:[0,1],translate:[this._left,-(this._size[1]-this._bottom),void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[0]}this._context.set(a,{size:[b,this._bottom-this._top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._right),this._top,void 0===c?this._z:c]})}return b&&(this._right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._right-this._left,this._bottom-this._top],translate:[this._left,this._top,void 0===b?this._z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._left+=a[3],this._top+=a[0],this._right-=a[1],this._bottom-=a[2],this},e.registerHelper("dock",d),b.exports=d},{"../LayoutUtility":8}],12:[function(a,b,c){(function(c){function d(a,b){if(!s.length)return 0;var c,d,e=[0,0];for(c=0;c0?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;cm;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],v>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+(j?w[j]:0),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],v>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="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof c?c.famous.utilities.Utility:null,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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../LayoutUtility":8}],13:[function(a,b,c){(function(a){function c(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 d="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof a?a.famous.utilities.Utility:null,e={sequence:!0,direction:[d.Direction.X,d.Direction.Y],scrolling:!0,sequentialScrollingOptimized:!1};c.Capabilities=e,b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],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(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(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="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof c?c.famous.utilities.Utility:null,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}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{"../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:1});a.set("background",{size:a.size});var e,f,g=a.get("rightItems");if(g)for(f=0;f=j&&(g=a.next());)j>=-k&&(l=j/h*n,r.translate[e]=m*Math.sin(l),r.translate[2]=m*Math.cos(l)-m,r.rotate[f]=e?-l:l,r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-o),a.set(g,r)),j+=h;for(j=a.scrollOffset-h;j>=-k&&(g=a.prev());)k>=j&&(l=j/h*n,r.translate[e]=m*Math.sin(l),r.translate[2]=m*Math.cos(l)-m,r.rotate[f]=e?-l:l,r.opacity=1-Math.abs(l)/(Math.PI/2)*(1-o),a.set(g,r)),j-=h}var d,e,f,g,h,i,j,k,l,m,n,o,p="undefined"!=typeof window?window.famous.utilities.Utility:"undefined"!=typeof a?a.famous.utilities.Utility:null,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};c.Capabilities=q,c.Name="WheelLayout",c.Description="Spinner-wheel/slot-machine layout",b.exports=c}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],22:[function(a,b,c){(function(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?"
"+b+"
":void 0});if(Array.isArray(a))for(var e=0;ej?j+d.upperBound:j-d.upperBound;Math.abs(k)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.upperBound){if(!this.loop)return void 0;b=Math.max(b%this.upperBound,this.lowerBound||0)}return this.setComponent(a,b),a},g.prototype.createPrevious=function(a){var b=this.getPrevious(a.date);return b?this.create(b):void 0},g.prototype.getPrevious=function(a){a=new Date(a.getTime());var b=this.getComponent(a)-this.step;if(void 0!==this.lowerBound&&b"+b+""})},g.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},g.prototype.destroy=function(a){this._pool.push(a)},h.prototype=Object.create(g.prototype),h.prototype.constructor=h,h.prototype.classes=["item","year"],h.prototype.format=f,h.prototype.sizeRatio=1,h.prototype.step=1,h.prototype.loop=!1,h.prototype.set="setFullYear",h.prototype.get="getFullYear",i.prototype=Object.create(g.prototype),i.prototype.constructor=i,i.prototype.classes=["item","month"],i.prototype.sizeRatio=2,i.prototype.lowerBound=0,i.prototype.upperBound=12,i.prototype.step=1,i.prototype.loop=!0,i.prototype.set="setMonth",i.prototype.get="getMonth",i.prototype.strings=["January","February","March","April","May","June","July","August","September","October","November","December"],i.prototype.format=function(a){return this.strings[a.getMonth()]},j.prototype=Object.create(g.prototype),j.prototype.constructor=j,j.prototype.classes=["item","fullday"],j.prototype.sizeRatio=2,j.prototype.step=1,j.prototype.set="setDate",j.prototype.get="getDate",j.prototype.format=function(a){return a.toLocaleDateString()},k.prototype=Object.create(g.prototype),k.prototype.constructor=k,k.prototype.classes=["item","weekday"],k.prototype.sizeRatio=2,k.prototype.lowerBound=0,k.prototype.upperBound=7,k.prototype.step=1,k.prototype.loop=!0,k.prototype.set="setDate",k.prototype.get="getDate",k.prototype.strings=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],k.prototype.format=function(a){return this.strings[a.getDay()]},l.prototype=Object.create(g.prototype),l.prototype.constructor=l,l.prototype.classes=["item","day"],l.prototype.format=c,l.prototype.sizeRatio=1,l.prototype.lowerBound=1,l.prototype.upperBound=32,l.prototype.step=1,l.prototype.loop=!0,l.prototype.set="setDate",l.prototype.get="getDate",m.prototype=Object.create(g.prototype),m.prototype.constructor=m,m.prototype.classes=["item","hour"],m.prototype.format=d,m.prototype.sizeRatio=1,m.prototype.lowerBound=0,m.prototype.upperBound=24,m.prototype.step=1,m.prototype.loop=!0,m.prototype.set="setHours",m.prototype.get="getHours",n.prototype=Object.create(g.prototype),n.prototype.constructor=n,n.prototype.classes=["item","minute"],n.prototype.format=d,n.prototype.sizeRatio=1,n.prototype.lowerBound=0,n.prototype.upperBound=60,n.prototype.step=1,n.prototype.loop=!0,n.prototype.set="setMinutes",n.prototype.get="getMinutes",o.prototype=Object.create(g.prototype),o.prototype.constructor=o,o.prototype.classes=["item","second"],o.prototype.format=d,o.prototype.sizeRatio=1,o.prototype.lowerBound=0,o.prototype.upperBound=60,o.prototype.step=1,o.prototype.loop=!0,o.prototype.set="setSeconds",o.prototype.get="getSeconds",p.prototype=Object.create(g.prototype),p.prototype.constructor=p,p.prototype.classes=["item","millisecond"],p.prototype.format=e,p.prototype.sizeRatio=1,p.prototype.lowerBound=0,p.prototype.upperBound=1e3,p.prototype.step=1,p.prototype.loop=!0,p.prototype.set="setMilliseconds",p.prototype.get="getMilliseconds",b.exports={Base:g,Year:h,Month:i,FullDay:j,WeekDay:k,Day:l,Hour:m,Minute:n,Second:o,Millisecond:p}}).call(this,"undefined"!=typeof global?global:"undefined"!=typeof self?self:"undefined"!=typeof window?window:{})},{}],24:[function(a,b,c){(function(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"+b+"":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="undefined"!=typeof window?window.famous.core.Surface:"undefined"!=typeof c?c.famous.core.Surface:null,h="undefined"!=typeof window?window.famous.core.View:"undefined"!=typeof c?c.famous.core.View:null,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=0&&a.oldIndex=0?this.animationController.show(this._items[b].view):this.animationController.hide()}var i="undefined"!=typeof window?window.famous.core.View:"undefined"!=typeof c?c.famous.core.View:null,j=a("../AnimationController"),k=a("./TabBar"),l=a("../helpers/LayoutDockHelper"),m=a("../LayoutController"),n="undefined"!=typeof window?window.famous.transitions.Easing:"undefined"!=typeof c?c.famous.transitions.Easing:null;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=2&&this._viewStack[0].state===D.HIDING&&this._viewStack[1].state===D.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=D.HIDING,d.hideCallback=function(){d.hideCallback=void 0;var a=this._viewStack.indexOf(d);this._renderables.views.splice(a,1),this._viewStack.splice(a,1),d.view=void 0,t.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=D.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=D.VISIBLE,t.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),u.call(this)}return this},d.prototype.get=function(){for(var a=0;aa;)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=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=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;bd)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;da||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.sized;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.indexthis._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;c0&&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;e0&&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&&cthis._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c=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;e0?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"}},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=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.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=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;c0?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-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+(j?0:w[j]),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],v>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+(j?w[j]:0),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],v>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(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=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?"
"+b+"
":void 0});if(Array.isArray(a))for(var e=0;ej?j+d.upperBound:j-d.upperBound;Math.abs(k)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.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"+b+""})},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"+b+"":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=0&&a.oldIndex=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= this.options.paginationEnergyThresshold)) { + else if (this.options.paginationEnergyThreshold && (Math.abs(this._scroll.particle.getEnergy()) >= this.options.paginationEnergyThreshold)) { velocity = velocity || 0; if ((velocity < 0) && item._node._next && item._node._next.renderNode) { this.goToRenderNode(item._node._next.renderNode); @@ -6054,7 +6119,7 @@ define('famous-flex/FlexScrollView',['require','exports','module','./LayoutUtili var totalHeight; // Show/activate pull to refresh renderables - for (var i = 0; i < 2 ; i++) { + for (var i = 0; i < 2; i++) { var pullToRefresh = this._pullToRefresh[i]; if (pullToRefresh) { @@ -6686,6 +6751,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c var RenderNode = require('famous/core/RenderNode'); var Timer = require('famous/utilities/Timer'); var Easing = require('famous/transitions/Easing'); + //var Transitionable = require('famous/animations/Transitionable'); /** * @class @@ -6709,6 +6775,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c function AnimationController(options) { View.apply(this, arguments); + this._size = [0, 0]; _createLayout.call(this); if (options) { @@ -6817,6 +6884,8 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c size: context.size, translate: [0, 0, 0] }; + this._size[0] = context.size[0]; + this._size[1] = context.size[1]; var views = context.get('views'); var transferables = context.get('transferables'); for (var i = 0; i < Math.min(views.length, 2); i++) { @@ -6866,7 +6935,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c dataSource: this._renderables }); this.add(this.layout); - this.layout.on('layoutend', _startAnimations.bind(this)); + this.layout.on('layoutend', _processAnimations.bind(this)); } /** @@ -6877,7 +6946,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c return; } var spec = view.getSpec(id); - if (spec) { + if (spec && !spec.trueSizeRequested) { callback(spec); } else { @@ -6917,12 +6986,24 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c * Begins visual transfer or renderables from the previous item * to the new item. */ - function _startTransferableAnimations(item, prevItem) { + function _initTransferableAnimations(item, prevItem, callback) { + var callbackCount = 0; + function waitForAll() { + callbackCount--; + if (callbackCount === 0) { + callback(); + } + } for (var sourceId in item.options.transfer.items) { - _startTransferableAnimation.call(this, item, prevItem, sourceId); + if (_initTransferableAnimation.call(this, item, prevItem, sourceId, waitForAll)) { + callbackCount++; + } + } + if (!callbackCount) { + callback(); } } - function _startTransferableAnimation(item, prevItem, sourceId) { + function _initTransferableAnimation(item, prevItem, sourceId, callback) { var target = item.options.transfer.items[sourceId]; var transferable = {}; transferable.source = _getTransferable.call(this, prevItem, prevItem.view, sourceId); @@ -6943,6 +7024,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c // Replace source & target renderables in the views // source: dummy-node // target: target-renderable with opacity: 0. + transferable.sourceSpec = sourceSpec; transferable.originalSource = transferable.source.get(); transferable.source.show(new RenderNode(new Modifier(sourceSpec))); transferable.originalTarget = transferable.target.get(); @@ -6955,9 +7037,9 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c var zIndexMod = new Modifier({ transform: Transform.translate(0, 0, item.options.transfer.zIndex) }); - var mod = new StateModifier(sourceSpec); + transferable.mod = new StateModifier(sourceSpec); transferable.renderNode = new RenderNode(zIndexMod); - transferable.renderNode.add(mod).add(transferable.originalSource); + transferable.renderNode.add(transferable.mod).add(transferable.originalSource); item.transferables.push(transferable); this._renderables.transferables.push(transferable.renderNode); this.layout.reflowLayout(); @@ -6966,31 +7048,52 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c // cycles if for instance, this involves a true-size renderable or the // renderable is affected by other true-size renderables around itsself. Timer.after(function() { + var callbackCalled; transferable.target.getSpec(function(targetSpec, transition) { - mod.halt(); - if ((sourceSpec.opacity !== undefined) || (targetSpec.opacity !== undefined)) { - mod.setOpacity((targetSpec.opacity === undefined) ? 1 : targetSpec.opacity, transition|| item.options.transfer.transition); - } - if (item.options.transfer.fastResize) { - if (sourceSpec.transform || targetSpec.transform || sourceSpec.size || targetSpec.size) { - var transform = targetSpec.transform || Transform.identity; - if (sourceSpec.size && targetSpec.size) { - transform = Transform.multiply(transform, Transform.scale(targetSpec.size[0] / sourceSpec.size[0], targetSpec.size[1] / sourceSpec.size[1], 1)); - } - mod.setTransform(transform, transition || item.options.transfer.transition); - } - } - else { - if (sourceSpec.transform || targetSpec.transform) { - mod.setTransform(targetSpec.transform || Transform.identity, transition || item.options.transfer.transition); - } - if (sourceSpec.size || targetSpec.size) { - mod.setSize(targetSpec.size || sourceSpec.size, transition || item.options.transfer.transition); - } + transferable.targetSpec = targetSpec; + transferable.transition = transition; + if (!callbackCalled) { + callback(); } }, true); }, 1); }.bind(this), false); + return true; + } + else { + return false; + } + } + function _startTransferableAnimations(item, callback) { + for (var j = 0; j < item.transferables.length; j++) { + var transferable = item.transferables[j]; + transferable.mod.halt(); + if ((transferable.sourceSpec.opacity !== undefined) || (transferable.targetSpec.opacity !== undefined)) { + transferable.mod.setOpacity((transferable.targetSpec.opacity === undefined) ? 1 : transferable.targetSpec.opacity, transferable.transition || item.options.transfer.transition); + } + if (item.options.transfer.fastResize) { + if (transferable.sourceSpec.transform || transferable.targetSpec.transform || transferable.sourceSpec.size || transferable.targetSpec.size) { + var transform = transferable.targetSpec.transform || Transform.identity; + if (transferable.sourceSpec.size && transferable.targetSpec.size) { + transform = Transform.multiply(transform, Transform.scale(transferable.targetSpec.size[0] / transferable.sourceSpec.size[0], transferable.targetSpec.size[1] / transferable.sourceSpec.size[1], 1)); + } + transferable.mod.setTransform(transform, transferable.transition || item.options.transfer.transition, callback); + callback = undefined; + } + } + else { + if (transferable.sourceSpec.transform || transferable.targetSpec.transform) { + transferable.mod.setTransform(transferable.targetSpec.transform || Transform.identity, transferable.transition || item.options.transfer.transition, callback); + callback = undefined; + } + if (transferable.sourceSpec.size || transferable.targetSpec.size) { + transferable.mod.setSize(transferable.targetSpec.size || transferable.sourceSpec.size, transferable.transition || item.options.transfer.transition, callback); + callback = undefined; + } + } + } + if (callback) { + callback(); } } @@ -7018,19 +7121,19 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c /** * Starts a show or hide animation. */ - function _startAnimations(event) { + function _processAnimations(event) { var prevItem; for (var i = 0; i < this._viewStack.length; i++) { var item = this._viewStack[i]; switch (item.state) { case ItemState.HIDE: item.state = ItemState.HIDING; - _startAnimation.call(this, item, prevItem, event.size, false); + _startHideAnimation.call(this, item, prevItem, event.size); _updateState.call(this); break; case ItemState.SHOW: item.state = ItemState.SHOWING; - _startAnimation.call(this, item, prevItem, event.size, true); + _initShowAnimation.call(this, item, prevItem, event.size); _updateState.call(this); break; } @@ -7041,38 +7144,93 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c /** * Starts the view animation. */ - function _startAnimation(item, prevItem, size, show) { - var animation = show ? item.options.show.animation : item.options.hide.animation; - var spec = animation ? animation.call(undefined, show, size) : {}; + function _initShowAnimation(item, prevItem, size) { + var spec = item.options.show.animation ? item.options.show.animation.call(undefined, true, size) : {}; + item.startSpec = spec; + item.endSpec = { + opacity: 1, + transform: Transform.identity + }; item.mod.halt(); - var callback; - if (show) { - callback = item.showCallback; + if (spec.transform) { + item.mod.setTransform(spec.transform); + } + if (spec.opacity !== undefined) { + item.mod.setOpacity(spec.opacity); + } + if (spec.align) { + item.mod.setAlign(spec.align); + } + if (spec.origin) { + item.mod.setOrigin(spec.origin); + } + if (prevItem) { + _initTransferableAnimations.call(this, item, prevItem, _startShowAnimation.bind(this, item, spec)); + } + else { + _startShowAnimation.call(this, item, spec); + } + } + + /** + * Starts the show animation whenever init has completed. + */ + function _startShowAnimation(item, spec) { + if (!item.halted) { + var callback = item.showCallback; if (spec.transform) { - item.mod.setTransform(spec.transform); item.mod.setTransform(Transform.identity, item.options.show.transition, callback); callback = undefined; } if (spec.opacity !== undefined) { - item.mod.setOpacity(spec.opacity); item.mod.setOpacity(1, item.options.show.transition, callback); callback = undefined; } - if (spec.align) { - item.mod.setAlign(spec.align); - } - if (spec.origin) { - item.mod.setOrigin(spec.origin); - } - if (prevItem) { - _startTransferableAnimations.call(this, item, prevItem); - } - if (callback) { - callback(); + _startTransferableAnimations.call(this, item, callback); + } + } + + /** + * Helper function for interpolating between start/end state based on percentage. + */ + function _interpolate(start, end, perc) { + return start + ((end - start) * perc); + } + + /** + * Halts a item at a given frame. The frame is provided as a percentage + * of the whole transition. + */ + function _haltItemAtFrame(item, perc) { + item.mod.halt(); + item.halted = true; + if (item.startSpec && (perc !== undefined)) { + if ((item.startSpec.opacity !== undefined) && (item.endSpec.opacity !== undefined)) { + item.mod.setOpacity(_interpolate(item.startSpec.opacity, item.endSpec.opacity, perc)); + } + if (item.startSpec.transform && item.endSpec.transform) { + var transform = []; + for (var i = 0; i < item.startSpec.transform.length; i++) { + transform.push(_interpolate(item.startSpec.transform[i], item.endSpec.transform[i], perc)); + } + item.mod.setTransform(transform); } } - else { - callback = item.hideCallback; + } + + /** + * Starts the hide animation. + */ + function _startHideAnimation(item, prevItem, size) { + var spec = item.options.hide.animation ? item.options.hide.animation.call(undefined, false, size) : {}; + item.endSpec = spec; + item.startSpec = { + opacity: 1, + transform: Transform.identity + }; + if (!item.halted) { + item.mod.halt(); + var callback = item.hideCallback; if (spec.transform) { item.mod.setTransform(spec.transform, item.options.hide.transition, callback); callback = undefined; @@ -7156,6 +7314,39 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c } } + function _resume() { + for (var i = 0; i < Math.min(this._viewStack.length, 2); i++) { + var item = this._viewStack[i]; + if (item.halted) { + item.halted = false; + if (item.endSpec) { + var callback; + switch (item.state) { + case ItemState.HIDE: + case ItemState.HIDING: + callback = item.hideCallback; + break; + case ItemState.SHOW: + case ItemState.SHOWING: + callback = item.showCallback; + break; + } + item.mod.halt(); + if (item.endSpec.transform) { + item.mod.setTransform(item.endSpec.transform, item.options.show.transition, callback); + callback = undefined; + } + if (item.endSpec.opacity !== undefined) { + item.mod.setOpacity(item.endSpec.opacity, item.options.show.transition, callback); + } + if (callback) { + callback(); + } + } + } + } + } + /** * Shows a renderable using an animation and hides the old renderable. * @@ -7181,6 +7372,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c * @return {AnimationController} this */ AnimationController.prototype.show = function(renderable, options, callback) { + _resume.call(this, renderable); if (!renderable) { return this.hide(options, callback); } @@ -7192,6 +7384,9 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c _setItemOptions.call(this, item, options); _updateState.call(this); } + if (callback) { + callback(); + } return this; } if (item && (item.state !== ItemState.HIDING) && options) { @@ -7203,7 +7398,6 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c item.options.hide.animation = options.animation; } } - item = { view: renderable, mod: new StateModifier(), @@ -7215,14 +7409,18 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c item.node.add(renderable); _setItemOptions.call(this, item, options); item.showCallback = function() { + item.showCallback = undefined; item.state = ItemState.VISIBLE; _updateState.call(this); _endTransferableAnimations.call(this, item); + item.endSpec = undefined; + item.startSpec = undefined; if (callback) { callback(); } }.bind(this); item.hideCallback = function() { + item.hideCallback = undefined; var index = this._viewStack.indexOf(item); this._renderables.views.splice(index, 1); this._viewStack.splice(index, 1); @@ -7246,6 +7444,7 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c * @return {AnimationController} this */ AnimationController.prototype.hide = function(options, callback) { + _resume.call(this); var item = this._viewStack.length ? this._viewStack[this._viewStack.length - 1] : undefined; if (!item || (item.state === ItemState.HIDING)) { return this; @@ -7278,23 +7477,90 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c /** * Clears the queue of any pending show animations. * + * @param {Boolean} [stopAnimation] Freezes the current animation. + * @param {Number} [framePerc] Frame at which to freeze the animation (in percentage). * @return {AnimationController} this */ - AnimationController.prototype.halt = function() { + AnimationController.prototype.halt = function(stopAnimation, framePerc) { + var item; for (var i = 0; i < this._viewStack.length; i++) { - var item = this._viewStack[this._viewStack.length - 1]; - if ((item.state === ItemState.QUEUED) || (item.state === ItemState.SHOW)) { - this._renderables.views.splice(this._viewStack.length - 1, 1); - this._viewStack.splice(this._viewStack.length - 1, 1); - item.view = undefined; + if (stopAnimation) { + item = this._viewStack[i]; + switch (item.state) { + case ItemState.SHOW: + case ItemState.SHOWING: + case ItemState.HIDE: + case ItemState.HIDING: + case ItemState.VISIBLE: + _haltItemAtFrame(item, framePerc); + break; + } } else { - break; + item = this._viewStack[this._viewStack.length - 1]; + if ((item.state === ItemState.QUEUED) || (item.state === ItemState.SHOW)) { + this._renderables.views.splice(this._viewStack.length - 1, 1); + this._viewStack.splice(this._viewStack.length - 1, 1); + item.view = undefined; + } + else { + break; + } } } return this; }; + /** + * Aborts the currently active show or hide operation, effectively + * reversing the animation. + * + * @param {Function} [callback] Function that is called on completion. + * @return {AnimationController} this + */ + AnimationController.prototype.abort = function(callback) { + if ((this._viewStack.length >= 2) && (this._viewStack[0].state === ItemState.HIDING) && (this._viewStack[1].state === ItemState.SHOWING)) { + var prevItem = this._viewStack[0]; + var item = this._viewStack[1]; + var swapSpec; + + item.halted = true; + swapSpec = item.endSpec; + item.endSpec = item.startSpec; + item.startSpec = swapSpec; + item.state = ItemState.HIDING; + item.hideCallback = function() { + item.hideCallback = undefined; + var index = this._viewStack.indexOf(item); + this._renderables.views.splice(index, 1); + this._viewStack.splice(index, 1); + item.view = undefined; + _updateState.call(this); + this.layout.reflowLayout(); + }.bind(this); + + prevItem.halted = true; + swapSpec = prevItem.endSpec; + prevItem.endSpec = prevItem.startSpec; + prevItem.startSpec = swapSpec; + prevItem.state = ItemState.SHOWING; + prevItem.showCallback = function() { + prevItem.showCallback = undefined; + prevItem.state = ItemState.VISIBLE; + _updateState.call(this); + _endTransferableAnimations.call(this, prevItem); + prevItem.endSpec = undefined; + prevItem.startSpec = undefined; + if (callback) { + callback(); + } + }.bind(this); + + _resume.call(this); + } + return this; + }; + /** * Gets the currently visible or being shown renderable. * @@ -7312,6 +7578,15 @@ define('famous-flex/AnimationController',['require','exports','module','famous/c return undefined; }; + /** + * Gets the size of the view. + * + * @return {Array.Number} size + */ + AnimationController.prototype.getSize = function() { + return this._size || this.options.size; + }; + module.exports = AnimationController; }); @@ -8366,7 +8641,7 @@ define('famous-flex/widgets/DatePicker',['require','exports','module','famous/co * |---|---|---| * |`[margins]`|Number/Array|Margins shorthand (e.g. 5, [10, 20], [2, 5, 2, 10])| * |`[spacing]`|Number|Space in between items| - * |`[zIncrement]`|Number|Z-translation increment used to stack the elements correctly (default: 0.001)| + * |`[zIncrement]`|Number|Z-translation increment used to stack the elements correctly (default: 2)| * |`[itemSize]`|Number/Bool|Width or height of the item (see below)| * * `itemSize` can have of the following values: @@ -8451,7 +8726,7 @@ define('famous-flex/layouts/TabBarLayout',['require','exports','module','famous/ items = context.get('items'); spacers = context.get('spacers'); margins = LayoutUtility.normalizeMargins(options.margins); - zIncrement = options.zIncrement || 0.001; + zIncrement = options.zIncrement || 2; set.size[0] = context.size[0]; set.size[1] = context.size[1]; set.size[revDirection] -= (margins[1 - revDirection] + margins[3 - revDirection]); @@ -9121,12 +9396,9 @@ define('famous-flex/widgets/TabBarController',['require','exports','module','fam * * @author: Hein Rutjes (IjzerenHein) * @license MIT - * @copyright Gloey Apps, 2014 + * @copyright Gloey Apps, 2014 - 2015 */ -/*global console*/ -/*eslint no-console: 0*/ - /** * Lays a collection of renderables from left to right or top to bottom, and when the right/bottom edge is reached, * continues at the next column/row. @@ -9134,7 +9406,7 @@ define('famous-flex/widgets/TabBarController',['require','exports','module','fam * |options|type|description| * |---|---|---| * |`[itemSize]`|Size/Function|Size of an item to layout or callback function which should return the size, e.g.: `function(renderNode, contextSize)`| - * |`[cells]`|Array.Number|Number of columns and rows: [columns, rows]. When used causes the itemSize to be calculated from the number of number of cells that should be displayed.| + * |`[cells]`|Array.[Number,true,undefined]|Number of columns and rows: [columns, rows]. When used causes the itemSize to be calculated from the number of number of cells that should be displayed.| * |`[margins]`|Number/Array|Margins shorthand (e.g. 5, [10, 20], [2, 5, 2, 10])| * |`[spacing]`|Number/Array|Spacing between items (e.g. 5, [10, 10])| * |`[justify]`|Bool/Array.Bool|Justify the renderables accross the width/height| @@ -9310,8 +9582,8 @@ define('famous-flex/layouts/CollectionLayout',['require','exports','module','fam direction = context.direction; alignment = context.alignment; lineDirection = (direction + 1) % 2; - if ((options.gutter !== undefined) && console.warn && !options.suppressWarnings) { - console.warn('option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead'); + if ((options.gutter !== undefined) && console.warn && !options.suppressWarnings) { //eslint-disable-line no-console + console.warn('option `gutter` has been deprecated for CollectionLayout, use margins & spacing instead'); //eslint-disable-line no-console } if (options.gutter && !options.margins && !options.spacing) { var gutter = Array.isArray(options.gutter) ? options.gutter : [options.gutter, options.gutter]; @@ -9336,12 +9608,12 @@ define('famous-flex/layouts/CollectionLayout',['require','exports','module','fam // Prepare item-size // if (options.cells) { - if (options.itemSize && console.warn && !options.suppressWarnings) { - console.warn('options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two'); + if (options.itemSize && console.warn && !options.suppressWarnings) { //eslint-disable-line no-console + console.warn('options `cells` and `itemSize` cannot both be specified for CollectionLayout, only use one of the two'); //eslint-disable-line no-console } itemSize = [ - (size[0] - (margins[1] + margins[3] + (spacing[0] * (options.cells[0] - 1)))) / options.cells[0], - (size[1] - (margins[0] + margins[2] + (spacing[1] * (options.cells[1] - 1)))) / options.cells[1] + ([undefined, true].indexOf(options.cells[0]) >-1) ? options.cells[0] : (size[0] - (margins[1] + margins[3] + (spacing[0] * (options.cells[0] - 1)))) / options.cells[0], + ([undefined, true].indexOf(options.cells[1]) >-1) ? options.cells[1] : (size[1] - (margins[0] + margins[2] + (spacing[1] * (options.cells[1] - 1)))) / options.cells[1] ]; } else if (!options.itemSize) { @@ -9732,6 +10004,7 @@ define('famous-flex/layouts/HeaderFooterLayout',['require','exports','module','. * |options|type|description| * |---|---|---| * |`[margins]`|Number/Array|Margins shorthand (e.g. 5, [10, 20], [2, 5, 2, 10])| + * |`[zIncrement]`|Z-translation increment used to stack the elements correctly (default: 2)| * |`[itemWidth]`|Number|Width of the left & right items| * |`[leftItemWidth]`|Number|Width of the left items| * |`[rightItemWidth]`|Number|Width of the right items| @@ -9781,12 +10054,24 @@ define('famous-flex/layouts/NavBarLayout',['require','exports','module','../help module.exports = function NavBarLayout(context, options) { var dock = new LayoutDockHelper(context, { margins: options.margins, - translateZ: 1 + translateZ: options.hasOwnProperty('zIncrement') ? options.zIncrement : 2 }); // Position background context.set('background', {size: context.size}); + // Position back-button + var backIcon = context.get('backIcon'); + if (backIcon) { + dock.left(backIcon, options.backIconWidth); + dock.left(undefined, options.leftItemSpacer || options.itemSpacer); + } + var backItem = context.get('backItem'); + if (backItem) { + dock.left(backItem, options.backItemWidth); + dock.left(undefined, options.leftItemSpacer || options.itemSpacer); + } + // Position right items var node; var i; @@ -9801,7 +10086,7 @@ define('famous-flex/layouts/NavBarLayout',['require','exports','module','../help } } - // Position left item + // Position left items var leftItems = context.get('leftItems'); if (leftItems) { for (i = 0; i < leftItems.length; i++) { @@ -9814,7 +10099,18 @@ define('famous-flex/layouts/NavBarLayout',['require','exports','module','../help } // Position title - dock.fill('title'); + var title = context.get('title'); + if (title) { + var titleSize = context.resolveSize(title, context.size); + var left = Math.max((context.size[0] - titleSize[0]) / 2, dock.get().left); + var right = Math.min((context.size[0] + titleSize[0]) / 2, dock.get().right); + left = Math.max(left, context.size[0] - right); + right = Math.min(right, context.size[0] - left); + context.set(title, { + size: [right - left, context.size[1]], + translate: [left, 0, dock.get().z] + }); + } }; }); diff --git a/dist/famous-flex.min.js b/dist/famous-flex.min.js index dd7bfea..06c6be6 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.2 -* @generated 07-05-2015 +* @version 0.3.3 +* @generated 09-06-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;cd;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.indexthis._contextState.prevSetIndex&&m.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,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=e.size&&void 0!==e._trueSizeCheck?e.size:void 0;if(g&&(g[0]===!0||g[1]===!0)){c.usesTrueSize=!0;var h=e._backupSize;if((e._contentDirty||e._trueSizeCheck)&&(this._trueSizeRequested=!0,c.trueSizeRequested=!0),e._trueSizeCheck&&h&&g!==f){var j=g[0]===!0?Math.max(h[0],f[0]):f[0],k=g[1]===!0?Math.max(h[1],f[1]):f[1];h[0]=j,h[1]=k,f=h,e._backupSize=void 0,h=void 0}(this._reevalTrueSize||h&&(h[0]!==f[0]||h[1]!==f[1]))&&(e._trueSizeCheck=!0,e._sizeDirty=!0,this._trueSizeRequested=!0),h||(e._backupSize=[0,0],h=e._backupSize),h[0]=f[0],h[1]=f[1]}return g=e._nodes?e.options.size:void 0,!g||g[0]!==!0&&g[1]!==!0||(this._reevalTrueSize||e._nodes._trueSizeRequested)&&(c.usesTrueSize=!0,c.trueSizeRequested=!0,this._trueSizeRequested=!0),(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 l=a("./LayoutContext"),m=a("./LayoutUtility"),n=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),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._z=b&&b.translateZ?b.translateZ:0,b&&b.margins){var d=e.normalizeMargins(b.margins);this._left=d[3],this._top=d[0],this._right=c[0]-d[1],this._bottom=c[1]-d[2]}else this._left=0,this._top=0,this._right=c[0],this._bottom=c[1]}var e=a("../LayoutUtility");d.prototype.parse=function(a){for(var b=0;b=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._right-this._left,this._bottom-this._top]);b=d[1]}return this._context.set(a,{size:[this._right-this._left,b],origin:[0,0],align:[0,0],translate:[this._left,this._top,void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[0]}return this._context.set(a,{size:[b,this._bottom-this._top],origin:[0,0],align:[0,0],translate:[this._left,this._top,void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[1]}return this._context.set(a,{size:[this._right-this._left,b],origin:[0,1],align:[0,1],translate:[this._left,-(this._size[1]-this._bottom),void 0===c?this._z:c]}),this._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._right-this._left,this._bottom-this._top]);b=d[0]}this._context.set(a,{size:[b,this._bottom-this._top],origin:[1,0],align:[1,0],translate:[-(this._size[0]-this._right),this._top,void 0===c?this._z:c]})}return b&&(this._right-=b),this},d.prototype.fill=function(a,b){return this._context.set(a,{size:[this._right-this._left,this._bottom-this._top],translate:[this._left,this._top,void 0===b?this._z:b]}),this},d.prototype.margins=function(a){return a=e.normalizeMargins(a),this._left+=a[3],this._top+=a[0],this._right-=a[1],this._bottom-=a[2],this},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;bd)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;da||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,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.touchMoveDirectionThresshold||c<=this.options.touchMoveDirectionThresshold)&&(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;e0&&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&&cthis._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c=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.paginationEnergyThresshold||Math.abs(this._scroll.particle.getEnergy())<=this.options.paginationEnergyThresshold)&&(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._isDirty=!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;e0?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"}},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,paginationEnergyThresshold:.01,alignment:0,touchMoveDirectionThresshold: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),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=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.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.paginationEnergyThresshold&&Math.abs(this._scroll.particle.getEnergy())>=this.options.paginationEnergyThresshold?(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(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.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=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=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){p.apply(this,arguments),f.call(this),a&&this.setOptions(a)}function e(a,b){for(var c={size:a.size,translate:[0,0,0]},d=a.get("views"),e=a.get("transferables"),f=0;f=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=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"+b+""})},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?"
"+b+"
":void 0});if(Array.isArray(a))for(var e=0;ej?j+d.upperBound:j-d.upperBound;Math.abs(k)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=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"+b+"":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=0&&a.oldIndex=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;c0?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;cm;){if(f=g.next(),!f){d(!0,!0);break}t=e(f),v+=(s.length?o[k]:0)+t[k],v>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+(j?w[j]:0),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],v>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:1});a.set("background",{size:a.size});var e,f,g=a.get("rightItems");if(g)for(f=0;fd;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.indexthis._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=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;bd)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;da||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,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;e0&&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&&cthis._scroll.springPosition||this._scroll.boundsReached===T.NEXT&&c=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;e0?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"}},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=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.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(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.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=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=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){v.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;f=2&&this._viewStack[0].state===D.HIDING&&this._viewStack[1].state===D.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=D.HIDING,d.hideCallback=function(){d.hideCallback=void 0;var a=this._viewStack.indexOf(d);this._renderables.views.splice(a,1),this._viewStack.splice(a,1),d.view=void 0,t.call(this),this.layout.reflowLayout()}.bind(this),c.halted=!0,b=c.endSpec,c.endSpec=c.startSpec,c.startSpec=b,c.state=D.SHOWING,c.showCallback=function(){c.showCallback=void 0,c.state=D.VISIBLE,t.call(this),l.call(this,c),c.endSpec=void 0,c.startSpec=void 0,a&&a()}.bind(this),u.call(this)}return this},d.prototype.get=function(){for(var a=0;a=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=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"+b+""})},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?"
"+b+"
":void 0});if(Array.isArray(a))for(var e=0;ej?j+d.upperBound:j-d.upperBound;Math.abs(k)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=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"+b+"":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=0&&a.oldIndex=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;c0?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-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+(j?0:w[j]),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],v>l&&(m+=d(!0,!f),v=t[k]),s.push({node:f,size:t})}for(m=g.scrollOffset+(j?w[j]:0),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],v>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