import{r as t,h as n,H as e}from"./p-78e3ebb9.js";const r=class{constructor(e){t(this,e);this.renderNode=t=>{if("type"in t&&t.type==="text"){const n=(t.text||"").replace(/&nbsp;/g," ");return n}else if("name"in t&&t.name){const{name:e,attrs:r,children:s}=t;const o={};let i=[];if(r&&typeof r==="object"){for(const t in r){const n=r[t];if(t==="style"&&typeof n==="string"){const t=n.split(";").map((t=>t.trim())).filter((t=>t));const e={};t.forEach((t=>{if(!t)return;const n=/(.+): *(.+)/g.exec(t);if(!n)return;const[,r,s]=n;const o=r.replace(/-([a-z])/g,((...t)=>t[1].toUpperCase()));e[o]=s}));if(Object.keys(e).length){o.style=e}continue}o[t]=n}}if(s&&s.length){i=s.map((t=>this.renderNode(t)))}return n(e,o,i)}return null};this.nodes=undefined}render(){const{nodes:t,renderNode:r}=this;if(Array.isArray(t)){return n(e,null,t.map((t=>r(t))))}else{return n(e,{innerHTML:t})}}};export{r as taro_rich_text_core};
//# sourceMappingURL=p-663e27a0.entry.js.map