// All material copyright ESRI, All Rights Reserved, unless otherwise specified.
// See http://@sbaseurl@/jsapi/jsapi/esri/copyright.txt and http://www.arcgis.com/apps/webappbuilder/copyright.txt for details.

//>>built
require({cache:{"url:themes/DashboardTheme/panels/MobilePanel/Panel.html":'\x3cdiv\x3e\r\n  \x3cdiv class\x3d"map-area" data-dojo-attach-point\x3d"mapNode"\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"splitter" data-dojo-attach-point\x3d"splitterNode"\x3e\r\n    \x3cdiv class\x3d"splitter_handler" data-dojo-attach-point\x3d"splitterHandler"\x3e\x3c/div\x3e\r\n  \x3c/div\x3e\r\n  \x3cdiv class\x3d"widget-area" data-dojo-attach-point\x3d"widgetContainerNode"\x3e\r\n    \x3cdiv class\x3d"panel-content" data-dojo-attach-point\x3d"containerNode"\x3e\x3c/div\x3e\r\n    \x3cdiv class\x3d"panel-header"\x3e\r\n      \x3cdiv class\x3d"previous-arrow jimu-float-leading jimu-leading-margin1" data-dojo-attach-point\x3d"previousArrow"\x3e\x3c/div\x3e\r\n      \x3cdiv class\x3d"next-arrow  jimu-float-trailing jimu-trailing-margin1" data-dojo-attach-point\x3d"nextArrow"\x3e\x3c/div\x3e\r\n      \x3cdiv class\x3d"label" data-dojo-attach-point\x3d"labelNode"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n    \x3cdiv class\x3d"panel-footer" data-dojo-attach-point\x3d"footerNode"\x3e\r\n      \x3cdiv class\x3d"count jimu-float-trailing jimu-trailing-margin2" data-dojo-attach-point\x3d"countNode"\x3e\x3c/div\x3e\r\n    \x3c/div\x3e\r\n  \x3c/div\x3e\r\n\x3c/div\x3e\r\n'}});
define("dojo/_base/declare dojo/_base/lang dojo/_base/array dijit/_WidgetBase dojo/dom-construct dojo/dom-geometry dojo/dom-style dojo/dom-class dojo/on dojo/Deferred dojo/query dojo/debounce dojo/Evented dojo/dnd/move dojo/_base/fx dojo/fx dijit/_TemplatedMixin dojo/text!./Panel.html".split(" "),function(y,m,z,A,t,p,l,q,u,x,B,C,D,E,k,v,F,G){return y([A,F,D],{baseClass:"jimu-dnd-mobile-panel",templateString:G,mobileLayout:1,layoutId:"",mapId:"",widgetIds:null,panels:null,currentIndex:0,leftPos:0,
count:"",title:"",widgetMode:0,layoutManager:null,_moveStartX:0,_moveStartY:0,postCreate:function(){this.inherited(arguments);this.setMobileLayout(this.mobileLayout);t.place(this.mapId,this.mapNode);this.own(u(this.previousArrow,"click",m.hitch(this,this._switchPrevious)));this.own(u(this.nextArrow,"click",m.hitch(this,this._switchNext)));this._initSplitter();l.set(this.footerNode,"opacity","0");this.resize()},clearPanels:function(){this.widgetIds=[];this.panels=[];t.empty(this.containerNode);l.set(this.containerNode,
"left",0);this.currentIndex=0;this._updateHeader(this.currentIndex-1,this.currentIndex)},setPanels:function(a,b){this.widgetIds=a;this.panels=b||{};this.currentIndex=0;1>=this.widgetIds.length?(l.set(this.previousArrow,"display","none"),l.set(this.nextArrow,"display","none")):(l.set(this.previousArrow,"display","block"),l.set(this.nextArrow,"display","block"));l.set(this.footerNode,"opacity","0");this._openPanel();this._updateHeader(this.currentIndex-1,this.currentIndex)},_resizeActivePanel:function(){if(this.widgetIds&&
this.panels){var a=this.panels[this.widgetIds[this.currentIndex]];a&&"function"===typeof a.resize&&a.resize()}},_openPanel:function(){var a=this.widgetIds[this.currentIndex],b=this.panels[a],d;if(b&&b.domNode){if(0===B('div[data-widgetId\x3d"'+a+'"]',this.containerNode).length){var e=t.create("div",{"data-widgetId":a,"class":"dnd-mobile-container"},this.containerNode);b.placeAt(e)}this.layoutManager.panelManager.openPanel(b)}else this.layoutManager._loadDashboardWidget(this.widgetIds[this.currentIndex]).then(m.hitch(this,
function(c){if(c){var g=t.create("div",{"data-widgetId":a,"class":"dnd-mobile-container"},this.containerNode);c.placeAt(g);this.panels[a]=c;this.layoutManager.panelManager.openPanel(c);this.labelNode.innerHTML=c.config.label}}));z.forEach(this.widgetIds,m.hitch(this,function(c){c!==a&&(d=this.panels[c])&&this.layoutManager.panelManager.closePanel(d)}))},_initSplitter:function(){this.moveable&&this.moveable.destroy();this.moveable=new E.parentConstrainedMoveable(this.splitterNode,{area:"content",within:!0});
this.own(u(this.moveable,"MoveStart",m.hitch(this,this.onMoveStart)));this.own(u(this.moveable,"Moving",C(m.hitch(this,this.onMoving),50)));this.own(u(this.moveable,"MoveStop",m.hitch(this,this.onMoveStop)))},destroy:function(){this.moveable&&(this.moveable.destroy(),this.moveable=null);var a=this.panels[this.widgetIds[this.currentIndex]];a&&this.layoutManager.panelManager.closePanel(a);t.empty(this.containerNode);this.inherited(arguments)},setMobileLayout:function(a){2===a?(this.mobileLayout=2,q.remove(this.domNode,
"portrait"),q.add(this.domNode,"landscape")):(this.mobileLayout=1,q.remove(this.domNode,"landscape"),q.add(this.domNode,"portrait"))},resize:function(){(2===this.mobileLayout?this._restoreLandscapeLayout():this._restorePortraitLayout()).then(m.hitch(this,function(){if(this.domNode){var a=p.getMarginBox(this.widgetContainerNode);window.isRTL?this.emit("resized",{right:a.l,top:a.t,width:a.w,height:a.h}):this.emit("resized",{left:a.l,top:a.t,width:a.w,height:a.h})}}))},_updateHeader:function(a,b){if(this.widgetIds&&
0<this.widgetIds.length){var d=this.widgetIds[b],e=this.widgetIds[a],c=this.panels[d],g=this.panels[e];this.countNode.innerHTML=b+1+"/"+this.widgetIds.length;a&&g&&(a=g.getWidgetById(e),a.onDeActive());if(c){if(d=c.getWidgetById(d))d.onActive(),this.labelNode.innerHTML=d.label}else this.labelNode.innerHTML=""}else this.labelNode.innerHTML="",this.countNode.innerHTML="";0===b?q.add(this.previousArrow,"disabled"):q.remove(this.previousArrow,"disabled");b===this.widgetIds.length-1?q.add(this.nextArrow,
"disabled"):q.remove(this.nextArrow,"disabled")},_switchPrevious:function(){0<this.currentIndex&&(this._updateHeader(this.currentIndex,this.currentIndex-1),this.currentIndex--,this._play())},_switchNext:function(){this.currentIndex<this.widgetIds.length-1&&(this._updateHeader(this.currentIndex,this.currentIndex+1),this.currentIndex++,this._play())},_play:function(){var a=p.getMarginBox(this.containerNode);k.animateProperty({node:this.containerNode,duration:300,properties:window.isRTL?{right:-this.currentIndex*
a.w}:{left:-this.currentIndex*a.w},onEnd:m.hitch(this,function(){l.set(this.footerNode,"opacity","1");k.animateProperty({node:this.footerNode,duration:2100,properties:{opacity:0}}).play()})}).play();this._openPanel()},onMoveStart:function(a){if(window.isRTL){var b=p.getMarginBox(this.layoutId),d=parseFloat(l.get(a.node,"right"));this._moveStartX=b.w-d;l.set(this.splitterNode,{left:this._moveStartX+"px",right:"auto"})}else this._moveStartX=l.get(a.node,"left");this._moveStartY=l.get(a.node,"top")},
onMoving:function(a){if(a&&a.node){var b=l.get(a.node,"left")-this._moveStartX;a=l.get(a.node,"top")-this._moveStartY;1===this.mobileLayout?(l.set(this.widgetContainerNode,"top",this._moveStartY+a+16+"px"),l.set(this.splitterNode,"top",this._moveStartY+a+"px"),l.set(this.splitterNode,"left","0")):2===this.mobileLayout&&(l.set(this.widgetContainerNode,{left:this._moveStartX+b+16+"px",right:"auto"}),l.set(this.splitterNode,{left:this._moveStartX+b+"px",right:"auto",top:0}))}},onMoveStop:function(a){var b=
l.get(a.node,"left")-this._moveStartX;a=l.get(a.node,"top")-this._moveStartY;1===this.mobileLayout?this._resizeWidgetVertically(a):2===this.mobileLayout&&this._resizeWidgetHorizontally(b)},_resizeWidgetVertically:function(a){var b=p.getMarginBox(this.layoutId),d=p.getMarginBox(this.containerNode).h/3,e=!1,c=[];d=150<d?150:d;if(0===this.widgetMode&&a<-d){this.widgetMode=2;var g=0;var f=.5*-b.h;var n=.5*b.h;var h=b.h-16;e=!0;this.emit("resized",{left:0,top:g+16,width:b.w,height:h})}else if(0===this.widgetMode&&
a>d)this.widgetMode=1,g=b.h-16,n=b.h-16,f=0,h=.5*b.h-16,e=!0,this.emit("resized",{left:0,top:g+16,width:b.w,height:h});else if(1===this.widgetMode&&a<-d||2===this.widgetMode&&a>d)this.widgetMode=0,g=.5*b.h,n=.5*b.h,f=0,h=.5*b.h-16,e=!0,this.emit("resized",{left:0,top:g+16,width:b.w,height:h});e?(c.push(k.animateProperty({node:this.widgetContainerNode,duration:300,properties:{top:g+16,height:h}})),c.push(k.animateProperty({node:this.containerNode,duration:300,properties:{left:-this.currentIndex*b.w,
width:b.w}})),c.push(k.animateProperty({node:this.splitterNode,duration:300,properties:{top:g}})),c.push(k.animateProperty({node:this.mapNode,duration:300,properties:{height:n,top:f}})),a=v.combine(c),a.onEnd=m.hitch(this,this._resizeActivePanel),a.play()):this._restorePortraitLayout()},_resizeWidgetHorizontally:function(a){var b=p.getMarginBox(this.layoutId),d=p.getMarginBox(this.containerNode).w/3,e=!1,c=[];d=150<d?150:d;if(window.isRTL){if(0===this.widgetMode&&a>d){this.widgetMode=2;var g=0;var f=
b.w-320-16;var n=-f;var h=b.w-16;e=!0;this.emit("resized",{left:g+16,right:"auto",top:0,width:h,height:b.h})}else if(0===this.widgetMode&&a<-d)this.widgetMode=1,g=f=b.w-16,n=0,h=320,e=!0,this.emit("resized",{left:g+16,right:"auto",top:0,width:h,height:b.h});else if(1===this.widgetMode&&a>d||2===this.widgetMode&&a<-d)this.widgetMode=0,g=f=b.w-320-16,n=0,h=320,e=!0,this.emit("resized",{left:g+16,right:"auto",top:0,width:h,height:b.h});e?(c.push(k.animateProperty({node:this.widgetContainerNode,duration:300,
properties:{left:"auto",right:g+16,width:h}})),c.push(k.animateProperty({node:this.containerNode,duration:300,properties:{left:"auto",right:-this.currentIndex*h,width:h}})),c.push(k.animateProperty({node:this.splitterNode,duration:300,properties:{left:"auto",right:g}})),c.push(k.animateProperty({node:this.mapNode,duration:300,properties:{left:"auto",width:f,right:n}})),a=v.combine(c),a.onEnd=m.hitch(this,this._resizeActivePanel),a.play()):this._restoreLandscapeLayout()}else{if(0===this.widgetMode&&
a<-d){this.widgetMode=2;var r=0;f=b.w-320-16;var w=-f;h=b.w-16;e=!0;this.emit("resized",{left:r+16,top:0,width:h,height:b.h})}else if(0===this.widgetMode&&a>d)this.widgetMode=1,r=f=b.w-16,w=0,h=320,e=!0,this.emit("resized",{left:r+16,top:0,width:h,height:b.h});else if(1===this.widgetMode&&a<-d||2===this.widgetMode&&a>d)this.widgetMode=0,r=f=b.w-320-16,w=0,h=320,e=!0,this.emit("resized",{left:r+16,top:0,width:h,height:b.h});e?(c.push(k.animateProperty({node:this.widgetContainerNode,duration:300,properties:{left:r+
16,width:h}})),c.push(k.animateProperty({node:this.containerNode,duration:300,properties:{left:-this.currentIndex*h,width:h}})),c.push(k.animateProperty({node:this.splitterNode,duration:300,properties:{left:r}})),c.push(k.animateProperty({node:this.mapNode,duration:300,properties:{width:f,left:w}})),a=v.combine(c),a.onEnd=m.hitch(this,this._resizeActivePanel),a.play()):this._restoreLandscapeLayout()}},_restorePortraitLayout:function(){var a=p.getMarginBox(this.layoutId),b=[],d=new x;if(0===this.widgetMode){var e=
.5*a.h;var c=.5*a.h;var g=0;var f=a.h-c-16}else 2===this.widgetMode?(e=0,g=.5*-a.h,c=.5*a.h,f=a.h-16):1===this.widgetMode&&(e=a.h-16,c=a.h-16,g=0,f=.5*a.h-16);b.push(k.animateProperty({node:this.widgetContainerNode,duration:300,properties:{left:0,right:0,top:e+16,height:f,width:a.w}}));b.push(k.animateProperty({node:this.containerNode,duration:300,properties:window.isRTL?{right:-this.currentIndex*a.w,width:a.w}:{left:-this.currentIndex*a.w,width:a.w}}));b.push(k.animateProperty({node:this.splitterNode,
duration:300,properties:{top:e,left:0,right:0,width:a.w,height:16}}));b.push(k.animateProperty({node:this.mapNode,duration:300,properties:{height:c,width:a.w,top:g,left:0,right:0}}));a=v.combine(b);a.onEnd=m.hitch(this,function(){this._resizeActivePanel();d.resolve()});a.play();return d},_restoreLandscapeLayout:function(){var a=p.getMarginBox(this.layoutId),b=[],d=new x,e;if(window.isRTL){if(0===this.widgetMode){var c=e=a.w-320-16;var g=0;var f=320}else 2===this.widgetMode?(c=0,e=a.w-320-16,g=-e,
f=a.w-16):1===this.widgetMode&&(c=e=a.w-16,g=0,f=320);b.push(k.animateProperty({node:this.widgetContainerNode,duration:300,properties:{top:0,right:c+16,width:f,height:a.h}}));b.push(k.animateProperty({node:this.containerNode,duration:300,properties:{right:-this.currentIndex*f,width:f}}));b.push(k.animateProperty({node:this.splitterNode,duration:300,properties:{right:c,top:0,height:a.h,width:16}}));b.push(k.animateProperty({node:this.mapNode,duration:300,properties:{width:e,height:a.h,right:g,top:0}}))}else{if(0===
this.widgetMode){var n=e=a.w-320-16;var h=0;f=320}else 2===this.widgetMode?(n=0,e=a.w-320-16,h=-e,f=a.w-16):1===this.widgetMode&&(n=e=a.w-16,h=0,f=320);b.push(k.animateProperty({node:this.widgetContainerNode,duration:300,properties:{top:0,left:n+16,width:f,height:a.h}}));b.push(k.animateProperty({node:this.containerNode,duration:300,properties:{left:-this.currentIndex*f,width:f}}));b.push(k.animateProperty({node:this.splitterNode,duration:300,properties:{left:n,top:0,height:a.h,width:16}}));b.push(k.animateProperty({node:this.mapNode,
duration:300,properties:{width:e,height:a.h,left:h,top:0}}))}a=v.combine(b);a.onEnd=m.hitch(this,function(){this._resizeActivePanel();d.resolve()});a.play();return d}})});