import{t as e}from"./Bcb1m8Xc2.js";function t(t,n,r={}){let{typographic:i=!0}=r,a=new Set([`agent`]);for(let e of n)a.add(e);return(i?e(t):t).replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/\n/g,`<br>`).replace(/@([a-z0-9_-]+)/gi,(e,t)=>a.has(t.toLowerCase())?`<span class="sg-mention">${e}</span>`:e)}function n(e,t){let n=new Set([`agent`]);for(let e of t)n.add(e);let r=0;return e.replace(/(<[^>]+>)|([^<]+)/g,(e,t,i)=>t?(/^<(code|pre|a)[\s/>]/i.test(t)?r++:/^<\/(code|pre|a)>/i.test(t)&&(r=Math.max(0,r-1)),t):!i||r>0?i??``:i.replace(/@([a-z0-9_-]+)/gi,(e,t)=>n.has(t.toLowerCase())?`<span class="sg-mention">${e}</span>`:e))}export{t as n,n as t};