var Widget=function(t){var e=$(t),a=this;this.value=null,this.val=function(t){if(void 0===t)return a.value;var i=e.find('input[type=radio][value="'+t+'"]');e.find("label").removeClass("select"),e.find("input[type=radio]").prop("checked",!1),i.length?(a.value=i.val(),i.parent().addClass("select"),setTimeout(function(){i.prop("checked",!0),e.trigger("tab-widget.change",[a.val()])},0)):(a.value=null,e.trigger("tab-widget.change",[null]))},e.on("click","label",function(){var t=$(this).find("input[type=radio]");return a.val(t.val()),!1});var i=e.find("input[type=radio]:checked");i.length?a.val(i.val()):a.val(null)},TabWidget={init:function(){$("[data-tab-widget]").each(function(t,e){var a=$(e).data("widget");a||(a=new Widget(e),$(e).data("widget",a))})}},TabWidgetForJquery=function(t){var e=$(t);this.val=function(t){if(void 0==t)return e.tabWidget().val();e.tabWidget().val(t)}};$.fn.extend({tabWidget:function(){var t=$(this).data("widget");return t||(t=new Widget(o),$(this).data("widget",t),new TabWidgetForJquery(this))}}),module.exports=TabWidget;