define(["Ti/_/css","Ti/_/declare","Ti/UI/View","Ti/UI","Ti/_/lang"],function(t,e,n,i,o){var a=o.isDef,r=i.FILL,_="TiUINavigationGroup";return e("Ti.UI.MobileWeb.NavigationGroup",n,{constructor:function(e){var n=this,o=n.__values__.constants.window=e&&e.window,a=n._navBarContainer=i.createView({height:50,width:i.FILL,layout:i._LAYOUT_CONSTRAINING_HORIZONTAL});t.add(a.domNode,_),n.layout=i._LAYOUT_CONSTRAINING_VERTICAL,a.add(n._leftContainer=i.createView({width:i.SIZE,height:"100%",left:5,right:5})),a.add(n._centerContainer=i.createView({width:i.FILL,height:"100%"})),a.add(n._rightContainer=i.createView({width:i.SIZE,height:"100%",left:5,right:5})),n._add(a),n._add(n._contentContainer=i.createView({width:r,height:r})),this.navBarAtTop=!0,a._getBorderFromCSS(),n._windows=[],o&&n.open(o)},_defaultWidth:r,_defaultHeight:r,_updateNavBar:function(){var t,e,n,o=this,a=o._windows,r=a.length,_=a[r-1],d=this._navBarContainer,l=o._leftContainer,h=o._centerContainer,c=o._rightContainer;_&&(n=_.rightNavButton,_.leftNavButton?t=_.leftNavButton:(o._backButton||(o._backButton=i.createButton({title:"Back"}),require.on(o._backButton,"singletap",function(){o.close(a[a.length-1])})),r>1&&(t=o._backButton)),l._children[0]!==t&&(l._removeAllChildren(),t&&l._add(t)),c._children[0]!==n&&(c._removeAllChildren(),n&&c._add(n)),d.backgroundColor=_.barColor,d.backgroundImage=_.barImage,d.opacity=_.translucent?.5:1,d.height=_.navBarHidden&&_.modal?0:50,e=_.titleControl?_.titleControl:_.titleImage?_._titleImageView||(_._titleImageView=i.createImageView({image:_.titleImage})):_._titleControl||(_._titleControl=i.createLabel({text:_._getTitle()||this._tab&&this._tab._getTitle()||"",width:"100%",height:"100%",textAlign:i.TEXT_ALIGNMENT_CENTER})),h._children[0]!==e&&(h._removeAllChildren(),e&&h._add(e)))},_getTopWindow:function(){var t=this._windows,e=t.length;return e?t[t.length-1]:null},open:function(t){if(!t._opened){var e=this._windows,n=this._tab;t._navGroup=this,!a(t.backgroundColor)&&!a(t.backgroundImage)&&(t.backgroundColor="#fff"),~(e.length-1)&&e[e.length-1].fireEvent("blur"),n&&(t.tabGroup=(t.tab=n)._tabGroup),e.push(t),this._contentContainer._add(t),this._updateNavBar(),t._opened||t.fireEvent("open"),t._opened=1,t.fireEvent("focus")}},close:function(t){var e=this._windows,n=e.indexOf(t),i=this;t._navGroup=void 0,n>0&&(e.splice(n,1),t.fireEvent("blur"),i._contentContainer.remove(t),t.fireEvent("close"),t._opened=0,this._updateNavBar(),e[e.length-1].fireEvent("focus"))},_reset:function(){for(var t,e=this._windows,n=e.length-1,i=n;;){if(t=e[n],!n)break;n--===i&&t.fireEvent("blur"),this._contentContainer.remove(t),t.fireEvent("close"),t._opened=0}e.splice(1),this._updateNavBar(),t.fireEvent("focus")},constants:{window:void 0,bubbleParent:!1},properties:{navBarAtTop:{set:function(e,n){if(e!==n){var i=this._navBarContainer,o=i.domNode;this._remove(i),this._insertAt(i,e?0:1),t.remove(o,_+(e?"Top":"Bottom")),t.add(o,_+(e?"Bottom":"Top"))}return e}}}})});