text: !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?e(exports,require("lit-element/lit-element.js"),require("@lrnwebcomponents/es-global-bridge/es-global-bridge.js"),require("crypto"),require("buffer")):"function"==typeof define&&define.amd?define(["exports","lit-element/lit-element.js","@lrnwebcomponents/es-global-bridge/es-global-bridge.js","crypto","buffer"],e):e((t=t||self).PaperAvatar={},t.litElement_js,null,t.crypto,t.buffer)}(this,function(t,e,n,r,i){"use strict";function o(t){return(o="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function s(t,e,n){return e&&a(t.prototype,e),n&&a(t,n),t}function l(t){return(l=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function h(t,e){return(h=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function f(t,e){return!e||"object"!=typeof e&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function u(t,e,n){return(u="undefined"!=typeof Reflect&&Reflect.get?Reflect.get:function(t,e,n){var r=function(t,e){for(;!Object.prototype.hasOwnProperty.call(t,e)&&null!==(t=l(t)););return t}(t,e);if(r){var i=Object.getOwnPropertyDescriptor(r,e);return i.get?i.get.call(n):i.value}})(t,e,n||t)}function c(t,e){return e||(e=t.slice(0)),Object.freeze(Object.defineProperties(t,{raw:{value:Object.freeze(e)}}))}r=r&&r.hasOwnProperty("default")?r.default:r,i=i&&i.hasOwnProperty("default")?i.default:i;var d="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};var p;(function(t){!function(){function e(t){if(t)b[0]=b[16]=b[1]=b[2]=b[3]=b[4]=b[5]=b[6]=b[7]=b[8]=b[9]=b[10]=b[11]=b[12]=b[13]=b[14]=b[15]=0,this.blocks=b,this.buffer8=s;else if(h){var e=new ArrayBuffer(68);this.buffer8=new Uint8Array(e),this.blocks=new Uint32Array(e)}else this.blocks=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];this.h0=this.h1=this.h2=this.h3=this.start=this.bytes=0,this.finalized=this.hashed=!1,this.first=!0}var n="object"==("undefined"==typeof window?"undefined":o(window))?window:{},a=!n.JS_MD5_NO_NODE_JS&&"object"==("undefined"==typeof process?"undefined":o(process))&&process.versions&&process.versions.node;a&&(n=d);var s,l=!n.JS_MD5_NO_COMMON_JS&&t.exports,h=!n.JS_MD5_NO_ARRAY_BUFFER&&"undefined"!=typeof ArrayBuffer,f="0123456789abcdef".split(""),u=[128,32768,8388608,-2147483648],c=[0,8,16,24],p=["hex","array","digest","buffer","arrayBuffer"],b=[];if(h){var y=new ArrayBuffer(68);s=new Uint8Array(y),b=new Uint32Array(y)}var v=function(t){return function(n){return new e(!0).update(n)[t]()}},w=function(t){var e=r,n=i.Buffer;return function(r){if("string"==typeof r)return e.createHash("md5").update(r,"utf8").digest("hex");if(r.constructor===ArrayBuffer)r=new Uint8Array(r);else if(void 0===r.length)return t(r);return e.createHash("md5").update(new n(r)).digest("hex")}};e.prototype.update=function(t){if(!this.finalized){var e="string"!=typeof t;e&&t.constructor==n.ArrayBuffer&&(t=new Uint8Array(t));for(var r,i,o=0,a=t.length||0,s=this.blocks,l=this.buffer8;a>o;){if(this.hashed&&(this.hashed=!1,s[0]=s[16],s[16]=s[1]=s[2]=s[3]=s[4]=s[5]=s[6]=s[7]=s[8]=s[9]=s[10]=s[11]=s[12]=s[13]=s[14]=s[15]=0),e)if(h)for(i=this.start;a>o&&64>i;++o)l[i++]=t[o];else for(i=this.start;a>o&&64>i;++o)s[i>>2]|=t[o]<<c[3&i++];else if(h)for(i=this.start;a>o&&64>i;++o)128>(r=t.charCodeAt(o))?l[i++]=r:2048>r?(l[i++]=192|r>>6,l[i++]=128|63&r):55296>r||r>=57344?(l[i++]=224|r>>12,l[i++]=128|r>>6&63,l[i++]=128|63&r):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++o)),l[i++]=240|r>>18,l[i++]=128|r>>12&63,l[i++]=128|r>>6&63,l[i++]=128|63&r);else for(i=this.start;a>o&&64>i;++o)128>(r=t.charCodeAt(o))?s[i>>2]|=r<<c[3&i++]:2048>r?(s[i>>2]|=(192|r>>6)<<c[3&i++],s[i>>2]|=(128|63&r)<<c[3&i++]):55296>r||r>=57344?(s[i>>2]|=(224|r>>12)<<c[3&i++],s[i>>2]|=(128|r>>6&63)<<c[3&i++],s[i>>2]|=(128|63&r)<<c[3&i++]):(r=65536+((1023&r)<<10|1023&t.charCodeAt(++o)),s[i>>2]|=(240|r>>18)<<c[3&i++],s[i>>2]|=(128|r>>12&63)<<c[3&i++],s[i>>2]|=(128|r>>6&63)<<c[3&i++],s[i>>2]|=(128|63&r)<<c[3&i++]);this.lastByteIndex=i,this.bytes+=i-this.start,i>=64?(this.start=i-64,this.hash(),this.hashed=!0):this.start=i}return this}},e.prototype.finalize=function(){if(!this.finalized){this.finalized=!0;var t=this.blocks,e=this.lastByteIndex;t[e>>2]|=u[3&e],e>=56&&(this.hashed||this.hash(),t[0]=t[16],t[16]=t[1]=t[2]=t[3]=t[4]=t[5]=t[6]=t[7]=t[8]=t[9]=t[10]=t[11]=t[12]=t[13]=t[14]=t[15]=0),t[14]=this.bytes<<3,this.hash()}},e.prototype.hash=function(){var t,e,n,r,i,o,a=this.blocks;this.first?e=((e=((t=((t=a[0]-680876937)<<7|t>>>25)-271733879<<0)^(n=((n=(-271733879^(r=((r=(-1732584194^2004318071&t)+a[1]-117830708)<<12|r>>>20)+t<<0)&(-271733879^t))+a[2]-1126478375)<<17|n>>>15)+r<<0)&(r^t))+a[3]-1316259209)<<22|e>>>10)+n<<0:(t=this.h0,e=this.h1,n=this.h2,e=((e+=((t=((t+=((r=this.h3)^e&(n^r))+a[0]-680876936)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+a[1]-389564586)<<12|r>>>20)+t<<0)&(t^e))+a[2]+606105819)<<17|n>>>15)+r<<0)&(r^t))+a[3]-1044525330)<<22|e>>>10)+n<<0),e=((e+=((t=((t+=(r^e&(n^r))+a[4]-176418897)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+a[5]+1200080426)<<12|r>>>20)+t<<0)&(t^e))+a[6]-1473231341)<<17|n>>>15)+r<<0)&(r^t))+a[7]-45705983)<<22|e>>>10)+n<<0,e=((e+=((t=((t+=(r^e&(n^r))+a[8]+1770035416)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+a[9]-1958414417)<<12|r>>>20)+t<<0)&(t^e))+a[10]-42063)<<17|n>>>15)+r<<0)&(r^t))+a[11]-1990404162)<<22|e>>>10)+n<<0,e=((e+=((t=((t+=(r^e&(n^r))+a[12]+1804603682)<<7|t>>>25)+e<<0)^(n=((n+=(e^(r=((r+=(n^t&(e^n))+a[13]-40341101)<<12|r>>>20)+t<<0)&(t^e))+a[14]-1502002290)<<17|n>>>15)+r<<0)&(r^t))+a[15]+1236535329)<<22|e>>>10)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+a[1]-165796510)<<5|t>>>27)+e<<0)^e))+a[6]-1069501632)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+a[11]+643717713)<<14|n>>>18)+r<<0)^r))+a[0]-373897302)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+a[5]-701558691)<<5|t>>>27)+e<<0)^e))+a[10]+38016083)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+a[15]-660478335)<<14|n>>>18)+r<<0)^r))+a[4]-405537848)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+a[9]+568446438)<<5|t>>>27)+e<<0)^e))+a[14]-1019803690)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+a[3]-187363961)<<14|n>>>18)+r<<0)^r))+a[8]+1163531501)<<20|e>>>12)+n<<0,e=((e+=((r=((r+=(e^n&((t=((t+=(n^r&(e^n))+a[13]-1444681467)<<5|t>>>27)+e<<0)^e))+a[2]-51403784)<<9|r>>>23)+t<<0)^t&((n=((n+=(t^e&(r^t))+a[7]+1735328473)<<14|n>>>18)+r<<0)^r))+a[12]-1926607734)<<20|e>>>12)+n<<0,e=((e+=((o=(r=((r+=((i=e^n)^(t=((t+=(i^r)+a[5]-378558)<<4|t>>>28)+e<<0))+a[8]-2022574463)<<11|r>>>21)+t<<0)^t)^(n=((n+=(o^e)+a[11]+1839030562)<<16|n>>>16)+r<<0))+a[14]-35309556)<<23|e>>>9)+n<<0,e=((e+=((o=(r=((r+=((i=e^n)^(t=((t+=(i^r)+a[1]-1530992060)<<4|t>>>28)+e<<0))+a[4]+1272893353)<<11|r>>>21)+t<<0)^t)^(n=((n+=(o^e)+a[7]-155497632)<<16|n>>>16)+r<<0))+a[10]-1094730640)<<23|e>>>9)+n<<0,e=((e+=((o=(r=((r+=((i=e^n)^(t=((t+=(i^r)+a[13]+681279174)<<4|t>>>28)+e<<0))+a[0]-358537222)<<11|r>>>21)+t<<0)^t)^(n=((n+=(o^e)+a[3]-722521979)<<16|n>>>16)+r<<0))+a[6]+76029189)<<23|e>>>9)+n<<0,e=((e+=((o=(r=((r+=((i=e^n)^(t=((t+=(i^r)+a[9]-640364487)<<4|t>>>28)+e<<0))+a[12]-421815835)<<11|r>>>21)+t<<0)^t)^(n=((n+=(o^e)+a[15]+530742520)<<16|n>>>16)+r<<0))+a[2]-995338651)<<23|e>>>9)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+a[0]-198630844)<<6|t>>>26)+e<<0)|~n))+a[7]+1126891415)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+a[14]-1416354905)<<15|n>>>17)+r<<0)|~t))+a[5]-57434055)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+a[12]+1700485571)<<6|t>>>26)+e<<0)|~n))+a[3]-1894986606)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+a[10]-1051523)<<15|n>>>17)+r<<0)|~t))+a[1]-2054922799)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+a[8]+1873313359)<<6|t>>>26)+e<<0)|~n))+a[15]-30611744)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+a[6]-1560198380)<<15|n>>>17)+r<<0)|~t))+a[13]+1309151649)<<21|e>>>11)+n<<0,e=((e+=((r=((r+=(e^((t=((t+=(n^(e|~r))+a[4]-145523070)<<6|t>>>26)+e<<0)|~n))+a[11]-1120210379)<<10|r>>>22)+t<<0)^((n=((n+=(t^(r|~e))+a[2]+718787259)<<15|n>>>17)+r<<0)|~t))+a[9]-343485551)<<21|e>>>11)+n<<0,this.first?(this.h0=t+1732584193<<0,this.h1=e-271733879<<0,this.h2=n-1732584194<<0,this.h3=r+271733878<<0,this.first=!1):(this.h0=this.h0+t<<0,this.h1=this.h1+e<<0,this.h2=this.h2+n<<0,this.h3=this.h3+r<<0)},e.prototype.hex=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return f[t>>4&15]+f[15&t]+f[t>>12&15]+f[t>>8&15]+f[t>>20&15]+f[t>>16&15]+f[t>>28&15]+f[t>>24&15]+f[e>>4&15]+f[15&e]+f[e>>12&15]+f[e>>8&15]+f[e>>20&15]+f[e>>16&15]+f[e>>28&15]+f[e>>24&15]+f[n>>4&15]+f[15&n]+f[n>>12&15]+f[n>>8&15]+f[n>>20&15]+f[n>>16&15]+f[n>>28&15]+f[n>>24&15]+f[r>>4&15]+f[15&r]+f[r>>12&15]+f[r>>8&15]+f[r>>20&15]+f[r>>16&15]+f[r>>28&15]+f[r>>24&15]},e.prototype.toString=e.prototype.hex,e.prototype.digest=function(){this.finalize();var t=this.h0,e=this.h1,n=this.h2,r=this.h3;return[255&t,t>>8&255,t>>16&255,t>>24&255,255&e,e>>8&255,e>>16&255,e>>24&255,255&n,n>>8&255,n>>16&255,n>>24&255,255&r,r>>8&255,r>>16&255,r>>24&255]},e.prototype.array=e.prototype.digest,e.prototype.arrayBuffer=function(){this.finalize();var t=new ArrayBuffer(16),e=new Uint32Array(t);return e[0]=this.h0,e[1]=this.h1,e[2]=this.h2,e[3]=this.h3,t},e.prototype.buffer=e.prototype.arrayBuffer;var g=function(){var t=v("hex");a&&(t=w(t)),t.create=function(){return new e},t.update=function(e){return t.create().update(e)};for(var n=0;n<p.length;++n){var r=p[n];t[r]=v(r)}return t}();l?t.exports=g:n.md5=g}()})(p={exports:{}},p.exports);function b(){var t=c(['\n        :host {\n          --paper-avatar-width: 40px;\n          display: inline-block;\n          box-sizing: border-box;\n          position: relative;\n          width: var(--paper-avatar-width);\n          height: var(--paper-avatar-width);\n          border-radius: 50%;\n          cursor: default;\n          background-color: var(\n            --paper-avatar-color,\n            var(--paper-avatar-bgcolor)\n          );\n          -webkit-user-select: none;\n          -moz-user-select: none;\n          -ms-user-select: none;\n          user-select: none;\n        }\n\n        :host > * {\n          pointer-events: none;\n        }\n        img {\n          width: var(--paper-avatar-width);\n          height: var(--paper-avatar-width);\n        }\n        #label,\n        #img,\n        #jdenticon {\n          position: absolute;\n          top: 0;\n          left: 0;\n          right: 0;\n          bottom: 0;\n          width: 100%;\n          height: 100%;\n          border-radius: 50%;\n        }\n        #label {\n          overflow: hidden;\n          display: -ms-flexbox;\n          display: -webkit-flex;\n          display: flex;\n          -webkit-flex-direction: row;\n          -ms-flex-direction: row;\n          flex-direction: row;\n          -webkit-align-items: center;\n          -ms-flex-align: center;\n          align-items: center;\n        }\n        #label span {\n          display: block;\n          width: 100%;\n          font-weight: 400;\n          color: var(--paper-avatar-text-color, rgba(255, 255, 255, 0.8));\n          text-transform: capitalize;\n          font-family: "Roboto", "Noto", sans-serif;\n          -webkit-font-smoothing: antialiased;\n          text-align: center;\n          font-size: calc(var(--paper-avatar-width) / 1.65);\n        }\n        #jdenticon {\n          width: var(--paper-avatar-width);\n          height: var(--paper-avatar-width);\n        }\n        #jdenticon * {\n          fill: var(\n            --paper-avatar-text-color,\n            rgba(255, 255, 255, 0.8)\n          ) !important;\n        }\n      ']);return b=function(){return t},t}function y(){var t=c(['\n            <img\n              id="img"\n              loading="lazy"\n              src="','"\n              title="','"\n              @load="','"\n              @error="','"\n              alt=""\n            />\n          ']);return y=function(){return t},t}function v(){var t=c(['\n      <div id="label" title="','">\n        <span>','</span>\n      </div>\n      <svg id="jdenticon" width="40" height="40"><slot></slot></svg>\n      ',"\n    "]);return v=function(){return t},t}var w=function(t){function n(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,n),(t=f(this,l(n).call(this))).label=null,t.src=null,t.jdenticonExists=!1,t.twoChars=!1,t.jdenticon=!1,t}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&h(t,e)}(n,e.LitElement),s(n,[{key:"render",value:function(){return e.html(v(),this.label,this._label(this.label),this.src?e.html(y(),this.src,this.label,this._onImgLoad,this._onImgError):"")}}],[{key:"styles",get:function(){return[e.css(b())]}},{key:"tag",get:function(){return"paper-avatar"}}]),s(n,[{key:"updated",value:function(t){var e=this;t.forEach(function(t,n){"label"==n&&e._observerLabel(e[n])})}},{key:"_observerLabel",value:function(t){t&&(this.jdenticonExists&&this.jdenticon&&(this.shadowRoot.querySelector("#label").hidden=!0,window.jdenticon.config={lightness:{color:[1,1],grayscale:[1,1]},saturation:1},window.jdenticon.update(this.shadowRoot.querySelector("#jdenticon"),window.md5(t))),this.style.backgroundColor=this._parseColor(t))}},{key:"pathFromUrl",value:function(t){return t.substring(0,t.lastIndexOf("/")+1)}},{key:"firstUpdated",value:function(t){var e=this.pathFromUrl(decodeURIComponent("undefined"!=typeof document?document.currentScript&&document.currentScript.src||document.baseURI:new("undefined"!=typeof URL?URL:require("url").URL)("file:"+__filename).href)),n="".concat(e,"lib/jdenticon-1.4.0.min.js");window.addEventListener("es-bridge-jdenticon-loaded",this._jdenticonLoaded.bind(this)),window.ESGlobalBridge.requestAvailability(),window.ESGlobalBridge.instance.load("jdenticon",n)}},{key:"disconnectedCallback",value:function(){window.removeEventListener("es-bridge-jdenticon-loaded",this._jdenticonLoaded.bind(this)),u(l(n.prototype),"disconnectedCallback",this).call(this)}},{key:"_jdenticonLoaded",value:function(t){this.jdenticonExists=!0,this._observerLabel(this.label)}},{key:"_label",value:function(t){if(!t)return"";if(this.twoChars){if(this.label.indexOf(" ")>-1){var e=this.label.match(/\b(\w)/g);return e[0]+e[1]}return t.substring(0,2)}return t.charAt(0)}},{key:"_onImgLoad",value:function(t){t.currentTarget.hidden=!1}},{key:"_onImgError",value:function(t){t.currentTarget.hidden=!0}},{key:"_parseColor",value:function(t){for(var e=this.colors?this.colors:["#F44336","#E91E63","#9C27B0","#673AB7","#3F51B5","#2196F3","#03A9F4","#00BCD4","#795548","#009688","#4CAF50","#8BC34A","#CDDC39","#FFEB3B","#FFC107","#FF9800","#FF5722","#9E9E9E","#607D8B"],n=0,r=0;r<t.length;r++)n+=t.charCodeAt(r)<<5;return n>=e.length?e[n%e.length]:e[n]}}],[{key:"properties",get:function(){return{src:{type:String},label:{type:String},jdenticonExists:{type:Boolean},twoChars:{type:Boolean,attribute:"two-chars"},colors:{type:Array},jdenticon:{type:Boolean}}}}]),n}();window.customElements.define(w.tag,w),t.PaperAvatar=w,Object.defineProperty(t,"__esModule",{value:!0})});
  //# sourceMappingURL=paper-avatar.umd.js.map
  