(function(c){"function"===typeof define&&define.amd?define(["jquery","./core","./widget"],c):c(jQuery)})(function(c){return c.widget("ui.tabs",{version:"1.11.4",delay:300,options:{active:null,collapsible:!1,event:"click",heightStyle:"content",hide:null,show:null,activate:null,beforeActivate:null,beforeLoad:null,load:null},_isLocal:function(){var a=/#.*$/;return function(b){var c,e;b=b.cloneNode(!1);c=b.href.replace(a,"");e=location.href.replace(a,"");try{c=decodeURIComponent(c)}catch(g){}try{e=decodeURIComponent(e)}catch(g){}return 1<
b.hash.length&&c===e}}(),_create:function(){var a=this,b=this.options;this.running=!1;this.element.addClass("ui-tabs ui-widget ui-widget-content ui-corner-all").toggleClass("ui-tabs-collapsible",b.collapsible);this._processTabs();b.active=this._initialActive();c.isArray(b.disabled)&&(b.disabled=c.unique(b.disabled.concat(c.map(this.tabs.filter(".ui-state-disabled"),function(b){return a.tabs.index(b)}))).sort());this.active=!1!==this.options.active&&this.anchors.length?this._findActive(b.active):c();
this._refresh();this.active.length&&this.load(b.active)},_initialActive:function(){var a=this.options.active,b=this.options.collapsible,d=location.hash.substring(1);null===a&&(d&&this.tabs.each(function(b,g){if(c(g).attr("aria-controls")===d)return a=b,!1}),null===a&&(a=this.tabs.index(this.tabs.filter(".ui-tabs-active"))),null===a||-1===a)&&(a=this.tabs.length?0:!1);!1!==a&&(a=this.tabs.index(this.tabs.eq(a)),-1===a&&(a=b?!1:0));!b&&!1===a&&this.anchors.length&&(a=0);return a},_getCreateEventData:function(){return{tab:this.active,
panel:this.active.length?this._getPanelForTab(this.active):c()}},_tabKeydown:function(a){var b=c(this.document[0].activeElement).closest("li"),d=this.tabs.index(b),e=!0;if(!this._handlePageNav(a)){switch(a.keyCode){case c.ui.keyCode.RIGHT:case c.ui.keyCode.DOWN:d++;break;case c.ui.keyCode.UP:case c.ui.keyCode.LEFT:e=!1;d--;break;case c.ui.keyCode.END:d=this.anchors.length-1;break;case c.ui.keyCode.HOME:d=0;break;case c.ui.keyCode.SPACE:a.preventDefault();clearTimeout(this.activating);this._activate(d);
return;case c.ui.keyCode.ENTER:a.preventDefault();clearTimeout(this.activating);this._activate(d===this.options.active?!1:d);return;default:return}a.preventDefault();clearTimeout(this.activating);d=this._focusNextTab(d,e);a.ctrlKey||a.metaKey||(b.attr("aria-selected","false"),this.tabs.eq(d).attr("aria-selected","true"),this.activating=this._delay(function(){this.option("active",d)},this.delay))}},_panelKeydown:function(a){!this._handlePageNav(a)&&a.ctrlKey&&a.keyCode===c.ui.keyCode.UP&&(a.preventDefault(),
this.active.focus())},_handlePageNav:function(a){if(a.altKey&&a.keyCode===c.ui.keyCode.PAGE_UP)return this._activate(this._focusNextTab(this.options.active-1,!1)),!0;if(a.altKey&&a.keyCode===c.ui.keyCode.PAGE_DOWN)return this._activate(this._focusNextTab(this.options.active+1,!0)),!0},_findNextTab:function(a,b){function d(){a>e&&(a=0);0>a&&(a=e);return a}for(var e=this.tabs.length-1;-1!==c.inArray(d(),this.options.disabled);)a=b?a+1:a-1;return a},_focusNextTab:function(a,b){a=this._findNextTab(a,
b);this.tabs.eq(a).focus();return a},_setOption:function(a,b){"active"===a?this._activate(b):"disabled"===a?this._setupDisabled(b):(this._super(a,b),"collapsible"===a&&(this.element.toggleClass("ui-tabs-collapsible",b),b||!1!==this.options.active||this._activate(0)),"event"===a&&this._setupEvents(b),"heightStyle"===a&&this._setupHeightStyle(b))},_sanitizeSelector:function(a){return a?a.replace(/[!"$%&'()*+,.\/:;<=>?@\[\]\^`{|}~]/g,"\\$&"):""},refresh:function(){var a=this.options,b=this.tablist.children(":has(a[href])");
a.disabled=c.map(b.filter(".ui-state-disabled"),function(a){return b.index(a)});this._processTabs();!1!==a.active&&this.anchors.length?this.active.length&&!c.contains(this.tablist[0],this.active[0])?this.tabs.length===a.disabled.length?(a.active=!1,this.active=c()):this._activate(this._findNextTab(Math.max(0,a.active-1),!1)):a.active=this.tabs.index(this.active):(a.active=!1,this.active=c());this._refresh()},_refresh:function(){this._setupDisabled(this.options.disabled);this._setupEvents(this.options.event);
this._setupHeightStyle(this.options.heightStyle);this.tabs.not(this.active).attr({"aria-selected":"false","aria-expanded":"false",tabIndex:-1});this.panels.not(this._getPanelForTab(this.active)).hide().attr({"aria-hidden":"true"});this.active.length?(this.active.addClass("ui-tabs-active ui-state-active").attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0}),this._getPanelForTab(this.active).show().attr({"aria-hidden":"false"})):this.tabs.eq(0).attr("tabIndex",0)},_processTabs:function(){var a=
this,b=this.tabs,d=this.anchors,e=this.panels;this.tablist=this._getList().addClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").attr("role","tablist").delegate("> li","mousedown"+this.eventNamespace,function(a){c(this).is(".ui-state-disabled")&&a.preventDefault()}).delegate(".ui-tabs-anchor","focus"+this.eventNamespace,function(){c(this).closest("li").is(".ui-state-disabled")&&this.blur()});this.tabs=this.tablist.find("> li:has(a[href])").addClass("ui-state-default ui-corner-top").attr({role:"tab",
tabIndex:-1});this.anchors=this.tabs.map(function(){return c("a",this)[0]}).addClass("ui-tabs-anchor").attr({role:"presentation",tabIndex:-1});this.panels=c();this.anchors.each(function(b,d){var e,k,m=c(d).uniqueId().attr("id"),l=c(d).closest("li"),n=l.attr("aria-controls");a._isLocal(d)?(e=d.hash,k=e.substring(1),e=a.element.find(a._sanitizeSelector(e))):(k=l.attr("aria-controls")||c({}).uniqueId()[0].id,e=a.element.find("#"+k),e.length||(e=a._createPanel(k),e.insertAfter(a.panels[b-1]||a.tablist)),
e.attr("aria-live","polite"));e.length&&(a.panels=a.panels.add(e));n&&l.data("ui-tabs-aria-controls",n);l.attr({"aria-controls":k,"aria-labelledby":m});e.attr("aria-labelledby",m)});this.panels.addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").attr("role","tabpanel");b&&(this._off(b.not(this.tabs)),this._off(d.not(this.anchors)),this._off(e.not(this.panels)))},_getList:function(){return this.tablist||this.element.find("ol,ul").eq(0)},_createPanel:function(a){return c("<div>").attr("id",
a).addClass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupDisabled:function(a){c.isArray(a)&&(a.length?a.length===this.anchors.length&&(a=!0):a=!1);for(var b=0,d;d=this.tabs[b];b++)!0===a||-1!==c.inArray(b,a)?c(d).addClass("ui-state-disabled").attr("aria-disabled","true"):c(d).removeClass("ui-state-disabled").removeAttr("aria-disabled");this.options.disabled=a},_setupEvents:function(a){var b={};a&&c.each(a.split(" "),function(a,c){b[c]="_eventHandler"});this._off(this.anchors.add(this.tabs).add(this.panels));
this._on(!0,this.anchors,{click:function(a){a.preventDefault()}});this._on(this.anchors,b);this._on(this.tabs,{keydown:"_tabKeydown"});this._on(this.panels,{keydown:"_panelKeydown"});this._focusable(this.tabs);this._hoverable(this.tabs)},_setupHeightStyle:function(a){var b,d=this.element.parent();"fill"===a?(b=d.height(),b-=this.element.outerHeight()-this.element.height(),this.element.siblings(":visible").each(function(){var a=c(this),d=a.css("position");"absolute"!==d&&"fixed"!==d&&(b-=a.outerHeight(!0))}),
this.element.children().not(this.panels).each(function(){b-=c(this).outerHeight(!0)}),this.panels.each(function(){c(this).height(Math.max(0,b-c(this).innerHeight()+c(this).height()))}).css("overflow","auto")):"auto"===a&&(b=0,this.panels.each(function(){b=Math.max(b,c(this).height("").height())}).height(b))},_eventHandler:function(a){var b=this.options,d=this.active,e=c(a.currentTarget).closest("li"),g=e[0]===d[0],f=g&&b.collapsible,h=f?c():this._getPanelForTab(e),k=d.length?this._getPanelForTab(d):
c(),d={oldTab:d,oldPanel:k,newTab:f?c():e,newPanel:h};a.preventDefault();e.hasClass("ui-state-disabled")||e.hasClass("ui-tabs-loading")||this.running||g&&!b.collapsible||!1===this._trigger("beforeActivate",a,d)||(b.active=f?!1:this.tabs.index(e),this.active=g?c():e,this.xhr&&this.xhr.abort(),k.length||h.length||c.error("jQuery UI Tabs: Mismatching fragment identifier."),h.length&&this.load(this.tabs.index(e),a),this._toggle(a,d))},_toggle:function(a,b){function d(){g.running=!1;g._trigger("activate",
a,b)}function e(){b.newTab.closest("li").addClass("ui-tabs-active ui-state-active");f.length&&g.options.show?g._show(f,g.options.show,d):(f.show(),d())}var g=this,f=b.newPanel,h=b.oldPanel;this.running=!0;h.length&&this.options.hide?this._hide(h,this.options.hide,function(){b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active");e()}):(b.oldTab.closest("li").removeClass("ui-tabs-active ui-state-active"),h.hide(),e());h.attr("aria-hidden","true");b.oldTab.attr({"aria-selected":"false",
"aria-expanded":"false"});f.length&&h.length?b.oldTab.attr("tabIndex",-1):f.length&&this.tabs.filter(function(){return 0===c(this).attr("tabIndex")}).attr("tabIndex",-1);f.attr("aria-hidden","false");b.newTab.attr({"aria-selected":"true","aria-expanded":"true",tabIndex:0})},_activate:function(a){a=this._findActive(a);a[0]!==this.active[0]&&(a.length||(a=this.active),a=a.find(".ui-tabs-anchor")[0],this._eventHandler({target:a,currentTarget:a,preventDefault:c.noop}))},_findActive:function(a){return!1===
a?c():this.tabs.eq(a)},_getIndex:function(a){"string"===typeof a&&(a=this.anchors.index(this.anchors.filter("[href$='"+a+"']")));return a},_destroy:function(){this.xhr&&this.xhr.abort();this.element.removeClass("ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible");this.tablist.removeClass("ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all").removeAttr("role");this.anchors.removeClass("ui-tabs-anchor").removeAttr("role").removeAttr("tabIndex").removeUniqueId();
this.tablist.unbind(this.eventNamespace);this.tabs.add(this.panels).each(function(){c.data(this,"ui-tabs-destroy")?c(this).remove():c(this).removeClass("ui-state-default ui-state-active ui-state-disabled ui-corner-top ui-corner-bottom ui-widget-content ui-tabs-active ui-tabs-panel").removeAttr("tabIndex").removeAttr("aria-live").removeAttr("aria-busy").removeAttr("aria-selected").removeAttr("aria-labelledby").removeAttr("aria-hidden").removeAttr("aria-expanded").removeAttr("role")});this.tabs.each(function(){var a=
c(this),b=a.data("ui-tabs-aria-controls");b?a.attr("aria-controls",b).removeData("ui-tabs-aria-controls"):a.removeAttr("aria-controls")});this.panels.show();"content"!==this.options.heightStyle&&this.panels.css("height","")},enable:function(a){var b=this.options.disabled;!1!==b&&(void 0===a?b=!1:(a=this._getIndex(a),b=c.isArray(b)?c.map(b,function(b){return b!==a?b:null}):c.map(this.tabs,function(b,c){return c!==a?c:null})),this._setupDisabled(b))},disable:function(a){var b=this.options.disabled;
if(!0!==b){if(void 0===a)b=!0;else{a=this._getIndex(a);if(-1!==c.inArray(a,b))return;b=c.isArray(b)?c.merge([a],b).sort():[a]}this._setupDisabled(b)}},load:function(a,b){a=this._getIndex(a);var d=this,e=this.tabs.eq(a),g=e.find(".ui-tabs-anchor"),f=this._getPanelForTab(e),h={tab:e,panel:f},k=function(a,b){"abort"===b&&d.panels.stop(!1,!0);e.removeClass("ui-tabs-loading");f.removeAttr("aria-busy");a===d.xhr&&delete d.xhr};this._isLocal(g[0])||(this.xhr=c.ajax(this._ajaxSettings(g,b,h)))&&"canceled"!==
this.xhr.statusText&&(e.addClass("ui-tabs-loading"),f.attr("aria-busy","true"),this.xhr.done(function(a,c,e){setTimeout(function(){f.html(a);d._trigger("load",b,h);k(e,c)},1)}).fail(function(a,b){setTimeout(function(){k(a,b)},1)}))},_ajaxSettings:function(a,b,d){var e=this;return{url:a.attr("href"),beforeSend:function(a,f){return e._trigger("beforeLoad",b,c.extend({jqXHR:a,ajaxSettings:f},d))}}},_getPanelForTab:function(a){a=c(a).attr("aria-controls");return this.element.find(this._sanitizeSelector("#"+
a))}})});