/** 商品展示名称去除内部 -L 后缀;此处不改商品 id,也不影响后端商品匹配。 */ function e(e) { return typeof e == `string` && /-L\s*$/.test(e); } function t(e) { return typeof e == `string` ? e.replace(/-L\s*$/, ``).trim() : ``; } // 在文本中仅替换已知商品全名,先按长度降序并转义正则,避免短名误伤长名或标识符。 function n(n, r) { if (!n) return ``; let i = [...new Set(r.filter((t) => e(t)).map((e) => e.trim()))].sort( (e, t) => t.length - e.length, ); if (!i.length) return n; let a = i.map((e) => e.replace(/[.*+?^${}()|[\]\\]/g, `\\$&`)).join(`|`), o = RegExp(`(? t(e)); } export { t as n, n as r, e as t };