import{u as n,e,n as t,c as s,a as i}from"./linkUtils-wZFFzPQ1.js";const u=new RegExp(`(${t})|${n}|${e}`,"gi"),r=new RegExp(`${n}|${e}`,"gi"),a=new RegExp(`^${e}$`,"gi"),l=new RegExp(t,"gi");function o(n){return{isText:!0,value:n}}function c(n){return{isNewline:!0,key:n}}function p(n,e,t){return!t&&n.match(l)?c(e):n.match(a)?function(n,e){return{isLink:!0,value:n,href:s(n),key:`${n}-${e}`}}(n,e):function(n,e){return{isLink:!0,value:n,href:i(n),key:`${n}-${e}`}}(n,e)}function f(n,e=!1){const t=[],s=e?r:u;let i,a=0;for(;null!==(i=s.exec(n));){let u=i[0];const r=u&&u.endsWith("&quot");i.index>0&&t.push(o(n.slice(0,i.index))),r&&(u=u.slice(0,u.lastIndexOf("&quot"))),t.push(p(u,a,e)),r&&t.push(o("&quot")),n=n.substring(s.lastIndex),s.lastIndex=0,a+=1}return null!=n&&""!==n&&t.push(o(n)),t}function x(n){return n.split(l).map((n,e)=>e%2==0?o(n):c(e))}export{x as a,f as p};
