(function(e,g){if(e.cleanData){var h=e.cleanData;e.cleanData=function(c){for(var b=0,a;(a=c[b])!=null;b++){e(a).triggerHandler("remove")}h(c)}}else{var f=e.fn.remove;e.fn.remove=function(b,a){return this.each(function(){if(!a){if(!b||e.filter(b,[this]).length){e("*",this).add([this]).each(function(){e(this).triggerHandler("remove")})}}return f.call(e(this),b,a)})}}e.widget=function(k,c,l){var d=k.split(".")[0],a;k=k.split(".")[1];a=d+"-"+k;if(!l){l=c;c=e.Widget}e.expr[":"][a]=function(i){return !!e.data(i,k)};e[d]=e[d]||{};e[d][k]=function(j,i){if(arguments.length){this._createWidget(j,i)}};var b=new c();b.options=e.extend(true,{},b.options);e[d][k].prototype=e.extend(true,b,{namespace:d,widgetName:k,widgetEventPrefix:e[d][k].prototype.widgetEventPrefix||k,widgetBaseClass:a},l);e.widget.bridge(k,e[d][k])};e.widget.bridge=function(a,b){e.fn[a]=function(d){var l=typeof d==="string",k=Array.prototype.slice.call(arguments,1),c=this;d=!l&&k.length?e.extend.apply(null,[true,d].concat(k)):d;if(l&&d.charAt(0)==="_"){return c}if(l){this.each(function(){var j=e.data(this,a),i=j&&e.isFunction(j[d])?j[d].apply(j,k):j;if(i!==j&&i!==g){c=i;return false}})}else{this.each(function(){var i=e.data(this,a);if(i){i.option(d||{})._init()}else{e.data(this,a,new b(d,this))}})}return c}};e.Widget=function(b,a){if(arguments.length){this._createWidget(b,a)}};e.Widget.prototype={widgetName:"widget",widgetEventPrefix:"",options:{disabled:false},_createWidget:function(b,a){e.data(a,this.widgetName,this);this.element=e(a);this.options=e.extend(true,{},this.options,this._getCreateOptions(),b);var c=this;this.element.bind("remove."+this.widgetName,function(){c.destroy()});this._create();this._trigger("create");this._init()},_getCreateOptions:function(){return e.metadata&&e.metadata.get(this.element[0])[this.widgetName]},_create:function(){},_init:function(){},destroy:function(){this.element.unbind("."+this.widgetName).removeData(this.widgetName);this.widget().unbind("."+this.widgetName).removeAttr("aria-disabled").removeClass(this.widgetBaseClass+"-disabled ui-state-disabled")},widget:function(){return this.element},option:function(b,a){var c=b;if(arguments.length===0){return e.extend({},this.options)}if(typeof b==="string"){if(a===g){return this.options[b]}c={};c[b]=a}this._setOptions(c);return this},_setOptions:function(a){var b=this;e.each(a,function(d,c){b._setOption(d,c)});return this},_setOption:function(b,a){this.options[b]=a;if(b==="disabled"){this.widget()[a?"addClass":"removeClass"](this.widgetBaseClass+"-disabled ui-state-disabled").attr("aria-disabled",a)}return this},enable:function(){return this._setOption("disabled",false)},disable:function(){return this._setOption("disabled",true)},_trigger:function(i,d,c){var a=this.options[i];d=e.Event(d);d.type=(i===this.widgetEventPrefix?i:this.widgetEventPrefix+i).toLowerCase();c=c||{};if(d.originalEvent){for(var l=e.event.props.length,b;l;){b=e.event.props[--l];d[b]=d.originalEvent[b]}}this.element.trigger(d,c);return !(e.isFunction(a)&&a.call(this.element[0],d,c)===false||d.isDefaultPrevented())}}})(jQuery);