"use strict";(self.webpackChunkflow_web_extension=self.webpackChunkflow_web_extension||[]).push([["35006"],{155068:function(e,n,o){o.r(n),o.d(n,{UnreadCountFeedListItemToolButtonPlugin:()=>f});var t=o(397458),d=o(652983),i=o(87608),a=o.n(i),s={badge:"badge-h9dYS7"},l=e=>{var{className:n,count:o,onClick:d}=e;return o?(0,t.jsx)("div",{className:a()(s.badge,n),onClick:d,children:o>99?"99+":o}):null},_=o(828005),c=o(651481),r=o(422784),u=o(233188),v=o(599225),g=o(788704),b=o(913356),m=o(41139),h=e=>{var{lastMessageIndex:n,conversation:o,inView:i}=e,{botInfo:a}=(0,u.lC)(null==o?void 0:o.conversation_id),s=n?(0,_.JZ)(c.GH.getState(),(null==o?void 0:o.conversation_id)||"",n):0,h=n?(0,v.k9)({badge_count:s,read_message_index:null==n?void 0:n.read_message_index,read_badge_count:null==n?void 0:n.read_badge_count}):0,f=(0,d.useRef)(0),x=(0,r.ae)();return(0,d.useEffect)(()=>{i&&h&&(null==o?void 0:o.conversation_id)&&(null==n?void 0:n.message_index)&&n.message_index>f.current&&(f.current=n.message_index,(0,g.L)("red_dot_show",{bot_id:null==o?void 0:o.bot_id,conversation_id:null==o?void 0:o.conversation_id,conversation_type:null==o?void 0:o.conversation_type,show_from:"chat_bot_list",chat_type:(0,u.yT)((0,b.n5)(),null==o?void 0:o.conversation_id,a),red_dot_cnt:h}))},[i,h,null==o?void 0:o.conversation_id,null==n?void 0:n.message_index]),(0,d.useEffect)(()=>{i&&h&&(null==o?void 0:o.conversation_id)&&x!==(null==o?void 0:o.conversation_id)&&m.k.persist.warning({eventName:"red_dot_show",meta:{conversation_id:null==o?void 0:o.conversation_id,red_dot_cnt:h,badge_count:null==n?void 0:n.badge_count,resolve_badge_count:s,read_badge_count:null==n?void 0:n.read_badge_count}})},[i,h,null==o?void 0:o.conversation_id,x]),(0,t.jsx)("div",{className:"feed-list-item-tool-button-hide-on-active p-1",children:(0,t.jsx)(l,{count:h,"data-testid":"chat_list_item_unread_count",className:"w-fit"})})};class f{constructor(){this.Content=h}}}}]);
//# sourceMappingURL=generic-feed-list-item-tool-button-plugin.js.map