"use strict";function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,r){if(e){if("string"==typeof e)return _arrayLikeToArray(e,r);var n=Object.prototype.toString.call(e).slice(8,-1);return"Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n?Array.from(e):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?_arrayLikeToArray(e,r):void 0}}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,r){(null==r||r>e.length)&&(r=e.length);for(var n=0,t=new Array(r);n<r;n++)t[n]=e[n];return t}Object.defineProperty(exports,"__esModule",{value:!0}),exports.normalizeDynamicEmojiToken=exports.getSingleDynamicEmojiToken=exports.getDynamicEmojiView=void 0;var DYNAMIC_EMOJI_BASE_URL="https://lf6-cdn-tos.douyinstatic.com/obj/livesaas/dynamic_large_",DYNAMIC_EMOJI_SET_ZH=["赞~","送心~","灵光一闪~","惊喜~","送花花~","强~"],DYNAMIC_EMOJI_SET_ZH_HANT=["贊~","送心~","靈光一閃~","驚喜~","送花花~","強~"],DYNAMIC_EMOJI_SET_EN=["Like~","Support~","Witty~","Wow~","Flower~","Praise~"],DYNAMIC_EMOJI_SETS={zh:DYNAMIC_EMOJI_SET_ZH,"zh-Hant":DYNAMIC_EMOJI_SET_ZH_HANT,en:DYNAMIC_EMOJI_SET_EN},DYNAMIC_EMOJI_IMAGES=["".concat(DYNAMIC_EMOJI_BASE_URL,"1.gif"),"".concat(DYNAMIC_EMOJI_BASE_URL,"2.gif"),"".concat(DYNAMIC_EMOJI_BASE_URL,"3.gif"),"".concat(DYNAMIC_EMOJI_BASE_URL,"4.gif"),"".concat(DYNAMIC_EMOJI_BASE_URL,"5.gif"),"".concat(DYNAMIC_EMOJI_BASE_URL,"6.gif")],DYNAMIC_EMOJI_TEXT_GRADIENTS=["linear-gradient(90deg, #FB733C 2.78%, #E81F3A 100%)","linear-gradient(90deg, #FF4370 2.78%, #FF7121 100%)","linear-gradient(90deg, #FF8310 2.78%, #F45800 100%)","linear-gradient(90deg, #C662E9 2.78%, #FF508F 100%)","linear-gradient(90deg, #FF4370 2.78%, #FF7121 100%)","linear-gradient(90deg, #1EC3F8 2.78%, #2D5BFF 83.29%)"],DYNAMIC_EMOJI_TEXT_COLORS=["#e81f3a","#ff4370","#f45800","#c662e9","#ff4370","#2d5bff"],normalizeDynamicEmojiToken=function(e){return String(e||"").replace(/^\[|\]$/g,"")};exports.normalizeDynamicEmojiToken=normalizeDynamicEmojiToken;var getDynamicEmojiIndex=function(e){for(var r,n=normalizeDynamicEmojiToken(e),t=function(e){if(Object.keys(DYNAMIC_EMOJI_SETS).some(function(r){return DYNAMIC_EMOJI_SETS[r][e]===n}))return{v:e}},i=0;i<DYNAMIC_EMOJI_SET_ZH.length;i++)if(r=t(i))return r.v;return-1},getDynamicEmojiView=function(e){var r=normalizeDynamicEmojiToken(e),n=getDynamicEmojiIndex(r);return n<0?{token:r,text:r,src:""}:{token:r,text:DYNAMIC_EMOJI_SET_ZH[n],src:DYNAMIC_EMOJI_IMAGES[n],textGradient:DYNAMIC_EMOJI_TEXT_GRADIENTS[n],textColor:DYNAMIC_EMOJI_TEXT_COLORS[n]}};exports.getDynamicEmojiView=getDynamicEmojiView;var getDynamicEmojiType=function(e){for(var r=new Set,n=/\[(.+?)\]/g,t=n.exec(String(e||""));t;){var i=normalizeDynamicEmojiToken(t[0]);getDynamicEmojiIndex(i)>-1&&r.add(t[0]),t=n.exec(String(e||""))}return _toConsumableArray(r)},transDynamicEmoji=function(e){return(e||[]).map(function(e){var r=getDynamicEmojiIndex(e);return r>-1?DYNAMIC_EMOJI_SET_EN[r]:null}).filter(Boolean)},getSingleDynamicEmojiToken=function(e){var r=getDynamicEmojiType(e);return 1!==r.length?"":transDynamicEmoji(r)[0]||""};exports.getSingleDynamicEmojiToken=getSingleDynamicEmojiToken;