//>>built
define("dojox/mobile/ViewController","dojo/_base/kernel dojo/_base/array dojo/_base/connect dojo/_base/declare dojo/_base/lang dojo/_base/window dojo/_base/Deferred dojo/dom dojo/dom-class dojo/dom-construct dojo/on dojo/ready dijit/registry ./ProgressIndicator ./TransitionEvent ./viewRegistry".split(" "),function(A,B,t,u,l,h,v,w,C,D,x,y,e,E,r,m){var k=u("dojox.mobile.ViewController",null,{dataHandlerClass:"dojox/mobile/dh/DataHandler",dataSourceClass:"dojox/mobile/dh/UrlDataSource",fileTypeMapClass:"dojox/mobile/dh/SuffixFileTypeMap",
constructor:function(){this.viewMap={};y(l.hitch(this,function(){x(h.body(),"startTransition",l.hitch(this,"onStartTransition"))}))},findTransitionViews:function(b){if(!b)return[];b.match(/^#?([^&?]+)(.*)/);b=RegExp.$2;var a=e.byId(RegExp.$1);if(!a)return[];for(var c=a.getParent();c;c=c.getParent())if(c.isVisible&&!c.isVisible()){var d=a.getShowingView();d&&d.id!==a.id&&a.show();a=c}return[a.getShowingView(),a,b]},openExternalView:function(b,a){var c=new v,d=this.viewMap[b.url];if(d)return b.moveTo=
d,b.noTransition?e.byId(d).hide():(new r(h.body(),b)).dispatch(),c.resolve(!0),c;var f=null;for(d=a.childNodes.length-1;0<=d;d--){var g=a.childNodes[d];if(1===g.nodeType&&"bottom"===(g.getAttribute("fixed")||g.getAttribute("data-mobile-fixed")||e.byNode(g)&&e.byNode(g).fixed)){f=g;break}}require([b.dataHandlerClass||this.dataHandlerClass,b.dataSourceClass||this.dataSourceClass,b.fileTypeMapClass||this.fileTypeMapClass],l.hitch(this,function(n,z,p){n=new n(new z(b.data||b.url),a,f);p=b.contentType||
p.getContentType(b.url)||"html";n.processData(p,l.hitch(this,function(q){q?(this.viewMap[b.url]=b.moveTo=q,b.noTransition?e.byId(q).hide():(new r(h.body(),b)).dispatch(),c.resolve(!0)):c.reject("Failed to load "+b.url)}))}));return c},onStartTransition:function(b){b.preventDefault();if(b.detail){var a=b.detail;if(a.moveTo||a.href||a.url||a.scene)if(a.url&&!a.moveTo){var c=a.urlTarget,d=e.byId(c);c=d&&d.containerNode||w.byId(c);c||(c=(d=m.getEnclosingView(b.target))&&d.domNode.parentNode||h.body());
(b=e.getEnclosingWidget(b.target))&&b.callback&&(a.context=b,a.method=b.callback);this.openExternalView(a,c)}else if(a.href)if(a.hrefTarget&&"_self"!=a.hrefTarget)h.global.open(a.href,a.hrefTarget);else{for(d=m.getEnclosingView(b.target);d;d=m.getParentView(d))c=d;c&&c.performTransition(null,a.transitionDir,a.transition,b.target,function(){location.href=a.href})}else if(a.scene)t.publish("/dojox/mobile/app/pushScene",[a.scene]);else{var f=this.findTransitionViews(a.moveTo);c=f[0];d=f[1];f=f[2];location.hash||
a.hashchange||(m.initialView=c);a.moveTo&&d&&(a.moveTo=("#"===a.moveTo.charAt(0)?"#"+d.id:d.id)+f);!c||a.moveTo&&c===e.byId(a.moveTo.replace(/^#?([^&?]+).*/,"$1"))||((b=e.getEnclosingWidget(b.target))&&b.callback&&(a.context=b,a.method=b.callback),c.performTransition(a))}}}});k._instance=new k;k.getInstance=function(){return k._instance};return k});