Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}}),require(`../../chunk-Bmb41Sf3.cjs`);const e=require(`../../common/emoji/index.cjs`),t=require(`../icon/icon-constants.cjs`),n=require(`../emoji/emoji.cjs`);let r=require(`vue`);var i=(0,r.h)((0,r.resolveDynamicComponent)(null)).type,a={compatConfig:{MODE:3},name:`DtEmojiTextWrapper`,components:{DtEmoji:n.default},props:{elementType:{type:String,default:`div`},size:{type:String,default:`500`,validator:e=>Object.keys(t.ICON_SIZE_MODIFIERS).includes(e)}},data(){return{loadingEmojiJson:!0}},async created(){this.loadingEmojiJson=!1},methods:{replaceDtEmojis(e,t){if(!e.length)return t;let i=e.map(e=>e.replace(/\*/g,`\\*`)),a=RegExp(`(${i.join(`|`)})`,`g`);return t.split(a).filter(e=>e.trim()!==``).map(t=>e.includes(t)?(0,r.h)(n.default,{code:t,size:this.size}):(0,r.h)(`span`,{class:`d-emoji-text-wrapper__text`},t))},searchVNodes(e){if(!e)return;if(typeof e==`string`)return this.searchCodes(e);if(e.type===i)return e;if(typeof e.type==`symbol`)return this.searchCodes(e.children);if(e.props?.innerHTML)return this.searchVNodes(e.props.innerHTML);let t=Array.isArray(e.children)?e.children:[e.children];return(0,r.h)(e.type,e.props,t.map(e=>this.searchVNodes(e)))},replaceVueComponentVNodeContent(){},searchCodes(t){let n=e.findShortCodes(t),r=e.findEmojis(t),i=[...n,...r];return i.length===0?t:this.replaceDtEmojis(i,t)}},render(){let e=this.$slots.default?this.$slots.default():[];return(0,r.h)(this.elementType,{"data-qa":`emoji-text-wrapper`,class:`d-emoji-text-wrapper`},this.loadingEmojiJson?e:e.map(e=>this.searchVNodes(e)))}};exports.default=a;
//# sourceMappingURL=emoji-text-wrapper.cjs.map