define(["Ti/_/declare","Ti/_/UI/FontWidget","Ti/_/dom","Ti/_/css","Ti/_/style","Ti/_/lang","Ti/Locale","Ti/UI"],function(t,e,i,o,s,n,r,a){var h=s.set,d=i.unitize,_=2,T={post:"_setText"};return t("Ti.UI.Label",e,{constructor:function(){this._add(this._textContainer=a.createView({width:a.INHERIT,height:a.SIZE,center:{y:"50%"}}));var t=this,e=this._textContainerDomNode=this._textContainer.domNode;t._textContainer._getContentSize=function(i){var o=t._textContainerDomNode.innerHTML,s=t._measureText(o,e,t._hasSizeWidth()?void 0:i);return{width:s.width,height:s.height}},this._addStyleableDomNode(e),h(e,"overflow","visible"),this.wordWrap=!0},_defaultWidth:a.SIZE,_defaultHeight:a.SIZE,_getText:function(){var t,e,i=0,o=0,s=r._getString(this.textid,this.text);if(void 0===s)return"";for(s+="";o<s.length;)if("	"===s[o]){var n="",a=_-e%_;for(t=0;a>t;t++)n+="&nbsp;";s=s.substring(0,o)+n+s.substring(o+1),o+=n.length,e+=a}else"\n"===s[o]?(s=s.substring(0,o)+"<br/>"+s.substring(o+1),o+=5,i=o,e=0):(o++,e++);return s.match(/<br\/>$/)&&(s+="&nbsp;"),s},_setText:function(){this._textContainerDomNode.innerHTML=this._getText(),this._triggerLayout()},_setTextShadow:function(){var t=this.shadowColor&&""!==this.shadowColor?this.shadowColor:void 0;h(this._textContainerDomNode,"textShadow",this.shadowOffset||t?(this.shadowOffset?d(this.shadowOffset.x)+" "+d(this.shadowOffset.y):"0px 0px")+" "+(this.shadowRadius?d(this.shadowRadius):"0.1em")+" "+n.val(t,"black"):"")},properties:{ellipsize:{set:function(t){return h(this._textContainerDomNode,"textOverflow",t?"ellipsis":"clip"),t},value:!0},html:{set:function(t){return this._textContainerDomNode.innerHTML=t,this._hasSizeDimensions()&&this._triggerLayout(),t}},shadowColor:{post:"_setTextShadow"},shadowOffset:{post:"_setTextShadow"},shadowRadius:{post:"_setTextShadow"},text:T,textAlign:{set:function(t){return h(this._textContainerDomNode,"textAlign",/(center|right)/.test(t)?t:"left"),t}},textid:T,wordWrap:{set:function(t){return h(this._textContainerDomNode,"whiteSpace",t?"normal":"nowrap"),t}},verticalAlign:{set:function(t){var e,i,o=this.center||{},s=this._textContainer;switch(t){case a.TEXT_VERTICAL_ALIGNMENT_TOP:e=0;break;case a.TEXT_VERTICAL_ALIGNMENT_CENTER:o.y="50%";break;case a.TEXT_VERTICAL_ALIGNMENT_BOTTOM:i=0}return s.top=e,s.center=o,s.bottom=i,t},value:a.TEXT_VERTICAL_ALIGNMENT_CENTER}}})});