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K2D,cAAcnB,EAAK/B,MAAO,QAO7C+B,EAAKf,SAAS8C,uBAAuBvE,KAAKI,iBACzCoC,EAAKf,SAASiD,IAAI,UAAU,GAG7B,MAAME,EAAa5E,KAAK6E,gBAClB6G,GACJ9G,GAAcA,EAAWnD,SAASsE,KAAOvD,EAAKf,SAASsE,GAGrD/F,KAAKsL,QAAUtL,KAAK2L,UAGxB/I,EAAEC,OAAM,KACP,IAAI7C,KAAK2L,SAAT,CAEA,GAAK3L,KAAKI,eAAe8B,OAElB,CACN,IAAI0J,EACJ,GAAIpJ,EAAKf,WAAazB,KAAKmI,gBAAiB,CAE3C,MAAM0D,EAAc7L,KAAKmI,gBAAgBzH,IAAI,QACxCmL,EAAYC,UAChBF,EAAaC,EAEf,MAEK,GAAIH,IAAoB1L,KAAK6E,gBACjC,GAAI7E,KAAKkI,cAAgBlI,KAAKI,eAAeM,IAAIV,KAAKkI,cACrD0D,EAAa5L,KAAKkI,aAAaxH,IAAI,YAC7B,CACN,MAAMqL,EAAOnJ,EAAEmJ,KAAK/L,KAAK6F,YACzB+F,EACC5L,KAAKmC,kBAAoBnC,KAAK6F,WAAWkG,EAAKA,EAAK7J,OAAS,GAC9D,EAIA0J,GACCA,EAAWD,UACVC,EAAWN,QAAWM,EAAWL,cAEnCvL,KAAK6D,SAAS+H,EAEhB,MA5BC5L,KAAKqB,aAAerB,KAAKyF,cA6BnBzF,KAAKmC,gBAhCa,CAgCG,GAE9B,CAGA,0BAAWjC,GACV,OAAO,CACR,CAGA,mBAAW8L,GACV,MAAO,WACR,EAGD","sources":["webpack://mono-repo/./packages/core/lib/netx-multiView.js"],"sourcesContent":["/**\n * Add and show views in particular contexts via actions - think of it as a view controller\n * Unlike the usual controller this is very privy to the DOM\n * @class\n */\nimport Base from './netx-view';\nimport EmptyTemplate from '@netx/core-app/templates/empty.html';\n\nimport AppViewsCollection from '@netx/core-app/collections/appViews';\nimport AppViewsQueueCollection from '@netx/core-app/collections/appViewsQueue';\nimport {\n\tRegisterLegacyAction,\n\tFindLegacyAction,\n} from '@netx/core/legacyActionManager';\n\nclass MultiView extends Base {\n\t/** @type {boolean} */\n\tget isMultiView() {\n\t\treturn this.constructor.__isMultiView__;\n\t}\n\n\t/**\n\t * @override\n\t * @listens {@link Netx.Collections.AppViews#change:showActions}\n\t * @listens {@link Netx.Collections.AppViews#change:uniqueShowAction}\n\t * @listens {@link Netx.Collections.AppViews#loaded}\n\t * @listens {@link Netx.Collections.AppViews#loading}\n\t * @listens {@link Netx.Collections.AppViews#swtichedBack}\n\t * @listens {@link Netx.Collections.AppViews#view:hiding}\n\t * @listens {@link Netx.Collections.AppViews#view:hidden}\n\t * @listens {@link Netx.Collections.AppViews#view:removed}\n\t * @listens {@link Netx.Collections.AppViews#view:rendered}\n\t * @listens {@link Netx.Collections.AppViews#view:showing}\n\t * @listens {@link Netx.Collections.AppViews#view:shown}\n\t * @listens {@link Netx.Views.MultiView#addedNewChildView|addedChildView}\n\t * @listens {@link Netx.Views.MultiView#removedChildView|removedChildView}\n\t */\n\tconstructor(opts = {}) {\n\t\tconst viewCollection = opts.viewCollection || new AppViewsCollection([]);\n\t\t/**\n\t\t * @property {object} childView - Child view object\n\t\t * @property {string} childView.viewClass - The view class to use when creating `childView` (in our case, it is the `viewSpec` model's `id`)\n\t\t * @property {string} childView.target - The css selector to use when injecting a newly created `childView` (to be overriden in extending `view`)\n\t\t */\n\t\topts.childView = {\n\t\t\tviewClass(model) {\n\t\t\t\treturn model.get('viewClass');\n\t\t\t},\n\t\t\ttarget: false,\n\t\t\tcollection: viewCollection,\n\t\t\toptions: {\n\t\t\t\tattributes: {\n\t\t\t\t\t'data-layer': '',\n\t\t\t\t},\n\t\t\t},\n\t\t\t...opts.childView,\n\t\t};\n\t\tsuper(opts);\n\n\t\tthis.childView = opts.childView;\n\t\tthis.instantiateOnAdd = opts.instantiateOnAdd !== false;\n\t\tthis.registeredViews = [];\n\t\t/**\n\t\t * Classes that will be added to views when they enter our `viewCollection`\n\t\t * These classes will be removed when they are removed from our `viewCollection`\n\t\t * This allows for transient views to have what they need when thye move from `multiView` to `multiView`\n\t\t * @type {string}\n\t\t * @default\n\t\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollection}\n\t\t */\n\t\tthis.additionalViewClasses = opts.additionalViewClasses || '';\n\n\t\t/**\n\t\t * Whether or not to confirm unsaved changes when `this` tries to hide\n\t\t * @type {boolean}\n\t\t * @default\n\t\t */\n\t\tthis.confirmUnsavedChanges = opts.confirmUnsavedChanges === true;\n\n\t\t/**\n\t\t * When `this` hides, should we empty all children in our `viewCollection`\n\t\t * @type {boolean}\n\t\t * @default\n\t\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollection}\n\t\t */\n\t\tthis.emptyOnHide = opts.emptyOnHide === true;\n\n\t\t/**\n\t\t * Should we hide `this` when our `viewCollection` reaches a length of 0\n\t\t * @type {boolean}\n\t\t * @default\n\t\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollection}\n\t\t */\n\t\tthis.hideOnEmpty = opts.hideOnEmpty === true;\n\n\t\t/**\n\t\t * Should we hide `this` when a child view is removed\n\t\t * @type {boolean}\n\t\t * @default\n\t\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollction}\n\t\t */\n\t\tthis.hideWhenChildViewRemoved = opts.hideWhenChildViewRemoved === true;\n\n\t\t/**\n\t\t * Render view immediately after instantiate\n\t\t * @type {boolean}\n\t\t * @default\n\t\t */\n\t\tthis.renderOnInstatiate = opts.renderOnInstatiate === true;\n\n\t\t/**\n\t\t * Should the `childView` be immediately shown when added to our `viewCollection`\n\t\t * @type {boolean}\n\t\t * @default\n\t\t * @see {@link Netx.Views.MultiView#viewInstantiated|viewInstantiated}\n\t\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollection}\n\t\t */\n\t\tthis.showOnAdd = opts.showOnAdd !== false;\n\n\t\t// I am confident in doing this here as this cannot be populated until the first render of this view\n\t\t// and none of the data needs to be validated or passed to the server / shared amongst the rest of the app\n\t\t/**\n\t\t * This is my collection of views.\n\t\t * @memberOf Netx.Views.MultiView\n\t\t * @alias viewCollection\n\t\t * @type {Netx.Collections.AppViews}\n\t\t */\n\t\tthis.viewCollection = viewCollection;\n\n\t\t// For debug output - multiviews within multiviews\n\t\tlet viewSpec = opts.viewSpec;\n\n\t\tthis.listenTo(this.viewCollection, 'add', (viewSpec) => {\n\t\t\tthis.registerView(viewSpec);\n\n\t\t\tif (!this.instantiateOnAdd) return;\n\n\t\t\tthis.instantiateView(viewSpec);\n\t\t});\n\n\t\tthis.listenTo(this.viewCollection, 'remove', (...args) => {\n\t\t\tthis.removeChildView(...args);\n\t\t});\n\n\t\tthis.listenTo(this.viewCollection, 'add remove reset', (collection) => {\n\t\t\tthis.el.classList.toggle(\n\t\t\t\t'multiple-views',\n\t\t\t\tthis.viewCollection.length > 1,\n\t\t\t);\n\t\t});\n\n\t\t////////////////////////////////\n\t\t// QUEUE\n\t\t////////////////////////////////\n\t\t/**\n\t\t * In the event we need to prevent a view from showing for a time (until conditions are met)\n\t\t * Or we receive a transient view that then leave (like a bookmark for the last view that was active before the transient came into our lives)\n\t\t * @memberOf Netx.Views.MultiView\n\t\t * @alias cachedActiveView\n\t\t * @private\n\t\t * @type {Netx.View}\n\t\t */\n\t\tthis.cachedActiveView = null;\n\n\t\t/**\n\t\t * If we are in the middle of hiding - the best thing for all involved is to let it finish - show again and then pick up where the data left off.\n\t\t * @memberOf Netx.Views.MultiView\n\t\t * @alias _viewQueue\n\t\t * @private\n\t\t * @type {Netx.Collections.AppViews}\n\t\t */\n\t\tthis.viewCollection.viewQueue = this._viewQueue =\n\t\t\tnew AppViewsQueueCollection([], {\n\t\t\t\tqueueFor: this.viewCollection,\n\t\t\t\tview: this,\n\t\t\t});\n\n\t\t// NOTE: I am not adding `_viewQueueParentView` to `this.subViews` - as nothing in this view (other than remove)\n\t\t// should have any affect on it\n\t\t/**\n\t\t * The reason for the dummy view is so that the queued views actually get created and can listen for any events that would affect them in the mean\n\t\t * time while they are queued\n\t\t * @memberOf Netx.Views.MultiView\n\t\t * @alias _viewQueueParentView\n\t\t * @private\n\t\t * @type {Netx.View}\n\t\t */\n\t\tthis._viewQueueParentView = new Base({\n\t\t\ttemplate: EmptyTemplate,\n\t\t\tcollection: this._viewQueue,\n\t\t});\n\t\t// Make sure it reflects our `childView` object\n\t\tthis._viewQueueParentView.childView = this.childView;\n\n\t\t// Hey, listen!\n\t\tthis.listenTo(this, 'addedNewChildView', (view) => {\n\t\t\t// Defer so all actions have been registered in the viewSpec\n\t\t\t// These get set at the same time as this event\n\t\t\t_.defer(_.bind(_.partial(this.viewInstantiated, view), this));\n\t\t})\n\t\t\t.listenTo(this, 'removedChildView', (view) => {\n\t\t\t\tthis.viewRemoved(view);\n\t\t\t})\n\t\t\t////////////////////////////////////\n\t\t\t// SHOW ACTION LISTENERS\n\t\t\t////////////////////////////////////\n\t\t\t.listenTo(\n\t\t\t\tthis.viewCollection,\n\t\t\t\t'change:showActions',\n\t\t\t\t(model, collection) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcollection &&\n\t\t\t\t\t\tcollection._listenId === this.viewCollection._listenId\n\t\t\t\t\t) {\n\t\t\t\t\t\tconst prev = model._previousAttributes || {};\n\t\t\t\t\t\tconst newActions = model.get('showActions') || [];\n\t\t\t\t\t\tconst prevActions = prev.showActions || [];\n\n\t\t\t\t\t\t// Stop listening to actions no longer present\n\t\t\t\t\t\t_.each(_.difference(prevActions, newActions), (action) => {\n\t\t\t\t\t\t\tthis.stopListening(dispatcher, action);\n\t\t\t\t\t\t});\n\t\t\t\t\t\t// Start lsitening to actions that were added\n\t\t\t\t\t\t_.each(_.difference(newActions, prevActions), (action) => {\n\t\t\t\t\t\t\tthis.listenTo(\n\t\t\t\t\t\t\t\tdispatcher,\n\t\t\t\t\t\t\t\taction,\n\t\t\t\t\t\t\t\t_.partial(this.showView, model.get('view')),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t)\n\t\t\t.listenTo(\n\t\t\t\tthis.viewCollection,\n\t\t\t\t'change:uniqueShowAction',\n\t\t\t\t(model, collection) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\tcollection &&\n\t\t\t\t\t\tcollection._listenId === this.viewCollection._listenId\n\t\t\t\t\t) {\n\t\t\t\t\t\tvar prev = model._previousAttributes || {},\n\t\t\t\t\t\t\tnewAction = model.get('uniqueShowAction'),\n\t\t\t\t\t\t\tprevAction = prev.uniqueShowAction;\n\n\t\t\t\t\t\t// TODO: A way to remove actions after they have been defined - is it as simple as removing it from the Actions array?\n\t\t\t\t\t\t// if( prevAction.match( /^appView:(\\w+):show/) ) {}\n\n\t\t\t\t\t\t// Register actions so we can run through the actions/event system\n\t\t\t\t\t\t// We assume that if you provided an action that does not match this pattern that it is a legitamte and registered action\n\t\t\t\t\t\tif (newAction && newAction.match(/^appView:(\\w+):show/)) {\n\t\t\t\t\t\t\tRegisterLegacyAction([\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tevent: newAction,\n\t\t\t\t\t\t\t\t\tlabel: i18n.t('i18n.show'),\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tprevAction && this.stopListening(dispatcher, prevAction);\n\t\t\t\t\t\tnewAction &&\n\t\t\t\t\t\t\tthis.listenTo(\n\t\t\t\t\t\t\t\tdispatcher,\n\t\t\t\t\t\t\t\tnewAction,\n\t\t\t\t\t\t\t\t_.partial(this.showView, model.get('view')),\n\t\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t)\n\t\t\t////////////////////////////////////\n\t\t\t// !SHOW ACTION LISTENERS\n\t\t\t////////////////////////////////////\n\n\t\t\t////////////////////////////////////\n\t\t\t// SWITCHING CONTEXTS\n\t\t\t////////////////////////////////////\n\t\t\t// A model has been switched to another `viewCollection`\n\t\t\t.listenTo(this.viewCollection, 'switched', (model, collection) => {\n\t\t\t\tif (model && model.isMyOriginalCollection(this.viewCollection)) {\n\t\t\t\t\tmodel.get('view') &&\n\t\t\t\t\t\tmodel.get('view').$el.removeClass(this.additionalViewClasses);\n\t\t\t\t\tmodel.set('switched', true);\n\t\t\t\t\tthis.$el.addClass('view-switched');\n\t\t\t\t}\n\t\t\t})\n\t\t\t// A view was returned back to its original home\n\t\t\t.listenTo(this.viewCollection, 'switchedBack', (model, collection) => {\n\t\t\t\t// If our `viewCollection` is its original `viewCollection` - reactivate and show it\n\t\t\t\tif (\n\t\t\t\t\tcollection &&\n\t\t\t\t\tthis.viewCollection._listenId === collection._listenId\n\t\t\t\t) {\n\t\t\t\t\t// Ge the view\n\t\t\t\t\tconst view = model.get('view');\n\t\t\t\t\t// Check if it shopuld be the active view\n\t\t\t\t\tconst activeView = this.getActiveView();\n\n\t\t\t\t\t// We are no longer switched out\n\t\t\t\t\tmodel.set('switched', false);\n\n\t\t\t\t\t// This will get our element back into its right place in the DOM\n\t\t\t\t\tthis.addChildView(model);\n\t\t\t\t\t// Put classes back\n\t\t\t\t\tview.$el.addClass(this.additionalViewClasses);\n\t\t\t\t\t// Either there are no active views or the active view is this view that is switching back\n\t\t\t\t\tif (_.isUndefined(activeView) || activeView.cid === view.cid) {\n\t\t\t\t\t\t// Reactivate\n\t\t\t\t\t\tmodel.set('active', true);\n\t\t\t\t\t\t// Show\n\t\t\t\t\t\tthis.showView(view);\n\t\t\t\t\t}\n\t\t\t\t\t// We are just put back but not active\n\t\t\t\t\telse {\n\t\t\t\t\t\t// Deactivate\n\t\t\t\t\t\tmodel.set('active', false);\n\t\t\t\t\t}\n\t\t\t\t\t// Toggle class based on if any views are still switched out from our `viewCollection`\n\t\t\t\t\tthis.$el.toggleClass(\n\t\t\t\t\t\t'view-switched',\n\t\t\t\t\t\t!_.isUndefined(this.viewCollection.findWhere({switched: true})),\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t})\n\t\t\t////////////////////////////////////\n\t\t\t// !SWITCHING CONTEXTS\n\t\t\t////////////////////////////////////\n\n\t\t\t// If it is a view event the first argument will always be the view that the event was triggered on\n\t\t\t// due to the fact that we are not consistent in always providing a the view when we trigger an event\n\t\t\t// Collection/model events will be piped through as-is\n\t\t\t// View events are prepended with \"view:\" so we do not conflict with data events\n\t\t\t// this.listenTo( this.viewCollection, 'all', function() {\n\t\t\t// \tconsole.log( arguments );\n\t\t\t// } );\n\n\t\t\t// Sometimes a view is removed by other means than being taken out of the viewCollection\n\t\t\t// Be safe and remove from the collection as well (if it does not exist there is no harm)\n\t\t\t// It will be caught in the 'removedChildView' listener and dealt with\n\t\t\t.listenTo(this.viewCollection, 'view:removed', (view) => {\n\t\t\t\tthis.viewCollection.remove(view.viewSpec);\n\t\t\t})\n\t\t\t.listenTo(this.viewCollection, 'view:hiding', this.viewOnHiding)\n\t\t\t.listenTo(this.viewCollection, 'view:hidden', (view) => {\n\t\t\t\tthis.viewAfterHidden(view);\n\t\t\t})\n\t\t\t.listenTo(this.viewCollection, 'view:showing', this.viewOnShowing)\n\t\t\t.listenTo(this.viewCollection, 'view:shown', (view) => {\n\t\t\t\tthis.viewAfterShown(view);\n\t\t\t});\n\n\t\t// When a child view is hidden we hide the multiView\n\t\tif (this.hideWhenChildViewRemoved) {\n\t\t\t// When any views hide we all hide\n\t\t\tthis.listenTo(this.viewCollection, 'remove', (model) => {\n\t\t\t\tthis.hide();\n\t\t\t});\n\t\t}\n\t}\n\n\t/** @override */\n\tgetExcludedViews() {\n\t\tconst excludedViews = super.getExcludedViews();\n\t\treturn excludedViews.concat(_.pluck(this.childViews, 'el'));\n\t}\n\n\t/**\n\t * @method\n\t */\n\tregisterView(viewSpec) {\n\t\tif (this.registeredViews.indexOf(viewSpec.id) > -1) return;\n\t\tthis.registeredViews.push(viewSpec.id);\n\t\t// Listen for each show:action\n\t\tviewSpec.get('showActions').forEach((action) => {\n\t\t\tthis.listenTo(dispatcher, action, () => {\n\t\t\t\tlet view = viewSpec.get('view');\n\t\t\t\tif (!view) {\n\t\t\t\t\tview = this.instantiateView(viewSpec);\n\t\t\t\t}\n\t\t\t\tthis.showView(view);\n\t\t\t});\n\t\t});\n\n\t\tthis.listenTo(dispatcher, viewSpec.get('uniqueShowAction'), () => {\n\t\t\tlet view = viewSpec.get('view');\n\t\t\tif (!view) {\n\t\t\t\tview = this.instantiateView(viewSpec);\n\t\t\t}\n\t\t\tthis.showView(view);\n\t\t});\n\t}\n\n\t/**\n\t * @method\n\t */\n\tinstantiateView(viewSpec) {\n\t\tif (!this.$childTargetEl || viewSpec.get('view')) return;\n\n\t\tconst viewClass = viewSpec.get('viewClass');\n\t\tlet opts = this.childView.options;\n\t\tif (typeof opts === 'function') {\n\t\t\topts = opts.call(this, viewSpec);\n\t\t} else {\n\t\t\t_.each(opts, (opt, key, all) => {\n\t\t\t\tif (\n\t\t\t\t\tkey === 'template' ||\n\t\t\t\t\tkey === 'onConfirmed' ||\n\t\t\t\t\tkey === 'onCancelled'\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tif (\n\t\t\t\t\t// Do not execute method overrides - leave them as is\n\t\t\t\t\t_.isFunction(opt) &&\n\t\t\t\t\t!opt.__isView__\n\t\t\t\t) {\n\t\t\t\t\tall[key] = opt.call(this, viewSpec);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\topts.viewSpec = viewSpec;\n\t\tlet viewOptions = viewSpec.get('viewOptions') || {};\n\t\tif (typeof viewOptions === 'function') {\n\t\t\tviewOptions = viewOptions.call(this, viewSpec);\n\t\t} else {\n\t\t\t_.each(viewOptions, (opt, key, all) => {\n\t\t\t\tif (\n\t\t\t\t\tkey === 'template' ||\n\t\t\t\t\tkey === 'onConfirmed' ||\n\t\t\t\t\tkey === 'onCancelled'\n\t\t\t\t)\n\t\t\t\t\treturn;\n\t\t\t\tif (\n\t\t\t\t\t// Do not execute method overrides - leave them as is\n\t\t\t\t\t_.isFunction(opt) &&\n\t\t\t\t\t!opt.__isView__\n\t\t\t\t) {\n\t\t\t\t\tall[key] = opt.call(this, viewSpec);\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\n\t\tconst view = new viewClass({...opts, ...viewOptions});\n\t\tviewSpec.set('view', view);\n\t\tthis.childViews = this.childViews || {};\n\t\tthis.childViews[viewSpec.cid] = view;\n\t\tthis.trigger('addedNewChildView', view);\n\n\t\tif (!this.$childTargetEl) return view;\n\n\t\tthis.$childTargetEl.append(view.$el);\n\t\tthis.renderOnInstatiate && view.render();\n\n\t\treturn view;\n\t}\n\n\t/**\n\t * @override\n\t * @param {boolean} simple Simple hide (not up for removal - just visibility change)\n\t */\n\thide(simple) {\n\t\t// If it is not a simple hide and we want to confirm unsaved changes and we have not previously confirmed unsaved changes\n\t\tif (\n\t\t\tsimple === true ||\n\t\t\t!this.confirmUnsavedChanges ||\n\t\t\tthis.confirmedUnsavedChanges\n\t\t) {\n\t\t\treturn super.hide(simple);\n\t\t}\n\n\t\tconst viewCollection = this.viewCollection;\n\n\t\t// Loop over our child views and check for a hide confirmations (unsaved changes)\n\t\t// We will only do the first one we find since wedo not have a great way yet to present a user with all the info about each unsaved view\n\t\t// So, if there are 2+ unsaved views, we confirm for one and it confirms for all\n\t\tlet unsavedView;\n\t\tfor (let i = 0, c = viewCollection.length, view; i < c; i++) {\n\t\t\tview = viewCollection.at(i).get('view');\n\t\t\tif (view && !view.confirmedUnsavedChanges) {\n\t\t\t\tunsavedView =\n\t\t\t\t\t_.isFunction(view.unsavedChanges) && view.unsavedChanges();\n\t\t\t\tif (unsavedView) break;\n\t\t\t}\n\t\t}\n\n\t\t// When all is ready\n\t\treturn this.when(unsavedView ? unsavedView.confirmHide() : true).then(\n\t\t\t(view) => {\n\t\t\t\t// We only confirm once - all other child views will be considered confirmed as well\n\t\t\t\tthis.viewCollection.each((viewSpec) => {\n\t\t\t\t\tconst v = viewSpec.get('view');\n\t\t\t\t\tif (!v) return;\n\t\t\t\t\tv.confirmedUnsavedChanges = true;\n\t\t\t\t});\n\t\t\t\t// We are good to hide\n\t\t\t\tthis.resetActiveView();\n\t\t\t\tsuper.hide(simple);\n\t\t\t},\n\t\t\t(view) => {\n\t\t\t\t// User opted not to hide, show the view\n\t\t\t\tthis.showView(view);\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Everything has happend in the core hiding of `this`\n\t * Executes just before `whenHidden` is resolved\n\t * @override\n\t * @listens {@link Netx.View#hidden}\n\t * @see {@link Netx.View#whenHidden|whenHidden}\n\t */\n\tafterHidden(view) {\n\t\tsuper.afterHidden(view);\n\n\t\tif (!this.emptyOnHide) return;\n\n\t\t// We defer so that anything running on hidden can finish\n\t\t_.defer(() => {\n\t\t\t// Views that wanted to show while we were hiding momentarily\n\t\t\tif (!this._viewQueue.length) return;\n\t\t\t// Apply queue\n\t\t\tthis.viewCollection.set(this._viewQueue.models);\n\t\t\t// Empty\n\t\t\tthis._viewQueue.reset([]);\n\t\t});\n\t}\n\n\t/**\n\t * We will need to cancel out any remaining views here as we can get collisions on after hidden\n\t * @method\n\t */\n\tbeforeHidden(cb) {\n\t\tsuper.beforeHidden(cb);\n\n\t\tif (!this.emptyOnHide) return this;\n\n\t\tthis.viewCollection.each((viewSpec) => {\n\t\t\tconst view = viewSpec.get('view');\n\t\t\tview && _.isFunction(view.cancel) && view.cancel();\n\t\t});\n\t\t// Always use set to empty\n\t\tthis.viewCollection.set([]);\n\t}\n\n\t/** @override */\n\tcheckHasResults() {\n\t\t// We may have a collection but it is not data related nor should it\n\t\t// be setting any no-results/no-assets attributes\n\t\t// Will need to deal with when we refactor the loading class stuff\n\t\treturn true;\n\t}\n\n\t/** @override */\n\tpostRender() {\n\t\tsuper.postRender();\n\n\t\tconst viewCollection = this.viewCollection;\n\n\t\t// Cache\n\t\tthis.$childTargetEl = this.$(this.childView.target || '.nx-childviews');\n\t\tif (!this.$childTargetEl.length) {\n\t\t\tthis.$childTargetEl = this.$el;\n\t\t}\n\n\t\tif (\n\t\t\t!this.getActiveView() &&\n\t\t\tthis.instantiateOnAdd &&\n\t\t\tviewCollection.length\n\t\t) {\n\t\t\tthis.instantiateView(viewCollection.at(0));\n\t\t}\n\n\t\tthis.el.classList.toggle('multiple-views', viewCollection.length > 1);\n\t}\n\n\t/** @override */\n\tremove() {\n\t\tthis.lastViewSpec = this.currentViewSpec = null;\n\t\t// Clear queue\n\t\tthis._viewQueueParentView.remove();\n\t\tthis._viewQueue.reset([]);\n\t\tthis._viewQueue.garbageCollect();\n\n\t\t_.invoke(this.childViews, 'remove');\n\n\t\tsuper.remove();\n\t}\n\n\t/**\n\t * Respond to `collection` remove events by removing the associated `childView`, if it exists.\n\t * Only respond if the app view has no where else to go - otherwise leave the view and its events intact\n\t * @override\n\t * @see {@link Netx.Views.MultiView#viewCollection|viewCollection}\n\t */\n\tremoveChildView(model, collection, opts = {}) {\n\t\t// Make sure it was removed from our `collection`\n\t\tif (!this.childViews || collection !== this.viewCollection) return;\n\n\t\tconst childView = model.get('view');\n\t\tif (!childView) return;\n\n\t\t// Leave the events and elements intact\n\t\tif (!model.collections.length) {\n\t\t\tchildView.remove();\n\t\t}\n\t\t// This only pertains to this view\n\t\tdelete this.childViews[model.cid];\n\t\tthis.stopListening(childView);\n\t\tthis.trigger('removedChildView', childView);\n\t}\n\n\t/**\n\t * Do any of our children have unsaved changes?\n\t * @override\n\t * @return {boolean|Netx.View} false / first unsaved instance of Netx.View\n\t */\n\tunsavedChanges() {\n\t\tconst viewCollection = this.viewCollection;\n\n\t\t// Loop over our `viewCollection` and find the first `childView` with unsaved changes\n\t\tlet hasUnsavedChanges = false;\n\t\tfor (let i = 0, c = viewCollection.length, view; i < c; i++) {\n\t\t\tview = viewCollection.at(i).get('view');\n\t\t\tif (view && view.unsavedChanges()) {\n\t\t\t\thasUnsavedChanges = view;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\n\t\treturn hasUnsavedChanges;\n\t}\n\n\t/**\n\t * Get the active `childView`\n\t * @method\n\t * @return {Netx.View} Active `childView` instance or `undefined`\n\t */\n\tgetActiveView() {\n\t\tconst viewSpec = this.viewCollection.findWhere({active: true});\n\t\treturn viewSpec ? viewSpec.get('view') : undefined;\n\t}\n\n\t/**\n\t * Find the first enabled (via `showActions`/`uniqueShowAction`) `childView` and show it.\n\t * Pass a `viewId` if you want to diqualify a particular `childView` from being considered.\n\t * @method\n\t * @param {string} viewId If provided it will get the first `view` not to match `viewId`\n\t * @return {boolean|Netx.Models.AppView} First enabled instance of {@link Netx.Models.AppView} or `false`\n\t */\n\tgetFirstEnabledView(viewId) {\n\t\tconst activeView = this.getActiveView();\n\t\tconst viewCollection = this.viewCollection;\n\t\tconst collectionLength = viewCollection.length;\n\n\t\tif (\n\t\t\tcollectionLength < 2 ||\n\t\t\t(activeView &&\n\t\t\t\tactiveView.viewSpec.id !== viewId &&\n\t\t\t\tactiveView.viewSpec.get('name') !== viewId)\n\t\t)\n\t\t\treturn false;\n\n\t\t// Either there is no `activeView` or the `activeView` is the view we do not want and we have enough views to do anything\n\t\t// Look for the first view that is not the one we could not show and is also valid to show\n\t\tfor (let i = 0, viewSpec; i < collectionLength; i++) {\n\t\t\tviewSpec = viewCollection.at(i);\n\t\t\tif (\n\t\t\t\t(!viewId ||\n\t\t\t\t\t(viewSpec.id !== viewId && viewSpec.get('name') !== viewId)) &&\n\t\t\t\tthis.isViewActionValid(viewSpec)\n\t\t\t) {\n\t\t\t\treturn viewSpec;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Get a `childView` by `name`\n\t * @method\n\t * @param {string} name View name\n\t * @return {Netx.View} `Netx.View` instance or `undefined`\n\t */\n\tgetViewByName(name) {\n\t\tconst viewSpec =\n\t\t\tthis.viewCollection.findWhere({name: name}) ||\n\t\t\tthis.viewCollection.findWhere({viewClass: name});\n\t\tif (!viewSpec) return;\n\n\t\treturn viewSpec.get('view');\n\t}\n\n\t/**\n\t * Hide every `childView`\n\t * @method\n\t */\n\thideAllViews() {\n\t\t_.invoke(this.childViews, 'hide', true);\n\t\treturn this;\n\t}\n\n\t/**\n\t * Check the unqiue show `action` of a `viewSpec`\n\t * @method\n\t * @param {Netx.Models.AppView} viewSpec View spec\n\t * @return {boolean} View `action` valid\n\t * TODO: Refactor actions and break up the pieces, like tests and synced listeners etc\n\t */\n\tisViewActionValid(viewSpec) {\n\t\tif (!viewSpec) return false;\n\t\treturn viewSpec.isViewActionValid();\n\t}\n\n\t/** @method */\n\tloadedView() {\n\t\tthis._loadingView = false;\n\t\tthis.reflectLoadingTimeout && clearTimeout(this.reflectLoadingTimeout);\n\t\tthis.el.removeAttribute('data-nx-loading-view');\n\t}\n\n\t/** @method */\n\tloadingView() {\n\t\tif (this._loadingView) return;\n\n\t\tthis._loadingView = true;\n\t\tthis.reflectLoadingTimeout && clearTimeout(this.reflectLoadingTimeout);\n\t\tthis.reflectLoadingTimeout = setTimeout(() => {\n\t\t\tif (!this._loadingView) return;\n\t\t\tthis.el.setAttribute('data-nx-loading-view', 'true');\n\t\t}, 48);\n\t}\n\n\t/**\n\t * Set the active `childView` to inactive\n\t * @method\n\t */\n\tresetActiveView() {\n\t\tconst viewSpec = this.viewCollection.findWhere({active: true});\n\t\tviewSpec && viewSpec.set('active', false);\n\t\t// Chain\n\t\treturn this;\n\t}\n\n\t/**\n\t * Set a class on `this.$el` to reflect the currently active `view`\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t */\n\tsetClassName(view) {\n\t\t// Set class this.$el\n\t\tthis.$el\n\t\t\t.removeClass((index, css) => {\n\t\t\t\t// We want to remove all classes matching '*-layer'\n\t\t\t\treturn (css.match(/\\S+-layer/g) || []).join(' ');\n\t\t\t})\n\t\t\t.addClass(\n\t\t\t\t`${view.viewSpec.get('name') || _.toCamelCase(view.viewSpec.id)}-layer`,\n\t\t\t);\n\t\t// Chain\n\t\treturn this;\n\t}\n\n\t/**\n\t * Show a `childView`\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t */\n\tshowView(view) {\n\t\tif (!this.viewChanging(view)) return this;\n\n\t\t// Show `this`\n\t\tthis.show();\n\n\t\t// Clean up any exisiting promise\n\t\tif (this.viewReady && this.viewReady.state() === 'pending') {\n\t\t\tthis.viewReady.rejectWith(this);\n\t\t}\n\t\tthis.viewReady = new $.Deferred();\n\n\t\tthis.loadingView();\n\n\t\tthis.lastViewSpec = this.currentViewSpec;\n\t\tthis.currentViewSpec = view.viewSpec;\n\n\t\t// Let `this` view respond to the fact we are about to call `show` on `view`\n\t\tthis.beforeShowView(view).then(() => {\n\t\t\tthis.whenShown.then(() => {\n\t\t\t\t// Delay hide\n\t\t\t\t// All views will live for at least 500ms - otherwise I have no idea what the interface is trying to do.\n\t\t\t\tconst d = new $.Deferred();\n\t\t\t\tview.hideDelayed = d.promise();\n\n\t\t\t\t_.delay(_.partial(d.resolveWith, this), view.minimumShowTime || 250);\n\n\t\t\t\t// Then call `show` on `view`\n\t\t\t\tview.show();\n\n\t\t\t\tthis.loadedView();\n\t\t\t});\n\t\t});\n\n\t\treturn this;\n\t}\n\n\t/**\n\t * Show will be starting soon\n\t * At this point not even `view.show` has been executed\n\t * This allows the view to do anything special it needs to do in anticipation of calling `view.show`\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @return {Promise} Promise\n\t */\n\tbeforeShowView(view) {\n\t\t// Multi-view does not currently have any default functionality here\n\t\t// But this mehtod is only implemented in multi-view - other views extending this should call `super`\n\t\t// unless certain that they will always override any behavior that may be later placed here\n\n\t\t// FUN FACT: You cannot even put the word in a comment (without spaces) `_ s u p e r` - backbone super\n\t\t// must parse the functions as a string and search for an instance of that word (regardless of context)\n\t\t// and if it finds it, it tries to wrap the method - if the method's super does not implement the function\n\t\t// you get `Uncaught Super does not implement this method: `\n\n\t\t// This method is for letting the view know a `childView` is going to be shown (before `show` is ever called)\n\t\t// We wait for our view to be shown before showing any `childViews` - but we may want to do something\n\t\t// in anticipation for the showing of a `childView` prior to any delays\n\n\t\t// Now we support promises (useful for when what we are doing may involve deferred modules)\n\t\t// All methods overriding this must return super or return and resolve `this.viewReady`\n\t\tconst deferredModules = view.viewSpec.get('deferredModules');\n\t\tif (!_.isFunction(deferredModules)) {\n\t\t\treturn this.viewReady.resolveWith(this);\n\t\t}\n\n\t\tdeferredModules(() => {\n\t\t\tthis.viewReady.resolveWith(this);\n\t\t});\n\t\treturn this.viewReady.promise();\n\t}\n\n\t/**\n\t * Find and the show the first enabled (via `showActions`/`uniqueShowAction`) `childView` and show it.\n\t * Pass a `viewId` if you want to diqualify a particular `childView` from being considered.\n\t * @method\n\t * @param {number} viewId If provided it will show the first `view` not to match `viewId`\n\t * @return {boolean|Netx.Models.AppView} First enabled instance of {@link Netx.Models.AppView} or `false`\n\t */\n\tshowFirstEnabledView(viewId) {\n\t\tconst viewSpec = this.getFirstEnabledView(viewId);\n\t\tif (!viewSpec) return;\n\n\t\tconst action = FindLegacyAction(viewSpec.get('uniqueShowAction'));\n\t\taction && this.performAction(action, [viewSpec.get('view'), null]);\n\n\t\treturn viewSpec;\n\t}\n\n\t/**\n\t * Show a `childView` by `name`\n\t * @method\n\t * @param {string} name `childView` name\n\t */\n\tshowViewByName(name) {\n\t\tlet view = this.getViewByName(name);\n\n\t\tif (!view) {\n\t\t\tlet viewSpec = this.viewCollection.findWhere({name: name});\n\t\t\tview = viewSpec && this.instantiateView(viewSpec);\n\t\t}\n\n\t\tview && this.showView(view);\n\n\t\t// Chain\n\t\treturn this;\n\t}\n\n\t/**\n\t * Provided with the view we are changing to and the knowledge of the current view\n\t * you can block the change by returning `false`\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @returns {boolean} Ok to change/show view\n\t */\n\tviewChanging(view) {\n\t\t// Transient views:\n\t\t// It should be noted - the view will go away still if you change views in its original `viewCollection` - since you are\n\t\t// affecting its original home - it will return (like in the category edit view - clicking another tab in the sidebar -\n\t\t// since that is where the category edit view belongs).\n\t\t// I think this is the desired behavior and avoids a lot of complications we would have if we tried to manage any deeper\n\t\t// than this. If we do, for some reason, decide we want to block it on all fronts - we will need to add this logic check\n\t\t// to the removal method in `multi-view` and check if the view being removed is `switched` and if so if it is blocking and\n\t\t// leave it be - but then you are entering a world of headaches I would imagine... it would be really hard to not create\n\t\t// collisions eventually. I think we would also need to add an idea of a queued active view when an official switch back\n\t\t// does finally occur.\n\t\t// If we have an active view and that view did not orginalyy belong to us, check its `transientOptions`\n\t\tconst activeView = this.getActiveView();\n\t\tif (\n\t\t\tactiveView &&\n\t\t\t!activeView.viewSpec.isMyOriginalCollection(this.viewCollection)\n\t\t) {\n\t\t\tconst transientOpts = activeView.transientOptions || {};\n\t\t\tif (transientOpts.blocking) {\n\t\t\t\t// Update `cachedActiveView` (so we will go to the view that was trying to show when done with this blocking one)\n\t\t\t\tthis.cachedActiveView = view;\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t\treturn true;\n\t}\n\n\t/**\n\t * Everything has happend in the core hiding of this `childView`\n\t * Executes just before `whenHidden` is resolved\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#view:hidden|view:hidden}\n\t * @see {@link Netx.View#whenHidden|whenHidden}\n\t */\n\tviewAfterHidden(view) {\n\t\t// Multi-view does not currently have any default functionality here\n\t\t// But this mehtod is only implemented in multi-view - other views extending this should call `super`\n\t\t// unless certain that they will always override any behavior that may be later placed here\n\t}\n\n\t/**\n\t * Everything has happend in the core showing of this `childView`\n\t * Executes just before `whenShown` is resolved\n\t * @method\n\t * @param {Netx.View} view Instance of {@link Netx.View} (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#view:shown|view:shown}\n\t * @see {@link Netx.View#whenShown|whenShown}\n\t */\n\tviewAfterShown(view) {\n\t\tthis.setClassName(view);\n\n\t\t// TODO: if the following view is one that renders when its collection fetches\n\t\t// and that is happening or is currently happening - we will get a double render\n\t\t// But I can't know if the view is going to need rendering or not...\n\t\t// We could check ( view.collection || view.model ) `syncedOnce` || `syncing` but\n\t\t// we still do not know if the view is listening to that. Until we figure out a\n\t\t// good pattern - the double render will occur - it is better than the view not\n\t\t// rendering at all by chance\n\t\t!view.renderedOnce && view.render();\n\t}\n\n\t/**\n\t * A `childView` was instantiated (a brand new `childView` was born - or at least as far as this view is concerned)\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#childViewAdded|childViewAdded}\n\t */\n\tviewInstantiated(view) {\n\t\tconst viewSpec = view.viewSpec;\n\n\t\t// So we can out the right one back when our visitor leaves (if nothing else steps up to the plate)\n\t\tif (!viewSpec.isMyOriginalCollection(this.viewCollection)) {\n\t\t\tthis.cachedActiveView = this.getActiveView();\n\t\t}\n\n\t\t// We are only enabled on instatiate if valid\n\t\tviewSpec.set('enabled', this.isViewActionValid(viewSpec));\n\n\t\t////////////////////////////////\n\t\t// LISTENERS\n\t\t////////////////////////////////\n\t\tconst action = FindLegacyAction(viewSpec.get('uniqueShowAction')) || {};\n\t\tif (action.testOnSync) {\n\t\t\tview.collection &&\n\t\t\t\tthis.listenTo(\n\t\t\t\t\tview.collection,\n\t\t\t\t\t'sync reset',\n\t\t\t\t\t_.partial(this.viewActionSynced, view),\n\t\t\t\t);\n\t\t\tview.model &&\n\t\t\t\tthis.listenTo(\n\t\t\t\t\tview.model,\n\t\t\t\t\t'sync',\n\t\t\t\t\t_.partial(this.viewActionSynced, view),\n\t\t\t\t);\n\t\t}\n\t\t////////////////////////////////\n\t\t// !LISTENERS\n\t\t////////////////////////////////\n\n\t\t// Rather than doing this on the `childView` object we must do it manually\n\t\t// otherwise we need to start modifying the `className` or we get the classes back on each render\n\t\tview.$el.addClass(this.additionalViewClasses);\n\n\t\t// Reset confirmation\n\t\tview.confirmedUnsavedChanges = false;\n\n\t\t// This is the first time - so show it now\n\t\t// Or we were added from an existing view collection and were active\n\t\tif (this.showOnAdd || view.viewSpec.get('active')) {\n\t\t\tthis.showView(view);\n\t\t}\n\t}\n\n\t/**\n\t * A `model` or `collection` related to a `childView`'s `showAction`/`uniqueShowAction` has syced, check if we should be enabled or not\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * TODO: Refactor actions and break up the pieces, like tests and synced listeners etc\n\t */\n\tviewActionSynced(view) {\n\t\tconst viewSpec = view && view.viewSpec;\n\t\tviewSpec && viewSpec.set('enabled', this.isViewActionValid(viewSpec));\n\t}\n\n\t/**\n\t * `hide` is about to start on a `childView`\n\t * At this point no animations or actual hiding [should] have taken place\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#view:hiding|view:hiding}\n\t */\n\tviewOnHiding(view) {\n\t\t// Only change its active status to `false` if it beloings to our `viewCollection`\n\t\tview.viewSpec.isMyOriginalCollection(this.viewCollection) &&\n\t\t\tview.viewSpec.set('active', false);\n\t\t// A defer here - just as with `viewRemoved` - there can always be that perfect timing where a new view is coming in\n\t\t// A defer is sufficient to avoid these perfect timing bad deals\n\t\t_.defer(() => {\n\t\t\t// We are not already hiding, the view will be removed on hide, this is the only view left and we want to hide when empty\n\t\t\tif (\n\t\t\t\t!this.hiding &&\n\t\t\t\tview.removeOnHide &&\n\t\t\t\tthis.hideOnEmpty &&\n\t\t\t\tthis.viewCollection.length === 1 &&\n\t\t\t\t(!view.viewSpec || this.viewCollection.at(0).id === view.viewSpec.id)\n\t\t\t) {\n\t\t\t\tthis.hide();\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * `show` is about to start on a `childView`\n\t * At this point no animations or actual hiding [should] have taken place\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#view:showing|view:showing}\n\t */\n\tviewOnShowing(view) {\n\t\t// DAM-18927 - don't activate if another view has taken it's place\n\t\tif (view.viewSpec.cid === this.currentViewSpec.cid) {\n\t\t\t// Set as active view\n\t\t\tview.viewSpec.set('active', true);\n\t\t}\n\t}\n\n\t/**\n\t * A `childView` was removed\n\t * @method\n\t * @param {Netx.View} view View (created via {@link Netx.Models.AppView})\n\t * @listens {@link Netx.Views.MultiView#removedChildView|removedChildView}\n\t */\n\tviewRemoved(view) {\n\t\t// Cleanup classes that were added\n\t\tview.$el.removeClass(this.additionalViewClasses);\n\n\t\t// If we were the cached view - we are not anymore\n\t\tif (this.cachedActiveView && view.cid === this.cachedActiveView.cid) {\n\t\t\tdelete this.cachedActiveView;\n\t\t}\n\n\t\tconst idx = this.registeredViews.indexOf(view.viewSpec.id);\n\t\tidx > -1 && this.registeredViews.splice(idx, 1);\n\n\t\t////////////////////////////////\n\t\t// STOP LISTENERS\n\t\t////////////////////////////////\n\t\t// See `viewInstantiated` method\n\t\tthis.stopListening(view);\n\t\t_.each(view.viewSpec.get('showActions'), (action) => {\n\t\t\tthis.stopListening(dispatcher, action);\n\t\t});\n\t\tthis.stopListening(dispatcher, view.viewSpec.get('uniqueShowAction'));\n\t\tview.collection && this.stopListening(view.collection, 'sync reset');\n\t\tview.model && this.stopListening(view.model, 'sync');\n\t\t////////////////////////////////\n\t\t// !STOP LISTENERS\n\t\t////////////////////////////////\n\n\t\t// This should have happend in the viewHidden method - but just in case it was bypassed\n\t\t// This only happens if our `viewCollection` is the `viewSpec`'s original collection\n\t\tview.viewSpec.isMyOriginalCollection(this.viewCollection) &&\n\t\t\tview.viewSpec.set('active', false);\n\n\t\t// Vars\n\t\tconst activeView = this.getActiveView();\n\t\tconst activeViewMatch =\n\t\t\t!activeView || activeView.viewSpec.id === view.viewSpec.id;\n\n\t\t// Make sure we are not already hiding or removing\n\t\tif (this.hiding || this.removing) return;\n\n\t\t// Wait for the chance a new view may have been added\n\t\t_.defer(() => {\n\t\t\tif (this.removing) return;\n\t\t\t// There is nothing left to show - hide this\n\t\t\tif (!this.viewCollection.length) {\n\t\t\t\tthis.hideOnEmpty && this.hide();\n\t\t\t} else {\n\t\t\t\tlet viewToShow;\n\t\t\t\tif (view.viewSpec !== this.currentViewSpec) {\n\t\t\t\t\t// A new current view has already been set in this time but is not visible\n\t\t\t\t\tconst currentView = this.currentViewSpec.get('view');\n\t\t\t\t\tif (!currentView.isShown) {\n\t\t\t\t\t\tviewToShow = currentView;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// Either there is no defined active view or the view we just removed was the active one and no others are active\n\t\t\t\telse if (activeViewMatch && !this.getActiveView()) {\n\t\t\t\t\tif (this.lastViewSpec && this.viewCollection.get(this.lastViewSpec)) {\n\t\t\t\t\t\tviewToShow = this.lastViewSpec.get('view');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tconst keys = _.keys(this.childViews);\n\t\t\t\t\t\tviewToShow =\n\t\t\t\t\t\t\tthis.cachedActiveView || this.childViews[keys[keys.length - 1]];\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t// We should not be in a situation where we want to show something that is already hiding/removing\n\t\t\t\tif (\n\t\t\t\t\tviewToShow &&\n\t\t\t\t\t!viewToShow.removing &&\n\t\t\t\t\t(!viewToShow.hiding || !viewToShow.removeOnHide)\n\t\t\t\t) {\n\t\t\t\t\tthis.showView(viewToShow);\n\t\t\t\t}\n\t\t\t}\n\t\t\tdelete this.cachedActiveView;\n\t\t});\n\t}\n\n\t/** @type {boolean} */\n\tstatic get __isMultiView__() {\n\t\treturn true;\n\t}\n\n\t/** @type {string} */\n\tstatic get __name__() {\n\t\treturn 'MultiView';\n\t}\n}\n\nexport default MultiView;\n"],"names":["MultiView","Base","isMultiView","this","constructor","__isMultiView__","opts","viewCollection","AppViewsCollection","childView","_objectSpread","viewClass","model","get","target","collection","options","attributes","super","instantiateOnAdd","registeredViews","additionalViewClasses","confirmUnsavedChanges","emptyOnHide","hideOnEmpty","hideWhenChildViewRemoved","renderOnInstatiate","showOnAdd","viewSpec","listenTo","registerView","instantiateView","args","removeChildView","el","classList","toggle","length","cachedActiveView","viewQueue","_viewQueue","AppViewsQueueCollection","queueFor","view","_viewQueueParentView","template","EmptyTemplate","_","defer","bind","partial","viewInstantiated","viewRemoved","_listenId","prev","_previousAttributes","newActions","prevActions","showActions","each","difference","action","stopListening","dispatcher","showView","newAction","prevAction","uniqueShowAction","match","RegisterLegacyAction","event","label","i18n","t","isMyOriginalCollection","$el","removeClass","set","addClass","activeView","getActiveView","addChildView","isUndefined","cid","toggleClass","findWhere","switched","remove","viewOnHiding","viewAfterHidden","viewOnShowing","viewAfterShown","hide","getExcludedViews","concat","pluck","childViews","indexOf","id","push","forEach","$childTargetEl","call","opt","key","all","isFunction","__isView__","viewOptions","trigger","append","render","simple","confirmedUnsavedChanges","unsavedView","i","c","at","unsavedChanges","when","confirmHide","then","v","resetActiveView","afterHidden","models","reset","beforeHidden","cb","cancel","checkHasResults","postRender","$","lastViewSpec","currentViewSpec","garbageCollect","invoke","collections","hasUnsavedChanges","active","undefined","getFirstEnabledView","viewId","collectionLength","isViewActionValid","getViewByName","name","hideAllViews","loadedView","_loadingView","reflectLoadingTimeout","clearTimeout","removeAttribute","loadingView","setTimeout","setAttribute","setClassName","index","css","join","toCamelCase","viewChanging","show","viewReady","state","rejectWith","Deferred","beforeShowView","whenShown","d","hideDelayed","promise","delay","resolveWith","minimumShowTime","deferredModules","showFirstEnabledView","FindLegacyAction","performAction","showViewByName","transientOptions","blocking","renderedOnce","testOnSync","viewActionSynced","hiding","removeOnHide","idx","splice","activeViewMatch","removing","viewToShow","currentView","isShown","keys","__name__"],"sourceRoot":""}