UNPKG

@vechain/picasso

Version:

General purpose deterministic identity icon library in svg format, mostly for vechain thor addresses

2 lines 3.85 kB
!function(t,i){"object"==typeof exports&&"object"==typeof module?module.exports=i():"function"==typeof define&&define.amd?define([],i):"object"==typeof exports?exports.picasso=i():t.picasso=i()}(self,(function(){return(()=>{var t={984:(t,i,s)=>{"use strict";s.d(i,{default:()=>o});const r=s(996),h=["rgb(244, 67, 54)","rgb(233, 30, 99)","rgb(156, 39, 176)","rgb(103, 58, 183)","rgb(63, 81, 181)","rgb(33, 150, 243)","rgb(3, 169, 244)","rgb(0, 188, 212)","rgb(0, 150, 136)","rgb(76, 175, 80)","rgb(139, 195, 74)","rgb(205, 220, 57)","rgb(255, 193, 7)","rgb(255, 152, 0)","rgb(255, 87, 34)"],o=function(t,i){i=i||h;const s=function(t){if(0===t.length)return 0;let i=0;for(let s=0;s<t.length;s++)i=31*i+t.charCodeAt(s),i%=Math.pow(2,32);return i}(t),o=new r(s);i=i.slice();const e=()=>{const t=Math.floor(i.length*o.random());return i.splice(t,1)[0]},n=`<rect fill="${e()}" width="100" height="100"/>`;let m="";const a=[35,40,45,50,55,60],c=[0,10,20,30,40,50,60,70,80,90,100],l=[30,40,50,60,70];for(let t=0;t<3;t++)m+=`<circle r="${a.splice(Math.floor(a.length*o.random()),1)[0]}" cx="${c.splice(Math.floor(c.length*o.random()),1)[0]}" cy="${l.splice(Math.floor(l.length*o.random()),1)[0]}" fill="${e()}"/>`;return`<svg version="1.1" xmlns="http://www.w3.org/2000/svg" class="picasso" width="100" height="100" viewBox="0 0 100 100"><style>.picasso circle{mix-blend-mode:soft-light;}</style>${n}${m}</svg>`}},996:t=>{var i=function(t){null==t&&(t=(new Date).getTime()),this.N=624,this.M=397,this.MATRIX_A=2567483615,this.UPPER_MASK=2147483648,this.LOWER_MASK=2147483647,this.mt=new Array(this.N),this.mti=this.N+1,t.constructor==Array?this.init_by_array(t,t.length):this.init_seed(t)};i.prototype.init_seed=function(t){for(this.mt[0]=t>>>0,this.mti=1;this.mti<this.N;this.mti++)t=this.mt[this.mti-1]^this.mt[this.mti-1]>>>30,this.mt[this.mti]=(1812433253*((4294901760&t)>>>16)<<16)+1812433253*(65535&t)+this.mti,this.mt[this.mti]>>>=0},i.prototype.init_by_array=function(t,i){var s,r,h;for(this.init_seed(19650218),s=1,r=0,h=this.N>i?this.N:i;h;h--){var o=this.mt[s-1]^this.mt[s-1]>>>30;this.mt[s]=(this.mt[s]^(1664525*((4294901760&o)>>>16)<<16)+1664525*(65535&o))+t[r]+r,this.mt[s]>>>=0,r++,++s>=this.N&&(this.mt[0]=this.mt[this.N-1],s=1),r>=i&&(r=0)}for(h=this.N-1;h;h--)o=this.mt[s-1]^this.mt[s-1]>>>30,this.mt[s]=(this.mt[s]^(1566083941*((4294901760&o)>>>16)<<16)+1566083941*(65535&o))-s,this.mt[s]>>>=0,++s>=this.N&&(this.mt[0]=this.mt[this.N-1],s=1);this.mt[0]=2147483648},i.prototype.random_int=function(){var t,i=new Array(0,this.MATRIX_A);if(this.mti>=this.N){var s;for(this.mti==this.N+1&&this.init_seed(5489),s=0;s<this.N-this.M;s++)t=this.mt[s]&this.UPPER_MASK|this.mt[s+1]&this.LOWER_MASK,this.mt[s]=this.mt[s+this.M]^t>>>1^i[1&t];for(;s<this.N-1;s++)t=this.mt[s]&this.UPPER_MASK|this.mt[s+1]&this.LOWER_MASK,this.mt[s]=this.mt[s+(this.M-this.N)]^t>>>1^i[1&t];t=this.mt[this.N-1]&this.UPPER_MASK|this.mt[0]&this.LOWER_MASK,this.mt[this.N-1]=this.mt[this.M-1]^t>>>1^i[1&t],this.mti=0}return t=this.mt[this.mti++],t^=t>>>11,t^=t<<7&2636928640,t^=t<<15&4022730752,(t^=t>>>18)>>>0},i.prototype.random_int31=function(){return this.random_int()>>>1},i.prototype.random_incl=function(){return this.random_int()*(1/4294967295)},i.prototype.random=function(){return this.random_int()*(1/4294967296)},i.prototype.random_excl=function(){return(this.random_int()+.5)*(1/4294967296)},i.prototype.random_long=function(){return(67108864*(this.random_int()>>>5)+(this.random_int()>>>6))*(1/9007199254740992)},t.exports=i}},i={};function s(r){if(i[r])return i[r].exports;var h=i[r]={exports:{}};return t[r](h,h.exports,s),h.exports}return s.d=(t,i)=>{for(var r in i)s.o(i,r)&&!s.o(t,r)&&Object.defineProperty(t,r,{enumerable:!0,get:i[r]})},s.o=(t,i)=>Object.prototype.hasOwnProperty.call(t,i),s(984)})().default})); //# sourceMappingURL=picasso.min.js.map