-
Notifications
You must be signed in to change notification settings - Fork 0
/
famous-global.min.js
13 lines (13 loc) · 189 KB
/
famous-global.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* @copyright Famous Industries, Inc. 2014
*/
!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var i;"undefined"!=typeof window?i=window:"undefined"!=typeof global?i=global:"undefined"!=typeof self&&(i=self),i.famous=t()}}(function(){return function t(i,e,n){function o(r,a){if(!e[r]){if(!i[r]){var h="function"==typeof require&&require;if(!a&&h)return h(r,!0);if(s)return s(r,!0);var c=new Error("Cannot find module '"+r+"'");throw c.code="MODULE_NOT_FOUND",c}var p=e[r]={exports:{}};i[r][0].call(p.exports,function(t){var e=i[r][1][t];return o(e?e:t)},p,p.exports,t,i,e,n)}return e[r].exports}for(var s="function"==typeof require&&require,r=0;r<n.length;r++)o(n[r]);return o}({1:[function(t,i){function e(t){return[t.clientWidth,t.clientHeight]}function n(t){this.container=t,this._allocator=new r(t),this._node=new o,this._eventOutput=new s,this._size=e(this.container),this._perspectiveState=new h(0),this._perspective=void 0,this._nodeContext={allocator:this._allocator,transform:a.identity,opacity:1,origin:c,align:c,size:this._size},this._eventOutput.on("resize",function(){this.setSize(e(this.container))}.bind(this))}var o=t("./RenderNode"),s=t("./EventHandler"),r=t("./ElementAllocator"),a=t("./Transform"),h=t("../transitions/Transitionable"),c=[0,0],p=!("perspective"in document.documentElement.style),u=p?function(t,i){t.style.webkitPerspective=i?i.toFixed()+"px":""}:function(t,i){t.style.perspective=i?i.toFixed()+"px":""};n.prototype.getAllocator=function(){return this._allocator},n.prototype.add=function(t){return this._node.add(t)},n.prototype.migrate=function(t){t!==this.container&&(this.container=t,this._allocator.migrate(t))},n.prototype.getSize=function(){return this._size},n.prototype.setSize=function(t){t||(t=e(this.container)),this._size[0]=t[0],this._size[1]=t[1]},n.prototype.update=function(t){t&&(t.transform&&(this._nodeContext.transform=t.transform),t.opacity&&(this._nodeContext.opacity=t.opacity),t.origin&&(this._nodeContext.origin=t.origin),t.align&&(this._nodeContext.align=t.align),t.size&&(this._nodeContext.size=t.size));var i=this._perspectiveState.get();i!==this._perspective&&(u(this.container,i),this._perspective=i),this._node.commit(this._nodeContext)},n.prototype.getPerspective=function(){return this._perspectiveState.get()},n.prototype.setPerspective=function(t,i,e){return this._perspectiveState.set(t,i,e)},n.prototype.emit=function(t,i){return this._eventOutput.emit(t,i)},n.prototype.on=function(t,i){return this._eventOutput.on(t,i)},n.prototype.removeListener=function(t,i){return this._eventOutput.removeListener(t,i)},n.prototype.pipe=function(t){return this._eventOutput.pipe(t)},n.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)},i.exports=n},{"../transitions/Transitionable":89,"./ElementAllocator":2,"./EventHandler":7,"./RenderNode":11,"./Transform":15}],2:[function(t,i){function e(t){t||(t=document.createDocumentFragment()),this.container=t,this.detachedNodes={},this.nodeCount=0}e.prototype.migrate=function(t){var i=this.container;if(t!==i){if(i instanceof DocumentFragment)t.appendChild(i);else for(;i.hasChildNodes();)t.appendChild(i.firstChild);this.container=t}},e.prototype.allocate=function(t){t=t.toLowerCase(),t in this.detachedNodes||(this.detachedNodes[t]=[]);var i,e=this.detachedNodes[t];return e.length>0?i=e.pop():(i=document.createElement(t),this.container.appendChild(i)),this.nodeCount++,i},e.prototype.deallocate=function(t){var i=t.nodeName.toLowerCase(),e=this.detachedNodes[i];e.push(t),this.nodeCount--},e.prototype.getNodeCount=function(){return this.nodeCount},i.exports=e},{}],3:[function(t,i){function e(t){this._matrix=null,this._opacity=1,this._origin=null,this._size=null,this._eventOutput=new c,this._eventOutput.bindThis(this),this.eventForwarder=function(t){this._eventOutput.emit(t.type,t)}.bind(this),this.id=h.register(this),this._element=null,this._sizeDirty=!1,this._originDirty=!1,this._transformDirty=!1,this._invisible=!1,t&&this.attach(t)}function n(t){for(var i in this._eventOutput.listeners)t.addEventListener(i,this.eventForwarder)}function o(t){for(var i in this._eventOutput.listeners)t.removeEventListener(i,this.eventForwarder)}function s(t){t[12]=Math.round(t[12]*l)/l,t[13]=Math.round(t[13]*l)/l;for(var i="matrix3d(",e=0;15>e;e++)i+=t[e]<1e-6&&t[e]>-1e-6?"0,":t[e]+",";return i+=t[15]+")"}function r(t){return 100*t[0]+"% "+100*t[1]+"%"}function a(t,i){return t&&i?t[0]!==i[0]||t[1]!==i[1]:t!==i}var h=t("./Entity"),c=t("./EventHandler"),p=t("./Transform"),u=!("transform"in document.documentElement.style),l=window.devicePixelRatio||1;e.prototype.on=function(t,i){this._element&&this._element.addEventListener(t,this.eventForwarder),this._eventOutput.on(t,i)},e.prototype.removeListener=function(t,i){this._eventOutput.removeListener(t,i)},e.prototype.emit=function(t,i){i&&!i.origin&&(i.origin=this);var e=this._eventOutput.emit(t,i);return e&&i&&i.stopPropagation&&i.stopPropagation(),e},e.prototype.pipe=function(t){return this._eventOutput.pipe(t)},e.prototype.unpipe=function(t){return this._eventOutput.unpipe(t)},e.prototype.render=function(){return this.id};var f;f=navigator.userAgent.toLowerCase().indexOf("firefox")>-1?function(t,i){t.style.zIndex=1e6*i[14]|0,t.style.transform=s(i)}:u?function(t,i){t.style.webkitTransform=s(i)}:function(t,i){t.style.transform=s(i)};var d=u?function(t,i){t.style.webkitTransformOrigin=r(i)}:function(t,i){t.style.transformOrigin=r(i)},_=u?function(t){t.style.webkitTransform="scale3d(0.0001,0.0001,0.0001)",t.style.opacity=0}:function(t){t.style.transform="scale3d(0.0001,0.0001,0.0001)",t.style.opacity=0};e.prototype.commit=function(t){var i=this._element;if(i){{var e=t.transform,n=t.opacity,o=t.origin;t.size}if(!e&&this._matrix)return this._matrix=null,this._opacity=0,void _(i);if(a(this._origin,o)&&(this._originDirty=!0),p.notEquals(this._matrix,e)&&(this._transformDirty=!0),this._invisible&&(this._invisible=!1,this._element.style.display=""),this._opacity!==n&&(this._opacity=n,i.style.opacity=n>=1?"0.999999":n),this._transformDirty||this._originDirty||this._sizeDirty){this._sizeDirty&&(this._sizeDirty=!1),this._originDirty&&(o?(this._origin||(this._origin=[0,0]),this._origin[0]=o[0],this._origin[1]=o[1]):this._origin=null,d(i,this._origin),this._originDirty=!1),e||(e=p.identity),this._matrix=e;var s=this._size?p.thenMove(e,[-this._size[0]*o[0],-this._size[1]*o[1],0]):e;f(i,s),this._transformDirty=!1}}},e.prototype.cleanup=function(){this._element&&(this._invisible=!0,this._element.style.display="none")},e.prototype.attach=function(t){this._element=t,n.call(this,t)},e.prototype.detach=function(){var t=this._element;return t&&(o.call(this,t),this._invisible&&(this._invisible=!1,this._element.style.display="")),this._element=null,t},i.exports=e},{"./Entity":5,"./EventHandler":7,"./Transform":15}],4:[function(t,i){function e(){w.runLoop?(f.step(),window.requestAnimationFrame(e)):O=!1}function n(){for(var t=0;t<d.length;t++)d[t].emit("resize");T.emit("resize")}function o(){window.addEventListener("touchmove",function(t){t.preventDefault()},!0),s()}function s(){return document.body?(document.body.classList.add("famous-root"),void document.documentElement.classList.add("famous-root")):void f.nextTick(s)}function r(t,i){return document.body?void document.body.addEventListener(t,i):void f.nextTick(addEventListener.bind(this,t,i))}function a(t,i){return document.body?(document.body.appendChild(i),void t.emit("resize")):void f.nextTick(a.bind(this,t,i))}var h,c,p=t("./Context"),u=t("./EventHandler"),l=t("./OptionsManager"),f={},d=[],_=[],g=0,y=0,v=[],m=Date.now(),O=!0,S={},T=new u,w={containerType:"div",containerClass:"famous-container",fpsCap:void 0,runLoop:!0,appMode:!0},b=new l(w),E=10;f.step=function(){g++,y=g;var t=Date.now();if(!(c&&c>t-m)){var i=0;h=t-m,m=t,T.emit("prerender");for(var e=_.length;e--;)_.shift()(g);for(;v.length&&Date.now()-t<E;)v.shift().call(this);for(i=0;i<d.length;i++)d[i].update();T.emit("postrender")}},window.requestAnimationFrame(e),window.addEventListener("resize",n,!1),n();var I=!1;f.pipe=function(t){return t.subscribe instanceof Function?t.subscribe(f):T.pipe(t)},f.unpipe=function(t){return t.unsubscribe instanceof Function?t.unsubscribe(f):T.unpipe(t)},f.on=function(t,i){return t in S||(S[t]=T.emit.bind(T,t),r(t,S[t])),T.on(t,i)},f.emit=function(t,i){return T.emit(t,i)},f.removeListener=function(t,i){return T.removeListener(t,i)},f.getFPS=function(){return 1e3/h},f.setFPSCap=function(t){c=Math.floor(1e3/t)},f.getOptions=function(t){return b.getOptions(t)},f.setOptions=function(){return b.setOptions.apply(b,arguments)},f.createContext=function(t){!I&&w.appMode&&f.nextTick(o);var i=!1;t||(t=document.createElement(w.containerType),t.classList.add(w.containerClass),i=!0);var e=new p(t);return f.registerContext(e),i&&a(e,t),e},f.registerContext=function(t){return d.push(t),t},f.getContexts=function(){return d},f.deregisterContext=function(t){var i=d.indexOf(t);i>=0&&d.splice(i,1)},f.nextTick=function(t){_.push(t)},f.defer=function(t){v.push(t)},b.on("change",function(t){"fpsCap"===t.id?f.setFPSCap(t.value):"runLoop"===t.id&&!O&&t.value&&(O=!0,window.requestAnimationFrame(e))}),i.exports=f},{"./Context":1,"./EventHandler":7,"./OptionsManager":10}],5:[function(t,i){function e(t){return r[t]}function n(t,i){r[t]=i}function o(t){var i=r.length;return n(i,t),i}function s(t){n(t,null)}var r=[];i.exports={register:o,unregister:s,get:e,set:n}},{}],6:[function(t,i){function e(){this.listeners={},this._owner=this}e.prototype.emit=function(t,i){var e=this.listeners[t];if(e)for(var n=0;n<e.length;n++)e[n].call(this._owner,i);return this},e.prototype.on=function(t,i){t in this.listeners||(this.listeners[t]=[]);var e=this.listeners[t].indexOf(i);return 0>e&&this.listeners[t].push(i),this},e.prototype.addListener=e.prototype.on,e.prototype.removeListener=function(t,i){var e=this.listeners[t];if(void 0!==e){var n=e.indexOf(i);n>=0&&e.splice(n,1)}return this},e.prototype.bindThis=function(t){this._owner=t},i.exports=e},{}],7:[function(t,i){function e(){n.apply(this,arguments),this.downstream=[],this.downstreamFn=[],this.upstream=[],this.upstreamListeners={}}var n=t("./EventEmitter");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.setInputHandler=function(t,i){t.trigger=i.trigger.bind(i),i.subscribe&&i.unsubscribe&&(t.subscribe=i.subscribe.bind(i),t.unsubscribe=i.unsubscribe.bind(i))},e.setOutputHandler=function(t,i){i instanceof e&&i.bindThis(t),t.pipe=i.pipe.bind(i),t.unpipe=i.unpipe.bind(i),t.on=i.on.bind(i),t.addListener=t.on,t.removeListener=i.removeListener.bind(i)},e.prototype.emit=function(t,i){n.prototype.emit.apply(this,arguments);var e=0;for(e=0;e<this.downstream.length;e++)this.downstream[e].trigger&&this.downstream[e].trigger(t,i);for(e=0;e<this.downstreamFn.length;e++)this.downstreamFn[e](t,i);return this},e.prototype.trigger=e.prototype.emit,e.prototype.pipe=function(t){if(t.subscribe instanceof Function)return t.subscribe(this);var i=t instanceof Function?this.downstreamFn:this.downstream,e=i.indexOf(t);return 0>e&&i.push(t),t instanceof Function?t("pipe",null):t.trigger&&t.trigger("pipe",null),t},e.prototype.unpipe=function(t){if(t.unsubscribe instanceof Function)return t.unsubscribe(this);var i=t instanceof Function?this.downstreamFn:this.downstream,e=i.indexOf(t);return e>=0?(i.splice(e,1),t instanceof Function?t("unpipe",null):t.trigger&&t.trigger("unpipe",null),t):!1},e.prototype.on=function(t){if(n.prototype.on.apply(this,arguments),!(t in this.upstreamListeners)){var i=this.trigger.bind(this,t);this.upstreamListeners[t]=i;for(var e=0;e<this.upstream.length;e++)this.upstream[e].on(t,i)}return this},e.prototype.addListener=e.prototype.on,e.prototype.subscribe=function(t){var i=this.upstream.indexOf(t);if(0>i){this.upstream.push(t);for(var e in this.upstreamListeners)t.on(e,this.upstreamListeners[e])}return this},e.prototype.unsubscribe=function(t){var i=this.upstream.indexOf(t);if(i>=0){this.upstream.splice(i,1);for(var e in this.upstreamListeners)t.removeListener(e,this.upstreamListeners[e])}return this},i.exports=e},{"./EventEmitter":6}],8:[function(t,i){function e(t){s.call(this,t),this._shouldRecalculateSize=!1,this._container=document.createDocumentFragment(),this.context=new n(this._container),this.setContent(this._container),this._groupSize=[void 0,void 0]}var n=t("./Context"),o=t("./Transform"),s=t("./Surface");e.SIZE_ZERO=[0,0],e.prototype=Object.create(s.prototype),e.prototype.elementType="div",e.prototype.elementClass="famous-group",e.prototype.add=function(){return this.context.add.apply(this.context,arguments)},e.prototype.render=function(){return s.prototype.render.call(this)},e.prototype.deploy=function(t){this.context.migrate(t)},e.prototype.recall=function(){this._container=document.createDocumentFragment(),this.context.migrate(this._container)},e.prototype.commit=function(t){var i=t.transform,n=t.origin,r=t.opacity,a=t.size,h=s.prototype.commit.call(this,{allocator:t.allocator,transform:o.thenMove(i,[-n[0]*a[0],-n[1]*a[1],0]),opacity:r,origin:n,size:e.SIZE_ZERO});return(a[0]!==this._groupSize[0]||a[1]!==this._groupSize[1])&&(this._groupSize[0]=a[0],this._groupSize[1]=a[1],this.context.setSize(a)),this.context.update({transform:o.translate(-n[0]*a[0],-n[1]*a[1],0),origin:n,size:a}),h},i.exports=e},{"./Context":1,"./Surface":14,"./Transform":15}],9:[function(t,i){function e(t){this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null,this._legacyStates={},this._output={transform:o.identity,opacity:1,origin:null,align:null,size:null,proportions:null,target:null},t&&(t.transform&&this.transformFrom(t.transform),void 0!==t.opacity&&this.opacityFrom(t.opacity),t.origin&&this.originFrom(t.origin),t.align&&this.alignFrom(t.align),t.size&&this.sizeFrom(t.size),t.proportions&&this.proportionsFrom(t.proportions))}function n(){this._transformGetter&&(this._output.transform=this._transformGetter()),this._opacityGetter&&(this._output.opacity=this._opacityGetter()),this._originGetter&&(this._output.origin=this._originGetter()),this._alignGetter&&(this._output.align=this._alignGetter()),this._sizeGetter&&(this._output.size=this._sizeGetter()),this._proportionGetter&&(this._output.proportions=this._proportionGetter())}var o=t("./Transform"),s=t("../transitions/Transitionable"),r=t("../transitions/TransitionableTransform");e.prototype.transformFrom=function(t){return t instanceof Function?this._transformGetter=t:t instanceof Object&&t.get?this._transformGetter=t.get.bind(t):(this._transformGetter=null,this._output.transform=t),this},e.prototype.opacityFrom=function(t){return t instanceof Function?this._opacityGetter=t:t instanceof Object&&t.get?this._opacityGetter=t.get.bind(t):(this._opacityGetter=null,this._output.opacity=t),this},e.prototype.originFrom=function(t){return t instanceof Function?this._originGetter=t:t instanceof Object&&t.get?this._originGetter=t.get.bind(t):(this._originGetter=null,this._output.origin=t),this},e.prototype.alignFrom=function(t){return t instanceof Function?this._alignGetter=t:t instanceof Object&&t.get?this._alignGetter=t.get.bind(t):(this._alignGetter=null,this._output.align=t),this},e.prototype.sizeFrom=function(t){return t instanceof Function?this._sizeGetter=t:t instanceof Object&&t.get?this._sizeGetter=t.get.bind(t):(this._sizeGetter=null,this._output.size=t),this},e.prototype.proportionsFrom=function(t){return t instanceof Function?this._proportionGetter=t:t instanceof Object&&t.get?this._proportionGetter=t.get.bind(t):(this._proportionGetter=null,this._output.proportions=t),this},e.prototype.setTransform=function(t,i,e){return i||this._legacyStates.transform?(this._legacyStates.transform||(this._legacyStates.transform=new r(this._output.transform)),this._transformGetter||this.transformFrom(this._legacyStates.transform),this._legacyStates.transform.set(t,i,e),this):this.transformFrom(t)},e.prototype.setOpacity=function(t,i,e){return i||this._legacyStates.opacity?(this._legacyStates.opacity||(this._legacyStates.opacity=new s(this._output.opacity)),this._opacityGetter||this.opacityFrom(this._legacyStates.opacity),this._legacyStates.opacity.set(t,i,e)):this.opacityFrom(t)},e.prototype.setOrigin=function(t,i,e){return i||this._legacyStates.origin?(this._legacyStates.origin||(this._legacyStates.origin=new s(this._output.origin||[0,0])),this._originGetter||this.originFrom(this._legacyStates.origin),this._legacyStates.origin.set(t,i,e),this):this.originFrom(t)},e.prototype.setAlign=function(t,i,e){return i||this._legacyStates.align?(this._legacyStates.align||(this._legacyStates.align=new s(this._output.align||[0,0])),this._alignGetter||this.alignFrom(this._legacyStates.align),this._legacyStates.align.set(t,i,e),this):this.alignFrom(t)},e.prototype.setSize=function(t,i,e){return t&&(i||this._legacyStates.size)?(this._legacyStates.size||(this._legacyStates.size=new s(this._output.size||[0,0])),this._sizeGetter||this.sizeFrom(this._legacyStates.size),this._legacyStates.size.set(t,i,e),this):this.sizeFrom(t)},e.prototype.setProportions=function(t,i,e){return t&&(i||this._legacyStates.proportions)?(this._legacyStates.proportions||(this._legacyStates.proportions=new s(this._output.proportions||[0,0])),this._proportionGetter||this.proportionsFrom(this._legacyStates.proportions),this._legacyStates.proportions.set(t,i,e),this):this.proportionsFrom(t)},e.prototype.halt=function(){this._legacyStates.transform&&this._legacyStates.transform.halt(),this._legacyStates.opacity&&this._legacyStates.opacity.halt(),this._legacyStates.origin&&this._legacyStates.origin.halt(),this._legacyStates.align&&this._legacyStates.align.halt(),this._legacyStates.size&&this._legacyStates.size.halt(),this._legacyStates.proportions&&this._legacyStates.proportions.halt(),this._transformGetter=null,this._opacityGetter=null,this._originGetter=null,this._alignGetter=null,this._sizeGetter=null,this._proportionGetter=null},e.prototype.getTransform=function(){return this._transformGetter()},e.prototype.getFinalTransform=function(){return this._legacyStates.transform?this._legacyStates.transform.getFinal():this._output.transform},e.prototype.getOpacity=function(){return this._opacityGetter()},e.prototype.getOrigin=function(){return this._originGetter()},e.prototype.getAlign=function(){return this._alignGetter()},e.prototype.getSize=function(){return this._sizeGetter?this._sizeGetter():this._output.size},e.prototype.getProportions=function(){return this._proportionGetter?this._proportionGetter():this._output.proportions},e.prototype.modify=function(t){return n.call(this),this._output.target=t,this._output},i.exports=e},{"../transitions/Transitionable":89,"../transitions/TransitionableTransform":90,"./Transform":15}],10:[function(t,i){function e(t){this._value=t,this.eventOutput=null}function n(){this.eventOutput=new o,this.eventOutput.bindThis(this),o.setOutputHandler(this,this.eventOutput)}var o=t("./EventHandler");e.patch=function(t){for(var i=new e(t),n=1;n<arguments.length;n++)i.patch(arguments[n]);return t},e.prototype.patch=function(){for(var t=this._value,i=0;i<arguments.length;i++){var e=arguments[i];for(var n in e)n in t&&e[n]&&e[n].constructor===Object&&t[n]&&t[n].constructor===Object?(t.hasOwnProperty(n)||(t[n]=Object.create(t[n])),this.key(n).patch(e[n]),this.eventOutput&&this.eventOutput.emit("change",{id:n,value:this.key(n).value()})):this.set(n,e[n])}return this},e.prototype.setOptions=e.prototype.patch,e.prototype.key=function(t){var i=new e(this._value[t]);return(!(i._value instanceof Object)||i._value instanceof Array)&&(i._value={}),i},e.prototype.get=function(t){return t?this._value[t]:this._value},e.prototype.getOptions=e.prototype.get,e.prototype.set=function(t,i){var e=this.get(t);return this._value[t]=i,this.eventOutput&&i!==e&&this.eventOutput.emit("change",{id:t,value:i}),this},e.prototype.on=function(){return n.call(this),this.on.apply(this,arguments)},e.prototype.removeListener=function(){return n.call(this),this.removeListener.apply(this,arguments)},e.prototype.pipe=function(){return n.call(this),this.pipe.apply(this,arguments)},e.prototype.unpipe=function(){return n.call(this),this.unpipe.apply(this,arguments)},i.exports=e},{"./EventHandler":7}],11:[function(t,i){function e(t){this._object=null,this._child=null,this._hasMultipleChildren=!1,this._isRenderable=!1,this._isModifier=!1,this._resultCache={},this._prevResults={},this._childResult=null,t&&this.set(t)}function n(t,i,e){for(var r=s.parse(t,i),a=Object.keys(r),h=0;h<a.length;h++){var c=a[h],p=o.get(c),u=r[c];u.allocator=i.allocator;var l=p.commit(u);l?n(l,i,e):e[c]=u}}var o=t("./Entity"),s=t("./SpecParser");e.prototype.add=function(t){var i=t instanceof e?t:new e(t);return this._child instanceof Array?this._child.push(i):this._child?(this._child=[this._child,i],this._hasMultipleChildren=!0,this._childResult=[]):this._child=i,i},e.prototype.get=function(){return this._object||(this._hasMultipleChildren?null:this._child?this._child.get():null)},e.prototype.set=function(t){return this._childResult=null,this._hasMultipleChildren=!1,this._isRenderable=t.render?!0:!1,this._isModifier=t.modify?!0:!1,this._object=t,this._child=null,t instanceof e?t:this},e.prototype.getSize=function(){var t=null,i=this.get();return i&&i.getSize&&(t=i.getSize()),!t&&this._child&&this._child.getSize&&(t=this._child.getSize()),t},e.prototype.commit=function(t){for(var i=Object.keys(this._prevResults),e=0;e<i.length;e++){var s=i[e];if(void 0===this._resultCache[s]){var r=o.get(s);r.cleanup&&r.cleanup(t.allocator)}}this._prevResults=this._resultCache,this._resultCache={},n(this.render(),t,this._resultCache)},e.prototype.render=function(){if(this._isRenderable)return this._object.render();var t=null;if(this._hasMultipleChildren){t=this._childResult;for(var i=this._child,e=0;e<i.length;e++)t[e]=i[e].render()}else this._child&&(t=this._child.render());return this._isModifier?this._object.modify(t):t},i.exports=e},{"./Entity":5,"./SpecParser":13}],12:[function(t,i){function e(t){this.id=null,this._objects=null,this.node=new c,this._definition=null,t&&this.load(t)}function n(t){for(var i in p)if(i in t){var e=t[i];return e instanceof Array||(e=[e]),p[i].apply(this,e)}}function o(t){var i=t.transform,e=t.opacity,o=t.origin,s=t.align,r=t.size,c=a.identity;if(i instanceof Array)if(16===i.length&&"number"==typeof i[0])c=i;else for(var p=0;p<i.length;p++)c=a.multiply(c,n(i[p]));else i instanceof Function?c=i:i instanceof Object&&(c=n(i));var u=new h({transform:c,opacity:e,origin:o,align:s,size:r});return u}function s(t){for(var i=new c,e=0;e<t.length;e++){var n=r.call(this,t[e]);n&&i.add(n)}return i}function r(t){var i,e;if(t instanceof Array)i=s.call(this,t);else if(e=this._objects.length,t.render&&t.render instanceof Function)i=t;else if(t.target){var n=r.call(this,t.target),a=o.call(this,t);i=new c(a),i.add(n),t.id&&(this.id[t.id]=a)}else t.id&&(i=new c,this.id[t.id]=i);return this._objects[e]=i,i}var a=t("./Transform"),h=t("./Modifier"),c=t("./RenderNode"),p={translate:a.translate,rotate:a.rotate,rotateX:a.rotateX,rotateY:a.rotateY,rotateZ:a.rotateZ,rotateAxis:a.rotateAxis,scale:a.scale,skew:a.skew,matrix3d:function(){return arguments}};e.prototype.create=function(){return new e(this._definition)},e.prototype.load=function(t){this._definition=t,this.id={},this._objects=[],this.node.set(r.call(this,t))},e.prototype.add=function(){return this.node.add.apply(this.node,arguments)},e.prototype.render=function(){return this.node.render.apply(this.node,arguments)},i.exports=e},{"./Modifier":9,"./RenderNode":11,"./Transform":15}],13:[function(t,i){function e(){this.result={}}function n(t,i){return[t[0]*i[0]+t[1]*i[4]+t[2]*i[8],t[0]*i[1]+t[1]*i[5]+t[2]*i[9],t[0]*i[2]+t[1]*i[6]+t[2]*i[10]]}var o=t("./Transform");e._instance=new e,e.parse=function(t,i){return e._instance.parse(t,i)},e.prototype.parse=function(t,i){return this.reset(),this._parseSpec(t,i,o.identity),this.result},e.prototype.reset=function(){this.result={}};var s=[0,0];e.prototype._parseSpec=function(t,i,e){var r,a,h,c,p,u,l;if("number"==typeof t){if(r=t,h=i.transform,u=i.align||s,i.size&&u&&(u[0]||u[1])){var f=[u[0]*i.size[0],u[1]*i.size[1],0];h=o.thenMove(h,n(f,e))}this.result[r]={transform:h,opacity:i.opacity,origin:i.origin||s,align:i.align||s,size:i.size}}else{if(!t)return;if(t instanceof Array)for(var d=0;d<t.length;d++)this._parseSpec(t[d],i,e);else{a=t.target,h=i.transform,c=i.opacity,p=i.origin,u=i.align,l=i.size;var _=e;if(void 0!==t.opacity&&(c=i.opacity*t.opacity),t.transform&&(h=o.multiply(i.transform,t.transform)),t.origin&&(p=t.origin,_=i.transform),t.align&&(u=t.align),t.size||t.proportions){var g=l;l=[l[0],l[1]],t.size&&(void 0!==t.size[0]&&(l[0]=t.size[0]),void 0!==t.size[1]&&(l[1]=t.size[1])),t.proportions&&(void 0!==t.proportions[0]&&(l[0]=l[0]*t.proportions[0]),void 0!==t.proportions[1]&&(l[1]=l[1]*t.proportions[1])),g&&(u&&(u[0]||u[1])&&(h=o.thenMove(h,n([u[0]*g[0],u[1]*g[1],0],e))),p&&(p[0]||p[1])&&(h=o.moveThen([-p[0]*l[0],-p[1]*l[1],0],h))),_=i.transform,p=null,u=null}this._parseSpec(a,{transform:h,opacity:c,origin:p,align:u,size:l},_)}}},i.exports=e},{"./Transform":15}],14:[function(t,i){function e(t){c.call(this),this.options={},this.properties={},this.attributes={},this.content="",this.classList=[],this.size=null,this._classesDirty=!0,this._stylesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._trueSizeCheck=!0,this._dirtyClasses=[],t&&this.setOptions(t),this._currentTarget=null}function n(t){for(var i=0;i<this._dirtyClasses.length;i++)t.classList.remove(this._dirtyClasses[i]);this._dirtyClasses=[]}function o(t){for(var i in this.properties)t.style[i]=this.properties[i]}function s(t){for(var i in this.properties)t.style[i]=""}function r(t){for(var i in this.attributes)t.setAttribute(i,this.attributes[i])}function a(t){for(var i in this.attributes)t.removeAttribute(i)}function h(t,i){return t&&i?t[0]!==i[0]||t[1]!==i[1]:t!==i}var c=t("./ElementOutput");e.prototype=Object.create(c.prototype),e.prototype.constructor=e,e.prototype.elementType="div",e.prototype.elementClass="famous-surface",e.prototype.setAttributes=function(t){for(var i in t){if("style"===i)throw new Error('Cannot set styles via "setAttributes" as it will break Famo.us. Use "setProperties" instead.');this.attributes[i]=t[i]}this._attributesDirty=!0},e.prototype.getAttributes=function(){return this.attributes},e.prototype.setProperties=function(t){for(var i in t)this.properties[i]=t[i];return this._stylesDirty=!0,this},e.prototype.getProperties=function(){return this.properties},e.prototype.addClass=function(t){return this.classList.indexOf(t)<0&&(this.classList.push(t),this._classesDirty=!0),this},e.prototype.removeClass=function(t){var i=this.classList.indexOf(t);return i>=0&&(this._dirtyClasses.push(this.classList.splice(i,1)[0]),this._classesDirty=!0),this},e.prototype.toggleClass=function(t){var i=this.classList.indexOf(t);return i>=0?this.removeClass(t):this.addClass(t),this},e.prototype.setClasses=function(t){var i=0,e=[];for(i=0;i<this.classList.length;i++)t.indexOf(this.classList[i])<0&&e.push(this.classList[i]);for(i=0;i<e.length;i++)this.removeClass(e[i]);for(i=0;i<t.length;i++)this.addClass(t[i]);return this},e.prototype.getClassList=function(){return this.classList},e.prototype.setContent=function(t){return this.content!==t&&(this.content=t,this._contentDirty=!0),this},e.prototype.getContent=function(){return this.content},e.prototype.setOptions=function(t){return t.size&&this.setSize(t.size),t.classes&&this.setClasses(t.classes),t.properties&&this.setProperties(t.properties),t.attributes&&this.setAttributes(t.attributes),t.content&&this.setContent(t.content),this},e.prototype.setup=function(t){var i=t.allocate(this.elementType);if(this.elementClass)if(this.elementClass instanceof Array)for(var e=0;e<this.elementClass.length;e++)i.classList.add(this.elementClass[e]);else i.classList.add(this.elementClass);i.style.display="",this.attach(i),this._opacity=null,this._currentTarget=i,this._stylesDirty=!0,this._classesDirty=!0,this._attributesDirty=!0,this._sizeDirty=!0,this._contentDirty=!0,this._originDirty=!0,this._transformDirty=!0},e.prototype.commit=function(t){this._currentTarget||this.setup(t.allocator);var i=this._currentTarget,e=t.size;if(this._classesDirty){n.call(this,i);for(var s=this.getClassList(),a=0;a<s.length;a++)i.classList.add(s[a]);this._classesDirty=!1,this._trueSizeCheck=!0}if(this._stylesDirty&&(o.call(this,i),this._stylesDirty=!1,this._trueSizeCheck=!0),this._attributesDirty&&(r.call(this,i),this._attributesDirty=!1,this._trueSizeCheck=!0),this.size){var p=t.size;if(e=[this.size[0],this.size[1]],void 0===e[0]&&(e[0]=p[0]),void 0===e[1]&&(e[1]=p[1]),e[0]===!0||e[1]===!0){if(e[0]===!0)if(this._trueSizeCheck||0===this._size[0]){var u=i.offsetWidth;this._size&&this._size[0]!==u&&(this._size[0]=u,this._sizeDirty=!0),e[0]=u}else this._size&&(e[0]=this._size[0]);if(e[1]===!0)if(this._trueSizeCheck||0===this._size[1]){var l=i.offsetHeight;this._size&&this._size[1]!==l&&(this._size[1]=l,this._sizeDirty=!0),e[1]=l}else this._size&&(e[1]=this._size[1]);this._trueSizeCheck=!1}}h(this._size,e)&&(this._size||(this._size=[0,0]),this._size[0]=e[0],this._size[1]=e[1],this._sizeDirty=!0),this._sizeDirty&&(this._size&&(i.style.width=this.size&&this.size[0]===!0?"":this._size[0]+"px",i.style.height=this.size&&this.size[1]===!0?"":this._size[1]+"px"),this._eventOutput.emit("resize")),this._contentDirty&&(this.deploy(i),this._eventOutput.emit("deploy"),this._contentDirty=!1,this._trueSizeCheck=!0),c.prototype.commit.call(this,t)},e.prototype.cleanup=function(t){var i=0,e=this._currentTarget;this._eventOutput.emit("recall"),this.recall(e),e.style.display="none",e.style.opacity="",e.style.width="",e.style.height="",s.call(this,e),a.call(this,e);var o=this.getClassList();for(n.call(this,e),i=0;i<o.length;i++)e.classList.remove(o[i]);if(this.elementClass)if(this.elementClass instanceof Array)for(i=0;i<this.elementClass.length;i++)e.classList.remove(this.elementClass[i]);else e.classList.remove(this.elementClass);this.detach(e),this._currentTarget=null,t.deallocate(e)},e.prototype.deploy=function(t){var i=this.getContent();if(i instanceof Node){for(;t.hasChildNodes();)t.removeChild(t.firstChild);t.appendChild(i)}else t.innerHTML=i},e.prototype.recall=function(t){for(var i=document.createDocumentFragment();t.hasChildNodes();)i.appendChild(t.firstChild);this.setContent(i)},e.prototype.getSize=function(){return this._size?this._size:this.size},e.prototype.setSize=function(t){return this.size=t?[t[0],t[1]]:null,this._sizeDirty=!0,this},i.exports=e},{"./ElementOutput":3}],15:[function(t,i){function e(t){return 2===t.length?t[0]*t[0]+t[1]*t[1]:t[0]*t[0]+t[1]*t[1]+t[2]*t[2]}function n(t){return Math.sqrt(e(t))}function o(t){return 0>t?-1:1}var s={};s.precision=1e-6,s.identity=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],s.multiply4x4=function(t,i){return[t[0]*i[0]+t[4]*i[1]+t[8]*i[2]+t[12]*i[3],t[1]*i[0]+t[5]*i[1]+t[9]*i[2]+t[13]*i[3],t[2]*i[0]+t[6]*i[1]+t[10]*i[2]+t[14]*i[3],t[3]*i[0]+t[7]*i[1]+t[11]*i[2]+t[15]*i[3],t[0]*i[4]+t[4]*i[5]+t[8]*i[6]+t[12]*i[7],t[1]*i[4]+t[5]*i[5]+t[9]*i[6]+t[13]*i[7],t[2]*i[4]+t[6]*i[5]+t[10]*i[6]+t[14]*i[7],t[3]*i[4]+t[7]*i[5]+t[11]*i[6]+t[15]*i[7],t[0]*i[8]+t[4]*i[9]+t[8]*i[10]+t[12]*i[11],t[1]*i[8]+t[5]*i[9]+t[9]*i[10]+t[13]*i[11],t[2]*i[8]+t[6]*i[9]+t[10]*i[10]+t[14]*i[11],t[3]*i[8]+t[7]*i[9]+t[11]*i[10]+t[15]*i[11],t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12]*i[15],t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13]*i[15],t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14]*i[15],t[3]*i[12]+t[7]*i[13]+t[11]*i[14]+t[15]*i[15]]},s.multiply=function(t,i){return[t[0]*i[0]+t[4]*i[1]+t[8]*i[2],t[1]*i[0]+t[5]*i[1]+t[9]*i[2],t[2]*i[0]+t[6]*i[1]+t[10]*i[2],0,t[0]*i[4]+t[4]*i[5]+t[8]*i[6],t[1]*i[4]+t[5]*i[5]+t[9]*i[6],t[2]*i[4]+t[6]*i[5]+t[10]*i[6],0,t[0]*i[8]+t[4]*i[9]+t[8]*i[10],t[1]*i[8]+t[5]*i[9]+t[9]*i[10],t[2]*i[8]+t[6]*i[9]+t[10]*i[10],0,t[0]*i[12]+t[4]*i[13]+t[8]*i[14]+t[12],t[1]*i[12]+t[5]*i[13]+t[9]*i[14]+t[13],t[2]*i[12]+t[6]*i[13]+t[10]*i[14]+t[14],1]
},s.thenMove=function(t,i){return i[2]||(i[2]=0),[t[0],t[1],t[2],0,t[4],t[5],t[6],0,t[8],t[9],t[10],0,t[12]+i[0],t[13]+i[1],t[14]+i[2],1]},s.moveThen=function(t,i){t[2]||(t[2]=0);var e=t[0]*i[0]+t[1]*i[4]+t[2]*i[8],n=t[0]*i[1]+t[1]*i[5]+t[2]*i[9],o=t[0]*i[2]+t[1]*i[6]+t[2]*i[10];return s.thenMove(i,[e,n,o])},s.translate=function(t,i,e){return void 0===e&&(e=0),[1,0,0,0,0,1,0,0,0,0,1,0,t,i,e,1]},s.thenScale=function(t,i){return[i[0]*t[0],i[1]*t[1],i[2]*t[2],0,i[0]*t[4],i[1]*t[5],i[2]*t[6],0,i[0]*t[8],i[1]*t[9],i[2]*t[10],0,i[0]*t[12],i[1]*t[13],i[2]*t[14],1]},s.scale=function(t,i,e){return void 0===e&&(e=1),void 0===i&&(i=t),[t,0,0,0,0,i,0,0,0,0,e,0,0,0,0,1]},s.rotateX=function(t){var i=Math.cos(t),e=Math.sin(t);return[1,0,0,0,0,i,e,0,0,-e,i,0,0,0,0,1]},s.rotateY=function(t){var i=Math.cos(t),e=Math.sin(t);return[i,0,-e,0,0,1,0,0,e,0,i,0,0,0,0,1]},s.rotateZ=function(t){var i=Math.cos(t),e=Math.sin(t);return[i,e,0,0,-e,i,0,0,0,0,1,0,0,0,0,1]},s.rotate=function(t,i,e){var n=Math.cos(t),o=Math.sin(t),s=Math.cos(i),r=Math.sin(i),a=Math.cos(e),h=Math.sin(e),c=[s*a,n*h+o*r*a,o*h-n*r*a,0,-s*h,n*a-o*r*h,o*a+n*r*h,0,r,-o*s,n*s,0,0,0,0,1];return c},s.rotateAxis=function(t,i){var e=Math.sin(i),n=Math.cos(i),o=1-n,s=t[0]*t[0]*o,r=t[0]*t[1]*o,a=t[0]*t[2]*o,h=t[1]*t[1]*o,c=t[1]*t[2]*o,p=t[2]*t[2]*o,u=t[0]*e,l=t[1]*e,f=t[2]*e,d=[s+n,r+f,a-l,0,r-f,h+n,c+u,0,a+l,c-u,p+n,0,0,0,0,1];return d},s.aboutOrigin=function(t,i){var e=t[0]-(t[0]*i[0]+t[1]*i[4]+t[2]*i[8]),n=t[1]-(t[0]*i[1]+t[1]*i[5]+t[2]*i[9]),o=t[2]-(t[0]*i[2]+t[1]*i[6]+t[2]*i[10]);return s.thenMove(i,[e,n,o])},s.skew=function(t,i,e){return[1,Math.tan(i),0,0,Math.tan(e),1,0,0,0,Math.tan(t),1,0,0,0,0,1]},s.skewX=function(t){return[1,0,0,0,Math.tan(t),1,0,0,0,0,1,0,0,0,0,1]},s.skewY=function(t){return[1,Math.tan(t),0,0,0,1,0,0,0,0,1,0,0,0,0,1]},s.perspective=function(t){return[1,0,0,0,0,1,0,0,0,0,1,-1/t,0,0,0,1]},s.getTranslate=function(t){return[t[12],t[13],t[14]]},s.inverse=function(t){var i=t[5]*t[10]-t[6]*t[9],e=t[4]*t[10]-t[6]*t[8],n=t[4]*t[9]-t[5]*t[8],o=t[1]*t[10]-t[2]*t[9],s=t[0]*t[10]-t[2]*t[8],r=t[0]*t[9]-t[1]*t[8],a=t[1]*t[6]-t[2]*t[5],h=t[0]*t[6]-t[2]*t[4],c=t[0]*t[5]-t[1]*t[4],p=t[0]*i-t[1]*e+t[2]*n,u=1/p,l=[u*i,-u*o,u*a,0,-u*e,u*s,-u*h,0,u*n,-u*r,u*c,0,0,0,0,1];return l[12]=-t[12]*l[0]-t[13]*l[4]-t[14]*l[8],l[13]=-t[12]*l[1]-t[13]*l[5]-t[14]*l[9],l[14]=-t[12]*l[2]-t[13]*l[6]-t[14]*l[10],l},s.transpose=function(t){return[t[0],t[4],t[8],t[12],t[1],t[5],t[9],t[13],t[2],t[6],t[10],t[14],t[3],t[7],t[11],t[15]]},s.interpret=function(t){var i=[t[0],t[1],t[2]],r=o(i[0]),a=n(i),h=[i[0]+r*a,i[1],i[2]],c=2/e(h);if(c>=1/0)return{translate:s.getTranslate(t),rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]};var p=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];p[0]=1-c*h[0]*h[0],p[5]=1-c*h[1]*h[1],p[10]=1-c*h[2]*h[2],p[1]=-c*h[0]*h[1],p[2]=-c*h[0]*h[2],p[6]=-c*h[1]*h[2],p[4]=p[1],p[8]=p[2],p[9]=p[6];var u=s.multiply(p,t),l=[u[5],u[6]],f=o(l[0]),d=n(l),_=[l[0]+f*d,l[1]],g=2/e(_),y=[1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1];y[5]=1-g*_[0]*_[0],y[10]=1-g*_[1]*_[1],y[6]=-g*_[0]*_[1],y[9]=y[6];var v=s.multiply(y,p),m=s.multiply(v,t),O=s.scale(m[0]<0?-1:1,m[5]<0?-1:1,m[10]<0?-1:1);m=s.multiply(m,O),v=s.multiply(O,v);var S={};return S.translate=s.getTranslate(t),S.rotate=[Math.atan2(-v[6],v[10]),Math.asin(v[2]),Math.atan2(-v[1],v[0])],S.rotate[0]||(S.rotate[0]=0,S.rotate[2]=Math.atan2(v[4],v[5])),S.scale=[m[0],m[5],m[10]],S.skew=[Math.atan2(m[9],S.scale[2]),Math.atan2(m[8],S.scale[2]),Math.atan2(m[4],S.scale[0])],Math.abs(S.rotate[0])+Math.abs(S.rotate[2])>1.5*Math.PI&&(S.rotate[1]=Math.PI-S.rotate[1],S.rotate[1]>Math.PI&&(S.rotate[1]-=2*Math.PI),S.rotate[1]<-Math.PI&&(S.rotate[1]+=2*Math.PI),S.rotate[0]<0?S.rotate[0]+=Math.PI:S.rotate[0]-=Math.PI,S.rotate[2]<0?S.rotate[2]+=Math.PI:S.rotate[2]-=Math.PI),S},s.average=function(t,i,e){e=void 0===e?.5:e;for(var n=s.interpret(t),o=s.interpret(i),r={translate:[0,0,0],rotate:[0,0,0],scale:[0,0,0],skew:[0,0,0]},a=0;3>a;a++)r.translate[a]=(1-e)*n.translate[a]+e*o.translate[a],r.rotate[a]=(1-e)*n.rotate[a]+e*o.rotate[a],r.scale[a]=(1-e)*n.scale[a]+e*o.scale[a],r.skew[a]=(1-e)*n.skew[a]+e*o.skew[a];return s.build(r)},s.build=function(t){var i=s.scale(t.scale[0],t.scale[1],t.scale[2]),e=s.skew(t.skew[0],t.skew[1],t.skew[2]),n=s.rotate(t.rotate[0],t.rotate[1],t.rotate[2]);return s.thenMove(s.multiply(s.multiply(n,e),i),t.translate)},s.equals=function(t,i){return!s.notEquals(t,i)},s.notEquals=function(t,i){return t===i?!1:!(t&&i)||t[12]!==i[12]||t[13]!==i[13]||t[14]!==i[14]||t[0]!==i[0]||t[1]!==i[1]||t[2]!==i[2]||t[4]!==i[4]||t[5]!==i[5]||t[6]!==i[6]||t[8]!==i[8]||t[9]!==i[9]||t[10]!==i[10]},s.normalizeRotation=function(t){var i=t.slice(0);for((i[0]===.5*Math.PI||i[0]===.5*-Math.PI)&&(i[0]=-i[0],i[1]=Math.PI-i[1],i[2]-=Math.PI),i[0]>.5*Math.PI&&(i[0]=i[0]-Math.PI,i[1]=Math.PI-i[1],i[2]-=Math.PI),i[0]<.5*-Math.PI&&(i[0]=i[0]+Math.PI,i[1]=-Math.PI-i[1],i[2]-=Math.PI);i[1]<-Math.PI;)i[1]+=2*Math.PI;for(;i[1]>=Math.PI;)i[1]-=2*Math.PI;for(;i[2]<-Math.PI;)i[2]+=2*Math.PI;for(;i[2]>=Math.PI;)i[2]-=2*Math.PI;return i},s.inFront=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,.001,1],s.behind=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,-.001,1],i.exports=s},{}],16:[function(t,i){function e(t){this._node=new s,this._eventInput=new n,this._eventOutput=new n,n.setInputHandler(this,this._eventInput),n.setOutputHandler(this,this._eventOutput),this.options=r.clone(this.constructor.DEFAULT_OPTIONS||e.DEFAULT_OPTIONS),this._optionsManager=new o(this.options),t&&this.setOptions(t)}var n=t("./EventHandler"),o=t("./OptionsManager"),s=t("./RenderNode"),r=t("../utilities/Utility");e.DEFAULT_OPTIONS={},e.prototype.getOptions=function(t){return this._optionsManager.getOptions(t)},e.prototype.setOptions=function(t){this._optionsManager.patch(t)},e.prototype.add=function(){return this._node.add.apply(this._node,arguments)},e.prototype._add=e.prototype.add,e.prototype.render=function(){return this._node.render()},e.prototype.getSize=function(){return this._node&&this._node.getSize?this._node.getSize.apply(this._node,arguments)||this.options.size:this.options.size},i.exports=e},{"../utilities/Utility":96,"./EventHandler":7,"./OptionsManager":10,"./RenderNode":11}],17:[function(t,i){function e(t){t||(t=[]),t instanceof Array&&(t={array:t}),this._=null,this.index=t.index||0,t.array?this._=new this.constructor.Backing(t.array):t._&&(this._=t._),this.index===this._.firstIndex&&(this._.firstNode=this),this.index===this._.firstIndex+this._.array.length-1&&(this._.lastNode=this),void 0!==t.loop&&(this._.loop=t.loop),void 0!==t.trackSize&&(this._.trackSize=t.trackSize),this._previousNode=null,this._nextNode=null}e.Backing=function(t){this.array=t,this.firstIndex=0,this.loop=!1,this.firstNode=null,this.lastNode=null,this.cumulativeSizes=[[0,0]],this.sizeDirty=!0,this.trackSize=!1},e.Backing.prototype.getValue=function(t){var i=t-this.firstIndex;return 0>i||i>=this.array.length?null:this.array[i]},e.Backing.prototype.setValue=function(t,i){this.array[t-this.firstIndex]=i},e.Backing.prototype.getSize=function(t){return this.cumulativeSizes[t]},e.Backing.prototype.calculateSize=function(t){t=t||this.array.length;for(var i=[0,0],e=0;t>e;e++){var n=this.array[e].getSize();if(!n)return void 0;void 0!==i[0]&&(void 0===n[0]?i[0]=void 0:i[0]+=n[0]),void 0!==i[1]&&(void 0===n[1]?i[1]=void 0:i[1]+=n[1]),this.cumulativeSizes[e+1]=i.slice()}return this.sizeDirty=!1,i},e.Backing.prototype.reindex=function(t,i,e){if(this.array[0]){for(var n=0,o=this.firstIndex,s=e-i,r=this.firstNode;t-1>o;)r=r.getNext(),o++;var a=r;for(n=0;i>n;n++)r=r.getNext(),r&&(r._previousNode=a);var h=r?r.getNext():null;for(a._nextNode=null,r=a,n=0;e>n;n++)r=r.getNext();if(o+=e,r!==h&&(r._nextNode=h,h&&(h._previousNode=r)),h)for(r=h,o++;r&&o<this.array.length+this.firstIndex;)r._nextNode?r.index+=s:r.index=o,r=r.getNext(),o++;this.trackSize&&(this.sizeDirty=!0)}},e.prototype.getPrevious=function(){var t=this._.array.length;return t?this.index===this._.firstIndex?this._.loop?(this._previousNode=this._.lastNode||new this.constructor({_:this._,index:this._.firstIndex+t-1}),this._previousNode._nextNode=this):this._previousNode=null:this._previousNode||(this._previousNode=new this.constructor({_:this._,index:this.index-1}),this._previousNode._nextNode=this):this._previousNode=null,this._previousNode},e.prototype.getNext=function(){var t=this._.array.length;return t?this.index===this._.firstIndex+t-1?this._.loop?(this._nextNode=this._.firstNode||new this.constructor({_:this._,index:this._.firstIndex}),this._nextNode._previousNode=this):this._nextNode=null:this._nextNode||(this._nextNode=new this.constructor({_:this._,index:this.index+1}),this._nextNode._previousNode=this):this._nextNode=null,this._nextNode},e.prototype.indexOf=function(t){return this._.array.indexOf(t)},e.prototype.getIndex=function(){return this.index},e.prototype.toString=function(){return""+this.index},e.prototype.unshift=function(){this._.array.unshift.apply(this._.array,arguments),this._.firstIndex-=arguments.length,this._.trackSize&&(this._.sizeDirty=!0)},e.prototype.push=function(){this._.array.push.apply(this._.array,arguments),this._.trackSize&&(this._.sizeDirty=!0)},e.prototype.splice=function(t,i){var e=Array.prototype.slice.call(arguments,2);this._.array.splice.apply(this._.array,[t-this._.firstIndex,i].concat(e)),this._.reindex(t,i,e.length)},e.prototype.swap=function(t){var i=t.get(),e=this.get();this._.setValue(this.index,i),this._.setValue(t.index,e);var n=this._previousNode,o=this._nextNode,s=this.index,r=t._previousNode,a=t._nextNode,h=t.index;this.index=h,this._previousNode=r===this?t:r,this._previousNode&&(this._previousNode._nextNode=this),this._nextNode=a===this?t:a,this._nextNode&&(this._nextNode._previousNode=this),t.index=s,t._previousNode=n===t?this:n,t._previousNode&&(t._previousNode._nextNode=t),t._nextNode=o===t?this:o,t._nextNode&&(t._nextNode._previousNode=t),this.index===this._.firstIndex?this._.firstNode=this:this.index===this._.firstIndex+this._.array.length-1&&(this._.lastNode=this),t.index===this._.firstIndex?this._.firstNode=t:t.index===this._.firstIndex+this._.array.length-1&&(this._.lastNode=t),this._.trackSize&&(this._.sizeDirty=!0)},e.prototype.get=function(){return this._.getValue(this.index)},e.prototype.getSize=function(){var t=this.get();return t?t.getSize():null},e.prototype.render=function(){this._.trackSize&&this._.sizeDirty&&this._.calculateSize();var t=this.get();return t?t.render.apply(t,arguments):null},i.exports=e},{}],18:[function(t,i){i.exports={Context:t("./Context"),ElementAllocator:t("./ElementAllocator"),ElementOutput:t("./ElementOutput"),Engine:t("./Engine"),Entity:t("./Entity"),EventEmitter:t("./EventEmitter"),EventHandler:t("./EventHandler"),Group:t("./Group"),Modifier:t("./Modifier"),OptionsManager:t("./OptionsManager"),RenderNode:t("./RenderNode"),Scene:t("./Scene"),SpecParser:t("./SpecParser"),Surface:t("./Surface"),Transform:t("./Transform"),View:t("./View"),ViewSequence:t("./ViewSequence")}},{"./Context":1,"./ElementAllocator":2,"./ElementOutput":3,"./Engine":4,"./Entity":5,"./EventEmitter":6,"./EventHandler":7,"./Group":8,"./Modifier":9,"./OptionsManager":10,"./RenderNode":11,"./Scene":12,"./SpecParser":13,"./Surface":14,"./Transform":15,"./View":16,"./ViewSequence":17}],19:[function(t,i){function e(t){this.dispatchers={},this.currMode=void 0,this.setMode(t)}var n=t("../core/EventHandler");e.prototype.setMode=function(t){if(t!==this.currMode){var i=this.currMode;this.dispatchers[this.currMode]&&this.dispatchers[this.currMode].trigger("unpipe"),this.currMode=t,this.dispatchers[t]&&this.dispatchers[t].emit("pipe"),this.emit("change",{from:i,to:t})}},e.prototype.forMode=function(t){return this.dispatchers[t]||(this.dispatchers[t]=new n),this.dispatchers[t]},e.prototype.emit=function(t,i){if(void 0===this.currMode)return!1;i||(i={});var e=this.dispatchers[this.currMode];return e?e.trigger(t,i):void 0},i.exports=e},{"../core/EventHandler":7}],20:[function(t,i){function e(t){n.call(this),this._condition=t}var n=t("../core/EventHandler");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.emit=function(t,i){return this._condition(t,i)?n.prototype.emit.apply(this,arguments):void 0},e.prototype.trigger=e.prototype.emit,i.exports=e},{"../core/EventHandler":7}],21:[function(t,i){function e(t){n.call(this),this._mappingFunction=t}var n=t("../core/EventHandler");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.subscribe=null,e.prototype.unsubscribe=null,e.prototype.emit=function(t,i){var e=this._mappingFunction.apply(this,arguments);e&&e.emit instanceof Function&&e.emit(t,i)},e.prototype.trigger=e.prototype.emit,i.exports=e},{"../core/EventHandler":7}],22:[function(t,i){i.exports={EventArbiter:t("./EventArbiter"),EventFilter:t("./EventFilter"),EventMapper:t("./EventMapper")}},{"./EventArbiter":19,"./EventFilter":20,"./EventMapper":21}],23:[function(t,i){i.exports={core:t("./core"),events:t("./events"),inputs:t("./inputs"),math:t("./math"),modifiers:t("./modifiers"),physics:t("./physics"),surfaces:t("./surfaces"),transitions:t("./transitions"),utilities:t("./utilities"),views:t("./views"),widgets:t("./widgets")}},{"./core":18,"./events":22,"./inputs":37,"./math":43,"./modifiers":48,"./physics":72,"./surfaces":83,"./transitions":93,"./utilities":97,"./views":112,"./widgets":117}],24:[function(t,i){function e(t,i){void 0===i&&(i="update"),this._state=t&&t.get&&t.set?t:new s(t||0),this._eventInput=new o,o.setInputHandler(this,this._eventInput),this._eventInput.on(i,n.bind(this))}function n(t){var i=t.delta,e=this.get();if(i.constructor===e.constructor){var n=i instanceof Array?[e[0]+i[0],e[1]+i[1]]:e+i;this.set(n)}}var o=t("../core/EventHandler"),s=t("../transitions/Transitionable");e.prototype.get=function(){return this._state.get()},e.prototype.set=function(t){this._state.set(t)},i.exports=e},{"../core/EventHandler":7,"../transitions/Transitionable":89}],25:[function(){function t(t){window.addEventListener(t,function(t){return t.stopPropagation(),!1},!0)}var i="ontouchstart"in window;i&&(t("mousedown"),t("mousemove"),t("mouseup"),t("mouseleave"))},{}],26:[function(){!function(){if(window.CustomEvent){var t=300,i=500,e={},n={},o=Date.now;window.addEventListener("touchstart",function(t){for(var i=o(),n=0;n<t.changedTouches.length;n++){var s=t.changedTouches[n];e[s.identifier]=i}}),window.addEventListener("touchmove",function(t){for(var i=0;i<t.changedTouches.length;i++){var n=t.changedTouches[i];delete e[n.identifier]}}),window.addEventListener("touchend",function(i){for(var s=o(),r=0;r<i.changedTouches.length;r++){var a=i.changedTouches[r],h=e[a.identifier];if(h&&t>s-h){var c=new window.CustomEvent("click",{bubbles:!0,detail:a});n[s]=i,i.target.dispatchEvent(c)}delete e[a.identifier]}}),window.addEventListener("click",function(t){var e=o();for(var s in n){var r=n[s];i>e-s?t instanceof window.MouseEvent&&t.target===r.target&&t.stopPropagation():delete n[s]}},!0)}}()},{}],27:[function(t,i){function e(t,i){this._eventInput=new o,this._eventOutput=new o,o.setInputHandler(this,this._eventInput),o.setOutputHandler(this,this._eventOutput),this._syncs={},t&&this.addSync(t),i&&this.setOptions(i)}function n(t,i){s[t]&&(this._syncs[t]=new s[t](i),this.pipeSync(t))}var o=t("../core/EventHandler");e.DIRECTION_X=0,e.DIRECTION_Y=1,e.DIRECTION_Z=2;var s={};e.register=function(t){for(var i in t)if(s[i]){if(s[i]!==t[i])throw new Error("Conflicting sync classes for key: "+i)}else s[i]=t[i]},e.prototype.setOptions=function(t){for(var i in this._syncs)this._syncs[i].setOptions(t)},e.prototype.pipeSync=function(t){var i=this._syncs[t];this._eventInput.pipe(i),i.pipe(this._eventOutput)},e.prototype.unpipeSync=function(t){var i=this._syncs[t];this._eventInput.unpipe(i),i.unpipe(this._eventOutput)},e.prototype.addSync=function(t){if(t instanceof Array)for(var i=0;i<t.length;i++)n.call(this,t[i]);else if(t instanceof Object)for(var e in t)n.call(this,e,t[e])},i.exports=e},{"../core/EventHandler":7}],28:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new c(this.options),t&&this.setOptions(t),this._eventInput=new h,this._eventOutput=new h,h.setInputHandler(this,this._eventInput),h.setOutputHandler(this,this._eventOutput),this._eventInput.on("mousedown",n.bind(this)),this._eventInput.on("mousemove",o.bind(this)),this._eventInput.on("mouseup",s.bind(this)),this.options.propogate?this._eventInput.on("mouseleave",r.bind(this)):this._eventInput.on("mouseleave",s.bind(this)),this.options.clickThreshold&&window.addEventListener("click",function(t){Math.sqrt(Math.pow(this._displacement[0],2)+Math.pow(this._displacement[1],2))>this.options.clickThreshold&&t.stopPropagation()}.bind(this),!0),this._payload={delta:null,position:null,velocity:null,clientX:0,clientY:0,offsetX:0,offsetY:0},this._positionHistory=[],this._position=null,this._down=!1,this._moved=!1,this._displacement=[0,0],this._documentActive=!1}function n(t){var i,e;this.options.preventDefault&&t.preventDefault();var n=t.clientX,o=t.clientY,s=Date.now();this._down=!0,this._move=!1,void 0!==this.options.direction?(this._position=0,i=0,e=0):(this._position=[0,0],i=[0,0],e=[0,0]),this.options.clickThreshold&&(this._displacement=[0,0]);var r=this._payload;r.delta=i,r.position=this._position,r.velocity=e,r.clientX=n,r.clientY=o,r.offsetX=t.offsetX,r.offsetY=t.offsetY,this._positionHistory.push({position:r.position.slice?r.position.slice(0):r.position,clientPosition:[n,o],timestamp:s}),this._eventOutput.emit("start",r),this._documentActive=!1}function o(t){if(0!==this._positionHistory.length){var i=a.call(this,t);this._eventOutput.emit("update",i),this._move=!0}}function s(t){if(this._down){var i=a.call(this,t);this._eventOutput.emit("end",i),this._down=!1,this._move=!1,this._positionHistory=[]}}function r(){if(this._down&&this._move&&!this._documentActive){var t=o.bind(this),i=function(e){s.call(this,e),document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",i)}.bind(this);document.addEventListener("mousemove",t),document.addEventListener("mouseup",i),this._documentActive=!0}}function a(t){var i,n,o=this._payload,s=this.options.scale,r=t.clientX,a=t.clientY,h=Date.now(),c=this._positionHistory[this._positionHistory.length-1],l=r*s-c.clientPosition[0],f=a*s-c.clientPosition[1];this.options.rails&&(Math.abs(l)>Math.abs(f)?f=0:l=0),this.options.direction===e.DIRECTION_X?(n=l,this._position+=n):this.options.direction===e.DIRECTION_Y?(n=f,this._position+=n):(n=[l,f],this._position[0]+=l,this._position[1]+=f),this.options.clickThreshold!==!1&&(this._displacement[0]+=l,this._displacement[1]+=f),o.delta=n,o.position=this._position,o.clientX=r,o.clientY=a,o.offsetX=t.offsetX,o.offsetY=t.offsetY,this._positionHistory.length===this.options.velocitySampleLength&&this._positionHistory.shift(),this._positionHistory.push({position:o.position.slice?o.position.slice(0):o.position,clientPosition:[r,a],timestamp:h});var d=p.getTimeHistoryPosition(this._positionHistory,this.options.timeSampleDuration),_=Math.max(h-d.timestamp,u);return i=void 0!==this.options.direction?s*(this._position-d.position)/_:[s*(this._position[0]-d.position[0])/_,s*(this._position[1]-d.position[1])/_],o.velocity=i,o}var h=t("../core/EventHandler"),c=t("../core/OptionsManager"),p=t("./SyncUtils");e.DEFAULT_OPTIONS={clickThreshold:void 0,direction:void 0,rails:!1,scale:1,propogate:!0,velocitySampleLength:10,timeSampleDuration:400,preventDefault:!0},e.DIRECTION_X=0,e.DIRECTION_Y=1;var u=8;e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"./SyncUtils":33}],29:[function(t,i){function e(t){n.call(this),this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new o(this.options),t&&this.setOptions(t),this._displacement=0,this._previousDistance=0}var n=t("./TwoFingerSync"),o=t("../core/OptionsManager");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={scale:1},e.prototype._startUpdate=function(t){this._previousDistance=n.calculateDistance(this.posA,this.posB),this._displacement=0,this._eventOutput.emit("start",{count:t.touches.length,touches:[this.touchAId,this.touchBId],distance:this._dist,center:n.calculateCenter(this.posA,this.posB)})},e.prototype._moveUpdate=function(t){var i=n.calculateDistance(this.posA,this.posB),e=n.calculateCenter(this.posA,this.posB),o=this.options.scale,s=o*(i-this._previousDistance),r=s/t;this._previousDistance=i,this._displacement+=s,this._eventOutput.emit("update",{delta:s,velocity:r,distance:i,displacement:this._displacement,center:e,touches:[this.touchAId,this.touchBId]})},e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},i.exports=e},{"../core/OptionsManager":10,"./TwoFingerSync":36}],30:[function(t,i){function e(t){n.call(this),this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new o(this.options),t&&this.setOptions(t),this._angle=0,this._previousAngle=0}var n=t("./TwoFingerSync"),o=t("../core/OptionsManager");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={scale:1},e.prototype._startUpdate=function(t){this._angle=0,this._previousAngle=n.calculateAngle(this.posA,this.posB);var i=n.calculateCenter(this.posA,this.posB);this._eventOutput.emit("start",{count:t.touches.length,angle:this._angle,center:i,touches:[this.touchAId,this.touchBId]})},e.prototype._moveUpdate=function(t){var i=this.options.scale,e=n.calculateAngle(this.posA,this.posB),o=n.calculateCenter(this.posA,this.posB),s=i*(e-this._previousAngle),r=s/t;this._angle+=s,this._eventOutput.emit("update",{delta:s,velocity:r,angle:this._angle,center:o,touches:[this.touchAId,this.touchBId]}),this._previousAngle=e},e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},i.exports=e},{"../core/OptionsManager":10,"./TwoFingerSync":36}],31:[function(t,i){function e(t){o.call(this),this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new s(this.options),t&&this.setOptions(t),this._scaleFactor=1,this._startDist=0,this._eventInput.on("pipe",n.bind(this))}function n(){this.touchAId=void 0,this.touchBId=void 0}var o=t("./TwoFingerSync"),s=t("../core/OptionsManager");e.prototype=Object.create(o.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={scale:1},e.prototype._startUpdate=function(t){this._scaleFactor=1,this._startDist=o.calculateDistance(this.posA,this.posB),this._eventOutput.emit("start",{count:t.touches.length,touches:[this.touchAId,this.touchBId],distance:this._startDist,center:o.calculateCenter(this.posA,this.posB)})},e.prototype._moveUpdate=function(t){var i=this.options.scale,e=o.calculateDistance(this.posA,this.posB),n=o.calculateCenter(this.posA,this.posB),s=(e-this._startDist)/this._startDist,r=Math.max(1+i*s,0),a=(r-this._scaleFactor)/t;this._eventOutput.emit("update",{delta:s,scale:r,velocity:a,distance:e,center:n,touches:[this.touchAId,this.touchBId]}),this._scaleFactor=r},e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},i.exports=e},{"../core/OptionsManager":10,"./TwoFingerSync":36}],32:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new a(this.options),t&&this.setOptions(t),this._payload={delta:null,position:null,velocity:null,slip:!0},this._eventInput=new s,this._eventOutput=new s,s.setInputHandler(this,this._eventInput),s.setOutputHandler(this,this._eventOutput),this._position=void 0===this.options.direction?[0,0]:0,this._prevTime=void 0,this._prevVel=void 0,this._eventInput.on("mousewheel",o.bind(this)),this._eventInput.on("wheel",o.bind(this)),this._inProgress=!1,this._loopBound=!1}function n(){if(this._inProgress&&c()-this._prevTime>this.options.stallTime){this._inProgress=!1;var t=Math.abs(this._prevVel)>=this.options.minimumEndSpeed?this._prevVel:0,i=this._payload;i.position=this._position,i.velocity=t,i.slip=!0,this._eventOutput.emit("end",i)}}function o(t){this.options.preventDefault&&t.preventDefault(),this._inProgress||(this._inProgress=!0,this._position=void 0===this.options.direction?[0,0]:0,g=this._payload,g.slip=!0,g.position=this._position,g.clientX=t.clientX,g.clientY=t.clientY,g.offsetX=t.offsetX,g.offsetY=t.offsetY,this._eventOutput.emit("start",g),this._loopBound||(r.on("prerender",n.bind(this)),this._loopBound=!0));var i=c(),o=this._prevTime||i,s=void 0!==t.wheelDeltaX?t.wheelDeltaX:-t.deltaX,a=void 0!==t.wheelDeltaY?t.wheelDeltaY:-t.deltaY;1===t.deltaMode&&(s*=this.options.lineHeight,a*=this.options.lineHeight),this.options.rails&&(Math.abs(s)>Math.abs(a)?a=0:s=0);var p,u,l=Math.max(i-o,h),f=s/l,d=a/l,_=this.options.scale;this.options.direction===e.DIRECTION_X?(u=_*s,p=_*f,this._position+=u):this.options.direction===e.DIRECTION_Y?(u=_*a,p=_*d,this._position+=u):(u=[_*s,_*a],p=[_*f,_*d],this._position[0]+=u[0],this._position[1]+=u[1]);var g=this._payload;g.delta=u,g.velocity=p,g.position=this._position,g.slip=!0,this._eventOutput.emit("update",g),this._prevTime=i,this._prevVel=p}var s=t("../core/EventHandler"),r=t("../core/Engine"),a=t("../core/OptionsManager");e.DEFAULT_OPTIONS={direction:void 0,minimumEndSpeed:1/0,rails:!1,scale:1,stallTime:50,lineHeight:40,preventDefault:!0},e.DIRECTION_X=0,e.DIRECTION_Y=1;var h=8,c=Date.now;e.prototype.getOptions=function(){return this.options},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},i.exports=e},{"../core/Engine":4,"../core/EventHandler":7,"../core/OptionsManager":10}],33:[function(t,i){i.exports={getTimeHistoryPosition:function(t,i){for(var e,n,o,s=t.length-1,r=s,a=!0,h=0;a;){if(n=t[r],0>r)return e;if(n&&e&&(o=e.timestamp-n.timestamp,h+=o,h>=i))return a=!1,n;r--,e=n}}}},{}],34:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new c(this.options),t&&this.setOptions(t),this._eventOutput=new h,this._touchTracker=new a({touchLimit:this.options.touchLimit}),h.setOutputHandler(this,this._eventOutput),h.setInputHandler(this,this._touchTracker),this._touchTracker.on("trackstart",n.bind(this)),this._touchTracker.on("trackmove",o.bind(this)),this._touchTracker.on("trackend",r.bind(this)),this._payload={delta:null,position:null,velocity:null,clientX:void 0,clientY:void 0,count:0,touch:void 0},this._position=null}function n(t){var i,e;void 0!==this.options.direction?(this._position=0,i=0,e=0):(this._position=[0,0],i=[0,0],e=[0,0]);var n=this._payload;n.delta=e,n.position=this._position,n.velocity=i,n.clientX=t.x,n.clientY=t.y,n.count=t.count,n.touch=t.identifier,this._eventOutput.emit("start",n)}function o(t){s.call(this,t)}function s(t){var i=t.history,n=i[i.length-1],o=p.getTimeHistoryPosition(i,this.options.timeSampleDuration),s=o.timestamp,r=n.timestamp,a=n.x-o.x,h=n.y-o.y,c=n.x-s,l=n.y-s;this.options.rails&&(Math.abs(a)>Math.abs(h)?h=0:a=0,Math.abs(c)>Math.abs(l)?l=0:c=0);var f,d,_=Math.max(r-s,u),g=c/_,y=l/_,v=this.options.scale;this.options.direction===e.DIRECTION_X?(d=v*a,f=v*g,this._position+=d):this.options.direction===e.DIRECTION_Y?(d=v*h,f=v*y,this._position+=d):(d=[v*a,v*h],f=[v*g,v*y],this._position[0]+=d[0],this._position[1]+=d[1]);var m=this._payload;m.delta=d,m.velocity=f,m.position=this._position,m.clientX=t.x,m.clientY=t.y,m.count=t.count,m.touch=t.identifier,this._eventOutput.emit("update",m)}function r(t){s.call(this,t),this._payload.count=t.count,this._eventOutput.emit("end",this._payload)}var a=t("./TouchTracker"),h=t("../core/EventHandler"),c=t("../core/OptionsManager"),p=t("./SyncUtils");e.DEFAULT_OPTIONS={direction:void 0,rails:!1,touchLimit:1,velocitySampleLength:10,scale:1,timeSampleDuration:400},e.DIRECTION_X=0,e.DIRECTION_Y=1;var u=8;e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.getOptions=function(){return this.options},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"./SyncUtils":33,"./TouchTracker":35}],35:[function(t,i){function e(t,i,e){return{x:t.clientX,y:t.clientY,identifier:t.identifier,origin:i.origin,timestamp:c(),count:i.touches.length,history:e}}function n(t){if(!(t.touches.length>this.touchLimit)){this.isTouched=!0;for(var i=0;i<t.changedTouches.length;i++){var n=t.changedTouches[i],o=e(n,t,null);this.eventOutput.emit("trackstart",o),this.selective||this.touchHistory[n.identifier]||this.track(o)}}}function o(t){if(!(t.touches.length>this.touchLimit))for(var i=0;i<t.changedTouches.length;i++){var n=t.changedTouches[i],o=this.touchHistory[n.identifier];if(o){var s=e(n,t,o);this.touchHistory[n.identifier].push(s),this.eventOutput.emit("trackmove",s)}}}function s(t){if(this.isTouched){for(var i=0;i<t.changedTouches.length;i++){var n=t.changedTouches[i],o=this.touchHistory[n.identifier];if(o){var s=e(n,t,o);this.touchHistory[n.identifier].push(s),this.eventOutput.emit("trackend",s),delete this.touchHistory[n.identifier]}}this.isTouched=!1}}function r(){for(var t in this.touchHistory){var i=this.touchHistory[t];this.eventOutput.emit("trackend",{touch:i[i.length-1].touch,timestamp:Date.now(),count:0,history:i}),delete this.touchHistory[t]}}function a(t){this.selective=t.selective,this.touchLimit=t.touchLimit||1,this.touchHistory={},this.eventInput=new h,this.eventOutput=new h,h.setInputHandler(this,this.eventInput),h.setOutputHandler(this,this.eventOutput),this.eventInput.on("touchstart",n.bind(this)),this.eventInput.on("touchmove",o.bind(this)),this.eventInput.on("touchend",s.bind(this)),this.eventInput.on("touchcancel",s.bind(this)),this.eventInput.on("unpipe",r.bind(this)),this.isTouched=!1}var h=t("../core/EventHandler"),c=Date.now;a.prototype.track=function(t){this.touchHistory[t.identifier]=[t]},i.exports=a},{"../core/EventHandler":7}],36:[function(t,i){function e(){this._eventInput=new n,this._eventOutput=new n,n.setInputHandler(this,this._eventInput),n.setOutputHandler(this,this._eventOutput),this.touchAEnabled=!1,this.touchAId=0,this.posA=null,this.timestampA=0,this.touchBEnabled=!1,this.touchBId=0,this.posB=null,this.timestampB=0,this._eventInput.on("touchstart",this.handleStart.bind(this)),this._eventInput.on("touchmove",this.handleMove.bind(this)),this._eventInput.on("touchend",this.handleEnd.bind(this)),this._eventInput.on("touchcancel",this.handleEnd.bind(this))}var n=t("../core/EventHandler");e.calculateAngle=function(t,i){var e=i[0]-t[0],n=i[1]-t[1];return Math.atan2(n,e)},e.calculateDistance=function(t,i){var e=i[0]-t[0],n=i[1]-t[1];return Math.sqrt(e*e+n*n)},e.calculateCenter=function(t,i){return[(t[0]+i[0])/2,(t[1]+i[1])/2]};var o=Date.now;e.prototype.handleStart=function(t){for(var i=0;i<t.changedTouches.length;i++){var e=t.changedTouches[i];this.touchAEnabled?this.touchBEnabled||(this.touchBId=e.identifier,this.touchBEnabled=!0,this.posB=[e.pageX,e.pageY],this.timestampB=o(),this._startUpdate(t)):(this.touchAId=e.identifier,this.touchAEnabled=!0,this.posA=[e.pageX,e.pageY],this.timestampA=o())}},e.prototype.handleMove=function(t){if(this.touchAEnabled&&this.touchBEnabled){for(var i,e=this.timestampA,n=this.timestampB,s=0;s<t.changedTouches.length;s++){var r=t.changedTouches[s];r.identifier===this.touchAId?(this.posA=[r.pageX,r.pageY],this.timestampA=o(),i=this.timestampA-e):r.identifier===this.touchBId&&(this.posB=[r.pageX,r.pageY],this.timestampB=o(),i=this.timestampB-n)}i&&this._moveUpdate(i)}},e.prototype.handleEnd=function(t){for(var i=0;i<t.changedTouches.length;i++){var e=t.changedTouches[i];(e.identifier===this.touchAId||e.identifier===this.touchBId)&&(this.touchAEnabled&&this.touchBEnabled&&this._eventOutput.emit("end",{touches:[this.touchAId,this.touchBId],angle:this._angle}),this.touchAEnabled=!1,this.touchAId=0,this.touchBEnabled=!1,this.touchBId=0)}},i.exports=e},{"../core/EventHandler":7}],37:[function(t,i){i.exports={Accumulator:t("./Accumulator"),DesktopEmulationMode:t("./DesktopEmulationMode"),FastClick:t("./FastClick"),GenericSync:t("./GenericSync"),MouseSync:t("./MouseSync"),PinchSync:t("./PinchSync"),RotateSync:t("./RotateSync"),ScaleSync:t("./ScaleSync"),ScrollSync:t("./ScrollSync"),SyncUtils:t("./SyncUtils"),TouchSync:t("./TouchSync"),TouchTracker:t("./TouchTracker"),TwoFingerSync:t("./TwoFingerSync")}
},{"./Accumulator":24,"./DesktopEmulationMode":25,"./FastClick":26,"./GenericSync":27,"./MouseSync":28,"./PinchSync":29,"./RotateSync":30,"./ScaleSync":31,"./ScrollSync":32,"./SyncUtils":33,"./TouchSync":34,"./TouchTracker":35,"./TwoFingerSync":36}],38:[function(t,i){function e(t){return this.values=t||[[1,0,0],[0,1,0],[0,0,1]],this}var n=t("./Vector"),o=new e,s=new n;e.prototype.get=function(){return this.values},e.prototype.set=function(t){this.values=t},e.prototype.vectorMultiply=function(t){var i=this.get(),e=t.x,n=t.y,o=t.z,r=i[0],a=i[1],h=i[2],c=r[0],p=r[1],u=r[2],l=a[0],f=a[1],d=a[2],_=h[0],g=h[1],y=h[2];return s.setXYZ(c*e+p*n+u*o,l*e+f*n+d*o,_*e+g*n+y*o)},e.prototype.multiply=function(t){for(var i=this.get(),e=[[]],n=0;3>n;n++){e[n]=[];for(var s=0;3>s;s++){for(var r=0,a=0;3>a;a++)r+=i[n][a]*t[a][s];e[n][s]=r}}return o.set(e)},e.prototype.transpose=function(){for(var t=[],i=this.get(),e=0;3>e;e++)for(var n=0;3>n;n++)t[e][n]=i[n][e];return o.set(t)},e.prototype.clone=function(){for(var t=this.get(),i=[],n=0;3>n;n++)i[n]=t[n].slice();return new e(i)},i.exports=e},{"./Vector":42}],39:[function(t,i){function e(t,i,e,n){return 1===arguments.length?this.set(t):(this.w=void 0!==t?t:1,this.x=void 0!==i?i:0,this.y=void 0!==e?e:0,this.z=void 0!==n?n:0),this}var n=t("./Matrix"),o=new e(1,0,0,0);e.prototype.add=function(t){return o.setWXYZ(this.w+t.w,this.x+t.x,this.y+t.y,this.z+t.z)},e.prototype.sub=function(t){return o.setWXYZ(this.w-t.w,this.x-t.x,this.y-t.y,this.z-t.z)},e.prototype.scalarDivide=function(t){return this.scalarMultiply(1/t)},e.prototype.scalarMultiply=function(t){return o.setWXYZ(this.w*t,this.x*t,this.y*t,this.z*t)},e.prototype.multiply=function(t){var i=this.x,e=this.y,n=this.z,s=this.w,r=t.x,a=t.y,h=t.z,c=t.w||0;return o.setWXYZ(s*c-i*r-e*a-n*h,i*c+r*s+a*n-e*h,e*c+a*s+i*h-r*n,n*c+h*s+r*e-i*a)};var s=new e(1,0,0,0);e.prototype.rotateVector=function(t){return s.set(this.conj()),o.set(this.multiply(t).multiply(s))},e.prototype.inverse=function(){return o.set(this.conj().scalarDivide(this.normSquared()))},e.prototype.negate=function(){return this.scalarMultiply(-1)},e.prototype.conj=function(){return o.setWXYZ(this.w,-this.x,-this.y,-this.z)},e.prototype.normalize=function(t){return t=void 0===t?1:t,this.scalarDivide(t*this.norm())},e.prototype.makeFromAngleAndAxis=function(t,i){var e=i.normalize(),n=.5*t,o=-Math.sin(n);return this.x=o*e.x,this.y=o*e.y,this.z=o*e.z,this.w=Math.cos(n),this},e.prototype.setWXYZ=function(t,i,e,n){return o.clear(),this.w=t,this.x=i,this.y=e,this.z=n,this},e.prototype.set=function(t){return t instanceof Array?(this.w=0,this.x=t[0],this.y=t[1],this.z=t[2]):(this.w=t.w,this.x=t.x,this.y=t.y,this.z=t.z),this!==o&&o.clear(),this},e.prototype.put=function(t){t.set(o)},e.prototype.clone=function(){return new e(this)},e.prototype.clear=function(){return this.w=1,this.x=0,this.y=0,this.z=0,this},e.prototype.isEqual=function(t){return t.w===this.w&&t.x===this.x&&t.y===this.y&&t.z===this.z},e.prototype.dot=function(t){return this.w*t.w+this.x*t.x+this.y*t.y+this.z*t.z},e.prototype.normSquared=function(){return this.dot(this)},e.prototype.norm=function(){return Math.sqrt(this.normSquared())},e.prototype.isZero=function(){return!(this.x||this.y||this.z)},e.prototype.getTransform=function(){var t=this.normalize(1),i=t.x,e=t.y,n=t.z,o=t.w;return[1-2*e*e-2*n*n,2*i*e-2*n*o,2*i*n+2*e*o,0,2*i*e+2*n*o,1-2*i*i-2*n*n,2*e*n-2*i*o,0,2*i*n-2*e*o,2*e*n+2*i*o,1-2*i*i-2*e*e,0,0,0,0,1]};var r=new n;e.prototype.getMatrix=function(){var t=this.normalize(1),i=t.x,e=t.y,n=t.z,o=t.w;return r.set([[1-2*e*e-2*n*n,2*i*e+2*n*o,2*i*n-2*e*o],[2*i*e-2*n*o,1-2*i*i-2*n*n,2*e*n+2*i*o],[2*i*n+2*e*o,2*e*n-2*i*o,1-2*i*i-2*e*e]])};var a=1e-5;e.prototype.slerp=function(t,i){var e,n,s,r,h;return n=this.dot(t),1-n>a?(e=Math.acos(n),s=Math.sin(e),r=Math.sin((1-i)*e)/s,h=Math.sin(i*e)/s):(r=1-i,h=i),o.set(this.scalarMultiply(r/h).add(t).multiply(h))},i.exports=e},{"./Matrix":38}],40:[function(t,i){function e(t,i){return t+o()*(i-t)}function n(t,i){return t+o()*(i-t+1)>>0}var o=Math.random,s={};s.integer=function(t,i,e){if(t=void 0!==t?t:0,i=void 0!==i?i:1,void 0!==e){for(var o=[],s=0;e>s;s++)o.push(n(t,i));return o}return n(t,i)},s.range=function(t,i,n){if(t=void 0!==t?t:0,i=void 0!==i?i:1,void 0!==n){for(var o=[],s=0;n>s;s++)o.push(e(t,i));return o}return e(t,i)},s.sign=function(t){return t=void 0!==t?t:.5,o()<t?1:-1},s.bool=function(t){return t=void 0!==t?t:.5,o()<t},i.exports=s},{}],41:[function(t,i){var e={};e.clamp=function(t,i){return Math.max(Math.min(t,i[1]),i[0])},e.length=function(t){for(var i=0,e=0;e<t.length;e++)i+=t[e]*t[e];return Math.sqrt(i)},i.exports=e},{}],42:[function(t,i){function e(t,i,e){return 1===arguments.length&&void 0!==t?this.set(t):(this.x=t||0,this.y=i||0,this.z=e||0),this}function n(t,i,e){return this.x=t,this.y=i,this.z=e,this}function o(t){return n.call(this,t[0],t[1],t[2]||0)}function s(t){return n.call(this,t.x,t.y,t.z)}function r(t){return n.call(this,t,0,0)}var a=new e(0,0,0);e.prototype.add=function(t){return n.call(a,this.x+t.x,this.y+t.y,this.z+t.z)},e.prototype.sub=function(t){return n.call(a,this.x-t.x,this.y-t.y,this.z-t.z)},e.prototype.mult=function(t){return n.call(a,t*this.x,t*this.y,t*this.z)},e.prototype.div=function(t){return this.mult(1/t)},e.prototype.cross=function(t){var i=this.x,e=this.y,o=this.z,s=t.x,r=t.y,h=t.z;return n.call(a,o*r-e*h,i*h-o*s,e*s-i*r)},e.prototype.equals=function(t){return t.x===this.x&&t.y===this.y&&t.z===this.z},e.prototype.rotateX=function(t){var i=this.x,e=this.y,o=this.z,s=Math.cos(t),r=Math.sin(t);return n.call(a,i,e*s-o*r,e*r+o*s)},e.prototype.rotateY=function(t){var i=this.x,e=this.y,o=this.z,s=Math.cos(t),r=Math.sin(t);return n.call(a,o*r+i*s,e,o*s-i*r)},e.prototype.rotateZ=function(t){var i=this.x,e=this.y,o=this.z,s=Math.cos(t),r=Math.sin(t);return n.call(a,i*s-e*r,i*r+e*s,o)},e.prototype.dot=function(t){return this.x*t.x+this.y*t.y+this.z*t.z},e.prototype.normSquared=function(){return this.dot(this)},e.prototype.norm=function(){return Math.sqrt(this.normSquared())},e.prototype.normalize=function(t){0===arguments.length&&(t=1);var i=this.norm();return i>1e-7?s.call(a,this.mult(t/i)):n.call(a,t,0,0)},e.prototype.clone=function(){return new e(this)},e.prototype.isZero=function(){return!(this.x||this.y||this.z)},e.prototype.set=function(t){return t instanceof Array?o.call(this,t):"number"==typeof t?r.call(this,t):s.call(this,t)},e.prototype.setXYZ=function(){return n.apply(this,arguments)},e.prototype.set1D=function(t){return r.call(this,t)},e.prototype.put=function(t){this===a?s.call(t,a):s.call(t,this)},e.prototype.clear=function(){return n.call(this,0,0,0)},e.prototype.cap=function h(h){if(1/0===h)return s.call(a,this);var t=this.norm();return t>h?s.call(a,this.mult(h/t)):s.call(a,this)},e.prototype.project=function(t){return t.mult(this.dot(t))},e.prototype.reflectAcross=function(t){return t.normalize().put(t),s(a,this.sub(this.project(t).mult(2)))},e.prototype.get=function(){return[this.x,this.y,this.z]},e.prototype.get1D=function(){return this.x},i.exports=e},{}],43:[function(t,i){i.exports={Matrix:t("./Matrix"),Quaternion:t("./Quaternion"),Random:t("./Random"),Utilities:t("./Utilities"),Vector:t("./Vector")}},{"./Matrix":38,"./Quaternion":39,"./Random":40,"./Utilities":41,"./Vector":42}],44:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this._positionState=new c([0,0]),this._differential=[0,0],this._active=!0,this.sync=new l(["mouse","touch"],{scale:this.options.scale}),this.eventOutput=new p,p.setInputHandler(this,this.sync),p.setOutputHandler(this,this.eventOutput),a.call(this)}function n(t){var i=this.options,e=i.projection,n=i.snapX,o=i.snapY,s=e&_.x?t[0]:0,r=e&_.y?t[1]:0;return n>0&&(s-=s%n),o>0&&(r-=r%o),[s,r]}function o(){this._active&&(this._positionState.isActive()&&this._positionState.halt(),this.eventOutput.emit("start",{position:this.getPosition()}))}function s(t){if(this._active){var i=this.options;this._differential=t.position;var e=n.call(this,this._differential);this._differential[0]-=e[0],this._differential[1]-=e[1];var o=this.getPosition();if(o[0]+=e[0],o[1]+=e[1],i.xRange){var s=[i.xRange[0]+.5*i.snapX,i.xRange[1]-.5*i.snapX];o[0]=g(o[0],s)}if(i.yRange){var r=[i.yRange[0]+.5*i.snapY,i.yRange[1]-.5*i.snapY];o[1]=g(o[1],r)}this.eventOutput.emit("update",{position:o})}}function r(){this._active&&this.eventOutput.emit("end",{position:this.getPosition()})}function a(){this.sync.on("start",o.bind(this)),this.sync.on("update",s.bind(this)),this.sync.on("end",r.bind(this))}var h=t("../core/Transform"),c=t("../transitions/Transitionable"),p=t("../core/EventHandler"),u=t("../math/Utilities"),l=t("../inputs/GenericSync"),f=t("../inputs/MouseSync"),d=t("../inputs/TouchSync");l.register({mouse:f,touch:d});var _={x:1,y:2};e.DIRECTION_X=_.x,e.DIRECTION_Y=_.y;var g=u.clamp;e.DEFAULT_OPTIONS={projection:_.x|_.y,scale:1,xRange:null,yRange:null,snapX:0,snapY:0,transition:{duration:0}},e.prototype.setOptions=function(t){var i=this.options;if(void 0!==t.projection){var e=t.projection;this.options.projection=0,["x","y"].forEach(function(t){-1!==e.indexOf(t)&&(i.projection|=_[t])})}void 0!==t.scale&&(i.scale=t.scale,this.sync.setOptions({scale:t.scale})),void 0!==t.xRange&&(i.xRange=t.xRange),void 0!==t.yRange&&(i.yRange=t.yRange),void 0!==t.snapX&&(i.snapX=t.snapX),void 0!==t.snapY&&(i.snapY=t.snapY)},e.prototype.getPosition=function(){return this._positionState.get()},e.prototype.setRelativePosition=function(t,i,e){var n=this.getPosition(),o=[n[0]+t[0],n[1]+t[1]];this.setPosition(o,i,e)},e.prototype.setPosition=function(t,i,e){this._positionState.isActive()&&this._positionState.halt(),this._positionState.set(t,i,e)},e.prototype.activate=function(){this._active=!0},e.prototype.deactivate=function(){this._active=!1},e.prototype.toggle=function(){this._active=!this._active},e.prototype.modify=function(t){var i=this.getPosition();return{transform:h.translate(i[0],i[1]),target:t}},i.exports=e},{"../core/EventHandler":7,"../core/Transform":15,"../inputs/GenericSync":27,"../inputs/MouseSync":28,"../inputs/TouchSync":34,"../math/Utilities":41,"../transitions/Transitionable":89}],45:[function(t,i){function e(t,i){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new o(this.options),t&&this.setOptions(t),i||(i=0),this.transitionHelper=new n(i)}var n=t("../transitions/Transitionable"),o=t("../core/OptionsManager");e.DEFAULT_OPTIONS={cull:!1,transition:!0,pulseInTransition:!0,pulseOutTransition:!0},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.show=function(t,i){t=t||this.options.transition,this.set(1,t,i)},e.prototype.hide=function(t,i){t=t||this.options.transition,this.set(0,t,i)},e.prototype.set=function(t,i,e){this.halt(),this.transitionHelper.set(t,i,e)},e.prototype.halt=function(){this.transitionHelper.halt()},e.prototype.isVisible=function(){return this.transitionHelper.get()>0},e.prototype.modify=function(t){var i=this.transitionHelper.get();return this.options.cull&&!i?void 0:{opacity:i,target:t}},i.exports=e},{"../core/OptionsManager":10,"../transitions/Transitionable":89}],46:[function(t,i){function e(){this._chain=[],arguments.length&&this.addModifier.apply(this,arguments)}e.prototype.addModifier=function(){Array.prototype.push.apply(this._chain,arguments)},e.prototype.removeModifier=function(t){var i=this._chain.indexOf(t);0>i||this._chain.splice(i,1)},e.prototype.modify=function(t){for(var i=this._chain,e=t,n=0;n<i.length;n++)e=i[n].modify(e);return e},i.exports=e},{}],47:[function(t,i){function e(t){this._transformState=new r(o.identity),this._opacityState=new s(1),this._originState=new s([0,0]),this._alignState=new s([0,0]),this._sizeState=new s([0,0]),this._proportionsState=new s([0,0]),this._modifier=new n({transform:this._transformState,opacity:this._opacityState,origin:null,align:null,size:null,proportions:null}),this._hasOrigin=!1,this._hasAlign=!1,this._hasSize=!1,this._hasProportions=!1,t&&(t.transform&&this.setTransform(t.transform),void 0!==t.opacity&&this.setOpacity(t.opacity),t.origin&&this.setOrigin(t.origin),t.align&&this.setAlign(t.align),t.size&&this.setSize(t.size),t.proportions&&this.setProportions(t.proportions))}var n=t("../core/Modifier"),o=t("../core/Transform"),s=t("../transitions/Transitionable"),r=t("../transitions/TransitionableTransform");e.prototype.setTransform=function(t,i,e){return this._transformState.set(t,i,e),this},e.prototype.setOpacity=function(t,i,e){return this._opacityState.set(t,i,e),this},e.prototype.setOrigin=function(t,i,e){return null===t?(this._hasOrigin&&(this._modifier.originFrom(null),this._hasOrigin=!1),this):(this._hasOrigin||(this._hasOrigin=!0,this._modifier.originFrom(this._originState)),this._originState.set(t,i,e),this)},e.prototype.setAlign=function(t,i,e){return null===t?(this._hasAlign&&(this._modifier.alignFrom(null),this._hasAlign=!1),this):(this._hasAlign||(this._hasAlign=!0,this._modifier.alignFrom(this._alignState)),this._alignState.set(t,i,e),this)},e.prototype.setSize=function(t,i,e){return null===t?(this._hasSize&&(this._modifier.sizeFrom(null),this._hasSize=!1),this):(this._hasSize||(this._hasSize=!0,this._modifier.sizeFrom(this._sizeState)),this._sizeState.set(t,i,e),this)},e.prototype.setProportions=function(t,i,e){return null===t?(this._hasProportions&&(this._modifier.proportionsFrom(null),this._hasProportions=!1),this):(this._hasProportions||(this._hasProportions=!0,this._modifier.proportionsFrom(this._proportionsState)),this._proportionsState.set(t,i,e),this)},e.prototype.halt=function(){this._transformState.halt(),this._opacityState.halt(),this._originState.halt(),this._alignState.halt(),this._sizeState.halt(),this._proportionsState.halt()},e.prototype.getTransform=function(){return this._transformState.get()},e.prototype.getFinalTransform=function(){return this._transformState.getFinal()},e.prototype.getOpacity=function(){return this._opacityState.get()},e.prototype.getOrigin=function(){return this._hasOrigin?this._originState.get():null},e.prototype.getAlign=function(){return this._hasAlign?this._alignState.get():null},e.prototype.getSize=function(){return this._hasSize?this._sizeState.get():null},e.prototype.getProportions=function(){return this._hasProportions?this._proportionsState.get():null},e.prototype.modify=function(t){return this._modifier.modify(t)},i.exports=e},{"../core/Modifier":9,"../core/Transform":15,"../transitions/Transitionable":89,"../transitions/TransitionableTransform":90}],48:[function(t,i){i.exports={Draggable:t("./Draggable"),Fader:t("./Fader"),ModifierChain:t("./ModifierChain"),StateModifier:t("./StateModifier")}},{"./Draggable":44,"./Fader":45,"./ModifierChain":46,"./StateModifier":47}],49:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this._particles=[],this._bodies=[],this._agentData={},this._forces=[],this._constraints=[],this._buffer=0,this._prevTime=S(),this._isSleeping=!1,this._eventHandler=null,this._currAgentId=0,this._hasBodies=!1,this._eventHandler=null}function n(t){return t.applyForce?this._forces:t.applyConstraint?this._constraints:void 0}function o(t,i,e){return void 0===i&&(i=this.getParticlesAndBodies()),i instanceof Array||(i=[i]),t.on("change",this.wake.bind(this)),this._agentData[this._currAgentId]={agent:t,id:this._currAgentId,targets:i,source:e},n.call(this,t).push(this._currAgentId),this._currAgentId++}function s(t){return this._agentData[t]}function r(t){var i=s.call(this,this._forces[t]);i.agent.applyForce(i.targets,i.source)}function a(){for(var t=this._forces.length-1;t>-1;t--)r.call(this,t)}function h(t,i){var e=this._agentData[this._constraints[t]];return e.agent.applyConstraint(e.targets,e.source,i)}function c(t){for(var i=0;i<this.options.constraintSteps;){for(var e=this._constraints.length-1;e>-1;e--)h.call(this,e,t);i++}}function p(t,i){t.integrateVelocity(i),this.options.velocityCap&&t.velocity.cap(this.options.velocityCap).put(t.velocity)}function u(t,i){t.integrateAngularMomentum(i),t.updateAngularVelocity(),this.options.angularVelocityCap&&t.angularVelocity.cap(this.options.angularVelocityCap).put(t.angularVelocity)}function l(t,i){t.integrateOrientation(i)}function f(t,i){t.integratePosition(i),t.emit(T.update,t)}function d(t){a.call(this,t),this.forEach(p,t),this.forEachBody(u,t),c.call(this,t),this.forEachBody(l,t),this.forEach(f,t)}function _(){var t=0,i=0;return this.forEach(function(e){i=e.getEnergy(),t+=i}),t}function g(){var t=0;for(var i in this._agentData)t+=this.getAgentEnergy(i);return t}var y=t("../core/EventHandler"),v=17,m=1e3/120,O=17,S=Date.now,T={start:"start",update:"update",end:"end"};e.DEFAULT_OPTIONS={constraintSteps:1,sleepTolerance:1e-7,velocityCap:void 0,angularVelocityCap:void 0},e.prototype.setOptions=function(t){for(var i in t)this.options[i]&&(this.options[i]=t[i])},e.prototype.addBody=function(t){return t._engine=this,t.isBody?(this._bodies.push(t),this._hasBodies=!0):this._particles.push(t),t.on("start",this.wake.bind(this)),t},e.prototype.removeBody=function(t){var i=t.isBody?this._bodies:this._particles,e=i.indexOf(t);if(e>-1){for(var n in this._agentData)this._agentData.hasOwnProperty(n)&&this.detachFrom(this._agentData[n].id,t);i.splice(e,1)}0===this.getBodies().length&&(this._hasBodies=!1)},e.prototype.attach=function(t,i,e){if(this.wake(),t instanceof Array){for(var n=[],s=0;s<t.length;s++)n[s]=o.call(this,t[s],i,e);return n}return o.call(this,t,i,e)},e.prototype.attachTo=function(t,i){s.call(this,t).targets.push(i)},e.prototype.detach=function(t){var i=this.getAgent(t),e=n.call(this,i),o=e.indexOf(t);e.splice(o,1),delete this._agentData[t]},e.prototype.detachFrom=function(t,i){var e=s.call(this,t);if(e.source===i)this.detach(t);else{var n=e.targets,o=n.indexOf(i);o>-1&&n.splice(o,1)}},e.prototype.detachAll=function(){this._agentData={},this._forces=[],this._constraints=[],this._currAgentId=0},e.prototype.getAgent=function(t){return s.call(this,t).agent},e.prototype.getParticles=function(){return this._particles},e.prototype.getBodies=function(){return this._bodies},e.prototype.getParticlesAndBodies=function(){return this.getParticles().concat(this.getBodies())},e.prototype.forEachParticle=function(t,i){for(var e=this.getParticles(),n=0,o=e.length;o>n;n++)t.call(this,e[n],i)},e.prototype.forEachBody=function(t,i){if(this._hasBodies)for(var e=this.getBodies(),n=0,o=e.length;o>n;n++)t.call(this,e[n],i)},e.prototype.forEach=function(t,i){this.forEachParticle(t,i),this.forEachBody(t,i)},e.prototype.getAgentEnergy=function(t){var i=s.call(this,t);return i.agent.getEnergy(i.targets,i.source)},e.prototype.getEnergy=function(){return _.call(this)+g.call(this)},e.prototype.step=function(){if(!this.isSleeping()){var t=S(),i=t-this._prevTime;this._prevTime=t,m>i||(i>O&&(i=O),d.call(this,v),this.emit(T.update,this),this.getEnergy()<this.options.sleepTolerance&&this.sleep())}},e.prototype.isSleeping=function(){return this._isSleeping},e.prototype.isActive=function(){return!this._isSleeping},e.prototype.sleep=function(){this._isSleeping||(this.forEach(function(t){t.sleep()}),this.emit(T.end,this),this._isSleeping=!0)},e.prototype.wake=function(){this._isSleeping&&(this._prevTime=S(),this.emit(T.start,this),this._isSleeping=!1)},e.prototype.emit=function(t,i){null!==this._eventHandler&&this._eventHandler.emit(t,i)},e.prototype.on=function(t,i){null===this._eventHandler&&(this._eventHandler=new y),this._eventHandler.on(t,i)},i.exports=e},{"../core/EventHandler":7}],50:[function(t,i){function e(t){n.call(this,t),t=t||{},this.orientation=new r,this.angularVelocity=new s,this.angularMomentum=new s,this.torque=new s,t.orientation&&this.orientation.set(t.orientation),t.angularVelocity&&this.angularVelocity.set(t.angularVelocity),t.angularMomentum&&this.angularMomentum.set(t.angularMomentum),t.torque&&this.torque.set(t.torque),this.angularVelocity.w=0,this.setMomentsOfInertia(),this.pWorld=new s}var n=t("./Particle"),o=t("../../core/Transform"),s=t("../../math/Vector"),r=t("../../math/Quaternion"),a=t("../../math/Matrix"),h=t("../integrators/SymplecticEuler");e.DEFAULT_OPTIONS=n.DEFAULT_OPTIONS,e.DEFAULT_OPTIONS.orientation=[0,0,0,1],e.DEFAULT_OPTIONS.angularVelocity=[0,0,0],e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.isBody=!0,e.prototype.setMass=function(){n.prototype.setMass.apply(this,arguments),this.setMomentsOfInertia()},e.prototype.setMomentsOfInertia=function(){this.inertia=new a,this.inverseInertia=new a},e.prototype.updateAngularVelocity=function(){this.angularVelocity.set(this.inverseInertia.vectorMultiply(this.angularMomentum))},e.prototype.toWorldCoordinates=function(t){return this.pWorld.set(this.orientation.rotateVector(t))},e.prototype.getEnergy=function(){return n.prototype.getEnergy.call(this)+.5*this.inertia.vectorMultiply(this.angularVelocity).dot(this.angularVelocity)},e.prototype.reset=function(t,i,e,o){n.prototype.reset.call(this,t,i),this.angularVelocity.clear(),this.setOrientation(e||[1,0,0,0]),this.setAngularMomentum(o||[0,0,0])},e.prototype.setOrientation=function(t){this.orientation.set(t)},e.prototype.setAngularVelocity=function(t){this.wake(),this.angularVelocity.set(t)},e.prototype.setAngularMomentum=function(t){this.wake(),this.angularMomentum.set(t)},e.prototype.applyForce=function(t,i){n.prototype.applyForce.call(this,t),void 0!==i&&this.applyTorque(i.cross(t))},e.prototype.applyTorque=function(t){this.wake(),this.torque.set(this.torque.add(t))},e.prototype.getTransform=function(){return o.thenMove(this.orientation.getTransform(),o.getTranslate(n.prototype.getTransform.call(this)))},e.prototype._integrate=function(t){n.prototype._integrate.call(this,t),this.integrateAngularMomentum(t),this.updateAngularVelocity(t),this.integrateOrientation(t)},e.prototype.integrateAngularMomentum=function(t){h.integrateAngularMomentum(this,t)},e.prototype.integrateOrientation=function(t){h.integrateOrientation(this,t)},i.exports=e},{"../../core/Transform":15,"../../math/Matrix":38,"../../math/Quaternion":39,"../../math/Vector":42,"../integrators/SymplecticEuler":73,"./Particle":52}],51:[function(t,i){function e(t){t=t||{},this.setRadius(t.radius||0),n.call(this,t)}var n=t("./Body"),o=t("../../math/Matrix");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.setRadius=function(t){this.radius=t,this.size=[2*this.radius,2*this.radius],this.setMomentsOfInertia()},e.prototype.setMomentsOfInertia=function(){var t=this.mass,i=this.radius;this.inertia=new o([[.25*t*i*i,0,0],[0,.25*t*i*i,0],[0,0,.5*t*i*i]]),this.inverseInertia=new o([[4/(t*i*i),0,0],[0,4/(t*i*i),0],[0,0,2/(t*i*i)]])},i.exports=e},{"../../math/Matrix":38,"./Body":50}],52:[function(t,i){function e(t){t=t||{};var i=e.DEFAULT_OPTIONS;this.position=new o,this.velocity=new o,this.force=new o,this._engine=null,this._isSleeping=!0,this._eventOutput=null,this.mass=void 0!==t.mass?t.mass:i.mass,this.inverseMass=1/this.mass,this.setPosition(t.position||i.position),this.setVelocity(t.velocity||i.velocity),this.force.set(t.force||[0,0,0]),this.transform=s.identity.slice(),this._spec={size:[!0,!0],target:{transform:this.transform,origin:[.5,.5],target:null}}}function n(){this._eventOutput=new r,this._eventOutput.bindThis(this),r.setOutputHandler(this,this._eventOutput)}var o=t("../../math/Vector"),s=t("../../core/Transform"),r=t("../../core/EventHandler"),a=t("../integrators/SymplecticEuler");e.DEFAULT_OPTIONS={position:[0,0,0],velocity:[0,0,0],mass:1};var h={start:"start",update:"update",end:"end"},c=Date.now;e.prototype.isBody=!1,e.prototype.isActive=function(){return!this._isSleeping},e.prototype.sleep=function(){this._isSleeping||(this.emit(h.end,this),this._isSleeping=!0)},e.prototype.wake=function(){this._isSleeping&&(this.emit(h.start,this),this._isSleeping=!1,this._prevTime=c(),this._engine&&this._engine.wake())},e.prototype.setPosition=function(t){this.position.set(t)},e.prototype.setPosition1D=function(t){this.position.x=t},e.prototype.getPosition=function(){return this._engine.step(),this.position.get()},e.prototype.getPosition1D=function(){return this._engine.step(),this.position.x},e.prototype.setVelocity=function(t){this.velocity.set(t),(0!==t[0]||0!==t[1]||0!==t[2])&&this.wake()},e.prototype.setVelocity1D=function(t){this.velocity.x=t,0!==t&&this.wake()},e.prototype.getVelocity=function(){return this.velocity.get()},e.prototype.setForce=function(t){this.force.set(t),this.wake()},e.prototype.getVelocity1D=function(){return this.velocity.x},e.prototype.setMass=function(t){this.mass=t,this.inverseMass=1/t},e.prototype.getMass=function(){return this.mass},e.prototype.reset=function(t,i){this.setPosition(t||[0,0,0]),this.setVelocity(i||[0,0,0])},e.prototype.applyForce=function(t){t.isZero()||(this.force.add(t).put(this.force),this.wake())},e.prototype.applyImpulse=function(t){if(!t.isZero()){var i=this.velocity;i.add(t.mult(this.inverseMass)).put(i)}},e.prototype.integrateVelocity=function(t){a.integrateVelocity(this,t)},e.prototype.integratePosition=function(t){a.integratePosition(this,t)},e.prototype._integrate=function(t){this.integrateVelocity(t),this.integratePosition(t)},e.prototype.getEnergy=function(){return.5*this.mass*this.velocity.normSquared()},e.prototype.getTransform=function(){this._engine.step();var t=this.position,i=this.transform;return i[12]=t.x,i[13]=t.y,i[14]=t.z,i},e.prototype.modify=function(t){var i=this._spec.target;return i.transform=this.getTransform(),i.target=t,this._spec},e.prototype.emit=function(t,i){this._eventOutput&&this._eventOutput.emit(t,i)},e.prototype.on=function(){return n.call(this),this.on.apply(this,arguments)},e.prototype.removeListener=function(){return n.call(this),this.removeListener.apply(this,arguments)},e.prototype.pipe=function(){return n.call(this),this.pipe.apply(this,arguments)},e.prototype.unpipe=function(){return n.call(this),this.unpipe.apply(this,arguments)},i.exports=e},{"../../core/EventHandler":7,"../../core/Transform":15,"../../math/Vector":42,"../integrators/SymplecticEuler":73}],53:[function(t,i){function e(t){t=t||{},this.size=t.size||[0,0],n.call(this,t)}var n=t("./Body"),o=t("../../math/Matrix");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.setSize=function(t){this.size=t,this.setMomentsOfInertia()},e.prototype.setMomentsOfInertia=function(){var t=this.mass,i=this.size[0],e=this.size[1];this.inertia=new o([[t*e*e/12,0,0],[0,t*i*i/12,0],[0,0,t*(i*i+e*e)/12]]),this.inverseInertia=new o([[12/(t*e*e),0,0],[0,12/(t*i*i),0],[0,0,12/(t*(i*i+e*e))]])},i.exports=e},{"../../math/Matrix":38,"./Body":50}],54:[function(t,i){i.exports={Body:t("./Body"),Circle:t("./Circle"),Particle:t("./Particle"),Rectangle:t("./Rectangle")}},{"./Body":50,"./Circle":51,"./Particle":52,"./Rectangle":53}],55:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.normal=new o,this.pDiff=new o,this.vDiff=new o,this.impulse1=new o,this.impulse2=new o,n.call(this)}var n=t("./Constraint"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={restitution:.5,drift:.5,slop:0},e.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},e.prototype.applyConstraint=function(t,i,e){if(void 0!==i)for(var n=i.velocity,o=i.position,s=i.inverseMass,r=i.radius,a=this.options,h=a.drift,c=-a.slop,p=a.restitution,u=this.normal,l=this.pDiff,f=this.vDiff,d=this.impulse1,_=this.impulse2,g=0;g<t.length;g++){var y=t[g];if(y!==i){var v=y.velocity,m=y.position,O=y.inverseMass,S=y.radius;l.set(m.sub(o)),f.set(v.sub(n));var T=l.norm(),w=T-(r+S),b=1/(s+O),E=0;if(0>w){if(u.set(l.normalize()),this._eventOutput){var I={target:y,source:i,overlap:w,normal:u};this._eventOutput.emit("preCollision",I),this._eventOutput.emit("collision",I)}var M=c>=w?((1+p)*u.dot(f)+h/e*(w-c))/(E+e/b):(1+p)*u.dot(f)/(E+e/b);u.mult(e*M).put(d),d.mult(-1).put(_),i.applyImpulse(d),y.applyImpulse(_),this._eventOutput&&this._eventOutput.emit("postCollision",I)}}}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],56:[function(t,i){function e(){this.options=this.options||{},this._eventOutput=new n,n.setOutputHandler(this,this._eventOutput)}var n=t("../../core/EventHandler");e.prototype.setOptions=function(t){this._eventOutput.emit("change",t)},e.prototype.applyConstraint=function(){},e.prototype.getEnergy=function(){return 0},i.exports=e},{"../../core/EventHandler":7}],57:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.J=new o,this.impulse=new o,n.call(this)}var n=t("./Constraint"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e;var s=1e-7,r=Math.PI;e.DEFAULT_OPTIONS={equation:function(){return 0},plane:function(t,i,e){return e},period:0,dampingRatio:0},e.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},e.prototype.applyConstraint=function(t,i,e){for(var n=this.options,o=this.impulse,a=this.J,h=n.equation,c=n.plane,p=n.dampingRatio,u=n.period,l=0;l<t.length;l++){var f,d,_=t[l],g=_.velocity,y=_.position,v=_.mass;if(0===u)f=0,d=1;else{var m=4*v*r*p/u,O=4*v*r*r/(u*u);f=1/(m+e*O),d=e*O/(m+e*O)}var S=y.x,T=y.y,w=y.z,b=h(S,T,w),E=(h(S+s,y,y)-b)/s,I=(h(S,T+s,y)-b)/s,M=(h(S,T,y+s)-b)/s,x=c(S,T,w),z=(c(S+s,T,w)-x)/s,C=(c(S,T+s,w)-x)/s,P=(c(S,T,w+s)-x)/s;a.setXYZ(E+z,I+C,M+P);var F=d/e*(b+x),D=-(a.dot(g)+F)/(f+e*a.normSquared()/v);o.set(a.mult(e*D)),_.applyImpulse(o)}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],58:[function(t,i){function e(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS),t&&this.setOptions(t),this.impulse=new o,this.normal=new o,this.diffP=new o,this.diffV=new o,n.call(this)}var n=t("./Constraint"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={anchor:null,length:0,minLength:0,period:0,dampingRatio:0};var s=Math.PI;e.prototype.setOptions=function(t){t.anchor&&(t.anchor.position instanceof o&&(this.options.anchor=t.anchor.position),t.anchor instanceof o&&(this.options.anchor=t.anchor),t.anchor instanceof Array&&(this.options.anchor=new o(t.anchor))),void 0!==t.length&&(this.options.length=t.length),void 0!==t.dampingRatio&&(this.options.dampingRatio=t.dampingRatio),void 0!==t.period&&(this.options.period=t.period),void 0!==t.minLength&&(this.options.minLength=t.minLength)},e.prototype.setAnchor=function(t){this.options.anchor||(this.options.anchor=new o),this.options.anchor.set(t)},e.prototype.applyConstraint=function(t,i,e){var n,o,r=this.normal,a=this.diffP,h=this.diffV,c=this.impulse,p=this.options,u=p.dampingRatio,l=p.period,f=p.minLength;if(i){var d=i.velocity;n=i.position,o=i.inverseMass}else n=this.options.anchor,o=0;for(var _=this.options.length,g=0;g<t.length;g++){var y=t[g],v=y.velocity,m=y.position,O=y.inverseMass;a.set(m.sub(n)),r.set(a.normalize());var S=a.norm()-_;if(Math.abs(S)<f)return;h.set(i?v.sub(d):v);var T,w,b=1/(O+o);if(0===l)T=0,w=1;else{var E=4*b*s*u/l,I=4*b*s*s/(l*l);T=1/(E+e*I),w=e*I/(E+e*I)}var M=w/e*S,x=-(r.dot(h)+M)/(T+e/b);c.set(r.mult(e*x)),y.applyImpulse(c),i&&i.applyImpulse(c.mult(-1))}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],59:[function(t,i){function e(t){n.call(this),this.options=Object.create(this.constructor.DEFAULT_OPTIONS),t&&this.setOptions(t),this.pDiff=new o,this.vDiff=new o,this.impulse1=new o,this.impulse2=new o}var n=t("./Constraint"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={period:300,dampingRatio:.1,length:0,anchor:void 0};var s=Math.PI;e.prototype.setOptions=function(t){void 0!==t.anchor&&(t.anchor instanceof o&&(this.options.anchor=t.anchor),t.anchor.position instanceof o&&(this.options.anchor=t.anchor.position),t.anchor instanceof Array&&(this.options.anchor=new o(t.anchor))),void 0!==t.length&&(this.options.length=t.length),void 0!==t.dampingRatio&&(this.options.dampingRatio=t.dampingRatio),void 0!==t.period&&(this.options.period=t.period),n.prototype.setOptions.call(this,t)
},e.prototype.getEnergy=function(t,i){for(var e=this.options,n=e.length,o=e.anchor||i.position,r=Math.pow(2*s/e.period,2),a=0,h=0;h<t.length;h++){var c=t[h],p=o.sub(c.position).norm()-n;a+=.5*r*p*p}return a},e.prototype.applyConstraint=function(t,i,e){for(var n=this.options,o=this.pDiff,r=this.vDiff,a=this.impulse1,h=this.impulse2,c=n.length,p=n.anchor||i.position,u=n.period,l=n.dampingRatio,f=0;f<t.length;f++){var d=t[f],_=d.position,g=d.velocity,y=d.mass,v=d.inverseMass;o.set(_.sub(p));var m,O=o.norm()-c;if(i){var S=i.inverseMass,T=i.velocity;r.set(g.sub(T)),m=1/(v+S)}else r.set(g),m=y;var w,b;if(0===this.options.period)w=0,b=1;else{var E=4*m*s*s/(u*u),I=4*m*s*l/u;b=e*E/(I+e*E),w=1/(I+e*E)}var M=b/e*O;o.normalize(-M).sub(r).mult(e/(w+e/m)).put(a),d.applyImpulse(a),i&&(a.mult(-1).put(h),i.applyImpulse(h))}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],60:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.J=new o,this.impulse=new o,n.call(this)}var n=t("./Constraint"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={equation:void 0,period:0,dampingRatio:0};var s=1e-7,r=Math.PI;e.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},e.prototype.applyConstraint=function(t,i,e){for(var n=this.impulse,o=this.J,a=this.options,h=a.equation,c=a.dampingRatio,p=a.period,u=0;u<t.length;u++){var l,f,d=t[u],_=d.velocity,g=d.position,y=d.mass;if(0===p)l=0,f=1;else{var v=4*y*r*c/p,m=4*y*r*r/(p*p);l=1/(v+e*m),f=e*m/(v+e*m)}var O=g.x,S=g.y,T=g.z,w=h(O,S,T),b=(h(O+s,g,g)-w)/s,E=(h(O,S+s,g)-w)/s,I=(h(O,S,g+s)-w)/s;o.setXYZ(b,E,I);var M=f/e*w,x=-(o.dot(_)+M)/(l+e*o.normSquared()/y);n.set(o.mult(e*x)),d.applyImpulse(n)}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],61:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.diff=new h,this.impulse=new h,a.call(this)}function n(t,i){return i.dot(t)}function o(t){var i=this.options.normal,e=this.options.distance;return t.dot(i)+e}function s(t,i,n){var o=t.position,s=t.velocity,r=t.mass,a=this.options.normal,h=this.options.onContact,c=this.options.restitution,p=this.impulse,u=this.options.drift,l=-this.options.slop,f=0;if(this._eventOutput){var d={particle:t,wall:this,overlap:i,normal:a};this._eventOutput.emit("preCollision",d),this._eventOutput.emit("collision",d)}switch(h){case e.ON_CONTACT.REFLECT:var _=l>i?-((1+c)*a.dot(s)+u/n*(i-l))/(r*n+f):-((1+c)*a.dot(s))/(r*n+f);p.set(a.mult(n*_)),t.applyImpulse(p),t.setPosition(o.add(a.mult(-i)))}this._eventOutput&&this._eventOutput.emit("postCollision",d)}function r(t,i){var n=this.options.onContact,o=t.position,s=this.options.normal;n===e.ON_CONTACT.REFLECT&&t.setPosition(o.add(s.mult(-i)))}var a=t("./Constraint"),h=t("../../math/Vector");e.prototype=Object.create(a.prototype),e.prototype.constructor=e,e.ON_CONTACT={REFLECT:0,SILENT:1},e.DEFAULT_OPTIONS={restitution:.5,drift:.5,slop:0,normal:[1,0,0],distance:0,onContact:e.ON_CONTACT.REFLECT},e.prototype.setOptions=function(t){void 0!==t.normal&&(t.normal instanceof h&&(this.options.normal=t.normal.clone()),t.normal instanceof Array&&(this.options.normal=new h(t.normal))),void 0!==t.restitution&&(this.options.restitution=t.restitution),void 0!==t.drift&&(this.options.drift=t.drift),void 0!==t.slop&&(this.options.slop=t.slop),void 0!==t.distance&&(this.options.distance=t.distance),void 0!==t.onContact&&(this.options.onContact=t.onContact)},e.prototype.applyConstraint=function(t,i,e){for(var a=this.options.normal,h=0;h<t.length;h++){var c=t[h],p=c.position,u=c.velocity,l=c.radius||0,f=o.call(this,p.add(a.mult(-l))),d=n.call(this,a,u);0>=f&&(0>d?s.call(this,c,f,e):r.call(this,c,f,e))}},i.exports=e},{"../../math/Vector":42,"./Constraint":56}],62:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),o.call(this,t.sides||this.options.sides),r.call(this)}function n(t,i,n){var o,s=e.SIDES;switch(parseInt(t)){case s.LEFT:o=i[0]*n[0];break;case s.TOP:o=i[1]*n[1];break;case s.FRONT:o=i[2]*n[2];break;case s.RIGHT:o=i[0]*(1-n[0]);break;case s.BOTTOM:o=i[1]*(1-n[1]);break;case s.BACK:o=i[2]*(1-n[2])}return o}function o(t){this.components={};for(var i=this.components,e=0;e<t.length;e++){var o=t[e];i[e]=new a({normal:c[o].clone(),distance:n(o,this.options.size,this.options.origin)})}}function s(t){this.forEach(function(i){i.setOptions(t)});for(var i in t)this.options[i]=t[i]}var r=t("./Constraint"),a=t("./Wall"),h=t("../../math/Vector");e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.ON_CONTACT=a.ON_CONTACT,e.SIDES={LEFT:0,RIGHT:1,TOP:2,BOTTOM:3,FRONT:4,BACK:5,TWO_DIMENSIONAL:[0,1,2,3],THREE_DIMENSIONAL:[0,1,2,3,4,5]},e.DEFAULT_OPTIONS={sides:e.SIDES.TWO_DIMENSIONAL,size:[window.innerWidth,window.innerHeight,0],origin:[.5,.5,.5],drift:.5,slop:0,restitution:.5,onContact:e.ON_CONTACT.REFLECT};var c={0:new h(1,0,0),1:new h(-1,0,0),2:new h(0,1,0),3:new h(0,-1,0),4:new h(0,0,1),5:new h(0,0,-1)};e.prototype.setOptions=function(t){var i=!1;void 0!==t.restitution&&s.call(this,{restitution:t.restitution}),void 0!==t.drift&&s.call(this,{drift:t.drift}),void 0!==t.slop&&s.call(this,{slop:t.slop}),void 0!==t.onContact&&s.call(this,{onContact:t.onContact}),void 0!==t.size&&(i=!0),void 0!==t.sides&&(this.options.sides=t.sides),void 0!==t.origin&&(i=!0),i&&this.setSize(t.size,t.origin)},e.prototype.setSize=function(t,i){i=i||this.options.origin,i.length<3&&(i[2]=.5),this.forEach(function(e,o){var s=n(o,t,i);e.setOptions({distance:s})}),this.options.size=t,this.options.origin=i},e.prototype.applyConstraint=function(t,i,e){this.forEach(function(n){n.applyConstraint(t,i,e)})},e.prototype.forEach=function(t){var i=this.options.sides;for(var e in this.sides)t(i[e],e)},e.prototype.rotateZ=function(t){this.forEach(function(i){var e=i.options.normal;e.rotateZ(t).put(e)})},e.prototype.rotateX=function(t){this.forEach(function(i){var e=i.options.normal;e.rotateX(t).put(e)})},e.prototype.rotateY=function(t){this.forEach(function(i){var e=i.options.normal;e.rotateY(t).put(e)})},e.prototype.reset=function(){var t=this.options.sides;for(var i in t){var e=this.components[i];e.options.normal.set(c[i])}},i.exports=e},{"../../math/Vector":42,"./Constraint":56,"./Wall":61}],63:[function(t,i){i.exports={Collision:t("./Collision"),Constraint:t("./Constraint"),Curve:t("./Curve"),Distance:t("./Distance"),Snap:t("./Snap"),Surface:t("./Surface"),Wall:t("./Wall"),Walls:t("./Walls")}},{"./Collision":55,"./Constraint":56,"./Curve":57,"./Distance":58,"./Snap":59,"./Surface":60,"./Wall":61,"./Walls":62}],64:[function(t,i){function e(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS),t&&this.setOptions(t),n.call(this)}var n=t("./Force");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.FORCE_FUNCTIONS={LINEAR:function(t){return t},QUADRATIC:function(t){return t.mult(t.norm())}},e.DEFAULT_OPTIONS={strength:.01,forceFunction:e.FORCE_FUNCTIONS.LINEAR},e.prototype.applyForce=function(t){var i,e,n=this.options.strength,o=this.options.forceFunction,s=this.force;for(i=0;i<t.length;i++)e=t[i],o(e.velocity).mult(-n).put(s),e.applyForce(s)},e.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},i.exports=e},{"./Force":65}],65:[function(t,i){function e(t){this.force=new n(t),this._eventOutput=new o,o.setOutputHandler(this,this._eventOutput)}var n=t("../../math/Vector"),o=t("../../core/EventHandler");e.prototype.setOptions=function(t){this._eventOutput.emit("change",t)},e.prototype.applyForce=function(t){for(var i=t.length;i--;)t[i].applyForce(this.force)},e.prototype.getEnergy=function(){return 0},i.exports=e},{"../../core/EventHandler":7,"../../math/Vector":42}],66:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.disp=new o,n.call(this)}var n=t("./Force"),o=t("../../math/Vector");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DECAY_FUNCTIONS={LINEAR:function(t,i){return Math.max(1-1/i*t,0)},MORSE:function(t,i){var e=0===i?100:i,n=t+e*(1-Math.log(2));return Math.max(1-Math.pow(1-Math.exp(n/e-1),2),0)},INVERSE:function(t,i){return 1/(1-i+t)},GRAVITY:function(t,i){return 1/(1-i+t*t)}},e.DEFAULT_OPTIONS={strength:1,anchor:void 0,range:[0,1/0],cutoff:0,cap:1/0,decayFunction:e.DECAY_FUNCTIONS.GRAVITY},e.prototype.setOptions=function(t){void 0!==t.anchor&&(t.anchor.position instanceof o&&(this.options.anchor=t.anchor.position),t.anchor instanceof Array&&(this.options.anchor=new o(t.anchor)),delete t.anchor);for(var i in t)this.options[i]=t[i]},e.prototype.applyForce=function(t,i){var e=this.options,n=this.force,o=this.disp,s=e.strength,r=e.anchor||i.position,a=e.cap,h=e.cutoff,c=e.range[0],p=e.range[1],u=e.decayFunction;if(0!==s)for(var l,f,d,_,g=t.length;g--;)l=t[g],l!==i&&(f=l.mass,d=l.position,o.set(d.sub(r)),_=o.norm(),p>_&&_>c&&(n.set(o.normalize(s*f*u(_,h)).cap(a)),l.applyForce(n)))},i.exports=e},{"../../math/Vector":42,"./Force":65}],67:[function(t,i){function e(t){n.call(this,t)}var n=t("./Drag");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS=n.DEFAULT_OPTIONS,e.FORCE_FUNCTIONS=n.FORCE_FUNCTIONS,e.FORCE_FUNCTIONS={LINEAR:function(t){return t},QUADRATIC:function(t){return t.mult(t.norm())}},e.prototype.applyForce=function(t){var i,e,n=this.options.strength,o=this.options.forceFunction,s=this.force;for(i=0;i<t.length;i++)e=t[i],o(e.angularVelocity).mult(-100*n).put(s),e.applyTorque(s)},e.prototype.setOptions=function(t){for(var i in t)this.options[i]=t[i]},i.exports=e},{"./Drag":64}],68:[function(t,i){function e(t){a.call(this,t)}function n(){var t=this.options;t.stiffness=Math.pow(2*c/t.period,2)}function o(){var t=this.options;t.damping=4*c*t.dampingRatio/t.period}function s(){n.call(this),o.call(this)}var r=t("./Force"),a=t("./Spring"),h=t("../../math/Quaternion");e.prototype=Object.create(a.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS=a.DEFAULT_OPTIONS,e.FORCE_FUNCTIONS=a.FORCE_FUNCTIONS;var c=Math.PI;e.prototype.setOptions=function(t){void 0!==t.anchor&&(t.anchor instanceof h&&(this.options.anchor=t.anchor),t.anchor instanceof Array&&(this.options.anchor=new h(t.anchor))),void 0!==t.period&&(this.options.period=t.period),void 0!==t.dampingRatio&&(this.options.dampingRatio=t.dampingRatio),void 0!==t.length&&(this.options.length=t.length),void 0!==t.forceFunction&&(this.options.forceFunction=t.forceFunction),void 0!==t.maxLength&&(this.options.maxLength=t.maxLength),s.call(this),r.prototype.setOptions.call(this,t)},e.prototype.applyForce=function(t){var i,e,n,o,s=this.force,r=this.options,a=this.disp,h=r.stiffness,c=r.damping,p=r.length,u=r.anchor,l=r.forceFunction,f=r.maxLength;for(i=0;i<t.length;i++){if(e=t[i],a.set(u.sub(e.orientation)),n=a.norm()-p,0===n)return;o=e.mass,h*=o,c*=o,s.set(a.normalize(h*l(n,f))),c&&s.add(e.angularVelocity.mult(-c)).put(s),e.applyTorque(s)}},e.prototype.getEnergy=function(t){for(var i=this.options,e=i.length,n=i.anchor,o=i.stiffness,s=0,r=0;r<t.length;r++){var a=t[r],h=n.sub(a.orientation).norm()-e;s+=.5*o*h*h}return s},i.exports=e},{"../../math/Quaternion":39,"./Force":65,"./Spring":69}],69:[function(t,i){function e(t){r.call(this),this.options=Object.create(this.constructor.DEFAULT_OPTIONS),t&&this.setOptions(t),this.disp=new a(0,0,0),s.call(this)}function n(){var t=this.options;t.stiffness=Math.pow(2*h/t.period,2)}function o(){var t=this.options;t.damping=4*h*t.dampingRatio/t.period}function s(){n.call(this),o.call(this)}var r=t("./Force"),a=t("../../math/Vector");e.prototype=Object.create(r.prototype),e.prototype.constructor=e;var h=Math.PI,c=150;e.FORCE_FUNCTIONS={FENE:function(t,i){var e=.99*i,n=Math.max(Math.min(t,e),-e);return n/(1-n*n/(i*i))},HOOK:function(t){return t}},e.DEFAULT_OPTIONS={period:300,dampingRatio:.1,length:0,maxLength:1/0,anchor:void 0,forceFunction:e.FORCE_FUNCTIONS.HOOK},e.prototype.setOptions=function(t){void 0!==t.anchor&&(t.anchor.position instanceof a&&(this.options.anchor=t.anchor.position),t.anchor instanceof a&&(this.options.anchor=t.anchor),t.anchor instanceof Array&&(this.options.anchor=new a(t.anchor))),void 0!==t.period&&(t.period<c&&(t.period=c,console.warn("The period of a SpringTransition is capped at "+c+" ms. Use a SnapTransition for faster transitions")),this.options.period=t.period),void 0!==t.dampingRatio&&(this.options.dampingRatio=t.dampingRatio),void 0!==t.length&&(this.options.length=t.length),void 0!==t.forceFunction&&(this.options.forceFunction=t.forceFunction),void 0!==t.maxLength&&(this.options.maxLength=t.maxLength),s.call(this),r.prototype.setOptions.call(this,t)},e.prototype.applyForce=function(t,i){var e,n,o,s,r,a,h=this.force,c=this.disp,p=this.options,u=p.stiffness,l=p.damping,f=p.length,d=p.maxLength,_=p.anchor||i.position,g=p.forceFunction;for(e=0;e<t.length;e++){if(n=t[e],o=n.position,s=n.velocity,_.sub(o).put(c),r=c.norm()-f,0===r)return;a=n.mass,u*=a,l*=a,c.normalize(u*g(r,d)).put(h),l&&(i?h.add(s.sub(i.velocity).mult(-l)).put(h):h.add(s.mult(-l)).put(h)),n.applyForce(h),i&&i.applyForce(h.mult(-1))}},e.prototype.getEnergy=function(t,i){for(var e=this.options,n=e.length,o=i?i.position:e.anchor,s=e.stiffness,r=0,a=0;a<t.length;a++){var h=t[a],c=o.sub(h.position).norm()-n;r+=.5*s*c*c}return r},i.exports=e},{"../../math/Vector":42,"./Force":65}],70:[function(t,i){function e(t){o.call(this),this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this.evaluation=new s}function n(t){var i=e.FIELDS;switch(t){case i.CONSTANT:this.options.direction?this.options.direction instanceof Array&&(this.options.direction=new s(this.options.direction)):this.options.direction=new s(0,1,0);break;case i.POINT_ATTRACTOR:this.options.position?this.options.position instanceof Array&&(this.options.position=new s(this.options.position)):this.options.position=new s(0,0,0)}}var o=t("./Force"),s=t("../../math/Vector");e.prototype=Object.create(o.prototype),e.prototype.constructor=e,e.FIELDS={CONSTANT:function(t,i){i.direction.put(this.evaluation)},LINEAR:function(t){t.put(this.evaluation)},RADIAL:function(t){t.mult(-1).put(this.evaluation)},POINT_ATTRACTOR:function(t,i){i.position.sub(t).put(this.evaluation)}},e.DEFAULT_OPTIONS={strength:.01,field:e.FIELDS.CONSTANT},e.prototype.setOptions=function(t){void 0!==t.strength&&(this.options.strength=t.strength),void 0!==t.direction&&(this.options.direction=t.direction),void 0!==t.field&&(this.options.field=t.field,n.call(this,this.options.field))},e.prototype.applyForce=function(t){var i,e,n=this.force,o=this.options.strength,s=this.options.field;for(i=0;i<t.length;i++)e=t[i],s.call(this,e.position,this.options),this.evaluation.mult(e.mass*o).put(n),e.applyForce(n)},e.prototype.getEnergy=function(t){var i,n,o=this.options.field,s=e.FIELDS,r=0;switch(o){case s.CONSTANT:r=t.length*this.options.direction.norm();break;case s.RADIAL:for(i=0;i<t.length;i++)n=t[i],r+=n.position.norm();break;case s.POINT_ATTRACTOR:for(i=0;i<t.length;i++)n=t[i],r+=n.position.sub(this.options.position).norm()}return r*=this.options.strength},i.exports=e},{"../../math/Vector":42,"./Force":65}],71:[function(t,i){i.exports={Drag:t("./Drag"),Force:t("./Force"),Repulsion:t("./Repulsion"),RotationalDrag:t("./RotationalDrag"),RotationalSpring:t("./RotationalSpring"),Spring:t("./Spring"),VectorField:t("./VectorField")}},{"./Drag":64,"./Force":65,"./Repulsion":66,"./RotationalDrag":67,"./RotationalSpring":68,"./Spring":69,"./VectorField":70}],72:[function(t,i){i.exports={PhysicsEngine:t("./PhysicsEngine"),bodies:t("./bodies"),constraints:t("./constraints"),forces:t("./forces"),integrators:t("./integrators")}},{"./PhysicsEngine":49,"./bodies":54,"./constraints":63,"./forces":71,"./integrators":74}],73:[function(t,i){var e={};e.integrateVelocity=function(t,i){var e=t.velocity,n=t.inverseMass,o=t.force;o.isZero()||(e.add(o.mult(i*n)).put(e),o.clear())},e.integratePosition=function(t,i){var e=t.position,n=t.velocity;e.add(n.mult(i)).put(e)},e.integrateAngularMomentum=function(t,i){var e=t.angularMomentum,n=t.torque;n.isZero()||(e.add(n.mult(i)).put(e),n.clear())},e.integrateOrientation=function(t,i){var e=t.orientation,n=t.angularVelocity;n.isZero()||e.add(e.multiply(n).scalarMultiply(.5*i)).put(e)},i.exports=e},{}],74:[function(t,i){i.exports={SymplecticEuler:t("./SymplecticEuler")}},{"./SymplecticEuler":73}],75:[function(t,i){function e(t){t&&t.canvasSize&&(this._canvasSize=t.canvasSize),n.apply(this,arguments),this._canvasSize||(this._canvasSize=this.getSize()),this._backBuffer=document.createElement("canvas"),this._canvasSize&&(this._backBuffer.width=this._canvasSize[0],this._backBuffer.height=this._canvasSize[1]),this._contextId=void 0}var n=t("../core/Surface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="canvas",e.prototype.elementClass="famous-surface",e.prototype.setContent=function(){},e.prototype.deploy=function(t){this._canvasSize&&(t.width=this._canvasSize[0],t.height=this._canvasSize[1]),"2d"===this._contextId&&(t.getContext(this._contextId).drawImage(this._backBuffer,0,0),this._backBuffer.width=0,this._backBuffer.height=0)},e.prototype.recall=function(t){this.getSize();this._backBuffer.width=t.width,this._backBuffer.height=t.height,"2d"===this._contextId&&(this._backBuffer.getContext(this._contextId).drawImage(t,0,0),t.width=0,t.height=0)},e.prototype.getContext=function(t){return this._contextId=t,this._currentTarget?this._currentTarget.getContext(t):this._backBuffer.getContext(t)},e.prototype.setSize=function(t,i){n.prototype.setSize.apply(this,arguments),i&&(this._canvasSize=[i[0],i[1]]),this._currentTarget&&(this._currentTarget.width=this._canvasSize[0],this._currentTarget.height=this._canvasSize[1])},i.exports=e},{"../core/Surface":14}],76:[function(t,i){function e(t){n.call(this,t),this._container=document.createElement("div"),this._container.classList.add("famous-group"),this._container.classList.add("famous-container-group"),this._shouldRecalculateSize=!1,this.context=new o(this._container),this.setContent(this._container)}var n=t("../core/Surface"),o=t("../core/Context");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="div",e.prototype.elementClass="famous-surface",e.prototype.add=function(){return this.context.add.apply(this.context,arguments)},e.prototype.render=function(){return this._sizeDirty&&(this._shouldRecalculateSize=!0),n.prototype.render.apply(this,arguments)},e.prototype.deploy=function(){return this._shouldRecalculateSize=!0,n.prototype.deploy.apply(this,arguments)},e.prototype.commit=function(){var t=this._size?[this._size[0],this._size[1]]:null,i=n.prototype.commit.apply(this,arguments);return(this._shouldRecalculateSize||t&&(this._size[0]!==t[0]||this._size[1]!==t[1]))&&(this.context.setSize(),this._shouldRecalculateSize=!1),this.context.update(),i},i.exports=e},{"../core/Context":1,"../core/Surface":14}],77:[function(t,i){function e(t){t&&(this._method=t.method||""),n.apply(this,arguments)}var n=t("./ContainerSurface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="form",e.prototype.deploy=function(t){return this._method&&(t.method=this._method),n.prototype.deploy.apply(this,arguments)},i.exports=e},{"./ContainerSurface":76}],78:[function(t,i){function e(){this._imageUrl=void 0,n.apply(this,arguments)}var n=t("../core/Surface"),o=[],s=[],r=[],a=!0;e.enableCache=function(){a=!0},e.disableCache=function(){a=!1},e.clearCache=function(){o=[],s=[],r=[]},e.getCache=function(){return{urlCache:o,countCache:s,nodeCache:s}},e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="img",e.prototype.elementClass="famous-surface",e.prototype.setContent=function(t){var i=o.indexOf(this._imageUrl);-1!==i&&(1===s[i]?(o.splice(i,1),s.splice(i,1),r.splice(i,1)):s[i]--),i=o.indexOf(t),-1===i?(o.push(t),s.push(1)):s[i]++,this._imageUrl=t,this._contentDirty=!0},e.prototype.deploy=function(t){var i=o.indexOf(this._imageUrl);if(void 0===r[i]&&a){var e=new Image;e.src=this._imageUrl||"",r[i]=e}t.src=this._imageUrl||""},e.prototype.recall=function(t){t.src=""},i.exports=e},{"../core/Surface":14}],79:[function(t,i){function e(t){this._placeholder=t.placeholder||"",this._value=t.value||"",this._type=t.type||"text",this._name=t.name||"",n.apply(this,arguments),this.on("click",this.focus.bind(this)),window.addEventListener("click",function(t){t.target!==this._currentTarget&&this.blur()}.bind(this))}var n=t("../core/Surface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="input",e.prototype.elementClass="famous-surface",e.prototype.setPlaceholder=function(t){return this._placeholder=t,this._contentDirty=!0,this},e.prototype.focus=function(){return this._currentTarget&&this._currentTarget.focus(),this},e.prototype.blur=function(){return this._currentTarget&&this._currentTarget.blur(),this},e.prototype.setValue=function(t){return this._value=t,this._contentDirty=!0,this},e.prototype.setType=function(t){return this._type=t,this._contentDirty=!0,this},e.prototype.getValue=function(){return this._currentTarget?this._currentTarget.value:this._value},e.prototype.setName=function(t){return this._name=t,this._contentDirty=!0,this},e.prototype.getName=function(){return this._name},e.prototype.deploy=function(t){""!==this._placeholder&&(t.placeholder=this._placeholder),t.value=this._value,t.type=this._type,t.name=this._name},i.exports=e},{"../core/Surface":14}],80:[function(t,i){function e(t){n.apply(this,arguments),this._type="submit",t&&t.onClick&&this.setOnClick(t.onClick)}var n=t("./InputSurface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.setOnClick=function(t){this.onClick=t},e.prototype.deploy=function(t){this.onclick&&(t.onClick=this.onClick),n.prototype.deploy.apply(this,arguments)},i.exports=e},{"./InputSurface":79}],81:[function(t,i){function e(t){this._placeholder=t.placeholder||"",this._value=t.value||"",this._name=t.name||"",this._wrap=t.wrap||"",this._cols=t.cols||"",this._rows=t.rows||"",n.apply(this,arguments),this.on("click",this.focus.bind(this))}var n=t("../core/Surface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.prototype.elementType="textarea",e.prototype.elementClass="famous-surface",e.prototype.setPlaceholder=function(t){return this._placeholder=t,this._contentDirty=!0,this},e.prototype.focus=function(){return this._currentTarget&&this._currentTarget.focus(),this},e.prototype.blur=function(){return this._currentTarget&&this._currentTarget.blur(),this},e.prototype.setValue=function(t){return this._value=t,this._contentDirty=!0,this},e.prototype.getValue=function(){return this._currentTarget?this._currentTarget.value:this._value},e.prototype.setName=function(t){return this._name=t,this._contentDirty=!0,this},e.prototype.getName=function(){return this._name},e.prototype.setWrap=function(t){return this._wrap=t,this._contentDirty=!0,this},e.prototype.setColumns=function(t){return this._cols=t,this._contentDirty=!0,this},e.prototype.setRows=function(t){return this._rows=t,this._contentDirty=!0,this},e.prototype.deploy=function(t){""!==this._placeholder&&(t.placeholder=this._placeholder),""!==this._value&&(t.value=this._value),""!==this._name&&(t.name=this._name),""!==this._wrap&&(t.wrap=this._wrap),""!==this._cols&&(t.cols=this._cols),""!==this._rows&&(t.rows=this._rows)},i.exports=e},{"../core/Surface":14}],82:[function(t,i){function e(t){n.apply(this,arguments),this._videoUrl=void 0,this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t)}var n=t("../core/Surface");e.prototype=Object.create(n.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={autoplay:!1},e.prototype.elementType="video",e.prototype.elementClass="famous-surface",e.prototype.setOptions=function(t){t.size&&this.setSize(t.size),t.classes&&this.setClasses(t.classes),t.properties&&this.setProperties(t.properties),t.autoplay&&(this.options.autoplay=t.autoplay),t.src&&(this._videoUrl=t.src,this._contentDirty=!0)},e.prototype.setContent=function(t){this._videoUrl=t,this._contentDirty=!0},e.prototype.deploy=function(t){t.src=this._videoUrl,t.autoplay=this.options.autoplay},e.prototype.recall=function(t){t.src=""},i.exports=e},{"../core/Surface":14}],83:[function(t,i){i.exports={CanvasSurface:t("./CanvasSurface"),ContainerSurface:t("./ContainerSurface"),FormContainerSurface:t("./FormContainerSurface"),ImageSurface:t("./ImageSurface"),InputSurface:t("./InputSurface"),SubmitInputSurface:t("./SubmitInputSurface"),TextareaSurface:t("./TextareaSurface"),VideoSurface:t("./VideoSurface")}},{"./CanvasSurface":75,"./ContainerSurface":76,"./FormContainerSurface":77,"./ImageSurface":78,"./InputSurface":79,"./SubmitInputSurface":80,"./TextareaSurface":81,"./VideoSurface":82}],84:[function(t,i){function e(t){this._map=t||null,this._cachedOutput=null,this._cachedInput=Number.NaN}e.create=function(t){var i=new e(t);return i.get.bind(i)},e.prototype.get=function(t){return t!==this._cachedInput&&(this._cachedInput=t,this._cachedOutput=this._map(t)),this._cachedOutput},i.exports=e},{}],85:[function(t,i){var e={inQuad:function(t){return t*t},outQuad:function(t){return-(t-=1)*t+1},inOutQuad:function(t){return(t/=.5)<1?.5*t*t:-.5*(--t*(t-2)-1)},inCubic:function(t){return t*t*t},outCubic:function(t){return--t*t*t+1},inOutCubic:function(t){return(t/=.5)<1?.5*t*t*t:.5*((t-=2)*t*t+2)},inQuart:function(t){return t*t*t*t},outQuart:function(t){return-(--t*t*t*t-1)},inOutQuart:function(t){return(t/=.5)<1?.5*t*t*t*t:-.5*((t-=2)*t*t*t-2)},inQuint:function(t){return t*t*t*t*t},outQuint:function(t){return--t*t*t*t*t+1},inOutQuint:function(t){return(t/=.5)<1?.5*t*t*t*t*t:.5*((t-=2)*t*t*t*t+2)},inSine:function(t){return-1*Math.cos(t*(Math.PI/2))+1},outSine:function(t){return Math.sin(t*(Math.PI/2))},inOutSine:function(t){return-.5*(Math.cos(Math.PI*t)-1)},inExpo:function(t){return 0===t?0:Math.pow(2,10*(t-1))},outExpo:function(t){return 1===t?1:-Math.pow(2,-10*t)+1},inOutExpo:function(t){return 0===t?0:1===t?1:(t/=.5)<1?.5*Math.pow(2,10*(t-1)):.5*(-Math.pow(2,-10*--t)+2)},inCirc:function(t){return-(Math.sqrt(1-t*t)-1)},outCirc:function(t){return Math.sqrt(1- --t*t)},inOutCirc:function(t){return(t/=.5)<1?-.5*(Math.sqrt(1-t*t)-1):.5*(Math.sqrt(1-(t-=2)*t)+1)},inElastic:function(t){var i=1.70158,e=0,n=1;return 0===t?0:1===t?1:(e||(e=.3),i=e/(2*Math.PI)*Math.asin(1/n),-(n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e)))},outElastic:function(t){var i=1.70158,e=0,n=1;return 0===t?0:1===t?1:(e||(e=.3),i=e/(2*Math.PI)*Math.asin(1/n),n*Math.pow(2,-10*t)*Math.sin(2*(t-i)*Math.PI/e)+1)},inOutElastic:function(t){var i=1.70158,e=0,n=1;return 0===t?0:2===(t/=.5)?1:(e||(e=.3*1.5),i=e/(2*Math.PI)*Math.asin(1/n),1>t?-.5*n*Math.pow(2,10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e):n*Math.pow(2,-10*(t-=1))*Math.sin(2*(t-i)*Math.PI/e)*.5+1)},inBack:function(t,i){return void 0===i&&(i=1.70158),t*t*((i+1)*t-i)},outBack:function(t,i){return void 0===i&&(i=1.70158),--t*t*((i+1)*t+i)+1},inOutBack:function(t,i){return void 0===i&&(i=1.70158),(t/=.5)<1?.5*t*t*(((i*=1.525)+1)*t-i):.5*((t-=2)*t*(((i*=1.525)+1)*t+i)+2)},inBounce:function(t){return 1-e.outBounce(1-t)},outBounce:function(t){return 1/2.75>t?7.5625*t*t:2/2.75>t?7.5625*(t-=1.5/2.75)*t+.75:2.5/2.75>t?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375},inOutBounce:function(t){return.5>t?.5*e.inBounce(2*t):.5*e.outBounce(2*t-1)+.5}};i.exports=e},{}],86:[function(t,i){function e(t){this.method=t,this._instances=[],this.state=[]}var n=t("../utilities/Utility");e.SUPPORTS_MULTIPLE=!0,e.prototype.get=function(){for(var t=0;t<this._instances.length;t++)this.state[t]=this._instances[t].get();return this.state},e.prototype.set=function(t,i,e){for(var o=n.after(t.length,e),s=0;s<t.length;s++)this._instances[s]||(this._instances[s]=new this.method),this._instances[s].set(t[s],i,o)},e.prototype.reset=function(t){for(var i=0;i<t.length;i++)this._instances[i]||(this._instances[i]=new this.method),this._instances[i].reset(t[i])},i.exports=e},{"../utilities/Utility":96}],87:[function(t,i){function e(t){t=t||0,this.endState=new v(t),this.initState=new v,this._dimensions=1,this._restTolerance=1e-10,this._absRestTolerance=this._restTolerance,this._callback=void 0,this.PE=new _,this.particle=new g,this.spring=new y({anchor:this.endState}),this.PE.addBody(this.particle),this.PE.attach(this.spring,this.particle)}function n(){return this.particle.getEnergy()+this.spring.getEnergy([this.particle])}function o(){var t=this.endState.sub(this.initState).normSquared();this._absRestTolerance=0===t?this._restTolerance:this._restTolerance*t}function s(t){this.endState.set(t),o.call(this)}function r(){this.PE.wake()}function a(){this.PE.sleep()}function h(t){this.particle.position.set(t)}function c(t){this.particle.velocity.set(t)}function p(){return 0===this._dimensions?this.particle.getPosition1D():this.particle.getPosition()}function u(){return 0===this._dimensions?this.particle.getVelocity1D():this.particle.getVelocity()}function l(t){this._callback=t}function f(t){var i=e.DEFAULT_OPTIONS;void 0===t.period&&(t.period=i.period),void 0===t.dampingRatio&&(t.dampingRatio=i.dampingRatio),void 0===t.velocity&&(t.velocity=i.velocity),this.spring.setOptions({period:t.period,dampingRatio:t.dampingRatio}),c.call(this,t.velocity)}function d(){if(this.PE.isSleeping()){if(this._callback){var t=this._callback;this._callback=void 0,t()}}else n.call(this)<this._absRestTolerance&&(h.call(this,this.endState),c.call(this,[0,0,0]),a.call(this))}var _=t("../physics/PhysicsEngine"),g=t("../physics/bodies/Particle"),y=t("../physics/constraints/Snap"),v=t("../math/Vector");e.SUPPORTS_MULTIPLE=3,e.DEFAULT_OPTIONS={period:100,dampingRatio:.2,velocity:0},e.prototype.reset=function(t,i){this._dimensions=t instanceof Array?t.length:0,this.initState.set(t),h.call(this,t),s.call(this,t),i&&c.call(this,i),l.call(this,void 0)},e.prototype.getVelocity=function(){return u.call(this)},e.prototype.setVelocity=function(t){this.call(this,c(t))},e.prototype.isActive=function(){return!this.PE.isSleeping()},e.prototype.halt=function(){this.set(this.get())},e.prototype.get=function(){return d.call(this),p.call(this)},e.prototype.set=function(t,i,e){return i?(this._dimensions=t instanceof Array?t.length:0,r.call(this),f.call(this,i),s.call(this,t),void l.call(this,e)):(this.reset(t),void(e&&e()))},i.exports=e},{"../math/Vector":42,"../physics/PhysicsEngine":49,"../physics/bodies/Particle":52,"../physics/constraints/Snap":59}],88:[function(t,i){function e(t){t=t||0,this.endState=new v(t),this.initState=new v,this._dimensions=void 0,this._restTolerance=1e-10,this._absRestTolerance=this._restTolerance,this._callback=void 0,this.PE=new _,this.spring=new y({anchor:this.endState}),this.particle=new g,this.PE.addBody(this.particle),this.PE.attach(this.spring,this.particle)}function n(){return this.particle.getEnergy()+this.spring.getEnergy([this.particle])}function o(t){this.particle.setPosition(t)}function s(t){this.particle.setVelocity(t)}function r(){return 0===this._dimensions?this.particle.getPosition1D():this.particle.getPosition()}function a(){return 0===this._dimensions?this.particle.getVelocity1D():this.particle.getVelocity()}function h(t){this._callback=t}function c(){this.PE.wake()}function p(){this.PE.sleep()}function u(){if(this.PE.isSleeping()){if(this._callback){var t=this._callback;this._callback=void 0,t()}}else n.call(this)<this._absRestTolerance&&(o.call(this,this.endState),s.call(this,[0,0,0]),p.call(this))}function l(t){var i=e.DEFAULT_OPTIONS;void 0===t.period&&(t.period=i.period),void 0===t.dampingRatio&&(t.dampingRatio=i.dampingRatio),void 0===t.velocity&&(t.velocity=i.velocity),t.period<150&&(t.period=150,console.warn("The period of a SpringTransition is capped at 150 ms. Use a SnapTransition for faster transitions")),this.spring.setOptions({period:t.period,dampingRatio:t.dampingRatio}),s.call(this,t.velocity)}function f(){var t=this.endState.sub(this.initState).normSquared();
this._absRestTolerance=0===t?this._restTolerance:this._restTolerance*t}function d(t){this.endState.set(t),f.call(this)}var _=t("../physics/PhysicsEngine"),g=t("../physics/bodies/Particle"),y=t("../physics/forces/Spring"),v=t("../math/Vector");e.SUPPORTS_MULTIPLE=3,e.DEFAULT_OPTIONS={period:300,dampingRatio:.5,velocity:0},e.prototype.reset=function(t,i){this._dimensions=t instanceof Array?t.length:0,this.initState.set(t),o.call(this,t),d.call(this,t),i&&s.call(this,i),h.call(this,void 0)},e.prototype.getVelocity=function(){return a.call(this)},e.prototype.setVelocity=function(t){this.call(this,s(t))},e.prototype.isActive=function(){return!this.PE.isSleeping()},e.prototype.halt=function(){this.set(this.get())},e.prototype.get=function(){return u.call(this),r.call(this)},e.prototype.set=function(t,i,e){return i?(this._dimensions=t instanceof Array?t.length:0,c.call(this),l.call(this,i),d.call(this,t),void h.call(this,e)):(this.reset(t),void(e&&e()))},i.exports=e},{"../math/Vector":42,"../physics/PhysicsEngine":49,"../physics/bodies/Particle":52,"../physics/forces/Spring":69}],89:[function(t,i){function e(t){this.currentAction=null,this.actionQueue=[],this.callbackQueue=[],this.state=0,this.velocity=void 0,this._callback=void 0,this._engineInstance=null,this._currentMethod=null,this.set(t)}function n(){if(this._callback){var t=this._callback;this._callback=void 0,t()}if(this.actionQueue.length<=0)return void this.set(this.get());this.currentAction=this.actionQueue.shift(),this._callback=this.callbackQueue.shift();var i=null,e=this.currentAction[0],a=this.currentAction[1];a instanceof Object&&a.method?(i=a.method,"string"==typeof i&&(i=r[i])):i=s,this._currentMethod!==i&&(this._engineInstance=!(e instanceof Object)||i.SUPPORTS_MULTIPLE===!0||e.length<=i.SUPPORTS_MULTIPLE?new i:new o(i),this._currentMethod=i),this._engineInstance.reset(this.state,this.velocity),void 0!==this.velocity&&(a.velocity=this.velocity),this._engineInstance.set(e,a,n.bind(this))}var o=t("./MultipleTransition"),s=t("./TweenTransition"),r={};e.register=function(t){var i=!0;for(var n in t)e.registerMethod(n,t[n])||(i=!1);return i},e.registerMethod=function(t,i){return t in r?!1:(r[t]=i,!0)},e.unregisterMethod=function(t){return t in r?(delete r[t],!0):!1},e.prototype.set=function(t,i,e){if(!i)return this.reset(t),e&&e(),this;var o=[t,i];return this.actionQueue.push(o),this.callbackQueue.push(e),this.currentAction||n.call(this),this},e.prototype.reset=function(t,i){this._currentMethod=null,this._engineInstance=null,this._callback=void 0,this.state=t,this.velocity=i,this.currentAction=null,this.actionQueue=[],this.callbackQueue=[]},e.prototype.delay=function(t,i){this.set(this.get(),{duration:t,curve:function(){return 0}},i)},e.prototype.get=function(t){return this._engineInstance&&(this._engineInstance.getVelocity&&(this.velocity=this._engineInstance.getVelocity()),this.state=this._engineInstance.get(t)),this.state},e.prototype.isActive=function(){return!!this.currentAction},e.prototype.halt=function(){return this.set(this.get())},i.exports=e},{"./MultipleTransition":86,"./TweenTransition":91}],90:[function(t,i){function e(t){this._final=r.identity.slice(),this._finalTranslate=[0,0,0],this._finalRotate=[0,0,0],this._finalSkew=[0,0,0],this._finalScale=[1,1,1],this.translate=new s(this._finalTranslate),this.rotate=new s(this._finalRotate),this.skew=new s(this._finalSkew),this.scale=new s(this._finalScale),t&&this.set(t)}function n(){return r.build({translate:this.translate.get(),rotate:this.rotate.get(),skew:this.skew.get(),scale:this.scale.get()})}function o(){return r.build({translate:this._finalTranslate,rotate:this._finalRotate,skew:this._finalSkew,scale:this._finalScale})}var s=t("./Transitionable"),r=t("../core/Transform"),a=t("../utilities/Utility");e.prototype.setTranslate=function(t,i,e){return this._finalTranslate=t,this._final=o.call(this),this.translate.set(t,i,e),this},e.prototype.setScale=function(t,i,e){return this._finalScale=t,this._final=o.call(this),this.scale.set(t,i,e),this},e.prototype.setRotate=function(t,i,e){return this._finalRotate=t,this._final=o.call(this),this.rotate.set(t,i,e),this},e.prototype.setSkew=function(t,i,e){return this._finalSkew=t,this._final=o.call(this),this.skew.set(t,i,e),this},e.prototype.set=function(t,i,e){var n=r.interpret(t);this._finalTranslate=n.translate,this._finalRotate=n.rotate,this._finalSkew=n.skew,this._finalScale=n.scale,this._final=t;var o=e?a.after(4,e):null;return this.translate.set(n.translate,i,o),this.rotate.set(n.rotate,i,o),this.skew.set(n.skew,i,o),this.scale.set(n.scale,i,o),this},e.prototype.setDefaultTransition=function(t){this.translate.setDefault(t),this.rotate.setDefault(t),this.skew.setDefault(t),this.scale.setDefault(t)},e.prototype.get=function(){return this.isActive()?n.call(this):this._final},e.prototype.getFinal=function(){return this._final},e.prototype.isActive=function(){return this.translate.isActive()||this.rotate.isActive()||this.scale.isActive()||this.skew.isActive()},e.prototype.halt=function(){return this.translate.halt(),this.rotate.halt(),this.skew.halt(),this.scale.halt(),this._final=this.get(),this._finalTranslate=this.translate.get(),this._finalRotate=this.rotate.get(),this._finalSkew=this.skew.get(),this._finalScale=this.scale.get(),this},i.exports=e},{"../core/Transform":15,"../utilities/Utility":96,"./Transitionable":89}],91:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),t&&this.setOptions(t),this._startTime=0,this._startValue=0,this._updateTime=0,this._endValue=0,this._curve=void 0,this._duration=0,this._active=!1,this._callback=void 0,this.state=0,this.velocity=void 0}function n(t,i,e){return(1-e)*t+e*i}function o(t){return t instanceof Object?t instanceof Array?t.slice(0):Object.create(t):t}function s(t,i){var n={curve:i.curve};return i.duration&&(n.duration=i.duration),i.speed&&(n.speed=i.speed),t instanceof Object&&(void 0!==t.duration&&(n.duration=t.duration),t.curve&&(n.curve=t.curve),t.speed&&(n.speed=t.speed)),"string"==typeof n.curve&&(n.curve=e.getCurve(n.curve)),n}function r(t,i,e,n,o){var s,r=1e-7,a=(e(o)-e(o-r))/r;if(t instanceof Array){s=[];for(var h=0;h<t.length;h++)s[h]="number"==typeof t[h]?a*(t[h]-i[h])/n:0}else s=a*(t-i)/n;return s}function a(t,i,e){var o;if(t instanceof Array){o=[];for(var s=0;s<t.length;s++)o[s]="number"==typeof t[s]?n(t[s],i[s],e):t[s]}else o=n(t,i,e);return o}e.Curves={linear:function(t){return t},easeIn:function(t){return t*t},easeOut:function(t){return t*(2-t)},easeInOut:function(t){return.5>=t?2*t*t:-2*t*t+4*t-1},easeOutBounce:function(t){return t*(3-2*t)},spring:function(t){return(1-t)*Math.sin(6*Math.PI*t)+t}},e.SUPPORTS_MULTIPLE=!0,e.DEFAULT_OPTIONS={curve:e.Curves.linear,duration:500,speed:0};var h={};e.registerCurve=function(t,i){return h[t]?!1:(h[t]=i,!0)},e.unregisterCurve=function(t){return h[t]?(delete h[t],!0):!1},e.getCurve=function(t){var i=h[t];if(void 0!==i)return i;throw new Error("curve not registered")},e.getCurves=function(){return h},e.prototype.setOptions=function(t){void 0!==t.curve&&(this.options.curve=t.curve),void 0!==t.duration&&(this.options.duration=t.duration),void 0!==t.speed&&(this.options.speed=t.speed)},e.prototype.set=function(t,i,e){if(!i)return this.reset(t),void(e&&e());if(this._startValue=o(this.get()),i=s(i,this.options),i.speed){var n=this._startValue;if(n instanceof Object){var r=0;for(var a in n)r+=(t[a]-n[a])*(t[a]-n[a]);i.duration=Math.sqrt(r)/i.speed}else i.duration=Math.abs(t-n)/i.speed}this._startTime=Date.now(),this._endValue=o(t),this._startVelocity=o(i.velocity),this._duration=i.duration,this._curve=i.curve,this._active=!0,this._callback=e},e.prototype.reset=function(t,i){if(this._callback){var e=this._callback;this._callback=void 0,e()}this.state=o(t),this.velocity=o(i),this._startTime=0,this._duration=0,this._updateTime=0,this._startValue=this.state,this._startVelocity=this.velocity,this._endValue=this.state,this._active=!1},e.prototype.getVelocity=function(){return this.velocity},e.prototype.get=function(t){return this.update(t),this.state},e.prototype.update=function(t){if(this._active){if(t||(t=Date.now()),!(this._updateTime>=t)){this._updateTime=t;var i=t-this._startTime;if(i>=this._duration)this.state=this._endValue,this.velocity=r(this.state,this._startValue,this._curve,this._duration,1),this._active=!1;else if(0>i)this.state=this._startValue,this.velocity=this._startVelocity;else{var e=i/this._duration;this.state=a(this._startValue,this._endValue,this._curve(e)),this.velocity=r(this.state,this._startValue,this._curve,this._duration,e)}}}else if(this._callback){var n=this._callback;this._callback=void 0,n()}},e.prototype.isActive=function(){return this._active},e.prototype.halt=function(){this.reset(this.get())},e.registerCurve("linear",e.Curves.linear),e.registerCurve("easeIn",e.Curves.easeIn),e.registerCurve("easeOut",e.Curves.easeOut),e.registerCurve("easeInOut",e.Curves.easeInOut),e.registerCurve("easeOutBounce",e.Curves.easeOutBounce),e.registerCurve("spring",e.Curves.spring),e.customCurve=function(t,i){return t=t||0,i=i||0,function(e){return t*e+(-2*t-i+3)*e*e+(t+i-2)*e*e*e}},i.exports=e},{}],92:[function(t,i){function e(t){t=t||0,this.endState=new m(t),this.initState=new m,this.spring=new y({anchor:this.endState}),this.wall=new v,this._restTolerance=1e-10,this._dimensions=1,this._absRestTolerance=this._restTolerance,this._callback=void 0,this.PE=new _,this.particle=new g,this.PE.addBody(this.particle),this.PE.attach([this.wall,this.spring],this.particle)}function n(){return this.particle.getEnergy()+this.spring.getEnergy([this.particle])}function o(){var t=this.endState.sub(this.initState).normSquared();this._absRestTolerance=0===t?this._restTolerance:this._restTolerance*t}function s(){this.PE.wake()}function r(){this.PE.sleep()}function a(t){this.endState.set(t);var i=this.endState.sub(this.initState).norm();this.wall.setOptions({distance:this.endState.norm(),normal:0===i?this.particle.velocity.normalize(-1):this.endState.sub(this.initState).normalize(-1)}),o.call(this)}function h(t){this.particle.position.set(t)}function c(t){this.particle.velocity.set(t)}function p(){return 0===this._dimensions?this.particle.getPosition1D():this.particle.getPosition()}function u(){return 0===this._dimensions?this.particle.getVelocity1D():this.particle.getVelocity()}function l(t){this._callback=t}function f(){if(this.PE.isSleeping()){if(this._callback){var t=this._callback;this._callback=void 0,t()}}else{var i=n.call(this);i<this._absRestTolerance&&(r.call(this),h.call(this,this.endState),c.call(this,[0,0,0]))}}function d(t){var i=e.DEFAULT_OPTIONS;void 0===t.period&&(t.period=i.period),void 0===t.dampingRatio&&(t.dampingRatio=i.dampingRatio),void 0===t.velocity&&(t.velocity=i.velocity),void 0===t.restitution&&(t.restitution=i.restitution),void 0===t.drift&&(t.drift=v.DEFAULT_OPTIONS.drift),void 0===t.slop&&(t.slop=v.DEFAULT_OPTIONS.slop),this.spring.setOptions({period:t.period,dampingRatio:t.dampingRatio}),this.wall.setOptions({restitution:t.restitution,drift:t.drift,slop:t.slop}),c.call(this,t.velocity)}var _=t("../physics/PhysicsEngine"),g=t("../physics/bodies/Particle"),y=t("../physics/forces/Spring"),v=t("../physics/constraints/Wall"),m=t("../math/Vector");e.SUPPORTS_MULTIPLE=3,e.DEFAULT_OPTIONS={period:300,dampingRatio:.5,velocity:0,restitution:.5},e.prototype.reset=function(t,i){this._dimensions=t instanceof Array?t.length:0,this.initState.set(t),h.call(this,t),i&&c.call(this,i),a.call(this,t),l.call(this,void 0)},e.prototype.getVelocity=function(){return u.call(this)},e.prototype.setVelocity=function(t){this.call(this,c(t))},e.prototype.isActive=function(){return!this.PE.isSleeping()},e.prototype.halt=function(){this.set(this.get())},e.prototype.get=function(){return f.call(this),p.call(this)},e.prototype.set=function(t,i,e){return i?(this._dimensions=t instanceof Array?t.length:0,s.call(this),d.call(this,i),a.call(this,t),void l.call(this,e)):(this.reset(t),void(e&&e()))},i.exports=e},{"../math/Vector":42,"../physics/PhysicsEngine":49,"../physics/bodies/Particle":52,"../physics/constraints/Wall":61,"../physics/forces/Spring":69}],93:[function(t,i){i.exports={CachedMap:t("./CachedMap"),Easing:t("./Easing"),MultipleTransition:t("./MultipleTransition"),SnapTransition:t("./SnapTransition"),SpringTransition:t("./SpringTransition"),Transitionable:t("./Transitionable"),TransitionableTransform:t("./TransitionableTransform"),TweenTransition:t("./TweenTransition"),WallTransition:t("./WallTransition")}},{"./CachedMap":84,"./Easing":85,"./MultipleTransition":86,"./SnapTransition":87,"./SpringTransition":88,"./Transitionable":89,"./TransitionableTransform":90,"./TweenTransition":91,"./WallTransition":92}],94:[function(t,i){var e={0:48,1:49,2:50,3:51,4:52,5:53,6:54,7:55,8:56,9:57,a:97,b:98,c:99,d:100,e:101,f:102,g:103,h:104,i:105,j:106,k:107,l:108,m:109,n:110,o:111,p:112,q:113,r:114,s:115,t:116,u:117,v:118,w:119,x:120,y:121,z:122,A:65,B:66,C:67,D:68,E:69,F:70,G:71,H:72,I:73,J:74,K:75,L:76,M:77,N:78,O:79,P:80,Q:81,R:82,S:83,T:84,U:85,V:86,W:87,X:88,Y:89,Z:90,ENTER:13,LEFT_ARROW:37,RIGHT_ARROW:39,UP_ARROW:38,DOWN_ARROW:40,SPACE:32,SHIFT:16,TAB:9};i.exports=e},{}],95:[function(t,i){function e(t){return c.on(p,t),t}function n(t,i){var n=u(),o=function(){var e=u();e-n>=i&&(t.apply(this,arguments),c.removeListener(p,o))};return e(o)}function o(t,i){var n=u(),o=function(){var e=u();e-n>=i&&(t.apply(this,arguments),n=u())};return e(o)}function s(t,i){if(void 0===i)return void 0;var n=function(){i--,0>=i&&(t.apply(this,arguments),a(n))};return e(n)}function r(t,i){i=i||1;var n=i,o=function(){i--,0>=i&&(t.apply(this,arguments),i=n)};return e(o)}function a(t){c.removeListener(p,t)}function h(t,i){var e,o,s,r,h;return function(){o=this,h=arguments,s=u();var c=function(){var a=u-s;i>a?e=n(c,i-a):(e=null,r=t.apply(o,h))};return a(e),e=n(c,i),r}}var c=t("../core/Engine"),p="prerender",u=window.performance&&window.performance.now?function(){return window.performance.now()}:function(){return Date.now()};i.exports={setTimeout:n,setInterval:o,debounce:h,after:s,every:r,clear:a}},{"../core/Engine":4}],96:[function(t,i){var e={};e.Direction={X:0,Y:1,Z:2},e.after=function(t,i){var e=t;return function(){e--,0===e&&i.apply(this,arguments)}},e.loadURL=function(t,i){var e=new XMLHttpRequest;e.onreadystatechange=function(){4===this.readyState&&i&&i(this.responseText)},e.open("GET",t),e.send()},e.createDocumentFragmentFromHTML=function(t){var i=document.createElement("div");i.innerHTML=t;for(var e=document.createDocumentFragment();i.hasChildNodes();)e.appendChild(i.firstChild);return e},e.clone=function(t){var i;if("object"==typeof t){i=t instanceof Array?[]:{};for(var n in t)if("object"==typeof t[n]&&null!==t[n])if(t[n]instanceof Array){i[n]=new Array(t[n].length);for(var o=0;o<t[n].length;o++)i[n][o]=e.clone(t[n][o])}else i[n]=e.clone(t[n]);else i[n]=t[n]}else i=t;return i},i.exports=e},{}],97:[function(t,i){i.exports={KeyCodes:t("./KeyCodes"),Timer:t("./Timer"),Utility:t("./Utility")}},{"./KeyCodes":94,"./Timer":95,"./Utility":96}],98:[function(t,i){function e(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS||e.DEFAULT_OPTIONS),this._optionsManager=new s(this.options),t&&this.setOptions(t),this._eventInput=new o,this._eventOutput=new o,o.setInputHandler(this,this._eventInput),o.setOutputHandler(this,this._eventOutput),this._id=n.register(this)}var n=t("../core/Entity"),o=(t("../core/Transform"),t("../core/EventHandler")),s=t("../core/OptionsManager");e.DEFAULT_OPTIONS={},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.getOptions=function(t){return this._optionsManager.getOptions(t)},e.prototype.render=function(){return this._id},e.prototype.commit=function(){},i.exports=e},{"../core/Entity":5,"../core/EventHandler":7,"../core/OptionsManager":10,"../core/Transform":15}],99:[function(t,i){function e(){c.apply(this,arguments),this.state=new a(0),this._isOpen=!1,this.setOutputFunction(function(t,i,e){var o=n.call(this),r=this.options.direction===h.Direction.X?s.translate(o*i,0,.001*(o-1)*i):s.translate(0,o*i,.001*(o-1)*i),a=t.render();if(this.options.stackRotation){var c=this.options.stackRotation*e*(1-o);a={transform:s.rotateZ(c),origin:[.5,.5],target:a}}return{transform:r,size:t.getSize(),target:a}})}function n(t){return t?this._isOpen?1:0:this.state.get()}function o(t,i,e){this.state.halt(),this.state.set(t,i,e)}var s=t("../core/Transform"),r=t("../core/OptionsManager"),a=t("../transitions/Transitionable"),h=t("../utilities/Utility"),c=t("./SequentialLayout");e.prototype=Object.create(c.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS=r.patch(c.DEFAULT_OPTIONS,{transition:{curve:"easeOutBounce",duration:500},stackRotation:0}),e.prototype.getSize=function(){var t=c.prototype.getSize.apply(this,arguments),i=this._items?this._items.get().getSize():[0,0];i||(i=[0,0]);var e=n.call(this),o=1-e;return[i[0]*o+t[0]*e,i[1]*o+t[1]*e]},e.prototype.isOpen=function(){return this._isOpen},e.prototype.open=function(t){this._isOpen=!0,o.call(this,1,this.options.transition,t)},e.prototype.close=function(t){this._isOpen=!1,o.call(this,0,this.options.transition,t)},e.prototype.toggle=function(t){this._isOpen?this.close(t):this.open(t)},i.exports=e},{"../core/OptionsManager":10,"../core/Transform":15,"../transitions/Transitionable":89,"../utilities/Utility":96,"./SequentialLayout":111}],100:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new p(this.options),t&&this.setOptions(t),this._position=new u(0),this._direction=n(this.options.side),this._orientation=o(this.options.side),this._isOpen=!1,this._cachedLength=0,this.drawer=new h,this.content=new h,this._eventInput=new l,this._eventOutput=new l,l.setInputHandler(this,this._eventInput),l.setOutputHandler(this,this._eventOutput),this._eventInput.on("update",r.bind(this)),this._eventInput.on("end",a.bind(this))}function n(t){var i=e.SIDES;return t===i.LEFT||t===i.RIGHT?f:d}function o(t){var i=e.SIDES;return t===i.LEFT||t===i.TOP?1:-1}function s(t){var i,e=this.options;if(e.drawerLength)i=e.drawerLength;else{var n=t.getSize();i=n?n[this._direction]:e.drawerLength}return this._orientation*i}function r(t){var i,e,n=this.getPosition()+t.delta;this._cachedLength=s.call(this,this.drawer),1===this._orientation?(i=0,e=this._cachedLength):(i=this._cachedLength,e=0),n>e?n=e:i>n&&(n=i),this.setPosition(n)}function a(t){var i=t.velocity,e=this._orientation*this.getPosition(),n=this.options,o=this._orientation*this._cachedLength,s=n.positionThreshold||o/2,r=n.velocityThreshold;if(n.transition instanceof Object&&(n.transition.velocity=t.velocity),0===e)return void(this._isOpen=!1);if(e===o)return void(this._isOpen=!0);var a=Math.abs(i)>r||!this._isOpen&&e>s||this._isOpen&&s>e;a?this.toggle():this.reset()}var h=t("../core/RenderNode"),c=t("../core/Transform"),p=t("../core/OptionsManager"),u=t("../transitions/Transitionable"),l=t("../core/EventHandler"),f=0,d=1;e.SIDES={LEFT:0,TOP:1,RIGHT:2,BOTTOM:3},e.DEFAULT_OPTIONS={side:e.SIDES.LEFT,drawerLength:0,velocityThreshold:0,positionThreshold:0,transition:!0},e.prototype.setOptions=function(t){this._optionsManager.setOptions(t),void 0!==t.side&&(this._direction=n(t.side),this._orientation=o(t.side))},e.prototype.open=function(t,i){t instanceof Function&&(i=t),void 0===t&&(t=this.options.transition),this._cachedLength=s.call(this,this.drawer),this.setPosition(this._cachedLength,t,i),this._isOpen||(this._isOpen=!0,this._eventOutput.emit("open"))},e.prototype.close=function(t,i){t instanceof Function&&(i=t),void 0===t&&(t=this.options.transition),this.setPosition(0,t,i),this._isOpen&&(this._isOpen=!1,this._eventOutput.emit("close"))},e.prototype.setPosition=function(t,i,e){this._position.isActive()&&this._position.halt(),this._position.set(t,i,e)},e.prototype.getPosition=function(){return this._position.get()},e.prototype.setProgress=function(t,i,e){return this._position.set(t*this._cachedLength,i,e)},e.prototype.getProgress=function(){return this._position.get()/this._cachedLength},e.prototype.toggle=function(t){this._isOpen?this.close(t):this.open(t)},e.prototype.reset=function(t){this._isOpen?this.open(t):this.close(t)},e.prototype.isOpen=function(){return this._isOpen},e.prototype.render=function(){var t=this.getPosition();(!this._isOpen&&0>t&&1===this._orientation||t>0&&-1===this._orientation)&&(t=0,this.setPosition(t));var i=this._direction===f?c.translate(t,0,0):c.translate(0,t,0);return[{transform:c.behind,target:this.drawer.render()},{transform:i,target:this.content.render()}]},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"../core/RenderNode":11,"../core/Transform":15,"../transitions/Transitionable":89}],101:[function(t,i){function e(t){this._currentTarget=null,this._size=[void 0,void 0],this._controller=new h(t),this._controller.inTransformFrom(o.create(n.bind(this,1e-4))),this._controller.outTransformFrom(o.create(n.bind(this,-1e-4))),this._eventInput=new r,r.setInputHandler(this,this._eventInput),this._entityId=s.register(this),t&&this.setOptions(t)}function n(t,i){return a.translate(this._size[0]*(1-i),0,t*(1-i))}var o=t("../transitions/CachedMap"),s=t("../core/Entity"),r=t("../core/EventHandler"),a=t("../core/Transform"),h=t("./RenderController");e.prototype.show=function(t){this._currentTarget&&this._eventInput.unpipe(this._currentTarget),this._currentTarget=t,this._currentTarget&&this._currentTarget.trigger&&this._eventInput.pipe(this._currentTarget),this._controller.show.apply(this._controller,arguments)},e.prototype.setOptions=function(t){this._controller.setOptions(t)},e.prototype.render=function(){return this._entityId},e.prototype.commit=function(t){return this._size[0]=t.size[0],this._size[1]=t.size[1],{transform:t.transform,opacity:t.opacity,origin:t.origin,size:t.size,target:this._controller.render()}},i.exports=e},{"../core/Entity":5,"../core/EventHandler":7,"../core/Transform":15,"../transitions/CachedMap":84,"./RenderController":107}],102:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this.optionsManager=new a(this.options),t&&this.setOptions(t),this.id=s.register(this),this._ratios=new c(this.options.ratios),this._nodes=[],this._size=[0,0],this._cachedDirection=null,this._cachedLengths=[],this._cachedTransforms=null,this._ratiosDirty=!1,this._eventOutput=new h,h.setOutputHandler(this,this._eventOutput)}function n(t,i,n){var o,s,a,h,c=0,p=i,u=0;for(this._cachedLengths=[],this._cachedTransforms=[],h=0;h<t.length;h++)s=t[h],a=this._nodes[h],"number"!=typeof s?p-=a.getSize()[n]||0:u+=s;for(h=0;h<t.length;h++)a=this._nodes[h],s=t[h],i="number"==typeof s?p*s/u:a.getSize()[n],o=n===e.DIRECTION_X?r.translate(c,0,0):r.translate(0,c,0),this._cachedTransforms.push(o),this._cachedLengths.push(i),c+=i}function o(t,i){for(var e=0;e<t.length;e++)if("number"!=typeof t[e]&&this._nodes[e].getSize()[i]!==this._cachedLengths[e])return!0;return!1}var s=t("../core/Entity"),r=t("../core/Transform"),a=t("../core/OptionsManager"),h=t("../core/EventHandler"),c=t("../transitions/Transitionable");e.DIRECTION_X=0,e.DIRECTION_Y=1,e.DEFAULT_OPTIONS={direction:e.DIRECTION_X,transition:!1,ratios:[]},e.prototype.render=function(){return this.id},e.prototype.setOptions=function(t){this.optionsManager.setOptions(t)},e.prototype.sequenceFrom=function(t){if(this._nodes=t,0===this._ratios.get().length){for(var i=[],e=0;e<this._nodes.length;e++)i.push(1);this.setRatios(i)}},e.prototype.setRatios=function(t,i,e){void 0===i&&(i=this.options.transition);var n=this._ratios;0===n.get().length&&(i=void 0),n.isActive()&&n.halt(),n.set(t,i,e),this._ratiosDirty=!0},e.prototype.getSize=function(){return this._size},e.prototype.commit=function(t){var i,e=t.size,s=t.transform,a=t.origin,h=t.opacity,c=this._ratios.get(),p=this.options.direction,u=e[p];(u!==this._size[p]||this._ratiosDirty||this._ratios.isActive()||p!==this._cachedDirection||o.call(this,c,p))&&(n.call(this,c,u,p),u!==this._size[p]&&(this._size[0]=e[0],this._size[1]=e[1]),p!==this._cachedDirection&&(this._cachedDirection=p),this._ratiosDirty&&(this._ratiosDirty=!1));for(var l=[],f=0;f<c.length;f++)i=[void 0,void 0],u=this._cachedLengths[f],i[p]=u,l.push({transform:this._cachedTransforms[f],size:i,target:this._nodes[f].render()});return e&&0!==a[0]&&0!==a[1]&&(s=r.moveThen([-e[0]*a[0],-e[1]*a[1],0],s)),{transform:s,size:e,opacity:h,target:l}},i.exports=e},{"../core/Entity":5,"../core/EventHandler":7,"../core/OptionsManager":10,"../core/Transform":15,"../transitions/Transitionable":89}],103:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new s(this.options),t&&this.setOptions(t),this.angle=new o(0),this.frontNode=void 0,this.backNode=void 0,this.flipped=!1}var n=t("../core/Transform"),o=t("../transitions/Transitionable"),s=(t("../core/RenderNode"),t("../core/OptionsManager"));e.DIRECTION_X=0,e.DIRECTION_Y=1;var r=1;e.DEFAULT_OPTIONS={transition:!0,direction:e.DIRECTION_X},e.prototype.flip=function(t,i){var e=this.flipped?0:Math.PI;this.setAngle(e,t,i),this.flipped=!this.flipped},e.prototype.setAngle=function(t,i,e){void 0===i&&(i=this.options.transition),this.angle.isActive()&&this.angle.halt(),this.angle.set(t,i,e)},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.setFront=function(t){this.frontNode=t},e.prototype.setBack=function(t){this.backNode=t},e.prototype.render=function(){var t,i,o=this.angle.get();this.options.direction===e.DIRECTION_X?(t=n.rotateY(o),i=n.rotateY(o+Math.PI)):(t=n.rotateX(o),i=n.rotateX(o+Math.PI));var s=[];return this.frontNode&&s.push({transform:t,target:this.frontNode.render()}),this.backNode&&s.push({transform:n.moveThen([0,0,r],i),target:this.backNode.render()}),s},i.exports=e},{"../core/OptionsManager":10,"../core/RenderNode":11,"../core/Transform":15,"../transitions/Transitionable":89}],104:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this.optionsManager=new u(this.options),t&&this.setOptions(t),this.id=r.register(this),this._modifiers=[],this._states=[],this._contextSizeCache=[0,0],this._dimensionsCache=[0,0],this._activeCount=0,this._eventOutput=new c,c.setOutputHandler(this,this._eventOutput)}function n(t,i,e){var n=[t[0],t[1]];n[0]-=this.options.gutterSize[0]*(i-1),n[1]-=this.options.gutterSize[1]*(e-1);for(var r,a=Math.round(n[1]/e),h=Math.round(n[0]/i),c=0,p=0,u=0;e>u;u++){r=0;for(var l=0;i>l;l++)void 0===this._modifiers[p]?o.call(this,p,[h,a],[r,c,0],1):s.call(this,p,[h,a],[r,c,0],1),p++,r+=h+this.options.gutterSize[0];c+=a+this.options.gutterSize[1]}for(this._dimensionsCache=[this.options.dimensions[0],this.options.dimensions[1]],this._contextSizeCache=[t[0],t[1]],this._activeCount=e*i,u=this._activeCount;u<this._modifiers.length;u++)s.call(this,u,[Math.round(h),Math.round(a)],[0,0],0);this._eventOutput.emit("reflow")}function o(t,i,e,n){var o={transform:new f(a.translate.apply(null,e)),opacity:new l(n),size:new l(i)},s=new p({transform:o.transform,opacity:o.opacity,size:o.size});this._states[t]=o,this._modifiers[t]=s}function s(t,i,e,n){var o=this._states[t],s=o.size,r=o.opacity,a=o.transform,h=this.options.transition;a.halt(),r.halt(),s.halt(),a.setTranslate(e,h),s.set(i,h),r.set(n,h)}var r=t("../core/Entity"),a=(t("../core/RenderNode"),t("../core/Transform")),h=t("../core/ViewSequence"),c=t("../core/EventHandler"),p=t("../core/Modifier"),u=t("../core/OptionsManager"),l=t("../transitions/Transitionable"),f=t("../transitions/TransitionableTransform");e.DEFAULT_OPTIONS={dimensions:[1,1],transition:!1,gutterSize:[0,0]},e.prototype.render=function(){return this.id},e.prototype.setOptions=function(t){return this.optionsManager.setOptions(t)},e.prototype.sequenceFrom=function(t){t instanceof Array&&(t=new h(t)),this.sequence=t},e.prototype.getSize=function(){return this._contextSizeCache},e.prototype.commit=function(t){var i=t.transform,e=t.opacity,o=t.origin,s=t.size,r=this.options.dimensions[0],h=this.options.dimensions[1];(s[0]!==this._contextSizeCache[0]||s[1]!==this._contextSizeCache[1]||r!==this._dimensionsCache[0]||h!==this._dimensionsCache[1])&&n.call(this,s,r,h);for(var c=this.sequence,p=[],u=0;c&&u<this._modifiers.length;){var l=c.get(),f=this._modifiers[u];u>=this._activeCount&&this._states[u].opacity.isActive()&&(this._modifiers.splice(u,1),this._states.splice(u,1)),l&&p.push(f.modify({origin:o,target:l.render()})),c=c.getNext(),u++}return s&&(i=a.moveThen([-s[0]*o[0],-s[1]*o[1],0],i)),{transform:i,opacity:e,size:s,target:p}},i.exports=e},{"../core/Entity":5,"../core/EventHandler":7,"../core/Modifier":9,"../core/OptionsManager":10,"../core/RenderNode":11,"../core/Transform":15,"../core/ViewSequence":17,"../transitions/Transitionable":89,"../transitions/TransitionableTransform":90}],105:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new c(this.options),t&&this.setOptions(t),this._entityId=r.register(this),this.header=new a,this.footer=new a,this.content=new a}function n(t,i){var e=t.getSize();return e?e[this.options.direction]:i}function o(t){return this.options.direction===e.DIRECTION_X?h.translate(t,0,0):h.translate(0,t,0)}function s(t,i){return this.options.direction===e.DIRECTION_X?[t,i[1]]:[i[0],t]}var r=t("../core/Entity"),a=t("../core/RenderNode"),h=t("../core/Transform"),c=t("../core/OptionsManager");e.DIRECTION_X=0,e.DIRECTION_Y=1,e.DEFAULT_OPTIONS={direction:e.DIRECTION_Y,headerSize:void 0,footerSize:void 0,defaultHeaderSize:0,defaultFooterSize:0},e.prototype.render=function(){return this._entityId},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.commit=function(t){var i=t.transform,e=t.origin,r=t.size,a=t.opacity,c=void 0!==this.options.headerSize?this.options.headerSize:n.call(this,this.header,this.options.defaultHeaderSize),p=void 0!==this.options.footerSize?this.options.footerSize:n.call(this,this.footer,this.options.defaultFooterSize),u=r[this.options.direction]-c-p;r&&(i=h.moveThen([-r[0]*e[0],-r[1]*e[1],0],i));var l=[{size:s.call(this,c,r),target:this.header.render()},{transform:o.call(this,c),size:s.call(this,u,r),target:this.content.render()},{transform:o.call(this,c+u),size:s.call(this,p,r),target:this.footer.render()}];return{transform:i,opacity:a,size:r,target:l}},i.exports=e},{"../core/Entity":5,"../core/OptionsManager":10,"../core/RenderNode":11,"../core/Transform":15}],106:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new a(this.options),t&&this.setOptions(t),this._showing=!1,this.nodes=[],this.transforms=[],this.states=[]}var n=t("../core/Transform"),o=t("../core/Modifier"),s=t("../core/RenderNode"),r=t("../utilities/Utility"),a=t("../core/OptionsManager"),h=t("../transitions/Transitionable"),c=t("../transitions/TransitionableTransform");e.DEFAULT_OPTIONS={inTransform:n.scale(.001,.001,.001),inOpacity:0,inOrigin:[.5,.5],inAlign:[.5,.5],outTransform:n.scale(.001,.001,.001),outOpacity:0,outOrigin:[.5,.5],outAlign:[.5,.5],showTransform:n.identity,showOpacity:1,showOrigin:[.5,.5],showAlign:[.5,.5],inTransition:!0,outTransition:!0,overlap:!1},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.show=function(t,i,e){if(!t)return this.hide(e);if(i instanceof Function&&(e=i,i=void 0),this._showing){if(!this.options.overlap)return this.hide(this.show.bind(this,t,i,e));this.hide()}this._showing=!0;var n={transform:new c(this.options.inTransform),origin:new h(this.options.inOrigin),align:new h(this.options.inAlign),opacity:new h(this.options.inOpacity)},a=new o({transform:n.transform,opacity:n.opacity,origin:n.origin,align:n.align}),p=new s;p.add(a).add(t),this.nodes.push(p),this.states.push(n),this.transforms.push(a);var u=e?r.after(3,e):void 0;i||(i=this.options.inTransition),n.transform.set(this.options.showTransform,i,u),n.opacity.set(this.options.showOpacity,i,u),n.origin.set(this.options.showOrigin,i,u),n.align.set(this.options.showAlign,i,u)
},e.prototype.hide=function(t,i){if(this._showing){this._showing=!1,t instanceof Function&&(i=t,t=void 0);var e=this.nodes[this.nodes.length-1],n=this.transforms[this.transforms.length-1],o=this.states[this.states.length-1],s=r.after(3,function(){this.nodes.splice(this.nodes.indexOf(e),1),this.states.splice(this.states.indexOf(o),1),this.transforms.splice(this.transforms.indexOf(n),1),i&&i.call(this)}.bind(this));t||(t=this.options.outTransition),o.transform.set(this.options.outTransform,t,s),o.opacity.set(this.options.outOpacity,t,s),o.origin.set(this.options.outOrigin,t,s),o.align.set(this.options.outAlign,t,s)}},e.prototype.render=function(){for(var t=[],i=0;i<this.nodes.length;i++)t.push(this.nodes[i].render());return t},i.exports=e},{"../core/Modifier":9,"../core/OptionsManager":10,"../core/RenderNode":11,"../core/Transform":15,"../transitions/Transitionable":89,"../transitions/TransitionableTransform":90,"../utilities/Utility":96}],107:[function(t,i){function e(){h.apply(this,arguments),this._showing=-1,this._outgoingRenderables=[],this._nextRenderable=null,this._renderables=[],this._nodes=[],this._modifiers=[],this._states=[],this.inTransformMap=e.DefaultMap.transform,this.inOpacityMap=e.DefaultMap.opacity,this.inOriginMap=e.DefaultMap.origin,this.inAlignMap=e.DefaultMap.align,this.outTransformMap=e.DefaultMap.transform,this.outOpacityMap=e.DefaultMap.opacity,this.outOriginMap=e.DefaultMap.origin,this.outAlignMap=e.DefaultMap.align,this._output=[]}function n(t,i){return t(i.get())}var o=t("../core/Modifier"),s=t("../core/RenderNode"),r=t("../core/Transform"),a=t("../transitions/Transitionable"),h=t("../core/View");e.prototype=Object.create(h.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={inTransition:!0,outTransition:!0,overlap:!0},e.DefaultMap={transform:function(){return r.identity},opacity:function(t){return t},origin:null,align:null},e.prototype.inTransformFrom=function(t){if(t instanceof Function)this.inTransformMap=t;else{if(!t||!t.get)throw new Error("inTransformFrom takes only function or getter object");this.inTransformMap=t.get.bind(t)}return this},e.prototype.inOpacityFrom=function(t){if(t instanceof Function)this.inOpacityMap=t;else{if(!t||!t.get)throw new Error("inOpacityFrom takes only function or getter object");this.inOpacityMap=t.get.bind(t)}return this},e.prototype.inOriginFrom=function(t){if(t instanceof Function)this.inOriginMap=t;else{if(!t||!t.get)throw new Error("inOriginFrom takes only function or getter object");this.inOriginMap=t.get.bind(t)}return this},e.prototype.inAlignFrom=function(t){if(t instanceof Function)this.inAlignMap=t;else{if(!t||!t.get)throw new Error("inAlignFrom takes only function or getter object");this.inAlignMap=t.get.bind(t)}return this},e.prototype.outTransformFrom=function(t){if(t instanceof Function)this.outTransformMap=t;else{if(!t||!t.get)throw new Error("outTransformFrom takes only function or getter object");this.outTransformMap=t.get.bind(t)}return this},e.prototype.outOpacityFrom=function(t){if(t instanceof Function)this.outOpacityMap=t;else{if(!t||!t.get)throw new Error("outOpacityFrom takes only function or getter object");this.outOpacityMap=t.get.bind(t)}return this},e.prototype.outOriginFrom=function(t){if(t instanceof Function)this.outOriginMap=t;else{if(!t||!t.get)throw new Error("outOriginFrom takes only function or getter object");this.outOriginMap=t.get.bind(t)}return this},e.prototype.outAlignFrom=function(t){if(t instanceof Function)this.outAlignMap=t;else{if(!t||!t.get)throw new Error("outAlignFrom takes only function or getter object");this.outAlignMap=t.get.bind(t)}return this},e.prototype.show=function(t,i,e){if(!t)return this.hide(e);if(i instanceof Function&&(e=i,i=null),this._showing>=0){if(!this.options.overlap)return void(this._nextRenderable?this._nextRenderable=t:(this._nextRenderable=t,this.hide(function(){this._nextRenderable===t&&this.show(this._nextRenderable,e),this._nextRenderable=null})));this.hide()}var r=null,h=this._renderables.indexOf(t);if(h>=0){this._showing=h,r=this._states[h],r.halt();var c=this._outgoingRenderables.indexOf(t);c>=0&&this._outgoingRenderables.splice(c,1)}else{r=new a(0);var p=new o({transform:this.inTransformMap?n.bind(this,this.inTransformMap,r):null,opacity:this.inOpacityMap?n.bind(this,this.inOpacityMap,r):null,origin:this.inOriginMap?n.bind(this,this.inOriginMap,r):null,align:this.inAlignMap?n.bind(this,this.inAlignMap,r):null}),u=new s;u.add(p).add(t),this._showing=this._nodes.length,this._nodes.push(u),this._modifiers.push(p),this._states.push(r),this._renderables.push(t)}i||(i=this.options.inTransition),r.set(1,i,e)},e.prototype.hide=function(t,i){if(!(this._showing<0)){var e=this._showing;this._showing=-1,t instanceof Function&&(i=t,t=void 0);var o=this._nodes[e],s=this._modifiers[e],r=this._states[e],a=this._renderables[e];s.transformFrom(this.outTransformMap?n.bind(this,this.outTransformMap,r):null),s.opacityFrom(this.outOpacityMap?n.bind(this,this.outOpacityMap,r):null),s.originFrom(this.outOriginMap?n.bind(this,this.outOriginMap,r):null),s.alignFrom(this.outAlignMap?n.bind(this,this.outAlignMap,r):null),this._outgoingRenderables.indexOf(a)<0&&this._outgoingRenderables.push(a),t||(t=this.options.outTransition),r.halt(),r.set(0,t,function(t,e,n,o){if(this._outgoingRenderables.indexOf(o)>=0){var s=this._nodes.indexOf(t);this._nodes.splice(s,1),this._modifiers.splice(s,1),this._states.splice(s,1),this._renderables.splice(s,1),this._outgoingRenderables.splice(this._outgoingRenderables.indexOf(o),1),this._showing>=s&&this._showing--}i&&i.call(this)}.bind(this,o,s,r,a))}},e.prototype.render=function(){var t=this._output;t.length>this._nodes.length&&t.splice(this._nodes.length);for(var i=0;i<this._nodes.length;i++)t[i]=this._nodes[i].render();return t},i.exports=e},{"../core/Modifier":9,"../core/RenderNode":11,"../core/Transform":15,"../core/View":16,"../transitions/Transitionable":89}],108:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new r(this.options),t&&this.setOptions(t),this.container=new n(this.options.container),this.scrollview=new s(this.options.scrollview),this.container.add(this.scrollview),this._eventInput=new o,o.setInputHandler(this,this._eventInput),this._eventInput.pipe(this.scrollview),this._eventOutput=new o,o.setOutputHandler(this,this._eventOutput),this.container.pipe(this._eventOutput),this.scrollview.pipe(this._eventOutput)}var n=t("../surfaces/ContainerSurface"),o=t("../core/EventHandler"),s=t("./Scrollview"),r=(t("../utilities/Utility"),t("../core/OptionsManager"));e.DEFAULT_OPTIONS={container:{properties:{overflow:"hidden"}},scrollview:{}},e.prototype.setOptions=function(t){return this._optionsManager.setOptions(t)},e.prototype.sequenceFrom=function(){return this.scrollview.sequenceFrom.apply(this.scrollview,arguments)},e.prototype.getSize=function(){return this.container.getSize.apply(this.container,arguments)},e.prototype.render=function(){return this.container.render()},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"../surfaces/ContainerSurface":76,"../utilities/Utility":96,"./Scrollview":110}],109:[function(t,i){function e(t){this.options=Object.create(this.constructor.DEFAULT_OPTIONS),this._optionsManager=new c(this.options),t&&this._optionsManager.setOptions(t),this._node=null,this._position=0,this._positionOffset=0,this._positionGetter=null,this._outputFunction=null,this._masterOutputFunction=null,this.outputFrom(),this._onEdge=0,this.group=new h,this.group.add({render:r.bind(this)}),this._entityId=a.register(this),this._size=[void 0,void 0],this._contextSize=[void 0,void 0],this._eventInput=new f,this._eventOutput=new f,f.setInputHandler(this,this._eventInput),f.setOutputHandler(this,this._eventOutput)}function n(t){t||(t=this._contextSize);var i=this.options.direction;return void 0===t[i]?this._contextSize[i]:t[i]}function o(t,i,e){var o=t.getSize?t.getSize():this._contextSize,s=this._outputFunction(i);return e.push({transform:s,target:t.render()}),n.call(this,o)}function s(){return void 0!==this.options.clipSize?this.options.clipSize:this._contextSize[this.options.direction]>this.getCumulativeSize()[this.options.direction]?n.call(this,this.getCumulativeSize()):n.call(this,this._contextSize)}function r(){for(var t=null,i=this._position,e=[],r=-this._positionOffset,a=s.call(this),h=this._node;h&&r-i<a+this.options.margin;)r+=o.call(this,h,r,e),h=h.getNext?h.getNext():null;var c=this._node,p=n.call(this,c.getSize());if(a>r){for(;c&&a>p;)c=c.getPrevious(),c&&(p+=n.call(this,c.getSize()));for(c=this._node;c&&a>p;)c=c.getNext(),c&&(p+=n.call(this,c.getSize()))}for(!h&&a-d>r-i?1!==this._onEdge&&(this._onEdge=1,this._eventOutput.emit("onEdge",{position:r-a})):!this._node.getPrevious()&&-d>i?-1!==this._onEdge&&(this._onEdge=-1,this._eventOutput.emit("onEdge",{position:0})):0!==this._onEdge&&(this._onEdge=0,this._eventOutput.emit("offEdge")),h=this._node&&this._node.getPrevious?this._node.getPrevious():null,r=-this._positionOffset,h&&(t=h.getSize?h.getSize():this._contextSize,r-=n.call(this,t));h&&r-i>-(a+this.options.margin);)o.call(this,h,r,e),h=h.getPrevious?h.getPrevious():null,h&&(t=h.getSize?h.getSize():this._contextSize,r-=n.call(this,t));return e}var a=t("../core/Entity"),h=t("../core/Group"),c=t("../core/OptionsManager"),p=t("../core/Transform"),u=t("../utilities/Utility"),l=t("../core/ViewSequence"),f=t("../core/EventHandler");e.DEFAULT_OPTIONS={direction:u.Direction.Y,margin:0,clipSize:void 0,groupScroll:!1};var d=0;e.prototype.getCumulativeSize=function(t){return void 0===t&&(t=this._node._.cumulativeSizes.length-1),this._node._.getSize(t)},e.prototype.setOptions=function(t){t.groupScroll!==this.options.groupScroll&&(t.groupScroll?this.group.pipe(this._eventOutput):this.group.unpipe(this._eventOutput)),this._optionsManager.setOptions(t)},e.prototype.onEdge=function(){return this._onEdge},e.prototype.outputFrom=function(t,i){t||(t=function(t){return this.options.direction===u.Direction.X?p.translate(t,0):p.translate(0,t)}.bind(this),i||(i=t)),this._outputFunction=t,this._masterOutputFunction=i?i:function(i){return p.inverse(t(-i))}},e.prototype.positionFrom=function(t){t instanceof Function?this._positionGetter=t:t&&t.get?this._positionGetter=t.get.bind(t):(this._positionGetter=null,this._position=t),this._positionGetter&&(this._position=this._positionGetter.call(this))},e.prototype.sequenceFrom=function(t){t instanceof Array&&(t=new l({array:t})),this._node=t,this._positionOffset=0},e.prototype.getSize=function(t){return t?this._contextSize:this._size},e.prototype.render=function(){return this._node?(this._positionGetter&&(this._position=this._positionGetter.call(this)),this._entityId):null},e.prototype.commit=function(t){var i=t.transform,e=t.opacity,n=t.origin,o=t.size;this.options.clipSize||o[0]===this._contextSize[0]&&o[1]===this._contextSize[1]||(this._onEdge=0,this._contextSize[0]=o[0],this._contextSize[1]=o[1],this.options.direction===u.Direction.X?(this._size[0]=s.call(this),this._size[1]=void 0):(this._size[0]=void 0,this._size[1]=s.call(this)));var r=this._masterOutputFunction(-this._position);return{transform:p.multiply(i,r),size:o,opacity:e,origin:n,target:this.group.render()}},i.exports=e},{"../core/Entity":5,"../core/EventHandler":7,"../core/Group":8,"../core/OptionsManager":10,"../core/Transform":15,"../core/ViewSequence":17,"../utilities/Utility":96}],110:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this._optionsManager=new O(this.options),this._scroller=new T(this.options),this.sync=new b(["scroll","touch"],{direction:this.options.direction,scale:this.options.syncScale,rails:this.options.rails,preventDefault:void 0!==this.options.preventDefault?this.options.preventDefault:this.options.direction!==w.Direction.Y}),this._physicsEngine=new _,this._particle=new g,this._physicsEngine.addBody(this._particle),this.spring=new v({anchor:[0,0,0],period:this.options.edgePeriod,dampingRatio:this.options.edgeDamp}),this.drag=new y({forceFunction:y.FORCE_FUNCTIONS.QUADRATIC,strength:this.options.drag}),this.friction=new y({forceFunction:y.FORCE_FUNCTIONS.LINEAR,strength:this.options.friction}),this._node=null,this._touchCount=0,this._springState=M.NONE,this._onEdge=x.NONE,this._pageSpringPosition=0,this._edgeSpringPosition=0,this._touchVelocity=0,this._earlyEnd=!1,this._needsPaginationCheck=!1,this._displacement=0,this._totalShift=0,this._cachedIndex=0,this._scroller.positionFrom(this.getPosition.bind(this)),this._eventInput=new m,this._eventOutput=new m,this._eventInput.pipe(this.sync),this.sync.pipe(this._eventInput),m.setInputHandler(this,this._eventInput),m.setOutputHandler(this,this._eventOutput),r.call(this),t&&this.setOptions(t)}function n(t){this._touchCount=t.count,void 0===t.count&&(this._touchCount=1),h.call(this),this.setVelocity(0),this._touchVelocity=0,this._earlyEnd=!1}function o(t){var i=-t.velocity,e=-t.delta;if(this._onEdge!==x.NONE&&t.slip&&(0>i&&this._onEdge===x.TOP||i>0&&this._onEdge===x.BOTTOM?this._earlyEnd||(s.call(this,t),this._earlyEnd=!0):this._earlyEnd&&Math.abs(i)>Math.abs(this.getVelocity())&&n.call(this,t)),!this._earlyEnd){if(this._touchVelocity=i,t.slip){var o=this.options.speedLimit;-o>i?i=-o:i>o&&(i=o),this.setVelocity(i);var r=16*o;e>r?e=r:-r>e&&(e=-r)}this.setPosition(this.getPosition()+e),this._displacement+=e,this._springState===M.NONE&&f.call(this)}}function s(t){if(this._touchCount=t.count||0,!this._touchCount){h.call(this),this._onEdge!==x.NONE&&l.call(this,this._edgeSpringPosition,M.EDGE),a.call(this);var i=-t.velocity,e=this.options.speedLimit;t.slip&&(e*=this.options.edgeGrip),-e>i?i=-e:i>e&&(i=e),this.setVelocity(i),this._touchVelocity=0,this._needsPaginationCheck=!0}}function r(){this._eventInput.bindThis(this),this._eventInput.on("start",n),this._eventInput.on("update",o),this._eventInput.on("end",s),this._eventInput.on("resize",function(){this._node._.calculateSize()}.bind(this)),this._scroller.on("onEdge",function(t){this._edgeSpringPosition=t.position,p.call(this,this._scroller.onEdge()),this._eventOutput.emit("onEdge")}.bind(this)),this._scroller.on("offEdge",function(){this.sync.setOptions({scale:this.options.syncScale}),this._onEdge=this._scroller.onEdge(),this._eventOutput.emit("offEdge")}.bind(this)),this._particle.on("update",function(t){this._springState===M.NONE&&f.call(this),this._displacement=t.position.x-this._totalShift}.bind(this)),this._particle.on("end",function(){(!this.options.paginated||this.options.paginated&&this._springState!==M.NONE)&&this._eventOutput.emit("settle")}.bind(this))}function a(){this._springState?this._physicsEngine.attach([this.spring],this._particle):this._physicsEngine.attach([this.drag,this.friction],this._particle)}function h(){this._springState=M.NONE,this._physicsEngine.detachAll()}function c(t){var i=this.options.direction,e=t.getSize();return e?e[i]:this._scroller.getSize()[i]}function p(t){this.sync.setOptions({scale:this.options.edgeGrip}),this._onEdge=t,this._touchCount||this._springState===M.EDGE||l.call(this,this._edgeSpringPosition,M.EDGE),this._springState&&Math.abs(this.getVelocity())<.001&&(h.call(this),a.call(this))}function u(){if(!this._touchCount&&this._springState!==M.EDGE){var t=this.getVelocity();if(!(Math.abs(t)>=this.options.pageStopSpeed)){var i=this.getPosition(),e=Math.abs(t)>this.options.pageSwitchSpeed,n=c.call(this,this._node),o=i>.5*n,s=t>0,r=0>t;this._needsPaginationCheck=!1,o&&!e||e&&s?this.goToNextPage():e&&r?this.goToPreviousPage():l.call(this,0,M.PAGE)}}}function l(t,i){var e;i===M.EDGE?(this._edgeSpringPosition=t,e={anchor:[this._edgeSpringPosition,0,0],period:this.options.edgePeriod,dampingRatio:this.options.edgeDamp}):i===M.PAGE&&(this._pageSpringPosition=t,e={anchor:[this._pageSpringPosition,0,0],period:this.options.pagePeriod,dampingRatio:this.options.pageDamp}),this.spring.setOptions(e),i&&!this._springState&&(h.call(this),this._springState=i,a.call(this)),this._springState=i}function f(){var t=0,i=this.getPosition();i+=(0>i?-.5:.5)>>0;for(var e=c.call(this,this._node),n=this._node.getNext();t+i>=e&&n;)t-=e,this._scroller.sequenceFrom(n),this._node=n,n=this._node.getNext(),e=c.call(this,this._node);for(var o,s=this._node.getPrevious();0>=t+i&&s;)o=c.call(this,s),this._scroller.sequenceFrom(s),this._node=s,t+=o,s=this._node.getPrevious();t&&d.call(this,t),this._node&&(this._node.index!==this._cachedIndex?this.getPosition()<.5*e&&(this._cachedIndex=this._node.index,this._eventOutput.emit("pageChange",{direction:-1,index:this._cachedIndex})):this.getPosition()>.5*e&&(this._cachedIndex=this._node.index+1,this._eventOutput.emit("pageChange",{direction:1,index:this._cachedIndex})))}function d(t){this._edgeSpringPosition+=t,this._pageSpringPosition+=t,this.setPosition(this.getPosition()+t),this._totalShift+=t,this._springState===M.EDGE?this.spring.setOptions({anchor:[this._edgeSpringPosition,0,0]}):this._springState===M.PAGE&&this.spring.setOptions({anchor:[this._pageSpringPosition,0,0]})}var _=t("../physics/PhysicsEngine"),g=t("../physics/bodies/Particle"),y=t("../physics/forces/Drag"),v=t("../physics/forces/Spring"),m=t("../core/EventHandler"),O=t("../core/OptionsManager"),S=t("../core/ViewSequence"),T=t("../views/Scroller"),w=t("../utilities/Utility"),b=t("../inputs/GenericSync"),E=t("../inputs/ScrollSync"),I=t("../inputs/TouchSync");b.register({scroll:E,touch:I});var M={NONE:0,EDGE:1,PAGE:2},x={TOP:-1,NONE:0,BOTTOM:1};e.DEFAULT_OPTIONS={direction:w.Direction.Y,rails:!0,friction:.005,drag:1e-4,edgeGrip:.2,edgePeriod:300,edgeDamp:1,margin:1e3,paginated:!1,pagePeriod:500,pageDamp:.8,pageStopSpeed:10,pageSwitchSpeed:.5,speedLimit:5,groupScroll:!1,syncScale:1},e.prototype.getCurrentIndex=function(){return this._node.index},e.prototype.goToPreviousPage=function(){if(!this._node||this._onEdge===x.TOP)return null;if(this.getPosition()>1&&this._springState===M.NONE)return l.call(this,0,M.PAGE),this._node;var t=this._node.getPrevious();if(t){var i=c.call(this,t);this._scroller.sequenceFrom(t),this._node=t,d.call(this,i),l.call(this,0,M.PAGE)}return t},e.prototype.goToNextPage=function(){if(!this._node||this._onEdge===x.BOTTOM)return null;var t=this._node.getNext();if(t){var i=c.call(this,this._node);this._scroller.sequenceFrom(t),this._node=t,d.call(this,-i),l.call(this,0,M.PAGE)}return t},e.prototype.goToPage=function(t){var i,e=this.getCurrentIndex();if(e>t)for(i=0;e-t>i;i++)this.goToPreviousPage();if(t>e)for(i=0;t-e>i;i++)this.goToNextPage()},e.prototype.outputFrom=function(){return this._scroller.outputFrom.apply(this._scroller,arguments)},e.prototype.getPosition=function(){return this._particle.getPosition1D()},e.prototype.getAbsolutePosition=function(){return this._scroller.getCumulativeSize(this.getCurrentIndex())[this.options.direction]+this.getPosition()},e.prototype.getOffset=e.prototype.getPosition,e.prototype.setPosition=function(t){this._particle.setPosition1D(t)},e.prototype.setOffset=e.prototype.setPosition,e.prototype.getVelocity=function(){return this._touchCount?this._touchVelocity:this._particle.getVelocity1D()},e.prototype.setVelocity=function(t){this._particle.setVelocity1D(t)},e.prototype.setOptions=function(t){void 0!==t.direction&&("x"===t.direction?t.direction=w.Direction.X:"y"===t.direction&&(t.direction=w.Direction.Y)),t.groupScroll!==this.options.groupScroll&&(t.groupScroll?this.subscribe(this._scroller):this.unsubscribe(this._scroller)),this._optionsManager.setOptions(t),this._scroller.setOptions(t),void 0!==t.drag&&this.drag.setOptions({strength:this.options.drag}),void 0!==t.friction&&this.friction.setOptions({strength:this.options.friction}),(void 0!==t.edgePeriod||void 0!==t.edgeDamp)&&this.spring.setOptions({period:this.options.edgePeriod,dampingRatio:this.options.edgeDamp}),(t.rails||void 0!==t.direction||void 0!==t.syncScale||t.preventDefault)&&this.sync.setOptions({rails:this.options.rails,direction:this.options.direction===w.Direction.X?b.DIRECTION_X:b.DIRECTION_Y,scale:this.options.syncScale,preventDefault:this.options.preventDefault})},e.prototype.sequenceFrom=function(t){return t instanceof Array&&(t=new S({array:t,trackSize:!0})),this._node=t,this._scroller.sequenceFrom(t)},e.prototype.getSize=function(){return this._scroller.getSize.apply(this._scroller,arguments)},e.prototype.render=function(){return this.options.paginated&&this._needsPaginationCheck&&u.call(this),this._scroller.render()},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"../core/ViewSequence":17,"../inputs/GenericSync":27,"../inputs/ScrollSync":32,"../inputs/TouchSync":34,"../physics/PhysicsEngine":49,"../physics/bodies/Particle":52,"../physics/forces/Drag":64,"../physics/forces/Spring":69,"../utilities/Utility":96,"../views/Scroller":109}],111:[function(t,i){function e(t){this._items=null,this._size=null,this._outputFunction=e.DEFAULT_OUTPUT_FUNCTION,this.options=a.clone(this.constructor.DEFAULT_OPTIONS||e.DEFAULT_OPTIONS),this.optionsManager=new n(this.options),this.id=o.register(this),this.cachedSize=[void 0,void 0],t&&this.setOptions(t)}var n=t("../core/OptionsManager"),o=t("../core/Entity"),s=t("../core/Transform"),r=t("../core/ViewSequence"),a=t("../utilities/Utility");e.DEFAULT_OPTIONS={direction:a.Direction.Y,itemSpacing:0},e.DEFAULT_OUTPUT_FUNCTION=function(t,i){var e=this.options.direction===a.Direction.X?s.translate(i,0):s.translate(0,i);return{size:this.cachedSize,transform:e,target:t.render()}},e.prototype.getSize=function(){return this._size||this.render(),this._size},e.prototype.sequenceFrom=function(t){return t instanceof Array&&(t=new r(t)),this._items=t,this},e.prototype.setOptions=function(){return this.optionsManager.setOptions.apply(this.optionsManager,arguments),this},e.prototype.setOutputFunction=function(t){return this._outputFunction=t,this},e.prototype.render=function(){return this.id},e.prototype.commit=function(t){var i=0,e=1^this.options.direction,n=this._items,o=null,s=[],r={},a=[],h=0;for(this._size=[0,0],this.cachedSize=t.size;n&&(o=n.get());)o.getSize&&(s=o.getSize()),r=this._outputFunction.call(this,o,i,h++),a.push(r),s&&(s[this.options.direction]&&(i+=s[this.options.direction]),s[e]>this._size[e]&&(this._size[e]=s[e]),0===s[e]&&(this._size[e]=void 0)),n=n.getNext(),this.options.itemSpacing&&n&&(i+=this.options.itemSpacing);return this._size[this.options.direction]=i,{transform:t.transform,origin:t.origin,size:this.getSize(),target:a}},i.exports=e},{"../core/Entity":5,"../core/OptionsManager":10,"../core/Transform":15,"../core/ViewSequence":17,"../utilities/Utility":96}],112:[function(t,i){i.exports={ContextualView:t("./ContextualView"),Deck:t("./Deck"),DrawerLayout:t("./DrawerLayout"),EdgeSwapper:t("./EdgeSwapper"),FlexibleLayout:t("./FlexibleLayout"),Flipper:t("./Flipper"),GridLayout:t("./GridLayout"),HeaderFooterLayout:t("./HeaderFooterLayout"),Lightbox:t("./Lightbox"),RenderController:t("./RenderController"),ScrollContainer:t("./ScrollContainer"),Scroller:t("./Scroller"),Scrollview:t("./Scrollview"),SequentialLayout:t("./SequentialLayout")}},{"./ContextualView":98,"./Deck":99,"./DrawerLayout":100,"./EdgeSwapper":101,"./FlexibleLayout":102,"./Flipper":103,"./GridLayout":104,"./HeaderFooterLayout":105,"./Lightbox":106,"./RenderController":107,"./ScrollContainer":108,"./Scroller":109,"./Scrollview":110,"./SequentialLayout":111}],113:[function(t,i){function e(){r.apply(this,arguments),this.title=new o({classes:this.options.classes,content:this.options.content}),this.back=new o({size:[this.options.size[1],this.options.size[1]],classes:this.options.classes,content:this.options.backContent}),this.back.on("click",function(){this._eventOutput.emit("back",{})}.bind(this)),this.more=new o({size:[this.options.size[1],this.options.size[1]],classes:this.options.classes,content:this.options.moreContent}),this.more.on("click",function(){this._eventOutput.emit("more",{})}.bind(this)),this.layout=new n({id:"master",size:this.options.size,target:[{transform:s.inFront,origin:[0,.5],align:[0,.5],target:this.back},{origin:[.5,.5],align:[.5,.5],target:this.title},{transform:s.inFront,origin:[1,.5],align:[1,.5],target:this.more}]}),this._add(this.layout),this._optionsManager.on("change",function(t){var i=t.id,e=t.value;"size"===i?(this.layout.id.master.setSize(e),this.title.setSize(e),this.back.setSize([e[1],e[1]]),this.more.setSize([e[1],e[1]])):"backClasses"===i?this.back.setOptions({classes:this.options.classes.concat(this.options.backClasses)}):"backContent"===i?this.back.setContent(this.options.backContent):"classes"===i?(this.title.setOptions({classes:this.options.classes}),this.back.setOptions({classes:this.options.classes.concat(this.options.backClasses)}),this.more.setOptions({classes:this.options.classes.concat(this.options.moreClasses)})):"content"===i?this.setContent(this.options.content):"moreClasses"===i?this.more.setOptions({classes:this.options.classes.concat(this.options.moreClasses)}):"moreContent"===i&&this.more.setContent(this.options.content)}.bind(this))}var n=t("../core/Scene"),o=t("../core/Surface"),s=t("../core/Transform"),r=t("../core/View");e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={size:[void 0,50],backClasses:["back"],backContent:"◀",classes:["navigation"],content:"",moreClasses:["more"],moreContent:"✚"},e.prototype.setContent=function(t){return this.title.setContent(t)},i.exports=e},{"../core/Scene":12,"../core/Surface":14,"../core/Transform":15,"../core/View":16}],114:[function(t,i){function e(t){this.options=Object.create(e.DEFAULT_OPTIONS),this.optionsManager=new c(this.options),t&&this.setOptions(t),this.indicator=new s({size:this.options.indicatorSize,classes:["slider-back"]}),this.label=new o({size:this.options.labelSize,content:this.options.label,properties:{pointerEvents:"none"},classes:["slider-label"]}),this.eventOutput=new a,this.eventInput=new a,a.setInputHandler(this,this.eventInput),a.setOutputHandler(this,this.eventOutput);var i=(this.options.range[1]-this.options.range[0])/this.options.indicatorSize[0];this.sync=new l(["mouse","touch"],{scale:i,direction:l.DIRECTION_X}),this.indicator.pipe(this.sync),this.sync.pipe(this),this.eventInput.on("update",function(t){this.set(t.position)}.bind(this)),this._drawPos=0,n.call(this)}function n(){this.label.setContent(this.options.label+'<span style="float: right">'+this.get().toFixed(this.options.precision)+"</span>")}var o=t("../core/Surface"),s=t("../surfaces/CanvasSurface"),r=t("../core/Transform"),a=t("../core/EventHandler"),h=t("../math/Utilities"),c=t("../core/OptionsManager"),p=t("../inputs/MouseSync"),u=t("../inputs/TouchSync"),l=t("../inputs/GenericSync");l.register({mouse:p,touch:u}),e.DEFAULT_OPTIONS={size:[200,60],indicatorSize:[200,30],labelSize:[200,30],range:[0,1],precision:2,value:0,label:"",fillColor:"rgba(170, 170, 170, 1)"},e.prototype.setOptions=function(t){return this.optionsManager.setOptions(t)},e.prototype.get=function(){return this.options.value},e.prototype.set=function(t){t!==this.options.value&&(this.options.value=h.clamp(t,this.options.range),n.call(this),this.eventOutput.emit("change",{value:t}))},e.prototype.getSize=function(){return this.options.size},e.prototype.render=function(){var t=this.options.range,i=Math.floor((this.get()-t[0])/(t[1]-t[0])*this.options.indicatorSize[0]);if(i<this._drawPos)this.indicator.getContext("2d").clearRect(i,0,this._drawPos-i+1,this.options.indicatorSize[1]);else if(i>this._drawPos){var e=this.indicator.getContext("2d");e.fillStyle=this.options.fillColor,e.fillRect(this._drawPos-1,0,i-this._drawPos+1,this.options.indicatorSize[1])}return this._drawPos=i,{size:this.options.size,target:[{origin:[0,0],target:this.indicator.render()},{transform:r.translate(0,0,1),origin:[0,0],target:this.label.render()}]}},i.exports=e},{"../core/EventHandler":7,"../core/OptionsManager":10,"../core/Surface":14,"../core/Transform":15,"../inputs/GenericSync":27,"../inputs/MouseSync":28,"../inputs/TouchSync":34,"../math/Utilities":41,"../surfaces/CanvasSurface":75}],115:[function(t,i){function e(){r.apply(this,arguments),this.layout=new a,this.buttons=[],this._buttonIds={},this._buttonCallbacks={},this.layout.sequenceFrom(this.buttons),this._add(this.layout),this._optionsManager.on("change",n.bind(this))}function n(t){var i=t.id,e=t.value;if("direction"===i)this.layout.setOptions({dimensions:o.call(this.buttons.length,this.options.direction)});else if("buttons"===i)for(var n in this.buttons)this.buttons[n].setOptions(e);else if("sections"===i)for(var s in this.options.sections)this.defineSection(s,this.options.sections[s])}function o(t,i){return i===s.Direction.X?[t,1]:[1,t]}var s=t("../utilities/Utility"),r=t("../core/View"),a=t("../views/GridLayout"),h=t("./ToggleButton");e.prototype=Object.create(r.prototype),e.prototype.constructor=e,e.DEFAULT_OPTIONS={sections:[],widget:h,size:[void 0,50],direction:s.Direction.X,buttons:{toggleMode:h.ON}},e.prototype.defineSection=function(t,i){var e,n=this._buttonIds[t];if(void 0===n){n=this.buttons.length,this._buttonIds[t]=n;var s=this.options.widget;e=new s,this.buttons[n]=e,this.layout.setOptions({dimensions:o(this.buttons.length,this.options.direction)})}else e=this.buttons[n],e.unbind("select",this._buttonCallbacks[t]);this.options.buttons&&e.setOptions(this.options.buttons),e.setOptions(i),this._buttonCallbacks[t]=this.select.bind(this,t),e.on("select",this._buttonCallbacks[t])},e.prototype.select=function(t){var i=this._buttonIds[t];this.buttons[i]&&this.buttons[i].isSelected()?this._eventOutput.emit("select",{id:t}):this.buttons[i]&&this.buttons[i].select();for(var e=0;e<this.buttons.length;e++)e!==i&&this.buttons[e].deselect()},i.exports=e},{"../core/View":16,"../utilities/Utility":96,"../views/GridLayout":104,"./ToggleButton":116}],116:[function(t,i){function e(t){this.options={content:["",""],offClasses:["off"],onClasses:["on"],size:void 0,outTransition:{curve:"easeInOut",duration:300},inTransition:{curve:"easeInOut",duration:300},toggleMode:e.TOGGLE,crossfade:!0},this._eventOutput=new o,o.setOutputHandler(this,this._eventOutput),this.offSurface=new n,this.offSurface.on("click",function(){this.options.toggleMode!==e.OFF&&this.select()}.bind(this)),this.offSurface.pipe(this._eventOutput),this.onSurface=new n,this.onSurface.on("click",function(){this.options.toggleMode!==e.ON&&this.deselect()}.bind(this)),this.onSurface.pipe(this._eventOutput),this.arbiter=new s({overlap:this.options.crossfade}),this.deselect(),t&&this.setOptions(t)}var n=t("../core/Surface"),o=t("../core/EventHandler"),s=t("../views/RenderController");e.OFF=0,e.ON=1,e.TOGGLE=2,e.prototype.select=function(t){this.selected=!0,this.arbiter.show(this.onSurface,this.options.inTransition),t||this._eventOutput.emit("select")},e.prototype.deselect=function(t){this.selected=!1,this.arbiter.show(this.offSurface,this.options.outTransition),t||this._eventOutput.emit("deselect")},e.prototype.isSelected=function(){return this.selected},e.prototype.setOptions=function(t){void 0!==t.content&&(t.content instanceof Array||(t.content=[t.content,t.content]),this.options.content=t.content,this.offSurface.setContent(this.options.content[0]),this.onSurface.setContent(this.options.content[1])),t.offClasses&&(this.options.offClasses=t.offClasses,this.offSurface.setClasses(this.options.offClasses)),t.onClasses&&(this.options.onClasses=t.onClasses,this.onSurface.setClasses(this.options.onClasses)),void 0!==t.size&&(this.options.size=t.size,this.onSurface.setSize(this.options.size),this.offSurface.setSize(this.options.size)),void 0!==t.toggleMode&&(this.options.toggleMode=t.toggleMode),void 0!==t.outTransition&&(this.options.outTransition=t.outTransition),void 0!==t.inTransition&&(this.options.inTransition=t.inTransition),void 0!==t.crossfade&&(this.options.crossfade=t.crossfade,this.arbiter.setOptions({overlap:this.options.crossfade}))},e.prototype.getSize=function(){return this.options.size},e.prototype.render=function(){return this.arbiter.render()},i.exports=e},{"../core/EventHandler":7,"../core/Surface":14,"../views/RenderController":107}],117:[function(t,i){i.exports={NavigationBar:t("./NavigationBar"),Slider:t("./Slider"),TabBar:t("./TabBar"),ToggleButton:t("./ToggleButton")}
},{"./NavigationBar":113,"./Slider":114,"./TabBar":115,"./ToggleButton":116}]},{},[23])(23)});