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
1006 B

function t(t){if(!t||"string"!=typeof t)return"";const e="max-width:100%;height:auto;display:block;vertical-align:top;";return t.replace(/<img\b([\s\S]*?)(\/>|>)/gi,(t,i,r)=>{const n=String(i).trim();if(/style\s*=/i.test(n))return/max-width\s*:/i.test(n)?t:t.replace(/style\s*=\s*(["'])([\s\S]*?)\1/i,(t,i,r)=>/max-width/i.test(r)?t:`style=${i}${r};${e}${i}`);return`<img ${n} style="${e}"${"/>"===r?" />":">"}`})}function e(t){if(!t||!String(t).trim())return!1;return String(t).replace(/<[^>]+>/g," ").replace(/&nbsp;/gi," ").replace(/\s+/g," ").trim().length>0}function i(i){if(null==i||""===i)return"";const r=String(i);let n="";if(/<[a-z][\s\S]*>/i.test(r)){n=`<div style="font-size:13px;color:#2c2c2c;line-height:1.8;">${t(r)}</div>`}else{const t=function(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}(r);n=`<div style="white-space:pre-wrap;font-size:13px;color:#2c2c2c;line-height:1.8;">${t}</div>`}return e(n)?n:""}export{i as b,e as h,t as n};