"use strict";const e=require("../../../../common/vendor.js"),t=require("./default-emoji.js"),r=require("./locales/zh_cn.js"),s=require("../../../utils/env.js"),n=t.DEFAULT_BASIC_EMOJI_URL,o=t.DEFAULT_BASIC_EMOJI_URL_MAPPING;exports.parseTextToRenderArray=e=>{const t=/\[([^\]]+)\]/g,r=[];let s,i=0;for(;null!==(s=t.exec(e));){const u=s.index,c=t.lastIndex,a=s[0];u>i&&r.push({type:"text",content:e.substring(i,u)});const l=n+o[a];l?r.push({type:"image",content:l,emojiKey:a}):r.push({type:"text",content:a}),i=c,t.lastIndex=i}return i<e.length&&r.push({type:"text",content:e.substring(i)}),r},exports.transformTextWithEmojiNamesToKeys=e=>{if(!e)return"";const r=/(\[.+?\])/g;let s=e;return r.test(e)&&(s=e.replace(r,(e=>t.BASIC_EMOJI_NAME_TO_KEY_MAPPING[e]||e))),s},exports.transformTextWithKeysToEmojiNames=t=>{if(!t)return"";const n=/(\[.+?\])/g;let i=t;return n.test(t)&&(i=t.replace(n,(t=>{return o[t]?(n=t,s.isWeChat?r.Emoji[n]:e.Wt.t(`Emoji.${n}`)):t;var n}))),i};
