"use strict";const S=require("../constant.js");function n(S){return function(S){if("string"==typeof S)try{return!!JSON.parse(S)}catch(n){return!1}return!1}(S)?JSON.parse(S):S}function t(S){var t;const e=n(null==(t=null==S?void 0:S.payload)?void 0:t.data);return 0===Number(null==e?void 0:e.customerServicePlugin)||1===Number(null==e?void 0:e.chatbotPlugin)}exports.JSONToObject=n,exports.isCustomerServiceMessage=t,exports.isMessageInvisible=t=>{var e,r;const o=n(null==(e=null==t?void 0:t.payload)?void 0:e.data),l=[S.CUSTOM_MESSAGE_SRC.MENU,S.CUSTOM_MESSAGE_SRC.BRANCH,S.CUSTOM_MESSAGE_SRC.BRANCH_NUMBER,S.CUSTOM_MESSAGE_SRC.FROM_INPUT,S.CUSTOM_MESSAGE_SRC.PRODUCT_CARD,S.CUSTOM_MESSAGE_SRC.ROBOT_MSG,S.CUSTOM_MESSAGE_SRC.RICH_TEXT,S.CUSTOM_MESSAGE_SRC.STREAM_TEXT],u=(null==t?void 0:t.type)===S.TYPES.MSG_CUSTOM,i=(null==o?void 0:o.src)&&!l.includes(null==o?void 0:o.src),s=(null==o?void 0:o.src)===S.CUSTOM_MESSAGE_SRC.ROBOT&&-1!==["feedback","updateBotStatus"].indexOf(null==(r=null==o?void 0:o.content)?void 0:r.command);return u&&(i||s)},exports.isMessageRating=e=>{var r;const o=n(null==(r=null==e?void 0:e.payload)?void 0:r.data);return t(e)&&o.src===S.CUSTOM_MESSAGE_SRC.MENU};
