You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

2 lines
1.2 KiB

const t=new Map,e="#05c9ac";function n(n){const r=function(t){if(!t||"string"!=typeof t)return e;let n=t.trim();if(n.startsWith("#")||(n=`#${n}`),/^#[0-9A-Fa-f]{6}$/.test(n))return n;if(/^#[0-9A-Fa-f]{3}$/.test(n)){const t=n[1],e=n[2],r=n[3];return`#${t}${t}${e}${e}${r}${r}`}return e}(n||"");if(t.has(r))return t.get(r);if("undefined"==typeof document)return t.set(r,""),"";const f=`data:image/svg+xml;charset=utf-8,${encodeURIComponent(`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 56" width="48" height="56">\n<path fill="${r}" stroke="#ffffff" stroke-width="2" stroke-linejoin="round" d="M24 4C14.6 4 7 11.4 7 20.5C7 32 24 50 24 50S41 32 41 20.5C41 11.4 33.4 4 24 4Z"/>\n<circle cx="24" cy="21" r="7" fill="#ffffff"/>\n<circle cx="24" cy="21" r="3.5" fill="${r}"/>\n</svg>`)}`;return t.set(r,f),f}function r(t,e){const n=t.venue_type_color;return n&&"string"==typeof n&&function(t){if(!t||"string"!=typeof t)return null;let e=t.trim();e.startsWith("#")||(e=`#${e}`);const n=e.match(/^#([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!n)return null;let r=n[1];return 3===r.length&&(r=`${r[0]}${r[0]}${r[1]}${r[1]}${r[2]}${r[2]}`),r.toLowerCase()}(n.trim())?n.trim():e()}export{n as g,r as t};