(function(a,b,r){var d=".",c="rmDisabled",n="rmParentItem",q="rmToggle",h="rmItem",i="rmLink",e="rmGroup",j="rmLoading",k="rmLoadingTemplate",g="rmLoadingIcon",f={opacity:0},o={opacity:1},l={left:"100%"},m={left:"-100%"},s={left:0},p="span";
b.MobileMenuItem=function(){b.MobileMenuItem.initializeBase(this);
};
b.MobileMenuItem.prototype={_initialize:function(u,t){b.MobileMenuItem.callBaseMethod(this,"_initialize",[u,t]);
this._clearNavigateUrl();
},_initializeRenderedItem:function(){b.MobileMenuItem.callBaseMethod(this,"_initializeRenderedItem");
this._ensureChildrenParent();
this._clearNavigateUrl();
},_dispose:function(){b.BaseMenuItem.callBaseMethod(this,"_dispose");
this._disposeDomElement();
},get_childListElement:function(){if(!this._childListElement){this._childListElement=a(this._element).children(d+e).get(0);
}return this._childListElement;
},get_textElement:function(){return this.get_linkElement();
},set_navigateUrl:function(v){var u=this,t=u.get_linkElement();
this._properties.setValue("navigateUrl",v,true);
if(!t){return;
}if(v&&v!=="#"){if(t.nodeName=="A"){t.href=v;
}else{this._replaceSpanElement(v);
}}else{this._replaceLinkElement();
}this._clearNavigateUrl();
},set_visible:function(v){var w=this.get_visible()!=v,t=v?"":"none",u=this.get_element();
if(!w){return;
}b.MobileMenuItem.callBaseMethod(this,"set_visible",[v]);
u.style.display=t;
},scrollIntoView:function(){var t=this.get_element();
if(t){t.scrollIntoView(false);
}},_render:function(t){t[t.length]="
";
this._renderTextContainer(t);
if(this.get_items().get_count()>0||this.get_expandMode()===b.MenuItemExpandMode.WebService){this._renderToggleButton(t);
this._renderChildItems(t);
}t[t.length]="";
},_renderTextContainer:function(t){var u=this.get_navigateUrl();
if(u&&u!="#"){this._renderLink(t,u);
}else{this._renderSpan(t);
}},_renderLink:function(t,u){var v=this.get_target();
t[t.length]="";
t[t.length]=this.get_text();
t[t.length]="";
},_renderSpan:function(t){t[t.length]="";
t[t.length]=this.get_text();
t[t.length]="";
},_renderToggleButton:function(t){t[t.length]="";
t[t.length]="";
t[t.length]="";
},_renderParentItem:function(u){var t=h+" "+n;
u[u.length]="";
u[u.length]=this.get_text();
u[u.length]="";
},_renderChildItems:function(u,v){var t=this.get_items().toArray();
if(t.length==0){return;
}u[u.length]="";
this._renderParentItem(u);
if(!v){a.each(t,function(){this._render(u);
});
}u[u.length]="
";
},_ensureChildrenParent:function(){var t=this._getParentItemElement();
if(t&&!t._item){this._parentItemElement._item=this;
this._parentItemElement._itemTypeName=Object.getTypeName(this);
}},_ensureToggleButton:function(){var t=a(this.get_linkElement());
if(!this._getToggleButtonElement()){this._createToggleButtonElement();
a(this._toggleButtonElement).insertAfter(t);
}},_getParentItemElement:function(){if(!this._parentItemElement){this._parentItemElement=a(this.get_childListElement()).children(d+n).get(0);
}return this._parentItemElement;
},_getToggleButtonElement:function(){if(!this._toggleButtonElement){this._toggleButtonElement=a(this.get_element()).children(d+q).get(0);
}return this._toggleButtonElement;
},_getChildElements:function(){return a(this.get_childListElement()).children(".rmItem :not(.rmParentItem)");
},_doOpen:function(y){var B,A=this.get_menu(),D=A.get_rightToLeft()?l:m,C=this.get_parent(),z=A.get_expandAnimation(),x=z.get_duration(),v=b.AnimationType.toEasing(z.get_type()),t=a(this.get_childListElement()),u=a(C.get_childListElement()),w=function(){u.css(f);
};
if(!this.get_hasContentTemplate()){this._ensureChildControls();
}this._state=b.RadMenuItemState.Open;
C._openedItem=this;
this._detachChildren();
t.css(o).stopTransition();
u.stopTransition();
if(v!=="easeNone"){t.transition(s,x,v);
u.transition(D,x,v,w);
}else{t.css(s);
u.css(D);
w();
}B=new b.RadMenuItemOpenedEventArgs(this,y);
A._raiseEvent("itemOpened",B);
},_doClose:function(A){var x,B=this.get_menu(),C=this.get_parent(),D=B.get_rightToLeft()?m:l,y=B.get_collapseAnimation(),z=y.get_duration(),v=b.AnimationType.toEasing(y.get_type()),t=a(this.get_childListElement()),u=a(C.get_childListElement()),w=function(){t.css(f);
};
this._state=b.RadMenuItemState.Closed;
C._openedItem=null;
u.css(o).stopTransition();
t.stopTransition();
if(v!=="easeNone"){u.transition(s,z,v);
t.transition(D,z,v,w);
}else{u.css(s);
t.css(D);
w();
}x=new b.RadMenuItemClosedEventArgs(this,A);
B._raiseEvent("itemClosed",x);
},_click:function(v){if(!this.get_enabled()){return;
}var w=this.get_menu(),u=new b.RadMenuItemClickingEventArgs(this,v),t;
w._raiseEvent("itemClicking",u);
if(u.get_cancel()){v.preventDefault();
return;
}t=new b.RadMenuItemClickedEventArgs(this,v);
w._raiseEvent("itemClicked",t);
if(this._shouldNavigate()){return;
}this.set_selected(true);
if(this._shouldPostBack()){a(w.get_element()).children(".rmRootToggle").trigger("touchend");
w._postback(this._getHierarchicalIndex());
}},_setFocused:function(t){this._focused=t;
this._updateLinkClass();
},_detachChildren:function(){if(this._childrenDetached){return;
}var v=this.get_menu(),u=a(v._getAnimationContainerElement()),t=a(this.get_childListElement());
u.append(t);
this._childrenDetached=true;
},_createChildListElement:function(){var v=[],u=a(this.get_element()),t;
this._renderChildItems(v,true);
t=a(v.join(""));
u.append(t);
return t.get(0);
},_createToggleButtonElement:function(){var t=document.createElement(p);
t.className=q;
t.innerHTML=" ";
this._toggleButtonElement=t;
},_applyCssClass:function(v,u){var t=a(this.get_element());
t.removeClass(u);
t.addClass(v);
},_updateLinkClass:function(){if(this.get_isSeparator()){return;
}var t=a(this.get_element()),u=this._resolveCssClass();
t.removeClass();
t.addClass(u.join(" "));
},_resolveCssClass:function(){var t=[h,this.get_cssClass()],u=this.get_menu();
if(this.get_focused()){t.push(this.get_focusedCssClass());
}if(this.get_selected()&&(!u||u.get_enableSelection())){t.push(this.get_selectedCssClass());
}if(this._clicked){t.push(this.get_clickedCssClass());
}if(!this.get_enabled()){Array.addRange(t,[c,this.get_disabledCssClass()]);
}return t;
},_replaceSpanElement:function(v){var u=this.get_linkElement(),t=a("");
this._replaceElement(t);
},_replaceLinkElement:function(){var u=this.get_linkElement(),t=a("");
this._replaceElement(t);
},_replaceElement:function(t){var u=a(this.get_linkElement());
t.html(u.html());
t.attr("accesskey",u.attr("accesskey"));
u.replaceWith(t);
this._linkElement=t.get(0);
},_createLoadingItem:function(){var v=this.get_menu(),w,u=v.get_loadingTemplate(),t=a(v._getAnimationContainerElement());
t.addClass(j);
if(u===""){t.addClass(g);
return;
}w=""+u+"";
t.append(a(w));
},_removeLoadingItem:function(){var v=this.get_menu(),u=v.get_loadingTemplate(),t=a(v._getAnimationContainerElement());
t.removeClass(j);
if(u===""){t.removeClass(g);
return;
}a(d+k).remove();
},_onChildrenLoading:function(){this._itemsLoading=true;
this._createLoadingItem();
},_onChildrenLoaded:function(){this._removeLoadingItem();
this._itemsLoaded=true;
this._itemsLoading=false;
this._doOpen(null);
},_onChildrenLoadingError:function(){this._removeLoadingItem();
this._itemsLoaded=false;
this._itemsLoading=false;
}};
b.MobileMenuItem.registerClass("Telerik.Web.UI.MobileMenuItem",b.BaseMenuItem);
})($telerik.$,Telerik.Web.UI);