text: "use strict";var _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},IgnitionError=function(e){this.name="IgnitionError",this.message=e},generateTypeValidation=function(e){return function(t,n){var i="undefined"==typeof t?"undefined":_typeof(t),r=!1,s=!1,o=!0;if("object"!==i||(r=null===t)||(s="[object Array]"===Object.prototype.toString.call(t)),"array"===e?o=s:"object"===e&&(s||r)?o=!1:i!==e&&(o=!1),!o&&n)throw new IgnitionError("Expected `"+e+"` and instead received `"+i+"`");return o}},isRegistered=function(e,t,n){var i;if(n=isArray(n)?n:[],isArray(e,!0),e=e.concat(n),isString(t))return e.indexOf(t)>=0;if(isFunction(t)){i=/ +?/g,t=t.toString().replace(i,"");for(var r=0;r<e.length;r++)if(isFunction(e[r])&&e[r].toString().replace(i,"")===t)return!0}return!1},generateRegistration=function(e,t){return function(n){if(!t(n))throw new IgnitionError("Invalid subject");isRegistered(e,n)||e.push(n)}},registerMulti=function(e,t){isArray(t,!0);for(var n=0;n<t.length;n++)e(t[n])},execFunctionQueue=function(e){for(var t=0;t<e.length;t++)e[t].call(window)},buildBundlePath=function(e,t,n){return"/"!==t.substr(-1)&&(t+="/"),t+e+"."+n},Ignition=function(e){function t(e){return function(){return Array.prototype.slice.call(this[e],0)}}function n(e){d._registerMulti(this.registerSrc,e)}function i(e){d._registerMulti(this.registerFn,e)}function r(e){if(isString(e)){var t=s(e),n=t.parsedSubject,i=t.isOptional;this.registerSrc(d.namedSrcs[n],i)}else{if(!isArray(e))throw new IgnitionError("Invalid subject");for(var r=0;r<e.length;r++){var o=s(e[r]),a=o.parsedSubject,u=o.isOptional;this.registerSrc(d.namedSrcs[a],u)}}}function s(e){var t=e.indexOf("?")===e.length-1?e.slice(0,e.length-1):e;return{parsedSubject:t,isOptional:e!==t}}function o(){for(var e=[],t=0;t<d.tierCount;t++)e=e.concat(d.tiers[t].srcs);return e}function a(e){return function(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!d.tiers[e].validation(t))throw new IgnitionError("Invalid subject");isRegistered(d.tiers[e].srcs,t,o())||(n?d.tiers[e].optionalSrcs.push(t):d.tiers[e].srcs.push(t))}}var u,l,d=this,g={bundles:{validation:function(e){return isString(e)&&/^[A-Za-z]+\w*$/.test(e)},dir:"/app/bundles/",loadCss:!1},bootstrap:function(e){angular.bootstrap(document,e)}};e=function b(e){for(var t,n=1;n<arguments.length;++n)if(t=arguments[n],isObject(t))for(var i in t)t.hasOwnProperty(i)&&(e[i]=isObject(t[i])?b({},e[i],t[i]):t[i]);return e}({},g,e),d.namedSrcs=isObject(e.sources)?e.sources:{},d.bundles={},d.bundles.names=[],d.bundles.getNames=t("names"),d.bundles.modules=isObject(e.bundles.modules)?e.bundles.modules:{},d.bundleModules={},d.bundleModules.names=[],d.bundleModules.getNames=t("names"),d.bundles.validation=e.bundles.validation,isFunction(d.bundles.validation,!0),d.bundles.dir=e.bundles.dir,isString(d.bundles.dir,!0),d.bundles.loadCss=e.bundles.loadCss,isBoolean(d.bundles.loadCss,!0),d.bundles.registerOne=generateRegistration(d.bundles.names,d.bundles.validation),d.bundles.registerMany=function(e){d._registerMulti(this.registerOne,e)},d.bundles.register=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:d.bundles.modules[e]||[e];isString(e,!0),d.bundles.registerOne(e),d.bundleModules.registerMany(t)},d.bundles.getSrcs=function(e){for(var t=this.getNames(),n=[],i="css"===e,r=i?"css":"js",s=0;s<t.length;s++)n.push(d._buildBundlePath(t[s],this.dir,r));return n},d.bundleModules.registerOne=generateRegistration(d.bundleModules.names,function(){return!0}),d.bundleModules.registerMany=function(e){d._registerMulti(this.registerOne,e)},d.bootstrap=e.bootstrap,isFunction(d.bootstrap,!0),d.tiers=[],isArray(e.tiers)?(d.tierCount=e.tiers.length,e.tiers=e.tiers):(d.tierCount=2,e.tiers=[]);for(var c=0;c<d.tierCount;c++){d.tiers[c]={},u=e.tiers[c]&&isArray(e.tiers[c].aliases),d.tiers[c].aliases=l=u?e.tiers[c].aliases:[];for(var f=0;f<l.length;f++){if(!isUndefined(d[l[f]]))throw new IgnitionError("Illegal alias name");d[l[f]]=d.tiers[c]}d.tiers[c].validation=e.tiers[c]&&isFunction(e.tiers[c].validation)?e.tiers[c].validation:isString,d.tiers[c].fns=[],d.tiers[c].srcs=[],d.tiers[c].optionalSrcs=[],d.tiers[c].getSrcs=t("srcs"),d.tiers[c].getOptionalSrcs=t("optionalSrcs"),d.tiers[c].getFns=t("fns"),d.tiers[c].registerSrc=a(c),d.tiers[c].registerFn=generateRegistration(d.tiers[c].fns,isFunction),d.tiers[c].registerSrcs=n,d.tiers[c].registerFns=i,d.tiers[c].register=r}d.ready={fns:[]},d.ready.getFns=t("fns"),d.ready.registerFn=generateRegistration(d.ready.fns,isFunction),d.ready.registerFns=function(e){d._registerMulti(this.registerFn,e)}},isString=void 0,isFunction=void 0,isObject=void 0,isArray=void 0,isUndefined=void 0,isBoolean=void 0;IgnitionError.prototype=Error.prototype,isString=generateTypeValidation("string"),isFunction=generateTypeValidation("function"),isObject=generateTypeValidation("object"),isArray=generateTypeValidation("array"),isUndefined=generateTypeValidation("undefined"),isBoolean=generateTypeValidation("boolean"),Ignition.fn=Ignition.prototype,Ignition.fn._isString=isString,Ignition.fn._isFunction=isFunction,Ignition.fn._isObject=isObject,Ignition.fn._isArray=isArray,Ignition.fn._isRegistered=isRegistered,Ignition.fn._generateRegistration=generateRegistration,Ignition.fn._registerMulti=registerMulti,Ignition.fn._execFunctionQueue=execFunctionQueue,Ignition.fn._buildBundlePath=buildBundlePath,Ignition.fn._loadTier=function(e,t){var n=this;return t.optionalScript(n.tiers[e].getOptionalSrcs()).script(n.tiers[e].getSrcs()).wait(function(){n._execFunctionQueue(n.tiers[e].getFns())})},Ignition.fn._injectCss=function(e){var t,n,i=document.getElementsByTagName("head")[0];t=i.getElementsByTagName("link");for(var r=0;r<t.length;r++)if(t[r].getAttribute("href")===e)return;n=document.createElement("link"),n.setAttribute("rel","stylesheet"),n.setAttribute("type","text/css"),n.setAttribute("href",e),i.appendChild(n)},Ignition.fn.load=function(){var e,t=this;if(!$LAB)throw new IgnitionError("$LAB not found.");e=$LAB;for(var n=0;n<t.tierCount;n++)e=t._loadTier(n,e);if(t.bundles.loadCss)for(var i=0,r=t.bundles.getSrcs("css");i<r.length;i++)t._injectCss(r[i]);e.script(t.bundles.getSrcs()).wait(function(){t.bootstrap(t.bundleModules.getNames()),t._execFunctionQueue(t.ready.getFns())})},window.Ignition=Ignition;
  //# sourceMappingURL=ignition.min.js.map
  