yano-backbone-rails 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1 +1,11 @@
1
- 404: Not Found
1
+ // MarionetteJS (Backbone.Marionette)
2
+ // ----------------------------------
3
+ // v3.0.0
4
+ //
5
+ // Copyright (c)2016 Derick Bailey, Muted Solutions, LLC.
6
+ // Distributed under MIT license
7
+ //
8
+ // http://marionettejs.com
9
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t(require("backbone"),require("underscore"),require("backbone.radio")):"function"==typeof define&&define.amd?define(["backbone","underscore","backbone.radio"],t):e.Marionette=e.Mn=t(e.Backbone,e._,e.Backbone.Radio)}(this,function(e,t,i){"use strict";function n(e,t,i){return i.toUpperCase()}function r(e){for(var i="on"+e.replace(k,n),r=D.call(this,i),s=void 0,o=arguments.length,h=Array(o>1?o-1:0),d=1;d<o;d++)h[d-1]=arguments[d];return t.isFunction(r)&&(s=r.apply(this,h)),this.trigger.apply(this,[e].concat(h)),s}function s(e){for(var i=t.isFunction(e.triggerMethod)?e.triggerMethod:r,n=arguments.length,s=Array(n>1?n-1:0),o=1;o<n;o++)s[o-1]=arguments[o];return i.apply(e,s)}function o(e,i,n){e._getImmediateChildren&&t.each(e._getImmediateChildren(),function(e){n(e)&&s(e,i,e)})}function h(e){return!e._isAttached}function d(e){return!!h(e)&&(e._isAttached=!0,!0)}function a(e){return e._isAttached}function l(e){return!!a(e)&&(e._isAttached=!1,!0)}function c(e){function t(){o(e,"before:attach",h)}function i(){o(e,"attach",d),u()}function n(){o(e,"before:detach",a)}function r(){o(e,"detach",l)}function c(){u()}function u(){e._isAttached&&e._isRendered&&s(e,"dom:refresh",e)}e._areViewEventsMonitored||(e._areViewEventsMonitored=!0,e.on({"before:attach":t,attach:i,"before:detach":n,detach:r,render:c}))}function u(e,i,n,r,s){var o=r.split(/\s+/);t.each(o,function(t){var r=e[t];if(!r)throw new F('Method "'+t+'" was configured as an event handler, but does not exist.');e[s](i,n,r)})}function f(e,i,n,r){if(i&&n){if(!t.isObject(n))throw new F({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindevents"});t.each(n,function(n,s){return t.isString(n)?void u(e,i,s,n,r):void e[r](i,s,n)})}}function g(e,t){return f(this,e,t,"listenTo"),this}function p(e,t){return f(this,e,t,"stopListening"),this}function v(e,i,n,r){if(i&&n){if(!t.isObject(n))throw new F({message:"Bindings must be an object.",url:"marionette.functions.html#marionettebindrequests"});var s=U.call(e,n);i[r](s,e)}}function _(e,t){return v(this,e,t,"reply"),this}function m(e,t){return v(this,e,t,"stopReplying"),this}function y(e,i){return e.behaviorClass?e.behaviorClass:t.isFunction(e)?e:t.isFunction(Ce.Behaviors.behaviorsLookup)?Ce.Behaviors.behaviorsLookup(e,i)[i]:Ce.Behaviors.behaviorsLookup[i]}function w(e,i){return t.chain(i).map(function(i,n){var r=y(i,n),s=i===r?{}:i,o=new r(s,e),h=w(e,t.result(o,"behaviors"));return[o].concat(h)}).flatten().value()}function E(e,i){return[e+t.uniqueId(".evt"),i].join(" ")}function b(e,i){t.isString(i)&&(i={event:i});var n=i.event,r=i.preventDefault!==!1,s=i.stopPropagation!==!1;return function(t){r&&t.preventDefault(),s&&t.stopPropagation(),e.triggerMethod(n,e)}}function V(e){e.supportsDestroyLifecycle||s(e,"before:destroy",e);var t=!!e._isAttached;t&&s(e,"before:detach",e),e.remove(),t&&(e._isAttached=!1,s(e,"detach",e)),e._isDestroyed=!0,e.supportsDestroyLifecycle||s(e,"destroy",e)}function C(){throw new F({message:"You must define where your behaviors are stored.",url:"marionette.behaviors.md#behaviorslookup"})}function R(e){return!!be[e]}function M(e,t){return be[e]=t}e="default"in e?e.default:e,t="default"in t?t.default:t,i="default"in i?i.default:i;var x="3.0.0",B=function(e){return function(t){for(var i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return e.apply(t,n)}},I=e.Model.extend,A=function e(i,n){t.isObject(i)&&(i=i.prev+" is going to be removed in the future. Please use "+i.next+" instead."+(i.url?" See: "+i.url:"")),Ce.DEV_MODE&&(void 0!==n&&n||e._cache[i]||(e._warn("Deprecation warning: "+i),e._cache[i]=!0))};A._console="undefined"!=typeof console?console:{},A._warn=function(){var e=A._console.warn||A._console.log||t.noop;return e.apply(A._console,arguments)},A._cache={};var O=function(t){return e.$.contains(document.documentElement,t)},T=function(e,i){e&&t.extend(this,t.pick(e,i))},D=function(e){if(e)return this.options&&void 0!==this.options[e]?this.options[e]:this[e]},U=function(e){var i=this;return t.reduce(e,function(e,n,r){return t.isFunction(n)||(n=i[n]),n&&(e[r]=n),e},{})},k=/(^|:)(\w)/gi,$=["description","fileName","lineNumber","name","message","number"],F=I.call(Error,{urlRoot:"http://marionettejs.com/docs/v"+x+"/",constructor:function(e,i){t.isObject(e)?(i=e,e=i.message):i||(i={});var n=Error.call(this,e);t.extend(this,t.pick(n,$),t.pick(i,$)),this.captureStackTrace(),i.url&&(this.url=this.urlRoot+i.url)},captureStackTrace:function(){Error.captureStackTrace&&Error.captureStackTrace(this,F)},toString:function(){return this.name+": "+this.message+(this.url?" See: "+this.url:"")}});F.extend=I;var S=function(){for(var e=arguments.length,i=Array(e),n=0;n<e;n++)i[n]=arguments[n];this.options=t.extend.apply(t,[{},t.result(this,"options")].concat(i))},z={normalizeMethods:U,_setOptions:S,mergeOptions:T,getOption:D,bindEvents:g,unbindEvents:p},L={_initRadio:function(){var e=t.result(this,"channelName");if(e){if(!i)throw new F({name:"BackboneRadioMissing",message:'The dependency "backbone.radio" is missing.'});var n=this._channel=i.channel(e),r=t.result(this,"radioEvents");this.bindEvents(n,r);var s=t.result(this,"radioRequests");this.bindRequests(n,s),this.on("destroy",this._destroyRadio)}},_destroyRadio:function(){this._channel.stopReplying(null,null,this)},getChannel:function(){return this._channel},bindEvents:g,unbindEvents:p,bindRequests:_,unbindRequests:m},P=["channelName","radioEvents","radioRequests"],j=function(e){this._setOptions(e),this.mergeOptions(e,P),this.cid=t.uniqueId(this.cidPrefix),this._initRadio(),this.initialize.apply(this,arguments)};j.extend=I,t.extend(j.prototype,e.Events,z,L,{cidPrefix:"mno",_isDestroyed:!1,isDestroyed:function(){return this._isDestroyed},initialize:function(){},destroy:function(){if(this._isDestroyed)return this;for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];return this.triggerMethod.apply(this,["before:destroy",this].concat(t)),this._isDestroyed=!0,this.triggerMethod.apply(this,["destroy",this].concat(t)),this.stopListening(),this},triggerMethod:r});var q=function(e){this.templateId=e};t.extend(q,{templateCaches:{},get:function(e,t){var i=this.templateCaches[e];return i||(i=new q(e),this.templateCaches[e]=i),i.load(t)},clear:function(){for(var e=void 0,t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];var r=i.length;if(r>0)for(e=0;e<r;e++)delete this.templateCaches[i[e]];else this.templateCaches={}}}),t.extend(q.prototype,{load:function(e){if(this.compiledTemplate)return this.compiledTemplate;var t=this.loadTemplate(this.templateId,e);return this.compiledTemplate=this.compileTemplate(t,e),this.compiledTemplate},loadTemplate:function(t,i){var n=e.$(t);if(!n.length)throw new F({name:"NoTemplateError",message:'Could not find template: "'+t+'"'});return n.html()},compileTemplate:function(e,i){return t.template(e,i)}});var N=t.invokeMap||t.invoke,H=function(e){if(Array.isArray(e)){for(var t=0,i=Array(e.length);t<e.length;t++)i[t]=e[t];return i}return Array.from(e)},K={_initBehaviors:function(){var e=t.result(this,"behaviors");this._behaviors=t.isObject(e)?w(this,e):{}},_getBehaviorTriggers:function(){var e=N(this._behaviors,"getTriggers");return t.extend.apply(t,[{}].concat(H(e)))},_getBehaviorEvents:function(){var e=N(this._behaviors,"getEvents");return t.extend.apply(t,[{}].concat(H(e)))},_proxyBehaviorViewProperties:function(){N(this._behaviors,"proxyViewProperties")},_delegateBehaviorEntityEvents:function(){N(this._behaviors,"delegateEntityEvents")},_undelegateBehaviorEntityEvents:function(){N(this._behaviors,"undelegateEntityEvents")},_destroyBehaviors:function(e){N.apply(void 0,[this._behaviors,"destroy"].concat(H(e)))},_bindBehaviorUIElements:function(){N(this._behaviors,"bindUIElements")},_unbindBehaviorUIElements:function(){N(this._behaviors,"unbindUIElements")},_triggerEventOnBehaviors:function(){for(var e=this._behaviors,t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];for(var s=0,o=e&&e.length;s<o;s++)r.apply(e[s],i)}},Y={_delegateEntityEvents:function(e,i){this._undelegateEntityEvents(e,i);var n=t.result(this,"modelEvents");g.call(this,e,n);var r=t.result(this,"collectionEvents");g.call(this,i,r)},_undelegateEntityEvents:function(e,i){var n=t.result(this,"modelEvents");p.call(this,e,n);var r=t.result(this,"collectionEvents");p.call(this,i,r)}},Z=/^(\S+)\s*(.*)$/,G=function(e){var t=e.match(Z);return E(t[1],t[2])},J={_getViewTriggers:function(e,i){return t.reduce(i,function(t,i,n){return n=G(n),t[n]=b(e,i),t},{})}},Q=function(e,i){return t.reduce(e,function(e,t,n){var r=W(n,i);return e[r]=t,e},{})},W=function(e,t){return e.replace(/@ui\.[a-zA-Z-_$0-9]*/g,function(e){return t[e.slice(4)]})},X=function e(i,n,r){return t.each(i,function(s,o){t.isString(s)?i[o]=W(s,n):t.isObject(s)&&t.isArray(r)&&(t.extend(s,e(t.pick(s,r),n)),t.each(r,function(e){var i=s[e];t.isString(i)&&(s[e]=W(i,n))}))}),i},ee={normalizeUIKeys:function(e){var t=this._getUIBindings();return Q(e,t)},normalizeUIValues:function(e,t){var i=this._getUIBindings();return X(e,i,t)},_getUIBindings:function(){var e=t.result(this,"_uiBindings"),i=t.result(this,"ui");return e||i},_bindUIElements:function(){var e=this;if(this.ui){this._uiBindings||(this._uiBindings=this.ui);var i=t.result(this,"_uiBindings");this._ui={},t.each(i,function(t,i){e._ui[i]=e.$(t)}),this.ui=this._ui}},_unbindUIElements:function(){var e=this;this.ui&&this._uiBindings&&(t.each(this.ui,function(t,i){delete e.ui[i]}),this.ui=this._uiBindings,delete this._uiBindings,delete this._ui)},_getUI:function(e){return this._ui[e]}},te={supportsRenderLifecycle:!0,supportsDestroyLifecycle:!0,_isDestroyed:!1,isDestroyed:function(){return!!this._isDestroyed},_isRendered:!1,isRendered:function(){return!!this._isRendered},_isAttached:!1,isAttached:function(){return!!this._isAttached},setElement:function(){var t=!!this.el;return e.View.prototype.setElement.apply(this,arguments),t&&(this._isRendered=!!this.$el.length,this._isAttached=O(this.el)),this},delegateEvents:function(i){this._proxyBehaviorViewProperties(),this._buildEventProxies();var n=this._getEvents(i);"undefined"==typeof i&&(this.events=n);var r=t.extend({},this._getBehaviorEvents(),n,this._getBehaviorTriggers(),this.getTriggers());return e.View.prototype.delegateEvents.call(this,r),this},_getEvents:function(e){var i=e||this.events;return t.isFunction(i)?this.normalizeUIKeys(i.call(this)):this.normalizeUIKeys(i)},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this,e)}},delegateEntityEvents:function(){return this._delegateEntityEvents(this.model,this.collection),this._delegateBehaviorEntityEvents(),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.model,this.collection),this._undelegateBehaviorEntityEvents(),this},_ensureViewIsIntact:function(){if(this._isDestroyed)throw new F({name:"ViewDestroyedError",message:'View (cid: "'+this.cid+'") has already been destroyed and cannot be used.'})},destroy:function(){if(this._isDestroyed)return this;for(var e=!!this._isAttached,t=arguments.length,i=Array(t),n=0;n<t;n++)i[n]=arguments[n];return this.triggerMethod.apply(this,["before:destroy",this].concat(i)),e&&this.triggerMethod("before:detach",this),this.unbindUIElements(),this._removeElement(),e&&(this._isAttached=!1,this.triggerMethod("detach",this)),this._removeChildren(),this._destroyBehaviors(i),this._isDestroyed=!0,this._isRendered=!1,this.triggerMethod.apply(this,["destroy",this].concat(i)),this.stopListening(),this},bindUIElements:function(){return this._bindUIElements(),this._bindBehaviorUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this._unbindBehaviorUIElements(),this},getUI:function(e){return this._ensureViewIsIntact(),this._getUI(e)},childViewEventPrefix:"childview",triggerMethod:function(){for(var e=arguments.length,t=Array(e),i=0;i<e;i++)t[i]=arguments[i];var n=r.apply(this,t);return this._triggerEventOnBehaviors.apply(this,t),this._triggerEventOnParentLayout.apply(this,t),n},_buildEventProxies:function(){this._childViewEvents=t.result(this,"childViewEvents"),this._childViewTriggers=t.result(this,"childViewTriggers")},_triggerEventOnParentLayout:function(e){var i=this._parentView();if(i){for(var n=t.result(i,"childViewEventPrefix"),r=n+":"+e,s=arguments.length,o=Array(s>1?s-1:0),h=1;h<s;h++)o[h-1]=arguments[h];i.triggerMethod.apply(i,[r].concat(o));var d=i.normalizeMethods(i._childViewEvents);d&&t.isFunction(d[e])&&d[e].apply(i,o);var a=i._childViewTriggers;a&&t.isString(a[e])&&i.triggerMethod.apply(i,[a[e]].concat(o))}},_parentView:function(){for(var e=this._parent;e;){if(e instanceof he)return e;e=e._parent}}};t.extend(te,K,z,Y,J,ee);var ie=["allowMissingEl","parentEl","replaceElement"],ne=j.extend({cidPrefix:"mnr",replaceElement:!1,_isReplaced:!1,constructor:function(t){if(this._setOptions(t),this.mergeOptions(t,ie),this._initEl=this.el=this.getOption("el"),this.el=this.el instanceof e.$?this.el[0]:this.el,!this.el)throw new F({name:"NoElError",message:'An "el" must be specified for a region.'});this.$el=this.getEl(this.el),j.call(this,t)},show:function(e,t){if(this._ensureElement(t))return this._ensureView(e),e===this.currentView?this:(this.triggerMethod("before:show",this,e,t),c(e),this.empty(t),e.on("destroy",this.empty,this),e._parent=this,this._renderView(e),this._attachView(e,t),this.triggerMethod("show",this,e,t),this)},_renderView:function(e){e._isRendered||(e.supportsRenderLifecycle||s(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,s(e,"render",e)))},_attachView:function(e){var i=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],n=!e._isAttached&&O(this.el),r="undefined"==typeof i.replaceElement?!!t.result(this,"replaceElement"):!!i.replaceElement;n&&s(e,"before:attach",e),this.attachHtml(e,r),n&&(e._isAttached=!0,s(e,"attach",e)),this.currentView=e},_ensureElement:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0];if(t.isObject(this.el)||(this.$el=this.getEl(this.el),this.el=this.$el[0]),!this.$el||0===this.$el.length){var i="undefined"==typeof e.allowMissingEl?!!t.result(this,"allowMissingEl"):!!e.allowMissingEl;if(i)return!1;throw new F('An "el" must exist in DOM for this region '+this.cid)}return!0},_ensureView:function(e){if(!e)throw new F({name:"ViewNotValid",message:"The view passed is undefined and therefore invalid. You must pass a view instance to show."});if(e._isDestroyed)throw new F({name:"ViewDestroyedError",message:'View (cid: "'+e.cid+'") has already been destroyed and cannot be used.'})},getEl:function(i){return e.$(i,t.result(this,"parentEl"))},_replaceEl:function(e){this._restoreEl();var t=this.el.parentNode;t.replaceChild(e.el,this.el),this._isReplaced=!0},_restoreEl:function(){if(this._isReplaced){var e=this.currentView;if(e){var t=e.el.parentNode;t&&(t.replaceChild(this.el,e.el),this._isReplaced=!1)}}},isReplaced:function(){return!!this._isReplaced},attachHtml:function(e,t){t?this._replaceEl(e):this.el.appendChild(e.el)},empty:function(){var e=arguments.length<=0||void 0===arguments[0]?{allowMissingEl:!0}:arguments[0],t=this.currentView;return t?(t.off("destroy",this.empty,this),this.triggerMethod("before:empty",this,t),this._restoreEl(),delete this.currentView,t._isDestroyed||(this._removeView(t,e),delete t._parent),this.triggerMethod("empty",this,t),this):(this._ensureElement(e)&&this.detachHtml(),this)},_removeView:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.preventDestroy,n=!!i;return n?void this._detachView(e):void(e.destroy?e.destroy():V(e))},_detachView:function(e){var t=!!e._isAttached;t&&s(e,"before:detach",e),this.detachHtml(),t&&(e._isAttached=!1,s(e,"detach",e))},detachHtml:function(){this.$el.contents().detach()},hasView:function(){return!!this.currentView},reset:function(e){return this.empty(e),this.$el&&(this.el=this._initEl),delete this.$el,this},destroy:function(e){return this.reset(e),j.prototype.destroy.apply(this,arguments)}}),re={regionClass:ne,_initRegions:function(){this.regions=this.regions||{},this._regions={},this.addRegions(t.result(this,"regions"))},_reInitRegions:function(){N(this._regions,"reset")},addRegion:function(e,t){var i={};return i[e]=t,this.addRegions(i)[e]},addRegions:function(e){if(!t.isEmpty(e))return e=this.normalizeUIValues(e,["selector","el"]),this.regions=t.extend({},this.regions,e),this._addRegions(e)},_addRegions:function(e){var i=this;return t.reduce(e,function(e,t,n){return e[n]=i._buildRegion(t),i._addRegion(e[n],n),e},{})},_buildRegion:function(e){return e instanceof ne?e:this._buildRegionFromDefinition(e)},_buildRegionFromDefinition:function(e){if(t.isString(e))return this._buildRegionFromObject({el:e});if(t.isFunction(e))return this._buildRegionFromRegionClass(e);if(t.isObject(e))return this._buildRegionFromObject(e);throw new F({message:"Improper region configuration type.",url:"marionette.region.html#region-configuration-types"})},_buildRegionFromObject:function(e){var i=e.regionClass||this.regionClass,n=t.omit(e,"regionClass");return t.defaults(n,{el:e.selector,parentEl:t.partial(t.result,this,"el")}),new i(n)},_buildRegionFromRegionClass:function(e){return new e({parentEl:t.partial(t.result,this,"el")})},_addRegion:function(e,t){this.triggerMethod("before:add:region",this,t,e),e._parent=this,this._regions[t]=e,this.triggerMethod("add:region",this,t,e)},removeRegion:function(e){var t=this._regions[e];return this._removeRegion(t,e),t},removeRegions:function(){var e=this.getRegions();return t.each(this._regions,t.bind(this._removeRegion,this)),e},_removeRegion:function(e,t){this.triggerMethod("before:remove:region",this,t,e),e.empty(),e.stopListening(),delete this.regions[t],delete this._regions[t],this.triggerMethod("remove:region",this,t,e)},emptyRegions:function(){var e=this.getRegions();return N(e,"empty"),e},hasRegion:function(e){return!!this.getRegion(e)},getRegion:function(e){return this._regions[e]},getRegions:function(){return t.clone(this._regions)},showChildView:function(e,t){for(var i=this.getRegion(e),n=arguments.length,r=Array(n>2?n-2:0),s=2;s<n;s++)r[s-2]=arguments[s];return i.show.apply(i,[t].concat(r))},getChildView:function(e){return this.getRegion(e).currentView}},se={render:function(e,i){if(!e)throw new F({name:"TemplateNotFoundError",message:"Cannot render the template since its false, null or undefined."});var n=t.isFunction(e)?e:q.get(e);return n(i)}},oe=["behaviors","childViewEventPrefix","childViewEvents","childViewTriggers","collectionEvents","events","modelEvents","regionClass","regions","template","templateContext","triggers","ui"],he=e.View.extend({constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,oe),c(this),this._initBehaviors(),this._initRegions();var n=Array.prototype.slice.call(arguments);n[0]=this.options,e.View.prototype.constructor.apply(this,n),this.delegateEntityEvents()},serializeData:function(){return this.model||this.collection?this.model?this.serializeModel():{items:this.serializeCollection()}:{}},serializeModel:function(){return this.model?t.clone(this.model.attributes):{}},serializeCollection:function(){return this.collection?this.collection.map(function(e){return t.clone(e.attributes)}):{}},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._isRendered&&this._reInitRegions(),this._renderTemplate(),this.bindUIElements(),this._isRendered=!0,this.triggerMethod("render",this),this},_renderTemplate:function(){var e=this.getTemplate();if(e!==!1){var t=this.mixinTemplateContext(this.serializeData()),i=se.render(e,t,this);this.attachElContent(i)}},getTemplate:function(){return this.template},mixinTemplateContext:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],i=t.result(this,"templateContext");return t.extend(e,i)},attachElContent:function(e){return this.$el.html(e),this},_removeChildren:function(){this.removeRegions()},_getImmediateChildren:function(){return t.chain(this.getRegions()).map("currentView").compact().value()}});t.extend(he.prototype,te,re);var de=["forEach","each","map","find","detect","filter","select","reject","every","all","some","any","include","contains","invoke","toArray","first","initial","rest","last","without","isEmpty","pluck","reduce"],ae=function(e,i){t.each(de,function(n){e[n]=function(){var e=t.values(t.result(this,i)),r=[e].concat(t.toArray(arguments));return t[n].apply(t,r)}})},le=function(e){this._views={},this._indexByModel={},this._indexByCustom={},this._updateLength(),t.each(e,t.bind(this.add,this))};ae(le.prototype,"_views"),t.extend(le.prototype,{add:function(e,t){return this._add(e,t)._updateLength()},_add:function(e,t){var i=e.cid;return this._views[i]=e,e.model&&(this._indexByModel[e.model.cid]=i),t&&(this._indexByCustom[t]=i),this},findByModel:function(e){return this.findByModelCid(e.cid)},findByModelCid:function(e){var t=this._indexByModel[e];return this.findByCid(t)},findByCustom:function(e){var t=this._indexByCustom[e];return this.findByCid(t)},findByIndex:function(e){return t.values(this._views)[e]},findByCid:function(e){return this._views[e]},remove:function(e){return this._remove(e)._updateLength()},_remove:function(e){var i=e.cid;return e.model&&delete this._indexByModel[e.model.cid],t.some(this._indexByCustom,t.bind(function(e,t){if(e===i)return delete this._indexByCustom[t],!0},this)),delete this._views[i],this},_updateLength:function(){return this.length=t.size(this._views),this}});var ce=["behaviors","childView","childViewEventPrefix","childViewEvents","childViewOptions","childViewTriggers","collectionEvents","events","filter","emptyView","emptyViewOptions","modelEvents","reorderOnSort","sort","triggers","ui","viewComparator"],ue=e.View.extend({sort:!0,constructor:function(i){this.render=t.bind(this.render,this),this._setOptions(i),this.mergeOptions(i,ce),c(this),this._initBehaviors(),this.once("render",this._initialEvents),this._initChildViewStorage(),this._bufferedChildren=[];var n=Array.prototype.slice.call(arguments);n[0]=this.options,e.View.prototype.constructor.apply(this,n),this.delegateEntityEvents()},_startBuffering:function(){this._isBuffering=!0},_endBuffering:function(){var e=!!this._isAttached,i=e?this._getImmediateChildren():[];this._isBuffering=!1,t.each(i,function(e){s(e,"before:attach",e)}),this.attachBuffer(this,this._createBuffer()),t.each(i,function(e){e._isAttached=!0,s(e,"attach",e)}),this._bufferedChildren=[]},_getImmediateChildren:function(){return t.values(this.children._views)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.render),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_onCollectionAdd:function(e,i,n){var r=void 0!==n.at&&(n.index||i.indexOf(e));if((this.filter||r===!1)&&(r=t.indexOf(this._filteredSortedModels(r),e)),this._shouldAddChild(e,r)){this._destroyEmptyView();var s=this._getChildView(e);this._addChild(e,s,r)}},_onCollectionRemove:function(e){var t=this.children.findByModel(e);this.removeChildView(t),this._checkEmpty()},render:function(){return this._ensureViewIsIntact(),this.triggerMethod("before:render",this),this._renderChildren(),this._isRendered=!0,this.triggerMethod("render",this),this},setFilter:function(e){var t=arguments.length<=1||void 0===arguments[1]?{}:arguments[1],i=t.preventRender,n=this._isRendered&&!this._isDestroyed,r=this.filter!==e,s=n&&r&&!i;if(s){var o=this._filteredSortedModels();this.filter=e;var h=this._filteredSortedModels();this._applyModelDeltas(h,o)}else this.filter=e;return this},removeFilter:function(e){return this.setFilter(null,e)},_applyModelDeltas:function(e,i){var n=this,r={};t.each(e,function(e,t){var i=!n.children.findByModel(e);i&&n._onCollectionAdd(e,n.collection,{at:t}),r[e.cid]=!0}),t.each(i,function(e){var t=!r[e.cid]&&n.children.findByModel(e);t&&n._onCollectionRemove(e)})},reorder:function(){var e=this,i=this.children,n=this._filteredSortedModels();if(!n.length&&this._showingEmptyView)return this;var r=t.some(n,function(e){return!i.findByModel(e)});return r?this.render():!function(){var r=t.map(n,function(e,t){var n=i.findByModel(e);return n._index=t,n.el}),s=i.filter(function(e){return!t.contains(r,e.el)});e.triggerMethod("before:reorder",e),e._appendReorderedChildren(r),t.each(s,t.bind(e.removeChildView,e)),e._checkEmpty(),e.triggerMethod("reorder",e)}(),this},resortView:function(){return this.reorderOnSort?this.reorder():this._renderChildren(),this},_sortViews:function(){var e=this,i=this._filteredSortedModels(),n=t.find(i,function(t,i){var n=e.children.findByModel(t);return!n||n._index!==i});n&&this.resortView()},_emptyViewIndex:-1,_appendReorderedChildren:function(e){this.$el.append(e)},_renderChildren:function(){this._isRendered&&(this._destroyEmptyView(),this._destroyChildren({checkEmpty:!1}));var e=this._filteredSortedModels();this.isEmpty({processedModels:e})?this._showEmptyView():(this.triggerMethod("before:render:children",this),this._startBuffering(),this._showCollection(e),this._endBuffering(),this.triggerMethod("render:children",this))},_showCollection:function(e){var i=this;t.each(e,function(e,t){var n=i._getChildView(e);i._addChild(e,n,t)})},_filteredSortedModels:function(e){if(!this.collection||!this.collection.length)return[];var t=this.getViewComparator(),i=this.collection.models;if(e=Math.min(Math.max(e,0),i.length-1),t){var n=void 0;e&&(n=i[e],i=i.slice(0,e).concat(i.slice(e+1))),i=this._sortModelsBy(i,t),n&&i.splice(e,0,n)}return i=this._filterModels(i)},getViewComparator:function(){return this.viewComparator},_filterModels:function(e){var i=this;return this.filter&&(e=t.filter(e,function(e,t){return i._shouldAddChild(e,t)})),e},_sortModelsBy:function(e,i){return"string"==typeof i?t.sortBy(e,function(e){return e.get(i)}):1===i.length?t.sortBy(e,t.bind(i,this)):e.sort(t.bind(i,this))},_showEmptyView:function(){var i=this._getEmptyView();if(i&&!this._showingEmptyView){this._showingEmptyView=!0;var n=new e.Model,r=this.emptyViewOptions||this.childViewOptions;t.isFunction(r)&&(r=r.call(this,n,this._emptyViewIndex));var s=this.buildChildView(n,i,r);this.triggerMethod("before:render:empty",this,s),this._addChildView(s,0),this.triggerMethod("render:empty",this,s),s._parent=this}},_destroyEmptyView:function(){this._showingEmptyView&&(this.triggerMethod("before:remove:empty",this),this._destroyChildren(),delete this._showingEmptyView,this.triggerMethod("remove:empty",this))},_getEmptyView:function(){var e=this.emptyView;if(e)return this._getView(e)},_getChildView:function(e){var t=this.childView;if(!t)throw new F({name:"NoChildViewError",message:'A "childView" must be specified'});if(t=this._getView(t,e),!t)throw new F({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},_getView:function(i,n){return i.prototype instanceof e.View||i===e.View?i:t.isFunction(i)?i.call(this,n):void 0},_addChild:function(e,t,i){var n=this._getChildViewOptions(e,i),r=this.buildChildView(e,t,n);return this.addChildView(r,i),r},_getChildViewOptions:function(e,i){return t.isFunction(this.childViewOptions)?this.childViewOptions(e,i):this.childViewOptions},addChildView:function(e,t){return this.triggerMethod("before:add:child",this,e),this._updateIndices(e,!0,t),e._parent=this,this._addChildView(e,t),this.triggerMethod("add:child",this,e),e},_updateIndices:function(e,t,i){this.sort&&(t&&(e._index=i),this.children.each(function(i){i._index>=e._index&&(i._index+=t?1:-1)}))},_addChildView:function(e,t){var i=!this._isBuffering&&this._isAttached;c(e),this._proxyChildEvents(e),this.children.add(e),e.supportsRenderLifecycle||s(e,"before:render",e),e.render(),e.supportsRenderLifecycle||(e._isRendered=!0,s(e,"render",e)),i&&s(e,"before:attach",e),this.attachHtml(this,e,t),i&&(e._isAttached=!0,s(e,"attach",e))},buildChildView:function(e,i,n){var r=t.extend({model:e},n);return new i(r)},removeChildView:function(e){return!e||e._isDestroyed?e:(this.triggerMethod("before:remove:child",this,e),e.destroy?e.destroy():V(e),delete e._parent,this.stopListening(e),this.children.remove(e),this.triggerMethod("remove:child",this,e),this._updateIndices(e,!1),e)},isEmpty:function(e){var i=void 0;return t.result(e,"processedModels")?i=e.processedModels:(i=this.collection?this.collection.models:[],i=this._filterModels(i)),0===i.length},_checkEmpty:function(){this.isEmpty()&&this._showEmptyView()},attachBuffer:function(e,t){e.$el.append(t)},_createBuffer:function(){var e=document.createDocumentFragment();return t.each(this._bufferedChildren,function(t){e.appendChild(t.el)}),e},attachHtml:function(e,t,i){e._isBuffering?e._bufferedChildren.splice(i,0,t):e._insertBefore(t,i)||e._insertAfter(t)},_insertBefore:function(e,t){var i=void 0,n=this.sort&&t<this.children.length-1;return n&&(i=this.children.find(function(e){return e._index===t+1})),!!i&&(i.$el.before(e.el),!0)},_insertAfter:function(e){this.$el.append(e.el)},_initChildViewStorage:function(){this.children=new le},_removeChildren:function(){this._destroyChildren({checkEmpty:!1})},_destroyChildren:function(){var e=arguments.length<=0||void 0===arguments[0]?{}:arguments[0],i=e.checkEmpty;this.triggerMethod("before:destroy:children",this);var n=i!==!1,r=this.children.map(t.identity);return this.children.each(t.bind(this.removeChildView,this)),n&&this._checkEmpty(),this.triggerMethod("destroy:children",this),r},_shouldAddChild:function(e,i){var n=this.filter;return!t.isFunction(n)||n.call(this,e,i,this.collection)},_proxyChildEvents:function(e){var i=this,n=t.result(this,"childViewEventPrefix");this.listenTo(e,"all",function(e){for(var r=arguments.length,s=Array(r>1?r-1:0),o=1;o<r;o++)s[o-1]=arguments[o];var h=n+":"+e,d=i.normalizeMethods(i._childViewEvents);"undefined"!=typeof d&&t.isFunction(d[e])&&d[e].apply(i,s);var a=i._childViewTriggers;a&&t.isString(a[e])&&i.triggerMethod.apply(i,[a[e]].concat(s)),i.triggerMethod.apply(i,[h].concat(s))})}});t.extend(ue.prototype,te);var fe=["childViewContainer","template","templateContext"],ge=ue.extend({constructor:function(e){A("CompositeView is deprecated. Convert to View at your earliest convenience"),this.mergeOptions(e,fe),ue.prototype.constructor.apply(this,arguments)},_initialEvents:function(){this.collection&&(this.listenTo(this.collection,"add",this._onCollectionAdd),this.listenTo(this.collection,"remove",this._onCollectionRemove),this.listenTo(this.collection,"reset",this.renderChildren),this.sort&&this.listenTo(this.collection,"sort",this._sortViews))},_getChildView:function(e){var t=this.childView;if(!t)return this.constructor;if(t=this._getView(t,e),!t)throw new F({name:"InvalidChildViewError",message:'"childView" must be a view class or a function that returns a view class'});return t},serializeData:function(){return this.serializeModel()},render:function(){return this._ensureViewIsIntact(),this._isRendering=!0,this.resetChildViewContainer(),this.triggerMethod("before:render",this),this._renderTemplate(),this.bindUIElements(),this.renderChildren(),this._isRendering=!1,this._isRendered=!0,this.triggerMethod("render",this),this},renderChildren:function(){(this._isRendered||this._isRendering)&&ue.prototype._renderChildren.call(this)},attachBuffer:function(e,t){var i=this.getChildViewContainer(e);i.append(t)},_insertAfter:function(e){var t=this.getChildViewContainer(this,e);t.append(e.el)},_appendReorderedChildren:function(e){var t=this.getChildViewContainer(this);t.append(e)},getChildViewContainer:function(e,i){if(e.$childViewContainer)return e.$childViewContainer;var n=void 0,r=e.childViewContainer;if(r){var s=t.result(e,"childViewContainer");if(n="@"===s.charAt(0)&&e.ui?e.ui[s.substr(4)]:e.$(s),n.length<=0)throw new F({name:"ChildViewContainerMissingError",
10
+ message:'The specified "childViewContainer" was not found: '+e.childViewContainer})}else n=e.$el;return e.$childViewContainer=n,n},resetChildViewContainer:function(){this.$childViewContainer&&(this.$childViewContainer=void 0)}}),pe=t.pick(he.prototype,"serializeModel","getTemplate","_renderTemplate","mixinTemplateContext","attachElContent");t.extend(ge.prototype,pe);var ve=["collectionEvents","events","modelEvents","triggers","ui"],_e=j.extend({cidPrefix:"mnb",constructor:function(e,i){this.view=i,this.defaults=t.clone(t.result(this,"defaults",{})),this._setOptions(this.defaults,e),this.mergeOptions(this.options,ve),this.ui=t.extend({},t.result(this,"ui"),t.result(i,"ui")),j.apply(this,arguments)},$:function(){return this.view.$.apply(this.view,arguments)},destroy:function(){return this.stopListening(),this},proxyViewProperties:function(){return this.$el=this.view.$el,this.el=this.view.el,this},bindUIElements:function(){return this._bindUIElements(),this},unbindUIElements:function(){return this._unbindUIElements(),this},getUI:function(e){return this.view._ensureViewIsIntact(),this._getUI(e)},delegateEntityEvents:function(){return this._delegateEntityEvents(this.view.model,this.view.collection),this},undelegateEntityEvents:function(){return this._undelegateEntityEvents(this.view.model,this.view.collection),this},getEvents:function(){var e=this.normalizeUIKeys(t.result(this,"events"));return t.reduce(e,function(e,i,n){if(t.isFunction(i)||(i=this[i]),i)return n=G(n),e[n]=t.bind(i,this),e},{},this)},getTriggers:function(){if(this.triggers){var e=this.normalizeUIKeys(t.result(this,"triggers"));return this._getViewTriggers(this.view,e)}}});t.extend(_e.prototype,Y,J,ee);var me=["region","regionClass"],ye=j.extend({cidPrefix:"mna",constructor:function(e){this._setOptions(e),this.mergeOptions(e,me),this._initRegion(),j.prototype.constructor.apply(this,arguments)},regionClass:ne,_initRegion:function(e){var i=this.region,n=this.regionClass;return t.isString(i)?void(this._region=new n({el:i})):void(this._region=i)},getRegion:function(){return this._region},showView:function(e){for(var t=this.getRegion(),i=arguments.length,n=Array(i>1?i-1:0),r=1;r<i;r++)n[r-1]=arguments[r];return t.show.apply(t,[e].concat(n))},getView:function(){return this.getRegion().currentView},start:function(e){return this.triggerMethod("before:start",this,e),this.triggerMethod("start",this,e),this}}),we=["appRoutes","controller"],Ee=e.Router.extend({constructor:function(t){this._setOptions(t),this.mergeOptions(t,we),e.Router.apply(this,arguments);var i=this.appRoutes,n=this._getController();this.processAppRoutes(n,i),this.on("route",this._processOnRoute,this)},appRoute:function(e,t){var i=this._getController();return this._addAppRoute(i,e,t),this},_processOnRoute:function(e,i){if(t.isFunction(this.onRoute)){var n=t.invert(this.appRoutes)[e];this.onRoute(e,n,i)}},processAppRoutes:function(e,i){var n=this;if(!i)return this;var r=t.keys(i).reverse();return t.each(r,function(t){n._addAppRoute(e,t,i[t])}),this},_getController:function(){return this.controller},_addAppRoute:function(e,i,n){var r=e[n];if(!r)throw new F('Method "'+n+'" was not found on the controller');this.route(i,n,t.bind(r,e))},triggerMethod:r});t.extend(Ee.prototype,z);var be={},Ve=e.Marionette,Ce=e.Marionette={};return Ce.noConflict=function(){return e.Marionette=Ve,this},Ce.bindEvents=B(g),Ce.unbindEvents=B(p),Ce.bindRequests=B(_),Ce.unbindRequests=B(m),Ce.mergeOptions=B(T),Ce.getOption=B(D),Ce.normalizeMethods=B(U),Ce.extend=I,Ce.isNodeAttached=O,Ce.deprecate=A,Ce.triggerMethod=B(r),Ce.triggerMethodOn=s,Ce.isEnabled=R,Ce.setEnabled=M,Ce.monitorViewEvents=c,Ce.Behaviors={},Ce.Behaviors.behaviorsLookup=C,Ce.Application=ye,Ce.AppRouter=Ee,Ce.Renderer=se,Ce.TemplateCache=q,Ce.View=he,Ce.CollectionView=ue,Ce.CompositeView=ge,Ce.Behavior=_e,Ce.Region=ne,Ce.Error=F,Ce.Object=j,Ce.DEV_MODE=!1,Ce.FEATURES=be,Ce.VERSION=x,Ce});
11
+ //# sourceMappingURL=<%= asset_path 'backbone.marionette.min.js.map' %>
@@ -1 +1 @@
1
- 404: Not Found
1
+ {"version":3,"sources":["/source/src/common/trigger-method.js","/source/src/common/monitor-view-events.js","/source/src/common/bind-events.js","/source/src/common/bind-requests.js","/source/src/mixins/behaviors.js","/source/src/utils/get-unique-event-name.js","/source/src/mixins/triggers.js","/source/src/utils/destroy-backbone-view.js","/source/src/config/behaviors-lookup.js","/source/src/config/features.js","/source/src/utils/proxy.js","/source/src/utils/extend.js","/source/src/utils/deprecate.js","/source/src/common/is-node-attached.js","/source/src/common/merge-options.js","/source/src/common/get-option.js","/source/src/common/normalize-methods.js","/source/src/error.js","/source/src/utils/set-options.js","/source/src/mixins/common.js","/source/src/mixins/radio.js","/source/src/object.js","/source/src/template-cache.js","/source/src/utils/invoke.js","/source/src/mixins/delegate-entity-events.js","/source/src/mixins/ui.js","/source/src/mixins/view.js","/source/src/region.js","/source/src/mixins/regions.js","/source/src/config/renderer.js","/source/src/view.js","/source/src/utils/emulate-collection.js","/source/src/child-view-container.js","/source/src/collection-view.js","/source/src/composite-view.js","/source/src/behavior.js","/source/src/application.js","/source/src/app-router.js","/source/src/backbone.marionette.js"],"names":["getEventName","match","prefix","eventName","toUpperCase","triggerMethod","event","methodName","replace","splitter","method","getOption","call","this","result","_len","arguments","length","args","Array","_key","_","isFunction","apply","trigger","concat","triggerMethodOn","context","fnc","_len2","_key2","triggerMethodChildren","view","shouldTrigger","_getImmediateChildren","each","child","shouldTriggerAttach","_isAttached","shouldAttach","shouldTriggerDetach","shouldDetach","monitorViewEvents","handleBeforeAttach","handleAttach","triggerDOMRefresh","handleBeforeDetach","handleDetach","handleRender","_isRendered","_areViewEventsMonitored","on","before:attach","attach","before:detach","detach","render","bindFromStrings","target","entity","evt","methods","actionName","methodNames","split","MarionetteError","iterateEvents","bindings","isObject","message","url","isString","bindEvents","unbindEvents","iterateReplies","channel","normalizedRadioRequests","normalizeMethods","bindRequests","unbindRequests","getBehaviorClass","options","key","behaviorClass","Marionette","Behaviors","behaviorsLookup","parseBehaviors","behaviors","chain","map","BehaviorClass","_options","behavior","nestedBehaviors","flatten","value","uniqueName","selector","uniqueId","join","buildViewTrigger","triggerDef","shouldPreventDefault","preventDefault","shouldStopPropagation","stopPropagation","e","destroyBackboneView","supportsDestroyLifecycle","remove","_isDestroyed","isEnabled","name","FEATURES","setEnabled","state","proxy","extend","Backbone","Model","deprecate","test","prev","next","DEV_MODE","undefined","_cache","_warn","_console","console","warn","log","noop","isNodeAttached","el","$","contains","document","documentElement","mergeOptions","keys","pick","optionName","hash","_this","reduce","normalizedHash","errorProps","Error","urlRoot","version","constructor","error","captureStackTrace","toString","setOptions","CommonMixin","_setOptions","RadioMixin","_initRadio","channelName","Radio","_channel","radioEvents","radioRequests","_destroyRadio","stopReplying","getChannel","ClassOptions","MarionetteObject","cid","cidPrefix","initialize","prototype","Events","isDestroyed","destroy","stopListening","TemplateCache","templateId","templateCaches","get","cachedTemplate","load","clear","i","compiledTemplate","template","loadTemplate","compileTemplate","$template","html","rawTemplate","_invoke","invokeMap","invoke","BehaviorsMixin","_initBehaviors","_behaviors","_getBehaviorTriggers","triggers","toConsumableArray","_getBehaviorEvents","events","_proxyBehaviorViewProperties","_delegateBehaviorEntityEvents","_undelegateBehaviorEntityEvents","_destroyBehaviors","_bindBehaviorUIElements","_unbindBehaviorUIElements","_triggerEventOnBehaviors","DelegateEntityEventsMixin","_delegateEntityEvents","model","collection","_undelegateEntityEvents","modelEvents","collectionEvents","delegateEventSplitter","getUniqueEventName","TriggersMixin","_getViewTriggers","_normalizeUIKeys","ui","memo","val","normalizedKey","normalizeUIString","uiString","r","slice","_normalizeUIValues","properties","isArray","property","propertyVal","UIMixin","normalizeUIKeys","uiBindings","_getUIBindings","normalizeUIValues","_bindUIElements","_uiBindings","_ui","_unbindUIElements","_this2","$el","_getUI","ViewMixin","supportsRenderLifecycle","isRendered","isAttached","setElement","hasEl","View","delegateEvents","eventsArg","_buildEventProxies","viewEvents","_getEvents","combinedEvents","getTriggers","delegateEntityEvents","undelegateEntityEvents","_ensureViewIsIntact","unbindUIElements","_removeElement","_removeChildren","bindUIElements","getUI","childViewEventPrefix","ret","_triggerMethod","_triggerEventOnParentLayout","_childViewEvents","_childViewTriggers","layoutView","_parentView","eventPrefix","prefixedEventName","_len3","_key3","childViewEvents","childViewTriggers","parent","_parent","Region","replaceElement","_isReplaced","_initEl","getEl","show","_ensureElement","_ensureView","currentView","empty","_renderView","_attachView","shouldReplaceEl","attachHtml","allowMissingEl","_replaceEl","_restoreEl","parentNode","replaceChild","isReplaced","shouldReplace","appendChild","off","_removeView","detachHtml","_ref","preventDestroy","shouldPreventDestroy","_detachView","contents","hasView","reset","RegionsMixin","regionClass","_initRegions","regions","_regions","addRegions","_reInitRegions","addRegion","definition","isEmpty","_addRegions","regionDefinitions","_buildRegion","_addRegion","_buildRegionFromDefinition","_buildRegionFromObject","_buildRegionFromRegionClass","RegionClass","omit","defaults","parentEl","partial","region","removeRegion","_removeRegion","removeRegions","getRegions","bind","emptyRegions","hasRegion","getRegion","clone","showChildView","getChildView","Renderer","data","templateFunc","serializeData","serializeModel","items","serializeCollection","attributes","_renderTemplate","getTemplate","mixinTemplateContext","attachElContent","templateContext","compact","emulateCollection","object","listProperty","list","values","toArray","Container","views","_views","_indexByModel","_indexByCustom","_updateLength","add","customIndex","_add","viewCid","findByModel","findByModelCid","modelCid","findByCid","findByCustom","index","findByIndex","_remove","some","size","CollectionView","sort","once","_initialEvents","_initChildViewStorage","_bufferedChildren","_startBuffering","_isBuffering","_endBuffering","triggerOnChildren","attachBuffer","_createBuffer","children","listenTo","_onCollectionAdd","_onCollectionRemove","_sortViews","opts","at","indexOf","filter","_filteredSortedModels","_shouldAddChild","_destroyEmptyView","ChildView","_getChildView","_addChild","removeChildView","_checkEmpty","_renderChildren","setFilter","preventRender","canBeRendered","filterChanged","shouldRender","previousModels","models","_applyModelDeltas","removeFilter","currentIds","addedChildNotExists","prevModel","removedChildExists","reorder","_showingEmptyView","anyModelsAdded","elsToReorder","_index","filteredOutViews","_appendReorderedChildren","resortView","reorderOnSort","_this3","orderChanged","find","item","_emptyViewIndex","append","_destroyChildren","checkEmpty","processedModels","_showEmptyView","_showCollection","_this4","addedAt","viewComparator","getViewComparator","Math","min","max","addedModel","_sortModelsBy","splice","_filterModels","_this5","comparator","sortBy","EmptyView","_getEmptyView","emptyViewOptions","childViewOptions","buildChildView","_addChildView","emptyView","_getView","childView","_getChildViewOptions","addChildView","_updateIndices","increment","laterView","_proxyChildEvents","ChildViewClass","collectionView","buffer","elBuffer","createDocumentFragment","b","_insertBefore","_insertAfter","findPosition","before","ChildViewContainer","_ref2","shouldCheckEmpty","childViews","identity","_this6","childEventName","CompositeView","renderChildren","_isRendering","resetChildViewContainer","compositeView","$container","getChildViewContainer","containerView","$childViewContainer","container","childViewContainer","charAt","substr","MixinFromView","Behavior","proxyViewProperties","getEvents","behaviorEvents","behaviorHandler","behaviorTriggers","Application","_initRegion","_region","showView","getView","start","AppRouter","Router","appRoutes","controller","_getController","processAppRoutes","_processOnRoute","appRoute","route","_addAppRoute","routeName","routeArgs","onRoute","routePath","invert","routeNames","reverse","previousMarionette","noConflict","Object","VERSION"],"mappings":";;;;;;;;4UAWA,SAASA,GAAaC,EAAOC,EAAQC,GACnC,MAAOA,GAAUC,cAUZ,QAASC,GAAcC,GAAgB,IAAA,GAEtCC,GAAa,KAAOD,EAAME,QAAQC,EAAUT,GAC5CU,EAASC,EAAUC,KAAKC,KAAMN,GAChCO,EAAA,OAJwCC,EAAAC,UAAAC,OAANC,EAAMC,MAAAJ,EAAA,EAAAA,EAAA,EAAA,GAAAK,EAAA,EAAAA,EAAAL,EAAAK,IAANF,EAAME,EAAA,GAAAJ,UAAAI,EAe5C,OARIC,GAAEC,WAAWZ,KAEfI,EAASJ,EAAOa,MAAMV,KAAMK,IAI9BL,KAAKW,QAALD,MAAAV,MAAaP,GAAbmB,OAAuBP,IAEhBJ,EAOF,QAASY,GAAgBC,GAAkB,IAAA,GAC1CC,GAAMP,EAAEC,WAAWK,EAAQtB,eAAiBsB,EAAQtB,cAAgBA,EAD1BwB,EAAAb,UAAAC,OAANC,EAAMC,MAAAU,EAAA,EAAAA,EAAA,EAAA,GAAAC,EA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W+F,cAAgBA,EAC3B/F,GAAW2K,KAAOA,GAClB3K,GAAWqT,eAAiBA,GAC5BrT,GAAWka,cAAgBA,GAC3Bla,GAAWgb,SAAWA,GACtBhb,GAAW2M,OAASA,GACpB3M,GAAWiE,MAAQpF,EACnBmB,GAAW+c,OAASzX,EAGpBtF,GAAWyC,UAAW,EACtBzC,GAAW8B,SAAWA,GACtB9B,GAAWgd,QAAU7Y","file":"backbone.marionette.min.js","sourcesContent":["// Trigger Method\n// --------------\n\nimport _ from 'underscore';\nimport getOption from './get-option';\n\n// split the event name on the \":\"\nconst splitter = /(^|:)(\\w)/gi;\n\n// take the event section (\"section1:section2:section3\")\n// and turn it in to uppercase name onSection1Section2Section3\nfunction getEventName(match, prefix, eventName) {\n return eventName.toUpperCase();\n}\n\n// Trigger an event and/or a corresponding method name. Examples:\n//\n// `this.triggerMethod(\"foo\")` will trigger the \"foo\" event and\n// call the \"onFoo\" method.\n//\n// `this.triggerMethod(\"foo:bar\")` will trigger the \"foo:bar\" event and\n// call the \"onFooBar\" method.\nexport function triggerMethod(event, ...args) {\n // get the method name from the event name\n const methodName = 'on' + event.replace(splitter, getEventName);\n const method = getOption.call(this, methodName);\n let result;\n\n // call the onMethodName if it exists\n if (_.isFunction(method)) {\n // pass all args, except the event name\n result = method.apply(this, args);\n }\n\n // trigger the event\n this.trigger(event, ...args);\n\n return result;\n}\n\n// triggerMethodOn invokes triggerMethod on a specific context\n//\n// e.g. `Marionette.triggerMethodOn(view, 'show')`\n// will trigger a \"show\" event or invoke onShow the view.\nexport function triggerMethodOn(context, ...args) {\n const fnc = _.isFunction(context.triggerMethod) ? context.triggerMethod : triggerMethod;\n return fnc.apply(context, args);\n}\n","// DOM Refresh\n// -----------\n\nimport _ from 'underscore';\nimport { triggerMethodOn } from './trigger-method';\n\n// Trigger method on children unless a pure Backbone.View\nfunction triggerMethodChildren(view, event, shouldTrigger) {\n if (!view._getImmediateChildren) { return; }\n _.each(view._getImmediateChildren(), child => {\n if (!shouldTrigger(child)) { return; }\n triggerMethodOn(child, event, child);\n });\n}\n\nfunction shouldTriggerAttach(view) {\n return !view._isAttached;\n}\n\nfunction shouldAttach(view) {\n if (!shouldTriggerAttach(view)) { return false; }\n view._isAttached = true;\n return true;\n}\n\nfunction shouldTriggerDetach(view) {\n return view._isAttached;\n}\n\nfunction shouldDetach(view) {\n if (!shouldTriggerDetach(view)) { return false; }\n view._isAttached = false;\n return true;\n}\n\n// Monitor a view's state, propagating attach/detach events to children and firing dom:refresh\n// whenever a rendered view is attached or an attached view is rendered.\nfunction monitorViewEvents(view) {\n if (view._areViewEventsMonitored) { return; }\n\n view._areViewEventsMonitored = true;\n\n function handleBeforeAttach() {\n triggerMethodChildren(view, 'before:attach', shouldTriggerAttach);\n }\n\n function handleAttach() {\n triggerMethodChildren(view, 'attach', shouldAttach);\n triggerDOMRefresh();\n }\n\n function handleBeforeDetach() {\n triggerMethodChildren(view, 'before:detach', shouldTriggerDetach);\n }\n\n function handleDetach() {\n triggerMethodChildren(view, 'detach', shouldDetach);\n }\n\n function handleRender() {\n triggerDOMRefresh();\n }\n\n function triggerDOMRefresh() {\n if (view._isAttached && view._isRendered) {\n triggerMethodOn(view, 'dom:refresh', view);\n }\n }\n\n view.on({\n 'before:attach': handleBeforeAttach,\n 'attach': handleAttach,\n 'before:detach': handleBeforeDetach,\n 'detach': handleDetach,\n 'render': handleRender\n });\n}\n\nexport default monitorViewEvents;\n","// Bind Entity Events & Unbind Entity Events\n// -----------------------------------------\n//\n// These methods are used to bind/unbind a backbone \"entity\" (e.g. collection/model)\n// to methods on a target object.\n//\n// The first parameter, `target`, must have the Backbone.Events module mixed in.\n//\n// The second parameter is the `entity` (Backbone.Model, Backbone.Collection or\n// any object that has Backbone.Events mixed in) to bind the events from.\n//\n// The third parameter is a hash of { \"event:name\": \"eventHandler\" }\n// configuration. Multiple handlers can be separated by a space. A\n// function can be supplied instead of a string handler name.\n\nimport _ from 'underscore';\nimport MarionetteError from '../error';\n\n// Bind/unbind the event to handlers specified as a string of\n// handler names on the target object\nfunction bindFromStrings(target, entity, evt, methods, actionName) {\n const methodNames = methods.split(/\\s+/);\n\n _.each(methodNames, function(methodName) {\n const method = target[methodName];\n if (!method) {\n throw new MarionetteError(`Method \"${methodName}\" was configured as an event handler, but does not exist.`);\n }\n\n target[actionName](entity, evt, method);\n });\n}\n\n// generic looping function\nfunction iterateEvents(target, entity, bindings, actionName) {\n if (!entity || !bindings) { return; }\n\n // type-check bindings\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'marionette.functions.html#marionettebindevents'\n });\n }\n\n // iterate the bindings and bind/unbind them\n _.each(bindings, function(method, evt) {\n\n // allow for a list of method names as a string\n if (_.isString(method)) {\n bindFromStrings(target, entity, evt, method, actionName);\n return;\n }\n\n target[actionName](entity, evt, method);\n });\n}\n\nfunction bindEvents(entity, bindings) {\n iterateEvents(this, entity, bindings, 'listenTo');\n return this;\n}\n\nfunction unbindEvents(entity, bindings) {\n iterateEvents(this, entity, bindings, 'stopListening');\n return this;\n}\n\n// Export Public API\nexport {\n bindEvents,\n unbindEvents\n};\n","// Bind/Unbind Radio Requests\n// -----------------------------------------\n//\n// These methods are used to bind/unbind a backbone.radio request\n// to methods on a target object.\n//\n// The first parameter, `target`, will set the context of the reply method\n//\n// The second parameter is the `Radio.channel` to bind the reply to.\n//\n// The third parameter is a hash of { \"request:name\": \"replyHandler\" }\n// configuration. A function can be supplied instead of a string handler name.\n\nimport _ from 'underscore';\nimport normalizeMethods from './normalize-methods';\nimport MarionetteError from '../error';\n\nfunction iterateReplies(target, channel, bindings, actionName) {\n if (!channel || !bindings) { return; }\n\n // type-check bindings\n if (!_.isObject(bindings)) {\n throw new MarionetteError({\n message: 'Bindings must be an object.',\n url: 'marionette.functions.html#marionettebindrequests'\n });\n }\n\n const normalizedRadioRequests = normalizeMethods.call(target, bindings);\n\n channel[actionName](normalizedRadioRequests, target);\n}\n\nfunction bindRequests(channel, bindings) {\n iterateReplies(this, channel, bindings, 'reply');\n return this;\n}\n\nfunction unbindRequests(channel, bindings) {\n iterateReplies(this, channel, bindings, 'stopReplying');\n return this;\n}\n\nexport {\n bindRequests,\n unbindRequests\n};\n","import _ from 'underscore';\nimport _invoke from '../utils/invoke';\nimport { triggerMethod } from '../common/trigger-method';\nimport Marionette from '../backbone.marionette';\n\n// MixinOptions\n// - behaviors\n\n// Takes care of getting the behavior class\n// given options and a key.\n// If a user passes in options.behaviorClass\n// default to using that.\n// If a user passes in a Behavior Class directly, use that\n// Otherwise delegate the lookup to the users `behaviorsLookup` implementation.\nfunction getBehaviorClass(options, key) {\n if (options.behaviorClass) {\n return options.behaviorClass;\n //treat functions as a Behavior constructor\n } else if (_.isFunction(options)) {\n return options;\n }\n\n // behaviorsLookup can be either a flat object or a method\n if (_.isFunction(Marionette.Behaviors.behaviorsLookup)) {\n return Marionette.Behaviors.behaviorsLookup(options, key)[key];\n }\n\n return Marionette.Behaviors.behaviorsLookup[key];\n}\n\n// Iterate over the behaviors object, for each behavior\n// instantiate it and get its grouped behaviors.\n// This accepts a list of behaviors in either an object or array form\nfunction parseBehaviors(view, behaviors) {\n return _.chain(behaviors).map(function(options, key) {\n const BehaviorClass = getBehaviorClass(options, key);\n //if we're passed a class directly instead of an object\n const _options = options === BehaviorClass ? {} : options;\n const behavior = new BehaviorClass(_options, view);\n const nestedBehaviors = parseBehaviors(view, _.result(behavior, 'behaviors'));\n\n return [behavior].concat(nestedBehaviors);\n }).flatten().value();\n}\n\nexport default {\n _initBehaviors() {\n const behaviors = _.result(this, 'behaviors');\n\n // Behaviors defined on a view can be a flat object literal\n // or it can be a function that returns an object.\n this._behaviors = _.isObject(behaviors) ? parseBehaviors(this, behaviors) : {};\n },\n\n _getBehaviorTriggers() {\n const triggers = _invoke(this._behaviors, 'getTriggers');\n return _.extend({}, ...triggers);\n },\n\n _getBehaviorEvents() {\n const events = _invoke(this._behaviors, 'getEvents');\n return _.extend({}, ...events);\n },\n\n // proxy behavior $el to the view's $el.\n _proxyBehaviorViewProperties() {\n _invoke(this._behaviors, 'proxyViewProperties');\n },\n\n // delegate modelEvents and collectionEvents\n _delegateBehaviorEntityEvents() {\n _invoke(this._behaviors, 'delegateEntityEvents');\n },\n\n // undelegate modelEvents and collectionEvents\n _undelegateBehaviorEntityEvents() {\n _invoke(this._behaviors, 'undelegateEntityEvents');\n },\n\n _destroyBehaviors(args) {\n // Call destroy on each behavior after\n // destroying the view.\n // This unbinds event listeners\n // that behaviors have registered for.\n _invoke(this._behaviors, 'destroy', ...args);\n },\n\n _bindBehaviorUIElements() {\n _invoke(this._behaviors, 'bindUIElements');\n },\n\n _unbindBehaviorUIElements() {\n _invoke(this._behaviors, 'unbindUIElements');\n },\n\n _triggerEventOnBehaviors(...args) {\n const behaviors = this._behaviors;\n // Use good ol' for as this is a very hot function\n for (let i = 0, length = behaviors && behaviors.length; i < length; i++) {\n triggerMethod.apply(behaviors[i], args);\n }\n }\n};\n","import _ from 'underscore';\n\n// Borrow event splitter from Backbone\nconst delegateEventSplitter = /^(\\S+)\\s*(.*)$/;\n\nfunction uniqueName(eventName, selector) {\n return [eventName + _.uniqueId('.evt'), selector].join(' ');\n}\n\n// Set event name to be namespaced using a unique index\n// to generate a non colliding event namespace\n// http://api.jquery.com/event.namespace/\nconst getUniqueEventName = function(eventName) {\n const match = eventName.match(delegateEventSplitter);\n return uniqueName(match[1], match[2]);\n};\n\nexport default getUniqueEventName;\n","import _ from 'underscore';\nimport getUniqueEventName from '../utils/get-unique-event-name';\n\n// Internal method to create an event handler for a given `triggerDef` like\n// 'click:foo'\nfunction buildViewTrigger(view, triggerDef) {\n if (_.isString(triggerDef)) {\n triggerDef = {event: triggerDef};\n }\n\n const eventName = triggerDef.event;\n const shouldPreventDefault = triggerDef.preventDefault !== false;\n const shouldStopPropagation = triggerDef.stopPropagation !== false;\n\n return function(e) {\n if (shouldPreventDefault) {\n e.preventDefault();\n }\n\n if (shouldStopPropagation) {\n e.stopPropagation();\n }\n\n view.triggerMethod(eventName, view);\n };\n}\n\nexport default {\n\n // Configure `triggers` to forward DOM events to view\n // events. `triggers: {\"click .foo\": \"do:foo\"}`\n _getViewTriggers(view, triggers) {\n // Configure the triggers, prevent default\n // action and stop propagation of DOM events\n return _.reduce(triggers, (events, value, key) => {\n key = getUniqueEventName(key);\n events[key] = buildViewTrigger(view, value);\n return events;\n }, {});\n }\n\n};\n","import { triggerMethodOn } from '../common/trigger-method';\n\nexport default function destroyBackboneView(view) {\n if (!view.supportsDestroyLifecycle) {\n triggerMethodOn(view, 'before:destroy', view);\n }\n\n const shouldTriggerDetach = !!view._isAttached;\n\n if (shouldTriggerDetach) {\n triggerMethodOn(view, 'before:detach', view);\n }\n\n view.remove();\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n triggerMethodOn(view, 'detach', view);\n }\n\n view._isDestroyed = true;\n\n if (!view.supportsDestroyLifecycle) {\n triggerMethodOn(view, 'destroy', view);\n }\n}\n","import MarionetteError from '../error';\n\n// Placeholder method to be extended by the user.\n// The method should define the object that stores the behaviors.\n// i.e.\n//\n// ```js\n// Marionette.Behaviors.behaviorsLookup: function() {\n// return App.Behaviors\n// }\n// ```\nexport default function behaviorsLookup() {\n throw new MarionetteError({\n message: 'You must define where your behaviors are stored.',\n url: 'marionette.behaviors.md#behaviorslookup'\n });\n}\n","// Add Feature flags here\n// e.g. 'class' => false\nconst FEATURES = {\n};\n\nfunction isEnabled(name) {\n return !!FEATURES[name];\n}\n\nfunction setEnabled(name, state) {\n return FEATURES[name] = state;\n}\n\nexport {\n FEATURES,\n setEnabled,\n isEnabled\n};\n","//Internal utility for creating context style global utils\nconst proxy = function(method) {\n return function(context, ...args) {\n return method.apply(context, args);\n };\n};\n\nexport default proxy;\n","// Marionette.extend\n// -----------------\n\nimport Backbone from 'backbone';\n\n// Borrow the Backbone `extend` method so we can use it as needed\nconst extend = Backbone.Model.extend;\n\nexport default extend;\n","/* global console */\n\nimport _ from 'underscore';\n\nimport Marionette from '../backbone.marionette';\n\nconst deprecate = function(message, test) {\n if (_.isObject(message)) {\n message = (\n message.prev + ' is going to be removed in the future. ' +\n 'Please use ' + message.next + ' instead.' +\n (message.url ? ' See: ' + message.url : '')\n );\n }\n\n if (!Marionette.DEV_MODE) {\n return;\n }\n\n if ((test === undefined || !test) && !deprecate._cache[message]) {\n deprecate._warn('Deprecation warning: ' + message);\n deprecate._cache[message] = true;\n }\n};\n\ndeprecate._console = typeof console !== 'undefined' ? console : {};\ndeprecate._warn = function() {\n const warn = deprecate._console.warn || deprecate._console.log || _.noop;\n return warn.apply(deprecate._console, arguments);\n};\ndeprecate._cache = {};\n\nexport default deprecate;\n","// Marionette.isNodeAttached\n// -------------------------\n\nimport Backbone from 'backbone';\n\n// Determine if `el` is a child of the document\nconst isNodeAttached = function(el) {\n return Backbone.$.contains(document.documentElement, el);\n};\n\nexport default isNodeAttached;\n","import _ from 'underscore';\n\n// Merge `keys` from `options` onto `this`\nconst mergeOptions = function(options, keys) {\n if (!options) { return; }\n _.extend(this, _.pick(options, keys));\n};\n\nexport default mergeOptions;\n","// Marionette.getOption\n// --------------------\n\n// Retrieve an object, function or other value from the\n// object or its `options`, with `options` taking precedence.\nconst getOption = function(optionName) {\n if (!optionName) { return; }\n if (this.options && (this.options[optionName] !== undefined)) {\n return this.options[optionName];\n } else {\n return this[optionName];\n }\n};\n\nexport default getOption;\n","import _ from 'underscore';\n\n// Marionette.normalizeMethods\n// ----------------------\n\n// Pass in a mapping of events => functions or function names\n// and return a mapping of events => functions\nconst normalizeMethods = function(hash) {\n return _.reduce(hash, (normalizedHash, method, name) => {\n if (!_.isFunction(method)) {\n method = this[method];\n }\n if (method) {\n normalizedHash[name] = method;\n }\n return normalizedHash;\n }, {});\n};\n\nexport default normalizeMethods;\n","// Error\n// -----\n\nimport _ from 'underscore';\nimport extend from './utils/extend';\nimport {version} from '../package.json';\n\nconst errorProps = ['description', 'fileName', 'lineNumber', 'name', 'message', 'number'];\n\nconst MarionetteError = extend.call(Error, {\n urlRoot: `http://marionettejs.com/docs/v${version}/`,\n\n constructor(message, options) {\n if (_.isObject(message)) {\n options = message;\n message = options.message;\n } else if (!options) {\n options = {};\n }\n\n const error = Error.call(this, message);\n _.extend(this, _.pick(error, errorProps), _.pick(options, errorProps));\n\n this.captureStackTrace();\n\n if (options.url) {\n this.url = this.urlRoot + options.url;\n }\n },\n\n captureStackTrace() {\n if (Error.captureStackTrace) {\n Error.captureStackTrace(this, MarionetteError);\n }\n },\n\n toString() {\n return this.name + ': ' + this.message + (this.url ? ' See: ' + this.url : '');\n }\n});\n\nMarionetteError.extend = extend;\n\nexport default MarionetteError;\n","import _ from 'underscore';\n\n// Internal utility for setting options consistently across Mn\nconst setOptions = function(...args) {\n this.options = _.extend({}, _.result(this, 'options'), ...args);\n};\n\nexport default setOptions;\n","import _setOptions from '../utils/set-options';\nimport getOption from '../common/get-option';\nimport mergeOptions from '../common/merge-options';\nimport normalizeMethods from '../common/normalize-methods';\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\nexport default {\n\n // Imports the \"normalizeMethods\" to transform hashes of\n // events=>function references/names to a hash of events=>function references\n normalizeMethods: normalizeMethods,\n\n _setOptions: _setOptions,\n\n // A handy way to merge passed-in options onto the instance\n mergeOptions: mergeOptions,\n\n // Enable getting options from this or this.options by name.\n getOption: getOption,\n\n // Enable binding view's events from another entity.\n bindEvents: bindEvents,\n\n // Enable unbinding view's events from another entity.\n unbindEvents: unbindEvents\n};\n","import _ from 'underscore';\nimport Radio from 'backbone.radio';\n\nimport {\n bindRequests,\n unbindRequests\n} from '../common/bind-requests';\n\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\nimport MarionetteError from '../error';\n\n// MixinOptions\n// - channelName\n// - radioEvents\n// - radioRequests\n\nexport default {\n\n _initRadio() {\n const channelName = _.result(this, 'channelName');\n\n if (!channelName) {\n return;\n }\n\n /* istanbul ignore next */\n if (!Radio) {\n throw new MarionetteError({\n name: 'BackboneRadioMissing',\n message: 'The dependency \"backbone.radio\" is missing.'\n });\n }\n\n const channel = this._channel = Radio.channel(channelName);\n\n const radioEvents = _.result(this, 'radioEvents');\n this.bindEvents(channel, radioEvents);\n\n const radioRequests = _.result(this, 'radioRequests');\n this.bindRequests(channel, radioRequests);\n\n this.on('destroy', this._destroyRadio);\n },\n\n _destroyRadio() {\n this._channel.stopReplying(null, null, this);\n },\n\n getChannel() {\n return this._channel;\n },\n\n // Proxy `bindEvents`\n bindEvents: bindEvents,\n\n // Proxy `unbindEvents`\n unbindEvents: unbindEvents,\n\n // Proxy `bindRequests`\n bindRequests: bindRequests,\n\n // Proxy `unbindRequests`\n unbindRequests: unbindRequests\n\n};\n","// Object\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport extend from './utils/extend';\nimport { triggerMethod } from './common/trigger-method';\nimport CommonMixin from './mixins/common';\nimport RadioMixin from './mixins/radio';\n\nconst ClassOptions = [\n 'channelName',\n 'radioEvents',\n 'radioRequests'\n];\n\n// A Base Class that other Classes should descend from.\n// Object borrows many conventions and utilities from Backbone.\nconst MarionetteObject = function(options) {\n this._setOptions(options);\n this.mergeOptions(options, ClassOptions);\n this.cid = _.uniqueId(this.cidPrefix);\n this._initRadio();\n this.initialize.apply(this, arguments);\n};\n\nMarionetteObject.extend = extend;\n\n// Object Methods\n// --------------\n\n// Ensure it can trigger events with Backbone.Events\n_.extend(MarionetteObject.prototype, Backbone.Events, CommonMixin, RadioMixin, {\n cidPrefix: 'mno',\n\n // for parity with Marionette.AbstractView lifecyle\n _isDestroyed: false,\n\n isDestroyed() {\n return this._isDestroyed;\n },\n\n //this is a noop method intended to be overridden by classes that extend from this base\n initialize() {},\n\n destroy(...args) {\n if (this._isDestroyed) { return this; }\n\n this.triggerMethod('before:destroy', this, ...args);\n\n this._isDestroyed = true;\n this.triggerMethod('destroy', this, ...args);\n this.stopListening();\n\n return this;\n },\n\n triggerMethod: triggerMethod\n});\n\nexport default MarionetteObject;\n","// Template Cache\n// --------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport MarionetteError from './error';\n\n// Manage templates stored in `<script>` blocks,\n// caching them for faster access.\nconst TemplateCache = function(templateId) {\n this.templateId = templateId;\n};\n\n// TemplateCache object-level methods. Manage the template\n// caches from these method calls instead of creating\n// your own TemplateCache instances\n_.extend(TemplateCache, {\n templateCaches: {},\n\n // Get the specified template by id. Either\n // retrieves the cached version, or loads it\n // from the DOM.\n get(templateId, options) {\n let cachedTemplate = this.templateCaches[templateId];\n\n if (!cachedTemplate) {\n cachedTemplate = new TemplateCache(templateId);\n this.templateCaches[templateId] = cachedTemplate;\n }\n\n return cachedTemplate.load(options);\n },\n\n // Clear templates from the cache. If no arguments\n // are specified, clears all templates:\n // `clear()`\n //\n // If arguments are specified, clears each of the\n // specified templates from the cache:\n // `clear(\"#t1\", \"#t2\", \"...\")`\n clear(...args) {\n let i;\n const length = args.length;\n\n if (length > 0) {\n for (i = 0; i < length; i++) {\n delete this.templateCaches[args[i]];\n }\n } else {\n this.templateCaches = {};\n }\n }\n});\n\n// TemplateCache instance methods, allowing each\n// template cache object to manage its own state\n// and know whether or not it has been loaded\n_.extend(TemplateCache.prototype, {\n\n // Internal method to load the template\n load(options) {\n // Guard clause to prevent loading this template more than once\n if (this.compiledTemplate) {\n return this.compiledTemplate;\n }\n\n // Load the template and compile it\n const template = this.loadTemplate(this.templateId, options);\n this.compiledTemplate = this.compileTemplate(template, options);\n\n return this.compiledTemplate;\n },\n\n // Load a template from the DOM, by default. Override\n // this method to provide your own template retrieval\n // For asynchronous loading with AMD/RequireJS, consider\n // using a template-loader plugin as described here:\n // https://github.com/marionettejs/backbone.marionette/wiki/Using-marionette-with-requirejs\n loadTemplate(templateId, options) {\n const $template = Backbone.$(templateId);\n\n if (!$template.length) {\n throw new MarionetteError({\n name: 'NoTemplateError',\n message: `Could not find template: \"${templateId}\"`\n });\n }\n return $template.html();\n },\n\n // Pre-compile the template before caching it. Override\n // this method if you do not need to pre-compile a template\n // (JST / RequireJS for example) or if you want to change\n // the template engine used (Handebars, etc).\n compileTemplate(rawTemplate, options) {\n return _.template(rawTemplate, options);\n }\n});\n\nexport default TemplateCache;\n","// Implementation of the invoke method (http://underscorejs.org/#invoke) with support for\n// lodash v3, v4, and underscore.js\nimport _ from 'underscore';\n\nexport default _.invokeMap || _.invoke;\n","import _ from 'underscore';\n\nimport {\n bindEvents,\n unbindEvents\n} from '../common/bind-events';\n\n// MixinOptions\n// - collectionEvents\n// - modelEvents\n\nexport default {\n // Handle `modelEvents`, and `collectionEvents` configuration\n _delegateEntityEvents(model, collection) {\n this._undelegateEntityEvents(model, collection);\n\n const modelEvents = _.result(this, 'modelEvents');\n bindEvents.call(this, model, modelEvents);\n\n const collectionEvents = _.result(this, 'collectionEvents');\n bindEvents.call(this, collection, collectionEvents);\n },\n\n _undelegateEntityEvents(model, collection) {\n const modelEvents = _.result(this, 'modelEvents');\n unbindEvents.call(this, model, modelEvents);\n\n const collectionEvents = _.result(this, 'collectionEvents');\n unbindEvents.call(this, collection, collectionEvents);\n }\n};\n","import _ from 'underscore';\n// allows for the use of the @ui. syntax within\n// a given key for triggers and events\n// swaps the @ui with the associated selector.\n// Returns a new, non-mutated, parsed events hash.\nconst normalizeUIKeys = function(hash, ui) {\n return _.reduce(hash, (memo, val, key) => {\n const normalizedKey = normalizeUIString(key, ui);\n memo[normalizedKey] = val;\n return memo;\n }, {});\n};\n\n// utility method for parsing @ui. syntax strings\n// into associated selector\nconst normalizeUIString = function(uiString, ui) {\n return uiString.replace(/@ui\\.[a-zA-Z-_$0-9]*/g, (r) => {\n return ui[r.slice(4)];\n });\n};\n\n// allows for the use of the @ui. syntax within\n// a given value for regions\n// swaps the @ui with the associated selector\nconst normalizeUIValues = function(hash, ui, properties) {\n _.each(hash, (val, key) => {\n if (_.isString(val)) {\n hash[key] = normalizeUIString(val, ui);\n } else if (_.isObject(val) && _.isArray(properties)) {\n _.extend(val, normalizeUIValues(_.pick(val, properties), ui));\n /* Value is an object, and we got an array of embedded property names to normalize. */\n _.each(properties, (property) => {\n const propertyVal = val[property];\n if (_.isString(propertyVal)) {\n val[property] = normalizeUIString(propertyVal, ui);\n }\n });\n }\n });\n return hash;\n};\n\nexport default {\n\n // normalize the keys of passed hash with the views `ui` selectors.\n // `{\"@ui.foo\": \"bar\"}`\n normalizeUIKeys(hash) {\n const uiBindings = this._getUIBindings();\n return normalizeUIKeys(hash, uiBindings);\n },\n\n // normalize the values of passed hash with the views `ui` selectors.\n // `{foo: \"@ui.bar\"}`\n normalizeUIValues(hash, properties) {\n const uiBindings = this._getUIBindings();\n return normalizeUIValues(hash, uiBindings, properties);\n },\n\n _getUIBindings() {\n const uiBindings = _.result(this, '_uiBindings');\n const ui = _.result(this, 'ui');\n return uiBindings || ui;\n },\n\n // This method binds the elements specified in the \"ui\" hash inside the view's code with\n // the associated jQuery selectors.\n _bindUIElements() {\n if (!this.ui) { return; }\n\n // store the ui hash in _uiBindings so they can be reset later\n // and so re-rendering the view will be able to find the bindings\n if (!this._uiBindings) {\n this._uiBindings = this.ui;\n }\n\n // get the bindings result, as a function or otherwise\n const bindings = _.result(this, '_uiBindings');\n\n // empty the ui so we don't have anything to start with\n this._ui = {};\n\n // bind each of the selectors\n _.each(bindings, (selector, key) => {\n this._ui[key] = this.$(selector);\n });\n\n this.ui = this._ui;\n },\n\n _unbindUIElements() {\n if (!this.ui || !this._uiBindings) { return; }\n\n // delete all of the existing ui bindings\n _.each(this.ui, ($el, name) => {\n delete this.ui[name];\n });\n\n // reset the ui element to the original bindings configuration\n this.ui = this._uiBindings;\n delete this._uiBindings;\n delete this._ui;\n },\n\n _getUI(name) {\n return this._ui[name];\n }\n};\n","// ViewMixin\n// ---------\n\nimport Backbone from 'backbone';\nimport _ from 'underscore';\nimport isNodeAttached from '../common/is-node-attached';\nimport { triggerMethod } from '../common/trigger-method';\nimport BehaviorsMixin from './behaviors';\nimport CommonMixin from './common';\nimport DelegateEntityEventsMixin from './delegate-entity-events';\nimport TriggersMixin from './triggers';\nimport UIMixin from './ui';\nimport View from '../view';\nimport MarionetteError from '../error';\n\n// MixinOptions\n// - behaviors\n// - childViewEventPrefix\n// - childViewEvents\n// - childViewTriggers\n// - collectionEvents\n// - modelEvents\n// - triggers\n// - ui\n\n\nconst ViewMixin = {\n supportsRenderLifecycle: true,\n supportsDestroyLifecycle: true,\n\n _isDestroyed: false,\n\n isDestroyed() {\n return !!this._isDestroyed;\n },\n\n _isRendered: false,\n\n isRendered() {\n return !!this._isRendered;\n },\n\n _isAttached: false,\n\n isAttached() {\n return !!this._isAttached;\n },\n\n // Overriding Backbone.View's `setElement` to handle\n // if an el was previously defined. If so, the view might be\n // rendered or attached on setElement.\n setElement() {\n const hasEl = !!this.el;\n\n Backbone.View.prototype.setElement.apply(this, arguments);\n\n if (hasEl) {\n this._isRendered = !!this.$el.length;\n this._isAttached = isNodeAttached(this.el);\n }\n\n return this;\n },\n\n // Overriding Backbone.View's `delegateEvents` to handle\n // `events` and `triggers`\n delegateEvents(eventsArg) {\n\n this._proxyBehaviorViewProperties();\n this._buildEventProxies();\n\n const viewEvents = this._getEvents(eventsArg);\n\n if (typeof eventsArg === 'undefined') {\n this.events = viewEvents;\n }\n\n const combinedEvents = _.extend({},\n this._getBehaviorEvents(),\n viewEvents,\n this._getBehaviorTriggers(),\n this.getTriggers()\n );\n\n Backbone.View.prototype.delegateEvents.call(this, combinedEvents);\n\n return this;\n },\n\n _getEvents(eventsArg) {\n const events = eventsArg || this.events;\n\n if (_.isFunction(events)) {\n return this.normalizeUIKeys(events.call(this));\n }\n\n return this.normalizeUIKeys(events);\n },\n\n // Configure `triggers` to forward DOM events to view\n // events. `triggers: {\"click .foo\": \"do:foo\"}`\n getTriggers() {\n if (!this.triggers) { return; }\n\n // Allow `triggers` to be configured as a function\n const triggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n // Configure the triggers, prevent default\n // action and stop propagation of DOM events\n return this._getViewTriggers(this, triggers);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.model, this.collection);\n\n // bind each behaviors model and collection events\n this._delegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Handle unbinding `modelEvents`, and `collectionEvents` configuration\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.model, this.collection);\n\n // unbind each behaviors model and collection events\n this._undelegateBehaviorEntityEvents();\n\n return this;\n },\n\n // Internal helper method to verify whether the view hasn't been destroyed\n _ensureViewIsIntact() {\n if (this._isDestroyed) {\n throw new MarionetteError({\n name: 'ViewDestroyedError',\n message: `View (cid: \"${this.cid}\") has already been destroyed and cannot be used.`\n });\n }\n },\n\n // Handle destroying the view and its children.\n destroy(...args) {\n if (this._isDestroyed) { return this; }\n const shouldTriggerDetach = !!this._isAttached;\n\n this.triggerMethod('before:destroy', this, ...args);\n if (shouldTriggerDetach) {\n this.triggerMethod('before:detach', this);\n }\n\n // unbind UI elements\n this.unbindUIElements();\n\n // remove the view from the DOM\n // https://github.com/jashkenas/backbone/blob/1.2.3/backbone.js#L1235\n this._removeElement();\n\n if (shouldTriggerDetach) {\n this._isAttached = false;\n this.triggerMethod('detach', this);\n }\n\n // remove children after the remove to prevent extra paints\n this._removeChildren();\n\n this._destroyBehaviors(args);\n\n this._isDestroyed = true;\n this._isRendered = false;\n this.triggerMethod('destroy', this, ...args);\n\n this.stopListening();\n\n return this;\n },\n\n bindUIElements() {\n this._bindUIElements();\n this._bindBehaviorUIElements();\n\n return this;\n },\n\n // This method unbinds the elements specified in the \"ui\" hash\n unbindUIElements() {\n this._unbindUIElements();\n this._unbindBehaviorUIElements();\n\n return this;\n },\n\n getUI(name) {\n this._ensureViewIsIntact();\n return this._getUI(name);\n },\n\n // used as the prefix for child view events\n // that are forwarded through the layoutview\n childViewEventPrefix: 'childview',\n\n // import the `triggerMethod` to trigger events with corresponding\n // methods if the method exists\n triggerMethod(...args) {\n const ret = triggerMethod.apply(this, args);\n\n this._triggerEventOnBehaviors(...args);\n this._triggerEventOnParentLayout(...args);\n\n return ret;\n },\n\n // Cache `childViewEvents` and `childViewTriggers`\n _buildEventProxies() {\n this._childViewEvents = _.result(this, 'childViewEvents');\n this._childViewTriggers = _.result(this, 'childViewTriggers');\n },\n\n _triggerEventOnParentLayout(eventName, ...args) {\n const layoutView = this._parentView();\n if (!layoutView) {\n return;\n }\n\n // invoke triggerMethod on parent view\n const eventPrefix = _.result(layoutView, 'childViewEventPrefix');\n const prefixedEventName = eventPrefix + ':' + eventName;\n\n layoutView.triggerMethod(prefixedEventName, ...args);\n\n // use the parent view's childViewEvents handler\n const childViewEvents = layoutView.normalizeMethods(layoutView._childViewEvents);\n\n if (!!childViewEvents && _.isFunction(childViewEvents[eventName])) {\n childViewEvents[eventName].apply(layoutView, args);\n }\n\n // use the parent view's proxyEvent handlers\n const childViewTriggers = layoutView._childViewTriggers;\n\n // Call the event with the proxy name on the parent layout\n if (childViewTriggers && _.isString(childViewTriggers[eventName])) {\n layoutView.triggerMethod(childViewTriggers[eventName], ...args);\n }\n },\n\n // Walk the _parent tree until we find a view (if one exists).\n // Returns the parent view hierarchically closest to this view.\n _parentView() {\n let parent = this._parent;\n\n while (parent) {\n if (parent instanceof View) {\n return parent;\n }\n parent = parent._parent;\n }\n }\n};\n\n_.extend(ViewMixin, BehaviorsMixin, CommonMixin, DelegateEntityEventsMixin, TriggersMixin, UIMixin);\n\nexport default ViewMixin;\n","// Region\n// ------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport destroyBackboneView from './utils/destroy-backbone-view';\nimport monitorViewEvents from './common/monitor-view-events';\nimport isNodeAttached from './common/is-node-attached';\nimport { triggerMethodOn } from './common/trigger-method';\nimport MarionetteObject from './object';\nimport MarionetteError from './error';\n\nconst ClassOptions = [\n 'allowMissingEl',\n 'parentEl',\n 'replaceElement'\n];\n\nconst Region = MarionetteObject.extend({\n cidPrefix: 'mnr',\n replaceElement: false,\n _isReplaced: false,\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n // getOption necessary because options.el may be passed as undefined\n this._initEl = this.el = this.getOption('el');\n\n // Handle when this.el is passed in as a $ wrapped element.\n this.el = this.el instanceof Backbone.$ ? this.el[0] : this.el;\n\n if (!this.el) {\n throw new MarionetteError({\n name: 'NoElError',\n message: 'An \"el\" must be specified for a region.'\n });\n }\n\n this.$el = this.getEl(this.el);\n MarionetteObject.call(this, options);\n },\n\n // Displays a backbone view instance inside of the region. Handles calling the `render`\n // method for you. Reads content directly from the `el` attribute. The `preventDestroy`\n // option can be used to prevent a view from the old view being destroyed on show.\n show(view, options) {\n if (!this._ensureElement(options)) {\n return;\n }\n this._ensureView(view);\n if (view === this.currentView) { return this; }\n\n this.triggerMethod('before:show', this, view, options);\n\n monitorViewEvents(view);\n\n this.empty(options);\n\n // We need to listen for if a view is destroyed in a way other than through the region.\n // If this happens we need to remove the reference to the currentView since once a view\n // has been destroyed we can not reuse it.\n view.on('destroy', this.empty, this);\n\n // Make this region the view's parent.\n // It's important that this parent binding happens before rendering so that any events\n // the child may trigger during render can also be triggered on the child's ancestor views.\n view._parent = this;\n\n this._renderView(view);\n\n this._attachView(view, options);\n\n this.triggerMethod('show', this, view, options);\n return this;\n },\n\n _renderView(view) {\n if (view._isRendered) {\n return;\n }\n\n if (!view.supportsRenderLifecycle) {\n triggerMethodOn(view, 'before:render', view);\n }\n\n view.render();\n\n if (!view.supportsRenderLifecycle) {\n view._isRendered = true;\n triggerMethodOn(view, 'render', view);\n }\n },\n\n _attachView(view, options = {}) {\n const shouldTriggerAttach = !view._isAttached && isNodeAttached(this.el);\n const shouldReplaceEl = typeof options.replaceElement === 'undefined' ? !!_.result(this, 'replaceElement') : !!options.replaceElement;\n\n if (shouldTriggerAttach) {\n triggerMethodOn(view, 'before:attach', view);\n }\n\n this.attachHtml(view, shouldReplaceEl);\n\n if (shouldTriggerAttach) {\n view._isAttached = true;\n triggerMethodOn(view, 'attach', view);\n }\n\n this.currentView = view;\n },\n\n _ensureElement(options = {}) {\n if (!_.isObject(this.el)) {\n this.$el = this.getEl(this.el);\n this.el = this.$el[0];\n }\n\n if (!this.$el || this.$el.length === 0) {\n const allowMissingEl = typeof options.allowMissingEl === 'undefined' ? !!_.result(this, 'allowMissingEl') : !!options.allowMissingEl;\n\n if (allowMissingEl) {\n return false;\n } else {\n throw new MarionetteError(`An \"el\" must exist in DOM for this region ${this.cid}`);\n }\n }\n return true;\n },\n\n _ensureView(view) {\n if (!view) {\n throw new MarionetteError({\n name: 'ViewNotValid',\n message: 'The view passed is undefined and therefore invalid. You must pass a view instance to show.'\n });\n }\n\n if (view._isDestroyed) {\n throw new MarionetteError({\n name: 'ViewDestroyedError',\n message: `View (cid: \"${view.cid}\") has already been destroyed and cannot be used.`\n });\n }\n },\n\n // Override this method to change how the region finds the DOM element that it manages. Return\n // a jQuery selector object scoped to a provided parent el or the document if none exists.\n getEl(el) {\n return Backbone.$(el, _.result(this, 'parentEl'));\n },\n\n _replaceEl(view) {\n // always restore the el to ensure the regions el is present before replacing\n this._restoreEl();\n\n const parent = this.el.parentNode;\n\n parent.replaceChild(view.el, this.el);\n this._isReplaced = true;\n },\n\n // Restore the region's element in the DOM.\n _restoreEl() {\n // There is nothing to replace\n if (!this._isReplaced) {\n return;\n }\n\n const view = this.currentView;\n\n if (!view) {\n return;\n }\n\n const parent = view.el.parentNode;\n\n if (!parent) {\n return;\n }\n\n parent.replaceChild(this.el, view.el);\n this._isReplaced = false;\n },\n\n // Check to see if the region's el was replaced.\n isReplaced() {\n return !!this._isReplaced;\n },\n\n // Override this method to change how the new view is appended to the `$el` that the\n // region is managing\n attachHtml(view, shouldReplace) {\n if (shouldReplace) {\n // replace the region's node with the view's node\n this._replaceEl(view);\n } else {\n this.el.appendChild(view.el);\n }\n },\n\n // Destroy the current view, if there is one. If there is no current view, it does\n // nothing and returns immediately.\n empty(options = { allowMissingEl: true }) {\n const view = this.currentView;\n\n // If there is no view in the region we should only detach current html\n if (!view) {\n if (this._ensureElement(options)) {\n this.detachHtml();\n }\n return this;\n }\n\n view.off('destroy', this.empty, this);\n this.triggerMethod('before:empty', this, view);\n\n this._restoreEl();\n\n delete this.currentView;\n\n if (!view._isDestroyed) {\n this._removeView(view, options);\n delete view._parent;\n }\n\n this.triggerMethod('empty', this, view);\n return this;\n },\n\n _removeView(view, {preventDestroy} = {}) {\n const shouldPreventDestroy = !!preventDestroy;\n\n if (shouldPreventDestroy) {\n this._detachView(view);\n return;\n }\n\n if (view.destroy) {\n view.destroy();\n } else {\n destroyBackboneView(view);\n }\n },\n\n _detachView(view) {\n const shouldTriggerDetach = !!view._isAttached;\n if (shouldTriggerDetach) {\n triggerMethodOn(view, 'before:detach', view);\n }\n\n this.detachHtml();\n\n if (shouldTriggerDetach) {\n view._isAttached = false;\n triggerMethodOn(view, 'detach', view);\n }\n },\n\n // Override this method to change how the region detaches current content\n detachHtml() {\n this.$el.contents().detach();\n },\n\n // Checks whether a view is currently present within the region. Returns `true` if there is\n // and `false` if no view is present.\n hasView() {\n return !!this.currentView;\n },\n\n // Reset the region by destroying any existing view and clearing out the cached `$el`.\n // The next time a view is shown via this region, the region will re-query the DOM for\n // the region's `el`.\n reset(options) {\n this.empty(options);\n\n if (this.$el) {\n this.el = this._initEl;\n }\n\n delete this.$el;\n return this;\n },\n\n destroy(options) {\n this.reset(options);\n return MarionetteObject.prototype.destroy.apply(this, arguments);\n }\n});\n\nexport default Region;\n","import _ from 'underscore';\nimport _invoke from '../utils/invoke';\nimport Region from '../region';\nimport MarionetteError from '../error';\n\n// MixinOptions\n// - regions\n// - regionClass\n\nexport default {\n regionClass: Region,\n\n // Internal method to initialize the regions that have been defined in a\n // `regions` attribute on this View.\n _initRegions() {\n\n // init regions hash\n this.regions = this.regions || {};\n this._regions = {};\n\n this.addRegions(_.result(this, 'regions'));\n },\n\n // Internal method to re-initialize all of the regions by updating\n // the `el` that they point to\n _reInitRegions() {\n _invoke(this._regions, 'reset');\n },\n\n // Add a single region, by name, to the View\n addRegion(name, definition) {\n const regions = {};\n regions[name] = definition;\n return this.addRegions(regions)[name];\n },\n\n // Add multiple regions as a {name: definition, name2: def2} object literal\n addRegions(regions) {\n // If there's nothing to add, stop here.\n if (_.isEmpty(regions)) {\n return;\n }\n\n // Normalize region selectors hash to allow\n // a user to use the @ui. syntax.\n regions = this.normalizeUIValues(regions, ['selector', 'el']);\n\n // Add the regions definitions to the regions property\n this.regions = _.extend({}, this.regions, regions);\n\n return this._addRegions(regions);\n },\n\n // internal method to build and add regions\n _addRegions(regionDefinitions) {\n return _.reduce(regionDefinitions, (regions, definition, name) => {\n regions[name] = this._buildRegion(definition);\n this._addRegion(regions[name], name);\n return regions;\n }, {});\n },\n\n // return the region instance from the definition\n _buildRegion(definition) {\n if (definition instanceof Region) {\n return definition;\n }\n\n return this._buildRegionFromDefinition(definition);\n },\n\n _buildRegionFromDefinition(definition) {\n if (_.isString(definition)) {\n return this._buildRegionFromObject({el: definition});\n }\n\n if (_.isFunction(definition)) {\n return this._buildRegionFromRegionClass(definition);\n }\n\n if (_.isObject(definition)) {\n return this._buildRegionFromObject(definition);\n }\n\n throw new MarionetteError({\n message: 'Improper region configuration type.',\n url: 'marionette.region.html#region-configuration-types'\n });\n },\n\n _buildRegionFromObject(definition) {\n const RegionClass = definition.regionClass || this.regionClass;\n\n const options = _.omit(definition, 'regionClass');\n\n _.defaults(options, {\n el: definition.selector,\n parentEl: _.partial(_.result, this, 'el')\n });\n\n return new RegionClass(options);\n },\n\n // Build the region directly from a given `RegionClass`\n _buildRegionFromRegionClass(RegionClass) {\n return new RegionClass({\n parentEl: _.partial(_.result, this, 'el')\n });\n },\n\n _addRegion(region, name) {\n this.triggerMethod('before:add:region', this, name, region);\n\n region._parent = this;\n\n this._regions[name] = region;\n\n this.triggerMethod('add:region', this, name, region);\n },\n\n // Remove a single region from the View, by name\n removeRegion(name) {\n const region = this._regions[name];\n\n this._removeRegion(region, name);\n\n return region;\n },\n\n // Remove all regions from the View\n removeRegions() {\n const regions = this.getRegions();\n\n _.each(this._regions, _.bind(this._removeRegion, this));\n\n return regions;\n },\n\n _removeRegion(region, name) {\n this.triggerMethod('before:remove:region', this, name, region);\n\n region.empty();\n region.stopListening();\n\n delete this.regions[name];\n delete this._regions[name];\n\n this.triggerMethod('remove:region', this, name, region);\n },\n\n // Empty all regions in the region manager, but\n // leave them attached\n emptyRegions() {\n const regions = this.getRegions();\n _invoke(regions, 'empty');\n return regions;\n },\n\n // Checks to see if view contains region\n // Accepts the region name\n // hasRegion('main')\n hasRegion(name) {\n return !!this.getRegion(name);\n },\n\n // Provides access to regions\n // Accepts the region name\n // getRegion('main')\n getRegion(name) {\n return this._regions[name];\n },\n\n // Get all regions\n getRegions() {\n return _.clone(this._regions);\n },\n\n showChildView(name, view, ...args) {\n const region = this.getRegion(name);\n return region.show(view, ...args);\n },\n\n getChildView(name) {\n return this.getRegion(name).currentView;\n }\n\n};\n","// Renderer\n// --------\n\nimport _ from 'underscore';\nimport MarionetteError from '../error';\nimport TemplateCache from '../template-cache';\n\n// Render a template with data by passing in the template\n// selector and the data to render.\nconst Renderer = {\n\n // Render a template with data. The `template` parameter is\n // passed to the `TemplateCache` object to retrieve the\n // template function. Override this method to provide your own\n // custom rendering and template handling for all of Marionette.\n render(template, data) {\n if (!template) {\n throw new MarionetteError({\n name: 'TemplateNotFoundError',\n message: 'Cannot render the template since its false, null or undefined.'\n });\n }\n\n const templateFunc = _.isFunction(template) ? template : TemplateCache.get(template);\n\n return templateFunc(data);\n }\n};\n\nexport default Renderer;\n","// View\n// ---------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport monitorViewEvents from './common/monitor-view-events';\nimport ViewMixin from './mixins/view';\nimport RegionsMixin from './mixins/regions';\nimport Renderer from './config/renderer';\n\nconst ClassOptions = [\n 'behaviors',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewTriggers',\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'regionClass',\n 'regions',\n 'template',\n 'templateContext',\n 'triggers',\n 'ui'\n];\n\n// The standard view. Includes view events, automatic rendering\n// of Underscore templates, nested views, and more.\nconst View = Backbone.View.extend({\n\n constructor(options) {\n this.render = _.bind(this.render, this);\n\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this._initRegions();\n\n const args = Array.prototype.slice.call(arguments);\n args[0] = this.options;\n Backbone.View.prototype.constructor.apply(this, args);\n\n this.delegateEntityEvents();\n },\n\n // Serialize the view's model *or* collection, if\n // it exists, for the template\n serializeData() {\n if (!this.model && !this.collection) {\n return {};\n }\n\n // If we have a model, we serialize that\n if (this.model) {\n return this.serializeModel();\n }\n\n // Otherwise, we serialize the collection,\n // making it available under the `items` property\n return {\n items: this.serializeCollection()\n };\n },\n\n // Prepares the special `model` property of a view\n // for being displayed in the template. By default\n // we simply clone the attributes. Override this if\n // you need a custom transformation for your view's model\n serializeModel() {\n if (!this.model) { return {}; }\n return _.clone(this.model.attributes);\n },\n\n // Serialize a collection by cloning each of\n // its model's attributes\n serializeCollection() {\n if (!this.collection) { return {}; }\n return this.collection.map(function(model) { return _.clone(model.attributes); });\n },\n\n // Render the view, defaulting to underscore.js templates.\n // You can override this in your view definition to provide\n // a very specific rendering for your view. In general, though,\n // you should override the `Marionette.Renderer` object to\n // change how Marionette renders views.\n // Subsequent renders after the first will re-render all nested\n // views.\n render() {\n this._ensureViewIsIntact();\n\n this.triggerMethod('before:render', this);\n\n // If this is not the first render call, then we need to\n // re-initialize the `el` for each region\n if (this._isRendered) {\n this._reInitRegions();\n }\n\n this._renderTemplate();\n this.bindUIElements();\n\n this._isRendered = true;\n this.triggerMethod('render', this);\n\n return this;\n },\n\n // Internal method to render the template with the serialized data\n // and template context via the `Marionette.Renderer` object.\n _renderTemplate() {\n const template = this.getTemplate();\n\n // Allow template-less views\n if (template === false) {\n return;\n }\n\n // Add in entity data and template context\n const data = this.mixinTemplateContext(this.serializeData());\n\n // Render and add to el\n const html = Renderer.render(template, data, this);\n this.attachElContent(html);\n },\n\n // Get the template for this view\n // instance. You can set a `template` attribute in the view\n // definition or pass a `template: \"whatever\"` parameter in\n // to the constructor options.\n getTemplate() {\n return this.template;\n },\n\n // Mix in template context methods. Looks for a\n // `templateContext` attribute, which can either be an\n // object literal, or a function that returns an object\n // literal. All methods and attributes from this object\n // are copies to the object passed in.\n mixinTemplateContext(target = {}) {\n const templateContext = _.result(this, 'templateContext');\n return _.extend(target, templateContext);\n },\n\n // Attaches the content of a given view.\n // This method can be overridden to optimize rendering,\n // or to render in a non standard way.\n //\n // For example, using `innerHTML` instead of `$el.html`\n //\n // ```js\n // attachElContent(html) {\n // this.el.innerHTML = html;\n // return this;\n // }\n // ```\n attachElContent(html) {\n this.$el.html(html);\n\n return this;\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this.removeRegions();\n },\n\n _getImmediateChildren() {\n return _.chain(this.getRegions())\n .map('currentView')\n .compact()\n .value();\n }\n});\n\n_.extend(View.prototype, ViewMixin, RegionsMixin);\n\nexport default View;\n","// Mix in methods from Underscore, for iteration, and other\n// collection related features.\n// Borrowing this code from Backbone.Collection:\n// https://github.com/jashkenas/backbone/blob/1.1.2/backbone.js#L962\n\nimport _ from 'underscore';\n\nconst methods = ['forEach', 'each', 'map', 'find', 'detect', 'filter',\n 'select', 'reject', 'every', 'all', 'some', 'any', 'include',\n 'contains', 'invoke', 'toArray', 'first', 'initial', 'rest',\n 'last', 'without', 'isEmpty', 'pluck', 'reduce'];\n\nconst emulateCollection = function(object, listProperty) {\n _.each(methods, function(method) {\n object[method] = function() {\n const list = _.values(_.result(this, listProperty));\n const args = [list].concat(_.toArray(arguments));\n return _[method].apply(_, args);\n };\n });\n};\n\nexport default emulateCollection;\n","import _ from 'underscore';\nimport emulateCollection from './utils/emulate-collection';\n\n// Provide a container to store, retrieve and\n// shut down child views.\nconst Container = function(views) {\n this._views = {};\n this._indexByModel = {};\n this._indexByCustom = {};\n this._updateLength();\n\n _.each(views, _.bind(this.add, this));\n};\n\nemulateCollection(Container.prototype, '_views');\n\n// Container Methods\n// -----------------\n\n_.extend(Container.prototype, {\n\n // Add a view to this container. Stores the view\n // by `cid` and makes it searchable by the model\n // cid (and model itself). Optionally specify\n // a custom key to store an retrieve the view.\n add(view, customIndex) {\n return this._add(view, customIndex)._updateLength();\n },\n\n // To be used when avoiding call _updateLength\n // When you are done adding all your new views\n // call _updateLength\n _add(view, customIndex) {\n const viewCid = view.cid;\n\n // store the view\n this._views[viewCid] = view;\n\n // index it by model\n if (view.model) {\n this._indexByModel[view.model.cid] = viewCid;\n }\n\n // index by custom\n if (customIndex) {\n this._indexByCustom[customIndex] = viewCid;\n }\n\n return this;\n },\n\n // Find a view by the model that was attached to\n // it. Uses the model's `cid` to find it.\n findByModel(model) {\n return this.findByModelCid(model.cid);\n },\n\n // Find a view by the `cid` of the model that was attached to\n // it. Uses the model's `cid` to find the view `cid` and\n // retrieve the view using it.\n findByModelCid(modelCid) {\n const viewCid = this._indexByModel[modelCid];\n return this.findByCid(viewCid);\n },\n\n // Find a view by a custom indexer.\n findByCustom(index) {\n const viewCid = this._indexByCustom[index];\n return this.findByCid(viewCid);\n },\n\n // Find by index. This is not guaranteed to be a\n // stable index.\n findByIndex(index) {\n return _.values(this._views)[index];\n },\n\n // retrieve a view by its `cid` directly\n findByCid(cid) {\n return this._views[cid];\n },\n\n // Remove a view\n remove(view) {\n return this._remove(view)._updateLength();\n },\n\n // To be used when avoiding call _updateLength\n // When you are done adding all your new views\n // call _updateLength\n _remove(view) {\n const viewCid = view.cid;\n\n // delete model index\n if (view.model) {\n delete this._indexByModel[view.model.cid];\n }\n\n // delete custom index\n _.some(this._indexByCustom, _.bind(function(cid, key) {\n if (cid === viewCid) {\n delete this._indexByCustom[key];\n return true;\n }\n }, this));\n\n // remove the view from the container\n delete this._views[viewCid];\n\n return this;\n },\n\n // Update the `.length` attribute on this container\n _updateLength() {\n this.length = _.size(this._views);\n\n return this;\n }\n});\n\nexport default Container;\n","// Collection View\n// ---------------\n\nimport _ from 'underscore';\nimport Backbone from 'backbone';\nimport destroyBackboneView from './utils/destroy-backbone-view';\nimport monitorViewEvents from './common/monitor-view-events';\nimport { triggerMethodOn } from './common/trigger-method';\nimport ChildViewContainer from './child-view-container';\nimport MarionetteError from './error';\nimport ViewMixin from './mixins/view';\n\nconst ClassOptions = [\n 'behaviors',\n 'childView',\n 'childViewEventPrefix',\n 'childViewEvents',\n 'childViewOptions',\n 'childViewTriggers',\n 'collectionEvents',\n 'events',\n 'filter',\n 'emptyView',\n 'emptyViewOptions',\n 'modelEvents',\n 'reorderOnSort',\n 'sort',\n 'triggers',\n 'ui',\n 'viewComparator'\n];\n\n// A view that iterates over a Backbone.Collection\n// and renders an individual child view for each model.\nconst CollectionView = Backbone.View.extend({\n\n // flag for maintaining the sorted order of the collection\n sort: true,\n\n // constructor\n // option to pass `{sort: false}` to prevent the `CollectionView` from\n // maintaining the sorted order of the collection.\n // This will fallback onto appending childView's to the end.\n //\n // option to pass `{viewComparator: compFunction()}` to allow the `CollectionView`\n // to use a custom sort order for the collection.\n constructor(options) {\n this.render = _.bind(this.render, this);\n\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n monitorViewEvents(this);\n\n this._initBehaviors();\n this.once('render', this._initialEvents);\n this._initChildViewStorage();\n this._bufferedChildren = [];\n\n const args = Array.prototype.slice.call(arguments);\n args[0] = this.options;\n Backbone.View.prototype.constructor.apply(this, args);\n\n this.delegateEntityEvents();\n },\n\n // Instead of inserting elements one by one into the page, it's much more performant to insert\n // elements into a document fragment and then insert that document fragment into the page\n _startBuffering() {\n this._isBuffering = true;\n },\n\n _endBuffering() {\n const shouldTriggerAttach = !!this._isAttached;\n const triggerOnChildren = shouldTriggerAttach ? this._getImmediateChildren() : [];\n\n this._isBuffering = false;\n\n _.each(triggerOnChildren, child => {\n triggerMethodOn(child, 'before:attach', child);\n });\n\n this.attachBuffer(this, this._createBuffer());\n\n _.each(triggerOnChildren, child => {\n child._isAttached = true;\n triggerMethodOn(child, 'attach', child);\n });\n\n this._bufferedChildren = [];\n },\n\n _getImmediateChildren() {\n return _.values(this.children._views);\n },\n\n // Configured the initial events that the collection view binds to.\n _initialEvents() {\n if (this.collection) {\n this.listenTo(this.collection, 'add', this._onCollectionAdd);\n this.listenTo(this.collection, 'remove', this._onCollectionRemove);\n this.listenTo(this.collection, 'reset', this.render);\n\n if (this.sort) {\n this.listenTo(this.collection, 'sort', this._sortViews);\n }\n }\n },\n\n // Handle a child added to the collection\n _onCollectionAdd(child, collection, opts) {\n // `index` is present when adding with `at` since BB 1.2; indexOf fallback for < 1.2\n let index = opts.at !== undefined && (opts.index || collection.indexOf(child));\n\n // When filtered or when there is no initial index, calculate index.\n if (this.filter || index === false) {\n index = _.indexOf(this._filteredSortedModels(index), child);\n }\n\n if (this._shouldAddChild(child, index)) {\n this._destroyEmptyView();\n const ChildView = this._getChildView(child);\n this._addChild(child, ChildView, index);\n }\n },\n\n // get the child view by model it holds, and remove it\n _onCollectionRemove(model) {\n const view = this.children.findByModel(model);\n this.removeChildView(view);\n this._checkEmpty();\n },\n\n // Render children views. Override this method to provide your own implementation of a\n // render function for the collection view.\n render() {\n this._ensureViewIsIntact();\n this.triggerMethod('before:render', this);\n this._renderChildren();\n this._isRendered = true;\n this.triggerMethod('render', this);\n return this;\n },\n\n // An efficient rendering used for filtering. Instead of modifying the whole DOM for the\n // collection view, we are only adding or removing the related childrenViews.\n setFilter(filter, {preventRender} = {}) {\n const canBeRendered = this._isRendered && !this._isDestroyed;\n const filterChanged = this.filter !== filter;\n const shouldRender = canBeRendered && filterChanged && !preventRender;\n\n if (shouldRender) {\n const previousModels = this._filteredSortedModels();\n this.filter = filter;\n const models = this._filteredSortedModels();\n this._applyModelDeltas(models, previousModels);\n } else {\n this.filter = filter;\n }\n\n return this;\n },\n\n // `removeFilter` is actually an alias for removing filters.\n removeFilter(options) {\n return this.setFilter(null, options);\n },\n\n // Calculate and apply difference by cid between `models` and `previousModels`.\n _applyModelDeltas(models, previousModels) {\n const currentIds = {};\n _.each(models, (model, index) => {\n const addedChildNotExists = !this.children.findByModel(model);\n if (addedChildNotExists) {\n this._onCollectionAdd(model, this.collection, {at: index});\n }\n currentIds[model.cid] = true;\n });\n _.each(previousModels, (prevModel) => {\n const removedChildExists = !currentIds[prevModel.cid] && this.children.findByModel(prevModel);\n if (removedChildExists) {\n this._onCollectionRemove(prevModel);\n }\n });\n },\n\n // Reorder DOM after sorting. When your element's rendering do not use their index,\n // you can pass reorderOnSort: true to only reorder the DOM after a sort instead of\n // rendering all the collectionView.\n reorder() {\n const children = this.children;\n const models = this._filteredSortedModels();\n\n if (!models.length && this._showingEmptyView) { return this; }\n\n const anyModelsAdded = _.some(models, function(model) {\n return !children.findByModel(model);\n });\n\n // If there are any new models added due to filtering we need to add child views,\n // so render as normal.\n if (anyModelsAdded) {\n this.render();\n } else {\n // Get the DOM nodes in the same order as the models.\n const elsToReorder = _.map(models, function(model, index) {\n const view = children.findByModel(model);\n view._index = index;\n return view.el;\n });\n\n // Find the views that were children before but aren't in this new ordering.\n const filteredOutViews = children.filter(function(view) {\n return !_.contains(elsToReorder, view.el);\n });\n\n this.triggerMethod('before:reorder', this);\n\n // Since append moves elements that are already in the DOM, appending the elements\n // will effectively reorder them.\n this._appendReorderedChildren(elsToReorder);\n\n // remove any views that have been filtered out\n _.each(filteredOutViews, _.bind(this.removeChildView, this));\n this._checkEmpty();\n\n this.triggerMethod('reorder', this);\n }\n return this;\n },\n\n // Render view after sorting. Override this method to change how the view renders\n // after a `sort` on the collection.\n resortView() {\n if (this.reorderOnSort) {\n this.reorder();\n } else {\n this._renderChildren();\n }\n return this;\n },\n\n // Internal method. This checks for any changes in the order of the collection.\n // If the index of any view doesn't match, it will render.\n _sortViews() {\n const models = this._filteredSortedModels();\n\n // check for any changes in sort order of views\n const orderChanged = _.find(models, (item, index) => {\n const view = this.children.findByModel(item);\n return !view || view._index !== index;\n });\n\n if (orderChanged) {\n this.resortView();\n }\n },\n\n // Internal reference to what index a `emptyView` is.\n _emptyViewIndex: -1,\n\n // Internal method. Separated so that CompositeView can append to the childViewContainer\n // if necessary\n _appendReorderedChildren(children) {\n this.$el.append(children);\n },\n\n // Internal method. Separated so that CompositeView can have more control over events\n // being triggered, around the rendering process\n _renderChildren() {\n if (this._isRendered) {\n this._destroyEmptyView();\n this._destroyChildren({checkEmpty: false});\n }\n\n const models = this._filteredSortedModels();\n if (this.isEmpty({processedModels: models})) {\n this._showEmptyView();\n } else {\n this.triggerMethod('before:render:children', this);\n this._startBuffering();\n this._showCollection(models);\n this._endBuffering();\n this.triggerMethod('render:children', this);\n }\n },\n\n // Internal method to loop through collection and show each child view.\n _showCollection(models) {\n _.each(models, (child, index) => {\n const ChildView = this._getChildView(child);\n this._addChild(child, ChildView, index);\n });\n },\n\n // Allow the collection to be sorted by a custom view comparator\n _filteredSortedModels(addedAt) {\n if (!this.collection || !this.collection.length) { return []; }\n\n const viewComparator = this.getViewComparator();\n let models = this.collection.models;\n addedAt = Math.min(Math.max(addedAt, 0), models.length - 1);\n\n if (viewComparator) {\n let addedModel;\n // Preserve `at` location, even for a sorted view\n if (addedAt) {\n addedModel = models[addedAt];\n models = models.slice(0, addedAt).concat(models.slice(addedAt + 1));\n }\n models = this._sortModelsBy(models, viewComparator);\n if (addedModel) {\n models.splice(addedAt, 0, addedModel);\n }\n }\n\n // Filter after sorting in case the filter uses the index\n models = this._filterModels(models);\n\n return models;\n },\n\n getViewComparator() {\n return this.viewComparator;\n },\n\n // Filter an array of models, if a filter exists\n _filterModels(models) {\n if (this.filter) {\n models = _.filter(models, (model, index) => {\n return this._shouldAddChild(model, index);\n });\n }\n return models;\n },\n\n _sortModelsBy(models, comparator) {\n if (typeof comparator === 'string') {\n return _.sortBy(models, (model) => {\n return model.get(comparator);\n });\n } else if (comparator.length === 1) {\n return _.sortBy(models, _.bind(comparator, this));\n } else {\n return models.sort(_.bind(comparator, this));\n }\n },\n\n // Internal method to show an empty view in place of a collection of child views,\n // when the collection is empty\n _showEmptyView() {\n const EmptyView = this._getEmptyView();\n\n if (EmptyView && !this._showingEmptyView) {\n this._showingEmptyView = true;\n\n const model = new Backbone.Model();\n let emptyViewOptions =\n this.emptyViewOptions || this.childViewOptions;\n if (_.isFunction(emptyViewOptions)) {\n emptyViewOptions = emptyViewOptions.call(this, model, this._emptyViewIndex);\n }\n\n const view = this.buildChildView(model, EmptyView, emptyViewOptions);\n\n this.triggerMethod('before:render:empty', this, view);\n this._addChildView(view, 0);\n this.triggerMethod('render:empty', this, view);\n\n view._parent = this;\n }\n },\n\n // Internal method to destroy an existing emptyView instance if one exists. Called when\n // a collection view has been rendered empty, and then a child is added to the collection.\n _destroyEmptyView() {\n if (this._showingEmptyView) {\n this.triggerMethod('before:remove:empty', this);\n\n this._destroyChildren();\n delete this._showingEmptyView;\n\n this.triggerMethod('remove:empty', this);\n }\n },\n\n // Retrieve the empty view class\n _getEmptyView() {\n const emptyView = this.emptyView;\n\n if (!emptyView) { return; }\n\n return this._getView(emptyView);\n },\n\n // Retrieve the `childView` class\n // The `childView` property can be either a view class or a function that\n // returns a view class. If it is a function, it will receive the model that\n // will be passed to the view instance (created from the returned view class)\n _getChildView(child) {\n let childView = this.childView;\n\n if (!childView) {\n throw new MarionetteError({\n name: 'NoChildViewError',\n message: 'A \"childView\" must be specified'\n });\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: 'InvalidChildViewError',\n message: '\"childView\" must be a view class or a function that returns a view class'\n });\n }\n\n return childView;\n },\n\n // First check if the `view` is a view class (the common case)\n // Then check if it's a function (which we assume that returns a view class)\n _getView(view, child) {\n if (view.prototype instanceof Backbone.View || view === Backbone.View) {\n return view;\n } else if (_.isFunction(view)) {\n return view.call(this, child);\n }\n },\n\n // Internal method for building and adding a child view\n _addChild(child, ChildView, index) {\n const childViewOptions = this._getChildViewOptions(child, index);\n\n const view = this.buildChildView(child, ChildView, childViewOptions);\n\n this.addChildView(view, index);\n\n return view;\n },\n\n _getChildViewOptions(child, index) {\n if (_.isFunction(this.childViewOptions)) {\n return this.childViewOptions(child, index);\n }\n\n return this.childViewOptions;\n },\n\n // Render the child's view and add it to the HTML for the collection view at a given index.\n // This will also update the indices of later views in the collection in order to keep the\n // children in sync with the collection.\n addChildView(view, index) {\n this.triggerMethod('before:add:child', this, view);\n\n // increment indices of views after this one\n this._updateIndices(view, true, index);\n\n view._parent = this;\n\n this._addChildView(view, index);\n\n this.triggerMethod('add:child', this, view);\n\n return view;\n },\n\n // Internal method. This decrements or increments the indices of views after the added/removed\n // view to keep in sync with the collection.\n _updateIndices(view, increment, index) {\n if (!this.sort) {\n return;\n }\n\n if (increment) {\n // assign the index to the view\n view._index = index;\n }\n\n // update the indexes of views after this one\n this.children.each((laterView) => {\n if (laterView._index >= view._index) {\n laterView._index += increment ? 1 : -1;\n }\n });\n },\n\n // Internal Method. Add the view to children and render it at the given index.\n _addChildView(view, index) {\n // Only trigger attach if already attached and not buffering,\n // otherwise _endBuffering() or Region#show() handles this.\n const shouldTriggerAttach = !this._isBuffering && this._isAttached;\n\n monitorViewEvents(view);\n\n // set up the child view event forwarding\n this._proxyChildEvents(view);\n\n // Store the child view itself so we can properly remove and/or destroy it later\n this.children.add(view);\n\n if (!view.supportsRenderLifecycle) {\n triggerMethodOn(view, 'before:render', view);\n }\n\n // Render view\n view.render();\n\n if (!view.supportsRenderLifecycle) {\n view._isRendered = true;\n triggerMethodOn(view, 'render', view);\n }\n\n if (shouldTriggerAttach) {\n triggerMethodOn(view, 'before:attach', view);\n }\n\n // Attach view\n this.attachHtml(this, view, index);\n\n if (shouldTriggerAttach) {\n view._isAttached = true;\n triggerMethodOn(view, 'attach', view);\n }\n },\n\n // Build a `childView` for a model in the collection.\n buildChildView(child, ChildViewClass, childViewOptions) {\n const options = _.extend({model: child}, childViewOptions);\n return new ChildViewClass(options);\n },\n\n // Remove the child view and destroy it. This function also updates the indices of later views\n // in the collection in order to keep the children in sync with the collection.\n removeChildView(view) {\n if (!view || view._isDestroyed) {\n return view;\n }\n\n this.triggerMethod('before:remove:child', this, view);\n\n if (view.destroy) {\n view.destroy();\n } else {\n destroyBackboneView(view);\n }\n\n delete view._parent;\n this.stopListening(view);\n this.children.remove(view);\n this.triggerMethod('remove:child', this, view);\n\n // decrement the index of views after this one\n this._updateIndices(view, false);\n\n return view;\n },\n\n // check if the collection is empty or optionally whether an array of pre-processed models is empty\n isEmpty(options) {\n let models;\n if (_.result(options, 'processedModels')) {\n models = options.processedModels;\n } else {\n models = this.collection ? this.collection.models : [];\n models = this._filterModels(models);\n }\n return models.length === 0;\n },\n\n // If empty, show the empty view\n _checkEmpty() {\n if (this.isEmpty()) {\n this._showEmptyView();\n }\n },\n\n // You might need to override this if you've overridden attachHtml\n attachBuffer(collectionView, buffer) {\n collectionView.$el.append(buffer);\n },\n\n // Create a fragment buffer from the currently buffered children\n _createBuffer() {\n const elBuffer = document.createDocumentFragment();\n _.each(this._bufferedChildren, (b) => {\n elBuffer.appendChild(b.el);\n });\n return elBuffer;\n },\n\n // Append the HTML to the collection's `el`. Override this method to do something other\n // than `.append`.\n attachHtml(collectionView, childView, index) {\n if (collectionView._isBuffering) {\n // buffering happens on reset events and initial renders\n // in order to reduce the number of inserts into the\n // document, which are expensive.\n collectionView._bufferedChildren.splice(index, 0, childView);\n } else {\n // If we've already rendered the main collection, append\n // the new child into the correct order if we need to. Otherwise\n // append to the end.\n if (!collectionView._insertBefore(childView, index)) {\n collectionView._insertAfter(childView);\n }\n }\n },\n\n // Internal method. Check whether we need to insert the view into the correct position.\n _insertBefore(childView, index) {\n let currentView;\n const findPosition = this.sort && (index < this.children.length - 1);\n if (findPosition) {\n // Find the view after this one\n currentView = this.children.find((view) => {\n return view._index === index + 1;\n });\n }\n\n if (currentView) {\n currentView.$el.before(childView.el);\n return true;\n }\n\n return false;\n },\n\n // Internal method. Append a view to the end of the $el\n _insertAfter(childView) {\n this.$el.append(childView.el);\n },\n\n // Internal method to set up the `children` object for storing all of the child views\n _initChildViewStorage() {\n this.children = new ChildViewContainer();\n },\n\n // called by ViewMixin destroy\n _removeChildren() {\n this._destroyChildren({checkEmpty: false});\n },\n\n // Destroy the child views that this collection view is holding on to, if any\n _destroyChildren({checkEmpty} = {}) {\n this.triggerMethod('before:destroy:children', this);\n const shouldCheckEmpty = checkEmpty !== false;\n const childViews = this.children.map(_.identity);\n\n this.children.each(_.bind(this.removeChildView, this));\n\n if (shouldCheckEmpty) {\n this._checkEmpty();\n }\n\n this.triggerMethod('destroy:children', this);\n return childViews;\n },\n\n // Return true if the given child should be shown. Return false otherwise.\n // The filter will be passed (child, index, collection), where\n // 'child' is the given model\n // 'index' is the index of that model in the collection\n // 'collection' is the collection referenced by this CollectionView\n _shouldAddChild(child, index) {\n const filter = this.filter;\n return !_.isFunction(filter) || filter.call(this, child, index, this.collection);\n },\n\n // Set up the child view event forwarding. Uses a \"childview:\" prefix in front of all forwarded events.\n _proxyChildEvents(view) {\n const prefix = _.result(this, 'childViewEventPrefix');\n\n // Forward all child view events through the parent,\n // prepending \"childview:\" to the event name\n this.listenTo(view, 'all', (eventName, ...args) => {\n\n const childEventName = prefix + ':' + eventName;\n\n const childViewEvents = this.normalizeMethods(this._childViewEvents);\n\n // call collectionView childViewEvent if defined\n if (typeof childViewEvents !== 'undefined' && _.isFunction(childViewEvents[eventName])) {\n childViewEvents[eventName].apply(this, args);\n }\n\n // use the parent view's proxyEvent handlers\n const childViewTriggers = this._childViewTriggers;\n\n // Call the event with the proxy name on the parent layout\n if (childViewTriggers && _.isString(childViewTriggers[eventName])) {\n this.triggerMethod(childViewTriggers[eventName], ...args);\n }\n\n this.triggerMethod(childEventName, ...args);\n });\n }\n});\n\n_.extend(CollectionView.prototype, ViewMixin);\n\nexport default CollectionView;\n","// Composite View\n// --------------\n\nimport _ from 'underscore';\nimport deprecate from './utils/deprecate';\nimport MarionetteError from './error';\nimport CollectionView from './collection-view';\nimport View from './view';\n\nconst ClassOptions = [\n 'childViewContainer',\n 'template',\n 'templateContext'\n];\n\n// Used for rendering a branch-leaf, hierarchical structure.\n// Extends directly from CollectionView\n// @deprecated\nconst CompositeView = CollectionView.extend({\n\n // Setting up the inheritance chain which allows changes to\n // Marionette.CollectionView.prototype.constructor which allows overriding\n // option to pass '{sort: false}' to prevent the CompositeView from\n // maintaining the sorted order of the collection.\n // This will fallback onto appending childView's to the end.\n constructor(options) {\n deprecate('CompositeView is deprecated. Convert to View at your earliest convenience');\n\n this.mergeOptions(options, ClassOptions);\n\n CollectionView.prototype.constructor.apply(this, arguments);\n },\n\n // Configured the initial events that the composite view\n // binds to. Override this method to prevent the initial\n // events, or to add your own initial events.\n _initialEvents() {\n\n // Bind only after composite view is rendered to avoid adding child views\n // to nonexistent childViewContainer\n\n if (this.collection) {\n this.listenTo(this.collection, 'add', this._onCollectionAdd);\n this.listenTo(this.collection, 'remove', this._onCollectionRemove);\n this.listenTo(this.collection, 'reset', this.renderChildren);\n\n if (this.sort) {\n this.listenTo(this.collection, 'sort', this._sortViews);\n }\n }\n },\n\n // Retrieve the `childView` to be used when rendering each of\n // the items in the collection. The default is to return\n // `this.childView` or Marionette.CompositeView if no `childView`\n // has been defined. As happens in CollectionView, `childView` can\n // be a function (which should return a view class).\n _getChildView(child) {\n let childView = this.childView;\n\n // for CompositeView, if `childView` is not specified, we'll get the same\n // composite view class rendered for each child in the collection\n // then check if the `childView` is a view class (the common case)\n // finally check if it's a function (which we assume that returns a view class)\n if (!childView) {\n return this.constructor;\n }\n\n childView = this._getView(childView, child);\n\n if (!childView) {\n throw new MarionetteError({\n name: 'InvalidChildViewError',\n message: '\"childView\" must be a view class or a function that returns a view class'\n });\n }\n\n return childView;\n },\n\n // Return the serialized model\n serializeData() {\n return this.serializeModel();\n },\n\n // Renders the model and the collection.\n render() {\n this._ensureViewIsIntact();\n this._isRendering = true;\n this.resetChildViewContainer();\n\n this.triggerMethod('before:render', this);\n\n this._renderTemplate();\n this.bindUIElements();\n this.renderChildren();\n\n this._isRendering = false;\n this._isRendered = true;\n this.triggerMethod('render', this);\n return this;\n },\n\n renderChildren() {\n if (this._isRendered || this._isRendering) {\n CollectionView.prototype._renderChildren.call(this);\n }\n },\n\n // You might need to override this if you've overridden attachHtml\n attachBuffer(compositeView, buffer) {\n const $container = this.getChildViewContainer(compositeView);\n $container.append(buffer);\n },\n\n // Internal method. Append a view to the end of the $el.\n // Overidden from CollectionView to ensure view is appended to\n // childViewContainer\n _insertAfter(childView) {\n const $container = this.getChildViewContainer(this, childView);\n $container.append(childView.el);\n },\n\n // Internal method. Append reordered childView'.\n // Overidden from CollectionView to ensure reordered views\n // are appended to childViewContainer\n _appendReorderedChildren(children) {\n const $container = this.getChildViewContainer(this);\n $container.append(children);\n },\n\n // Internal method to ensure an `$childViewContainer` exists, for the\n // `attachHtml` method to use.\n getChildViewContainer(containerView, childView) {\n if (!!containerView.$childViewContainer) {\n return containerView.$childViewContainer;\n }\n\n let container;\n const childViewContainer = containerView.childViewContainer;\n if (childViewContainer) {\n\n const selector = _.result(containerView, 'childViewContainer');\n\n if (selector.charAt(0) === '@' && containerView.ui) {\n container = containerView.ui[selector.substr(4)];\n } else {\n container = containerView.$(selector);\n }\n\n if (container.length <= 0) {\n throw new MarionetteError({\n name: 'ChildViewContainerMissingError',\n message: `The specified \"childViewContainer\" was not found: ${containerView.childViewContainer}`\n });\n }\n\n } else {\n container = containerView.$el;\n }\n\n containerView.$childViewContainer = container;\n return container;\n },\n\n // Internal method to reset the `$childViewContainer` on render\n resetChildViewContainer() {\n if (this.$childViewContainer) {\n this.$childViewContainer = undefined;\n }\n }\n});\n\n// To prevent duplication but allow the best View organization\n// Certain View methods are mixed directly into the deprecated CompositeView\nconst MixinFromView = _.pick(View.prototype, 'serializeModel', 'getTemplate', '_renderTemplate', 'mixinTemplateContext', 'attachElContent');\n_.extend(CompositeView.prototype, MixinFromView);\n\nexport default CompositeView;\n","// Behavior\n// --------\n\n// A Behavior is an isolated set of DOM /\n// user interactions that can be mixed into any View.\n// Behaviors allow you to blackbox View specific interactions\n// into portable logical chunks, keeping your views simple and your code DRY.\n\nimport _ from 'underscore';\nimport getUniqueEventName from './utils/get-unique-event-name';\nimport MarionetteObject from './object';\nimport DelegateEntityEventsMixin from './mixins/delegate-entity-events';\nimport TriggersMixin from './mixins/triggers';\nimport UIMixin from './mixins/ui';\n\nconst ClassOptions = [\n 'collectionEvents',\n 'events',\n 'modelEvents',\n 'triggers',\n 'ui'\n];\n\nconst Behavior = MarionetteObject.extend({\n cidPrefix: 'mnb',\n\n constructor(options, view) {\n // Setup reference to the view.\n // this comes in handle when a behavior\n // wants to directly talk up the chain\n // to the view.\n this.view = view;\n this.defaults = _.clone(_.result(this, 'defaults', {}));\n this._setOptions(this.defaults, options);\n this.mergeOptions(this.options, ClassOptions);\n\n // Construct an internal UI hash using\n // the behaviors UI hash and then the view UI hash.\n // This allows the user to use UI hash elements\n // defined in the parent view as well as those\n // defined in the given behavior.\n // This order will help the reuse and share of a behavior\n // between multiple views, while letting a view override a\n // selector under an UI key.\n this.ui = _.extend({}, _.result(this, 'ui'), _.result(view, 'ui'));\n\n MarionetteObject.apply(this, arguments);\n },\n\n // proxy behavior $ method to the view\n // this is useful for doing jquery DOM lookups\n // scoped to behaviors view.\n $() {\n return this.view.$.apply(this.view, arguments);\n },\n\n // Stops the behavior from listening to events.\n // Overrides Object#destroy to prevent additional events from being triggered.\n destroy() {\n this.stopListening();\n\n return this;\n },\n\n proxyViewProperties() {\n this.$el = this.view.$el;\n this.el = this.view.el;\n\n return this;\n },\n\n bindUIElements() {\n this._bindUIElements();\n\n return this;\n },\n\n unbindUIElements() {\n this._unbindUIElements();\n\n return this;\n },\n\n getUI(name) {\n this.view._ensureViewIsIntact();\n return this._getUI(name);\n },\n\n // Handle `modelEvents`, and `collectionEvents` configuration\n delegateEntityEvents() {\n this._delegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n undelegateEntityEvents() {\n this._undelegateEntityEvents(this.view.model, this.view.collection);\n\n return this;\n },\n\n getEvents() {\n // Normalize behavior events hash to allow\n // a user to use the @ui. syntax.\n const behaviorEvents = this.normalizeUIKeys(_.result(this, 'events'));\n\n // binds the handler to the behavior and builds a unique eventName\n return _.reduce(behaviorEvents, function(events, behaviorHandler, key) {\n if (!_.isFunction(behaviorHandler)) {\n behaviorHandler = this[behaviorHandler];\n }\n if (!behaviorHandler) { return; }\n key = getUniqueEventName(key);\n events[key] = _.bind(behaviorHandler, this);\n return events;\n } , {}, this);\n },\n\n // Internal method to build all trigger handlers for a given behavior\n getTriggers() {\n if (!this.triggers) { return; }\n\n // Normalize behavior triggers hash to allow\n // a user to use the @ui. syntax.\n const behaviorTriggers = this.normalizeUIKeys(_.result(this, 'triggers'));\n\n return this._getViewTriggers(this.view, behaviorTriggers);\n }\n\n});\n\n_.extend(Behavior.prototype, DelegateEntityEventsMixin, TriggersMixin, UIMixin);\n\nexport default Behavior;\n","// Application\n// -----------\nimport _ from 'underscore';\nimport MarionetteObject from './object';\nimport Region from './region';\n\nconst ClassOptions = [\n 'region',\n 'regionClass'\n];\n\n// A container for a Marionette application.\nconst Application = MarionetteObject.extend({\n cidPrefix: 'mna',\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n this._initRegion();\n\n MarionetteObject.prototype.constructor.apply(this, arguments);\n },\n\n regionClass: Region,\n\n _initRegion(options) {\n const region = this.region;\n const RegionClass = this.regionClass;\n\n // if the region is a string expect an el or selector\n // and instantiate a region\n if (_.isString(region)) {\n this._region = new RegionClass({\n el: region\n });\n return;\n }\n\n this._region = region;\n },\n\n getRegion() {\n return this._region;\n },\n\n showView(view, ...args) {\n const region = this.getRegion();\n return region.show(view, ...args);\n },\n\n getView() {\n return this.getRegion().currentView;\n },\n\n // kick off all of the application's processes.\n start(options) {\n this.triggerMethod('before:start', this, options);\n this.triggerMethod('start', this, options);\n return this;\n }\n\n});\n\nexport default Application;\n","// App Router\n// ----------\n\n// Reduce the boilerplate code of handling route events\n// and then calling a single method on another object,\n// called a controller.\n// Have your routers configured to call the method on\n// your controller, directly.\n//\n// Configure an AppRouter with `appRoutes`.\n//\n// App routers can only take one `controller` object.\n// It is recommended that you divide your controller\n// objects in to smaller pieces of related functionality\n// and have multiple routers / controllers, instead of\n// just one giant router and controller.\n//\n// You can also add standard routes to an AppRouter.\n\nimport Backbone from 'backbone';\nimport _ from 'underscore';\nimport { triggerMethod } from './common/trigger-method';\nimport MarionetteError from './error';\nimport CommonMixin from './mixins/common';\n\nconst ClassOptions = [\n 'appRoutes',\n 'controller'\n];\n\nconst AppRouter = Backbone.Router.extend({\n\n constructor(options) {\n this._setOptions(options);\n\n this.mergeOptions(options, ClassOptions);\n\n Backbone.Router.apply(this, arguments);\n\n const appRoutes = this.appRoutes;\n const controller = this._getController();\n this.processAppRoutes(controller, appRoutes);\n this.on('route', this._processOnRoute, this);\n },\n\n // Similar to route method on a Backbone Router but\n // method is called on the controller\n appRoute(route, methodName) {\n const controller = this._getController();\n this._addAppRoute(controller, route, methodName);\n return this;\n },\n\n // process the route event and trigger the onRoute\n // method call, if it exists\n _processOnRoute(routeName, routeArgs) {\n // make sure an onRoute before trying to call it\n if (_.isFunction(this.onRoute)) {\n // find the path that matches the current route\n const routePath = _.invert(this.appRoutes)[routeName];\n this.onRoute(routeName, routePath, routeArgs);\n }\n },\n\n // Internal method to process the `appRoutes` for the\n // router, and turn them in to routes that trigger the\n // specified method on the specified `controller`.\n processAppRoutes(controller, appRoutes) {\n if (!appRoutes) { return this; }\n\n const routeNames = _.keys(appRoutes).reverse(); // Backbone requires reverted order of routes\n\n _.each(routeNames, route => {\n this._addAppRoute(controller, route, appRoutes[route]);\n });\n\n return this;\n },\n\n _getController() {\n return this.controller;\n },\n\n _addAppRoute(controller, route, methodName) {\n const method = controller[methodName];\n\n if (!method) {\n throw new MarionetteError(`Method \"${methodName}\" was not found on the controller`);\n }\n\n this.route(route, methodName, _.bind(method, controller));\n },\n\n triggerMethod: triggerMethod\n});\n\n_.extend(AppRouter.prototype, CommonMixin);\n\nexport default AppRouter;\n","import Backbone from 'backbone';\nimport {version} from '../package.json';\n\nimport proxy from './utils/proxy';\nimport extend from './utils/extend';\nimport deprecate from './utils/deprecate';\n\nimport isNodeAttached from './common/is-node-attached';\nimport mergeOptions from './common/merge-options';\nimport getOption from './common/get-option';\nimport normalizeMethods from './common/normalize-methods';\nimport monitorViewEvents from './common/monitor-view-events';\n\nimport {\n bindEvents,\n unbindEvents\n} from './common/bind-events';\n\nimport {\n bindRequests,\n unbindRequests\n} from './common/bind-requests';\n\nimport {\n triggerMethod,\n triggerMethodOn\n} from './common/trigger-method';\n\n\nimport MarionetteObject from './object';\nimport TemplateCache from './template-cache';\nimport View from './view';\nimport CollectionView from './collection-view';\nimport CompositeView from './composite-view';\nimport Behavior from './behavior';\nimport Region from './region';\nimport Application from './application';\nimport AppRouter from './app-router';\nimport MarionetteError from './error';\n\nimport behaviorsLookup from './config/behaviors-lookup';\nimport Renderer from './config/renderer';\n\nimport {\n FEATURES,\n isEnabled,\n setEnabled\n} from './config/features';\n\nconst previousMarionette = Backbone.Marionette;\nconst Marionette = Backbone.Marionette = {};\n\n// This allows you to run multiple instances of Marionette on the same\n// webapp. After loading the new version, call `noConflict()` to\n// get a reference to it. At the same time the old version will be\n// returned to Backbone.Marionette.\nMarionette.noConflict = function() {\n Backbone.Marionette = previousMarionette;\n return this;\n};\n\n// Utilities\nMarionette.bindEvents = proxy(bindEvents);\nMarionette.unbindEvents = proxy(unbindEvents);\nMarionette.bindRequests = proxy(bindRequests);\nMarionette.unbindRequests = proxy(unbindRequests);\nMarionette.mergeOptions = proxy(mergeOptions);\nMarionette.getOption = proxy(getOption);\nMarionette.normalizeMethods = proxy(normalizeMethods);\nMarionette.extend = extend;\nMarionette.isNodeAttached = isNodeAttached;\nMarionette.deprecate = deprecate;\nMarionette.triggerMethod = proxy(triggerMethod);\nMarionette.triggerMethodOn = triggerMethodOn;\nMarionette.isEnabled = isEnabled;\nMarionette.setEnabled = setEnabled;\nMarionette.monitorViewEvents = monitorViewEvents;\n\nMarionette.Behaviors = {};\nMarionette.Behaviors.behaviorsLookup = behaviorsLookup;\n\n// Classes\nMarionette.Application = Application;\nMarionette.AppRouter = AppRouter;\nMarionette.Renderer = Renderer;\nMarionette.TemplateCache = TemplateCache;\nMarionette.View = View;\nMarionette.CollectionView = CollectionView;\nMarionette.CompositeView = CompositeView;\nMarionette.Behavior = Behavior;\nMarionette.Region = Region;\nMarionette.Error = MarionetteError;\nMarionette.Object = MarionetteObject;\n\n// Configuration\nMarionette.DEV_MODE = false;\nMarionette.FEATURES = FEATURES;\nMarionette.VERSION = version;\n\nexport default Marionette;\n"],"sourceRoot":"/source/"}
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yano-backbone-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan C. Calixto