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