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
2.7 KiB

const t=new Map,e=new Map,n="#05c9ac";function f(t){if(!t||"string"!=typeof t)return n;let e=t.trim();if(e.startsWith("#")||(e=`#${e}`),/^#[0-9A-Fa-f]{6}$/.test(e))return e;if(/^#[0-9A-Fa-f]{3}$/.test(e)){const t=e[1],n=e[2],f=e[3];return`#${t}${t}${n}${n}${f}${f}`}return n}function i(t){const n=f(t||"");if(e.has(n))return e.get(n);if("undefined"==typeof document)return e.set(n,""),"";const i=document.createElement("canvas");i.width=48,i.height=56;const a=i.getContext("2d");if(!a)return e.set(n,""),"";const s=24,l=20;a.clearRect(0,0,48,56),a.beginPath(),a.arc(s,l,17,0,2*Math.PI),a.fillStyle="#ffffff",a.fill(),a.beginPath(),a.arc(s,l,14,0,2*Math.PI),a.fillStyle=n,a.fill(),a.beginPath(),a.moveTo(14,31),a.lineTo(s,52),a.lineTo(34,31),a.closePath(),a.fillStyle=n,a.fill(),a.beginPath(),a.arc(s,l,9,0,2*Math.PI),a.fillStyle="#ffffff",a.fill(),a.beginPath(),a.arc(s,l,5,0,2*Math.PI),a.fillStyle=n,a.fill();const r=i.toDataURL("image/png");return e.set(n,r),r}function a(t){var e;if(!t)return t;if(/^https?:\/\//i.test(t))return t;if("undefined"!=typeof window&&(null==(e=window.location)?void 0:e.origin)){const e=t.startsWith("/")?t:`/${t}`;return`${window.location.origin}${e}`}return t}function s(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 f=n[1];return 3===f.length&&(f=`${f[0]}${f[0]}${f[1]}${f[1]}${f[2]}${f[2]}`),f.toLowerCase()}const l={"01a9a5":"/h5/assets/map_sel_01a9a5-D_IShBLl.png","1e71ee":"/h5/assets/map_sel_1e71ee-DZQzw-_V.png","70bd0a":"/h5/assets/map_sel_70bd0a-CIUtKMgY.png","8a4ce8":"/h5/assets/map_sel_8a4ce8-0PyjHHMA.png",f15b3c:"/h5/assets/map_sel_f15b3c-CYxy5W7d.png",ff33ff:"/h5/assets/map_sel_ff33ff-2WBdd7Ry.png",ffd308:"/h5/assets/map_sel_ffd308-D2ZN8WeK.png"};function r(t,e){const n=t.venue_type_color;return n&&"string"==typeof n&&s(n.trim())?n.trim():e()}function o(e){const n=s(e??"");if(n){const t=function(t){const e=l[t];return e?a(e):null}(n);if(t)return t}const i=function(e){const n=f(e||"");if(t.has(n))return t.get(n);if("undefined"==typeof document)return t.set(n,""),"";const i=document.createElement("canvas");i.width=48,i.height=56;const a=i.getContext("2d");if(!a)return t.set(n,""),"";const s=24;a.clearRect(0,0,48,56),a.beginPath(),a.arc(s,18,14,0,2*Math.PI),a.fillStyle="#ffffff",a.fill(),a.beginPath(),a.arc(s,18,12,0,2*Math.PI),a.fillStyle=n,a.fill(),a.beginPath(),a.moveTo(16,28),a.lineTo(s,50),a.lineTo(32,28),a.closePath(),a.fillStyle=n,a.fill(),a.beginPath(),a.arc(21,15,3,0,2*Math.PI),a.fillStyle="rgba(255,255,255,0.35)",a.fill();const l=i.toDataURL("image/png");return t.set(n,l),l}(e);return i||a("/h5/assets/map_cur-l874x3m8.png")}export{i as g,o as m,r as t};