From b18bdeede465fa1ffe2adbfa9ebdc0727162f0ea Mon Sep 17 00:00:00 2001 From: Andrey Butenko Date: Sun, 24 Jun 2018 17:31:41 -0700 Subject: [PATCH 1/2] Enable resize from any edge --- dist/ventus.css | 16 ++++ dist/ventus.js | 161 +++++++++++++++++++++++++++--------- dist/ventus.min.js | 4 +- src/ventus/less/window.less | 22 +++++ src/ventus/wm/window.js | 145 +++++++++++++++++++++++++++++--- 5 files changed, 296 insertions(+), 52 deletions(-) diff --git a/dist/ventus.css b/dist/ventus.css index 4a5ec9d..e9739d4 100644 --- a/dist/ventus.css +++ b/dist/ventus.css @@ -223,6 +223,22 @@ height: 15px; width: 10px; } +.wm-window.mouse-edge.mouse-edge-top, +.wm-window.mouse-edge.mouse-edge-bottom { + cursor: ns-resize; +} +.wm-window.mouse-edge.mouse-edge-left, +.wm-window.mouse-edge.mouse-edge-right { + cursor: ew-resize; +} +.wm-window.mouse-edge.mouse-edge-top-left, +.wm-window.mouse-edge.mouse-edge-bottom-right { + cursor: nwse-resize; +} +.wm-window.mouse-edge.mouse-edge-top-right, +.wm-window.mouse-edge.mouse-edge-bottom-left { + cursor: nesw-resize; +} .wm-window.disabled * { -webkit-user-select: none; -moz-user-select: none; diff --git a/dist/ventus.js b/dist/ventus.js index 5302e14..13ca160 100644 --- a/dist/ventus.js +++ b/dist/ventus.js @@ -1,16 +1,16 @@ -/*! - * Ventus 0.3 - * Copyright © 2015 Ramón Lamana - * http://www.rlamana.com - */ -(function (root, factory) { - if (typeof define === 'function' && define.amd) { // AMD. - define(['$'], factory); - } else { // Browser globals - root.Ventus = factory(root.$); - } -}(this, function (jQuery) { - +/*! + * Ventus 0.3 + * Copyright © 2015 Ramón Lamana + * http://www.rlamana.com + */ +(function (root, factory) { + if (typeof define === 'function' && define.amd) { // AMD. + define(['$'], factory); + } else { // Browser globals + root.Ventus = factory(root.$); + } +}(this, function (jQuery) { + var requirejs, require, define; (function (undef) { var defined = {}, waiting = {}, config = {}, defining = {}, aps = [].slice, main, req; @@ -1199,6 +1199,7 @@ define('ventus/wm/window', [ _restore: null, _moving: null, _resizing: null, + _resizeDirection: null, slots: { move: function (e) { var event = convertMoveEvent(e); @@ -1224,6 +1225,9 @@ define('ventus/wm/window', [ if (this.widget) { this.slots.move.call(this, e); } + if (this.enabled && this.resizable && this._resizeDirectionState().any) { + this.startResize(e); + } }, '.wm-content click': function (e) { if (this.enabled) { @@ -1231,7 +1235,7 @@ define('ventus/wm/window', [ } }, '.wm-window-title mousedown': function (e) { - if (!this.maximized) { + if (!this.maximized && !this._resizeDirectionState().any) { this.slots.move.call(this, e); } }, @@ -1267,17 +1271,58 @@ define('ventus/wm/window', [ e.preventDefault(); }, 'button.wm-resize mousedown': function (e) { - var event = convertMoveEvent(e); - if (!this.enabled || !this.resizable) { + if (this.enabled && this.resizable) { + this._resizeDirection = { + top: false, + left: false, + bottom: true, + right: true + }; + this.startResize(e); + } + }, + 'mousemove': function (e) { + var EdgeSensitivities = { + TOP: 5, + LEFT: 10, + BOTTOM: 15, + RIGHT: 15 + }; + var TITLE_HEIGHT = 36; + if (!this.enabled || !this.resizable || this._resizing) { return; } - this._resizing = { - width: this.width - event.pageX, - height: this.height - event.pageY + var event = convertMoveEvent(e); + this._resizeDirection = { + top: !e.srcElement.classList.contains('wm-content') && event.offsetY < EdgeSensitivities.TOP, + left: event.offsetX < EdgeSensitivities.LEFT, + bottom: this.height - TITLE_HEIGHT - event.offsetY < EdgeSensitivities.BOTTOM, + right: this.width - event.offsetX < EdgeSensitivities.RIGHT }; - this._space[0].classList.add('no-events'); - this.el.addClass('resizing'); - e.preventDefault(); + this.el[0].classList.remove('mouse-edge', 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', 'mouse-edge-left', 'mouse-edge-right', 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right'); + if (this._resizeDirectionState().any) { + var className = 'mouse-edge'; + window.counter = window.counter || 0; + if (this._resizeDirection.top) { + window.counter++; + console.log('top', window.counter); + className += '-top'; + } else if (this._resizeDirection.bottom) { + className += '-bottom'; + } + if (this._resizeDirection.left) { + className += '-left'; + } else if (this._resizeDirection.right) { + className += '-right'; + } + this.el[0].classList.add('mouse-edge', className); + } + }, + 'mouseleave': function () { + if (!this._resizing) { + this._resizeDirection = null; + this.el[0].classList.remove('mouse-edge', 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', 'mouse-edge-left', 'mouse-edge-right', 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right'); + } } }, space: { @@ -1308,7 +1353,29 @@ define('ventus/wm/window', [ } } if (this._resizing) { - this.resize(event.pageX + this._resizing.width, event.pageY + this._resizing.height); + var newWidth; + if (!this._resizeDirectionState().horizontal) { + newWidth = this.width; + } else if (this._resizeDirection.left) { + newWidth = this._resizing.pageX - event.pageX + this._resizing.width; + } else { + newWidth = event.pageX - this._resizing.pageX + this._resizing.width; + } + var newHeight; + if (!this._resizeDirectionState().vertical) { + newHeight = this.height; + } else if (this._resizeDirection.top) { + newHeight = this._resizing.pageY - event.pageY + this._resizing.height; + } else { + newHeight = event.pageY - this._resizing.pageY + this._resizing.height; + } + this.resize(newWidth, newHeight); + if (this._resizeDirection.left) { + this.move(event.pageX, this.y); + } + if (this._resizeDirection.top) { + this.move(this.x, event.pageY); + } } }, 'mouseup': function () { @@ -1328,6 +1395,13 @@ define('ventus/wm/window', [ this._restore = null; this._resizing = null; }, + _resizeDirectionState: function () { + return { + any: this._resizeDirection && (this._resizeDirection.top || this._resizeDirection.left || this._resizeDirection.bottom || this._resizeDirection.right), + horizontal: this._resizeDirection && (this._resizeDirection.left || this._resizeDirection.right), + vertical: this._resizeDirection && (this._resizeDirection.top || this._resizeDirection.bottom) + }; + }, set space(el) { if (el && !el.listen) { console.error('The given space element is not a valid View'); @@ -1477,6 +1551,18 @@ define('ventus/wm/window', [ get z() { return parseInt(this.el.css('z-index'), 10); }, + startResize: function (e) { + var event = convertMoveEvent(e); + this._resizing = { + pageX: event.pageX, + pageY: event.pageY, + width: this.width, + height: this.height + }; + this._space[0].classList.add('no-events'); + this.el.addClass('resizing'); + e.preventDefault(); + }, open: function () { var promise = new Promise(); this.signals.emit('open', this); @@ -2576,17 +2662,18 @@ define('src/main', [ 'handlebars', 'ventus' ], function () { -}); - - // Register in the values from the outer closure for common dependencies - // as local almond modules - define('$', function () { - return jQuery; - }); - - define('underscore', function () { - return _; - }); - - return require('ventus'); -})); +}); + + // Register in the values from the outer closure for common dependencies + // as local almond modules + define('$', function () { + return jQuery; + }); + + define('underscore', function () { + return _; + }); + + return require('ventus'); +})); + \ No newline at end of file diff --git a/dist/ventus.min.js b/dist/ventus.min.js index 6fb1131..e6c31bb 100644 --- a/dist/ventus.min.js +++ b/dist/ventus.min.js @@ -3,5 +3,5 @@ * Copyright © 2015 Ramón Lamana * http://www.rlamana.com */ -!function(t,n){"function"==typeof define&&define.amd?define(["$"],n):t.Ventus=n(t.$)}(this,function(t){var n,e,i;return function(t){function r(t,n){var e,i,r,s,o,a,u,c,l,h,f=n&&n.split("/"),p=m.map,d=p&&p["*"]||{};if(t&&"."===t.charAt(0)&&n){for(f=f.slice(0,f.length-1),t=f.concat(t.split("/")),c=0;h=t[c];c++)if("."===h)t.splice(c,1),c-=1;else if(".."===h){if(1===c&&(".."===t[2]||".."===t[0]))return!0;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||d)&&p){for(e=t.split("/"),c=e.length;c>0;c-=1){if(i=e.slice(0,c).join("/"),f)for(l=f.length;l>0;l-=1)if(r=p[f.slice(0,l).join("/")],r&&(r=r[i])){s=r,o=c;break}if(s)break;!a&&d&&d[i]&&(a=d[i],u=c)}!s&&a&&(s=a,o=u),s&&(e.splice(0,o,s),t=e.join("/"))}return t}function s(n,e){return function(){return f.apply(t,g.call(arguments,0).concat([n,e]))}}function o(t){return function(n){return r(n,t)}}function a(t){return function(n){p[t]=n}}function u(n){if(d.hasOwnProperty(n)){var e=d[n];delete d[n],v[n]=!0,h.apply(t,e)}if(!p.hasOwnProperty(n))throw new Error("No "+n);return p[n]}function c(t,n){var e,i,s=t.indexOf("!");return-1!==s?(e=r(t.slice(0,s),n),t=t.slice(s+1),i=u(e),t=i&&i.normalize?i.normalize(t,o(n)):r(t,n)):t=r(t,n),{f:e?e+"!"+t:t,n:t,p:i}}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var h,f,p={},d={},m={},v={},g=[].slice;h=function(n,e,i,r){var o,h,f,m,g,w,y=[];if(r=r||n,"function"==typeof i){for(e=!e.length&&i.length?["require","exports","module"]:e,w=0;w":">",'"':""","'":"'","`":"`"},c=/[&<>"'`]/g,l=/[&<>"'`]/;o.extend=e;var h=Object.prototype.toString;o.toString=h;var f=function(t){return"function"==typeof t};f(/x/)&&(f=function(t){return"function"==typeof t&&"[object Function]"===h.call(t)});var f;o.isFunction=f;var p=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===h.call(t):!1};return o.isArray=p,o.escapeExpression=i,o.isEmpty=r,o.appendContextPath=s,o}(t),e=function(){"use strict";function t(t,n){var i;n&&n.firstLine&&(i=n.firstLine,t+=" - "+i+":"+n.firstColumn);for(var r=Error.prototype.constructor.call(this,t),s=0;s0?(e.ids&&(e.ids=[e.name]),t.helpers.each(n,e)):i(this);if(e.data&&e.ids){var o=v(e.data);o.contextPath=s.appendContextPath(e.data.contextPath,e.name),e={data:o}}return r(n,e)}),t.registerHelper("each",function(t,n){if(!n)throw new o("Must pass iterator to #each");var e,i,r=n.fn,a=n.inverse,u=0,c="";if(n.data&&n.ids&&(i=s.appendContextPath(n.data.contextPath,n.ids[0])+"."),h(t)&&(t=t.call(this)),n.data&&(e=v(n.data)),t&&"object"==typeof t)if(l(t))for(var f=t.length;f>u;u++)e&&(e.index=u,e.first=0===u,e.last=u===t.length-1,i&&(e.contextPath=i+u)),c+=r(t[u],{data:e});else for(var p in t)t.hasOwnProperty(p)&&(e&&(e.key=p,e.index=u,e.first=0===u,i&&(e.contextPath=i+p)),c+=r(t[p],{data:e}),u++);return 0===u&&(c=a(this)),c}),t.registerHelper("if",function(t,n){return h(t)&&(t=t.call(this)),!n.hash.includeZero&&!t||s.isEmpty(t)?n.inverse(this):n.fn(this)}),t.registerHelper("unless",function(n,e){return t.helpers["if"].call(this,n,{fn:e.inverse,inverse:e.fn,hash:e.hash})}),t.registerHelper("with",function(t,n){h(t)&&(t=t.call(this));var e=n.fn;if(s.isEmpty(t))return n.inverse(this);if(n.data&&n.ids){var i=v(n.data);i.contextPath=s.appendContextPath(n.data.contextPath,n.ids[0]),n={data:i}}return e(t,n)}),t.registerHelper("log",function(n,e){var i=e.data&&null!=e.data.level?parseInt(e.data.level,10):1;t.log(i,n)}),t.registerHelper("lookup",function(t,n){return t&&t[n]})}var r={},s=t,o=n,a="2.0.0";r.VERSION=a;var u=6;r.COMPILER_REVISION=u;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};r.REVISION_CHANGES=c;var l=s.isArray,h=s.isFunction,f=s.toString,p="[object Object]";r.HandlebarsEnvironment=e,e.prototype={constructor:e,logger:d,log:m,registerHelper:function(t,n){if(f.call(t)===p){if(n)throw new o("Arg not supported with multiple helpers");s.extend(this.helpers,t)}else this.helpers[t]=n},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,n){f.call(t)===p?s.extend(this.partials,t):this.partials[t]=n},unregisterPartial:function(t){delete this.partials[t]}};var d={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,n){if(d.level<=t){var e=d.methodMap[t];"undefined"!=typeof console&&console[e]&&console[e].call(console,n)}}};r.logger=d;var m=d.log;r.log=m;var v=function(t){var n=s.extend({},t);return n._parent=t,n};return r.createFrame=v,r}(n,e),r=function(t,n,e){"use strict";function i(t){var n=t&&t[0]||1,e=f;if(n!==e){if(e>n){var i=p[e],r=p[n];throw new h("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+r+").")}throw new h("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function r(t,n){if(!n)throw new h("No environment passed to template");if(!t||!t.main)throw new h("Unknown template object: "+typeof t);n.VM.checkRevision(t.compiler);var e=function(e,i,r,s,o,a,u,c,f){o&&(s=l.extend({},s,o));var p=n.VM.invokePartial.call(this,e,r,s,a,u,c,f);if(null==p&&n.compile){var d={helpers:a,partials:u,data:c,depths:f};u[r]=n.compile(e,{data:void 0!==c,compat:t.compat},n),p=u[r](s,d)}if(null!=p){if(i){for(var m=p.split("\n"),v=0,g=m.length;g>v&&(m[v]||v+1!==g);v++)m[v]=i+m[v];p=m.join("\n")}return p}throw new h("The partial "+r+" could not be compiled when running in runtime-only mode")},i={lookup:function(t,n){for(var e=t.length,i=0;e>i;i++)if(t[i]&&null!=t[i][n])return t[i][n]},lambda:function(t,n){return"function"==typeof t?t.call(n):t},escapeExpression:l.escapeExpression,invokePartial:e,fn:function(n){return t[n]},programs:[],program:function(t,n,e){var i=this.programs[t],r=this.fn(t);return n||e?i=s(this,t,r,n,e):i||(i=this.programs[t]=s(this,t,r)),i},data:function(t,n){for(;t&&n--;)t=t._parent;return t},merge:function(t,n){var e=t||n;return t&&n&&t!==n&&(e=l.extend({},n,t)),e},noop:n.VM.noop,compilerInfo:t.compiler},r=function(n,e){e=e||{};var s=e.data;r._setup(e),!e.partial&&t.useData&&(s=u(n,s));var o;return t.useDepths&&(o=e.depths?[n].concat(e.depths):[n]),t.main.call(i,n,i.helpers,i.partials,s,o)};return r.isTop=!0,r._setup=function(e){e.partial?(i.helpers=e.helpers,i.partials=e.partials):(i.helpers=i.merge(e.helpers,n.helpers),t.usePartial&&(i.partials=i.merge(e.partials,n.partials)))},r._child=function(n,e,r){if(t.useDepths&&!r)throw new h("must pass parent depths");return s(i,n,t[n],e,r)},r}function s(t,n,e,i,r){var s=function(n,s){return s=s||{},e.call(t,n,t.helpers,t.partials,s.data||i,r&&[n].concat(r))};return s.program=n,s.depth=r?r.length:0,s}function o(t,n,e,i,r,s,o){var a={partial:!0,helpers:i,partials:r,data:s,depths:o};if(void 0===t)throw new h("The partial "+n+" could not be found");return t instanceof Function?t(e,a):void 0}function a(){return""}function u(t,n){return n&&"root"in n||(n=n?d(n):{},n.root=t),n}var c={},l=t,h=n,f=e.COMPILER_REVISION,p=e.REVISION_CHANGES,d=e.createFrame;return c.checkRevision=i,c.template=r,c.program=s,c.invokePartial=o,c.noop=a,c}(n,e,i),s=function(t,n,e,i,r){"use strict";var s,o=t,a=n,u=e,c=i,l=r,h=function(){var t=new o.HandlebarsEnvironment;return c.extend(t,o),t.SafeString=a,t.Exception=u,t.Utils=c,t.escapeExpression=c.escapeExpression,t.VM=l,t.template=function(n){return l.template(n,t)},t},f=h();return f.create=h,f["default"]=f,s=f}(i,t,e,n,r);return s}),i("ventus/core/emitter",[],function(){"use strict";function t(t,n,e){return function(i){return(i.funct===t&&i.scope===n)===e}}function n(n,e,i,r){return n[e]?n[e].some(t(i,r,!0)):!1}function e(){this._listeners={}}return e.prototype={listenersCount:function(t){var n=this._listeners[t];return n?n.length:0},on:function(t,e,i){var r=this._listeners;n(r,t,e,i)||(r[t]||(r[t]=[]),r[t].push({funct:e,scope:i}))},off:function(n,e,i){var r=this._listeners[n];r&&(this._listeners[n]=r.filter(t(e,i,!1)))},once:function(t,e,i){n(this._listeners,t,e,i)||this.on(t,function r(){this.off(t,r,this),e.apply(i,arguments)},this)},emit:function(t){var n=this._listeners[t];if(n){var e=Array.prototype.slice.call(arguments,1);n.forEach(function(t){t.funct.apply(t.scope,e)})}},connect:function(t,n){if(t)for(var e in t)t.hasOwnProperty(e)&&this.on(e,t[e],n)},disconnect:function(t,n){if(t)for(var e in t)t.hasOwnProperty(e)&&this.off(e,t[e],n)}},e}),i("ventus/core/promise",[],function(){"use strict";function t(t,n,e){setTimeout(function(){t.apply(n,e)})}function n(t,n,e){var i="Error on "+t+" promise execution at index ["+e+"]";Error.call(this,i),this.child=n,this.index=e,this.message=i}function e(){this._future=new s}function i(t){return t.hasSucceed()}function r(t,e,i,o,a){return i+=1,i>=t.length?o.done(a):a instanceof s?void a.then(function(){r(t,e,i,o,t[i].apply(e,arguments))},function(t){o.fail(new n(" serial ",t,i))}):r(t,e,i,o,t[i].call(e,a))}function s(){this._args=null,this._fn={success:[],failed:[],"finally":[]}}var o=Array.prototype.slice;return e.prototype={constructor:e,done:function(){var t=o.call(arguments);this.getFuture()._arrived("success",t)},fail:function(){var t=o.call(arguments);this.getFuture()._arrived("failed",t)},getFuture:function(){return this._future}},e.done=function(){var t=new e;return t.done.apply(t,arguments),t.getFuture()},e.failed=function(){var t=new e;return t.fail.apply(t,arguments),t.getFuture()},e.parallel=function(){return e.all(o.call(arguments))},e.all=function(t){if(!t||!t.length)return e.done();t=t.map(function(t){return t.getFuture?t.getFuture():t});var r=new e,s=[];return t.forEach(function(e,a){e.then(function(){s[a]=o.call(arguments),t.every(i)&&r.done.apply(r,s)},function(t){r.fail(new n("parallel",t,a))})}),r.getFuture()},e.serial=function(t,n){if(!t||0===t.length)return e.done();var i=new e;return setTimeout(function(){r(t,n,0,i,t[0].call(n))}),i.getFuture()},s.prototype={constructor:s,_add:function(n,e,i){return e?this._fn[n]===!0?t(e,i,this._args):this._fn[n]&&this._fn[n].push({callback:e,scope:i}):console.warn("No callback passed"),this},_arrived:function(t,n){function e(t){t.callback.apply(t.scope,n)}if(this.isCompleted())throw new Error("Future already arrived!");var i=this._fn[t].concat(this._fn["finally"]);this._fn={success:!1,failed:!1,"finally":!0},this._args=n,this._fn[t]=!0,i.forEach(e)},isCompleted:function(){return this._fn["finally"]===!0},hasFailed:function(){return this._fn.failed===!0},hasSucceed:function(){return this._fn.success===!0},onDone:function(t,n){return this._add("success",t,n)},onError:function(t,n){return this._add("failed",t,n)},onFinally:function(t,n){return this._add("finally",t,n)},then:function(t,n,e){t&&this.onDone(t),n&&this.onError(n),e&&this.onFinally(e)},transform:function(t){var n=new e;return this.then(function(){var e=t.apply(null,arguments);e&&"array"===e.constructor||(e=[e]),n.done.apply(n,e)},function(){n.fail.apply(n,arguments)}),n.getFuture()}},e.PromiseError=n,e.Future=s,e}),i("ventus/core/view",["$"],function(t){"use strict";for(var n=/^(?:(.*)\s)?(\w+)$/,e="transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",i="animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",r=["transform","transition","animation","transform-origin"],s=r.length;s--;)!function(n){t.cssHooks[n]={get:function(){return null},set:function(t,e){t.style["-webkit-"+n]=e,t.style["-moz-"+n]=e,t.style["-ms-"+n]=e,t.style["-o-"+n]=e,t.style[n]=e}}}(r[s]);return t.fn.extend({listen:function(t,e){var i,r,s,o;for(var a in t)if(t.hasOwnProperty(a)){if(i=t[a],r=a.match(n),s=r[1],o=r[2],"mousedown"===o?o+=" touchstart":"mousemove"===o?o+=" touchmove":"mouseup"===o?o+=" touchend":"click"===o&&(o+=" touchend"),"string"==typeof i&&(i=e[i]),!i)throw new Error("Handler not found");s?this.on(o,s,i.bind(e)):this.on(o,i.bind(e))}return this},onTransitionEnd:function(t,n){this.one(e,function(){t.apply(n||this)})},onAnimationEnd:function(t,n){this.one(i,function(){t.apply(n||this)})}}),function(n){return"function"==typeof n?function(e){return t(n(e||{}))}:t(n)}}),i("ventus/tpl/window",["handlebars"],function(t){return t.template({compiler:[6,">= 2.0.0-beta.1"],main:function(t,n,e,i){var r,s="function",o=n.helperMissing,a=this.escapeExpression;return'
\n
\n
\n

'+a((r=null!=(r=n.title||(null!=t?t.title:t))?r:o,typeof r===s?r.call(t,{name:"title",hash:{},data:i}):r))+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n
\n'},useData:!0})}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/promise","ventus/core/view","ventus/tpl/window"],function(t,n,e,i){"use strict";function r(t){return!!window.TouchEvent&&t.originalEvent instanceof window.TouchEvent}function s(t){return r(t)?t.originalEvent.changedTouches[0]:t.originalEvent}var o=function(n){if(this.signals=new t,n=n||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0,animations:!0,classname:"",stayinspace:!1},n.animations&&n.classname+" animated",this.el=e(i({title:n.title,classname:n.classname})),this.el.listen(this.events.window,this),n.opacity&&this.el.css("opacity",n.opacity),n.events)for(var r in n.events)n.events.hasOwnProperty(r)&&"function"==typeof n.events[r]&&this.signals.on(r,n.events[r],this);this.$content=this.el.find(".wm-content"),n.content&&this.$content.append(n.content),this.$titlebar=this.el.find("header"),this.width=n.width||400,this.height=n.height||200,this.x=n.x||0,this.y=n.y||0,this.z=1e4,this.enabled=!0,this.active=!1,this.maximized=!1,this.minimized=!1,this._closed=!0,this._destroyed=!1,this.widget=!1,this.movable="undefined"!=typeof n.movable?n.movable:!0,this.resizable="undefined"!=typeof n.resizable?n.resizable:!0,this.animations="undefined"!=typeof n.animations?n.animations:!0,this.titlebar=!0,this.stayinspace="undefined"!=typeof n.stayinspace?n.stayinspace:!1};return o.prototype={_restore:null,_moving:null,_resizing:null,slots:{move:function(t){var n=s(t);this.enabled&&this.movable&&(this._moving=this.toLocal({x:n.pageX,y:n.pageY}),this.el.addClass("move"),this._space[0].classList.add("no-events"),t.preventDefault())}},events:{window:{click:function(t){this.signals.emit("select",this,t)},mousedown:function(t){this.focus(),this.widget&&this.slots.move.call(this,t)},".wm-content click":function(t){this.enabled&&this.signals.emit("click",this,t)},".wm-window-title mousedown":function(t){this.maximized||this.slots.move.call(this,t)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(t){this.focus(),t.stopPropagation(),t.preventDefault()},"button.wm-resize mousedown":function(t){var n=s(t);this.enabled&&this.resizable&&(this._resizing={width:this.width-n.pageX,height:this.height-n.pageY},this._space[0].classList.add("no-events"),this.el.addClass("resizing"),t.preventDefault())}},space:{mousemove:function(t){var n=s(t);if(r(t)||1===t.which||(this._moving&&this._stopMove(),this._resizing&&this._stopResize()),this._moving)if(this.stayinspace){(this.el[0].clientWidth>this.space[0].clientWidth||this.el[0].clientHeight>this.space[0].clientHeight)&&this.resize(Math.min(this.el[0].clientWidth,this.space[0].clientWidth),Math.min(this.el[0].clientHeight,this.space[0].clientHeight));var e=Math.max(0,n.pageX-this._moving.x),i=0,o=Math.max(0,n.pageY-this._moving.y),a=0;e+this.el[0].clientWidth>this.space[0].clientWidth&&(i=e+this.el[0].clientWidth-this.space[0].clientWidth),o+this.el[0].clientHeight>this.space[0].clientHeight&&(a=o+this.el[0].clientHeight-this.space[0].clientHeight),this.move(e-i,o-a)}else this.move(n.pageX-this._moving.x,n.pageY-this._moving.y);this._resizing&&this.resize(n.pageX+this._resizing.width,n.pageY+this._resizing.height)},mouseup:function(){this._moving&&this._stopMove(),this._resizing&&this._stopResize()}}},_stopMove:function(){this.el.removeClass("move"),this._space[0].classList.remove("no-events"),this._moving=null},_stopResize:function(){this._space[0].classList.remove("no-events"),this.el.removeClass("resizing"),this._restore=null,this._resizing=null},set space(t){return t&&!t.listen?void console.error("The given space element is not a valid View"):(this._space=t,t.append(this.el),void t.listen(this.events.space,this))},get space(){return this._space},get maximized(){return this._maximized},set maximized(t){t?(this._restoreMaximized=this.stamp(),this.el.addClass("maximized"),this.signals.emit("maximize",this,this._restoreMaximized)):(this.el.removeClass("maximized"),this.signals.emit("restore",this,this._restoreMaximized)),this._maximized=t},get minimized(){return this._minimized},set minimized(t){t?(this._restoreMinimized=this.stamp(),this.signals.emit("minimize",this,this._restoreMinimized)):this.signals.emit("restore",this,this._restoreMinimized),this._minimized=t},set active(t){t?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=t},get active(){return this._active},set enabled(t){t?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=t},get enabled(){return this._enabled},set movable(t){this._movable=!!t},get movable(){return this._movable},set resizable(t){t?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!t},get resizable(){return this._resizable},set closed(t){},get closed(){return this._closed},set destroyed(t){},get destroyed(){return this._destroyed},set widget(t){this._widget=t},get widget(){return this._widget},set titlebar(t){t?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=t},get titlebar(){return this._titlebar},set animations(t){t?this.el.addClass("animated"):this.el.removeClass("animated"),this._animations=t},get animations(){return this._animations},set width(t){this.el.width(t)},get width(){return parseInt(this.el.width(),10)},set height(t){this.el.height(t)},get height(){return parseInt(this.el.height(),10)},set x(t){this.el.css("left",t)},set y(t){this.el.css("top",t)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(t){this.el.css("z-index",t)},get z(){return parseInt(this.el.css("z-index"),10)},open:function(){var t=new n;return this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening"),t.done()},this),this._closed=!1,t},close:function(){var t=new n;return this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.signals.emit("closed",this),t.done()},this),this._closed=!0,t},destroy:function(){var t=function(){this.$content.html(""),this.signals.emit("destroyed",this),this._destroyed=!0}.bind(this);this.signals.emit("destroy",this),this.closed?t():this.close().getFuture().then(function(){t()})},resize:function(t,n){return this.width=t,this.height=n,this},move:function(t,n){return this.x=t,this.y=n,this},stamp:function(){return this.restore=function(){var t={width:this.width,height:this.height},n={x:this.x,y:this.y};return function(){return this.resize(t.width,t.height),this.move(n.x,n.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){this.el.addClass("maximazing");var t=function(){this.el.removeClass("maximazing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.maximized=!this.maximized,this},minimize:function(){this.el.addClass("minimizing");var t=function(){this.el.removeClass("minimizing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.minimized=!this.minimized,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(t){return{x:t.x-this.x,y:t.y-this.y}},toGlobal:function(t){return{x:t.x+this.x,y:t.y+this.y}},append:function(t){t.appendTo(this.$content)}},o}),i("ventus/wm/modes/default",[],function(){"use strict";var t={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(t){t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},restore:function(t,n){n.call(t)},minimize:function(t){t.resize(0,0)}}};return t}),function(){var t=this,n=t._,e={},i=Array.prototype,r=Object.prototype,s=Function.prototype,o=i.push,a=i.slice,u=i.concat,c=r.toString,l=r.hasOwnProperty,h=i.forEach,f=i.map,p=i.reduce,d=i.reduceRight,m=i.filter,v=i.every,g=i.some,w=i.indexOf,y=i.lastIndexOf,b=Array.isArray,_=Object.keys,x=s.bind,j=function(t){return t instanceof j?t:this instanceof j?void(this._wrapped=t):new j(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):t._=j,j.VERSION="1.4.4";var z=j.each=j.forEach=function(t,n,i){if(null!=t)if(h&&t.forEach===h)t.forEach(n,i);else if(t.length===+t.length){for(var r=0,s=t.length;s>r;r++)if(n.call(i,t[r],r,t)===e)return}else for(var o in t)if(j.has(t,o)&&n.call(i,t[o],o,t)===e)return};j.map=j.collect=function(t,n,e){var i=[];return null==t?i:f&&t.map===f?t.map(n,e):(z(t,function(t,r,s){i[i.length]=n.call(e,t,r,s)}),i)};var E="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(t,n,e,i){var r=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return i&&(n=j.bind(n,i)),r?t.reduce(n,e):t.reduce(n);if(z(t,function(t,s,o){r?e=n.call(i,e,t,s,o):(e=t,r=!0)}),!r)throw new TypeError(E);return e},j.reduceRight=j.foldr=function(t,n,e,i){var r=arguments.length>2;if(null==t&&(t=[]),d&&t.reduceRight===d)return i&&(n=j.bind(n,i)),r?t.reduceRight(n,e):t.reduceRight(n);var s=t.length;if(s!==+s){var o=j.keys(t);s=o.length}if(z(t,function(a,u,c){u=o?o[--s]:--s,r?e=n.call(i,e,t[u],u,c):(e=t[u],r=!0)}),!r)throw new TypeError(E);return e},j.find=j.detect=function(t,n,e){var i;return O(t,function(t,r,s){return n.call(e,t,r,s)?(i=t,!0):void 0}),i},j.filter=j.select=function(t,n,e){var i=[];return null==t?i:m&&t.filter===m?t.filter(n,e):(z(t,function(t,r,s){n.call(e,t,r,s)&&(i[i.length]=t)}),i)},j.reject=function(t,n,e){return j.filter(t,function(t,i,r){return!n.call(e,t,i,r)},e)},j.every=j.all=function(t,n,i){n||(n=j.identity);var r=!0;return null==t?r:v&&t.every===v?t.every(n,i):(z(t,function(t,s,o){return(r=r&&n.call(i,t,s,o))?void 0:e}),!!r)};var O=j.some=j.any=function(t,n,i){n||(n=j.identity);var r=!1;return null==t?r:g&&t.some===g?t.some(n,i):(z(t,function(t,s,o){return r||(r=n.call(i,t,s,o))?e:void 0}),!!r)};j.contains=j.include=function(t,n){return null==t?!1:w&&t.indexOf===w?-1!=t.indexOf(n):O(t,function(t){return t===n})},j.invoke=function(t,n){var e=a.call(arguments,2),i=j.isFunction(n);return j.map(t,function(t){return(i?n:t[n]).apply(t,e)})},j.pluck=function(t,n){return j.map(t,function(t){return t[n]})},j.where=function(t,n,e){return j.isEmpty(n)?e?null:[]:j[e?"find":"filter"](t,function(t){for(var e in n)if(n[e]!==t[e])return!1;return!0})},j.findWhere=function(t,n){return j.where(t,n,!0)},j.max=function(t,n,e){if(!n&&j.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.max.apply(Math,t);if(!n&&j.isEmpty(t))return-1/0;var i={computed:-1/0,value:-1/0};return z(t,function(t,r,s){var o=n?n.call(e,t,r,s):t;o>=i.computed&&(i={value:t,computed:o})}),i.value},j.min=function(t,n,e){if(!n&&j.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.min.apply(Math,t);if(!n&&j.isEmpty(t))return 1/0;var i={computed:1/0,value:1/0};return z(t,function(t,r,s){var o=n?n.call(e,t,r,s):t;i.computed>o&&(i={value:t,computed:o})}),i.value},j.shuffle=function(t){var n,e=0,i=[];return z(t,function(t){n=j.random(e++),i[e-1]=i[n],i[n]=t}),i};var C=function(t){return j.isFunction(t)?t:function(n){return n[t]}};j.sortBy=function(t,n,e){var i=C(n);return j.pluck(j.map(t,function(t,n,r){return{value:t,index:n,criteria:i.call(e,t,n,r)}}).sort(function(t,n){var e=t.criteria,i=n.criteria;if(e!==i){if(e>i||void 0===e)return 1;if(i>e||void 0===i)return-1}return t.indexs;){var a=s+o>>>1;r>e.call(i,t[a])?s=a+1:o=a}return s},j.toArray=function(t){return t?j.isArray(t)?a.call(t):t.length===+t.length?j.map(t,j.identity):j.values(t):[]},j.size=function(t){return null==t?0:t.length===+t.length?t.length:j.keys(t).length},j.first=j.head=j.take=function(t,n,e){return null==t?void 0:null==n||e?t[0]:a.call(t,0,n)},j.initial=function(t,n,e){return a.call(t,0,t.length-(null==n||e?1:n))},j.last=function(t,n,e){return null==t?void 0:null==n||e?t[t.length-1]:a.call(t,Math.max(t.length-n,0))},j.rest=j.tail=j.drop=function(t,n,e){return a.call(t,null==n||e?1:n)},j.compact=function(t){return j.filter(t,j.identity)};var M=function(t,n,e){return z(t,function(t){j.isArray(t)?n?o.apply(e,t):M(t,n,e):e.push(t)}),e};j.flatten=function(t,n){return M(t,n,[])},j.without=function(t){return j.difference(t,a.call(arguments,1))},j.uniq=j.unique=function(t,n,e,i){j.isFunction(n)&&(i=e,e=n,n=!1);var r=e?j.map(t,e,i):t,s=[],o=[];return z(r,function(e,i){(n?i&&o[o.length-1]===e:j.contains(o,e))||(o.push(e),s.push(t[i]))}),s},j.union=function(){return j.uniq(u.apply(i,arguments))},j.intersection=function(t){var n=a.call(arguments,1);return j.filter(j.uniq(t),function(t){return j.every(n,function(n){return j.indexOf(n,t)>=0})})},j.difference=function(t){var n=u.apply(i,a.call(arguments,1));return j.filter(t,function(t){return!j.contains(n,t)})},j.zip=function(){for(var t=a.call(arguments),n=j.max(j.pluck(t,"length")),e=Array(n),i=0;n>i;i++)e[i]=j.pluck(t,""+i);return e},j.object=function(t,n){if(null==t)return{};for(var e={},i=0,r=t.length;r>i;i++)n?e[t[i]]=n[i]:e[t[i][0]]=t[i][1];return e},j.indexOf=function(t,n,e){if(null==t)return-1;var i=0,r=t.length;if(e){if("number"!=typeof e)return i=j.sortedIndex(t,n),t[i]===n?i:-1;i=0>e?Math.max(0,r+e):e}if(w&&t.indexOf===w)return t.indexOf(n,e);for(;r>i;i++)if(t[i]===n)return i;return-1},j.lastIndexOf=function(t,n,e){if(null==t)return-1;var i=null!=e;if(y&&t.lastIndexOf===y)return i?t.lastIndexOf(n,e):t.lastIndexOf(n);for(var r=i?e:t.length;r--;)if(t[r]===n)return r;return-1},j.range=function(t,n,e){1>=arguments.length&&(n=t||0,t=0),e=arguments[2]||1;for(var i=Math.max(Math.ceil((n-t)/e),0),r=0,s=Array(i);i>r;)s[r++]=t,t+=e;return s},j.bind=function(t,n){if(t.bind===x&&x)return x.apply(t,a.call(arguments,1));var e=a.call(arguments,2);return function(){return t.apply(n,e.concat(a.call(arguments)))}},j.partial=function(t){var n=a.call(arguments,1);return function(){return t.apply(this,n.concat(a.call(arguments)))}},j.bindAll=function(t){var n=a.call(arguments,1);return 0===n.length&&(n=j.functions(t)),z(n,function(n){t[n]=j.bind(t[n],t)}),t},j.memoize=function(t,n){var e={};return n||(n=j.identity),function(){var i=n.apply(this,arguments);return j.has(e,i)?e[i]:e[i]=t.apply(this,arguments)}},j.delay=function(t,n){var e=a.call(arguments,2);return setTimeout(function(){return t.apply(null,e)},n)},j.defer=function(t){return j.delay.apply(j,[t,1].concat(a.call(arguments,1)))},j.throttle=function(t,n){var e,i,r,s,o=0,a=function(){o=new Date,r=null,s=t.apply(e,i)};return function(){var u=new Date,c=n-(u-o);return e=this,i=arguments,0>=c?(clearTimeout(r),r=null,o=u,s=t.apply(e,i)):r||(r=setTimeout(a,c)),s}},j.debounce=function(t,n,e){var i,r;return function(){var s=this,o=arguments,a=function(){i=null,e||(r=t.apply(s,o))},u=e&&!i;return clearTimeout(i),i=setTimeout(a,n),u&&(r=t.apply(s,o)),r}},j.once=function(t){var n,e=!1;return function(){return e?n:(e=!0,n=t.apply(this,arguments),t=null,n)}},j.wrap=function(t,n){return function(){var e=[t];return o.apply(e,arguments),n.apply(this,e)}},j.compose=function(){var t=arguments;return function(){for(var n=arguments,e=t.length-1;e>=0;e--)n=[t[e].apply(this,n)];return n[0]}},j.after=function(t,n){return 0>=t?n():function(){return 1>--t?n.apply(this,arguments):void 0}},j.keys=_||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var n=[];for(var e in t)j.has(t,e)&&(n[n.length]=e);return n},j.values=function(t){var n=[];for(var e in t)j.has(t,e)&&n.push(t[e]);return n},j.pairs=function(t){var n=[];for(var e in t)j.has(t,e)&&n.push([e,t[e]]);return n},j.invert=function(t){var n={};for(var e in t)j.has(t,e)&&(n[t[e]]=e);return n},j.functions=j.methods=function(t){var n=[];for(var e in t)j.isFunction(t[e])&&n.push(e);return n.sort()},j.extend=function(t){return z(a.call(arguments,1),function(n){if(n)for(var e in n)t[e]=n[e]}),t},j.pick=function(t){var n={},e=u.apply(i,a.call(arguments,1)); -return z(e,function(e){e in t&&(n[e]=t[e])}),n},j.omit=function(t){var n={},e=u.apply(i,a.call(arguments,1));for(var r in t)j.contains(e,r)||(n[r]=t[r]);return n},j.defaults=function(t){return z(a.call(arguments,1),function(n){if(n)for(var e in n)null==t[e]&&(t[e]=n[e])}),t},j.clone=function(t){return j.isObject(t)?j.isArray(t)?t.slice():j.extend({},t):t},j.tap=function(t,n){return n(t),t};var A=function(t,n,e,i){if(t===n)return 0!==t||1/t==1/n;if(null==t||null==n)return t===n;t instanceof j&&(t=t._wrapped),n instanceof j&&(n=n._wrapped);var r=c.call(t);if(r!=c.call(n))return!1;switch(r){case"[object String]":return t==n+"";case"[object Number]":return t!=+t?n!=+n:0==t?1/t==1/n:t==+n;case"[object Date]":case"[object Boolean]":return+t==+n;case"[object RegExp]":return t.source==n.source&&t.global==n.global&&t.multiline==n.multiline&&t.ignoreCase==n.ignoreCase}if("object"!=typeof t||"object"!=typeof n)return!1;for(var s=e.length;s--;)if(e[s]==t)return i[s]==n;e.push(t),i.push(n);var o=0,a=!0;if("[object Array]"==r){if(o=t.length,a=o==n.length)for(;o--&&(a=A(t[o],n[o],e,i)););}else{var u=t.constructor,l=n.constructor;if(u!==l&&!(j.isFunction(u)&&u instanceof u&&j.isFunction(l)&&l instanceof l))return!1;for(var h in t)if(j.has(t,h)&&(o++,!(a=j.has(n,h)&&A(t[h],n[h],e,i))))break;if(a){for(h in n)if(j.has(n,h)&&!o--)break;a=!o}}return e.pop(),i.pop(),a};j.isEqual=function(t,n){return A(t,n,[],[])},j.isEmpty=function(t){if(null==t)return!0;if(j.isArray(t)||j.isString(t))return 0===t.length;for(var n in t)if(j.has(t,n))return!1;return!0},j.isElement=function(t){return!(!t||1!==t.nodeType)},j.isArray=b||function(t){return"[object Array]"==c.call(t)},j.isObject=function(t){return t===Object(t)},z(["Arguments","Function","String","Number","Date","RegExp"],function(t){j["is"+t]=function(n){return c.call(n)=="[object "+t+"]"}}),j.isArguments(arguments)||(j.isArguments=function(t){return!(!t||!j.has(t,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(t){return"function"==typeof t}),j.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},j.isNaN=function(t){return j.isNumber(t)&&t!=+t},j.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==c.call(t)},j.isNull=function(t){return null===t},j.isUndefined=function(t){return void 0===t},j.has=function(t,n){return l.call(t,n)},j.noConflict=function(){return t._=n,this},j.identity=function(t){return t},j.times=function(t,n,e){for(var i=Array(t),r=0;t>r;r++)i[r]=n.call(e,r);return i},j.random=function(t,n){return null==n&&(n=t,t=0),t+Math.floor(Math.random()*(n-t+1))};var F={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};F.unescape=j.invert(F.escape);var P={escape:RegExp("["+j.keys(F.escape).join("")+"]","g"),unescape:RegExp("("+j.keys(F.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(t){j[t]=function(n){return null==n?"":(""+n).replace(P[t],function(n){return F[t][n]})}}),j.result=function(t,n){if(null==t)return null;var e=t[n];return j.isFunction(e)?e.call(t):e},j.mixin=function(t){z(j.functions(t),function(n){var e=j[n]=t[n];j.prototype[n]=function(){var t=[this._wrapped];return o.apply(t,arguments),S.call(this,e.apply(j,t))}})};var T=0;j.uniqueId=function(t){var n=++T+"";return t?t+n:n},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var H=/(.)^/,I={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(t,n,e){var i;e=j.defaults({},e,j.templateSettings);var r=RegExp([(e.escape||H).source,(e.interpolate||H).source,(e.evaluate||H).source].join("|")+"|$","g"),s=0,o="__p+='";t.replace(r,function(n,e,i,r,a){return o+=t.slice(s,a).replace(R,function(t){return"\\"+I[t]}),e&&(o+="'+\n((__t=("+e+"))==null?'':_.escape(__t))+\n'"),i&&(o+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+n.length,n}),o+="';\n",e.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=Function(e.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(n)return i(n,j);var u=function(t){return i.call(this,t,j)};return u.source="function("+(e.variable||"obj")+"){\n"+o+"}",u},j.chain=function(t){return j(t).chain()};var S=function(t){return this._chain?j(t).chain():t};j.mixin(j),z(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var n=i[t];j.prototype[t]=function(){var e=this._wrapped;return n.apply(e,arguments),"shift"!=t&&"splice"!=t||0!==e.length||delete e[0],S.call(this,e)}}),z(["concat","join","slice"],function(t){var n=i[t];j.prototype[t]=function(){return S.call(this,n.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("underscore",[],function(){}),i("ventus/wm/modes/expose",["underscore","ventus/core/promise"],function(t,n){"use strict";var e={register:function(){var n=this;console.log("Expose mode registered."),this.el.on("contextmenu",t.throttle(function(){return"expose"!==n.mode?n.windows.length>0&&(n.mode="expose"):"expose"===n.mode&&(n.mode="default"),!1},1e3))},plug:function(){var t,n,e,i,r=Math.floor,s=Math.ceil,o=this,a=s(this.windows.length/2),u=r(this.el.width()/a),c=r(this.el.height()/2);this.el.addClass("expose");for(var l,h=0,f=this.windows.length;f>h;h++){l=this.windows[h],l.stamp(),t=l.height>l.width?l.height>c?c/l.height:1:l.width>u?u/l.width:1,t-=.15,i={x:h%a*u,y:(a>h?0:1)*c},n=i.x+r((u-t*l.width)/2),e=i.y+r((c-t*l.height)/2),l.enabled=!1,l.movable=!1,l.el.addClass("exposing"),l.el.css("transform-origin","0 0"),l.el.css("transform","scale("+t+")"),l.el.css("top",e),l.el.css("left",n);var p=function(){l.el.removeClass("exposing")};l.animations?l.el.onTransitionEnd(p,this):p.call(this)}this.overlay=!0,this.el.one("click",function(){o.mode="default"})},unplug:function(){var t=new n;t.getFuture().then(function(){this.el.removeClass("expose")}.bind(this)),0===this.windows.length&&t.done();for(var e,i=this.windows.length;i--;){e=this.windows[i],e.restore(),e.el.css("transform","scale(1)"),e.el.css("transform-origin","50% 50%");var r=function(n,e){return function(){0===e&&t.done(),n.el.css("transform","")}}(e,i);e.animations?this.el.onTransitionEnd(r,this):r.call(this),e.movable=!0,e.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return e}),i("ventus/wm/modes/fullscreen",[],function(){"use strict";var t={register:function(){console.log("Fullscreen mode registered.")},plug:function(){this.el.addClass("fullscreen");for(var t,n=0,e=this.windows.length;e>n;n++)t=this.windows[n],t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},unplug:function(){for(var t,n=this.windows.length;n--;){t=this.windows[n],t.restore(),t.el.css("transform","scale(1)"),t.el.css("transform-origin","50% 50%");var e=function(t){return function(){this.el.removeClass("fullscreen"),t.el.css("transform","")}}(t);this.el.onTransitionEnd(e,this),t.movable=!0,t.resizable=!0,t.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return t}),i("ventus/wm/windowmanager",["$","ventus/wm/window","ventus/core/view","ventus/wm/modes/default","ventus/wm/modes/expose","ventus/wm/modes/fullscreen"],function(t,n,e,i,r,s){"use strict";var o=function(){var n;this.el=e('
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(t){this[t]=function(t){return function(){this.currentMode.actions[t]&&this.currentMode.actions[t].apply(this,arguments)}}.call(this,t)},this);for(var i in this.modes)this.modes.hasOwnProperty(i)&&this.modes[i].register&&this.modes[i].register.apply(this);this.windows=[],this.active=null,this.mode="default",n=this.createWindow,this.createWindow=n.bind(this),this.createWindow.fromQuery=n.fromQuery.bind(this),this.createWindow.fromElement=n.fromElement.bind(this)};return o.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:r,fullscreen:s},set mode(t){var n=this.modes[t];n&&this._mode!==t&&(this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),n.plug&&n.plug.apply(this),this._mode=t)},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(t){this.$overlay.css("opacity",t?.8:0),this._overlay=t},get overlay(){return this._overlay},createWindow:function(t){var e=new n(t);return this.mode="default",e.signals.on("focus",this._focus,this),e.signals.on("blur",this._blur,this),e.signals.on("close",this._close,this),this.actions.forEach(function(t){e.signals.on(t,this[t],this)},this),this.windows.push(e),e.space=this.el,e.focus(),e},_focus:function(t){var n,e,i=1e4,r=i+1e4;if(!this.active||this.active!==t){if(this.active?(n=this.active.z,this.active.blur()):n=i,e=this.windows.indexOf(t),this.windows.splice(e,1),this.windows.push(t),t.z=n+1,n>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=i+(s-r);this.active=t}},_blur:function(t){this.active===t&&(this.active=null)},_close:function(t){var n,e=this.windows.indexOf(t);return-1===e?void console.log("Trying to close a window that doesn't exist in this window manager"):(this.windows.splice(e,1),n=this.windows.length,void(this.active&&this.active===t&&(this.active=0!==n?this.windows[n-1]:null,this.active&&this.active.focus())))}},o.prototype.createWindow.fromQuery=function(t,n){return n.content=e(t),this.createWindow(n)},o.prototype.createWindow.fromElement=function(t,n){return n.content=e(t),this.createWindow(n)},o}),i("ventus",["require","exports","module","ventus/wm/windowmanager","ventus/wm/window"],function(t){"use strict";return{version:"0.2",browser:{animationEventName:function(){var t=document.body.style,n=null;return""===t.animation?n="animationend":""===t.MozAnimation?n="mozAnimationEnd":""===t.webkitAnimation&&(n="webkitAnimationEnd"),n}},WindowManager:t("ventus/wm/windowmanager"),Window:t("ventus/wm/window")}}),i("src/main",["almond","handlebars","ventus"],function(){}),i("$",function(){return t}),i("underscore",function(){return _}),e("ventus")}); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define(["$"],e):t.Ventus=e(t.$)}(this,function(t){var e,n,i;return function(t){function r(t,e){var n,i,r,s,o,a,u,c,l,h,f=e&&e.split("/"),p=m.map,d=p&&p["*"]||{};if(t&&"."===t.charAt(0)&&e){for(f=f.slice(0,f.length-1),t=f.concat(t.split("/")),c=0;h=t[c];c++)if("."===h)t.splice(c,1),c-=1;else if(".."===h){if(1===c&&(".."===t[2]||".."===t[0]))return!0;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||d)&&p){for(n=t.split("/"),c=n.length;c>0;c-=1){if(i=n.slice(0,c).join("/"),f)for(l=f.length;l>0;l-=1)if(r=p[f.slice(0,l).join("/")],r&&(r=r[i])){s=r,o=c;break}if(s)break;!a&&d&&d[i]&&(a=d[i],u=c)}!s&&a&&(s=a,o=u),s&&(n.splice(0,o,s),t=n.join("/"))}return t}function s(e,n){return function(){return f.apply(t,g.call(arguments,0).concat([e,n]))}}function o(t){return function(e){return r(e,t)}}function a(t){return function(e){p[t]=e}}function u(e){if(d.hasOwnProperty(e)){var n=d[e];delete d[e],v[e]=!0,h.apply(t,n)}if(!p.hasOwnProperty(e))throw new Error("No "+e);return p[e]}function c(t,e){var n,i,s=t.indexOf("!");return-1!==s?(n=r(t.slice(0,s),e),t=t.slice(s+1),i=u(n),t=i&&i.normalize?i.normalize(t,o(e)):r(t,e)):t=r(t,e),{f:n?n+"!"+t:t,n:t,p:i}}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var h,f,p={},d={},m={},v={},g=[].slice;h=function(e,n,i,r){var o,h,f,m,g,w,b=[];if(r=r||e,"function"==typeof i){for(n=!n.length&&i.length?["require","exports","module"]:n,w=0;w":">",'"':""","'":"'","`":"`"},c=/[&<>"'`]/g,l=/[&<>"'`]/;o.extend=n;var h=Object.prototype.toString;o.toString=h;var f=function(t){return"function"==typeof t};f(/x/)&&(f=function(t){return"function"==typeof t&&"[object Function]"===h.call(t)});var f;o.isFunction=f;var p=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===h.call(t):!1};return o.isArray=p,o.escapeExpression=i,o.isEmpty=r,o.appendContextPath=s,o}(t),n=function(){"use strict";function t(t,e){var i;e&&e.firstLine&&(i=e.firstLine,t+=" - "+i+":"+e.firstColumn);for(var r=Error.prototype.constructor.call(this,t),s=0;s0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var o=v(n.data);o.contextPath=s.appendContextPath(n.data.contextPath,n.name),n={data:o}}return r(e,n)}),t.registerHelper("each",function(t,e){if(!e)throw new o("Must pass iterator to #each");var n,i,r=e.fn,a=e.inverse,u=0,c="";if(e.data&&e.ids&&(i=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),h(t)&&(t=t.call(this)),e.data&&(n=v(e.data)),t&&"object"==typeof t)if(l(t))for(var f=t.length;f>u;u++)n&&(n.index=u,n.first=0===u,n.last=u===t.length-1,i&&(n.contextPath=i+u)),c+=r(t[u],{data:n});else for(var p in t)t.hasOwnProperty(p)&&(n&&(n.key=p,n.index=u,n.first=0===u,i&&(n.contextPath=i+p)),c+=r(t[p],{data:n}),u++);return 0===u&&(c=a(this)),c}),t.registerHelper("if",function(t,e){return h(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||s.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){return t.helpers["if"].call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),t.registerHelper("with",function(t,e){h(t)&&(t=t.call(this));var n=e.fn;if(s.isEmpty(t))return e.inverse(this);if(e.data&&e.ids){var i=v(e.data);i.contextPath=s.appendContextPath(e.data.contextPath,e.ids[0]),e={data:i}}return n(t,e)}),t.registerHelper("log",function(e,n){var i=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;t.log(i,e)}),t.registerHelper("lookup",function(t,e){return t&&t[e]})}var r={},s=t,o=e,a="2.0.0";r.VERSION=a;var u=6;r.COMPILER_REVISION=u;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};r.REVISION_CHANGES=c;var l=s.isArray,h=s.isFunction,f=s.toString,p="[object Object]";r.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:d,log:m,registerHelper:function(t,e){if(f.call(t)===p){if(e)throw new o("Arg not supported with multiple helpers");s.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){f.call(t)===p?s.extend(this.partials,t):this.partials[t]=e},unregisterPartial:function(t){delete this.partials[t]}};var d={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,e){if(d.level<=t){var n=d.methodMap[t];"undefined"!=typeof console&&console[n]&&console[n].call(console,e)}}};r.logger=d;var m=d.log;r.log=m;var v=function(t){var e=s.extend({},t);return e._parent=t,e};return r.createFrame=v,r}(e,n),r=function(t,e,n){"use strict";function i(t){var e=t&&t[0]||1,n=f;if(e!==n){if(n>e){var i=p[n],r=p[e];throw new h("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+r+").")}throw new h("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function r(t,e){if(!e)throw new h("No environment passed to template");if(!t||!t.main)throw new h("Unknown template object: "+typeof t);e.VM.checkRevision(t.compiler);var n=function(n,i,r,s,o,a,u,c,f){o&&(s=l.extend({},s,o));var p=e.VM.invokePartial.call(this,n,r,s,a,u,c,f);if(null==p&&e.compile){var d={helpers:a,partials:u,data:c,depths:f};u[r]=e.compile(n,{data:void 0!==c,compat:t.compat},e),p=u[r](s,d)}if(null!=p){if(i){for(var m=p.split("\n"),v=0,g=m.length;g>v&&(m[v]||v+1!==g);v++)m[v]=i+m[v];p=m.join("\n")}return p}throw new h("The partial "+r+" could not be compiled when running in runtime-only mode")},i={lookup:function(t,e){for(var n=t.length,i=0;n>i;i++)if(t[i]&&null!=t[i][e])return t[i][e]},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:l.escapeExpression,invokePartial:n,fn:function(e){return t[e]},programs:[],program:function(t,e,n){var i=this.programs[t],r=this.fn(t);return e||n?i=s(this,t,r,e,n):i||(i=this.programs[t]=s(this,t,r)),i},data:function(t,e){for(;t&&e--;)t=t._parent;return t},merge:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=l.extend({},e,t)),n},noop:e.VM.noop,compilerInfo:t.compiler},r=function(e,n){n=n||{};var s=n.data;r._setup(n),!n.partial&&t.useData&&(s=u(e,s));var o;return t.useDepths&&(o=n.depths?[e].concat(n.depths):[e]),t.main.call(i,e,i.helpers,i.partials,s,o)};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials):(i.helpers=i.merge(n.helpers,e.helpers),t.usePartial&&(i.partials=i.merge(n.partials,e.partials)))},r._child=function(e,n,r){if(t.useDepths&&!r)throw new h("must pass parent depths");return s(i,e,t[e],n,r)},r}function s(t,e,n,i,r){var s=function(e,s){return s=s||{},n.call(t,e,t.helpers,t.partials,s.data||i,r&&[e].concat(r))};return s.program=e,s.depth=r?r.length:0,s}function o(t,e,n,i,r,s,o){var a={partial:!0,helpers:i,partials:r,data:s,depths:o};if(void 0===t)throw new h("The partial "+e+" could not be found");return t instanceof Function?t(n,a):void 0}function a(){return""}function u(t,e){return e&&"root"in e||(e=e?d(e):{},e.root=t),e}var c={},l=t,h=e,f=n.COMPILER_REVISION,p=n.REVISION_CHANGES,d=n.createFrame;return c.checkRevision=i,c.template=r,c.program=s,c.invokePartial=o,c.noop=a,c}(e,n,i),s=function(t,e,n,i,r){"use strict";var s,o=t,a=e,u=n,c=i,l=r,h=function(){var t=new o.HandlebarsEnvironment;return c.extend(t,o),t.SafeString=a,t.Exception=u,t.Utils=c,t.escapeExpression=c.escapeExpression,t.VM=l,t.template=function(e){return l.template(e,t)},t},f=h();return f.create=h,f["default"]=f,s=f}(i,t,n,e,r);return s}),i("ventus/core/emitter",[],function(){"use strict";function t(t,e,n){return function(i){return(i.funct===t&&i.scope===e)===n}}function e(e,n,i,r){return e[n]?e[n].some(t(i,r,!0)):!1}function n(){this._listeners={}}return n.prototype={listenersCount:function(t){var e=this._listeners[t];return e?e.length:0},on:function(t,n,i){var r=this._listeners;e(r,t,n,i)||(r[t]||(r[t]=[]),r[t].push({funct:n,scope:i}))},off:function(e,n,i){var r=this._listeners[e];r&&(this._listeners[e]=r.filter(t(n,i,!1)))},once:function(t,n,i){e(this._listeners,t,n,i)||this.on(t,function r(){this.off(t,r,this),n.apply(i,arguments)},this)},emit:function(t){var e=this._listeners[t];if(e){var n=Array.prototype.slice.call(arguments,1);e.forEach(function(t){t.funct.apply(t.scope,n)})}},connect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.on(n,t[n],e)},disconnect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.off(n,t[n],e)}},n}),i("ventus/core/promise",[],function(){"use strict";function t(t,e,n){setTimeout(function(){t.apply(e,n)})}function e(t,e,n){var i="Error on "+t+" promise execution at index ["+n+"]";Error.call(this,i),this.child=e,this.index=n,this.message=i}function n(){this._future=new s}function i(t){return t.hasSucceed()}function r(t,n,i,o,a){return i+=1,i>=t.length?o.done(a):a instanceof s?void a.then(function(){r(t,n,i,o,t[i].apply(n,arguments))},function(t){o.fail(new e(" serial ",t,i))}):r(t,n,i,o,t[i].call(n,a))}function s(){this._args=null,this._fn={success:[],failed:[],"finally":[]}}var o=Array.prototype.slice;return n.prototype={constructor:n,done:function(){var t=o.call(arguments);this.getFuture()._arrived("success",t)},fail:function(){var t=o.call(arguments);this.getFuture()._arrived("failed",t)},getFuture:function(){return this._future}},n.done=function(){var t=new n;return t.done.apply(t,arguments),t.getFuture()},n.failed=function(){var t=new n;return t.fail.apply(t,arguments),t.getFuture()},n.parallel=function(){return n.all(o.call(arguments))},n.all=function(t){if(!t||!t.length)return n.done();t=t.map(function(t){return t.getFuture?t.getFuture():t});var r=new n,s=[];return t.forEach(function(n,a){n.then(function(){s[a]=o.call(arguments),t.every(i)&&r.done.apply(r,s)},function(t){r.fail(new e("parallel",t,a))})}),r.getFuture()},n.serial=function(t,e){if(!t||0===t.length)return n.done();var i=new n;return setTimeout(function(){r(t,e,0,i,t[0].call(e))}),i.getFuture()},s.prototype={constructor:s,_add:function(e,n,i){return n?this._fn[e]===!0?t(n,i,this._args):this._fn[e]&&this._fn[e].push({callback:n,scope:i}):console.warn("No callback passed"),this},_arrived:function(t,e){function n(t){t.callback.apply(t.scope,e)}if(this.isCompleted())throw new Error("Future already arrived!");var i=this._fn[t].concat(this._fn["finally"]);this._fn={success:!1,failed:!1,"finally":!0},this._args=e,this._fn[t]=!0,i.forEach(n)},isCompleted:function(){return this._fn["finally"]===!0},hasFailed:function(){return this._fn.failed===!0},hasSucceed:function(){return this._fn.success===!0},onDone:function(t,e){return this._add("success",t,e)},onError:function(t,e){return this._add("failed",t,e)},onFinally:function(t,e){return this._add("finally",t,e)},then:function(t,e,n){t&&this.onDone(t),e&&this.onError(e),n&&this.onFinally(n)},transform:function(t){var e=new n;return this.then(function(){var n=t.apply(null,arguments);n&&"array"===n.constructor||(n=[n]),e.done.apply(e,n)},function(){e.fail.apply(e,arguments)}),e.getFuture()}},n.PromiseError=e,n.Future=s,n}),i("ventus/core/view",["$"],function(t){"use strict";for(var e=/^(?:(.*)\s)?(\w+)$/,n="transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",i="animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",r=["transform","transition","animation","transform-origin"],s=r.length;s--;)!function(e){t.cssHooks[e]={get:function(){return null},set:function(t,n){t.style["-webkit-"+e]=n,t.style["-moz-"+e]=n,t.style["-ms-"+e]=n,t.style["-o-"+e]=n,t.style[e]=n}}}(r[s]);return t.fn.extend({listen:function(t,n){var i,r,s,o;for(var a in t)if(t.hasOwnProperty(a)){if(i=t[a],r=a.match(e),s=r[1],o=r[2],"mousedown"===o?o+=" touchstart":"mousemove"===o?o+=" touchmove":"mouseup"===o?o+=" touchend":"click"===o&&(o+=" touchend"),"string"==typeof i&&(i=n[i]),!i)throw new Error("Handler not found");s?this.on(o,s,i.bind(n)):this.on(o,i.bind(n))}return this},onTransitionEnd:function(t,e){this.one(n,function(){t.apply(e||this)})},onAnimationEnd:function(t,e){this.one(i,function(){t.apply(e||this)})}}),function(e){return"function"==typeof e?function(n){return t(e(n||{}))}:t(e)}}),i("ventus/tpl/window",["handlebars"],function(t){return t.template({compiler:[6,">= 2.0.0-beta.1"],main:function(t,e,n,i){var r,s="function",o=e.helperMissing,a=this.escapeExpression;return'
\n
\n
\n

'+a((r=null!=(r=e.title||(null!=t?t.title:t))?r:o,typeof r===s?r.call(t,{name:"title",hash:{},data:i}):r))+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n
\n'},useData:!0})}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/promise","ventus/core/view","ventus/tpl/window"],function(t,e,n,i){"use strict";function r(t){return!!window.TouchEvent&&t.originalEvent instanceof window.TouchEvent}function s(t){return r(t)?t.originalEvent.changedTouches[0]:t.originalEvent}var o=function(e){if(this.signals=new t,e=e||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0,animations:!0,classname:"",stayinspace:!1},e.animations&&e.classname+" animated",this.el=n(i({title:e.title,classname:e.classname})),this.el.listen(this.events.window,this),e.opacity&&this.el.css("opacity",e.opacity),e.events)for(var r in e.events)e.events.hasOwnProperty(r)&&"function"==typeof e.events[r]&&this.signals.on(r,e.events[r],this);this.$content=this.el.find(".wm-content"),e.content&&this.$content.append(e.content),this.$titlebar=this.el.find("header"),this.width=e.width||400,this.height=e.height||200,this.x=e.x||0,this.y=e.y||0,this.z=1e4,this.enabled=!0,this.active=!1,this.maximized=!1,this.minimized=!1,this._closed=!0,this._destroyed=!1,this.widget=!1,this.movable="undefined"!=typeof e.movable?e.movable:!0,this.resizable="undefined"!=typeof e.resizable?e.resizable:!0,this.animations="undefined"!=typeof e.animations?e.animations:!0,this.titlebar=!0,this.stayinspace="undefined"!=typeof e.stayinspace?e.stayinspace:!1};return o.prototype={_restore:null,_moving:null,_resizing:null,_resizeDirection:null,slots:{move:function(t){var e=s(t);this.enabled&&this.movable&&(this._moving=this.toLocal({x:e.pageX,y:e.pageY}),this.el.addClass("move"),this._space[0].classList.add("no-events"),t.preventDefault())}},events:{window:{click:function(t){this.signals.emit("select",this,t)},mousedown:function(t){this.focus(),this.widget&&this.slots.move.call(this,t),this.enabled&&this.resizable&&this._resizeDirectionState().any&&this.startResize(t)},".wm-content click":function(t){this.enabled&&this.signals.emit("click",this,t)},".wm-window-title mousedown":function(t){this.maximized||this._resizeDirectionState().any||this.slots.move.call(this,t)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(t){this.focus(),t.stopPropagation(),t.preventDefault()},"button.wm-resize mousedown":function(t){this.enabled&&this.resizable&&(this._resizeDirection={top:!1,left:!1,bottom:!0,right:!0},this.startResize(t))},mousemove:function(t){var e={TOP:5,LEFT:10,BOTTOM:15,RIGHT:15},n=36;if(this.enabled&&this.resizable&&!this._resizing){var i=s(t);if(this._resizeDirection={top:!t.srcElement.classList.contains("wm-content")&&i.offsetYthis.space[0].clientWidth||this.el[0].clientHeight>this.space[0].clientHeight)&&this.resize(Math.min(this.el[0].clientWidth,this.space[0].clientWidth),Math.min(this.el[0].clientHeight,this.space[0].clientHeight));var n=Math.max(0,e.pageX-this._moving.x),i=0,o=Math.max(0,e.pageY-this._moving.y),a=0;n+this.el[0].clientWidth>this.space[0].clientWidth&&(i=n+this.el[0].clientWidth-this.space[0].clientWidth),o+this.el[0].clientHeight>this.space[0].clientHeight&&(a=o+this.el[0].clientHeight-this.space[0].clientHeight),this.move(n-i,o-a)}else this.move(e.pageX-this._moving.x,e.pageY-this._moving.y);if(this._resizing){var u;u=this._resizeDirectionState().horizontal?this._resizeDirection.left?this._resizing.pageX-e.pageX+this._resizing.width:e.pageX-this._resizing.pageX+this._resizing.width:this.width;var c;c=this._resizeDirectionState().vertical?this._resizeDirection.top?this._resizing.pageY-e.pageY+this._resizing.height:e.pageY-this._resizing.pageY+this._resizing.height:this.height,this.resize(u,c),this._resizeDirection.left&&this.move(e.pageX,this.y),this._resizeDirection.top&&this.move(this.x,e.pageY)}},mouseup:function(){this._moving&&this._stopMove(),this._resizing&&this._stopResize()}}},_stopMove:function(){this.el.removeClass("move"),this._space[0].classList.remove("no-events"),this._moving=null},_stopResize:function(){this._space[0].classList.remove("no-events"),this.el.removeClass("resizing"),this._restore=null,this._resizing=null},_resizeDirectionState:function(){return{any:this._resizeDirection&&(this._resizeDirection.top||this._resizeDirection.left||this._resizeDirection.bottom||this._resizeDirection.right),horizontal:this._resizeDirection&&(this._resizeDirection.left||this._resizeDirection.right),vertical:this._resizeDirection&&(this._resizeDirection.top||this._resizeDirection.bottom)}},set space(t){return t&&!t.listen?void console.error("The given space element is not a valid View"):(this._space=t,t.append(this.el),void t.listen(this.events.space,this))},get space(){return this._space},get maximized(){return this._maximized},set maximized(t){t?(this._restoreMaximized=this.stamp(),this.el.addClass("maximized"),this.signals.emit("maximize",this,this._restoreMaximized)):(this.el.removeClass("maximized"),this.signals.emit("restore",this,this._restoreMaximized)),this._maximized=t},get minimized(){return this._minimized},set minimized(t){t?(this._restoreMinimized=this.stamp(),this.signals.emit("minimize",this,this._restoreMinimized)):this.signals.emit("restore",this,this._restoreMinimized),this._minimized=t},set active(t){t?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=t},get active(){return this._active},set enabled(t){t?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=t},get enabled(){return this._enabled},set movable(t){this._movable=!!t},get movable(){return this._movable},set resizable(t){t?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!t},get resizable(){return this._resizable},set closed(t){},get closed(){return this._closed},set destroyed(t){},get destroyed(){return this._destroyed},set widget(t){this._widget=t},get widget(){return this._widget},set titlebar(t){t?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=t},get titlebar(){return this._titlebar},set animations(t){t?this.el.addClass("animated"):this.el.removeClass("animated"),this._animations=t},get animations(){return this._animations},set width(t){this.el.width(t)},get width(){return parseInt(this.el.width(),10)},set height(t){this.el.height(t)},get height(){return parseInt(this.el.height(),10)},set x(t){this.el.css("left",t)},set y(t){this.el.css("top",t)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(t){this.el.css("z-index",t)},get z(){return parseInt(this.el.css("z-index"),10)},startResize:function(t){var e=s(t);this._resizing={pageX:e.pageX,pageY:e.pageY,width:this.width,height:this.height},this._space[0].classList.add("no-events"),this.el.addClass("resizing"),t.preventDefault()},open:function(){var t=new e;return this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening"),t.done()},this),this._closed=!1,t},close:function(){var t=new e;return this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.signals.emit("closed",this),t.done()},this),this._closed=!0,t},destroy:function(){var t=function(){this.$content.html(""),this.signals.emit("destroyed",this),this._destroyed=!0}.bind(this);this.signals.emit("destroy",this),this.closed?t():this.close().getFuture().then(function(){t()})},resize:function(t,e){return this.width=t,this.height=e,this},move:function(t,e){return this.x=t,this.y=e,this},stamp:function(){return this.restore=function(){var t={width:this.width,height:this.height},e={x:this.x,y:this.y};return function(){return this.resize(t.width,t.height),this.move(e.x,e.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){this.el.addClass("maximazing");var t=function(){this.el.removeClass("maximazing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.maximized=!this.maximized,this},minimize:function(){this.el.addClass("minimizing");var t=function(){this.el.removeClass("minimizing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.minimized=!this.minimized,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(t){return{x:t.x-this.x,y:t.y-this.y}},toGlobal:function(t){return{x:t.x+this.x,y:t.y+this.y}},append:function(t){t.appendTo(this.$content)}},o}),i("ventus/wm/modes/default",[],function(){"use strict";var t={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(t){t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},restore:function(t,e){e.call(t)},minimize:function(t){t.resize(0,0)}}};return t}),function(){var t=this,e=t._,n={},i=Array.prototype,r=Object.prototype,s=Function.prototype,o=i.push,a=i.slice,u=i.concat,c=r.toString,l=r.hasOwnProperty,h=i.forEach,f=i.map,p=i.reduce,d=i.reduceRight,m=i.filter,v=i.every,g=i.some,w=i.indexOf,b=i.lastIndexOf,y=Array.isArray,_=Object.keys,x=s.bind,z=function(t){return t instanceof z?t:this instanceof z?void(this._wrapped=t):new z(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=z),exports._=z):t._=z,z.VERSION="1.4.4";var j=z.each=z.forEach=function(t,e,i){if(null!=t)if(h&&t.forEach===h)t.forEach(e,i);else if(t.length===+t.length){for(var r=0,s=t.length;s>r;r++)if(e.call(i,t[r],r,t)===n)return}else for(var o in t)if(z.has(t,o)&&e.call(i,t[o],o,t)===n)return};z.map=z.collect=function(t,e,n){var i=[];return null==t?i:f&&t.map===f?t.map(e,n):(j(t,function(t,r,s){i[i.length]=e.call(n,t,r,s)}),i)};var O="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return i&&(e=z.bind(e,i)),r?t.reduce(e,n):t.reduce(e);if(j(t,function(t,s,o){r?n=e.call(i,n,t,s,o):(n=t,r=!0)}),!r)throw new TypeError(O);return n},z.reduceRight=z.foldr=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),d&&t.reduceRight===d)return i&&(e=z.bind(e,i)),r?t.reduceRight(e,n):t.reduceRight(e);var s=t.length;if(s!==+s){var o=z.keys(t);s=o.length}if(j(t,function(a,u,c){u=o?o[--s]:--s,r?n=e.call(i,n,t[u],u,c):(n=t[u],r=!0)}),!r)throw new TypeError(O);return n},z.find=z.detect=function(t,e,n){var i;return E(t,function(t,r,s){return e.call(n,t,r,s)?(i=t,!0):void 0}),i},z.filter=z.select=function(t,e,n){var i=[];return null==t?i:m&&t.filter===m?t.filter(e,n):(j(t,function(t,r,s){e.call(n,t,r,s)&&(i[i.length]=t)}),i)},z.reject=function(t,e,n){return z.filter(t,function(t,i,r){return!e.call(n,t,i,r)},n)},z.every=z.all=function(t,e,i){e||(e=z.identity);var r=!0;return null==t?r:v&&t.every===v?t.every(e,i):(j(t,function(t,s,o){return(r=r&&e.call(i,t,s,o))?void 0:n}),!!r)};var E=z.some=z.any=function(t,e,i){e||(e=z.identity);var r=!1;return null==t?r:g&&t.some===g?t.some(e,i):(j(t,function(t,s,o){return r||(r=e.call(i,t,s,o))?n:void 0}),!!r)};z.contains=z.include=function(t,e){return null==t?!1:w&&t.indexOf===w?-1!=t.indexOf(e):E(t,function(t){return t===e})},z.invoke=function(t,e){var n=a.call(arguments,2),i=z.isFunction(e);return z.map(t,function(t){return(i?e:t[e]).apply(t,n)})},z.pluck=function(t,e){return z.map(t,function(t){return t[e]})},z.where=function(t,e,n){return z.isEmpty(e)?n?null:[]:z[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},z.findWhere=function(t,e){return z.where(t,e,!0)},z.max=function(t,e,n){if(!e&&z.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.max.apply(Math,t);if(!e&&z.isEmpty(t))return-1/0;var i={computed:-1/0,value:-1/0};return j(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;o>=i.computed&&(i={value:t,computed:o})}),i.value},z.min=function(t,e,n){if(!e&&z.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.min.apply(Math,t);if(!e&&z.isEmpty(t))return 1/0;var i={computed:1/0,value:1/0};return j(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;i.computed>o&&(i={value:t,computed:o})}),i.value},z.shuffle=function(t){var e,n=0,i=[];return j(t,function(t){e=z.random(n++),i[n-1]=i[e],i[e]=t}),i};var C=function(t){return z.isFunction(t)?t:function(e){return e[t]}};z.sortBy=function(t,e,n){var i=C(e);return z.pluck(z.map(t,function(t,e,r){return{value:t,index:e,criteria:i.call(n,t,e,r)}}).sort(function(t,e){var n=t.criteria,i=e.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(i>n||void 0===i)return-1}return t.indexs;){var a=s+o>>>1;r>n.call(i,t[a])?s=a+1:o=a}return s},z.toArray=function(t){return t?z.isArray(t)?a.call(t):t.length===+t.length?z.map(t,z.identity):z.values(t):[]},z.size=function(t){return null==t?0:t.length===+t.length?t.length:z.keys(t).length},z.first=z.head=z.take=function(t,e,n){return null==t?void 0:null==e||n?t[0]:a.call(t,0,e)},z.initial=function(t,e,n){return a.call(t,0,t.length-(null==e||n?1:e))},z.last=function(t,e,n){return null==t?void 0:null==e||n?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},z.rest=z.tail=z.drop=function(t,e,n){return a.call(t,null==e||n?1:e)},z.compact=function(t){return z.filter(t,z.identity)};var M=function(t,e,n){return j(t,function(t){z.isArray(t)?e?o.apply(n,t):M(t,e,n):n.push(t)}),n};z.flatten=function(t,e){return M(t,e,[])},z.without=function(t){return z.difference(t,a.call(arguments,1))},z.uniq=z.unique=function(t,e,n,i){z.isFunction(e)&&(i=n,n=e,e=!1);var r=n?z.map(t,n,i):t,s=[],o=[];return j(r,function(n,i){(e?i&&o[o.length-1]===n:z.contains(o,n))||(o.push(n),s.push(t[i]))}),s},z.union=function(){return z.uniq(u.apply(i,arguments))},z.intersection=function(t){var e=a.call(arguments,1);return z.filter(z.uniq(t),function(t){return z.every(e,function(e){return z.indexOf(e,t)>=0})})},z.difference=function(t){var e=u.apply(i,a.call(arguments,1));return z.filter(t,function(t){return!z.contains(e,t)})},z.zip=function(){for(var t=a.call(arguments),e=z.max(z.pluck(t,"length")),n=Array(e),i=0;e>i;i++)n[i]=z.pluck(t,""+i);return n},z.object=function(t,e){if(null==t)return{};for(var n={},i=0,r=t.length;r>i;i++)e?n[t[i]]=e[i]:n[t[i][0]]=t[i][1];return n},z.indexOf=function(t,e,n){if(null==t)return-1;var i=0,r=t.length;if(n){if("number"!=typeof n)return i=z.sortedIndex(t,e),t[i]===e?i:-1;i=0>n?Math.max(0,r+n):n}if(w&&t.indexOf===w)return t.indexOf(e,n);for(;r>i;i++)if(t[i]===e)return i;return-1},z.lastIndexOf=function(t,e,n){if(null==t)return-1;var i=null!=n;if(b&&t.lastIndexOf===b)return i?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var r=i?n:t.length;r--;)if(t[r]===e)return r;return-1},z.range=function(t,e,n){1>=arguments.length&&(e=t||0,t=0),n=arguments[2]||1;for(var i=Math.max(Math.ceil((e-t)/n),0),r=0,s=Array(i);i>r;)s[r++]=t,t+=n; +return s},z.bind=function(t,e){if(t.bind===x&&x)return x.apply(t,a.call(arguments,1));var n=a.call(arguments,2);return function(){return t.apply(e,n.concat(a.call(arguments)))}},z.partial=function(t){var e=a.call(arguments,1);return function(){return t.apply(this,e.concat(a.call(arguments)))}},z.bindAll=function(t){var e=a.call(arguments,1);return 0===e.length&&(e=z.functions(t)),j(e,function(e){t[e]=z.bind(t[e],t)}),t},z.memoize=function(t,e){var n={};return e||(e=z.identity),function(){var i=e.apply(this,arguments);return z.has(n,i)?n[i]:n[i]=t.apply(this,arguments)}},z.delay=function(t,e){var n=a.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},z.defer=function(t){return z.delay.apply(z,[t,1].concat(a.call(arguments,1)))},z.throttle=function(t,e){var n,i,r,s,o=0,a=function(){o=new Date,r=null,s=t.apply(n,i)};return function(){var u=new Date,c=e-(u-o);return n=this,i=arguments,0>=c?(clearTimeout(r),r=null,o=u,s=t.apply(n,i)):r||(r=setTimeout(a,c)),s}},z.debounce=function(t,e,n){var i,r;return function(){var s=this,o=arguments,a=function(){i=null,n||(r=t.apply(s,o))},u=n&&!i;return clearTimeout(i),i=setTimeout(a,e),u&&(r=t.apply(s,o)),r}},z.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},z.wrap=function(t,e){return function(){var n=[t];return o.apply(n,arguments),e.apply(this,n)}},z.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},z.after=function(t,e){return 0>=t?e():function(){return 1>--t?e.apply(this,arguments):void 0}},z.keys=_||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)z.has(t,n)&&(e[e.length]=n);return e},z.values=function(t){var e=[];for(var n in t)z.has(t,n)&&e.push(t[n]);return e},z.pairs=function(t){var e=[];for(var n in t)z.has(t,n)&&e.push([n,t[n]]);return e},z.invert=function(t){var e={};for(var n in t)z.has(t,n)&&(e[t[n]]=n);return e},z.functions=z.methods=function(t){var e=[];for(var n in t)z.isFunction(t[n])&&e.push(n);return e.sort()},z.extend=function(t){return j(a.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},z.pick=function(t){var e={},n=u.apply(i,a.call(arguments,1));return j(n,function(n){n in t&&(e[n]=t[n])}),e},z.omit=function(t){var e={},n=u.apply(i,a.call(arguments,1));for(var r in t)z.contains(n,r)||(e[r]=t[r]);return e},z.defaults=function(t){return j(a.call(arguments,1),function(e){if(e)for(var n in e)null==t[n]&&(t[n]=e[n])}),t},z.clone=function(t){return z.isObject(t)?z.isArray(t)?t.slice():z.extend({},t):t},z.tap=function(t,e){return e(t),t};var D=function(t,e,n,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof z&&(t=t._wrapped),e instanceof z&&(e=e._wrapped);var r=c.call(t);if(r!=c.call(e))return!1;switch(r){case"[object String]":return t==e+"";case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var s=n.length;s--;)if(n[s]==t)return i[s]==e;n.push(t),i.push(e);var o=0,a=!0;if("[object Array]"==r){if(o=t.length,a=o==e.length)for(;o--&&(a=D(t[o],e[o],n,i)););}else{var u=t.constructor,l=e.constructor;if(u!==l&&!(z.isFunction(u)&&u instanceof u&&z.isFunction(l)&&l instanceof l))return!1;for(var h in t)if(z.has(t,h)&&(o++,!(a=z.has(e,h)&&D(t[h],e[h],n,i))))break;if(a){for(h in e)if(z.has(e,h)&&!o--)break;a=!o}}return n.pop(),i.pop(),a};z.isEqual=function(t,e){return D(t,e,[],[])},z.isEmpty=function(t){if(null==t)return!0;if(z.isArray(t)||z.isString(t))return 0===t.length;for(var e in t)if(z.has(t,e))return!1;return!0},z.isElement=function(t){return!(!t||1!==t.nodeType)},z.isArray=y||function(t){return"[object Array]"==c.call(t)},z.isObject=function(t){return t===Object(t)},j(["Arguments","Function","String","Number","Date","RegExp"],function(t){z["is"+t]=function(e){return c.call(e)=="[object "+t+"]"}}),z.isArguments(arguments)||(z.isArguments=function(t){return!(!t||!z.has(t,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(t){return"function"==typeof t}),z.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},z.isNaN=function(t){return z.isNumber(t)&&t!=+t},z.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==c.call(t)},z.isNull=function(t){return null===t},z.isUndefined=function(t){return void 0===t},z.has=function(t,e){return l.call(t,e)},z.noConflict=function(){return t._=e,this},z.identity=function(t){return t},z.times=function(t,e,n){for(var i=Array(t),r=0;t>r;r++)i[r]=e.call(n,r);return i},z.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var A={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};A.unescape=z.invert(A.escape);var F={escape:RegExp("["+z.keys(A.escape).join("")+"]","g"),unescape:RegExp("("+z.keys(A.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(t){z[t]=function(e){return null==e?"":(""+e).replace(F[t],function(e){return A[t][e]})}}),z.result=function(t,e){if(null==t)return null;var n=t[e];return z.isFunction(n)?n.call(t):n},z.mixin=function(t){j(z.functions(t),function(e){var n=z[e]=t[e];z.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),H.call(this,n.apply(z,t))}})};var T=0;z.uniqueId=function(t){var e=++T+"";return t?t+e:e},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,S={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(t,e,n){var i;n=z.defaults({},n,z.templateSettings);var r=RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";t.replace(r,function(e,n,i,r,a){return o+=t.slice(s,a).replace(R,function(t){return"\\"+S[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),i&&(o+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=Function(n.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return i(e,z);var u=function(t){return i.call(this,t,z)};return u.source="function("+(n.variable||"obj")+"){\n"+o+"}",u},z.chain=function(t){return z(t).chain()};var H=function(t){return this._chain?z(t).chain():t};z.mixin(z),j(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=i[t];z.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],H.call(this,n)}}),j(["concat","join","slice"],function(t){var e=i[t];z.prototype[t]=function(){return H.call(this,e.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("underscore",[],function(){}),i("ventus/wm/modes/expose",["underscore","ventus/core/promise"],function(t,e){"use strict";var n={register:function(){var e=this;console.log("Expose mode registered."),this.el.on("contextmenu",t.throttle(function(){return"expose"!==e.mode?e.windows.length>0&&(e.mode="expose"):"expose"===e.mode&&(e.mode="default"),!1},1e3))},plug:function(){var t,e,n,i,r=Math.floor,s=Math.ceil,o=this,a=s(this.windows.length/2),u=r(this.el.width()/a),c=r(this.el.height()/2);this.el.addClass("expose");for(var l,h=0,f=this.windows.length;f>h;h++){l=this.windows[h],l.stamp(),t=l.height>l.width?l.height>c?c/l.height:1:l.width>u?u/l.width:1,t-=.15,i={x:h%a*u,y:(a>h?0:1)*c},e=i.x+r((u-t*l.width)/2),n=i.y+r((c-t*l.height)/2),l.enabled=!1,l.movable=!1,l.el.addClass("exposing"),l.el.css("transform-origin","0 0"),l.el.css("transform","scale("+t+")"),l.el.css("top",n),l.el.css("left",e);var p=function(){l.el.removeClass("exposing")};l.animations?l.el.onTransitionEnd(p,this):p.call(this)}this.overlay=!0,this.el.one("click",function(){o.mode="default"})},unplug:function(){var t=new e;t.getFuture().then(function(){this.el.removeClass("expose")}.bind(this)),0===this.windows.length&&t.done();for(var n,i=this.windows.length;i--;){n=this.windows[i],n.restore(),n.el.css("transform","scale(1)"),n.el.css("transform-origin","50% 50%");var r=function(e,n){return function(){0===n&&t.done(),e.el.css("transform","")}}(n,i);n.animations?this.el.onTransitionEnd(r,this):r.call(this),n.movable=!0,n.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return n}),i("ventus/wm/modes/fullscreen",[],function(){"use strict";var t={register:function(){console.log("Fullscreen mode registered.")},plug:function(){this.el.addClass("fullscreen");for(var t,e=0,n=this.windows.length;n>e;e++)t=this.windows[e],t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},unplug:function(){for(var t,e=this.windows.length;e--;){t=this.windows[e],t.restore(),t.el.css("transform","scale(1)"),t.el.css("transform-origin","50% 50%");var n=function(t){return function(){this.el.removeClass("fullscreen"),t.el.css("transform","")}}(t);this.el.onTransitionEnd(n,this),t.movable=!0,t.resizable=!0,t.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return t}),i("ventus/wm/windowmanager",["$","ventus/wm/window","ventus/core/view","ventus/wm/modes/default","ventus/wm/modes/expose","ventus/wm/modes/fullscreen"],function(t,e,n,i,r,s){"use strict";var o=function(){var e;this.el=n('
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(t){this[t]=function(t){return function(){this.currentMode.actions[t]&&this.currentMode.actions[t].apply(this,arguments)}}.call(this,t)},this);for(var i in this.modes)this.modes.hasOwnProperty(i)&&this.modes[i].register&&this.modes[i].register.apply(this);this.windows=[],this.active=null,this.mode="default",e=this.createWindow,this.createWindow=e.bind(this),this.createWindow.fromQuery=e.fromQuery.bind(this),this.createWindow.fromElement=e.fromElement.bind(this)};return o.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:r,fullscreen:s},set mode(t){var e=this.modes[t];e&&this._mode!==t&&(this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),e.plug&&e.plug.apply(this),this._mode=t)},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(t){this.$overlay.css("opacity",t?.8:0),this._overlay=t},get overlay(){return this._overlay},createWindow:function(t){var n=new e(t);return this.mode="default",n.signals.on("focus",this._focus,this),n.signals.on("blur",this._blur,this),n.signals.on("close",this._close,this),this.actions.forEach(function(t){n.signals.on(t,this[t],this)},this),this.windows.push(n),n.space=this.el,n.focus(),n},_focus:function(t){var e,n,i=1e4,r=i+1e4;if(!this.active||this.active!==t){if(this.active?(e=this.active.z,this.active.blur()):e=i,n=this.windows.indexOf(t),this.windows.splice(n,1),this.windows.push(t),t.z=e+1,e>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=i+(s-r);this.active=t}},_blur:function(t){this.active===t&&(this.active=null)},_close:function(t){var e,n=this.windows.indexOf(t);return-1===n?void console.log("Trying to close a window that doesn't exist in this window manager"):(this.windows.splice(n,1),e=this.windows.length,void(this.active&&this.active===t&&(this.active=0!==e?this.windows[e-1]:null,this.active&&this.active.focus())))}},o.prototype.createWindow.fromQuery=function(t,e){return e.content=n(t),this.createWindow(e)},o.prototype.createWindow.fromElement=function(t,e){return e.content=n(t),this.createWindow(e)},o}),i("ventus",["require","exports","module","ventus/wm/windowmanager","ventus/wm/window"],function(t){"use strict";return{version:"0.2",browser:{animationEventName:function(){var t=document.body.style,e=null;return""===t.animation?e="animationend":""===t.MozAnimation?e="mozAnimationEnd":""===t.webkitAnimation&&(e="webkitAnimationEnd"),e}},WindowManager:t("ventus/wm/windowmanager"),Window:t("ventus/wm/window")}}),i("src/main",["almond","handlebars","ventus"],function(){}),i("$",function(){return t}),i("underscore",function(){return _}),n("ventus")}); \ No newline at end of file diff --git a/src/ventus/less/window.less b/src/ventus/less/window.less index 7fbd0f6..8be6bd1 100644 --- a/src/ventus/less/window.less +++ b/src/ventus/less/window.less @@ -189,6 +189,28 @@ width: 10px; } } + + &.mouse-edge { + &.mouse-edge-top, + &.mouse-edge-bottom { + cursor: ns-resize; + } + + &.mouse-edge-left, + &.mouse-edge-right { + cursor: ew-resize; + } + + &.mouse-edge-top-left, + &.mouse-edge-bottom-right { + cursor: nwse-resize; + } + + &.mouse-edge-top-right, + &.mouse-edge-bottom-left { + cursor: nesw-resize; + } + } } .wm-window.disabled { diff --git a/src/ventus/wm/window.js b/src/ventus/wm/window.js index 0967d51..7a8ff70 100644 --- a/src/ventus/wm/window.js +++ b/src/ventus/wm/window.js @@ -111,6 +111,7 @@ function(Emitter, Promise, View, WindowTemplate) { _restore: null, _moving: null, _resizing: null, + _resizeDirection: null, slots: { move: function(e) { @@ -144,6 +145,10 @@ function(Emitter, Promise, View, WindowTemplate) { if(this.widget) { this.slots.move.call(this, e); } + + if(this.enabled && this.resizable && this._resizeDirectionState().any) { + this.startResize(e); + } }, '.wm-content click': function(e) { @@ -153,7 +158,7 @@ function(Emitter, Promise, View, WindowTemplate) { }, '.wm-window-title mousedown': function(e) { - if(!this.maximized) { + if(!this.maximized && !this._resizeDirectionState().any) { this.slots.move.call(this, e); } }, @@ -199,21 +204,81 @@ function(Emitter, Promise, View, WindowTemplate) { }, 'button.wm-resize mousedown': function(e) { - var event = convertMoveEvent(e); + if(this.enabled && this.resizable) { + this._resizeDirection = { + top: false, + left: false, + bottom: true, + right: true + }; + + this.startResize(e); + } + }, - if(!this.enabled || !this.resizable) { + 'mousemove': function(e) { + var EdgeSensitivities = { + TOP: 5, // lower because bar is used to drag + LEFT: 10, + BOTTOM: 15, + RIGHT: 15 + }; + var TITLE_HEIGHT = 36; + + if(!this.enabled || !this.resizable || this._resizing) { return; } - this._resizing = { - width: this.width - event.pageX, - height: this.height - event.pageY + var event = convertMoveEvent(e); + + // top can be triggered from wm-content, but should only be triggered by wm-window + // otherwise you get resize event from top of content + this._resizeDirection = { + top: !e.srcElement.classList.contains('wm-content') && + event.offsetY < EdgeSensitivities.TOP, + left: event.offsetX < EdgeSensitivities.LEFT, + bottom: this.height - TITLE_HEIGHT - event.offsetY < EdgeSensitivities.BOTTOM, + right: this.width - event.offsetX < EdgeSensitivities.RIGHT }; - this._space[0].classList.add('no-events'); - this.el.addClass('resizing'); + this.el[0].classList.remove('mouse-edge', + 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', + 'mouse-edge-left', 'mouse-edge-right', + 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right' + ); + + if(this._resizeDirectionState().any) { + var className = 'mouse-edge'; + window.counter = window.counter || 0; + if(this._resizeDirection.top) { + window.counter++; + console.log('top', window.counter); + className += '-top'; + } + else if(this._resizeDirection.bottom) { + className += '-bottom'; + } - e.preventDefault(); + if(this._resizeDirection.left) { + className += '-left'; + } + else if(this._resizeDirection.right) { + className += '-right'; + } + + this.el[0].classList.add('mouse-edge', className); + } + }, + + 'mouseleave': function() { + if(!this._resizing) { + this._resizeDirection = null; + this.el[0].classList.remove('mouse-edge', + 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', + 'mouse-edge-left', 'mouse-edge-right', + 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right' + ); + } } }, @@ -261,10 +326,37 @@ function(Emitter, Promise, View, WindowTemplate) { } if(this._resizing) { - this.resize( - event.pageX + this._resizing.width, - event.pageY + this._resizing.height - ); + var newWidth; + if(!this._resizeDirectionState().horizontal) { + newWidth = this.width; + } + else if(this._resizeDirection.left) { + newWidth = this._resizing.pageX - event.pageX + this._resizing.width; + } + else { + newWidth = event.pageX - this._resizing.pageX + this._resizing.width; + } + + var newHeight; + if(!this._resizeDirectionState().vertical) { + newHeight = this.height; + } + else if(this._resizeDirection.top) { + newHeight = this._resizing.pageY - event.pageY + this._resizing.height; + } + else { + newHeight = event.pageY - this._resizing.pageY + this._resizing.height; + } + + this.resize(newWidth, newHeight); + + if(this._resizeDirection.left) { + this.move(event.pageX, this.y); + } + + if(this._resizeDirection.top) { + this.move(this.x, event.pageY); + } } }, @@ -288,6 +380,18 @@ function(Emitter, Promise, View, WindowTemplate) { this._resizing = null; }, + _resizeDirectionState: function() { + return { + any: this._resizeDirection && + (this._resizeDirection.top || this._resizeDirection.left || + this._resizeDirection.bottom || this._resizeDirection.right), + horizontal: this._resizeDirection && + (this._resizeDirection.left || this._resizeDirection.right), + vertical: this._resizeDirection && + (this._resizeDirection.top || this._resizeDirection.bottom) + }; + }, + set space(el) { if(el && !el.listen) { console.error('The given space element is not a valid View'); @@ -485,6 +589,21 @@ function(Emitter, Promise, View, WindowTemplate) { return parseInt(this.el.css('z-index'), 10); }, + startResize: function(e) { + var event = convertMoveEvent(e); + this._resizing = { + pageX: event.pageX, + pageY: event.pageY, + width: this.width, + height: this.height + }; + + this._space[0].classList.add('no-events'); + this.el.addClass('resizing'); + + e.preventDefault(); + }, + open: function() { var promise = new Promise(); this.signals.emit('open', this); From 40204fde9f3968fc8edbc016bdf49612d68c014e Mon Sep 17 00:00:00 2001 From: Andrey Butenko Date: Sun, 24 Jun 2018 17:43:35 -0700 Subject: [PATCH 2/2] Add more descriptive names for resize feature --- dist/ventus.js | 53 +++++++++++++++++----------------- dist/ventus.min.js | 4 +-- src/ventus/wm/window.js | 64 +++++++++++++++++++++-------------------- 3 files changed, 61 insertions(+), 60 deletions(-) diff --git a/dist/ventus.js b/dist/ventus.js index 13ca160..fdfefec 100644 --- a/dist/ventus.js +++ b/dist/ventus.js @@ -1199,7 +1199,7 @@ define('ventus/wm/window', [ _restore: null, _moving: null, _resizing: null, - _resizeDirection: null, + _mouseEdgePosition: null, slots: { move: function (e) { var event = convertMoveEvent(e); @@ -1225,7 +1225,7 @@ define('ventus/wm/window', [ if (this.widget) { this.slots.move.call(this, e); } - if (this.enabled && this.resizable && this._resizeDirectionState().any) { + if (this.enabled && this.resizable && !this.maximized && this.mouseOnWindowEdge) { this.startResize(e); } }, @@ -1235,7 +1235,7 @@ define('ventus/wm/window', [ } }, '.wm-window-title mousedown': function (e) { - if (!this.maximized && !this._resizeDirectionState().any) { + if (!this.maximized && !this.mouseOnWindowEdge) { this.slots.move.call(this, e); } }, @@ -1272,7 +1272,7 @@ define('ventus/wm/window', [ }, 'button.wm-resize mousedown': function (e) { if (this.enabled && this.resizable) { - this._resizeDirection = { + this._mouseEdgePosition = { top: false, left: false, bottom: true, @@ -1284,7 +1284,7 @@ define('ventus/wm/window', [ 'mousemove': function (e) { var EdgeSensitivities = { TOP: 5, - LEFT: 10, + LEFT: 15, BOTTOM: 15, RIGHT: 15 }; @@ -1293,26 +1293,23 @@ define('ventus/wm/window', [ return; } var event = convertMoveEvent(e); - this._resizeDirection = { + this._mouseEdgePosition = { top: !e.srcElement.classList.contains('wm-content') && event.offsetY < EdgeSensitivities.TOP, left: event.offsetX < EdgeSensitivities.LEFT, bottom: this.height - TITLE_HEIGHT - event.offsetY < EdgeSensitivities.BOTTOM, right: this.width - event.offsetX < EdgeSensitivities.RIGHT }; this.el[0].classList.remove('mouse-edge', 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', 'mouse-edge-left', 'mouse-edge-right', 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right'); - if (this._resizeDirectionState().any) { + if (this.mouseOnWindowEdge) { var className = 'mouse-edge'; - window.counter = window.counter || 0; - if (this._resizeDirection.top) { - window.counter++; - console.log('top', window.counter); + if (this._mouseEdgePosition.top) { className += '-top'; - } else if (this._resizeDirection.bottom) { + } else if (this._mouseEdgePosition.bottom) { className += '-bottom'; } - if (this._resizeDirection.left) { + if (this._mouseEdgePosition.left) { className += '-left'; - } else if (this._resizeDirection.right) { + } else if (this._mouseEdgePosition.right) { className += '-right'; } this.el[0].classList.add('mouse-edge', className); @@ -1320,7 +1317,7 @@ define('ventus/wm/window', [ }, 'mouseleave': function () { if (!this._resizing) { - this._resizeDirection = null; + this._mouseEdgePosition = null; this.el[0].classList.remove('mouse-edge', 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', 'mouse-edge-left', 'mouse-edge-right', 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right'); } } @@ -1354,26 +1351,26 @@ define('ventus/wm/window', [ } if (this._resizing) { var newWidth; - if (!this._resizeDirectionState().horizontal) { + if (!this.resizingHorizontally) { newWidth = this.width; - } else if (this._resizeDirection.left) { + } else if (this._mouseEdgePosition.left) { newWidth = this._resizing.pageX - event.pageX + this._resizing.width; } else { newWidth = event.pageX - this._resizing.pageX + this._resizing.width; } var newHeight; - if (!this._resizeDirectionState().vertical) { + if (!this.resizingVertically) { newHeight = this.height; - } else if (this._resizeDirection.top) { + } else if (this._mouseEdgePosition.top) { newHeight = this._resizing.pageY - event.pageY + this._resizing.height; } else { newHeight = event.pageY - this._resizing.pageY + this._resizing.height; } this.resize(newWidth, newHeight); - if (this._resizeDirection.left) { + if (this._mouseEdgePosition.left) { this.move(event.pageX, this.y); } - if (this._resizeDirection.top) { + if (this._mouseEdgePosition.top) { this.move(this.x, event.pageY); } } @@ -1395,12 +1392,14 @@ define('ventus/wm/window', [ this._restore = null; this._resizing = null; }, - _resizeDirectionState: function () { - return { - any: this._resizeDirection && (this._resizeDirection.top || this._resizeDirection.left || this._resizeDirection.bottom || this._resizeDirection.right), - horizontal: this._resizeDirection && (this._resizeDirection.left || this._resizeDirection.right), - vertical: this._resizeDirection && (this._resizeDirection.top || this._resizeDirection.bottom) - }; + get mouseOnWindowEdge() { + return this._mouseEdgePosition && (this._mouseEdgePosition.top || this._mouseEdgePosition.left || this._mouseEdgePosition.bottom || this._mouseEdgePosition.right); + }, + get resizingHorizontally() { + return this._mouseEdgePosition && (this._mouseEdgePosition.left || this._mouseEdgePosition.right); + }, + get resizingVertically() { + return this._mouseEdgePosition && (this._mouseEdgePosition.top || this._mouseEdgePosition.bottom); }, set space(el) { if (el && !el.listen) { diff --git a/dist/ventus.min.js b/dist/ventus.min.js index e6c31bb..26b04bb 100644 --- a/dist/ventus.min.js +++ b/dist/ventus.min.js @@ -3,5 +3,5 @@ * Copyright © 2015 Ramón Lamana * http://www.rlamana.com */ -!function(t,e){"function"==typeof define&&define.amd?define(["$"],e):t.Ventus=e(t.$)}(this,function(t){var e,n,i;return function(t){function r(t,e){var n,i,r,s,o,a,u,c,l,h,f=e&&e.split("/"),p=m.map,d=p&&p["*"]||{};if(t&&"."===t.charAt(0)&&e){for(f=f.slice(0,f.length-1),t=f.concat(t.split("/")),c=0;h=t[c];c++)if("."===h)t.splice(c,1),c-=1;else if(".."===h){if(1===c&&(".."===t[2]||".."===t[0]))return!0;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||d)&&p){for(n=t.split("/"),c=n.length;c>0;c-=1){if(i=n.slice(0,c).join("/"),f)for(l=f.length;l>0;l-=1)if(r=p[f.slice(0,l).join("/")],r&&(r=r[i])){s=r,o=c;break}if(s)break;!a&&d&&d[i]&&(a=d[i],u=c)}!s&&a&&(s=a,o=u),s&&(n.splice(0,o,s),t=n.join("/"))}return t}function s(e,n){return function(){return f.apply(t,g.call(arguments,0).concat([e,n]))}}function o(t){return function(e){return r(e,t)}}function a(t){return function(e){p[t]=e}}function u(e){if(d.hasOwnProperty(e)){var n=d[e];delete d[e],v[e]=!0,h.apply(t,n)}if(!p.hasOwnProperty(e))throw new Error("No "+e);return p[e]}function c(t,e){var n,i,s=t.indexOf("!");return-1!==s?(n=r(t.slice(0,s),e),t=t.slice(s+1),i=u(n),t=i&&i.normalize?i.normalize(t,o(e)):r(t,e)):t=r(t,e),{f:n?n+"!"+t:t,n:t,p:i}}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var h,f,p={},d={},m={},v={},g=[].slice;h=function(e,n,i,r){var o,h,f,m,g,w,b=[];if(r=r||e,"function"==typeof i){for(n=!n.length&&i.length?["require","exports","module"]:n,w=0;w":">",'"':""","'":"'","`":"`"},c=/[&<>"'`]/g,l=/[&<>"'`]/;o.extend=n;var h=Object.prototype.toString;o.toString=h;var f=function(t){return"function"==typeof t};f(/x/)&&(f=function(t){return"function"==typeof t&&"[object Function]"===h.call(t)});var f;o.isFunction=f;var p=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===h.call(t):!1};return o.isArray=p,o.escapeExpression=i,o.isEmpty=r,o.appendContextPath=s,o}(t),n=function(){"use strict";function t(t,e){var i;e&&e.firstLine&&(i=e.firstLine,t+=" - "+i+":"+e.firstColumn);for(var r=Error.prototype.constructor.call(this,t),s=0;s0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var o=v(n.data);o.contextPath=s.appendContextPath(n.data.contextPath,n.name),n={data:o}}return r(e,n)}),t.registerHelper("each",function(t,e){if(!e)throw new o("Must pass iterator to #each");var n,i,r=e.fn,a=e.inverse,u=0,c="";if(e.data&&e.ids&&(i=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),h(t)&&(t=t.call(this)),e.data&&(n=v(e.data)),t&&"object"==typeof t)if(l(t))for(var f=t.length;f>u;u++)n&&(n.index=u,n.first=0===u,n.last=u===t.length-1,i&&(n.contextPath=i+u)),c+=r(t[u],{data:n});else for(var p in t)t.hasOwnProperty(p)&&(n&&(n.key=p,n.index=u,n.first=0===u,i&&(n.contextPath=i+p)),c+=r(t[p],{data:n}),u++);return 0===u&&(c=a(this)),c}),t.registerHelper("if",function(t,e){return h(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||s.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){return t.helpers["if"].call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),t.registerHelper("with",function(t,e){h(t)&&(t=t.call(this));var n=e.fn;if(s.isEmpty(t))return e.inverse(this);if(e.data&&e.ids){var i=v(e.data);i.contextPath=s.appendContextPath(e.data.contextPath,e.ids[0]),e={data:i}}return n(t,e)}),t.registerHelper("log",function(e,n){var i=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;t.log(i,e)}),t.registerHelper("lookup",function(t,e){return t&&t[e]})}var r={},s=t,o=e,a="2.0.0";r.VERSION=a;var u=6;r.COMPILER_REVISION=u;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};r.REVISION_CHANGES=c;var l=s.isArray,h=s.isFunction,f=s.toString,p="[object Object]";r.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:d,log:m,registerHelper:function(t,e){if(f.call(t)===p){if(e)throw new o("Arg not supported with multiple helpers");s.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){f.call(t)===p?s.extend(this.partials,t):this.partials[t]=e},unregisterPartial:function(t){delete this.partials[t]}};var d={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,e){if(d.level<=t){var n=d.methodMap[t];"undefined"!=typeof console&&console[n]&&console[n].call(console,e)}}};r.logger=d;var m=d.log;r.log=m;var v=function(t){var e=s.extend({},t);return e._parent=t,e};return r.createFrame=v,r}(e,n),r=function(t,e,n){"use strict";function i(t){var e=t&&t[0]||1,n=f;if(e!==n){if(n>e){var i=p[n],r=p[e];throw new h("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+r+").")}throw new h("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function r(t,e){if(!e)throw new h("No environment passed to template");if(!t||!t.main)throw new h("Unknown template object: "+typeof t);e.VM.checkRevision(t.compiler);var n=function(n,i,r,s,o,a,u,c,f){o&&(s=l.extend({},s,o));var p=e.VM.invokePartial.call(this,n,r,s,a,u,c,f);if(null==p&&e.compile){var d={helpers:a,partials:u,data:c,depths:f};u[r]=e.compile(n,{data:void 0!==c,compat:t.compat},e),p=u[r](s,d)}if(null!=p){if(i){for(var m=p.split("\n"),v=0,g=m.length;g>v&&(m[v]||v+1!==g);v++)m[v]=i+m[v];p=m.join("\n")}return p}throw new h("The partial "+r+" could not be compiled when running in runtime-only mode")},i={lookup:function(t,e){for(var n=t.length,i=0;n>i;i++)if(t[i]&&null!=t[i][e])return t[i][e]},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:l.escapeExpression,invokePartial:n,fn:function(e){return t[e]},programs:[],program:function(t,e,n){var i=this.programs[t],r=this.fn(t);return e||n?i=s(this,t,r,e,n):i||(i=this.programs[t]=s(this,t,r)),i},data:function(t,e){for(;t&&e--;)t=t._parent;return t},merge:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=l.extend({},e,t)),n},noop:e.VM.noop,compilerInfo:t.compiler},r=function(e,n){n=n||{};var s=n.data;r._setup(n),!n.partial&&t.useData&&(s=u(e,s));var o;return t.useDepths&&(o=n.depths?[e].concat(n.depths):[e]),t.main.call(i,e,i.helpers,i.partials,s,o)};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials):(i.helpers=i.merge(n.helpers,e.helpers),t.usePartial&&(i.partials=i.merge(n.partials,e.partials)))},r._child=function(e,n,r){if(t.useDepths&&!r)throw new h("must pass parent depths");return s(i,e,t[e],n,r)},r}function s(t,e,n,i,r){var s=function(e,s){return s=s||{},n.call(t,e,t.helpers,t.partials,s.data||i,r&&[e].concat(r))};return s.program=e,s.depth=r?r.length:0,s}function o(t,e,n,i,r,s,o){var a={partial:!0,helpers:i,partials:r,data:s,depths:o};if(void 0===t)throw new h("The partial "+e+" could not be found");return t instanceof Function?t(n,a):void 0}function a(){return""}function u(t,e){return e&&"root"in e||(e=e?d(e):{},e.root=t),e}var c={},l=t,h=e,f=n.COMPILER_REVISION,p=n.REVISION_CHANGES,d=n.createFrame;return c.checkRevision=i,c.template=r,c.program=s,c.invokePartial=o,c.noop=a,c}(e,n,i),s=function(t,e,n,i,r){"use strict";var s,o=t,a=e,u=n,c=i,l=r,h=function(){var t=new o.HandlebarsEnvironment;return c.extend(t,o),t.SafeString=a,t.Exception=u,t.Utils=c,t.escapeExpression=c.escapeExpression,t.VM=l,t.template=function(e){return l.template(e,t)},t},f=h();return f.create=h,f["default"]=f,s=f}(i,t,n,e,r);return s}),i("ventus/core/emitter",[],function(){"use strict";function t(t,e,n){return function(i){return(i.funct===t&&i.scope===e)===n}}function e(e,n,i,r){return e[n]?e[n].some(t(i,r,!0)):!1}function n(){this._listeners={}}return n.prototype={listenersCount:function(t){var e=this._listeners[t];return e?e.length:0},on:function(t,n,i){var r=this._listeners;e(r,t,n,i)||(r[t]||(r[t]=[]),r[t].push({funct:n,scope:i}))},off:function(e,n,i){var r=this._listeners[e];r&&(this._listeners[e]=r.filter(t(n,i,!1)))},once:function(t,n,i){e(this._listeners,t,n,i)||this.on(t,function r(){this.off(t,r,this),n.apply(i,arguments)},this)},emit:function(t){var e=this._listeners[t];if(e){var n=Array.prototype.slice.call(arguments,1);e.forEach(function(t){t.funct.apply(t.scope,n)})}},connect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.on(n,t[n],e)},disconnect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.off(n,t[n],e)}},n}),i("ventus/core/promise",[],function(){"use strict";function t(t,e,n){setTimeout(function(){t.apply(e,n)})}function e(t,e,n){var i="Error on "+t+" promise execution at index ["+n+"]";Error.call(this,i),this.child=e,this.index=n,this.message=i}function n(){this._future=new s}function i(t){return t.hasSucceed()}function r(t,n,i,o,a){return i+=1,i>=t.length?o.done(a):a instanceof s?void a.then(function(){r(t,n,i,o,t[i].apply(n,arguments))},function(t){o.fail(new e(" serial ",t,i))}):r(t,n,i,o,t[i].call(n,a))}function s(){this._args=null,this._fn={success:[],failed:[],"finally":[]}}var o=Array.prototype.slice;return n.prototype={constructor:n,done:function(){var t=o.call(arguments);this.getFuture()._arrived("success",t)},fail:function(){var t=o.call(arguments);this.getFuture()._arrived("failed",t)},getFuture:function(){return this._future}},n.done=function(){var t=new n;return t.done.apply(t,arguments),t.getFuture()},n.failed=function(){var t=new n;return t.fail.apply(t,arguments),t.getFuture()},n.parallel=function(){return n.all(o.call(arguments))},n.all=function(t){if(!t||!t.length)return n.done();t=t.map(function(t){return t.getFuture?t.getFuture():t});var r=new n,s=[];return t.forEach(function(n,a){n.then(function(){s[a]=o.call(arguments),t.every(i)&&r.done.apply(r,s)},function(t){r.fail(new e("parallel",t,a))})}),r.getFuture()},n.serial=function(t,e){if(!t||0===t.length)return n.done();var i=new n;return setTimeout(function(){r(t,e,0,i,t[0].call(e))}),i.getFuture()},s.prototype={constructor:s,_add:function(e,n,i){return n?this._fn[e]===!0?t(n,i,this._args):this._fn[e]&&this._fn[e].push({callback:n,scope:i}):console.warn("No callback passed"),this},_arrived:function(t,e){function n(t){t.callback.apply(t.scope,e)}if(this.isCompleted())throw new Error("Future already arrived!");var i=this._fn[t].concat(this._fn["finally"]);this._fn={success:!1,failed:!1,"finally":!0},this._args=e,this._fn[t]=!0,i.forEach(n)},isCompleted:function(){return this._fn["finally"]===!0},hasFailed:function(){return this._fn.failed===!0},hasSucceed:function(){return this._fn.success===!0},onDone:function(t,e){return this._add("success",t,e)},onError:function(t,e){return this._add("failed",t,e)},onFinally:function(t,e){return this._add("finally",t,e)},then:function(t,e,n){t&&this.onDone(t),e&&this.onError(e),n&&this.onFinally(n)},transform:function(t){var e=new n;return this.then(function(){var n=t.apply(null,arguments);n&&"array"===n.constructor||(n=[n]),e.done.apply(e,n)},function(){e.fail.apply(e,arguments)}),e.getFuture()}},n.PromiseError=e,n.Future=s,n}),i("ventus/core/view",["$"],function(t){"use strict";for(var e=/^(?:(.*)\s)?(\w+)$/,n="transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",i="animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",r=["transform","transition","animation","transform-origin"],s=r.length;s--;)!function(e){t.cssHooks[e]={get:function(){return null},set:function(t,n){t.style["-webkit-"+e]=n,t.style["-moz-"+e]=n,t.style["-ms-"+e]=n,t.style["-o-"+e]=n,t.style[e]=n}}}(r[s]);return t.fn.extend({listen:function(t,n){var i,r,s,o;for(var a in t)if(t.hasOwnProperty(a)){if(i=t[a],r=a.match(e),s=r[1],o=r[2],"mousedown"===o?o+=" touchstart":"mousemove"===o?o+=" touchmove":"mouseup"===o?o+=" touchend":"click"===o&&(o+=" touchend"),"string"==typeof i&&(i=n[i]),!i)throw new Error("Handler not found");s?this.on(o,s,i.bind(n)):this.on(o,i.bind(n))}return this},onTransitionEnd:function(t,e){this.one(n,function(){t.apply(e||this)})},onAnimationEnd:function(t,e){this.one(i,function(){t.apply(e||this)})}}),function(e){return"function"==typeof e?function(n){return t(e(n||{}))}:t(e)}}),i("ventus/tpl/window",["handlebars"],function(t){return t.template({compiler:[6,">= 2.0.0-beta.1"],main:function(t,e,n,i){var r,s="function",o=e.helperMissing,a=this.escapeExpression;return'
\n
\n
\n

'+a((r=null!=(r=e.title||(null!=t?t.title:t))?r:o,typeof r===s?r.call(t,{name:"title",hash:{},data:i}):r))+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n
\n'},useData:!0})}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/promise","ventus/core/view","ventus/tpl/window"],function(t,e,n,i){"use strict";function r(t){return!!window.TouchEvent&&t.originalEvent instanceof window.TouchEvent}function s(t){return r(t)?t.originalEvent.changedTouches[0]:t.originalEvent}var o=function(e){if(this.signals=new t,e=e||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0,animations:!0,classname:"",stayinspace:!1},e.animations&&e.classname+" animated",this.el=n(i({title:e.title,classname:e.classname})),this.el.listen(this.events.window,this),e.opacity&&this.el.css("opacity",e.opacity),e.events)for(var r in e.events)e.events.hasOwnProperty(r)&&"function"==typeof e.events[r]&&this.signals.on(r,e.events[r],this);this.$content=this.el.find(".wm-content"),e.content&&this.$content.append(e.content),this.$titlebar=this.el.find("header"),this.width=e.width||400,this.height=e.height||200,this.x=e.x||0,this.y=e.y||0,this.z=1e4,this.enabled=!0,this.active=!1,this.maximized=!1,this.minimized=!1,this._closed=!0,this._destroyed=!1,this.widget=!1,this.movable="undefined"!=typeof e.movable?e.movable:!0,this.resizable="undefined"!=typeof e.resizable?e.resizable:!0,this.animations="undefined"!=typeof e.animations?e.animations:!0,this.titlebar=!0,this.stayinspace="undefined"!=typeof e.stayinspace?e.stayinspace:!1};return o.prototype={_restore:null,_moving:null,_resizing:null,_resizeDirection:null,slots:{move:function(t){var e=s(t);this.enabled&&this.movable&&(this._moving=this.toLocal({x:e.pageX,y:e.pageY}),this.el.addClass("move"),this._space[0].classList.add("no-events"),t.preventDefault())}},events:{window:{click:function(t){this.signals.emit("select",this,t)},mousedown:function(t){this.focus(),this.widget&&this.slots.move.call(this,t),this.enabled&&this.resizable&&this._resizeDirectionState().any&&this.startResize(t)},".wm-content click":function(t){this.enabled&&this.signals.emit("click",this,t)},".wm-window-title mousedown":function(t){this.maximized||this._resizeDirectionState().any||this.slots.move.call(this,t)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(t){this.focus(),t.stopPropagation(),t.preventDefault()},"button.wm-resize mousedown":function(t){this.enabled&&this.resizable&&(this._resizeDirection={top:!1,left:!1,bottom:!0,right:!0},this.startResize(t))},mousemove:function(t){var e={TOP:5,LEFT:10,BOTTOM:15,RIGHT:15},n=36;if(this.enabled&&this.resizable&&!this._resizing){var i=s(t);if(this._resizeDirection={top:!t.srcElement.classList.contains("wm-content")&&i.offsetYthis.space[0].clientWidth||this.el[0].clientHeight>this.space[0].clientHeight)&&this.resize(Math.min(this.el[0].clientWidth,this.space[0].clientWidth),Math.min(this.el[0].clientHeight,this.space[0].clientHeight));var n=Math.max(0,e.pageX-this._moving.x),i=0,o=Math.max(0,e.pageY-this._moving.y),a=0;n+this.el[0].clientWidth>this.space[0].clientWidth&&(i=n+this.el[0].clientWidth-this.space[0].clientWidth),o+this.el[0].clientHeight>this.space[0].clientHeight&&(a=o+this.el[0].clientHeight-this.space[0].clientHeight),this.move(n-i,o-a)}else this.move(e.pageX-this._moving.x,e.pageY-this._moving.y);if(this._resizing){var u;u=this._resizeDirectionState().horizontal?this._resizeDirection.left?this._resizing.pageX-e.pageX+this._resizing.width:e.pageX-this._resizing.pageX+this._resizing.width:this.width;var c;c=this._resizeDirectionState().vertical?this._resizeDirection.top?this._resizing.pageY-e.pageY+this._resizing.height:e.pageY-this._resizing.pageY+this._resizing.height:this.height,this.resize(u,c),this._resizeDirection.left&&this.move(e.pageX,this.y),this._resizeDirection.top&&this.move(this.x,e.pageY)}},mouseup:function(){this._moving&&this._stopMove(),this._resizing&&this._stopResize()}}},_stopMove:function(){this.el.removeClass("move"),this._space[0].classList.remove("no-events"),this._moving=null},_stopResize:function(){this._space[0].classList.remove("no-events"),this.el.removeClass("resizing"),this._restore=null,this._resizing=null},_resizeDirectionState:function(){return{any:this._resizeDirection&&(this._resizeDirection.top||this._resizeDirection.left||this._resizeDirection.bottom||this._resizeDirection.right),horizontal:this._resizeDirection&&(this._resizeDirection.left||this._resizeDirection.right),vertical:this._resizeDirection&&(this._resizeDirection.top||this._resizeDirection.bottom)}},set space(t){return t&&!t.listen?void console.error("The given space element is not a valid View"):(this._space=t,t.append(this.el),void t.listen(this.events.space,this))},get space(){return this._space},get maximized(){return this._maximized},set maximized(t){t?(this._restoreMaximized=this.stamp(),this.el.addClass("maximized"),this.signals.emit("maximize",this,this._restoreMaximized)):(this.el.removeClass("maximized"),this.signals.emit("restore",this,this._restoreMaximized)),this._maximized=t},get minimized(){return this._minimized},set minimized(t){t?(this._restoreMinimized=this.stamp(),this.signals.emit("minimize",this,this._restoreMinimized)):this.signals.emit("restore",this,this._restoreMinimized),this._minimized=t},set active(t){t?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=t},get active(){return this._active},set enabled(t){t?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=t},get enabled(){return this._enabled},set movable(t){this._movable=!!t},get movable(){return this._movable},set resizable(t){t?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!t},get resizable(){return this._resizable},set closed(t){},get closed(){return this._closed},set destroyed(t){},get destroyed(){return this._destroyed},set widget(t){this._widget=t},get widget(){return this._widget},set titlebar(t){t?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=t},get titlebar(){return this._titlebar},set animations(t){t?this.el.addClass("animated"):this.el.removeClass("animated"),this._animations=t},get animations(){return this._animations},set width(t){this.el.width(t)},get width(){return parseInt(this.el.width(),10)},set height(t){this.el.height(t)},get height(){return parseInt(this.el.height(),10)},set x(t){this.el.css("left",t)},set y(t){this.el.css("top",t)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(t){this.el.css("z-index",t)},get z(){return parseInt(this.el.css("z-index"),10)},startResize:function(t){var e=s(t);this._resizing={pageX:e.pageX,pageY:e.pageY,width:this.width,height:this.height},this._space[0].classList.add("no-events"),this.el.addClass("resizing"),t.preventDefault()},open:function(){var t=new e;return this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening"),t.done()},this),this._closed=!1,t},close:function(){var t=new e;return this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.signals.emit("closed",this),t.done()},this),this._closed=!0,t},destroy:function(){var t=function(){this.$content.html(""),this.signals.emit("destroyed",this),this._destroyed=!0}.bind(this);this.signals.emit("destroy",this),this.closed?t():this.close().getFuture().then(function(){t()})},resize:function(t,e){return this.width=t,this.height=e,this},move:function(t,e){return this.x=t,this.y=e,this},stamp:function(){return this.restore=function(){var t={width:this.width,height:this.height},e={x:this.x,y:this.y};return function(){return this.resize(t.width,t.height),this.move(e.x,e.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){this.el.addClass("maximazing");var t=function(){this.el.removeClass("maximazing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.maximized=!this.maximized,this},minimize:function(){this.el.addClass("minimizing");var t=function(){this.el.removeClass("minimizing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.minimized=!this.minimized,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(t){return{x:t.x-this.x,y:t.y-this.y}},toGlobal:function(t){return{x:t.x+this.x,y:t.y+this.y}},append:function(t){t.appendTo(this.$content)}},o}),i("ventus/wm/modes/default",[],function(){"use strict";var t={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(t){t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},restore:function(t,e){e.call(t)},minimize:function(t){t.resize(0,0)}}};return t}),function(){var t=this,e=t._,n={},i=Array.prototype,r=Object.prototype,s=Function.prototype,o=i.push,a=i.slice,u=i.concat,c=r.toString,l=r.hasOwnProperty,h=i.forEach,f=i.map,p=i.reduce,d=i.reduceRight,m=i.filter,v=i.every,g=i.some,w=i.indexOf,b=i.lastIndexOf,y=Array.isArray,_=Object.keys,x=s.bind,z=function(t){return t instanceof z?t:this instanceof z?void(this._wrapped=t):new z(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=z),exports._=z):t._=z,z.VERSION="1.4.4";var j=z.each=z.forEach=function(t,e,i){if(null!=t)if(h&&t.forEach===h)t.forEach(e,i);else if(t.length===+t.length){for(var r=0,s=t.length;s>r;r++)if(e.call(i,t[r],r,t)===n)return}else for(var o in t)if(z.has(t,o)&&e.call(i,t[o],o,t)===n)return};z.map=z.collect=function(t,e,n){var i=[];return null==t?i:f&&t.map===f?t.map(e,n):(j(t,function(t,r,s){i[i.length]=e.call(n,t,r,s)}),i)};var O="Reduce of empty array with no initial value";z.reduce=z.foldl=z.inject=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),p&&t.reduce===p)return i&&(e=z.bind(e,i)),r?t.reduce(e,n):t.reduce(e);if(j(t,function(t,s,o){r?n=e.call(i,n,t,s,o):(n=t,r=!0)}),!r)throw new TypeError(O);return n},z.reduceRight=z.foldr=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),d&&t.reduceRight===d)return i&&(e=z.bind(e,i)),r?t.reduceRight(e,n):t.reduceRight(e);var s=t.length;if(s!==+s){var o=z.keys(t);s=o.length}if(j(t,function(a,u,c){u=o?o[--s]:--s,r?n=e.call(i,n,t[u],u,c):(n=t[u],r=!0)}),!r)throw new TypeError(O);return n},z.find=z.detect=function(t,e,n){var i;return E(t,function(t,r,s){return e.call(n,t,r,s)?(i=t,!0):void 0}),i},z.filter=z.select=function(t,e,n){var i=[];return null==t?i:m&&t.filter===m?t.filter(e,n):(j(t,function(t,r,s){e.call(n,t,r,s)&&(i[i.length]=t)}),i)},z.reject=function(t,e,n){return z.filter(t,function(t,i,r){return!e.call(n,t,i,r)},n)},z.every=z.all=function(t,e,i){e||(e=z.identity);var r=!0;return null==t?r:v&&t.every===v?t.every(e,i):(j(t,function(t,s,o){return(r=r&&e.call(i,t,s,o))?void 0:n}),!!r)};var E=z.some=z.any=function(t,e,i){e||(e=z.identity);var r=!1;return null==t?r:g&&t.some===g?t.some(e,i):(j(t,function(t,s,o){return r||(r=e.call(i,t,s,o))?n:void 0}),!!r)};z.contains=z.include=function(t,e){return null==t?!1:w&&t.indexOf===w?-1!=t.indexOf(e):E(t,function(t){return t===e})},z.invoke=function(t,e){var n=a.call(arguments,2),i=z.isFunction(e);return z.map(t,function(t){return(i?e:t[e]).apply(t,n)})},z.pluck=function(t,e){return z.map(t,function(t){return t[e]})},z.where=function(t,e,n){return z.isEmpty(e)?n?null:[]:z[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},z.findWhere=function(t,e){return z.where(t,e,!0)},z.max=function(t,e,n){if(!e&&z.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.max.apply(Math,t);if(!e&&z.isEmpty(t))return-1/0;var i={computed:-1/0,value:-1/0};return j(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;o>=i.computed&&(i={value:t,computed:o})}),i.value},z.min=function(t,e,n){if(!e&&z.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.min.apply(Math,t);if(!e&&z.isEmpty(t))return 1/0;var i={computed:1/0,value:1/0};return j(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;i.computed>o&&(i={value:t,computed:o})}),i.value},z.shuffle=function(t){var e,n=0,i=[];return j(t,function(t){e=z.random(n++),i[n-1]=i[e],i[e]=t}),i};var C=function(t){return z.isFunction(t)?t:function(e){return e[t]}};z.sortBy=function(t,e,n){var i=C(e);return z.pluck(z.map(t,function(t,e,r){return{value:t,index:e,criteria:i.call(n,t,e,r)}}).sort(function(t,e){var n=t.criteria,i=e.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(i>n||void 0===i)return-1}return t.indexs;){var a=s+o>>>1;r>n.call(i,t[a])?s=a+1:o=a}return s},z.toArray=function(t){return t?z.isArray(t)?a.call(t):t.length===+t.length?z.map(t,z.identity):z.values(t):[]},z.size=function(t){return null==t?0:t.length===+t.length?t.length:z.keys(t).length},z.first=z.head=z.take=function(t,e,n){return null==t?void 0:null==e||n?t[0]:a.call(t,0,e)},z.initial=function(t,e,n){return a.call(t,0,t.length-(null==e||n?1:e))},z.last=function(t,e,n){return null==t?void 0:null==e||n?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},z.rest=z.tail=z.drop=function(t,e,n){return a.call(t,null==e||n?1:e)},z.compact=function(t){return z.filter(t,z.identity)};var M=function(t,e,n){return j(t,function(t){z.isArray(t)?e?o.apply(n,t):M(t,e,n):n.push(t)}),n};z.flatten=function(t,e){return M(t,e,[])},z.without=function(t){return z.difference(t,a.call(arguments,1))},z.uniq=z.unique=function(t,e,n,i){z.isFunction(e)&&(i=n,n=e,e=!1);var r=n?z.map(t,n,i):t,s=[],o=[];return j(r,function(n,i){(e?i&&o[o.length-1]===n:z.contains(o,n))||(o.push(n),s.push(t[i]))}),s},z.union=function(){return z.uniq(u.apply(i,arguments))},z.intersection=function(t){var e=a.call(arguments,1);return z.filter(z.uniq(t),function(t){return z.every(e,function(e){return z.indexOf(e,t)>=0})})},z.difference=function(t){var e=u.apply(i,a.call(arguments,1));return z.filter(t,function(t){return!z.contains(e,t)})},z.zip=function(){for(var t=a.call(arguments),e=z.max(z.pluck(t,"length")),n=Array(e),i=0;e>i;i++)n[i]=z.pluck(t,""+i);return n},z.object=function(t,e){if(null==t)return{};for(var n={},i=0,r=t.length;r>i;i++)e?n[t[i]]=e[i]:n[t[i][0]]=t[i][1];return n},z.indexOf=function(t,e,n){if(null==t)return-1;var i=0,r=t.length;if(n){if("number"!=typeof n)return i=z.sortedIndex(t,e),t[i]===e?i:-1;i=0>n?Math.max(0,r+n):n}if(w&&t.indexOf===w)return t.indexOf(e,n);for(;r>i;i++)if(t[i]===e)return i;return-1},z.lastIndexOf=function(t,e,n){if(null==t)return-1;var i=null!=n;if(b&&t.lastIndexOf===b)return i?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var r=i?n:t.length;r--;)if(t[r]===e)return r;return-1},z.range=function(t,e,n){1>=arguments.length&&(e=t||0,t=0),n=arguments[2]||1;for(var i=Math.max(Math.ceil((e-t)/n),0),r=0,s=Array(i);i>r;)s[r++]=t,t+=n; -return s},z.bind=function(t,e){if(t.bind===x&&x)return x.apply(t,a.call(arguments,1));var n=a.call(arguments,2);return function(){return t.apply(e,n.concat(a.call(arguments)))}},z.partial=function(t){var e=a.call(arguments,1);return function(){return t.apply(this,e.concat(a.call(arguments)))}},z.bindAll=function(t){var e=a.call(arguments,1);return 0===e.length&&(e=z.functions(t)),j(e,function(e){t[e]=z.bind(t[e],t)}),t},z.memoize=function(t,e){var n={};return e||(e=z.identity),function(){var i=e.apply(this,arguments);return z.has(n,i)?n[i]:n[i]=t.apply(this,arguments)}},z.delay=function(t,e){var n=a.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},z.defer=function(t){return z.delay.apply(z,[t,1].concat(a.call(arguments,1)))},z.throttle=function(t,e){var n,i,r,s,o=0,a=function(){o=new Date,r=null,s=t.apply(n,i)};return function(){var u=new Date,c=e-(u-o);return n=this,i=arguments,0>=c?(clearTimeout(r),r=null,o=u,s=t.apply(n,i)):r||(r=setTimeout(a,c)),s}},z.debounce=function(t,e,n){var i,r;return function(){var s=this,o=arguments,a=function(){i=null,n||(r=t.apply(s,o))},u=n&&!i;return clearTimeout(i),i=setTimeout(a,e),u&&(r=t.apply(s,o)),r}},z.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},z.wrap=function(t,e){return function(){var n=[t];return o.apply(n,arguments),e.apply(this,n)}},z.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},z.after=function(t,e){return 0>=t?e():function(){return 1>--t?e.apply(this,arguments):void 0}},z.keys=_||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)z.has(t,n)&&(e[e.length]=n);return e},z.values=function(t){var e=[];for(var n in t)z.has(t,n)&&e.push(t[n]);return e},z.pairs=function(t){var e=[];for(var n in t)z.has(t,n)&&e.push([n,t[n]]);return e},z.invert=function(t){var e={};for(var n in t)z.has(t,n)&&(e[t[n]]=n);return e},z.functions=z.methods=function(t){var e=[];for(var n in t)z.isFunction(t[n])&&e.push(n);return e.sort()},z.extend=function(t){return j(a.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},z.pick=function(t){var e={},n=u.apply(i,a.call(arguments,1));return j(n,function(n){n in t&&(e[n]=t[n])}),e},z.omit=function(t){var e={},n=u.apply(i,a.call(arguments,1));for(var r in t)z.contains(n,r)||(e[r]=t[r]);return e},z.defaults=function(t){return j(a.call(arguments,1),function(e){if(e)for(var n in e)null==t[n]&&(t[n]=e[n])}),t},z.clone=function(t){return z.isObject(t)?z.isArray(t)?t.slice():z.extend({},t):t},z.tap=function(t,e){return e(t),t};var D=function(t,e,n,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof z&&(t=t._wrapped),e instanceof z&&(e=e._wrapped);var r=c.call(t);if(r!=c.call(e))return!1;switch(r){case"[object String]":return t==e+"";case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var s=n.length;s--;)if(n[s]==t)return i[s]==e;n.push(t),i.push(e);var o=0,a=!0;if("[object Array]"==r){if(o=t.length,a=o==e.length)for(;o--&&(a=D(t[o],e[o],n,i)););}else{var u=t.constructor,l=e.constructor;if(u!==l&&!(z.isFunction(u)&&u instanceof u&&z.isFunction(l)&&l instanceof l))return!1;for(var h in t)if(z.has(t,h)&&(o++,!(a=z.has(e,h)&&D(t[h],e[h],n,i))))break;if(a){for(h in e)if(z.has(e,h)&&!o--)break;a=!o}}return n.pop(),i.pop(),a};z.isEqual=function(t,e){return D(t,e,[],[])},z.isEmpty=function(t){if(null==t)return!0;if(z.isArray(t)||z.isString(t))return 0===t.length;for(var e in t)if(z.has(t,e))return!1;return!0},z.isElement=function(t){return!(!t||1!==t.nodeType)},z.isArray=y||function(t){return"[object Array]"==c.call(t)},z.isObject=function(t){return t===Object(t)},j(["Arguments","Function","String","Number","Date","RegExp"],function(t){z["is"+t]=function(e){return c.call(e)=="[object "+t+"]"}}),z.isArguments(arguments)||(z.isArguments=function(t){return!(!t||!z.has(t,"callee"))}),"function"!=typeof/./&&(z.isFunction=function(t){return"function"==typeof t}),z.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},z.isNaN=function(t){return z.isNumber(t)&&t!=+t},z.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==c.call(t)},z.isNull=function(t){return null===t},z.isUndefined=function(t){return void 0===t},z.has=function(t,e){return l.call(t,e)},z.noConflict=function(){return t._=e,this},z.identity=function(t){return t},z.times=function(t,e,n){for(var i=Array(t),r=0;t>r;r++)i[r]=e.call(n,r);return i},z.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var A={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};A.unescape=z.invert(A.escape);var F={escape:RegExp("["+z.keys(A.escape).join("")+"]","g"),unescape:RegExp("("+z.keys(A.unescape).join("|")+")","g")};z.each(["escape","unescape"],function(t){z[t]=function(e){return null==e?"":(""+e).replace(F[t],function(e){return A[t][e]})}}),z.result=function(t,e){if(null==t)return null;var n=t[e];return z.isFunction(n)?n.call(t):n},z.mixin=function(t){j(z.functions(t),function(e){var n=z[e]=t[e];z.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),H.call(this,n.apply(z,t))}})};var T=0;z.uniqueId=function(t){var e=++T+"";return t?t+e:e},z.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var P=/(.)^/,S={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},R=/\\|'|\r|\n|\t|\u2028|\u2029/g;z.template=function(t,e,n){var i;n=z.defaults({},n,z.templateSettings);var r=RegExp([(n.escape||P).source,(n.interpolate||P).source,(n.evaluate||P).source].join("|")+"|$","g"),s=0,o="__p+='";t.replace(r,function(e,n,i,r,a){return o+=t.slice(s,a).replace(R,function(t){return"\\"+S[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),i&&(o+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=Function(n.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return i(e,z);var u=function(t){return i.call(this,t,z)};return u.source="function("+(n.variable||"obj")+"){\n"+o+"}",u},z.chain=function(t){return z(t).chain()};var H=function(t){return this._chain?z(t).chain():t};z.mixin(z),j(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=i[t];z.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],H.call(this,n)}}),j(["concat","join","slice"],function(t){var e=i[t];z.prototype[t]=function(){return H.call(this,e.apply(this._wrapped,arguments))}}),z.extend(z.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("underscore",[],function(){}),i("ventus/wm/modes/expose",["underscore","ventus/core/promise"],function(t,e){"use strict";var n={register:function(){var e=this;console.log("Expose mode registered."),this.el.on("contextmenu",t.throttle(function(){return"expose"!==e.mode?e.windows.length>0&&(e.mode="expose"):"expose"===e.mode&&(e.mode="default"),!1},1e3))},plug:function(){var t,e,n,i,r=Math.floor,s=Math.ceil,o=this,a=s(this.windows.length/2),u=r(this.el.width()/a),c=r(this.el.height()/2);this.el.addClass("expose");for(var l,h=0,f=this.windows.length;f>h;h++){l=this.windows[h],l.stamp(),t=l.height>l.width?l.height>c?c/l.height:1:l.width>u?u/l.width:1,t-=.15,i={x:h%a*u,y:(a>h?0:1)*c},e=i.x+r((u-t*l.width)/2),n=i.y+r((c-t*l.height)/2),l.enabled=!1,l.movable=!1,l.el.addClass("exposing"),l.el.css("transform-origin","0 0"),l.el.css("transform","scale("+t+")"),l.el.css("top",n),l.el.css("left",e);var p=function(){l.el.removeClass("exposing")};l.animations?l.el.onTransitionEnd(p,this):p.call(this)}this.overlay=!0,this.el.one("click",function(){o.mode="default"})},unplug:function(){var t=new e;t.getFuture().then(function(){this.el.removeClass("expose")}.bind(this)),0===this.windows.length&&t.done();for(var n,i=this.windows.length;i--;){n=this.windows[i],n.restore(),n.el.css("transform","scale(1)"),n.el.css("transform-origin","50% 50%");var r=function(e,n){return function(){0===n&&t.done(),e.el.css("transform","")}}(n,i);n.animations?this.el.onTransitionEnd(r,this):r.call(this),n.movable=!0,n.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return n}),i("ventus/wm/modes/fullscreen",[],function(){"use strict";var t={register:function(){console.log("Fullscreen mode registered.")},plug:function(){this.el.addClass("fullscreen");for(var t,e=0,n=this.windows.length;n>e;e++)t=this.windows[e],t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},unplug:function(){for(var t,e=this.windows.length;e--;){t=this.windows[e],t.restore(),t.el.css("transform","scale(1)"),t.el.css("transform-origin","50% 50%");var n=function(t){return function(){this.el.removeClass("fullscreen"),t.el.css("transform","")}}(t);this.el.onTransitionEnd(n,this),t.movable=!0,t.resizable=!0,t.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return t}),i("ventus/wm/windowmanager",["$","ventus/wm/window","ventus/core/view","ventus/wm/modes/default","ventus/wm/modes/expose","ventus/wm/modes/fullscreen"],function(t,e,n,i,r,s){"use strict";var o=function(){var e;this.el=n('
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(t){this[t]=function(t){return function(){this.currentMode.actions[t]&&this.currentMode.actions[t].apply(this,arguments)}}.call(this,t)},this);for(var i in this.modes)this.modes.hasOwnProperty(i)&&this.modes[i].register&&this.modes[i].register.apply(this);this.windows=[],this.active=null,this.mode="default",e=this.createWindow,this.createWindow=e.bind(this),this.createWindow.fromQuery=e.fromQuery.bind(this),this.createWindow.fromElement=e.fromElement.bind(this)};return o.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:r,fullscreen:s},set mode(t){var e=this.modes[t];e&&this._mode!==t&&(this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),e.plug&&e.plug.apply(this),this._mode=t)},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(t){this.$overlay.css("opacity",t?.8:0),this._overlay=t},get overlay(){return this._overlay},createWindow:function(t){var n=new e(t);return this.mode="default",n.signals.on("focus",this._focus,this),n.signals.on("blur",this._blur,this),n.signals.on("close",this._close,this),this.actions.forEach(function(t){n.signals.on(t,this[t],this)},this),this.windows.push(n),n.space=this.el,n.focus(),n},_focus:function(t){var e,n,i=1e4,r=i+1e4;if(!this.active||this.active!==t){if(this.active?(e=this.active.z,this.active.blur()):e=i,n=this.windows.indexOf(t),this.windows.splice(n,1),this.windows.push(t),t.z=e+1,e>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=i+(s-r);this.active=t}},_blur:function(t){this.active===t&&(this.active=null)},_close:function(t){var e,n=this.windows.indexOf(t);return-1===n?void console.log("Trying to close a window that doesn't exist in this window manager"):(this.windows.splice(n,1),e=this.windows.length,void(this.active&&this.active===t&&(this.active=0!==e?this.windows[e-1]:null,this.active&&this.active.focus())))}},o.prototype.createWindow.fromQuery=function(t,e){return e.content=n(t),this.createWindow(e)},o.prototype.createWindow.fromElement=function(t,e){return e.content=n(t),this.createWindow(e)},o}),i("ventus",["require","exports","module","ventus/wm/windowmanager","ventus/wm/window"],function(t){"use strict";return{version:"0.2",browser:{animationEventName:function(){var t=document.body.style,e=null;return""===t.animation?e="animationend":""===t.MozAnimation?e="mozAnimationEnd":""===t.webkitAnimation&&(e="webkitAnimationEnd"),e}},WindowManager:t("ventus/wm/windowmanager"),Window:t("ventus/wm/window")}}),i("src/main",["almond","handlebars","ventus"],function(){}),i("$",function(){return t}),i("underscore",function(){return _}),n("ventus")}); \ No newline at end of file +!function(t,e){"function"==typeof define&&define.amd?define(["$"],e):t.Ventus=e(t.$)}(this,function(t){var e,n,i;return function(t){function r(t,e){var n,i,r,s,o,a,u,c,l,h,f=e&&e.split("/"),d=m.map,p=d&&d["*"]||{};if(t&&"."===t.charAt(0)&&e){for(f=f.slice(0,f.length-1),t=f.concat(t.split("/")),c=0;h=t[c];c++)if("."===h)t.splice(c,1),c-=1;else if(".."===h){if(1===c&&(".."===t[2]||".."===t[0]))return!0;c>0&&(t.splice(c-1,2),c-=2)}t=t.join("/")}if((f||p)&&d){for(n=t.split("/"),c=n.length;c>0;c-=1){if(i=n.slice(0,c).join("/"),f)for(l=f.length;l>0;l-=1)if(r=d[f.slice(0,l).join("/")],r&&(r=r[i])){s=r,o=c;break}if(s)break;!a&&p&&p[i]&&(a=p[i],u=c)}!s&&a&&(s=a,o=u),s&&(n.splice(0,o,s),t=n.join("/"))}return t}function s(e,n){return function(){return f.apply(t,v.call(arguments,0).concat([e,n]))}}function o(t){return function(e){return r(e,t)}}function a(t){return function(e){d[t]=e}}function u(e){if(p.hasOwnProperty(e)){var n=p[e];delete p[e],g[e]=!0,h.apply(t,n)}if(!d.hasOwnProperty(e))throw new Error("No "+e);return d[e]}function c(t,e){var n,i,s=t.indexOf("!");return-1!==s?(n=r(t.slice(0,s),e),t=t.slice(s+1),i=u(n),t=i&&i.normalize?i.normalize(t,o(e)):r(t,e)):t=r(t,e),{f:n?n+"!"+t:t,n:t,p:i}}function l(t){return function(){return m&&m.config&&m.config[t]||{}}}var h,f,d={},p={},m={},g={},v=[].slice;h=function(e,n,i,r){var o,h,f,m,v,w,b=[];if(r=r||e,"function"==typeof i){for(n=!n.length&&i.length?["require","exports","module"]:n,w=0;w":">",'"':""","'":"'","`":"`"},c=/[&<>"'`]/g,l=/[&<>"'`]/;o.extend=n;var h=Object.prototype.toString;o.toString=h;var f=function(t){return"function"==typeof t};f(/x/)&&(f=function(t){return"function"==typeof t&&"[object Function]"===h.call(t)});var f;o.isFunction=f;var d=Array.isArray||function(t){return t&&"object"==typeof t?"[object Array]"===h.call(t):!1};return o.isArray=d,o.escapeExpression=i,o.isEmpty=r,o.appendContextPath=s,o}(t),n=function(){"use strict";function t(t,e){var i;e&&e.firstLine&&(i=e.firstLine,t+=" - "+i+":"+e.firstColumn);for(var r=Error.prototype.constructor.call(this,t),s=0;s0?(n.ids&&(n.ids=[n.name]),t.helpers.each(e,n)):i(this);if(n.data&&n.ids){var o=g(n.data);o.contextPath=s.appendContextPath(n.data.contextPath,n.name),n={data:o}}return r(e,n)}),t.registerHelper("each",function(t,e){if(!e)throw new o("Must pass iterator to #each");var n,i,r=e.fn,a=e.inverse,u=0,c="";if(e.data&&e.ids&&(i=s.appendContextPath(e.data.contextPath,e.ids[0])+"."),h(t)&&(t=t.call(this)),e.data&&(n=g(e.data)),t&&"object"==typeof t)if(l(t))for(var f=t.length;f>u;u++)n&&(n.index=u,n.first=0===u,n.last=u===t.length-1,i&&(n.contextPath=i+u)),c+=r(t[u],{data:n});else for(var d in t)t.hasOwnProperty(d)&&(n&&(n.key=d,n.index=u,n.first=0===u,i&&(n.contextPath=i+d)),c+=r(t[d],{data:n}),u++);return 0===u&&(c=a(this)),c}),t.registerHelper("if",function(t,e){return h(t)&&(t=t.call(this)),!e.hash.includeZero&&!t||s.isEmpty(t)?e.inverse(this):e.fn(this)}),t.registerHelper("unless",function(e,n){return t.helpers["if"].call(this,e,{fn:n.inverse,inverse:n.fn,hash:n.hash})}),t.registerHelper("with",function(t,e){h(t)&&(t=t.call(this));var n=e.fn;if(s.isEmpty(t))return e.inverse(this);if(e.data&&e.ids){var i=g(e.data);i.contextPath=s.appendContextPath(e.data.contextPath,e.ids[0]),e={data:i}}return n(t,e)}),t.registerHelper("log",function(e,n){var i=n.data&&null!=n.data.level?parseInt(n.data.level,10):1;t.log(i,e)}),t.registerHelper("lookup",function(t,e){return t&&t[e]})}var r={},s=t,o=e,a="2.0.0";r.VERSION=a;var u=6;r.COMPILER_REVISION=u;var c={1:"<= 1.0.rc.2",2:"== 1.0.0-rc.3",3:"== 1.0.0-rc.4",4:"== 1.x.x",5:"== 2.0.0-alpha.x",6:">= 2.0.0-beta.1"};r.REVISION_CHANGES=c;var l=s.isArray,h=s.isFunction,f=s.toString,d="[object Object]";r.HandlebarsEnvironment=n,n.prototype={constructor:n,logger:p,log:m,registerHelper:function(t,e){if(f.call(t)===d){if(e)throw new o("Arg not supported with multiple helpers");s.extend(this.helpers,t)}else this.helpers[t]=e},unregisterHelper:function(t){delete this.helpers[t]},registerPartial:function(t,e){f.call(t)===d?s.extend(this.partials,t):this.partials[t]=e},unregisterPartial:function(t){delete this.partials[t]}};var p={methodMap:{0:"debug",1:"info",2:"warn",3:"error"},DEBUG:0,INFO:1,WARN:2,ERROR:3,level:3,log:function(t,e){if(p.level<=t){var n=p.methodMap[t];"undefined"!=typeof console&&console[n]&&console[n].call(console,e)}}};r.logger=p;var m=p.log;r.log=m;var g=function(t){var e=s.extend({},t);return e._parent=t,e};return r.createFrame=g,r}(e,n),r=function(t,e,n){"use strict";function i(t){var e=t&&t[0]||1,n=f;if(e!==n){if(n>e){var i=d[n],r=d[e];throw new h("Template was precompiled with an older version of Handlebars than the current runtime. Please update your precompiler to a newer version ("+i+") or downgrade your runtime to an older version ("+r+").")}throw new h("Template was precompiled with a newer version of Handlebars than the current runtime. Please update your runtime to a newer version ("+t[1]+").")}}function r(t,e){if(!e)throw new h("No environment passed to template");if(!t||!t.main)throw new h("Unknown template object: "+typeof t);e.VM.checkRevision(t.compiler);var n=function(n,i,r,s,o,a,u,c,f){o&&(s=l.extend({},s,o));var d=e.VM.invokePartial.call(this,n,r,s,a,u,c,f);if(null==d&&e.compile){var p={helpers:a,partials:u,data:c,depths:f};u[r]=e.compile(n,{data:void 0!==c,compat:t.compat},e),d=u[r](s,p)}if(null!=d){if(i){for(var m=d.split("\n"),g=0,v=m.length;v>g&&(m[g]||g+1!==v);g++)m[g]=i+m[g];d=m.join("\n")}return d}throw new h("The partial "+r+" could not be compiled when running in runtime-only mode")},i={lookup:function(t,e){for(var n=t.length,i=0;n>i;i++)if(t[i]&&null!=t[i][e])return t[i][e]},lambda:function(t,e){return"function"==typeof t?t.call(e):t},escapeExpression:l.escapeExpression,invokePartial:n,fn:function(e){return t[e]},programs:[],program:function(t,e,n){var i=this.programs[t],r=this.fn(t);return e||n?i=s(this,t,r,e,n):i||(i=this.programs[t]=s(this,t,r)),i},data:function(t,e){for(;t&&e--;)t=t._parent;return t},merge:function(t,e){var n=t||e;return t&&e&&t!==e&&(n=l.extend({},e,t)),n},noop:e.VM.noop,compilerInfo:t.compiler},r=function(e,n){n=n||{};var s=n.data;r._setup(n),!n.partial&&t.useData&&(s=u(e,s));var o;return t.useDepths&&(o=n.depths?[e].concat(n.depths):[e]),t.main.call(i,e,i.helpers,i.partials,s,o)};return r.isTop=!0,r._setup=function(n){n.partial?(i.helpers=n.helpers,i.partials=n.partials):(i.helpers=i.merge(n.helpers,e.helpers),t.usePartial&&(i.partials=i.merge(n.partials,e.partials)))},r._child=function(e,n,r){if(t.useDepths&&!r)throw new h("must pass parent depths");return s(i,e,t[e],n,r)},r}function s(t,e,n,i,r){var s=function(e,s){return s=s||{},n.call(t,e,t.helpers,t.partials,s.data||i,r&&[e].concat(r))};return s.program=e,s.depth=r?r.length:0,s}function o(t,e,n,i,r,s,o){var a={partial:!0,helpers:i,partials:r,data:s,depths:o};if(void 0===t)throw new h("The partial "+e+" could not be found");return t instanceof Function?t(n,a):void 0}function a(){return""}function u(t,e){return e&&"root"in e||(e=e?p(e):{},e.root=t),e}var c={},l=t,h=e,f=n.COMPILER_REVISION,d=n.REVISION_CHANGES,p=n.createFrame;return c.checkRevision=i,c.template=r,c.program=s,c.invokePartial=o,c.noop=a,c}(e,n,i),s=function(t,e,n,i,r){"use strict";var s,o=t,a=e,u=n,c=i,l=r,h=function(){var t=new o.HandlebarsEnvironment;return c.extend(t,o),t.SafeString=a,t.Exception=u,t.Utils=c,t.escapeExpression=c.escapeExpression,t.VM=l,t.template=function(e){return l.template(e,t)},t},f=h();return f.create=h,f["default"]=f,s=f}(i,t,n,e,r);return s}),i("ventus/core/emitter",[],function(){"use strict";function t(t,e,n){return function(i){return(i.funct===t&&i.scope===e)===n}}function e(e,n,i,r){return e[n]?e[n].some(t(i,r,!0)):!1}function n(){this._listeners={}}return n.prototype={listenersCount:function(t){var e=this._listeners[t];return e?e.length:0},on:function(t,n,i){var r=this._listeners;e(r,t,n,i)||(r[t]||(r[t]=[]),r[t].push({funct:n,scope:i}))},off:function(e,n,i){var r=this._listeners[e];r&&(this._listeners[e]=r.filter(t(n,i,!1)))},once:function(t,n,i){e(this._listeners,t,n,i)||this.on(t,function r(){this.off(t,r,this),n.apply(i,arguments)},this)},emit:function(t){var e=this._listeners[t];if(e){var n=Array.prototype.slice.call(arguments,1);e.forEach(function(t){t.funct.apply(t.scope,n)})}},connect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.on(n,t[n],e)},disconnect:function(t,e){if(t)for(var n in t)t.hasOwnProperty(n)&&this.off(n,t[n],e)}},n}),i("ventus/core/promise",[],function(){"use strict";function t(t,e,n){setTimeout(function(){t.apply(e,n)})}function e(t,e,n){var i="Error on "+t+" promise execution at index ["+n+"]";Error.call(this,i),this.child=e,this.index=n,this.message=i}function n(){this._future=new s}function i(t){return t.hasSucceed()}function r(t,n,i,o,a){return i+=1,i>=t.length?o.done(a):a instanceof s?void a.then(function(){r(t,n,i,o,t[i].apply(n,arguments))},function(t){o.fail(new e(" serial ",t,i))}):r(t,n,i,o,t[i].call(n,a))}function s(){this._args=null,this._fn={success:[],failed:[],"finally":[]}}var o=Array.prototype.slice;return n.prototype={constructor:n,done:function(){var t=o.call(arguments);this.getFuture()._arrived("success",t)},fail:function(){var t=o.call(arguments);this.getFuture()._arrived("failed",t)},getFuture:function(){return this._future}},n.done=function(){var t=new n;return t.done.apply(t,arguments),t.getFuture()},n.failed=function(){var t=new n;return t.fail.apply(t,arguments),t.getFuture()},n.parallel=function(){return n.all(o.call(arguments))},n.all=function(t){if(!t||!t.length)return n.done();t=t.map(function(t){return t.getFuture?t.getFuture():t});var r=new n,s=[];return t.forEach(function(n,a){n.then(function(){s[a]=o.call(arguments),t.every(i)&&r.done.apply(r,s)},function(t){r.fail(new e("parallel",t,a))})}),r.getFuture()},n.serial=function(t,e){if(!t||0===t.length)return n.done();var i=new n;return setTimeout(function(){r(t,e,0,i,t[0].call(e))}),i.getFuture()},s.prototype={constructor:s,_add:function(e,n,i){return n?this._fn[e]===!0?t(n,i,this._args):this._fn[e]&&this._fn[e].push({callback:n,scope:i}):console.warn("No callback passed"),this},_arrived:function(t,e){function n(t){t.callback.apply(t.scope,e)}if(this.isCompleted())throw new Error("Future already arrived!");var i=this._fn[t].concat(this._fn["finally"]);this._fn={success:!1,failed:!1,"finally":!0},this._args=e,this._fn[t]=!0,i.forEach(n)},isCompleted:function(){return this._fn["finally"]===!0},hasFailed:function(){return this._fn.failed===!0},hasSucceed:function(){return this._fn.success===!0},onDone:function(t,e){return this._add("success",t,e)},onError:function(t,e){return this._add("failed",t,e)},onFinally:function(t,e){return this._add("finally",t,e)},then:function(t,e,n){t&&this.onDone(t),e&&this.onError(e),n&&this.onFinally(n)},transform:function(t){var e=new n;return this.then(function(){var n=t.apply(null,arguments);n&&"array"===n.constructor||(n=[n]),e.done.apply(e,n)},function(){e.fail.apply(e,arguments)}),e.getFuture()}},n.PromiseError=e,n.Future=s,n}),i("ventus/core/view",["$"],function(t){"use strict";for(var e=/^(?:(.*)\s)?(\w+)$/,n="transitionend webkitTransitionEnd oTransitionEnd MSTransitionEnd",i="animationend webkitAnimationEnd oAnimationEnd MSAnimationEnd",r=["transform","transition","animation","transform-origin"],s=r.length;s--;)!function(e){t.cssHooks[e]={get:function(){return null},set:function(t,n){t.style["-webkit-"+e]=n,t.style["-moz-"+e]=n,t.style["-ms-"+e]=n,t.style["-o-"+e]=n,t.style[e]=n}}}(r[s]);return t.fn.extend({listen:function(t,n){var i,r,s,o;for(var a in t)if(t.hasOwnProperty(a)){if(i=t[a],r=a.match(e),s=r[1],o=r[2],"mousedown"===o?o+=" touchstart":"mousemove"===o?o+=" touchmove":"mouseup"===o?o+=" touchend":"click"===o&&(o+=" touchend"),"string"==typeof i&&(i=n[i]),!i)throw new Error("Handler not found");s?this.on(o,s,i.bind(n)):this.on(o,i.bind(n))}return this},onTransitionEnd:function(t,e){this.one(n,function(){t.apply(e||this)})},onAnimationEnd:function(t,e){this.one(i,function(){t.apply(e||this)})}}),function(e){return"function"==typeof e?function(n){return t(e(n||{}))}:t(e)}}),i("ventus/tpl/window",["handlebars"],function(t){return t.template({compiler:[6,">= 2.0.0-beta.1"],main:function(t,e,n,i){var r,s="function",o=e.helperMissing,a=this.escapeExpression;return'
\n
\n
\n

'+a((r=null!=(r=e.title||(null!=t?t.title:t))?r:o,typeof r===s?r.call(t,{name:"title",hash:{},data:i}):r))+'

\n
\n \n \n \n
\n
\n\n
\n\n \n
\n
\n
\n'},useData:!0})}),i("ventus/wm/window",["ventus/core/emitter","ventus/core/promise","ventus/core/view","ventus/tpl/window"],function(t,e,n,i){"use strict";function r(t){return!!window.TouchEvent&&t.originalEvent instanceof window.TouchEvent}function s(t){return r(t)?t.originalEvent.changedTouches[0]:t.originalEvent}var o=function(e){if(this.signals=new t,e=e||{title:"Untitle Window",width:400,height:200,x:0,y:0,content:"",movable:!0,resizable:!0,widget:!1,titlebar:!0,animations:!0,classname:"",stayinspace:!1},e.animations&&e.classname+" animated",this.el=n(i({title:e.title,classname:e.classname})),this.el.listen(this.events.window,this),e.opacity&&this.el.css("opacity",e.opacity),e.events)for(var r in e.events)e.events.hasOwnProperty(r)&&"function"==typeof e.events[r]&&this.signals.on(r,e.events[r],this);this.$content=this.el.find(".wm-content"),e.content&&this.$content.append(e.content),this.$titlebar=this.el.find("header"),this.width=e.width||400,this.height=e.height||200,this.x=e.x||0,this.y=e.y||0,this.z=1e4,this.enabled=!0,this.active=!1,this.maximized=!1,this.minimized=!1,this._closed=!0,this._destroyed=!1,this.widget=!1,this.movable="undefined"!=typeof e.movable?e.movable:!0,this.resizable="undefined"!=typeof e.resizable?e.resizable:!0,this.animations="undefined"!=typeof e.animations?e.animations:!0,this.titlebar=!0,this.stayinspace="undefined"!=typeof e.stayinspace?e.stayinspace:!1};return o.prototype={_restore:null,_moving:null,_resizing:null,_mouseEdgePosition:null,slots:{move:function(t){var e=s(t);this.enabled&&this.movable&&(this._moving=this.toLocal({x:e.pageX,y:e.pageY}),this.el.addClass("move"),this._space[0].classList.add("no-events"),t.preventDefault())}},events:{window:{click:function(t){this.signals.emit("select",this,t)},mousedown:function(t){this.focus(),this.widget&&this.slots.move.call(this,t),this.enabled&&this.resizable&&!this.maximized&&this.mouseOnWindowEdge&&this.startResize(t)},".wm-content click":function(t){this.enabled&&this.signals.emit("click",this,t)},".wm-window-title mousedown":function(t){this.maximized||this.mouseOnWindowEdge||this.slots.move.call(this,t)},".wm-window-title dblclick":function(){this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-close click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.close()},".wm-window-title button.wm-maximize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.resizable&&this.maximize()},".wm-window-title button.wm-minimize click":function(t){t.stopPropagation(),t.preventDefault(),this.enabled&&this.minimize()},".wm-window-title button mousedown":function(t){this.focus(),t.stopPropagation(),t.preventDefault()},"button.wm-resize mousedown":function(t){this.enabled&&this.resizable&&(this._mouseEdgePosition={top:!1,left:!1,bottom:!0,right:!0},this.startResize(t))},mousemove:function(t){var e={TOP:5,LEFT:15,BOTTOM:15,RIGHT:15},n=36;if(this.enabled&&this.resizable&&!this._resizing){var i=s(t);if(this._mouseEdgePosition={top:!t.srcElement.classList.contains("wm-content")&&i.offsetYthis.space[0].clientWidth||this.el[0].clientHeight>this.space[0].clientHeight)&&this.resize(Math.min(this.el[0].clientWidth,this.space[0].clientWidth),Math.min(this.el[0].clientHeight,this.space[0].clientHeight));var n=Math.max(0,e.pageX-this._moving.x),i=0,o=Math.max(0,e.pageY-this._moving.y),a=0;n+this.el[0].clientWidth>this.space[0].clientWidth&&(i=n+this.el[0].clientWidth-this.space[0].clientWidth),o+this.el[0].clientHeight>this.space[0].clientHeight&&(a=o+this.el[0].clientHeight-this.space[0].clientHeight),this.move(n-i,o-a)}else this.move(e.pageX-this._moving.x,e.pageY-this._moving.y);if(this._resizing){var u;u=this.resizingHorizontally?this._mouseEdgePosition.left?this._resizing.pageX-e.pageX+this._resizing.width:e.pageX-this._resizing.pageX+this._resizing.width:this.width;var c;c=this.resizingVertically?this._mouseEdgePosition.top?this._resizing.pageY-e.pageY+this._resizing.height:e.pageY-this._resizing.pageY+this._resizing.height:this.height,this.resize(u,c),this._mouseEdgePosition.left&&this.move(e.pageX,this.y),this._mouseEdgePosition.top&&this.move(this.x,e.pageY)}},mouseup:function(){this._moving&&this._stopMove(),this._resizing&&this._stopResize()}}},_stopMove:function(){this.el.removeClass("move"),this._space[0].classList.remove("no-events"),this._moving=null},_stopResize:function(){this._space[0].classList.remove("no-events"),this.el.removeClass("resizing"),this._restore=null,this._resizing=null},get mouseOnWindowEdge(){return this._mouseEdgePosition&&(this._mouseEdgePosition.top||this._mouseEdgePosition.left||this._mouseEdgePosition.bottom||this._mouseEdgePosition.right)},get resizingHorizontally(){return this._mouseEdgePosition&&(this._mouseEdgePosition.left||this._mouseEdgePosition.right)},get resizingVertically(){return this._mouseEdgePosition&&(this._mouseEdgePosition.top||this._mouseEdgePosition.bottom)},set space(t){return t&&!t.listen?void console.error("The given space element is not a valid View"):(this._space=t,t.append(this.el),void t.listen(this.events.space,this))},get space(){return this._space},get maximized(){return this._maximized},set maximized(t){t?(this._restoreMaximized=this.stamp(),this.el.addClass("maximized"),this.signals.emit("maximize",this,this._restoreMaximized)):(this.el.removeClass("maximized"),this.signals.emit("restore",this,this._restoreMaximized)),this._maximized=t},get minimized(){return this._minimized},set minimized(t){t?(this._restoreMinimized=this.stamp(),this.signals.emit("minimize",this,this._restoreMinimized)):this.signals.emit("restore",this,this._restoreMinimized),this._minimized=t},set active(t){t?(this.signals.emit("focus",this),this.el.addClass("active"),this.el.removeClass("inactive")):(this.signals.emit("blur",this),this.el.removeClass("active"),this.el.addClass("inactive")),this._active=t},get active(){return this._active},set enabled(t){t?this.el.removeClass("disabled"):this.el.addClass("disabled"),this._enabled=t},get enabled(){return this._enabled},set movable(t){this._movable=!!t},get movable(){return this._movable},set resizable(t){t?this.el.removeClass("noresizable"):this.el.addClass("noresizable"),this._resizable=!!t},get resizable(){return this._resizable},set closed(t){},get closed(){return this._closed},set destroyed(t){},get destroyed(){return this._destroyed},set widget(t){this._widget=t},get widget(){return this._widget},set titlebar(t){t?this.$titlebar.removeClass("hide"):this.$titlebar.addClass("hide"),this._titlebar=t},get titlebar(){return this._titlebar},set animations(t){t?this.el.addClass("animated"):this.el.removeClass("animated"),this._animations=t},get animations(){return this._animations},set width(t){this.el.width(t)},get width(){return parseInt(this.el.width(),10)},set height(t){this.el.height(t)},get height(){return parseInt(this.el.height(),10)},set x(t){this.el.css("left",t)},set y(t){this.el.css("top",t)},get x(){return parseInt(this.el.css("left"),10)},get y(){return parseInt(this.el.css("top"),10)},set z(t){this.el.css("z-index",t)},get z(){return parseInt(this.el.css("z-index"),10)},startResize:function(t){var e=s(t);this._resizing={pageX:e.pageX,pageY:e.pageY,width:this.width,height:this.height},this._space[0].classList.add("no-events"),this.el.addClass("resizing"),t.preventDefault()},open:function(){var t=new e;return this.signals.emit("open",this),this.el.show(),this.el.addClass("opening"),this.el.onAnimationEnd(function(){this.el.removeClass("opening"),t.done()},this),this._closed=!1,t},close:function(){var t=new e;return this.signals.emit("close",this),this.el.addClass("closing"),this.el.onAnimationEnd(function(){this.el.removeClass("closing"),this.el.addClass("closed"),this.el.hide(),this.signals.emit("closed",this),t.done()},this),this._closed=!0,t},destroy:function(){var t=function(){this.$content.html(""),this.signals.emit("destroyed",this),this._destroyed=!0}.bind(this);this.signals.emit("destroy",this),this.closed?t():this.close().getFuture().then(function(){t()})},resize:function(t,e){return this.width=t,this.height=e,this},move:function(t,e){return this.x=t,this.y=e,this},stamp:function(){return this.restore=function(){var t={width:this.width,height:this.height},e={x:this.x,y:this.y};return function(){return this.resize(t.width,t.height),this.move(e.x,e.y),this}}.apply(this),this.restore},restore:function(){},maximize:function(){this.el.addClass("maximazing");var t=function(){this.el.removeClass("maximazing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.maximized=!this.maximized,this},minimize:function(){this.el.addClass("minimizing");var t=function(){this.el.removeClass("minimizing")};return this.animations?this.el.onTransitionEnd(t,this):t.call(this),this.minimized=!this.minimized,this},focus:function(){return this.active=!0,this},blur:function(){return this.active=!1,this},toLocal:function(t){return{x:t.x-this.x,y:t.y-this.y}},toGlobal:function(t){return{x:t.x+this.x,y:t.y+this.y}},append:function(t){t.appendTo(this.$content)}},o}),i("ventus/wm/modes/default",[],function(){"use strict";var t={register:function(){console.log("Default mode registered.")},plug:function(){},unplug:function(){},actions:{maximize:function(t){t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},restore:function(t,e){e.call(t)},minimize:function(t){t.resize(0,0)}}};return t}),function(){var t=this,e=t._,n={},i=Array.prototype,r=Object.prototype,s=Function.prototype,o=i.push,a=i.slice,u=i.concat,c=r.toString,l=r.hasOwnProperty,h=i.forEach,f=i.map,d=i.reduce,p=i.reduceRight,m=i.filter,g=i.every,v=i.some,w=i.indexOf,b=i.lastIndexOf,y=Array.isArray,_=Object.keys,x=s.bind,j=function(t){return t instanceof j?t:this instanceof j?void(this._wrapped=t):new j(t)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=j),exports._=j):t._=j,j.VERSION="1.4.4";var E=j.each=j.forEach=function(t,e,i){if(null!=t)if(h&&t.forEach===h)t.forEach(e,i);else if(t.length===+t.length){for(var r=0,s=t.length;s>r;r++)if(e.call(i,t[r],r,t)===n)return}else for(var o in t)if(j.has(t,o)&&e.call(i,t[o],o,t)===n)return};j.map=j.collect=function(t,e,n){var i=[];return null==t?i:f&&t.map===f?t.map(e,n):(E(t,function(t,r,s){i[i.length]=e.call(n,t,r,s)}),i)};var z="Reduce of empty array with no initial value";j.reduce=j.foldl=j.inject=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),d&&t.reduce===d)return i&&(e=j.bind(e,i)),r?t.reduce(e,n):t.reduce(e);if(E(t,function(t,s,o){r?n=e.call(i,n,t,s,o):(n=t,r=!0)}),!r)throw new TypeError(z);return n},j.reduceRight=j.foldr=function(t,e,n,i){var r=arguments.length>2;if(null==t&&(t=[]),p&&t.reduceRight===p)return i&&(e=j.bind(e,i)),r?t.reduceRight(e,n):t.reduceRight(e);var s=t.length;if(s!==+s){var o=j.keys(t);s=o.length}if(E(t,function(a,u,c){u=o?o[--s]:--s,r?n=e.call(i,n,t[u],u,c):(n=t[u],r=!0)}),!r)throw new TypeError(z);return n},j.find=j.detect=function(t,e,n){var i;return O(t,function(t,r,s){return e.call(n,t,r,s)?(i=t,!0):void 0}),i},j.filter=j.select=function(t,e,n){var i=[];return null==t?i:m&&t.filter===m?t.filter(e,n):(E(t,function(t,r,s){e.call(n,t,r,s)&&(i[i.length]=t)}),i)},j.reject=function(t,e,n){return j.filter(t,function(t,i,r){return!e.call(n,t,i,r)},n)},j.every=j.all=function(t,e,i){e||(e=j.identity);var r=!0;return null==t?r:g&&t.every===g?t.every(e,i):(E(t,function(t,s,o){return(r=r&&e.call(i,t,s,o))?void 0:n}),!!r)};var O=j.some=j.any=function(t,e,i){e||(e=j.identity);var r=!1;return null==t?r:v&&t.some===v?t.some(e,i):(E(t,function(t,s,o){return r||(r=e.call(i,t,s,o))?n:void 0}),!!r)};j.contains=j.include=function(t,e){return null==t?!1:w&&t.indexOf===w?-1!=t.indexOf(e):O(t,function(t){return t===e})},j.invoke=function(t,e){var n=a.call(arguments,2),i=j.isFunction(e);return j.map(t,function(t){return(i?e:t[e]).apply(t,n)})},j.pluck=function(t,e){return j.map(t,function(t){return t[e]})},j.where=function(t,e,n){return j.isEmpty(e)?n?null:[]:j[n?"find":"filter"](t,function(t){for(var n in e)if(e[n]!==t[n])return!1;return!0})},j.findWhere=function(t,e){return j.where(t,e,!0)},j.max=function(t,e,n){if(!e&&j.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.max.apply(Math,t);if(!e&&j.isEmpty(t))return-1/0;var i={computed:-1/0,value:-1/0};return E(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;o>=i.computed&&(i={value:t,computed:o})}),i.value},j.min=function(t,e,n){if(!e&&j.isArray(t)&&t[0]===+t[0]&&65535>t.length)return Math.min.apply(Math,t);if(!e&&j.isEmpty(t))return 1/0;var i={computed:1/0,value:1/0};return E(t,function(t,r,s){var o=e?e.call(n,t,r,s):t;i.computed>o&&(i={value:t,computed:o})}),i.value},j.shuffle=function(t){var e,n=0,i=[];return E(t,function(t){e=j.random(n++),i[n-1]=i[e],i[e]=t}),i};var P=function(t){return j.isFunction(t)?t:function(e){return e[t]}};j.sortBy=function(t,e,n){var i=P(e);return j.pluck(j.map(t,function(t,e,r){return{value:t,index:e,criteria:i.call(n,t,e,r)}}).sort(function(t,e){var n=t.criteria,i=e.criteria;if(n!==i){if(n>i||void 0===n)return 1;if(i>n||void 0===i)return-1}return t.indexs;){var a=s+o>>>1;r>n.call(i,t[a])?s=a+1:o=a}return s},j.toArray=function(t){return t?j.isArray(t)?a.call(t):t.length===+t.length?j.map(t,j.identity):j.values(t):[]},j.size=function(t){return null==t?0:t.length===+t.length?t.length:j.keys(t).length},j.first=j.head=j.take=function(t,e,n){return null==t?void 0:null==e||n?t[0]:a.call(t,0,e)},j.initial=function(t,e,n){return a.call(t,0,t.length-(null==e||n?1:e))},j.last=function(t,e,n){return null==t?void 0:null==e||n?t[t.length-1]:a.call(t,Math.max(t.length-e,0))},j.rest=j.tail=j.drop=function(t,e,n){return a.call(t,null==e||n?1:e)},j.compact=function(t){return j.filter(t,j.identity)};var k=function(t,e,n){return E(t,function(t){j.isArray(t)?e?o.apply(n,t):k(t,e,n):n.push(t)}),n};j.flatten=function(t,e){return k(t,e,[])},j.without=function(t){return j.difference(t,a.call(arguments,1))},j.uniq=j.unique=function(t,e,n,i){j.isFunction(e)&&(i=n,n=e,e=!1);var r=n?j.map(t,n,i):t,s=[],o=[];return E(r,function(n,i){(e?i&&o[o.length-1]===n:j.contains(o,n))||(o.push(n),s.push(t[i]))}),s},j.union=function(){return j.uniq(u.apply(i,arguments))},j.intersection=function(t){var e=a.call(arguments,1);return j.filter(j.uniq(t),function(t){return j.every(e,function(e){return j.indexOf(e,t)>=0})})},j.difference=function(t){var e=u.apply(i,a.call(arguments,1));return j.filter(t,function(t){return!j.contains(e,t)})},j.zip=function(){for(var t=a.call(arguments),e=j.max(j.pluck(t,"length")),n=Array(e),i=0;e>i;i++)n[i]=j.pluck(t,""+i);return n},j.object=function(t,e){if(null==t)return{};for(var n={},i=0,r=t.length;r>i;i++)e?n[t[i]]=e[i]:n[t[i][0]]=t[i][1];return n},j.indexOf=function(t,e,n){if(null==t)return-1;var i=0,r=t.length;if(n){if("number"!=typeof n)return i=j.sortedIndex(t,e),t[i]===e?i:-1;i=0>n?Math.max(0,r+n):n}if(w&&t.indexOf===w)return t.indexOf(e,n);for(;r>i;i++)if(t[i]===e)return i;return-1},j.lastIndexOf=function(t,e,n){if(null==t)return-1;var i=null!=n;if(b&&t.lastIndexOf===b)return i?t.lastIndexOf(e,n):t.lastIndexOf(e);for(var r=i?n:t.length;r--;)if(t[r]===e)return r;return-1},j.range=function(t,e,n){1>=arguments.length&&(e=t||0,t=0),n=arguments[2]||1;for(var i=Math.max(Math.ceil((e-t)/n),0),r=0,s=Array(i);i>r;)s[r++]=t,t+=n;return s},j.bind=function(t,e){if(t.bind===x&&x)return x.apply(t,a.call(arguments,1)); +var n=a.call(arguments,2);return function(){return t.apply(e,n.concat(a.call(arguments)))}},j.partial=function(t){var e=a.call(arguments,1);return function(){return t.apply(this,e.concat(a.call(arguments)))}},j.bindAll=function(t){var e=a.call(arguments,1);return 0===e.length&&(e=j.functions(t)),E(e,function(e){t[e]=j.bind(t[e],t)}),t},j.memoize=function(t,e){var n={};return e||(e=j.identity),function(){var i=e.apply(this,arguments);return j.has(n,i)?n[i]:n[i]=t.apply(this,arguments)}},j.delay=function(t,e){var n=a.call(arguments,2);return setTimeout(function(){return t.apply(null,n)},e)},j.defer=function(t){return j.delay.apply(j,[t,1].concat(a.call(arguments,1)))},j.throttle=function(t,e){var n,i,r,s,o=0,a=function(){o=new Date,r=null,s=t.apply(n,i)};return function(){var u=new Date,c=e-(u-o);return n=this,i=arguments,0>=c?(clearTimeout(r),r=null,o=u,s=t.apply(n,i)):r||(r=setTimeout(a,c)),s}},j.debounce=function(t,e,n){var i,r;return function(){var s=this,o=arguments,a=function(){i=null,n||(r=t.apply(s,o))},u=n&&!i;return clearTimeout(i),i=setTimeout(a,e),u&&(r=t.apply(s,o)),r}},j.once=function(t){var e,n=!1;return function(){return n?e:(n=!0,e=t.apply(this,arguments),t=null,e)}},j.wrap=function(t,e){return function(){var n=[t];return o.apply(n,arguments),e.apply(this,n)}},j.compose=function(){var t=arguments;return function(){for(var e=arguments,n=t.length-1;n>=0;n--)e=[t[n].apply(this,e)];return e[0]}},j.after=function(t,e){return 0>=t?e():function(){return 1>--t?e.apply(this,arguments):void 0}},j.keys=_||function(t){if(t!==Object(t))throw new TypeError("Invalid object");var e=[];for(var n in t)j.has(t,n)&&(e[e.length]=n);return e},j.values=function(t){var e=[];for(var n in t)j.has(t,n)&&e.push(t[n]);return e},j.pairs=function(t){var e=[];for(var n in t)j.has(t,n)&&e.push([n,t[n]]);return e},j.invert=function(t){var e={};for(var n in t)j.has(t,n)&&(e[t[n]]=n);return e},j.functions=j.methods=function(t){var e=[];for(var n in t)j.isFunction(t[n])&&e.push(n);return e.sort()},j.extend=function(t){return E(a.call(arguments,1),function(e){if(e)for(var n in e)t[n]=e[n]}),t},j.pick=function(t){var e={},n=u.apply(i,a.call(arguments,1));return E(n,function(n){n in t&&(e[n]=t[n])}),e},j.omit=function(t){var e={},n=u.apply(i,a.call(arguments,1));for(var r in t)j.contains(n,r)||(e[r]=t[r]);return e},j.defaults=function(t){return E(a.call(arguments,1),function(e){if(e)for(var n in e)null==t[n]&&(t[n]=e[n])}),t},j.clone=function(t){return j.isObject(t)?j.isArray(t)?t.slice():j.extend({},t):t},j.tap=function(t,e){return e(t),t};var M=function(t,e,n,i){if(t===e)return 0!==t||1/t==1/e;if(null==t||null==e)return t===e;t instanceof j&&(t=t._wrapped),e instanceof j&&(e=e._wrapped);var r=c.call(t);if(r!=c.call(e))return!1;switch(r){case"[object String]":return t==e+"";case"[object Number]":return t!=+t?e!=+e:0==t?1/t==1/e:t==+e;case"[object Date]":case"[object Boolean]":return+t==+e;case"[object RegExp]":return t.source==e.source&&t.global==e.global&&t.multiline==e.multiline&&t.ignoreCase==e.ignoreCase}if("object"!=typeof t||"object"!=typeof e)return!1;for(var s=n.length;s--;)if(n[s]==t)return i[s]==e;n.push(t),i.push(e);var o=0,a=!0;if("[object Array]"==r){if(o=t.length,a=o==e.length)for(;o--&&(a=M(t[o],e[o],n,i)););}else{var u=t.constructor,l=e.constructor;if(u!==l&&!(j.isFunction(u)&&u instanceof u&&j.isFunction(l)&&l instanceof l))return!1;for(var h in t)if(j.has(t,h)&&(o++,!(a=j.has(e,h)&&M(t[h],e[h],n,i))))break;if(a){for(h in e)if(j.has(e,h)&&!o--)break;a=!o}}return n.pop(),i.pop(),a};j.isEqual=function(t,e){return M(t,e,[],[])},j.isEmpty=function(t){if(null==t)return!0;if(j.isArray(t)||j.isString(t))return 0===t.length;for(var e in t)if(j.has(t,e))return!1;return!0},j.isElement=function(t){return!(!t||1!==t.nodeType)},j.isArray=y||function(t){return"[object Array]"==c.call(t)},j.isObject=function(t){return t===Object(t)},E(["Arguments","Function","String","Number","Date","RegExp"],function(t){j["is"+t]=function(e){return c.call(e)=="[object "+t+"]"}}),j.isArguments(arguments)||(j.isArguments=function(t){return!(!t||!j.has(t,"callee"))}),"function"!=typeof/./&&(j.isFunction=function(t){return"function"==typeof t}),j.isFinite=function(t){return isFinite(t)&&!isNaN(parseFloat(t))},j.isNaN=function(t){return j.isNumber(t)&&t!=+t},j.isBoolean=function(t){return t===!0||t===!1||"[object Boolean]"==c.call(t)},j.isNull=function(t){return null===t},j.isUndefined=function(t){return void 0===t},j.has=function(t,e){return l.call(t,e)},j.noConflict=function(){return t._=e,this},j.identity=function(t){return t},j.times=function(t,e,n){for(var i=Array(t),r=0;t>r;r++)i[r]=e.call(n,r);return i},j.random=function(t,e){return null==e&&(e=t,t=0),t+Math.floor(Math.random()*(e-t+1))};var A={escape:{"&":"&","<":"<",">":">",'"':""","'":"'","/":"/"}};A.unescape=j.invert(A.escape);var F={escape:RegExp("["+j.keys(A.escape).join("")+"]","g"),unescape:RegExp("("+j.keys(A.unescape).join("|")+")","g")};j.each(["escape","unescape"],function(t){j[t]=function(e){return null==e?"":(""+e).replace(F[t],function(e){return A[t][e]})}}),j.result=function(t,e){if(null==t)return null;var n=t[e];return j.isFunction(n)?n.call(t):n},j.mixin=function(t){E(j.functions(t),function(e){var n=j[e]=t[e];j.prototype[e]=function(){var t=[this._wrapped];return o.apply(t,arguments),S.call(this,n.apply(j,t))}})};var T=0;j.uniqueId=function(t){var e=++T+"";return t?t+e:e},j.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var R=/(.)^/,H={"'":"'","\\":"\\","\r":"r","\n":"n"," ":"t","\u2028":"u2028","\u2029":"u2029"},I=/\\|'|\r|\n|\t|\u2028|\u2029/g;j.template=function(t,e,n){var i;n=j.defaults({},n,j.templateSettings);var r=RegExp([(n.escape||R).source,(n.interpolate||R).source,(n.evaluate||R).source].join("|")+"|$","g"),s=0,o="__p+='";t.replace(r,function(e,n,i,r,a){return o+=t.slice(s,a).replace(I,function(t){return"\\"+H[t]}),n&&(o+="'+\n((__t=("+n+"))==null?'':_.escape(__t))+\n'"),i&&(o+="'+\n((__t=("+i+"))==null?'':__t)+\n'"),r&&(o+="';\n"+r+"\n__p+='"),s=a+e.length,e}),o+="';\n",n.variable||(o="with(obj||{}){\n"+o+"}\n"),o="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+o+"return __p;\n";try{i=Function(n.variable||"obj","_",o)}catch(a){throw a.source=o,a}if(e)return i(e,j);var u=function(t){return i.call(this,t,j)};return u.source="function("+(n.variable||"obj")+"){\n"+o+"}",u},j.chain=function(t){return j(t).chain()};var S=function(t){return this._chain?j(t).chain():t};j.mixin(j),E(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var e=i[t];j.prototype[t]=function(){var n=this._wrapped;return e.apply(n,arguments),"shift"!=t&&"splice"!=t||0!==n.length||delete n[0],S.call(this,n)}}),E(["concat","join","slice"],function(t){var e=i[t];j.prototype[t]=function(){return S.call(this,e.apply(this._wrapped,arguments))}}),j.extend(j.prototype,{chain:function(){return this._chain=!0,this},value:function(){return this._wrapped}})}.call(this),i("underscore",[],function(){}),i("ventus/wm/modes/expose",["underscore","ventus/core/promise"],function(t,e){"use strict";var n={register:function(){var e=this;console.log("Expose mode registered."),this.el.on("contextmenu",t.throttle(function(){return"expose"!==e.mode?e.windows.length>0&&(e.mode="expose"):"expose"===e.mode&&(e.mode="default"),!1},1e3))},plug:function(){var t,e,n,i,r=Math.floor,s=Math.ceil,o=this,a=s(this.windows.length/2),u=r(this.el.width()/a),c=r(this.el.height()/2);this.el.addClass("expose");for(var l,h=0,f=this.windows.length;f>h;h++){l=this.windows[h],l.stamp(),t=l.height>l.width?l.height>c?c/l.height:1:l.width>u?u/l.width:1,t-=.15,i={x:h%a*u,y:(a>h?0:1)*c},e=i.x+r((u-t*l.width)/2),n=i.y+r((c-t*l.height)/2),l.enabled=!1,l.movable=!1,l.el.addClass("exposing"),l.el.css("transform-origin","0 0"),l.el.css("transform","scale("+t+")"),l.el.css("top",n),l.el.css("left",e);var d=function(){l.el.removeClass("exposing")};l.animations?l.el.onTransitionEnd(d,this):d.call(this)}this.overlay=!0,this.el.one("click",function(){o.mode="default"})},unplug:function(){var t=new e;t.getFuture().then(function(){this.el.removeClass("expose")}.bind(this)),0===this.windows.length&&t.done();for(var n,i=this.windows.length;i--;){n=this.windows[i],n.restore(),n.el.css("transform","scale(1)"),n.el.css("transform-origin","50% 50%");var r=function(e,n){return function(){0===n&&t.done(),e.el.css("transform","")}}(n,i);n.animations?this.el.onTransitionEnd(r,this):r.call(this),n.movable=!0,n.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return n}),i("ventus/wm/modes/fullscreen",[],function(){"use strict";var t={register:function(){console.log("Fullscreen mode registered.")},plug:function(){this.el.addClass("fullscreen");for(var t,e=0,n=this.windows.length;n>e;e++)t=this.windows[e],t.move(0,0),t.el.css("-webkit-transform","translate3d(0, 0, 0);"),t.resize(this.el.width(),this.el.height())},unplug:function(){for(var t,e=this.windows.length;e--;){t=this.windows[e],t.restore(),t.el.css("transform","scale(1)"),t.el.css("transform-origin","50% 50%");var n=function(t){return function(){this.el.removeClass("fullscreen"),t.el.css("transform","")}}(t);this.el.onTransitionEnd(n,this),t.movable=!0,t.resizable=!0,t.enabled=!0}this.overlay=!1},actions:{focus:function(){},close:function(){this.mode="expose"},select:function(t){this.mode="default",t.focus()}}};return t}),i("ventus/wm/windowmanager",["$","ventus/wm/window","ventus/core/view","ventus/wm/modes/default","ventus/wm/modes/expose","ventus/wm/modes/fullscreen"],function(t,e,n,i,r,s){"use strict";var o=function(){var e;this.el=n('
'),t(document.body).prepend(this.el),this.$overlay=this.el.find(".wm-overlay"),this.$overlay.css("z-index",this._baseZ-1),this.actions.forEach(function(t){this[t]=function(t){return function(){this.currentMode.actions[t]&&this.currentMode.actions[t].apply(this,arguments)}}.call(this,t)},this);for(var i in this.modes)this.modes.hasOwnProperty(i)&&this.modes[i].register&&this.modes[i].register.apply(this);this.windows=[],this.active=null,this.mode="default",e=this.createWindow,this.createWindow=e.bind(this),this.createWindow.fromQuery=e.fromQuery.bind(this),this.createWindow.fromElement=e.fromElement.bind(this)};return o.prototype={actions:["focus","blur","close","maximize","minimize","restore","select"],modes:{"default":i,expose:r,fullscreen:s},set mode(t){var e=this.modes[t];e&&this._mode!==t&&(this._mode&&this.currentMode.unplug&&this.currentMode.unplug.apply(this),e.plug&&e.plug.apply(this),this._mode=t)},get mode(){return this._mode},get currentMode(){return this.modes[this._mode]},set overlay(t){this.$overlay.css("opacity",t?.8:0),this._overlay=t},get overlay(){return this._overlay},createWindow:function(t){var n=new e(t);return this.mode="default",n.signals.on("focus",this._focus,this),n.signals.on("blur",this._blur,this),n.signals.on("close",this._close,this),this.actions.forEach(function(t){n.signals.on(t,this[t],this)},this),this.windows.push(n),n.space=this.el,n.focus(),n},_focus:function(t){var e,n,i=1e4,r=i+1e4;if(!this.active||this.active!==t){if(this.active?(e=this.active.z,this.active.blur()):e=i,n=this.windows.indexOf(t),this.windows.splice(n,1),this.windows.push(t),t.z=e+1,e>r+this.windows.length)for(var s,o=this.windows.length;o--;)s=this.windows[o].z,this.windows[o].z=i+(s-r);this.active=t}},_blur:function(t){this.active===t&&(this.active=null)},_close:function(t){var e,n=this.windows.indexOf(t);return-1===n?void console.log("Trying to close a window that doesn't exist in this window manager"):(this.windows.splice(n,1),e=this.windows.length,void(this.active&&this.active===t&&(this.active=0!==e?this.windows[e-1]:null,this.active&&this.active.focus())))}},o.prototype.createWindow.fromQuery=function(t,e){return e.content=n(t),this.createWindow(e)},o.prototype.createWindow.fromElement=function(t,e){return e.content=n(t),this.createWindow(e)},o}),i("ventus",["require","exports","module","ventus/wm/windowmanager","ventus/wm/window"],function(t){"use strict";return{version:"0.2",browser:{animationEventName:function(){var t=document.body.style,e=null;return""===t.animation?e="animationend":""===t.MozAnimation?e="mozAnimationEnd":""===t.webkitAnimation&&(e="webkitAnimationEnd"),e}},WindowManager:t("ventus/wm/windowmanager"),Window:t("ventus/wm/window")}}),i("src/main",["almond","handlebars","ventus"],function(){}),i("$",function(){return t}),i("underscore",function(){return _}),n("ventus")}); \ No newline at end of file diff --git a/src/ventus/wm/window.js b/src/ventus/wm/window.js index 7a8ff70..ae7cf75 100644 --- a/src/ventus/wm/window.js +++ b/src/ventus/wm/window.js @@ -111,7 +111,7 @@ function(Emitter, Promise, View, WindowTemplate) { _restore: null, _moving: null, _resizing: null, - _resizeDirection: null, + _mouseEdgePosition: null, slots: { move: function(e) { @@ -146,7 +146,8 @@ function(Emitter, Promise, View, WindowTemplate) { this.slots.move.call(this, e); } - if(this.enabled && this.resizable && this._resizeDirectionState().any) { + if(this.enabled && this.resizable && + !this.maximized && this.mouseOnWindowEdge) { this.startResize(e); } }, @@ -158,7 +159,7 @@ function(Emitter, Promise, View, WindowTemplate) { }, '.wm-window-title mousedown': function(e) { - if(!this.maximized && !this._resizeDirectionState().any) { + if(!this.maximized && !this.mouseOnWindowEdge) { this.slots.move.call(this, e); } }, @@ -205,7 +206,7 @@ function(Emitter, Promise, View, WindowTemplate) { 'button.wm-resize mousedown': function(e) { if(this.enabled && this.resizable) { - this._resizeDirection = { + this._mouseEdgePosition = { top: false, left: false, bottom: true, @@ -219,7 +220,7 @@ function(Emitter, Promise, View, WindowTemplate) { 'mousemove': function(e) { var EdgeSensitivities = { TOP: 5, // lower because bar is used to drag - LEFT: 10, + LEFT: 15, BOTTOM: 15, RIGHT: 15 }; @@ -233,7 +234,7 @@ function(Emitter, Promise, View, WindowTemplate) { // top can be triggered from wm-content, but should only be triggered by wm-window // otherwise you get resize event from top of content - this._resizeDirection = { + this._mouseEdgePosition = { top: !e.srcElement.classList.contains('wm-content') && event.offsetY < EdgeSensitivities.TOP, left: event.offsetX < EdgeSensitivities.LEFT, @@ -247,22 +248,19 @@ function(Emitter, Promise, View, WindowTemplate) { 'mouse-edge-bottom', 'mouse-edge-bottom-left', 'mouse-edge-bottom-right' ); - if(this._resizeDirectionState().any) { + if(this.mouseOnWindowEdge) { var className = 'mouse-edge'; - window.counter = window.counter || 0; - if(this._resizeDirection.top) { - window.counter++; - console.log('top', window.counter); + if(this._mouseEdgePosition.top) { className += '-top'; } - else if(this._resizeDirection.bottom) { + else if(this._mouseEdgePosition.bottom) { className += '-bottom'; } - if(this._resizeDirection.left) { + if(this._mouseEdgePosition.left) { className += '-left'; } - else if(this._resizeDirection.right) { + else if(this._mouseEdgePosition.right) { className += '-right'; } @@ -272,7 +270,7 @@ function(Emitter, Promise, View, WindowTemplate) { 'mouseleave': function() { if(!this._resizing) { - this._resizeDirection = null; + this._mouseEdgePosition = null; this.el[0].classList.remove('mouse-edge', 'mouse-edge-top', 'mouse-edge-top-left', 'mouse-edge-top-right', 'mouse-edge-left', 'mouse-edge-right', @@ -327,10 +325,10 @@ function(Emitter, Promise, View, WindowTemplate) { if(this._resizing) { var newWidth; - if(!this._resizeDirectionState().horizontal) { + if(!this.resizingHorizontally) { newWidth = this.width; } - else if(this._resizeDirection.left) { + else if(this._mouseEdgePosition.left) { newWidth = this._resizing.pageX - event.pageX + this._resizing.width; } else { @@ -338,10 +336,10 @@ function(Emitter, Promise, View, WindowTemplate) { } var newHeight; - if(!this._resizeDirectionState().vertical) { + if(!this.resizingVertically) { newHeight = this.height; } - else if(this._resizeDirection.top) { + else if(this._mouseEdgePosition.top) { newHeight = this._resizing.pageY - event.pageY + this._resizing.height; } else { @@ -350,11 +348,11 @@ function(Emitter, Promise, View, WindowTemplate) { this.resize(newWidth, newHeight); - if(this._resizeDirection.left) { + if(this._mouseEdgePosition.left) { this.move(event.pageX, this.y); } - if(this._resizeDirection.top) { + if(this._mouseEdgePosition.top) { this.move(this.x, event.pageY); } } @@ -380,16 +378,20 @@ function(Emitter, Promise, View, WindowTemplate) { this._resizing = null; }, - _resizeDirectionState: function() { - return { - any: this._resizeDirection && - (this._resizeDirection.top || this._resizeDirection.left || - this._resizeDirection.bottom || this._resizeDirection.right), - horizontal: this._resizeDirection && - (this._resizeDirection.left || this._resizeDirection.right), - vertical: this._resizeDirection && - (this._resizeDirection.top || this._resizeDirection.bottom) - }; + get mouseOnWindowEdge() { + return this._mouseEdgePosition && + (this._mouseEdgePosition.top || this._mouseEdgePosition.left || + this._mouseEdgePosition.bottom || this._mouseEdgePosition.right); + }, + + get resizingHorizontally() { + return this._mouseEdgePosition && + (this._mouseEdgePosition.left || this._mouseEdgePosition.right); + }, + + get resizingVertically() { + return this._mouseEdgePosition && + (this._mouseEdgePosition.top || this._mouseEdgePosition.bottom); }, set space(el) {