import{r as registerInstance,h,H as Host}from"./index-c948674f.js";var RichText=function(){function r(r){var e=this;registerInstance(this,r);this.renderNode=function(r){if("type"in r&&r.type==="text"){var t=(r.text||"").replace(/&nbsp;/g," ");return t}else if("name"in r&&r.name){var n=r.name,i=r.attrs,a=r.children;var o={};var f=[];if(i&&typeof i==="object"){var s=function(r){var e=i[r];if(r==="style"&&typeof e==="string"){var t=e.split(";").map((function(r){return r.trim()})).filter((function(r){return r}));var n={};t.forEach((function(r){if(!r)return;var e=/(.+): *(.+)/g.exec(r);if(!e)return;var t=e[1],i=e[2];var a=t.replace(/-([a-z])/g,(function(){var r=[];for(var e=0;e<arguments.length;e++){r[e]=arguments[e]}return r[1].toUpperCase()}));n[a]=i}));if(Object.keys(n).length){o.style=n}return"continue"}o[r]=e};for(var u in i){s(u)}}if(a&&a.length){f=a.map((function(r){return e.renderNode(r)}))}return h(n,o,f)}return null};this.nodes=undefined}r.prototype.render=function(){var r=this,e=r.nodes,t=r.renderNode;if(Array.isArray(e)){return h(Host,null,e.map((function(r){return t(r)})))}else{return h(Host,{innerHTML:e})}};return r}();export{RichText as taro_rich_text_core};
//# sourceMappingURL=taro-rich-text-core.entry.js.map