//>>built
define("dojox/app/main","require dojo/_base/kernel dojo/_base/lang dojo/_base/declare dojo/_base/config dojo/_base/window dojo/Evented dojo/Deferred dojo/when dojo/has dojo/on dojo/ready dojo/dom-construct dojo/dom-attr ./utils/model ./utils/nls ./module/lifecycle ./utils/hash ./utils/constraints ./utils/config".split(" "),function(g,t,e,k,u,v,w,m,l,p,x,y,z,F,A,B,G,q,C,D){function r(a,c){var b;a=D.configProcessHas(a);a.loaderConfig||(a.loaderConfig={});a.loaderConfig.paths||(a.loaderConfig.paths=
{});a.loaderConfig.paths.app||(b=window.location.pathname,"/"!=b.charAt(b.length)&&(b=b.split("/"),b.pop(),b=b.join("/")),a.loaderConfig.paths.app=b);g(a.loaderConfig);a.modules||(a.modules=[]);a.modules.push("./module/lifecycle");var d=a.modules.concat(a.dependencies?a.dependencies:[]);a.template&&(b=a.template,0==b.indexOf("./")&&(b="app/"+b),d.push("dojo/text!"+b));g(d,function(){for(var b=[E],d=0;d<a.modules.length;d++)b.push(arguments[d]);if(a.template)var e={templateString:arguments[arguments.length-
1]};App=k(b,e);y(function(){var b=new App(a,c||v.body());p("app-log-api")?b.log=function(){var a="";try{for(var b=0;b<arguments.length-1;b++)a+=arguments[b];console.log(a,arguments[arguments.length-1])}catch(H){}}:b.log=function(){};b.transitionToView=function(a,b,d){x.emit(a,"startTransition",{bubbles:!0,cancelable:!0,detail:b,triggerEvent:d||null})};b.setStatus(b.lifecycle.STARTING);var d=b.id;window[d]&&k.safeMixin(b,window[d]);window[d]=b;b.start()})})}p.add("app-log-api",(u.app||{}).debugApp);
var E=k(w,{constructor:function(a,c){k.safeMixin(this,a);this.params=a;this.id=a.id;this.defaultView=a.defaultView;this.controllers=[];this.children={};this.loadedModels={};this.loadedStores={};this.setDomNode(z.create("div",{id:this.id+"_Root",style:"width:100%; height:100%; overflow-y:hidden; overflow-x:hidden;"}));c.appendChild(this.domNode)},createDataStore:function(a){if(a.stores)for(var c in a.stores)if("_"!==c.charAt(0)){var b=a.stores[c].type?a.stores[c].type:"dojo/store/Memory",d={};a.stores[c].params&&
e.mixin(d,a.stores[c].params);try{var f=g(b)}catch(n){throw Error(b+" must be listed in the dependencies");}d.data&&e.isString(d.data)&&(d.data=e.getObject(d.data));if(a.stores[c].observable){try{var h=g("dojo/store/Observable")}catch(n){throw Error("dojo/store/Observable must be listed in the dependencies");}a.stores[c].store=h(new f(d))}else a.stores[c].store=new f(d);this.loadedStores[c]=a.stores[c].store}},createControllers:function(a){if(a){for(var c=[],b=0;b<a.length;b++)c.push(a[b]);var d=
new m,f;try{f=g.on?g.on("error",function(a){d.isResolved()||d.isRejected()||(d.reject("load controllers error."),f&&f.remove())}):null,g(c,function(){d.resolve.call(d,arguments);f&&f.remove()})}catch(n){d.reject(n),f&&f.remove()}var h=new m;l(d,e.hitch(this,function(a){for(var b=0;b<a.length;b++)this.controllers.push((new a[b](this)).bind());h.resolve(this)}),function(){h.reject("load controllers error.")});return h}},trigger:function(a,c){t.deprecated("dojox.app.Application.trigger","Use dojox.app.Application.emit instead",
"2.0");this.emit(a,c)},start:function(){this.createDataStore(this.params);var a=new m,c;try{c=A(this.params.models,this,this)}catch(b){return a.reject(b),a.promise}l(c,e.hitch(this,function(a){this.loadedModels=e.isArray(a)?a[0]:a;this.setupControllers();l(B(this.params),e.hitch(this,function(a){a&&e.mixin(this.nls={},a);this.startup()}))}),function(){a.reject("load model error.")})},setDomNode:function(a){var c=this.domNode;this.domNode=a;this.emit("app-domNode",{oldNode:c,newNode:a})},setupControllers:function(){var a=
window.location.hash;this._startView=q.getTarget(a,this.defaultView);this._startParams=q.getParams(a)},startup:function(){this.selectedChildren={};var a=this.createControllers(this.params.controllers);this.hasOwnProperty("constraint")?C.register(this.params.constraints):this.constraint="center";var c=function(){this.emit("app-load",{viewId:this.defaultView,initLoad:!0,params:this._startParams,callback:e.hitch(this,function(){this.emit("app-transition",{viewId:this.defaultView,forceTransitionNone:!0,
opts:{params:this._startParams}});this.defaultView!==this._startView&&this.emit("app-transition",{viewId:this._startView,opts:{params:this._startParams}});this.setStatus(this.lifecycle.STARTED)})})};l(a,e.hitch(this,function(){this.template?this.emit("app-init",{app:this,name:this.name,type:this.type,parent:this,templateString:this.templateString,controller:this.controller,callback:e.hitch(this,function(a){this.setDomNode(a.domNode);c.call(this)})}):c.call(this)}))}});return function(a,c){if(!a)throw Error("App Config Missing");
a.validate?g(["dojox/json/schema","dojox/json/ref","dojo/text!dojox/application/schema/application.json"],function(b,d){b=dojox.json.ref.resolveJson(b);b.validate(a,d)&&r(a,c)}):r(a,c)}});