define(["Ti/_","Ti/API","Ti/_/style"],function(e,r,t){var n=require.is,a={innerHTML:1,className:1,value:1},i={classname:"class",htmlfor:"for",tabindex:"tabIndex",readonly:"readOnly"},o={"class":"className","for":"htmlFor",tabindex:"tabIndex",readonly:"readOnly",colspan:"colSpan",frameborder:"frameBorder",rowspan:"rowSpan",valuetype:"valueType"},c={set:function(e,r,u){if(2===arguments.length){for(var s in r)c.set(e,s,r[s]);return e}var l=r.toLowerCase(),d=o[l]||r,p=a[d];return"style"!==d||require.is(u,"String")?p||n(u,"Boolean")||n(u,"Function")?(e[r]=u,e):(e.setAttribute(i[l]||r,u),e):t.set(e,u)},remove:function(e,r){return e.removeAttribute(r),e}};return{create:function(e,r,t,a){var i=t?t.ownerDocument:document;return n(e,"String")&&(e=i.createElement(e)),r&&c.set(e,r),t&&this.place(e,t,a),e},attr:c,place:function(e,r){return r.appendChild(e),e},detach:function(e){return e.parentNode&&e.parentNode.removeChild(e)},destroy:function(e){try{var r=e.ownerDocument.createElement("div");r.appendChild(this.detach(e)||e),r.innerHTML=""}catch(t){}},calculateDistance:function(e,r,t,n){return Math.sqrt(Math.pow(e-t,2)+Math.pow(r-n,2))},unitize:function(e){return isNaN(e-0)||e-0!=e?e:e+"px"},computeSize:function(t,a,i){if(n(t,"Number")&&isNaN(t))return 0;var o=require.is(t);if("String"===o){var c=require("Ti/UI");if(t===c.SIZE)i&&(t=void 0);else{var u=parseFloat(t),s=t.match(/.*(%|mm|cm|em|pt|in|px|dp)$/);switch(s=s?s[1]:"px"){case"%":if(a==c.SIZE)i?void 0:c.SIZE;else if(!require.is(a,"Number"))return void r.error("Could not compute percentage size/position of element.");return u/100*a;case"mm":u/=10;case"cm":return.393700787*u*e.dpi;case"em":case"pt":u/=12;case"pc":u/=6;case"in":return u*e.dpi;case"px":return u;case"dp":return u*e.dpi/96}}}else"Number"!==o&&(t=void 0);return t}}});