").attr("id",t).addclass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)},_setupdisabled:function(t){e.isarray(t)&&(t.length?t.length===this.anchors.length&&(t=!0):t=!1);for(var n=0,r;r=this.tabs[n];n++)t===!0||e.inarray(n,t)!==-1?e(r).addclass("ui-state-disabled").attr("aria-disabled","true"):e(r).removeclass("ui-state-disabled").removeattr("aria-disabled");this.options.disabled=t},_setupevents:function(t){var n={click:function(e){e.preventdefault()}};t&&e.each(t.split(" "),function(e,t){n[t]="_eventhandler"}),this._off(this.anchors.add(this.tabs).add(this.panels)),this._on(this.anchors,n),this._on(this.tabs,{keydown:"_tabkeydown"}),this._on(this.panels,{keydown:"_panelkeydown"}),this._focusable(this.tabs),this._hoverable(this.tabs)},_setupheightstyle:function(t){var n,r,i=this.element.parent();t==="fill"?(e.support.minheight||(r=i.css("overflow"),i.css("overflow","hidden")),n=i.height(),this.element.siblings(":visible").each(function(){var t=e(this),r=t.css("position");if(r==="absolute"||r==="fixed")return;n-=t.outerheight(!0)}),r&&i.css("overflow",r),this.element.children().not(this.panels).each(function(){n-=e(this).outerheight(!0)}),this.panels.each(function(){e(this).height(math.max(0,n-e(this).innerheight()+e(this).height()))}).css("overflow","auto")):t==="auto"&&(n=0,this.panels.each(function(){n=math.max(n,e(this).height("").height())}).height(n))},_eventhandler:function(t){var n=this.options,r=this.active,i=e(t.currenttarget),s=i.closest("li"),o=s[0]===r[0],u=o&&n.collapsible,a=u?e():this._getpanelfortab(s),f=r.length?this._getpanelfortab(r):e(),l={oldtab:r,oldpanel:f,newtab:u?e():s,newpanel:a};t.preventdefault();if(s.hasclass("ui-state-disabled")||s.hasclass("ui-tabs-loading")||this.running||o&&!n.collapsible||this._trigger("beforeactivate",t,l)===!1)return;n.active=u?!1:this.tabs.index(s),this.active=o?e():s,this.xhr&&this.xhr.abort(),!f.length&&!a.length&&e.error("jquery ui tabs: mismatching fragment identifier."),a.length&&this.load(this.tabs.index(s),t),this._toggle(t,l)},_toggle:function(t,n){function o(){r.running=!1,r._trigger("activate",t,n)}function u(){n.newtab.closest("li").addclass("ui-tabs-active ui-state-active"),i.length&&r.options.show?r._show(i,r.options.show,o):(i.show(),o())}var r=this,i=n.newpanel,s=n.oldpanel;this.running=!0,s.length&&this.options.hide?this._hide(s,this.options.hide,function(){n.oldtab.closest("li").removeclass("ui-tabs-active ui-state-active"),u()}):(n.oldtab.closest("li").removeclass("ui-tabs-active ui-state-active"),s.hide(),u()),s.attr({"aria-expanded":"false","aria-hidden":"true"}),n.oldtab.attr("aria-selected","false"),i.length&&s.length?n.oldtab.attr("tabindex",-1):i.length&&this.tabs.filter(function(){return e(this).attr("tabindex")===0}).attr("tabindex",-1),i.attr({"aria-expanded":"true","aria-hidden":"false"}),n.newtab.attr({"aria-selected":"true",tabindex:0})},_activate:function(t){var n,r=this._findactive(t);if(r[0]===this.active[0])return;r.length||(r=this.active),n=r.find(".ui-tabs-anchor")[0],this._eventhandler({target:n,currenttarget:n,preventdefault:e.noop})},_findactive:function(t){return t===!1?e():this.tabs.eq(t)},_getindex:function(e){return typeof e=="string"&&(e=this.anchors.index(this.anchors.filter("[href$='"+e+"']"))),e},_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").removedata("href.tabs").removedata("load.tabs").removeuniqueid(),this.tabs.add(this.panels).each(function(){e.data(this,"ui-tabs-destroy")?e(this).remove():e(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 t=e(this),n=t.data("ui-tabs-aria-controls");n?t.attr("aria-controls",n):t.removeattr("aria-controls")}),this.panels.show(),this.options.heightstyle!=="content"&&this.panels.css("height","")},enable:function(n){var r=this.options.disabled;if(r===!1)return;n===t?r=!1:(n=this._getindex(n),e.isarray(r)?r=e.map(r,function(e){return e!==n?e:null}):r=e.map(this.tabs,function(e,t){return t!==n?t:null})),this._setupdisabled(r)},disable:function(n){var r=this.options.disabled;if(r===!0)return;if(n===t)r=!0;else{n=this._getindex(n);if(e.inarray(n,r)!==-1)return;e.isarray(r)?r=e.merge([n],r).sort():r=[n]}this._setupdisabled(r)},load:function(t,n){t=this._getindex(t);var r=this,i=this.tabs.eq(t),o=i.find(".ui-tabs-anchor"),u=this._getpanelfortab(i),a={tab:i,panel:u};if(s(o[0]))return;this.xhr=e.ajax(this._ajaxsettings(o,n,a)),this.xhr&&this.xhr.statustext!=="canceled"&&(i.addclass("ui-tabs-loading"),u.attr("aria-busy","true"),this.xhr.success(function(e){settimeout(function(){u.html(e),r._trigger("load",n,a)},1)}).complete(function(e,t){settimeout(function(){t==="abort"&&r.panels.stop(!1,!0),i.removeclass("ui-tabs-loading"),u.removeattr("aria-busy"),e===r.xhr&&delete r.xhr},1)}))},_ajaxsettings:function(t,n,r){var i=this;return{url:t.attr("href"),beforesend:function(t,s){return i._trigger("beforeload",n,e.extend({jqxhr:t,ajaxsettings:s},r))}}},_getpanelfortab:function(t){var n=e(t).attr("aria-controls");return this.element.find(this._sanitizeselector("#"+n))}}),e.uibackcompat!==!1&&(e.ui.tabs.prototype._ui=function(e,t){return{tab:e,panel:t,index:this.anchors.index(e)}},e.widget("ui.tabs",e.ui.tabs,{url:function(e,t){this.anchors.eq(e).attr("href",t)}}),e.widget("ui.tabs",e.ui.tabs,{options:{ajaxoptions:null,cache:!1},_create:function(){this._super();var t=this;this._on({tabsbeforeload:function(n,r){if(e.data(r.tab[0],"cache.tabs")){n.preventdefault();return}r.jqxhr.success(function(){t.options.cache&&e.data(r.tab[0],"cache.tabs",!0)})}})},_ajaxsettings:function(t,n,r){var i=this.options.ajaxoptions;return e.extend({},i,{error:function(e,t){try{i.error(e,t,r.tab.closest("li").index(),r.tab[0])}catch(n){}}},this._superapply(arguments))},_setoption:function(e,t){e==="cache"&&t===!1&&this.anchors.removedata("cache.tabs"),this._super(e,t)},_destroy:function(){this.anchors.removedata("cache.tabs"),this._super()},url:function(e){this.anchors.eq(e).removedata("cache.tabs"),this._superapply(arguments)}}),e.widget("ui.tabs",e.ui.tabs,{abort:function(){this.xhr&&this.xhr.abort()}}),e.widget("ui.tabs",e.ui.tabs,{options:{spinner:"
loading…"},_create:function(){this._super(),this._on({tabsbeforeload:function(e,t){if(e.target!==this.element[0]||!this.options.spinner)return;var n=t.tab.find("span"),r=n.html();n.html(this.options.spinner),t.jqxhr.complete(function(){n.html(r)})}})}}),e.widget("ui.tabs",e.ui.tabs,{options:{enable:null,disable:null},enable:function(t){var n=this.options,r;if(t&&n.disabled===!0||e.isarray(n.disabled)&&e.inarray(t,n.disabled)!==-1)r=!0;this._superapply(arguments),r&&this._trigger("enable",null,this._ui(this.anchors[t],this.panels[t]))},disable:function(t){var n=this.options,r;if(t&&n.disabled===!1||e.isarray(n.disabled)&&e.inarray(t,n.disabled)===-1)r=!0;this._superapply(arguments),r&&this._trigger("disable",null,this._ui(this.anchors[t],this.panels[t]))}}),e.widget("ui.tabs",e.ui.tabs,{options:{add:null,remove:null,tabtemplate:"
#{label}"},add:function(n,r,i){i===t&&(i=this.anchors.length);var s,o,u=this.options,a=e(u.tabtemplate.replace(/#\{href\}/g,n).replace(/#\{label\}/g,r)),f=n.indexof("#")?this._tabid(a):n.replace("#","");return a.addclass("ui-state-default ui-corner-top").data("ui-tabs-destroy",!0),a.attr("aria-controls",f),s=i>=this.tabs.length,o=this.element.find("#"+f),o.length||(o=this._createpanel(f),s?i>0?o.insertafter(this.panels.eq(-1)):o.appendto(this.element):o.insertbefore(this.panels[i])),o.addclass("ui-tabs-panel ui-widget-content ui-corner-bottom").hide(),s?a.appendto(this.tablist):a.insertbefore(this.tabs[i]),u.disabled=e.map(u.disabled,function(e){return e>=i?++e:e}),this.refresh(),this.tabs.length===1&&u.active===!1&&this.option("active",0),this._trigger("add",null,this._ui(this.anchors[i],this.panels[i])),this},remove:function(t){t=this._getindex(t);var n=this.options,r=this.tabs.eq(t).remove(),i=this._getpanelfortab(r).remove();return r.hasclass("ui-tabs-active")&&this.anchors.length>2&&this._activate(t+(t+1
=t?--e:e}),this.refresh(),this._trigger("remove",null,this._ui(r.find("a")[0],i[0])),this}}),e.widget("ui.tabs",e.ui.tabs,{length:function(){return this.anchors.length}}),e.widget("ui.tabs",e.ui.tabs,{options:{idprefix:"ui-tabs-"},_tabid:function(t){var n=t.is("li")?t.find("a[href]"):t;return n=n[0],e(n).closest("li").attr("aria-controls")||n.title&&n.title.replace(/\s/g,"_").replace(/[^\w\u00c0-\uffff\-]/g,"")||this.options.idprefix+i()}}),e.widget("ui.tabs",e.ui.tabs,{options:{paneltemplate:""},_createpanel:function(t){return e(this.options.paneltemplate).attr("id",t).addclass("ui-tabs-panel ui-widget-content ui-corner-bottom").data("ui-tabs-destroy",!0)}}),e.widget("ui.tabs",e.ui.tabs,{_create:function(){var e=this.options;e.active===null&&e.selected!==t&&(e.active=e.selected===-1?!1:e.selected),this._super(),e.selected=e.active,e.selected===!1&&(e.selected=-1)},_setoption:function(e,t){if(e!=="selected")return this._super(e,t);var n=this.options;this._super("active",t===-1?!1:t),n.selected=n.active,n.selected===!1&&(n.selected=-1)},_eventhandler:function(){this._superapply(arguments),this.options.selected=this.options.active,this.options.selected===!1&&(this.options.selected=-1)}}),e.widget("ui.tabs",e.ui.tabs,{options:{show:null,select:null},_create:function(){this._super(),this.options.active!==!1&&this._trigger("show",null,this._ui(this.active.find(".ui-tabs-anchor")[0],this._getpanelfortab(this.active)[0]))},_trigger:function(e,t,n){var r,i,s=this._superapply(arguments);return s?(e==="beforeactivate"?(r=n.newtab.length?n.newtab:n.oldtab,i=n.newpanel.length?n.newpanel:n.oldpanel,s=this._super("select",t,{tab:r.find(".ui-tabs-anchor")[0],panel:i[0],index:r.closest("li").index()})):e==="activate"&&n.newtab.length&&(s=this._super("show",t,{tab:n.newtab.find(".ui-tabs-anchor")[0],panel:n.newpanel[0],index:n.newtab.closest("li").index()})),s):!1}}),e.widget("ui.tabs",e.ui.tabs,{select:function(e){e=this._getindex(e);if(e===-1){if(!this.options.collapsible||this.options.selected===-1)return;e=this.options.selected}this.anchors.eq(e).trigger(this.options.event+this.eventnamespace)}}),function(){var t=0;e.widget("ui.tabs",e.ui.tabs,{options:{cookie:null},_create:function(){var e=this.options,t;e.active==null&&e.cookie&&(t=parseint(this._cookie(),10),t===-1&&(t=!1),e.active=t),this._super()},_cookie:function(n){var r=[this.cookie||(this.cookie=this.options.cookie.name||"ui-tabs-"+ ++t)];return arguments.length&&(r.push(n===!1?-1:n),r.push(this.options.cookie)),e.cookie.apply(null,r)},_refresh:function(){this._super(),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_eventhandler:function(){this._superapply(arguments),this.options.cookie&&this._cookie(this.options.active,this.options.cookie)},_destroy:function(){this._super(),this.options.cookie&&this._cookie(null,this.options.cookie)}})}(),e.widget("ui.tabs",e.ui.tabs,{_trigger:function(t,n,r){var i=e.extend({},r);return t==="load"&&(i.panel=i.panel[0],i.tab=i.tab.find(".ui-tabs-anchor")[0]),this._super(t,n,i)}}),e.widget("ui.tabs",e.ui.tabs,{options:{fx:null},_getfx:function(){var t,n,r=this.options.fx;return r&&(e.isarray(r)?(t=r[0],n=r[1]):t=n=r),r?{show:n,hide:t}:null},_toggle:function(e,t){function o(){n.running=!1,n._trigger("activate",e,t)}function u(){t.newtab.closest("li").addclass("ui-tabs-active ui-state-active"),r.length&&s.show?r.animate(s.show,s.show.duration,function(){o()}):(r.show(),o())}var n=this,r=t.newpanel,i=t.oldpanel,s=this._getfx();if(!s)return this._super(e,t);n.running=!0,i.length&&s.hide?i.animate(s.hide,s.hide.duration,function(){t.oldtab.closest("li").removeclass("ui-tabs-active ui-state-active"),u()}):(t.oldtab.closest("li").removeclass("ui-tabs-active ui-state-active"),i.hide(),u())}}))})(jquery);
/*! jquery ui - v1.9.2 - 2012-11-23
* includes: jquery.ui.menu.js
*/
(function(e,t){var n=!1;e.widget("ui.menu",{version:"1.9.2",defaultelement:"",delay:300,options:{icons:{submenu:"ui-icon-carat-1-e"},menus:"ul",position:{my:"left top",at:"right top"},role:"menu",blur:null,focus:null,select:null},_create:function(){this.activemenu=this.element,this.element.uniqueid().addclass("ui-menu ui-widget ui-widget-content ui-corner-all").toggleclass("ui-menu-icons",!!this.element.find(".ui-icon").length).attr({role:this.options.role,tabindex:0}).bind("click"+this.eventnamespace,e.proxy(function(e){this.options.disabled&&e.preventdefault()},this)),this.options.disabled&&this.element.addclass("ui-state-disabled").attr("aria-disabled","true"),this._on({"mousedown .ui-menu-item > a":function(e){e.preventdefault()},"click .ui-state-disabled > a":function(e){e.preventdefault()},"click .ui-menu-item:has(a)":function(t){var r=e(t.target).closest(".ui-menu-item");!n&&r.not(".ui-state-disabled").length&&(n=!0,this.select(t),r.has(".ui-menu").length?this.expand(t):this.element.is(":focus")||(this.element.trigger("focus",[!0]),this.active&&this.active.parents(".ui-menu").length===1&&cleartimeout(this.timer)))},"mouseenter .ui-menu-item":function(t){var n=e(t.currenttarget);n.siblings().children(".ui-state-active").removeclass("ui-state-active"),this.focus(t,n)},mouseleave:"collapseall","mouseleave .ui-menu":"collapseall",focus:function(e,t){var n=this.active||this.element.children(".ui-menu-item").eq(0);t||this.focus(e,n)},blur:function(t){this._delay(function(){e.contains(this.element[0],this.document[0].activeelement)||this.collapseall(t)})},keydown:"_keydown"}),this.refresh(),this._on(this.document,{click:function(t){e(t.target).closest(".ui-menu").length||this.collapseall(t),n=!1}})},_destroy:function(){this.element.removeattr("aria-activedescendant").find(".ui-menu").andself().removeclass("ui-menu ui-widget ui-widget-content ui-corner-all ui-menu-icons").removeattr("role").removeattr("tabindex").removeattr("aria-labelledby").removeattr("aria-expanded").removeattr("aria-hidden").removeattr("aria-disabled").removeuniqueid().show(),this.element.find(".ui-menu-item").removeclass("ui-menu-item").removeattr("role").removeattr("aria-disabled").children("a").removeuniqueid().removeclass("ui-corner-all ui-state-hover").removeattr("tabindex").removeattr("role").removeattr("aria-haspopup").children().each(function(){var t=e(this);t.data("ui-menu-submenu-carat")&&t.remove()}),this.element.find(".ui-menu-divider").removeclass("ui-menu-divider ui-widget-content")},_keydown:function(t){function a(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")}var n,r,i,s,o,u=!0;switch(t.keycode){case e.ui.keycode.page_up:this.previouspage(t);break;case e.ui.keycode.page_down:this.nextpage(t);break;case e.ui.keycode.home:this._move("first","first",t);break;case e.ui.keycode.end:this._move("last","last",t);break;case e.ui.keycode.up:this.previous(t);break;case e.ui.keycode.down:this.next(t);break;case e.ui.keycode.left:this.collapse(t);break;case e.ui.keycode.right:this.active&&!this.active.is(".ui-state-disabled")&&this.expand(t);break;case e.ui.keycode.enter:case e.ui.keycode.space:this._activate(t);break;case e.ui.keycode.escape:this.collapse(t);break;default:u=!1,r=this.previousfilter||"",i=string.fromcharcode(t.keycode),s=!1,cleartimeout(this.filtertimer),i===r?s=!0:i=r+i,o=new regexp("^"+a(i),"i"),n=this.activemenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())}),n=s&&n.index(this.active.next())!==-1?this.active.nextall(".ui-menu-item"):n,n.length||(i=string.fromcharcode(t.keycode),o=new regexp("^"+a(i),"i"),n=this.activemenu.children(".ui-menu-item").filter(function(){return o.test(e(this).children("a").text())})),n.length?(this.focus(t,n),n.length>1?(this.previousfilter=i,this.filtertimer=this._delay(function(){delete this.previousfilter},1e3)):delete this.previousfilter):delete this.previousfilter}u&&t.preventdefault()},_activate:function(e){this.active.is(".ui-state-disabled")||(this.active.children("a[aria-haspopup='true']").length?this.expand(e):this.select(e))},refresh:function(){var t,n=this.options.icons.submenu,r=this.element.find(this.options.menus);r.filter(":not(.ui-menu)").addclass("ui-menu ui-widget ui-widget-content ui-corner-all").hide().attr({role:this.options.role,"aria-hidden":"true","aria-expanded":"false"}).each(function(){var t=e(this),r=t.prev("a"),i=e("").addclass("ui-menu-icon ui-icon "+n).data("ui-menu-submenu-carat",!0);r.attr("aria-haspopup","true").prepend(i),t.attr("aria-labelledby",r.attr("id"))}),t=r.add(this.element),t.children(":not(.ui-menu-item):has(a)").addclass("ui-menu-item").attr("role","presentation").children("a").uniqueid().addclass("ui-corner-all").attr({tabindex:-1,role:this._itemrole()}),t.children(":not(.ui-menu-item)").each(function(){var t=e(this);/[^\-—–\s]/.test(t.text())||t.addclass("ui-widget-content ui-menu-divider")}),t.children(".ui-state-disabled").attr("aria-disabled","true"),this.active&&!e.contains(this.element[0],this.active[0])&&this.blur()},_itemrole:function(){return{menu:"menuitem",listbox:"option"}[this.options.role]},focus:function(e,t){var n,r;this.blur(e,e&&e.type==="focus"),this._scrollintoview(t),this.active=t.first(),r=this.active.children("a").addclass("ui-state-focus"),this.options.role&&this.element.attr("aria-activedescendant",r.attr("id")),this.active.parent().closest(".ui-menu-item").children("a:first").addclass("ui-state-active"),e&&e.type==="keydown"?this._close():this.timer=this._delay(function(){this._close()},this.delay),n=t.children(".ui-menu"),n.length&&/^mouse/.test(e.type)&&this._startopening(n),this.activemenu=t.parent(),this._trigger("focus",e,{item:t})},_scrollintoview:function(t){var n,r,i,s,o,u;this._hasscroll()&&(n=parsefloat(e.css(this.activemenu[0],"bordertopwidth"))||0,r=parsefloat(e.css(this.activemenu[0],"paddingtop"))||0,i=t.offset().top-this.activemenu.offset().top-n-r,s=this.activemenu.scrolltop(),o=this.activemenu.height(),u=t.height(),i<0?this.activemenu.scrolltop(s+i):i+u>o&&this.activemenu.scrolltop(s+i-o+u))},blur:function(e,t){t||cleartimeout(this.timer);if(!this.active)return;this.active.children("a").removeclass("ui-state-focus"),this.active=null,this._trigger("blur",e,{item:this.active})},_startopening:function(e){cleartimeout(this.timer);if(e.attr("aria-hidden")!=="true")return;this.timer=this._delay(function(){this._close(),this._open(e)},this.delay)},_open:function(t){var n=e.extend({of:this.active},this.options.position);cleartimeout(this.timer),this.element.find(".ui-menu").not(t.parents(".ui-menu")).hide().attr("aria-hidden","true"),t.show().removeattr("aria-hidden").attr("aria-expanded","true").position(n)},collapseall:function(t,n){cleartimeout(this.timer),this.timer=this._delay(function(){var r=n?this.element:e(t&&t.target).closest(this.element.find(".ui-menu"));r.length||(r=this.element),this._close(r),this.blur(t),this.activemenu=r},this.delay)},_close:function(e){e||(e=this.active?this.active.parent():this.element),e.find(".ui-menu").hide().attr("aria-hidden","true").attr("aria-expanded","false").end().find("a.ui-state-active").removeclass("ui-state-active")},collapse:function(e){var t=this.active&&this.active.parent().closest(".ui-menu-item",this.element);t&&t.length&&(this._close(),this.focus(e,t))},expand:function(e){var t=this.active&&this.active.children(".ui-menu ").children(".ui-menu-item").first();t&&t.length&&(this._open(t.parent()),this._delay(function(){this.focus(e,t)}))},next:function(e){this._move("next","first",e)},previous:function(e){this._move("prev","last",e)},isfirstitem:function(){return this.active&&!this.active.prevall(".ui-menu-item").length},islastitem:function(){return this.active&&!this.active.nextall(".ui-menu-item").length},_move:function(e,t,n){var r;this.active&&(e==="first"||e==="last"?r=this.active[e==="first"?"prevall":"nextall"](".ui-menu-item").eq(-1):r=this.active[e+"all"](".ui-menu-item").eq(0));if(!r||!r.length||!this.active)r=this.activemenu.children(".ui-menu-item")[t]();this.focus(n,r)},nextpage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.islastitem())return;this._hasscroll()?(r=this.active.offset().top,i=this.element.height(),this.active.nextall(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r-i<0}),this.focus(t,n)):this.focus(t,this.activemenu.children(".ui-menu-item")[this.active?"last":"first"]())},previouspage:function(t){var n,r,i;if(!this.active){this.next(t);return}if(this.isfirstitem())return;this._hasscroll()?(r=this.active.offset().top,i=this.element.height(),this.active.prevall(".ui-menu-item").each(function(){return n=e(this),n.offset().top-r+i>0}),this.focus(t,n)):this.focus(t,this.activemenu.children(".ui-menu-item").first())},_hasscroll:function(){return this.element.outerheight()")).addclass(n+r.dialogclass).css({display:"none",outline:0,zindex:r.zindex}).attr("tabindex",-1).keydown(function(n){r.closeonescape&&!n.isdefaultprevented()&&n.keycode&&n.keycode===e.ui.keycode.escape&&(t.close(n),n.preventdefault())}).mousedown(function(e){t.movetotop(!1,e)}).appendto("body"),this.element.show().removeattr("title").addclass("ui-dialog-content ui-widget-content").appendto(s),o=(this.uidialogtitlebar=e("")).addclass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix").bind("mousedown",function(){s.focus()}).prependto(s),u=e("
").addclass("ui-dialog-titlebar-close ui-corner-all").attr("role","button").click(function(e){e.preventdefault(),t.close(e)}).appendto(o),(this.uidialogtitlebarclosetext=e("
")).addclass("ui-icon ui-icon-closethick").text(r.closetext).appendto(u),a=e("").uniqueid().addclass("ui-dialog-title").html(i).prependto(o),f=(this.uidialogbuttonpane=e("")).addclass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix"),(this.uibuttonset=e("
")).addclass("ui-dialog-buttonset").appendto(f),s.attr({role:"dialog","aria-labelledby":a.attr("id")}),o.find("*").add(o).disableselection(),this._hoverable(u),this._focusable(u),r.draggable&&e.fn.draggable&&this._makedraggable(),r.resizable&&e.fn.resizable&&this._makeresizable(),this._createbuttons(r.buttons),this._isopen=!1,e.fn.bgiframe&&s.bgiframe(),this._on(s,{keydown:function(t){if(!r.modal||t.keycode!==e.ui.keycode.tab)return;var n=e(":tabbable",s),i=n.filter(":first"),o=n.filter(":last");if(t.target===o[0]&&!t.shiftkey)return i.focus(1),!1;if(t.target===i[0]&&t.shiftkey)return o.focus(1),!1}})},_init:function(){this.options.autoopen&&this.open()},_destroy:function(){var e,t=this.oldposition;this.overlay&&this.overlay.destroy(),this.uidialog.hide(),this.element.removeclass("ui-dialog-content ui-widget-content").hide().appendto("body"),this.uidialog.remove(),this.originaltitle&&this.element.attr("title",this.originaltitle),e=t.parent.children().eq(t.index),e.length&&e[0]!==this.element[0]?e.before(this.element):t.parent.append(this.element)},widget:function(){return this.uidialog},close:function(t){var n=this,r,i;if(!this._isopen)return;if(!1===this._trigger("beforeclose",t))return;return this._isopen=!1,this.overlay&&this.overlay.destroy(),this.options.hide?this._hide(this.uidialog,this.options.hide,function(){n._trigger("close",t)}):(this.uidialog.hide(),this._trigger("close",t)),e.ui.dialog.overlay.resize(),this.options.modal&&(r=0,e(".ui-dialog").each(function(){this!==n.uidialog[0]&&(i=e(this).css("z-index"),isnan(i)||(r=math.max(r,i)))}),e.ui.dialog.maxz=r),this},isopen:function(){return this._isopen},movetotop:function(t,n){var r=this.options,i;return r.modal&&!t||!r.stack&&!r.modal?this._trigger("focus",n):(r.zindex>e.ui.dialog.maxz&&(e.ui.dialog.maxz=r.zindex),this.overlay&&(e.ui.dialog.maxz+=1,e.ui.dialog.overlay.maxz=e.ui.dialog.maxz,this.overlay.$el.css("z-index",e.ui.dialog.overlay.maxz)),i={scrolltop:this.element.scrolltop(),scrollleft:this.element.scrollleft()},e.ui.dialog.maxz+=1,this.uidialog.css("z-index",e.ui.dialog.maxz),this.element.attr(i),this._trigger("focus",n),this)},open:function(){if(this._isopen)return;var t,n=this.options,r=this.uidialog;return this._size(),this._position(n.position),r.show(n.show),this.overlay=n.modal?new e.ui.dialog.overlay(this):null,this.movetotop(!0),t=this.element.find(":tabbable"),t.length||(t=this.uidialogbuttonpane.find(":tabbable"),t.length||(t=r)),t.eq(0).focus(),this._isopen=!0,this._trigger("open"),this},_createbuttons:function(t){var n=this,r=!1;this.uidialogbuttonpane.remove(),this.uibuttonset.empty(),typeof t=="object"&&t!==null&&e.each(t,function(){return!(r=!0)}),r?(e.each(t,function(t,r){var i,s;r=e.isfunction(r)?{click:r,text:t}:r,r=e.extend({type:"button"},r),s=r.click,r.click=function(){s.apply(n.element[0],arguments)},i=e("
",r).appendto(n.uibuttonset),e.fn.button&&i.button()}),this.uidialog.addclass("ui-dialog-buttons"),this.uidialogbuttonpane.appendto(this.uidialog)):this.uidialog.removeclass("ui-dialog-buttons")},_makedraggable:function(){function r(e){return{position:e.position,offset:e.offset}}var t=this,n=this.options;this.uidialog.draggable({cancel:".ui-dialog-content, .ui-dialog-titlebar-close",handle:".ui-dialog-titlebar",containment:"document",start:function(n,i){e(this).addclass("ui-dialog-dragging"),t._trigger("dragstart",n,r(i))},drag:function(e,n){t._trigger("drag",e,r(n))},stop:function(i,s){n.position=[s.position.left-t.document.scrollleft(),s.position.top-t.document.scrolltop()],e(this).removeclass("ui-dialog-dragging"),t._trigger("dragstop",i,r(s)),e.ui.dialog.overlay.resize()}})},_makeresizable:function(n){function u(e){return{originalposition:e.originalposition,originalsize:e.originalsize,position:e.position,size:e.size}}n=n===t?this.options.resizable:n;var r=this,i=this.options,s=this.uidialog.css("position"),o=typeof n=="string"?n:"n,e,s,w,se,sw,ne,nw";this.uidialog.resizable({cancel:".ui-dialog-content",containment:"document",alsoresize:this.element,maxwidth:i.maxwidth,maxheight:i.maxheight,minwidth:i.minwidth,minheight:this._minheight(),handles:o,start:function(t,n){e(this).addclass("ui-dialog-resizing"),r._trigger("resizestart",t,u(n))},resize:function(e,t){r._trigger("resize",e,u(t))},stop:function(t,n){e(this).removeclass("ui-dialog-resizing"),i.height=e(this).height(),i.width=e(this).width(),r._trigger("resizestop",t,u(n)),e.ui.dialog.overlay.resize()}}).css("position",s).find(".ui-resizable-se").addclass("ui-icon ui-icon-grip-diagonal-se")},_minheight:function(){var e=this.options;return e.height==="auto"?e.minheight:math.min(e.minheight,e.height)},_position:function(t){var n=[],r=[0,0],i;if(t){if(typeof t=="string"||typeof t=="object"&&"0"in t)n=t.split?t.split(" "):[t[0],t[1]],n.length===1&&(n[1]=n[0]),e.each(["left","top"],function(e,t){+n[e]===n[e]&&(r[e]=n[e],n[e]=t)}),t={my:n[0]+(r[0]<0?r[0]:"+"+r[0])+" "+n[1]+(r[1]<0?r[1]:"+"+r[1]),at:n.join(" ")};t=e.extend({},e.ui.dialog.prototype.options.position,t)}else t=e.ui.dialog.prototype.options.position;i=this.uidialog.is(":visible"),i||this.uidialog.show(),this.uidialog.position(t),i||this.uidialog.hide()},_setoptions:function(t){var n=this,s={},o=!1;e.each(t,function(e,t){n._setoption(e,t),e in r&&(o=!0),e in i&&(s[e]=t)}),o&&this._size(),this.uidialog.is(":data(resizable)")&&this.uidialog.resizable("option",s)},_setoption:function(t,r){var i,s,o=this.uidialog;switch(t){case"buttons":this._createbuttons(r);break;case"closetext":this.uidialogtitlebarclosetext.text(""+r);break;case"dialogclass":o.removeclass(this.options.dialogclass).addclass(n+r);break;case"disabled":r?o.addclass("ui-dialog-disabled"):o.removeclass("ui-dialog-disabled");break;case"draggable":i=o.is(":data(draggable)"),i&&!r&&o.draggable("destroy"),!i&&r&&this._makedraggable();break;case"position":this._position(r);break;case"resizable":s=o.is(":data(resizable)"),s&&!r&&o.resizable("destroy"),s&&typeof r=="string"&&o.resizable("option","handles",r),!s&&r!==!1&&this._makeresizable(r);break;case"title":e(".ui-dialog-title",this.uidialogtitlebar).html(""+(r||" "))}this._super(t,r)},_size:function(){var t,n,r,i=this.options,s=this.uidialog.is(":visible");this.element.show().css({width:"auto",minheight:0,height:0}),i.minwidth>i.width&&(i.width=i.minwidth),t=this.uidialog.css({height:"auto",width:i.width}).outerheight(),n=math.max(0,i.minheight-t),i.height==="auto"?e.support.minheight?this.element.css({minheight:n,height:"auto"}):(this.uidialog.show(),r=this.element.css("height","auto").height(),s||this.uidialog.hide(),this.element.height(math.max(r,n))):this.element.height(math.max(i.height-t,0)),this.uidialog.is(":data(resizable)")&&this.uidialog.resizable("option","minheight",this._minheight())}}),e.extend(e.ui.dialog,{uuid:0,maxz:0,gettitleid:function(e){var t=e.attr("id");return t||(this.uuid+=1,t=this.uuid),"ui-dialog-title-"+t},overlay:function(t){this.$el=e.ui.dialog.overlay.create(t)}}),e.extend(e.ui.dialog.overlay,{instances:[],oldinstances:[],maxz:0,events:e.map("focus,mousedown,mouseup,keydown,keypress,click".split(","),function(e){return e+".dialog-overlay"}).join(" "),create:function(t){this.instances.length===0&&(settimeout(function(){e.ui.dialog.overlay.instances.length&&e(document).bind(e.ui.dialog.overlay.events,function(t){if(e(t.target).zindex()
").addclass("ui-widget-overlay");return e(document).bind("keydown.dialog-overlay",function(r){var i=e.ui.dialog.overlay.instances;i.length!==0&&i[i.length-1]===n&&t.options.closeonescape&&!r.isdefaultprevented()&&r.keycode&&r.keycode===e.ui.keycode.escape&&(t.close(r),r.preventdefault())}),n.appendto(document.body).css({width:this.width(),height:this.height()}),e.fn.bgiframe&&n.bgiframe(),this.instances.push(n),n},destroy:function(t){var n=e.inarray(t,this.instances),r=0;n!==-1&&this.oldinstances.push(this.instances.splice(n,1)[0]),this.instances.length===0&&e([document,window]).unbind(".dialog-overlay"),t.height(0).width(0).remove(),e.each(this.instances,function(){r=math.max(r,this.css("z-index"))}),this.maxz=r},height:function(){var t,n;return e.ui.ie?(t=math.max(document.documentelement.scrollheight,document.body.scrollheight),n=math.max(document.documentelement.offsetheight,document.body.offsetheight),t",options:{appendto:"body",autofocus:!1,delay:300,minlength:1,position:{my:"left top",at:"left bottom",collision:"none"},source:null,change:null,close:null,focus:null,open:null,response:null,search:null,select:null},pending:0,_create:function(){var t,n,r;this.ismultiline=this._ismultiline(),this.valuemethod=this.element[this.element.is("input,textarea")?"val":"text"],this.isnewmenu=!0,this.element.addclass("ui-autocomplete-input").attr("autocomplete","off"),this._on(this.element,{keydown:function(i){if(this.element.prop("readonly")){t=!0,r=!0,n=!0;return}t=!1,r=!1,n=!1;var s=e.ui.keycode;switch(i.keycode){case s.page_up:t=!0,this._move("previouspage",i);break;case s.page_down:t=!0,this._move("nextpage",i);break;case s.up:t=!0,this._keyevent("previous",i);break;case s.down:t=!0,this._keyevent("next",i);break;case s.enter:case s.numpad_enter:this.menu.active&&(t=!0,i.preventdefault(),this.menu.select(i));break;case s.tab:this.menu.active&&this.menu.select(i);break;case s.escape:this.menu.element.is(":visible")&&(this._value(this.term),this.close(i),i.preventdefault());break;default:n=!0,this._searchtimeout(i)}},keypress:function(r){if(t){t=!1,r.preventdefault();return}if(n)return;var i=e.ui.keycode;switch(r.keycode){case i.page_up:this._move("previouspage",r);break;case i.page_down:this._move("nextpage",r);break;case i.up:this._keyevent("previous",r);break;case i.down:this._keyevent("next",r)}},input:function(e){if(r){r=!1,e.preventdefault();return}this._searchtimeout(e)},focus:function(){this.selecteditem=null,this.previous=this._value()},blur:function(e){if(this.cancelblur){delete this.cancelblur;return}cleartimeout(this.searching),this.close(e),this._change(e)}}),this._initsource(),this.menu=e("").addclass("ui-autocomplete").appendto(this.document.find(this.options.appendto||"body")[0]).menu({input:e(),role:null}).zindex(this.element.zindex()+1).hide().data("menu"),this._on(this.menu.element,{mousedown:function(t){t.preventdefault(),this.cancelblur=!0,this._delay(function(){delete this.cancelblur});var n=this.menu.element[0];e(t.target).closest(".ui-menu-item").length||this._delay(function(){var t=this;this.document.one("mousedown",function(r){r.target!==t.element[0]&&r.target!==n&&!e.contains(n,r.target)&&t.close()})})},menufocus:function(t,n){if(this.isnewmenu){this.isnewmenu=!1;if(t.originalevent&&/^mouse/.test(t.originalevent.type)){this.menu.blur(),this.document.one("mousemove",function(){e(t.target).trigger(t.originalevent)});return}}var r=n.item.data("ui-autocomplete-item")||n.item.data("item.autocomplete");!1!==this._trigger("focus",t,{item:r})?t.originalevent&&/^key/.test(t.originalevent.type)&&this._value(r.value):this.liveregion.text(r.value)},menuselect:function(e,t){var n=t.item.data("ui-autocomplete-item")||t.item.data("item.autocomplete"),r=this.previous;this.element[0]!==this.document[0].activeelement&&(this.element.focus(),this.previous=r,this._delay(function(){this.previous=r,this.selecteditem=n})),!1!==this._trigger("select",e,{item:n})&&this._value(n.value),this.term=this._value(),this.close(e),this.selecteditem=n}}),this.liveregion=e("",{role:"status","aria-live":"polite"}).addclass("ui-helper-hidden-accessible").insertafter(this.element),e.fn.bgiframe&&this.menu.element.bgiframe(),this._on(this.window,{beforeunload:function(){this.element.removeattr("autocomplete")}})},_destroy:function(){cleartimeout(this.searching),this.element.removeclass("ui-autocomplete-input").removeattr("autocomplete"),this.menu.element.remove(),this.liveregion.remove()},_setoption:function(e,t){this._super(e,t),e==="source"&&this._initsource(),e==="appendto"&&this.menu.element.appendto(this.document.find(t||"body")[0]),e==="disabled"&&t&&this.xhr&&this.xhr.abort()},_ismultiline:function(){return this.element.is("textarea")?!0:this.element.is("input")?!1:this.element.prop("iscontenteditable")},_initsource:function(){var t,n,r=this;e.isarray(this.options.source)?(t=this.options.source,this.source=function(n,r){r(e.ui.autocomplete.filter(t,n.term))}):typeof this.options.source=="string"?(n=this.options.source,this.source=function(t,i){r.xhr&&r.xhr.abort(),r.xhr=e.ajax({url:n,data:t,datatype:"json",success:function(e){i(e)},error:function(){i([])}})}):this.source=this.options.source},_searchtimeout:function(e){cleartimeout(this.searching),this.searching=this._delay(function(){this.term!==this._value()&&(this.selecteditem=null,this.search(null,e))},this.options.delay)},search:function(e,t){e=e!=null?e:this._value(),this.term=this._value();if(e.length").append(e("").text(n.label)).appendto(t)},_move:function(e,t){if(!this.menu.element.is(":visible")){this.search(null,t);return}if(this.menu.isfirstitem()&&/^previous/.test(e)||this.menu.islastitem()&&/^next/.test(e)){this._value(this.term),this.menu.blur();return}this.menu[e](t)},widget:function(){return this.menu.element},_value:function(){return this.valuemethod.apply(this.element,arguments)},_keyevent:function(e,t){if(!this.ismultiline||this.menu.element.is(":visible"))this._move(e,t),t.preventdefault()}}),e.extend(e.ui.autocomplete,{escaperegex:function(e){return e.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g,"\\$&")},filter:function(t,n){var r=new regexp(e.ui.autocomplete.escaperegex(n),"i");return e.grep(t,function(e){return r.test(e.label||e.value||e)})}}),e.widget("ui.autocomplete",e.ui.autocomplete,{options:{messages:{noresults:"no search results.",results:function(e){return e+(e>1?" results are":" result is")+" available, use up and down arrow keys to navigate."}}},__response:function(e){var t;this._superapply(arguments);if(this.options.disabled||this.cancelsearch)return;e&&e.length?t=this.options.messages.results(e.length):t=this.options.messages.noresults,this.liveregion.text(t)}})})(jquery);