-
Notifications
You must be signed in to change notification settings - Fork 0
/
sirius-core.min.js
55 lines (55 loc) · 21.6 KB
/
sirius-core.min.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
/*
Sirius.js v1.3.3
(c) 2014-2020 fntz
license: MIT
*/
var $jscomp=$jscomp||{};$jscomp.scope={};$jscomp.arrayIteratorImpl=function(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}};$jscomp.arrayIterator=function(a){return{next:$jscomp.arrayIteratorImpl(a)}};$jscomp.makeIterator=function(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):$jscomp.arrayIterator(a)};$jscomp.arrayFromIterator=function(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c};
$jscomp.arrayFromIterable=function(a){return a instanceof Array?a:$jscomp.arrayFromIterator($jscomp.makeIterator(a))};$jscomp.ASSUME_ES5=!1;$jscomp.ASSUME_NO_NATIVE_MAP=!1;$jscomp.ASSUME_NO_NATIVE_SET=!1;$jscomp.SIMPLE_FROUND_POLYFILL=!1;$jscomp.objectCreate=$jscomp.ASSUME_ES5||"function"==typeof Object.create?Object.create:function(a){var b=function(){};b.prototype=a;return new b};$jscomp.underscoreProtoCanBeSet=function(){var a={a:!0},b={};try{return b.__proto__=a,b.a}catch(c){}return!1};
$jscomp.setPrototypeOf="function"==typeof Object.setPrototypeOf?Object.setPrototypeOf:$jscomp.underscoreProtoCanBeSet()?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null;
$jscomp.inherits=function(a,b){a.prototype=$jscomp.objectCreate(b.prototype);a.prototype.constructor=a;if($jscomp.setPrototypeOf){var c=$jscomp.setPrototypeOf;c(a,b)}else for(c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.superClass_=b.prototype};var Adapter,Sirius,VanillaJsAdapter;Sirius={VERSION:"1.0.3"};
Adapter=function(){var a=function(){};a.prototype.bind=function(a,c,d,e){};a.prototype.off=function(a,c,d){};a.prototype.fire=function(a,c,d){};a.prototype.get_properties=function(a,c){};a.prototype.get_attr=function(a,c){};a.prototype.swap=function(a,c){};a.prototype.append=function(a,c){};a.prototype.prepend=function(a,c){};a.prototype.clear=function(a){};a.prototype.set_attr=function(a,c,d){};a.prototype.all=function(a){return"object"===typeof a&&1===a.nodeType||9===a.nodeType?a:document.querySelectorAll(a)};
a.prototype.get=function(a){return document.querySelector(a)};a.prototype.as_string=function(a){if(a===document)return"document";if("[object String]"===Object.prototype.toString.call(a))return a;try{if(Array.isArray(a)&&1<a.size){var b=a.map(function(a){return a.tagName+"."+a.className});return b.slice(0,3).join(", ")}return a.tagName+"."+id}catch(d){return a}};a.prototype._adapter_name="Adapter";return a}.call(this);
VanillaJsAdapter=function(){var a=function(){return Adapter.apply(this,arguments)||this};$jscomp.inherits(a,Adapter);a.prototype._get_element_from_selector=function(a){if("object"===typeof a&&1===a.nodeType)return a;var b=this.all(a);if(0===b.length)throw Error("Selector `"+a+"` not found");return b[0]};a.prototype.bind=function(a,c,d,e){var b,g;if(null===c||c===a)a.addEventListener(d,e);else if("object"===typeof c&&1===c.nodeType)c.addEventListener(d,e);else for(a=this.all(c),c=b=0,g=a.length;0<=
g?0<=b&&b<g:0>=b&&b>g;c=0<=g?++b:--b)a.item(c).addEventListener(d,e)};a.prototype.off=function(a,c,d){var b,f;a=this.all(a);var g=b=0;for(f=a.length;0<=f?0<=b&&b<f:0>=b&&b>f;g=0<=f?++b:--b)a.item(g).removeEventListener(c,d)};a.prototype.fire=function(a,c,d){for(var b=[],f=2;f<arguments.length;++f)b[f-2]=arguments[f];f=document.createEvent("CustomEvent");f.initCustomEvent(c,!1,!0,b);document.dispatchEvent(f)};a.prototype.get_properties=function(a,c){var b;a=a.target;var e=[];var f=0;for(b=c.length;f<
b;f++){var g=c[f];e.push(this.get_attr(a,g))}return e};a.prototype.get_attr=function(a,c){a=this._get_element_from_selector(a);var b=a.getAttribute(c);return null!=b?"checked"===c||"selected"===c?"false"===b?!1:!0:b:a[c]};a.prototype.swap=function(a,c){a=this._get_element_from_selector(a);var b=a.tagName;"INPUT"===b||"TEXTAREA"===b||"SELECT"===b?a.value=c:a.textContent=c};a.prototype.set_attr=function(a,c,d){this._get_element_from_selector(a).setAttribute(c,d)};a.prototype.append=function(a,c){a=
this._get_element_from_selector(a);a.textContent+=c};a.prototype.prepend=function(a,c){a=this._get_element_from_selector(a);a.textContent=c+a.textContent};a.prototype.clear=function(a){a=this._get_element_from_selector(a);var c=a.tagName;"INPUT"===c||"TEXTAREA"===c?a.value="":a.textContent=""};a.prototype.text=function(a){a=this._get_element_from_selector(a);var c=a.tagName;return"INPUT"===c||"TEXTAREA"===c||"SELECT"===c?a.value:a.innerText?a.innerText:a.textContent};a.prototype._adapter_name="VanillaJs";
return a}.call(this);
Sirius.Logger=function(){var a=function(a){var c=this;this.log_source=a;this._log_queue=[];if(!Sirius.Logger.Configuration._is_initialized){var b=setInterval(function(){return f()},100);var f=function(){var a;if(Sirius.Logger.Configuration._is_initialized){var d=c._log_queue;var f=0;for(a=d.length;f<a;f++){var e=d[f];c._write(e.level,e.message)}return clearInterval(b)}}}};a.build=function(a){return new Sirius.Logger(a)};a.prototype.debug=function(a){return this._write(Sirius.Logger.Debug,a)};a.prototype.info=
function(a){return this._write(Sirius.Logger.Info,a)};a.prototype.warn=function(a){return this._write(Sirius.Logger.Warn,a)};a.prototype.error=function(a){return this._write(Sirius.Logger.Error,a)};a.prototype._write=function(a,b){if(Sirius.Logger.Configuration._is_initialized){if(a.gte(Sirius.Logger.Configuration.minimum_log_level))return Sirius.Logger.Configuration.log_function(a.get_value().toUpperCase(),this.log_source,b)}else return this._log_queue.push[{level:a,message:b}]};a.prototype.log_source=
null;var b=function(a,b){this.value=a;this.weight=b};b.prototype.gte=function(a){return this.weight>=a.weight};b.prototype.get_value=function(){return this.value};a.Debug=new b("debug",10);a.Info=new b("info",20);a.Warn=new b("warn",30);a.Error=new b("error",40);a.NoLog=new b("no-log",100);a.Levels=[a.Debug,a.Info,a.Warn,a.Error];a.Default={enable_logging:!1,minimum_log_level:a.Debug.get_value(),default_log_function:function(a,b,e){return console&&console.log?console.log(a+" ["+b+"]: "+e):alert("Not supported `console`. You should define own `logger` function for a Sirius.Application")}};
a.Configuration={minimum_log_level:null,log_function:null,enable_logging:null,_is_initialized:!1,configure:function(b){b=void 0===b?{}:b;var c;var e=b.enable_logging||a.Default.enable_logging;if((c=b.minimum_log_level)&&!this.is_valid_level(c))throw b=a.Levels.map(function(a){return a.get_value()}),Error("Invalid 'minimum_log_level' value: '"+c+"', available options are: "+b.join(", "));c=c||a.Default.minimum_log_level;this.minimum_log_level=e?this._get_logger_from_input(c):a.NoLog;this.enable_logging=
e;if(b.log_to){if(!Sirius.Utils.is_function(b.log_to))throw Error("'log_to' argument must be a function");b=b.log_to}else b=a.Default.default_log_function;this.log_function=b;return this._is_initialized=!0},is_valid_level:function(b){return 0!==a.Levels.filter(function(a){return a.get_value()===b}).length},_get_logger_from_input:function(b){var c;return null!=b&&Sirius.Utils.is_string(b)?(c=a.Levels.filter(function(a){return a.get_value()===b.toLowerCase()}))&&0===c.length?a.Debug:c[0]:a.Debug}};
return a}.call(this);Sirius.Internal={DefaultProperty:"text",Errors:"errors"};var lib$sirius_core$classdecl$var1=function(a){this.value=a;this.fn=function(){}};lib$sirius_core$classdecl$var1.prototype.and_then=function(a){return null!=this.value?a(this.value):this.fn=a};lib$sirius_core$classdecl$var1.prototype.set_value=function(a){this.value=a;return this.fn(a)};Sirius.Promise=lib$sirius_core$classdecl$var1;var lib$sirius_core$classdecl$var2=function(){};
lib$sirius_core$classdecl$var2.is_function=function(a){return"[object Function]"===Object.prototype.toString.call(a)};lib$sirius_core$classdecl$var2.is_string=function(a){return"[object String]"===Object.prototype.toString.call(a)};lib$sirius_core$classdecl$var2.is_array=function(a){return"[object Array]"===Object.prototype.toString.call(a)};lib$sirius_core$classdecl$var2.is_object=function(a){return null!==a&&"object"===typeof a};
lib$sirius_core$classdecl$var2.camelize=function(a){return a.charAt(0).toUpperCase()+a.slice(1)};lib$sirius_core$classdecl$var2.underscore=function(a){return a.replace(/([A-Z])/g,"_$1").replace(/^_/,"").toLowerCase()};lib$sirius_core$classdecl$var2.ie_version=function(){var a=window.navigator.userAgent;var b=a.indexOf("MSIE ");var c=a.indexOf("Trident/");return 0<b?parseInt(a.substring(b+5,a.indexOf(".",b)),10):0<c?(b=a.indexOf("rv:"),parseInt(a.substring(b+3,a.indexOf(".",b)),10)):0};
lib$sirius_core$classdecl$var2.guid=function(){var a=function(){return Math.floor(65536*(1+Math.random())).toString(16).substring(1)};return""+a()+a()+"-"+a()+"-"+a()+"-"+a()+"-"+a()+a()+a()};lib$sirius_core$classdecl$var2.is_ie9=function(){return 9===this.ie_version()};lib$sirius_core$classdecl$var2.fn_name=function(a){if(this.is_function(a))return a.toString().match(/function ([^\(]+)/)[1];throw Error("Need function, given "+typeof a);};Sirius.Utils=lib$sirius_core$classdecl$var2;
var lib$sirius_core$classdecl$var3=function(a){this.setup=a};lib$sirius_core$classdecl$var3.prototype.hash=function(){return window.location.hash};lib$sirius_core$classdecl$var3.prototype.current=function(){return window.location.hash};lib$sirius_core$classdecl$var3.prototype.origin=function(){return window.location.origin};lib$sirius_core$classdecl$var3.prototype.pathname=function(){var a=window.location.pathname;""===a&&(a="/");return a};
lib$sirius_core$classdecl$var3.prototype.write=function(a,b,c){return this.setup.has_push_state_support?history.pushState(a,b,c):history.replaceState(a,b,c)};Sirius.Internal.HistoryJournal=lib$sirius_core$classdecl$var3;
Sirius.redirect=function(a){var b=Sirius.Application;b.get_logger("Redirect").info("Redirect to "+a);b.use_hash_routing_for_old_browsers&&!b.push_state_support&&(a=0===a.indexOf("#")?a:0===a.indexOf("/")?"#"+a:"#/"+a);if(0===a.indexOf("#")){if(b.push_state_support)return location.replace(a)}else if(b.push_state_support)return Sirius.Internal.RouteSystem.dispatch.call(null,{type:"redirect",target:{href:a}})};var lib$sirius_core$classdecl$var4=function(a,b){this.is_matched=a;this.args=b};
lib$sirius_core$classdecl$var4.prototype.with_args=function(a){this.args=a;return this};lib$sirius_core$classdecl$var4.prototype.get_args=function(){return this.args||[]};lib$sirius_core$classdecl$var4.prototype.is_success=function(){return this.is_matched};lib$sirius_core$classdecl$var4.prototype.success=function(){this.is_matched=!0;return this};lib$sirius_core$classdecl$var4.prototype.fail=function(){this.is_matched=!1;return this};Sirius.Internal.RouteMatchResult=lib$sirius_core$classdecl$var4;
var lib$sirius_core$classdecl$var5=function(a){this.original=a;this.is_end=!0;this.start=null;this.parts=[];a=a.replace(/\/$/,"").split("/");""===a[0]&&(a[0]="#");"*"===a[a.length-1]&&(this.is_end=!1);this.parts=a.slice(0);this.logger=Sirius.Application.get_logger("Sirius.Internal.RoutePart#"+this.original)};lib$sirius_core$classdecl$var5._is_named_part=function(a){return 0===a.indexOf(":")};lib$sirius_core$classdecl$var5._is_regexp_part=function(a){return 0===a.indexOf("[")};
lib$sirius_core$classdecl$var5._is_end_part=function(a){return 0===a.indexOf("*")};
lib$sirius_core$classdecl$var5.prototype.match=function(a){this.logger.debug("try to match: '"+a+"'");var b=new Sirius.Internal.RouteMatchResult(!1,[]);var c=a.replace(/\/$/,"").split("/");""===c[0]&&(c[0]="#");if(this.is_end&&c.length!==this.parts.length||1<this.parts.length&&c.length<this.parts.length)return b.fail();var d=-1;for(a=[];10>d;){d++;var e=$jscomp.makeIterator([this.parts[d],c[d]]);var f=e.next().value;e=e.next().value;if(!f||!e)break;if(Sirius.Internal.RoutePart._is_named_part(f))a.push(c[d]);
else if(Sirius.Internal.RoutePart._is_regexp_part(f)){f=new RegExp("^"+f+"$");if(!f.test(e))return b.fail();a.push(f.exec(e)[0])}else{if(Sirius.Internal.RoutePart._is_end_part(f)){a=a.concat(c.slice(d));break}if(f!==e)return b.fail()}}return b.with_args(a).success()};Sirius.Internal.RoutePart=lib$sirius_core$classdecl$var5;
var lib$sirius_core$classdecl$var6=function(a,b){b=void 0===b?function(a){return a}:b;this.logger=Sirius.Application.get_logger(this.constructor.name);var c;if(!(c=a.controller))throw Error("Params must contain a Controller definition");var d=a.action;if(Sirius.Utils.is_string(d))var e=c[d];else if(Sirius.Utils.is_function(d))e=d;else throw b="Action must be a string or a function",this.logger.error(b),Error(b);if(!e)throw b="The action '"+d+"' was not found in the controller",this.logger.error("ControlFlow: "+
b),Error(b);this.action=b(e);b=function(b,e){e=void 0===e?!1:e;var f=a[b];var g=c[b+"_"+d];var l=function(a){return Error("The "+a+" method must be a string or a function")};if(Sirius.Utils.is_string(f)){e=c[f];if(!Sirius.Utils.is_function(e))throw l(Sirius.Utils.camelize(b));return e}if(Sirius.Utils.is_function(f))return f;if(f)throw l(Sirius.Utils.camelize(b));if(g){if(!Sirius.Utils.is_function(g))throw l(Sirius.Utils.camelize(b));return g}return e?null:function(){}};this.before=b("before");this.after=
b("after");this.guard=b("guard",!0);this.data=a.data||[];this.controller=c};
lib$sirius_core$classdecl$var6.prototype.handle_event=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];this.logger.debug("Start event processing");return a?(d=Sirius.Utils.is_array(this.data)?this.data:[this.data],d=Sirius.Application.adapter.get_properties(a,d),d=[].concat([],[a],d),this._call_with([].concat.apply([],[[],d].concat($jscomp.arrayFromIterable(c))))):this._call_with([].concat.apply([],c))};
lib$sirius_core$classdecl$var6.prototype._call_with=function(a){if(this.guard){if(this.guard.apply(this.controller,a))return this.before.apply(this.controller),this.action.apply(this.controller,a),this.after.apply(this.controller)}else return this.before.apply(this.controller),this.action.apply(this.controller,a),this.after.apply(this.controller)};lib$sirius_core$classdecl$var6.prototype.tick=function(){this.logger.debug("tick");return this._call_with(null)};Sirius.Internal.ControlFlow=lib$sirius_core$classdecl$var6;
var lib$sirius_core$classdecl$var7=function(a){this.is_need_redirect_to_hash=a.old;this.has_push_state_support=a.support;this.is_ignore_not_matched_urls=a.ignore};lib$sirius_core$classdecl$var7.build=function(a){return new Sirius.Internal.RoutingSetup(a)};Sirius.Internal.RoutingSetup=lib$sirius_core$classdecl$var7;
Sirius.Internal.RouteSystem={_every:"every",_scheduler:"scheduler",_once:"once",_selector:"a:not([href^='#'])",_is_hash_route:function(a){return 0===a.toString().indexOf("#")},_is_404_route:function(a){return"404"===a.toString()},_is_plain_route:function(a){return 0===a.toString().indexOf("/")},_is_scheduler_command:function(a){return 0===a.lastIndexOf(this._scheduler)||0===a.lastIndexOf(this._once)||0===a.lastIndexOf(this._every)},_is_event_route:function(a){return!this._is_hash_route(a)&&!this._is_404_route(a)&&
!this._is_plain_route(a)&&!this._is_scheduler_command(a)},_get_time_unit:function(a,b){var c;if(c=b.match(/^(\d+)(ms|s|m)/))return a=parseInt(c[1],10),c=c[2]||"s","ms"===c?a:"s"===c?1E3*a:6E4*a;throw Error("Bad time unit: "+b+" in "+a+", available units: 'ms', 's', 'm'");},_get_scheduler_params:function(a){var b=a.split(" ");var c="Define time unit for scheduler, for example: 'every 10s', given: "+a;if(1===b.length)throw Error(c);if(2===b.length)return c=Sirius.Internal.RouteSystem._get_time_unit(a,
b[1]),{delay:null,time:c};if(3===b.length)return c=Sirius.Internal.RouteSystem._get_time_unit(a,b[1]),a=Sirius.Internal.RouteSystem._get_time_unit(a,b[2]),{delay:c,time:a};throw Error(c);},_scheduler_register:function(a,b,c){var d;var e=this._every;var f=this._scheduler;var g=this._get_scheduler_params;var h=[];for(d in a){var k=a[d];this._is_scheduler_command(d)&&h.push(function(a,d){var h=Sirius.Utils.is_function(d)?b(d):function(){return(new Sirius.Internal.ControlFlow(d,b)).tick()};var k=g(a);
c.debug("Define scheduler for '"+a+"' with "+JSON.stringify(k));return 0===a.lastIndexOf(e)||0===a.lastIndexOf(f)?null===k.delay?setInterval(h,k.time):setTimeout(function(){return setInterval(h,k.time)},k.delay):null===k.delay?setTimeout(h,k.time):setTimeout(function(){return setTimeout(h,k.time)},k.delay)}(d,k))}return h},_event_register:function(a,b,c,d){var e;var f=[];for(e in a){var g=a[e];this._is_event_route(e)&&f.push(function(a,e){var f=Sirius.Utils.is_function(e)?b(e):function(a,c){for(var d=
[],f=1;f<arguments.length;++f)d[f-1]=arguments[f];return(new Sirius.Internal.ControlFlow(e,b)).handle_event(a,d)};var g=a.match(/^([a-zA-Z:]+)(\s+)?(.*)?/);a=g[1];g=g[3]||document;c.bind(document,g,a,f);return d.debug("define event route: '"+a+"' for '"+c.as_string(g)+"'")}(e,g))}return f},_get_hash_routes:function(a,b,c){var d=[];for(f in a){var e=a[f];if(this._is_hash_route(f)){c.info("define hash route: '"+f+"' ~> "+e);var f=new Sirius.Internal.RoutePart(f);e=Sirius.Utils.is_function(e)?b(e):new Sirius.Internal.ControlFlow(e,
b);d.push([f,e])}}return d},_get_plain_routes:function(a,b,c){var d=[];for(f in a){var e=a[f];if(this._is_plain_route(f)){c.debug("define route: '"+f+"' ~> "+e);var f=new Sirius.Internal.RoutePart(f);e=Sirius.Utils.is_function(e)?b(e):new Sirius.Internal.ControlFlow(e,b);d.push([f,e])}}return d},_convert_to_hash_routing:function(a,b,c){if(a.is_need_redirect_to_hash&&!a.has_push_state_support){c.info("Convert plain routing into hash routing");var d=[];c={};for(e in b){a=b[e];this._is_hash_route(e)&&
d.push(e);if(this._is_plain_route(e)){var e="#"+e;-1!==d.indexOf(e)&&this.logger.warn("Routes already defined '"+e+"' url")}c[e]=a}b=c}return b},_try_to_call:function(a,b){var c;var d=!1;var e=0;for(c=a.length;e<c;e++){var f=$jscomp.makeIterator(a[e]);var g=f.next().value;f=f.next().value;d||(g=g.match(b),g.is_success()&&(d=!0,f.handle_event?f.handle_event(null,g.get_args()):f.apply(null,g.get_args())))}return d},_handle_404_event:function(a,b,c,d,e,f){f.warn("route '"+b+"' not found. Generate 404 event");
e.fire(document,"application:404",b,c);if(a=a["404"]||a[404])return Sirius.Utils.is_function(a)?d(a)(b):(new Sirius.Internal.ControlFlow(a,d)).handle_event(null,b)},create:function(a,b,c){var d=this;c=void 0===c?function(){}:c;var e;var f=Sirius.Application.get_logger("Sirius.Internal.RouteSystem");var g=new Sirius.Internal.HistoryJournal(b);var h=e=g.hash();return Sirius.Application.get_adapter().and_then(function(k){a=d._convert_to_hash_routing(b,a,f);var l=function(a){var b;var c=Sirius.Application.controller_wrapper;
for(b in c){var d=c[b];this[b]=d}return a};d._event_register(a,l,k,f);d._scheduler_register(a,l,k,f);var r=d._get_hash_routes(a,l,f);var p=d._get_plain_routes(a,l,f);var q=function(a){return a.preventDefault?a.preventDefault():a.returnValue=!1};var n=function(c){e=h;f.debug("start processing route: '"+h+"'");if("hashchange"===c.type){var d=r;h=g.hash();var m=g.origin();g.write({href:h},""+h,m+"/"+h)}else d=p,m=c.target.href,"popstate"!==c.type&&b.has_push_state_support&&g.write({href:m},""+m,m),h=
m=g.pathname();Sirius.Internal.RouteSystem._try_to_call(d,h)?(q(c),f.debug("Url changed to: "+h),k.fire(document,"application:urlchange",h,e)):b.is_ignore_not_matched_urls?f.debug("the URL was not matched: '"+h+"'"):(Sirius.Internal.RouteSystem._handle_404_event(a,h,e,l,k,f),q(c))};d.dispatch=n;0!==p.length&&k.bind(document,d._selector,"click",n);window.onhashchange=n;b.has_push_state_support&&k.bind(window,null,"popstate",function(a){if(history&&null!=history.state&&void 0!==history.state.href&&
0!==history.state.href.indexOf("#"))return n(a)});return c()})}};
Sirius.Application={enable_logging:Sirius.Logger.Default.enable_logging,minimum_log_level:Sirius.Logger.Default.minimum_log_level,log_to:Sirius.Logger.Default.default_log_function,adapter:null,route:{},start:!1,controller_wrapper:{redirect:Sirius.redirect},use_hash_routing_for_old_browsers:!0,ignore_not_matched_urls:!0,_wait:[],get_logger:function(a){return Sirius.Logger.build(a)},get_adapter:function(){if(null==this.adapter){var a=new Sirius.Promise;this._wait.push(a);return a}return new Sirius.Promise(this.adapter)},
run:function(a){a=void 0===a?{}:a;this._initialize(a)},_initialize:function(a){var b=this,c;Sirius.Logger.Configuration.configure(a);var d=new Sirius.Logger("Sirius.Application");var e=function(b,c){return null!=a[b]?a[b]:c};this.adapter=a.adapter||new VanillaJsAdapter;this.route=a.route||this.route;this.ignore_not_matched_urls=e("ignore_not_matched_urls",this.ignore_not_matched_urls);this.start=a.start||this.start;var f=a.controller_wrapper||{};for(c in f){var g=f[c];this.controller_wrapper[c]=g}this.hash_always_on_top=
e("hash_always_on_top",this.hash_always_on_top);this.use_hash_routing_for_old_browsers=e("use_hash_routing_for_old_browsers",this.use_hash_routing_for_old_browsers);d.info("Logger enabled? "+Sirius.Logger.Configuration.enable_logging);d.info("Minimum log level: "+Sirius.Logger.Configuration.minimum_log_level.get_value());d.info("Adapter: "+this.adapter._adapter_name);d.info("Use hash routing for old browsers: "+this.use_hash_routing_for_old_browsers);d.info("Current browser: "+navigator.userAgent);
d.info("Ignore not matched urls: "+this.ignore_not_matched_urls);this.push_state_support=history.pushState;d.info("History pushState support: !!"+this.push_state_support);!this.push_state_support&&this.use_hash_routing_for_old_browsers&&d.warn("You browser does not support pushState, and you disabled hash routing for old browser");e=Sirius.Internal.RoutingSetup.build({old:this.use_hash_routing_for_old_browsers,support:this.push_state_support,ignore:this.ignore_not_matched_urls});Sirius.Internal.RouteSystem.create(this.route,
e,function(){var a;var c=b._wait;var d=0;for(a=c.length;d<a;d++){var e=c[d];e.set_value(b.adapter)}return b.adapter.fire(document,"application:run",new Date)});if(this.start)return Sirius.redirect(this.start)}};