YUI.add("aui-rating-base",function(e,t){var n=e.Lang,r=n.isBoolean,i=n.isNumber,s=n.isString,o=function(t){return t instanceof e.NodeList},u=function(t){return t instanceof e.Node},a="a",f="boundingBox",l="canReset",c="contentBox",h="defaultSelected",p="disabled",d=".",v="elements",m="href",g="id",y="input",b="inputName",w="label",E="labelNode",t="name",S="nodeName",x="rating",T="selectedIndex",N="showTitle",C="size",k="",L="title",A="value",O="itemClick",M="itemOut",_="itemOver",D="itemSelect",P=e.getClassName,H=P("icon","star"),B=P("icon","star","empty"),j=P(x,w),F='<a class="{cssClasses}"></a>',I='<span class="'+j+'"></span>',q=e.Component.create({NAME:"rating",ATTRS:{disabled:{value:!1,validator:r},canReset:{value:!0,validator:r},cssClasses:{value:{element:B,hover:H,off:B,on:H}},defaultSelected:{value:0,writeOnce:!0,validator:i},elements:{validator:o},hiddenInput:{validator:u},inputName:{value:k,validator:s},label:{value:k,validator:s},labelNode:{valueFn:function(){return e.Node.create(I)},validator:u},selectedIndex:{value:-1,validator:i},showTitle:{value:!0,validator:r},size:{value:5,validator:function(e){return i(e)&&e>0}},title:null,value:null},HTML_PARSER:{elements:function(e){return e.all("a")},label:function(e){var t=e.one(d+j);if(t)return t.html()},labelNode:d+j},prototype:{BOUNDING_TEMPLATE:"<span></span>",CONTENT_TEMPLATE:"<span></span>",initializer:function(){var e=this;e.inputElementsData={},e.after("labelChange",this._afterSetLabel)},renderUI:function(){var e=this;e._parseInputElements(),e._renderLabel(),e._renderElements()},bindUI:function(){var e=this;e._createEvents(),e.on({click:e._handleClickEvent,mouseover:e._handleMouseOverEvent,mouseout:e._handleMouseOutEvent})},syncUI:function(){var e=this;e._syncElements(),e._syncLabelUI()},clearSelection:function(){var e=this,t=e.get("cssClasses");e.get(v).each(function(e){e.removeClass(t.on),e.removeClass(t.hover),e.addClass(t.element)})},select:function(e){var t=this,n=t.get(T),r=t.get(l);r&&n===e&&(e=-1),t.set(T,e);var i=t.get(T),s=t._getInputData(i),o=L in s?s.title:k,u=A in s?s.value:i;t.fillTo(i),t.set(L,o),t.set(A,u);var a=t.get("hiddenInput");a.setAttribute(L,o),a.setAttribute(A,u)},fillTo:function(e,t){var n=this,r=n.get("cssClasses");n.clearSelection(),e>=0&&n.get(v).some(function(n,i){return n.addClass(t||r.on),n.removeClass(r.element),i===Math.round(e)})},indexOf:function(e){var t=this;return t.get(v).indexOf(e)},_canFireCustomEvent:function(e){var t=this,n=e.domEvent.target;return!t.get(p)&&n.test("a")},_createElements:function(){var t=this,r=t.get("cssClasses"),i=this.get(C),s=[];for(var o=0;o<i;o++)s.push(n.sub(F,{cssClasses:r.element}));return e.NodeList.create(s.join(k))},_createEvents:function(){var e=this,t=function(t,n){e.publish(t,{defaultFn:n,queuable:!1,emitFacade:!0,bubbles:!0})};t(O,this._defRatingItemClickFn),t(D,this._defRatingItemSelectFn),t(_,this._defRatingItemOverFn),t(M,this._defRatingItemOutFn)},_defRatingItemClickFn:function(e){var t=this,n=e.domEvent;t.fire(D,{delegateEvent:e,domEvent:n,ratingItem:n.target})},_defRatingItemSelectFn:function(e){var t=this,n=e.domEvent.target;t.select(t.indexOf(n))},_defRatingItemOutFn:function(){var e=this;e.fillTo(e.get(T))},_defRatingItemOverFn:function(e){var t=this,n=t.get("cssClasses"),r=t.indexOf(e.domEvent.target);t.fillTo(r,n.hover)},_parseInputElements:function(){var n=this,r=n.get(f),i=r.all(y),s=i.size(),o=n.get(b),u=e.Node.create('<input type="hidden" />');if(s>0){o=o||i.item(0).getAttribute(t),n.set(C,s);var a=r.getElementsByTagName("label");i.each(function(e,t){var r=e.get(g),i=k;if(r){var s=a.filter('[for="'+r+'"]');s.size()&&(i=s.item(0).html())}n.inputElementsData[t]={content:i,value:e.getAttribute(A)||t,title:e.getAttribute(L)}}),a.remove(!0),i.remove(!0)}o&&(u.setAttribute(t,o),r.appendChild(u)),n.set("hiddenInput",u)},_renderLabel:function(){var e=this;e.get(c).setContent(e.get(E))},_renderElements:function(){var e=this,t=e.get(c),n=e.get(v);if(!n||!n.size())n=e._createElements(),e.set(v,n);n.each(function(t,n){var r=e._getInputData(n),i=r.content,s=r.title||e.get(L)||i;s&&e.get(N)&&t.setAttribute(L,s),!t.attr(m)&&t.get(S).toLowerCase()===a&&t.setAttribute("onclick","return false;")}),t.append(n.getDOM())},_syncElements:function(){var e=this,t=e.get(h)-1;e.set(T,t),e.select()},_syncLabelUI:function(){var e=this,t=e.get(w);e.get(E).html(t)},_getInputData:function(e){var t=this;return t.inputElementsData[e]||{}},_handleClickEvent:function(e){var t=this,n=e.domEvent;t._canFireCustomEvent(e)?t.fire(O,{delegateEvent:e,domEvent:n}):n.preventDefault()},_handleMouseOutEvent:function(e){var t=this;t._canFireCustomEvent(e)&&t.fire(M,{delegateEvent:e,domEvent:e.domEvent})},_handleMouseOverEvent:function(e){var t=this;t._canFireCustomEvent(e)&&t.fire(_,{delegateEvent:e,domEvent:e.domEvent})},_afterSetLabel:function(){this._syncLabelUI()}}});e.Rating=q,e.StarRating=q},"2.0.0",{requires:["widget-htmlparser","widget-uievents","aui-component","aui-node-base"],skinnable:!0});
