{"version":3,"sources":["webpack:///./packages/core/lib/netx-loading.js","webpack:///./build-targets/theme/packages/core/lib/netx-loading.js","webpack:///./packages/core/lib/netx-routers-app.js","webpack:///./packages/core/index.js"],"names":["loadedChunks","__webpack_require__","e","_","wrap","chunkId","apply","this","rest","arguments","dispatcher","trigger","promise","then","messageQueue","loadingQueue","initializingQueue","Loading","constructor","extend","Backbone","Events","checkMessage","throttle","checkProgress","progressAmt","el","document","getElementById","messageEl","querySelector","messageTextEl","progressEl","progressWrapperEl","progressBarEl","splashEl","listenTo","initializingModule","initializedModule","loadingChunk","loadedChunk","restLoading","restLoaded","appLoaded","cb","removeSplash","hideMessageTimeout","clearTimeout","messageKeys","keys","hasMessage","length","messageActive","classList","add","innerText","last","setTimeout","remove","progressMessage","hasProgress","completeProgressTimeout","hideProgressTimeout","progressAwaitingCompletion","progressActive","progressStalled","hangingProgressTimeout","progressComplete","progressHide","drawProgress","drawing","draw","style","width","Math","min","progressIndeterminate","window","requestAnimationFrame","chunk","name","progress","deferred","key","join","defered","$splashEl","$","fadeOut","isFunction","thing","namespace","fn","message","getRestLoadingMessage","call","getRestLoadedMessage","Base","super","mdcProgress","MDCLinearProgress","foundation_","setDeterminate","BASE64_ROUTES_BASES","routeIsBase64","route","find","base","includes","routeInterceptors","Map","History","prototype","loadUrl","_isRouting","args","ret","isRouting","Router","ES6Router","opts","AppRouter","history","customSize","Netx","custom","router","SIZE","size","routeChanged","page","routeContext","hash","location","unescapeURI","replace","escapeURI","correctBase64RouteIfNeeded","pageRoute","test","navigate","isUndefined","oldHash","on","newHash","addRouteInterceptor","func","set","removeRouteInterceptor","delete","back","home","defaultRoute","console","warn","REQUIRE_LOGIN","session","authenticated","contains","reload","pop","oldRoute","fragment","unshift","callback","isRegExp","_routeToRegExp","_extractParameters","_route","lastIndexOf","substr","execute","executeRoute","concat","isPromise","get","Array","from","reroute","frag","replaceState","addRoutes","routes","reverse","forEach","routePattern","inCategory","match","parseInt","exitRoute","pattern","targetRoute","r","RegExp","force","sendOpts","HOME_ROUTE","initialize","Object","assign","config","Routers","App","start","silent","Promise","resolve","reject","ShareRequest","default","error","initialized"],"mappings":";8GAAA,MAAMA,EAAe,CAAC,EAEtBC,EAAoBC,EAAIC,EAAEC,KAAKH,EAAoBC,GAAG,SAASA,EAAGG,GACjE,GAAIL,EAAaK,GAAU,OAAOH,EAAEI,MAAMC,KAAMJ,EAAEK,KAAKC,YAEvDC,WAAWC,QAAQ,qBAAsBN,GAEzC,IAAIO,EAAUV,EAAEI,MAAMC,KAAMJ,EAAEK,KAAKC,YAMnC,OALAG,EAAQC,MAAK,WACZb,EAAaK,IAAW,EACxBK,WAAWC,QAAQ,oBAAqBN,EACzC,IAEOO,CACR,IAEA,MAAME,EAAe,CAAC,EAChBC,EAAe,CAAC,EAChBC,EAAoB,CAAC,EAmTZC,MA9Sf,MAICC,cAECf,EAAEgB,OAAOZ,KAAMa,SAASC,QAGxBd,KAAKe,aAAenB,EAAEoB,SAAShB,KAAKe,aAAc,IAAI,GACtDf,KAAKiB,cAAgBrB,EAAEoB,SAAShB,KAAKiB,cAAe,QAAQ,GAE5DjB,KAAKkB,YAAc,EAEnB,IAAIC,EAAMnB,KAAKmB,GAAKC,SAASC,eAAe,iBAE5CrB,KAAKsB,UAAYH,EAAGI,cAAc,mBAClCvB,KAAKwB,cAAgBxB,KAAKsB,UAAUC,cAAc,wBAElDvB,KAAKyB,WAAaN,EAAGI,cAAc,oBACnCvB,KAAK0B,kBAAoB1B,KAAKyB,WAAWF,cACxC,wBAEDvB,KAAK2B,cAAgB3B,KAAK0B,kBAAkBH,cAC3C,oBAGDvB,KAAK4B,SAAWT,EAAGI,cAAc,YAGjCvB,KAAK6B,SACJ1B,WACA,2BACAH,KAAK8B,oBAEJD,SAAS1B,WAAY,0BAA2BH,KAAK+B,mBACrDF,SAAS1B,WAAY,qBAAsBH,KAAKgC,cAChDH,SAAS1B,WAAY,oBAAqBH,KAAKiC,aAC/CJ,SAAS1B,WAAY,oBAAqBH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min.js?2.23.2.92950101.1696963302561","sourcesContent":["const loadedChunks = {};\n// Override - will need to check this method every time we update webpack\n__webpack_require__.e = _.wrap(__webpack_require__.e, function(e, chunkId) {\n\tif (loadedChunks[chunkId]) return e.apply(this, _.rest(arguments));\n\n\tdispatcher.trigger('netx:loading:chunk', chunkId);\n\n\tvar promise = e.apply(this, _.rest(arguments));\n\tpromise.then(function() {\n\t\tloadedChunks[chunkId] = true;\n\t\tdispatcher.trigger('netx:loaded:chunk', chunkId);\n\t});\n\n\treturn promise;\n});\n\nconst messageQueue = {};\nconst loadingQueue = {};\nconst initializingQueue = {};\n\n/**\n * @class\n */\nclass Loading {\n\t/**\n\t * @method\n\t */\n\tconstructor() {\n\t\t// Get backbone events (they are quite nice)\n\t\t_.extend(this, Backbone.Events);\n\n\t\t// Debounced/throttled methods\n\t\tthis.checkMessage = _.throttle(this.checkMessage, 50, true);\n\t\tthis.checkProgress = _.throttle(this.checkProgress, 16.666, true);\n\n\t\tthis.progressAmt = 0;\n\n\t\tvar el = (this.el = document.getElementById('nx-app-loader'));\n\t\t// Messaging\n\t\tthis.messageEl = el.querySelector('#nx-app-message');\n\t\tthis.messageTextEl = this.messageEl.querySelector('#nx-app-message-text');\n\t\t// Progress bar\n\t\tthis.progressEl = el.querySelector('#nx-app-progress');\n\t\tthis.progressWrapperEl = this.progressEl.querySelector(\n\t\t\t'#nx-progress-wrapper',\n\t\t);\n\t\tthis.progressBarEl = this.progressWrapperEl.querySelector(\n\t\t\t'#nx-progress-bar',\n\t\t);\n\t\t// Splash screen\n\t\tthis.splashEl = el.querySelector('#loading');\n\n\t\t// Hey, listen!\n\t\tthis.listenTo(\n\t\t\tdispatcher,\n\t\t\t'netx:initializing:module',\n\t\t\tthis.initializingModule,\n\t\t)\n\t\t\t.listenTo(dispatcher, 'netx:initialized:module', this.initializedModule)\n\t\t\t.listenTo(dispatcher, 'netx:loading:chunk', this.loadingChunk)\n\t\t\t.listenTo(dispatcher, 'netx:loaded:chunk', this.loadedChunk)\n\t\t\t.listenTo(dispatcher, 'netx:rest:loading', this.restLoading)\n\t\t\t.listenTo(dispatcher, 'netx:rest:loaded', this.restLoaded);\n\t}\n\n\t/**\n\t * @method\n\t * @param {function} cb Callback\n\t */\n\tappLoaded(cb) {\n\t\tthis.removeSplash(cb);\n\t}\n\n\t/**\n\t * @method\n\t */\n\tcheckMessage() {\n\t\tthis.hideMessageTimeout && clearTimeout(this.hideMessageTimeout);\n\n\t\tconst messageEl = this.messageEl,\n\t\t\tmessageTextEl = this.messageTextEl,\n\t\t\tmessageKeys = _.keys(messageQueue),\n\t\t\thasMessage = messageKeys.length > 0;\n\n\t\tif (hasMessage && !this.messageActive) {\n\t\t\tmessageEl.classList.add('active');\n\t\t\tthis.messageActive = true;\n\t\t}\n\n\t\tif (hasMessage) {\n\t\t\tmessageTextEl.innerText = messageQueue[_.last(messageKeys)];\n\t\t} else if (this.messageActive) {\n\t\t\tthis.hideMessageTimeout = setTimeout(() => {\n\t\t\t\tmessageEl.classList.remove('active');\n\t\t\t\tthis.messageActive = false;\n\t\t\t\tthis.progressMessage = '';\n\t\t\t}, 1500);\n\t\t}\n\t}\n\n\t/**\n\t * @method\n\t */\n\tcheckProgress() {\n\t\tconst progressEl = this.progressEl,\n\t\t\tprogressBarEl = this.progressBarEl,\n\t\t\tprogressWrapperEl = this.progressWrapperEl;\n\n\t\tconst progressKeys = _.keys(loadingQueue),\n\t\t\thasProgress = progressKeys.length > 0;\n\n\t\tif (hasProgress) {\n\t\t\tthis.completeProgressTimeout &&\n\t\t\t\tclearTimeout(this.completeProgressTimeout);\n\t\t\tthis.hideProgressTimeout && clearTimeout(this.hideProgressTimeout);\n\t\t\tthis.progressAwaitingCompletion = false;\n\t\t}\n\n\t\tif (hasProgress && !this.progressActive) {\n\t\t\tprogressEl.classList.remove('disable-transition');\n\t\t\tprogressEl.classList.add('active');\n\t\t\tthis.progressActive = true;\n\t\t\tthis.progressStalled = false;\n\t\t} else if (\n\t\t\t!hasProgress &&\n\t\t\tthis.progressActive &&\n\t\t\t!this.progressAwaitingCompletion\n\t\t) {\n\t\t\tthis.progressAwaitingCompletion = true;\n\t\t\tthis.hangingProgressTimeout && clearTimeout(this.hangingProgressTimeout);\n\n\t\t\tthis.completeProgressTimeout = setTimeout(() => {\n\t\t\t\tif (!this.progressAwaitingCompletion) return;\n\n\t\t\t\tthis.progressComplete();\n\n\t\t\t\tthis.hideProgressTimeout = setTimeout(() => {\n\t\t\t\t\tif (this.progressActive) return;\n\t\t\t\t\t\n\t\t\t\t\tthis.progressHide();\n\t\t\t\t}, 500);\n\t\t\t}, 350);\n\t\t}\n\n\t\tthis.drawProgress();\n\t}\n\n\t/**\n\t * @method\n\t */\n\tdrawProgress() {\n\t\tif (this.drawing) return;\n\t\t\n\t\tconst progressEl = this.progressEl,\n\t\t\tprogressBarEl = this.progressBarEl,\n\t\t\tprogressWrapperEl = this.progressWrapperEl;\n\n\t\tconst draw = () => {\n\t\t\tthis.progressAmt += (100 - this.progressAmt) * 0.015;\n\t\t\tprogressBarEl.style.width = Math.min(this.progressAmt, 100) + '%';\n\n\t\t\tif (!this.progressActive) {\n\t\t\t\tthis.drawing = false;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (this.progressAmt >= 99 && !this.progressStalled) {\n\t\t\t\tthis.progressStalled = true;\n\t\t\t\tthis.hangingProgressTimeout = setTimeout(() => {\n\t\t\t\t\tif (!this.progressStalled) return;\n\t\t\t\t\t\n\t\t\t\t\tthis.progressIndeterminate();\n\t\t\t\t}, 2000);\n\t\t\t}\n\n\t\t\twindow.requestAnimationFrame(draw);\n\t\t};\n\n\t\tthis.drawing = true;\n\t\tdraw();\n\t}\n\n\t/**\n\t * @method\n\t * @param {number} chunk Chunk id\n\t */\n\tloadingChunk(chunk) {\n\t\tloadingQueue['chunk:' + chunk] = true;\n\t\tthis.checkProgress();\n\t}\n\n\t/**\n\t * @method\n\t * @param {number} chunk Chunk id\n\t */\n\tloadedChunk(chunk) {\n\t\tdelete loadingQueue['chunk:' + chunk];\n\t\tthis.checkProgress();\n\t}\n\n\t/**\n\t * @method\n\t * @param {string} name Module name\n\t * @param {number} progress Module overall init progress (for this round anyways)\n\t * @param {boolean} deferred Module was deferred\n\t */\n\tinitializingModule(name, progress, deferred) {\n\t\tconst key = ['module', name].join(':');\n\n\t\tloadingQueue[key] = true;\n\t\tinitializingQueue[key] = {\n\t\t\tdefered: deferred,\n\t\t\tprogress: progress,\n\t\t};\n\t\tmessageQueue[key] =\n\t\t\t'Initializing: ' + name + ((deferred && ' (deferred)') || '');\n\n\t\tthis.checkMessage();\n\t\tthis.checkProgress();\n\t}\n\n\t/**\n\t * @method\n\t * @param {string} name Module name\n\t * @param {number} progress Module overall init progress (for this round anyways)\n\t * @param {boolean} deferred Module was deferred\n\t */\n\tinitializedModule(name, progress, deferred) {\n\t\tconst key = ['module', name].join(':');\n\n\t\tmessageQueue[key] =\n\t\t\t'Initialized: ' + name + ((deferred && ' (deferred)') || '');\n\t\tsetTimeout(() => {\n\t\t\tdelete messageQueue[key];\n\t\t\tthis.checkMessage();\n\t\t}, 500);\n\n\t\tdelete loadingQueue[key];\n\t\tdelete initializingQueue[key];\n\n\t\tthis.checkMessage();\n\t\tthis.checkProgress();\n\t}\n\t\n\t/** @method */\n\tprogressHide() {\n\t\tthis.progressWrapperEl.classList.remove('progress-striped');\n\t\tthis.progressEl.classList.remove('active');\n\t\tthis.progressEl.classList.add('disable-transition');\n\t\tthis.progressBarEl.classList.remove('active');\n\t\tthis.progressAmt = this.progressBarEl.style.width = 0;\n\t}\n\t\n\t/** @method */\n\tprogressComplete() {\n\t\tthis.progressAmt = 100;\n\t\tthis.progressActive = this.progressStalled = false;\n\t}\n\t\n\t/** @method */\n\tprogressIndeterminate() {\n\t\tthis.progressWrapperEl.classList.add('progress-striped');\n\t\tthis.progressBarEl.classList.add('active');\n\t}\n\n\t/**\n\t * @method\n\t * @param {function} cb Callback\n\t */\n\tremoveSplash(cb) {\n\t\tconst $splashEl = $(this.splashEl);\n\n\t\t$splashEl.fadeOut('slow', function() {\n\t\t\t$splashEl.remove();\n\t\t\t_.isFunction(cb) && cb();\n\t\t});\n\t}\n\n\t/**\n\t * @method\n\t * @param {module:core/lib/netx-model|module:core/lib/netx-collection} thing Collection or model\n\t * @param {string} namespace Namespace\n\t * @param {string} fn RPC method name\n\t */\n\trestLoading(thing, namespace, fn) {\n\t\tconst key = ['rest', namespace, fn].join(':');\n\n\t\tloadingQueue[key] = true;\n\n\t\tconst message = thing.getRestLoadingMessage(fn);\n\t\tif (message) {\n\t\t\tmessageQueue[key] = _.isFunction(message) ? message.call(thing) : message;\n\t\t\tthis.checkMessage();\n\t\t}\n\n\t\tthis.checkProgress();\n\t}\n\n\t/**\n\t * @method\n\t * @param {module:core/lib/netx-model|module:core/lib/netx-collection} thing Collection or model\n\t * @param {string} namespace Namespace\n\t * @param {string} fn RPC method name\n\t */\n\trestLoaded(thing, namespace, fn) {\n\t\tconst key = ['rest', namespace, fn].join(':');\n\n\t\tconst message = thing.getRestLoadedMessage(fn);\n\t\tif (message) {\n\t\t\tmessageQueue[key] = _.isFunction(message) ? message.call(thing) : message;\n\t\t\tthis.checkMessage();\n\t\t\tsetTimeout(() => {\n\t\t\t\tdelete messageQueue[key];\n\t\t\t\tthis.checkMessage();\n\t\t\t}, 500);\n\t\t} else {\n\t\t\tdelete messageQueue[key];\n\t\t\tthis.checkMessage();\n\t\t}\n\n\t\tdelete loadingQueue[key];\n\t\tthis.checkProgress();\n\t}\n}\n\nexport default Loading;","/**\n * @class\n * @override\n */\nimport Base from '@netx/core/lib/netx-loading';\n\nimport {MDCLinearProgress} from '@material/linear-progress';\n\nfunction round(value, decimals) {\n\treturn Number(Math.round(value + 'e' + decimals) + 'e-' + decimals);\n}\n\nclass Loading extends Base {\n\t/** @override */\n\tconstructor() {\n\t\tsuper();\n\n\t\tthis.mdcProgress = new MDCLinearProgress(\n\t\t\tthis.el.querySelector('.mdc-linear-progress'),\n\t\t);\n\t}\n\n\t// scaleX is jumpy and i do not know why yet\n\t// /** @override */\n\t// drawProgress() {\n\t// \tif (this.progressStalled) return;\n\t//\n\t// \tconst oldProgress = round(this.progressAmt / 100, 2);\n\t//\n\t// \tthis.progressAmt += Math.min((100 - this.progressAmt) * 0.02, 100);\n\t//\n\t// \tlet newProgress = round(this.progressAmt / 100, 2);\n\t//\n\t// \tif (newProgress > oldProgress) {\n\t// \t\tthis.mdcProgress.progress = newProgress;\n\t// \t}\n\t//\n\t// \tif (!this.progressActive) return;\n\t//\n\t// \tthis.mdcProgress.foundation_.open();\n\t//\n\t// \tif (this.progressAmt >= 96 && !this.progressStalled) {\n\t// \t\tthis.progressStalled = true;\n\t// \t\tthis.hangingProgressTimeout = setTimeout(() => {\n\t// \t\t\tif (!this.progressStalled) return;\n\t// \t\t\tthis.progressIndeterminate();\n\t// \t\t}, 2000);\n\t// \t}\n\t// }\n\t//\n\t// /** @override */\n\t// progressHide() {\n\t// \tthis.progressEl.classList.add('disable-transition');\n\t// \tthis.progressBarEl.classList.remove('active');\n\t// \tthis.mdcProgress.foundation_.close();\n\t// \tthis.progressAmt = this.mdcProgress.progress = 0;\n\t// }\n\n\t/** @override */\n\tprogressComplete() {\n\t\tsuper.progressComplete();\n\t\t// this.progressAmt = 100;\n\t\t// this.mdcProgress.progress = 1;\n\t\tthis.mdcProgress.foundation_.setDeterminate(true);\n\t}\n\n\t/** @override */\n\tprogressIndeterminate() {\n\t\tthis.mdcProgress.foundation_.setDeterminate(false);\n\t}\n}\n\nexport default Loading;\n","/**\n * Netx.Routers.App is the class of our sole router instance, Netx.router\n * @class\n * @param {object} opts Options\n * @extends Backbone.ES6Router\n * @todo: This is an interesting idea\n * http://stackoverflow.com/questions/25806608/how-to-detect-browser-back-button-event-cross-browser\n */\n\nimport Backbone from 'backbone';\nimport Netx from '@netx/core/bootstrap';\n\n// base64 search routes, good times! ¯\\_(ツ)_/¯\n// we need to unescape and then re-escape since things get escaped automagically\n// by either the browser, backbone, or the two\n// note: need to trim and re-add the base route as that will get mangled in an escape\nconst BASE64_ROUTES_BASES = ['search/attribute/history/', 'search/advanced/'];\nconst routeIsBase64 = (route) =>\n\tBASE64_ROUTES_BASES.find((base) => route.includes(base));\nconst correctBase64RouteIfNeeded = (route) => {\n\tconst base = routeIsBase64(route);\n\tif (!base) return route;\n\treturn base + _.escapeURI(_.unescapeURI(route.replace(base, '')));\n};\n\n/**\n * Only the most recent interceptor will be used. The reason for allowing the setting this\n * way is to try and prevent one view creating while another is removing, and the removing one\n * removed its interceptor\n */\nconst routeInterceptors = new Map();\n\n/*****************\n * NetX extensions to Backbone.History:\n *\n * Certain parts of X7 need to know whether they're being executed in the context\n * of a route change. Backbone.History.isRouting() returns the boolean value of a flag\n * that is set when Backbone.History.loadUrl() begins, and cleared when it ends.\n *\n */\nconst History = Backbone.History;\nHistory.prototype.loadUrl = _.wrap(\n\tHistory.prototype.loadUrl,\n\tfunction (loadUrl) {\n\t\tthis._isRouting = true;\n\t\tvar args = _.rest(arguments);\n\t\tvar ret = loadUrl.apply(this, args);\n\t\tdelete this._isRouting;\n\t\treturn ret;\n\t},\n);\n\nHistory.prototype.isRouting = function () {\n\treturn this._isRouting || false;\n};\n\nconst Router = Backbone.Router;\nclass ES6Router {\n\t/** @override */\n\tconstructor(opts) {\n\t\tRouter.apply(this, arguments);\n\t}\n}\n_.extend(ES6Router.prototype, Router.prototype);\nBackbone.ES6Router = ES6Router;\n\nclass AppRouter extends ES6Router {\n\t/** @override */\n\tconstructor(opts = {}) {\n\t\tsuper(opts);\n\n\t\t/** @type {array} */\n\t\tthis.history = [];\n\n\t\t// If Netx.custom.router.SIZE exists, override this.size default\n\t\tconst customSize =\n\t\t\tNetx.custom && Netx.custom.router && Netx.custom.router.SIZE;\n\t\t/**\n\t\t * Size can be configured by setting Netx.custom.router.SIZE in config.js\n\t\t * @type {number}\n\t\t * @default\n\t\t */\n\t\tthis.size = opts.size || customSize || 50;\n\n\t\tthis.listenTo(this, 'route', this.routeChanged);\n\t\t// listen for route paging from pager.js\n\t\tthis.listenTo(dispatcher, 'router:page', (page, routeContext) => {\n\t\t\tlet {hash} = window.location;\n\t\t\t// We need to escape things like `'` (%27) and ` ` (%20)\n\t\t\t// Our `routeContext` encodes, but only some things are encoded in the route by backbone, like spaces,\n\t\t\t// where things like apostrophes are not encoded by backbone ¯\\_(ツ)_/¯\n\t\t\tif (!_.unescapeURI(hash).includes(_.unescapeURI(routeContext))) return;\n\n\t\t\tif (!routeIsBase64(routeContext)) {\n\t\t\t\t// We have to handle this a bit specially - see the wonderful search controller\n\t\t\t\thash = hash.replace(/ /g, '%20');\n\t\t\t}\n\n\t\t\t// see notes about function\n\t\t\trouteContext = correctBase64RouteIfNeeded(routeContext);\n\n\t\t\tlet pageRoute = `/page/${page}`;\n\n\t\t\t// Do not specify a page in the hash if one was not specified already\n\t\t\t// (can end up in a loop if you use the browser's back button)\n\t\t\tif (page === 1 && !/page\\/\\d/.test(hash)) {\n\t\t\t\tpageRoute = '';\n\t\t\t}\n\n\t\t\tthis.navigate(`${routeContext}${pageRoute}`, true);\n\t\t});\n\n\t\t// USE RESPONSIBLY\n\t\t// Currently, \"routed\" only gets dispatched when {trigger:false} is not set.\n\t\t// This code is for skins, etc that have pieces that would like to know when the route changes\n\t\t// whether or not it was silenced.\n\t\t// A good example:\n\t\t// When you run a search and then navigate into an asset detail view- when done you close the detail\n\t\t// view and return to your search results... Rather than running the search over again we put the\n\t\t// search string back into the hash and silence the change.\n\t\t// @fires 'hash:changed' and provides newHash and oldHash (if you are into that sort of thing)\n\n\t\t// In IE originalEvent.newURL and originalEvent.oldURL are not a thing. We will fake it.\n\t\tif (_.isUndefined(this.oldHash)) {\n\t\t\tthis.oldHash = window.location.hash ? window.location.hash : '';\n\t\t}\n\t\t$(window).on('hashchange.router', (e) => {\n\t\t\tconst newHash = window.location.hash;\n\t\t\tdispatcher.trigger(\n\t\t\t\t'hash:changed',\n\t\t\t\tnewHash,\n\t\t\t\tthis.oldHash ? this.oldHash : '',\n\t\t\t);\n\t\t\tthis.oldHash = newHash;\n\t\t});\n\t}\n\n\t/**\n\t * Add route interceptor\n\t * Note: Only the most recent interceptor will be used. The reason for allowing the setting this\n\t * way is to try and prevent one view creating while another is removing, and the removing one\n\t * removed its interceptor\n\t * @param {string} key\n\t * @param {Function} func\n\t */\n\taddRouteInterceptor(key, func) {\n\t\trouteInterceptors.set(key, func);\n\t}\n\n\t/**\n\t * Remove route interceptor\n\t * @param {string} key\n\t * @param {Function} func\n\t */\n\tremoveRouteInterceptor(key) {\n\t\trouteInterceptors.delete(key);\n\t}\n\n\t/**\n\t * Rewind the route one step. Just like window.history.back(), except it also manages our\n\t * local history cache.\n\t *\n\t * WARNING: intersecting back() with push()/pop() can lead to unknown, probably-wrong behavior.\n\t * @param {object} opts Options\n\t */\n\tback(opts = {}) {\n\t\tif (this.history.length > 1) {\n\t\t\twindow.history.back();\n\t\t} else {\n\t\t\tthis.home(opts);\n\t\t}\n\t}\n\n\t/**\n\t * @param {string} page Page\n\t */\n\t// TODO: provide a proper 404 error here.\n\tdefaultRoute(page) {\n\t\tconsole.warn('The page you are trying to reach: %s, does not exist.', page);\n\t}\n\n\t/**\n\t * @method\n\t * @param {string} route Route event (or route if ananymous function was used)\n\t */\n\trouteChanged(route) {\n\t\t// TODO: This is a band-aid until we can get some finer\n\t\t// control over our routes (white listing etc)\n\t\tconst validUnauthenticatedRoutes = [\n\t\t\t'auth:user:login',\n\t\t\t'auth:user:register:approvalNeeded',\n\t\t\t'auth:user:register',\n\t\t\t'auth:user:password:reset',\n\t\t\t'auth:user:password:change',\n\t\t\t'auth:user:sessionKey',\n\t\t\t// share request bundle will handle invalid token messaging\n\t\t\t'share:request',\n\t\t];\n\t\tif (\n\t\t\tNetx.custom.REQUIRE_LOGIN &&\n\t\t\t!Netx.session.authenticated() &&\n\t\t\t!_.contains(validUnauthenticatedRoutes, route)\n\t\t) {\n\t\t\t// If empty route send them to the login page\n\t\t\tif (route === '') {\n\t\t\t\tdispatcher.trigger('auth:session:invalid');\n\t\t\t\treturn;\n\t\t\t}\n\t\t\treturn window.location.reload();\n\t\t}\n\n\t\t// console.log('The route has changed: %o', Backbone.history.fragment);\n\t\t// Maintains routing history. Keeps up to the value of 'this.size' in history.\n\t\t// Accessible from the history object where index 0 is the current route\n\t\tif (this.history.length >= this.size) {\n\t\t\tthis.history.pop();\n\t\t}\n\n\t\tconst oldRoute = this.history[0];\n\t\tif (Backbone.history.fragment != history[0]) {\n\t\t\tthis.history.unshift(Backbone.history.fragment);\n\t\t}\n\n\t\t// Triggers a decoupled 'routed' event that view instances can listen to\n\t\t// to perform custom tasks. Ex. Netx.views.assetDetailView listens to the\n\t\t// dispatcher for the 'routed' event and pauses the video player.\n\t\tdispatcher.trigger('routed', Backbone.history.fragment, oldRoute);\n\t}\n\n\t/**\n\t * Support promises\n\t * @override\n\t * @param {string} route Route\n\t * @param {string} name Route name\n\t * @param {function} callback Route collback\n\t */\n\troute(route, name, callback) {\n\t\tif (!_.isRegExp(route)) {\n\t\t\troute = this._routeToRegExp(route);\n\t\t}\n\t\tif (_.isFunction(name)) {\n\t\t\tcallback = name;\n\t\t\tname = '';\n\t\t}\n\t\tif (!callback) {\n\t\t\tcallback = this[name];\n\t\t}\n\n\t\tBackbone.history.route(route, (fragment) => {\n\t\t\tconst args = this._extractParameters(route, fragment);\n\n\t\t\tconst _route = () => {\n\t\t\t\t// Strip trailing lone slash `asset/3/` -> `asset/3`\n\t\t\t\tif (fragment.length - 1 === fragment.lastIndexOf('/')) {\n\t\t\t\t\tfragment = fragment.substr(0, fragment.length - 1);\n\t\t\t\t\twindow.location.hash = `#${fragment}`;\n\t\t\t\t}\n\n\t\t\t\tconst ret = this.execute(callback, args, name);\n\n\t\t\t\t// Execute route\n\t\t\t\tconst executeRoute = () => {\n\t\t\t\t\tthis.trigger.apply(this, [`route:${name}`].concat(args));\n\t\t\t\t\tthis.trigger('route', name, args);\n\t\t\t\t\tBackbone.history.trigger('route', this, name, args);\n\t\t\t\t};\n\n\t\t\t\tif (!_.isPromise(ret)) {\n\t\t\t\t\tret !== false && executeRoute();\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tret.then((execute) => {\n\t\t\t\t\texecute !== false && executeRoute();\n\t\t\t\t});\n\t\t\t};\n\n\t\t\tif (routeInterceptors.size) {\n\t\t\t\t// See note on `routeInterceptors`\n\t\t\t\trouteInterceptors.get(\n\t\t\t\t\tArray.from(routeInterceptors.keys())[routeInterceptors.size - 1],\n\t\t\t\t)(_route, fragment, name, args);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t_route();\n\t\t});\n\t\treturn this;\n\t}\n\n\t/*\n\t * reroute() is useful in a route handler that wants to trigger a route;\n\t * it uses replaceState() to delete the intermediate route from the history.\n\t * @param {string} frag The url component\n\t * @param {object} opts Options for .navigate();\n\t */\n\treroute(frag, opts) {\n\t\t// Replace the #upload in the browser history so that the back button won't re-forward:\n\t\t// Note the blank 'state object' because I haven't found the doc on what that should contain;\n\t\t// I think it's up to us, but i hope Backbone isn't using it ...\n\t\thistory.replaceState({}, '', `#${frag}`);\n\n\t\t// Tidy up our local .history\n\t\tthis.history[0] = frag;\n\n\t\t// This will trigger the route, even though our href is here already:\n\t\tthis.navigate(frag, opts);\n\t}\n\n\t/**\n\t * Add a set of new routes to the routes we already have.\n\t * @param {object} routes Routes\n\t */\n\taddRoutes(routes) {\n\t\t// apparently, routes must be added in reverse order to their position in the object.\n\t\t_.keys(routes)\n\t\t\t.reverse()\n\t\t\t.forEach((routePattern) =>\n\t\t\t\tthis.route(routePattern, routes[routePattern]),\n\t\t\t);\n\t}\n\n\t/**\n\t * inCategory() parses the current route to see if it's a category route\n\t * @return {number} a route ID, or undefined if not a category route.\n\t */\n\tinCategory() {\n\t\tif (Backbone.history.fragment.match(/category\\/(\\d+)/)) {\n\t\t\treturn parseInt(\n\t\t\t\tBackbone.history.fragment.match(/category\\/(\\d+)/)[1],\n\t\t\t\t10,\n\t\t\t);\n\t\t} else {\n\t\t\treturn undefined;\n\t\t}\n\t}\n\n\t/**\n\t * push() and pop() have had problems.\n\t * New strategy: find the most recent route that does *not* match a pattern, and go to that.\n\t * @param {string} pattern Pattern\n\t * @param {object} opts Options\n\t */\n\texitRoute(pattern, opts = {}) {\n\t\tconst targetRoute = _.find(this.history, (r) => {\n\t\t\t// Only use match if RegExp was passed\n\t\t\tif (pattern instanceof RegExp) {\n\t\t\t\t// Find the first route that doesn't match this pattern\n\t\t\t\treturn !r.match(pattern);\n\t\t\t}\n\t\t\t// Otheriwse we do an exact comparison\n\t\t\treturn r !== pattern;\n\t\t});\n\n\t\tconst {force, ...sendOpts} = opts;\n\t\t// If there is no available history, or it happens to be the last route\n\t\t// use this.back(), it will fall back on home()\n\t\tif (!targetRoute || (!force && targetRoute === this.history[1])) {\n\t\t\tif (force && !targetRoute && this.history.length) return this.home();\n\t\t\treturn this.back({trigger: true});\n\t\t}\n\n\t\tthis.navigate(targetRoute || '', {trigger: true, ...sendOpts});\n\t}\n\n\t/**\n\t * Route to the HOME_ROUTE, or the null route if HOME_ROUTE is not defined.\n\t * If no options provided, we set {trigger: true} to actually fire the route handler -- which is what we usually want.\n\t * @param {object} opts Options\n\t */\n\thome(opts = {}) {\n\t\topts.trigger = opts.trigger !== false;\n\t\tthis.navigate(Netx.custom.HOME_ROUTE || '#', opts);\n\t}\n}\n\nexport default AppRouter;\n","/**\n * Netx core\n * @module core\n */\nimport config from './config';\nimport Loading from './lib/netx-loading';\nimport Router from './lib/netx-routers-app';\n\nimport Netx from './bootstrap';\n\nexport default {\n\tnamespace: 'netx',\n\tinitialize() {\n\t\t// We expect these to be set\n\t\tObject.assign(Netx.custom, config);\n\n\t\t// Routers\n\t\tNetx.Routers = {\n\t\t\tApp: Router,\n\t\t};\n\n\t\t// Loading screen\n\t\tNetx.Loading = new Loading();\n\n\t\t// Instantiate the global router & start history\n\t\tNetx.router = new Router(Netx.router);\n\n\t\t// Start history\n\t\tBackbone.history.start({silent: true});\n\n\t\t// \"bunldes\" that do not depend on the full \"core-app\"\n\t\tif (\n\t\t\twindow.location.hash.match(\n\t\t\t\t/share\\/request\\/((?!review|approve|reject).)*$/,\n\t\t\t)\n\t\t) {\n\t\t\treturn new Promise((resolve, reject) => {\n\t\t\t\timport(\n\t\t\t\t\t/* webpackChunkName: \"core-share-request\" */ '@netx/core-share-request'\n\t\t\t\t).then((ShareRequest) => {\n\t\t\t\t\tdispatcher.trigger('netx:load:module', ShareRequest.default, {\n\t\t\t\t\t\tloadUrl: true,\n\t\t\t\t\t\terror: reject,\n\t\t\t\t\t\tinitialized: resolve,\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\t\t}\n\n\t\treturn new Promise((resolve, reject) => {\n\t\t\t// Bring in custom controller\n\t\t\timport(\n\t\t\t\t/* webpackChunkName: \"core-module-dependencies\" */ '@netx/core/controller'\n\t\t\t);\n\t\t\timport(\n\t\t\t\t/* webpackChunkName: \"core-module-dependencies\" */ '@netx/core-app'\n\t\t\t).then((App) => {\n\t\t\t\t// Initialize app\n\t\t\t\tdispatcher.trigger('netx:load:module', App.default, {\n\t\t\t\t\terror: reject,\n\t\t\t\t\tinitialized: resolve,\n\t\t\t\t});\n\t\t\t});\n\t\t});\n\t},\n};\n"],"sourceRoot":""}