(function(u,h){function r(t,e,i){t=t||"";e=e||60;var r=["#1abc9c","#2ecc71","#3498db","#9b59b6","#34495e","#16a085","#27ae60","#2980b9","#8e44ad","#2c3e50","#f1c40f","#e67e22","#e74c3c","#ecf0f1","#95a5a6","#f39c12","#d35400","#c0392b","#bdc3c7","#7f8c8d"],a=String(t).split(" "),n,o,c,f,d,l;if(a.length==1){n=a[0]?a[0].charAt(0):"?"}else{n=a[0].charAt(0)+a[1].charAt(0)}if(u.devicePixelRatio){e=e*u.devicePixelRatio}o=(n=="?"?72:n.charCodeAt(0))-64;c=o%20;f=h.createElement("canvas");f.width=e;f.height=e;d=f.getContext("2d");d.fillStyle=i?i:r[c-1];d.fillRect(0,0,f.width,f.height);d.font=Math.round(f.width/2)+"px Arial";d.textAlign="center";d.fillStyle="#FFF";d.fillText(n,e/2,e/1.5);l=f.toDataURL();f=null;return l}r.transform=function(){Array.prototype.forEach.call(h.querySelectorAll("img[avatar]"),function(t,e,i){e=t.getAttribute("avatar");i=t.getAttribute("color");t.src=r(e,t.getAttribute("width"),i);t.removeAttribute("avatar");t.setAttribute("alt",e)})};if(typeof define==="function"&&define.amd){define(function(){return r})}else if(typeof exports!=="undefined"){if(typeof module!="undefined"&&module.exports){exports=module.exports=r}exports.LetterAvatar=r}else{window.LetterAvatar=r;h.addEventListener("DOMContentLoaded",function(t){r.transform()})}})(window,document);