!function(e){function a(e){var a=0,l=e,t="position: absolute !important; top: -1000 !important; ";return l=l.clone().attr("style",t).appendTo("body"),a=l.width(!0),l.remove(),a}function l(e,a){e&&window.console&&window.console.log&&window.console.log("jQuery-LABELAUTY: "+a)}function t(e,a,l,t,n,c){var i,r,s,d="";return null==n?r=s="":(r=n[0],s=null==n[1]?r:n[1]),d=null==a?"":'tabindex="0" role="'+t+'" aria-checked="'+l+'" aria-label="'+a+'"',i=1==c?'":''}e.fn.labelauty=function(n){var c=e.extend({development:!1,"class":"labelauty",label:!0,separator:"|",checked_label:"Checked",unchecked_label:"Unchecked",force_random_id:!1,minimum_width:!1,same_width:!0},n);return this.each(function(){var n,i,r,s=e(this),d=s.is(":checked"),o=s.attr("type"),h=!0,u=s.attr("aria-label");if(s.attr("aria-hidden",!0),s.is(":checkbox")===!1&&s.is(":radio")===!1)return this;if(s.addClass(c["class"]),n=s.attr("data-labelauty"),h=c.label,h===!0&&(null==n||0===n.length?(i=new Array,i[0]=c.unchecked_label,i[1]=c.checked_label):(i=n.split(c.separator),i.length>2?(h=!1,l(c.development,"There's more than two labels. LABELAUTY will not use labels.")):1===i.length&&l(c.development,"There's just one label. LABELAUTY will use this one for both cases."))),s.css({display:"none"}),s.removeAttr("data-labelauty"),r=s.attr("id"),c.force_random_id||null==r||""===r.trim()){var b=1+Math.floor(1024e3*Math.random());for(r="labelauty-"+b;0!==e(r).length;)b++,r="labelauty-"+b,l(c.development,"Holy crap, between 1024 thousand numbers, one raised a conflict. Trying again.");s.attr("id",r)}var p=jQuery(t(r,u,d,o,i,h));if(p.click(function(){s.is(":checked")?e(p).attr("aria-checked",!1):e(p).attr("aria-checked",!0)}),p.keypress(function(a){a.preventDefault(),32!==a.keyCode&&13!==a.keyCode||(s.is(":checked")?(s.prop("checked",!1),e(p).attr("aria-checked",!1)):(s.prop("checked",!0),e(p).attr("aria-checked",!0)))}),s.after(p),c.minimum_width!==!1&&s.next("label[for="+r+"]").css({"min-width":c.minimum_width}),0!=c.same_width&&1==c.label){var k=s.next("label[for="+r+"]"),m=a(k.find("span.labelauty-unchecked")),y=a(k.find("span.labelauty-checked"));m>y?k.find("span.labelauty-checked").width(m):k.find("span.labelauty-unchecked").width(y)}})}}(jQuery);