"use strict";var e=require("./linkUtils-DWJ_yIwJ.js");const n=new RegExp(`(${e.newLineRegexString})|${e.urlRegexString}|${e.emailRegexString}`,"gi"),t=new RegExp(`${e.urlRegexString}|${e.emailRegexString}`,"gi"),i=new RegExp(`^${e.emailRegexString}$`,"gi"),r=new RegExp(e.newLineRegexString,"gi");function u(e){return{isText:!0,value:e}}function s(e){return{isNewline:!0,key:e}}function l(n,t,u){return!u&&n.match(r)?s(t):n.match(i)?function(n,t){return{isLink:!0,value:n,href:e.createEmailHref(n),key:`${n}-${t}`}}(n,t):function(n,t){return{isLink:!0,value:n,href:e.createHttpHref(n),key:`${n}-${t}`}}(n,t)}exports.parseToFormattedLinkifiedParts=function(e,i=!1){const r=[],s=i?t:n;let g,a=0;for(;null!==(g=s.exec(e));){let n=g[0];const t=n&&n.endsWith("&quot");g.index>0&&r.push(u(e.slice(0,g.index))),t&&(n=n.slice(0,n.lastIndexOf("&quot"))),r.push(l(n,a,i)),t&&r.push(u("&quot")),e=e.substring(s.lastIndex),s.lastIndex=0,a+=1}return null!=e&&""!==e&&r.push(u(e)),r},exports.parseToFormattedParts=function(e){return e.split(r).map((e,n)=>n%2==0?u(e):s(n))};
