1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7499],{30161:function(t,e,n){n.d(e,{W:function(){return o}});var a=n(85893),s=n(7806),i=n(92517);n(67294);var l=n(69330),r=n(98346),o=function(t){var e=t.v,n=(t.t,t.showBell),o=e.images,c=e.name,d=e.id,u=e.viewer,w=e.live_streamer,m=(e.start_datetime,e.duration,e.status);e.city;var x=w||{},f=x.name,h=x.avatar,v="".concat((0,i.UR)(c),"-").concat(d);return(0,a.jsxs)(l.rU,{className:"tw-w-full tw-z-0 tw-block tw-relative tw-border tw-rounded-5 tw-border-gray-31 hover:tw-border-primary-main tw-duration-500 tw-ease-linear",url:{pathname:s._.LiveVideoPage,query:{id:v}},children:[n&&(0,a.jsx)(l.Ee,{alt:"bell",src:"/ico_bell.svg",className:"!tw-absolute tw--right-3 tw--top-4 tw-w-9 tw-h-9 tw-z-11"}),(0,a.jsxs)("div",{className:"tw-w-full tw-relative tw-pb-55-percent tw-rounded-t-5 tw-overflow-hidden",children:[(0,a.jsx)(l.Ee,{alt:f,src:(0,i.eQ)(o),className:"tw-w-full tw-h-full !tw-absolute tw-left-0 tw-top-0"}),(0,a.jsx)("div",{className:"tw-absolute tw-left-0 tw-top-0 tw-w-full tw-h-full tw-z-1",style:{background:"linear-gradient(180deg, rgba(0, 0, 0, 0) 66.74%, #000000 151.27%)",transform:"rotate(-180deg)"}}),(0,a.jsx)("div",{className:"tw-absolute tw-left-0 tw-top-0 tw-w-full tw-h-full tw-z-1",style:{background:"linear-gradient(180deg, rgba(0, 0, 0, 0) 71.7%, #000000 113.56%)"}}),(0,a.jsx)("div",{className:"tw-z-11 tw-absolute tw-left-0 tw-top-0 tw-bottom-0 tw-right-0 tw-text-white",children:(0,a.jsx)("div",{className:"tw-flex tw-flex-col tw-h-full tw-justify-between tw-p-2",children:(0,a.jsxs)("div",{className:"tw-flex tw-gap-x-1 tw-items-center",children:[m===r.zN.LIVE_NOW&&(0,a.jsxs)("div",{className:"tw-flex tw-items-center tw-px-4 tw-bg-red-600 tw-text-white tw-font-xs tw-rounded tw-mr-2",children:[(0,a.jsx)("span",{className:"tw-w-2 tw-h-2 tw-rounded-full tw-bg-white tw-mr-1 tw-block"}),"Live"]}),(0,a.jsx)(l.JO,{icon:(0,a.jsx)(l.ON,{}),className:"tw-w-5 tw-h-5"}),(0,a.jsx)("p",{className:" tw-text-sm",children:u})]})})})]}),(0,a.jsx)("div",{className:"tw-flex tw-flex-col tw-gap-y-1 tw-px-4 tw-py-4 tw-bg-white tw-rounded-b-5 tw-overflow-hidden",children:(0,a.jsxs)("div",{className:"tw-flex tw-gap-x-2 tw-items-center tw-text-secondary-70 tw-font-medium",children:[(0,a.jsx)(l.qE,{src:h,className:"tw-w-6 tw-h-6",rounded:"tw-rounded-full"}),(0,a.jsx)("h3",{dangerouslySetInnerHTML:{__html:f}})]})})]},d)}},59904:function(t,e,n){var a=n(85893),s=n(67294),i=n(9008),l=n.n(i),r=function(t){var e=t.schema;return(0,a.jsx)(l(),{children:(0,a.jsx)("script",{type:"application/ld+json",dangerouslySetInnerHTML:{__html:JSON.stringify(e)}})})};e.Z=(0,s.memo)(r)},34794:function(t,e,n){var a=n(85893),s=n(67294),i=n(69330),l=n(48309),r=function(t){var e=t.name,n=t.className,s=t.cs,r=(0,l.AE)(),o=(null!=r?r:{}).theme,c=(null!=o?o:{}).icon_category_url;return(0,a.jsx)("div",{className:"_title tw-text-lg md:tw-text-2xl tw-flex tw-items-center tw-justify-center tw-w-full tw-relative ".concat(n),children:(0,a.jsxs)("div",{className:"tw-flex tw-items-center tw-w-max tw-px-5 tw-justify-center ",children:[c?(0,a.jsx)(i.Ee,{src:c,alt:"star",className:"tw-h-8 tw-w-8"}):(0,a.jsx)(i.Ee,{src:"/diamond.svg",alt:"star",className:"tw-h-5 tw-w-5"}),(0,a.jsx)("h2",{className:"tw-flex-1 tw-block tw-px-4 tw-uppercase tw-text-primary-main tw-font-semibold ".concat(s),children:e}),c?(0,a.jsx)(i.Ee,{src:c,alt:"star",className:"tw-h-8 tw-w-8"}):(0,a.jsx)(i.Ee,{src:"/diamond.svg",alt:"star",className:"tw-h-5 tw-w-5"})]})})};e.Z=(0,s.memo)(r)},17499:function(t,e,n){n.d(e,{Z:function(){return tn}});var a,s,i=n(85893),l=n(67294),r=n(69330),o=n(83134),c=n(34794),d=n(77910),u=n(74931),w=n(83749),m=n(30161),x=function(t){var e=t.t,n=(0,l.useState)(o.y),a=n[0],s=n[1],x=(0,d.fN)({limit:4,offset:0},{enabled:!1,retry:!1,refetchOnWindowFocus:!1,onError:function(t){u.ZP.error(t.message)},onSuccess:function(t){var e=t.data,n=t.total_records;s({edges:Array.isArray(e)?e:[],count:+n})}}),f=x.refetch,h=x.isLoading;return(0,l.useEffect)(function(){f()},[]),(0,i.jsxs)("div",{children:[(0,i.jsx)(c.Z,{name:e("detail.list-live-title"),className:"_title-live-detail"}),(0,i.jsx)("div",{className:"tw-flex tw-flex-col tw-mt-10",children:h?(0,i.jsx)("div",{className:"tw-h-10 tw-flex tw-justify-center tw-items-center tw-text-primary-main",children:(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.h,{})})}):(0,i.jsx)(w.E.div,{initial:"mainInitial",animate:"mainAnimate",exit:"mainExit",variants:{mainInitial:{opacity:0}
1,mainAnimate:{opacity:1,transition:{duration:.4}},mainExit:{opacity:0}},children:!!a.edges&&(0,i.jsx)("div",{className:"tw-grid tw-grid-cols-2 md:tw-grid-cols-4 tw-gap-2 md:tw-gap-4",children:a.edges.map(function(t){return(0,i.jsx)(m.W,{v:t,t:e},t.id)})})})})]})},f=(0,l.memo)(x),h=n(98346),v=n(7806),p=n(48309),g=n(26042),j=n(69396),y=n(29815),b=n(96486),_=n(53154),N=n(74865),k=function(t){var e,n,a=t.replyComment,s=t.fullName,l=(null==a?void 0:a.facebook_comment_info)?{fullname:(null==a?void 0:null===(e=a.facebook_comment_info)||void 0===e?void 0:e.facebook_user.first_name)||"",avatar:(null==a?void 0:null===(n=a.facebook_comment_info)||void 0===n?void 0:n.facebook_user.avatar_url)||""}:null,o=(0,_.G)(l||null,(null==a?void 0:a.staffs)?null==a?void 0:a.staffs:null),c=o.fullname,d=o.avatar;return(0,i.jsxs)("div",{className:"tw-flex tw-gap-x-2",children:[(0,i.jsx)(r.qE,{alt:c,src:d||"",className:"tw-w-5 tw-h-5",rounded:"tw-rounded-full"}),(0,i.jsxs)("div",{className:"tw-bg-white tw-px-4 tw-py-1 tw-rounded-b-lg tw-rounded-lg tw-relative tw-flex-1",children:[(0,i.jsx)("h4",{dangerouslySetInnerHTML:{__html:c},className:"text-user-chat tw-font-normal tw-text-13 tw-line-clamp-1"}),(0,i.jsxs)("p",{className:"tw-text-secondary-70 tw-text-13",children:[(0,i.jsx)("b",{children:s})," ",(0,i.jsx)("span",{dangerouslySetInnerHTML:{__html:(null==a?void 0:a.comment)||""}})]}),(null==a?void 0:a.updated_at)&&(0,i.jsx)("div",{className:"tw-text-right tw-text-secondary-50",style:{fontSize:"10px"},children:(0,N.EM)(null==a?void 0:a.updated_at)})]})]},"reply-comment-"+(null==a?void 0:a.id))},S=n(58533),E=n(11163),C=n(65820),I=n(6501),P=n(92517),O=(0,l.forwardRef)(function(t,e){var n,a,s,o,c=t.liveId,m=t.isAuth,x=t.messageData,f=t.commentList,h=t.defaultOffset,O=t.isShowProducts,L=t.hiddenProducts,A=t.t,F=t.sendComment,T=(0,p.Un)(),Z=(null==T?void 0:T.id)||null,z=(0,l.useState)(0),D=z[0],U=z[1],R=(0,l.useState)(f),q=R[0],W=R[1],H=(0,l.useState)(""),J=H[0],M=H[1],B=(0,E.useRouter)(),G=[{label:"Ph\xf9 hợp nhất",value:"my"},{label:"Xem tất cả",value:"all"},],K=(0,l.useRef)(null),V=(0,d.iq)({id:+c,offset:D},{enabled:!1,onError:function(t){var e=t.message;u.ZP.error(e)},onSuccess:function(t){var e=t.data;
1(Array.isArray(e)?e:[]).forEach(function(t){W(function(e){return e.find(function(e){return e.id===t.id})?(0,y.Z)(e):(0,y.Z)(e).concat([t])})})}}),Q=V.refetch,$=V.isLoading,X=(0,d.iq)({id:+c,offset:0},{enabled:!1,onError:function(t){var e=t.message;u.ZP.error(e)},onSuccess:function(t){var e=t.data;W(Array.isArray(e)?e:[])}}).refetch,Y=(0,d.aH)((null===(n=B.query)||void 0===n?void 0:n.comment_id)?+(null===(a=B.query)||void 0===a?void 0:a.comment_id):0,{enabled:!1,onError:function(t){var e=t.message;u.ZP.error(e)},onSuccess:function(t){var e=t.data;"object"==typeof e&&W([e])}}).refetch,tt=function(){var t=document.getElementById("scrollableDiv");t&&K&&q.length&&(t.scrollTop=K.current.scrollHeight)},te=function(){U(function(t){return t+20})},tn=function(){setTimeout(function(){W(function(t){var e=t.filter(function(t){return"lottery"!==t.type});return(0,y.Z)(e)})},1e4)},ta=function(t){M(t.value),m&&(tt(),U(0),t.value===G[0].value?Y():X())};(0,l.useEffect)(function(){W(f)},[f]),(0,l.useImperativeHandle)(e,function(){return{scrollToBottom:function(){tt()}}}),(0,l.useEffect)(function(){var t;tt(),U(h),(null===(t=B.query)||void 0===t?void 0:t.comment_id)&&M(G[0].value)},[c,h,null===(s=B.query)||void 0===s?void 0:s.comment_id]),(0,l.useEffect)(function(){if(x){if(x.method===v.iz.CreateComment||x.method===v.iz.UnHideComment){if(!x.data.comment)return;return tt(),W(function(t){return[null==x?void 0:x.data].concat((0,y.Z)(t))})}(x.method===v.iz.DeleteComment||x.method===v.iz.HideComment)&&(tt(),W(function(t){return t.filter(function(t){return t.id!==(null==x?void 0:x.data.comment_id)})})),(x.method===v.iz.CreateReplyComment||x.method===v.iz.UnHideReplyComment)&&W(function(t){return(0,b.forEach)(t,function(t){t.id===x.data.parent_id&&(t.reply_comments?t.reply_comments.push(null==x?void 0:x.data):t.reply_comments=[null==x?void 0:x.data])})}),(x.method===v.iz.DeleteReplyComment||x.method===v.iz.HideReplyComment)&&W(function(t){return(0,b.forEach)(t,function(t){if(t.id===x.data.comment_id){var e;t.reply_comments=null==t?void 0:null===(e=t.reply_comments)||void 0===e?void 0:e.filter(function(t){return t.id!==x.data.reply_comment_id})}})}),x.method===v.iz.UpdateComment&&W(function(t){return(0,b.forEach)(t,function(t){t.id===x.data.id&&(t.comment=x.data.comment)})}),x.method===v.iz.UpdateReplyComment&&W(function(t){return(0,b.forEach)(t,function(t){if(t.id===x.data.parent_id){var e,n=null==t?void 0:null===(e=t.reply_comments)||void 0===e?void 0:e.find(function(t){return t.id===x.data.id});n&&(n.comment=x.data.comment)}})}),x.method===v.Sf.OpenLottery&&W(function(t){return[(0,j.Z)((0,g.Z)({},x.data),{comment:"Bắt Äầu xá» sá»",type:"lottery"})].concat((0,y.Z)(t))}),x.method===v.Sf.EndLottery&&(W(function(t){return[(0,j.Z)((0,g.Z)({},x.data),{comment:"Kết th\xfac xá» sá»",type:"lottery"})].concat((0,y.Z)(t))}),tn()),x.method===v.Sf.CloseListLottery&&W(function(t){return[(0,j.Z)((0,g.Z)({},x.data),{comment:"Chá»t danh s\xe1ch xá» sá»",type:"lottery"})].concat((0,y.Z)(t))}),x.method===v.Sf.AdminPickTicketLottery&&W(function(t){return[(0,j.Z)((0,g.Z)({},x.data),{comment:"Kết quả sá» sá»: "+x.data.number,type:"lottery"})].concat((0,y.Z)(t))})}},[x,null==x?void 0:x.data.id]),(0,l.useEffect)(function(){m&&!$&&D&&J!==G[0].value&&Q()},[D,$,m,J]);var ts=function(t){var e=t.users,n=t.facebook_comment_info,a=t.youtube_comment_info,s=t.tiktok_comment_info;return e||(n?{fullname:(null==n?void 0:n.facebook_user.first_name)||"",avatar:(null==n?void 0:n.facebook_user.avatar_url)||""}:a?{fullname:(null==a?void 0:a.youtube_user.first_name)||"",avatar:(null==a?void 0:a.youtube_user.avatar_url)||""}:s?{fullname:(null==s?void 0:s.tiktok_user.first_name)||"",avatar:(null==s?void 0:s.tiktok_user.avatar_url)||""}:null)},ti=function(t){var e,n,a,s,l=null==t?void 0:null===(e=t.comment_attachments)||void 0===e?void 0:e[0];if(!l)return(0,i.jsx)(i.Fragment,{});var o=null===(n=l.data)||void 0===n?void 0:n.prize,c=null!==(s=null===(a=l.data)||void 0===a?void 0:a.won_comments)&&void 0!==s?s:[];return(0,i.jsxs)("div",{children:[c.map(function(t){var e;return(0,i.jsx)("div",{children:(0,i.jsxs)("p",{className:"text-user-chat tw-text-13 tw-font-bold tw-flex tw-items-center tw-gap-1",children:[null===(e=ts(t))||void 0===e?void 0:e.fullname,t.facebook_comment_info&&(0,i.jsx)(r.Ee,{src:"/facebook-color.png",alt:"Facebook",className:"tw-w-4 tw-h-4 tw-rounded-full"}),t.youtube_comment_info&&(0,i.jsx)(r.Ee,{src:"/youtube.svg",alt:"Youtube",className:"tw-w-4 tw-h-4 tw-rounded-full"})]})},"comment-".concat(t.id))}),(0,i.jsxs)("p",{className:"tw-text-secondary-70 tw-text-13 tw-font-normal",children:["Bạn Ä\xe3 nháºn ÄÆ°á»£c ",null==o?void 0:o.reward_content," từ An Thư"]})]})};return(0,i.jsxs)(i.Fragment,{children:[(null===(o=B.query)||void 0===o?void 0:o.comment_id)&&(0,i.jsx)("div",{className:"tw-w-max tw-z-10 tw-bg-muted-90",children:(0,i.jsx)(r.uU,{className:"tw-h-7 tw-text-xs !tw-px-2 !tw-w-40",options:G,handleSelect:ta})}),(0,i.jsxs)("div",{className:"tw-relative tw-w-full tw-flex-1 tw-overflow-hidden tw-block",children:[(0,i.jsx)("div",{id:"scrollableDiv",className:"tw-relative",style:{overflow:"auto",display:"flex",flexDirection:"column-reverse",height:"100%"}
1,children:(0,i.jsx)(S.Z,{dataLength:q.length,next:te,style:{display:"flex",height:"100%",flexDirection:"column-reverse"},inverse:!0,hasMore:!0,loader:(0,i.jsx)(i.Fragment,{}),scrollableTarget:"scrollableDiv",ref:K,children:q.map(function(t){var e,n,a,s,l,o,c,d=t.comment,u=t.id,w=t.staffs,m=t.type,x=t.reply_comments,f=t.facebook_comment_info,h=t.youtube_comment_info,p=t.tiktok_comment_info,g=t.created_at,j=t.comment_attachments,y=ts(t),b=Array.from(new Set(x)).length>0?null==x?void 0:x.sort(function(t,e){return t&&new Date(t.updated_at).getTime()-new Date(e.updated_at).getTime()}):[],S=(0,_.G)(y,w||null),E=S.fullname,C=S.avatar;return d?"lottery"===m?(0,i.jsx)("div",{className:"tw-flex tw-justify-center tw-mt-4",children:t.number?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("span",{className:"tw-text-secondary-91 tw-flex tw-items-center tw-text-13 tw-py-2 tw-px-9 tw-rounded-2xl",style:{background:"rgba(0, 0, 0, 0.06)"},children:[d,[1,2,3].map(function(t){return(0,i.jsx)(r.Ee,{src:"/confetti-flat.gif",alt:"confetti",className:"tw-w-6 tw-h-6 ".concat(1==t&&" tw-ml-1")},"i-".concat(1))})]})}):(0,i.jsxs)(i.Fragment,{children:[" ",(0,i.jsx)("span",{className:"tw-text-secondary-91 tw-text-13 tw-py-2 tw-px-9 tw-rounded-2xl",style:{background:"rgba(0, 0, 0, 0.06)"},children:d})]})},d+"-"+new Date().getTime()):(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"tw-flex tw-gap-x-2 tw-w-full tw-mt-4 tw-items-end",children:[(0,i.jsx)(r.qE,{alt:E,src:C||"",className:"tw-w-8 tw-h-8 tw-mt-6",rounded:"tw-rounded-full"}),(0,i.jsx)("div",{className:"tw-flex-1",children:(0,i.jsx)("div",{className:"tw-w-full",children:(0,i.jsxs)("div",{className:"tw-bg-white tw-px-4 tw-py-1 tw-rounded-t-lg tw-rounded-br-lg tw-relative custom-polygon-bottom",children:[(0,i.jsxs)("div",{className:"text-user-chat tw-font-bold tw-text-13 tw-flex tw-items-center",children:[(0,i.jsx)("div",{dangerouslySetInnerHTML:{__html:t.comment_attachments&&t.comment_attachments[0]&&["AUCTION_TOP_OFFER_HIGHEST_PRICE","CAMPAIGN_QUIZ_WIN",].includes(null===(e=t.comment_attachments[0])||void 0===e?void 0:e.type)?"An Thư Kim Cương":E}}),!!f&&(0,i.jsx)(r.Ee,{className:"tw-w-3 tw-h-3 tw-ml-2",src:"/fb-mini.png",alt:"fb-min"}),!!h&&(0,i.jsx)(r.Ee,{className:"tw-w-3 tw-h-3 tw-ml-2",src:"/youtube-mini.png",alt:"ytb-min"}),!!p&&(0,i.jsx)(r.Ee,{className:"tw-w-3 tw-h-3 tw-ml-2",src:"/tiktok-mini.webp",alt:"ttk-min"})]}),(0,i.jsx)("p",{className:"tw-text-secondary-70 tw-text-13 tw-font-normal",children:d}),t.comment_attachments&&t.comment_attachments.length>0&&(null===(n=t.comment_attachments[0])||void 0===n?void 0:n.type)==="AUCTION_TOP_OFFER_HIGHEST_PRICE"&&(null===(a=t.comment_attachments[0])||void 0===a?void 0:null===(s=a.data)||void 0===s?void 0:s.user_auction)&&(0,i.jsx)("div",{className:"tw-py-2 tw-text-13 tw-w-full tw-bg-white tw-rounded tw-mx-auto",style:{minWidth:350},children:null===(l=t.comment_attachments[0])||void 0===l?void 0:null===(o=l.data)||void 0===o?void 0:o.user_auction.sort(function(t,e){return e.price-t.price}).slice(0,3).map(function(t,e){var n,a,s,l,o="FACEBOOK"===t.type?null===(n=t.facebook_user)||void 0===n?void 0:n.first_name:null===(a=t.users)||void 0===a?void 0:a.fullname,c="FACEBOOK"===t.type?null===(s=t.facebook_user)||void 0===s?void 0:s.avatar_url:null===(l=t.users)||void 0===l?void 0:l.avatar;return(0,i.jsxs)("div",{className:"tw-flex tw-items-center tw-py-1 tw-gap-1 tw-text-[11px]",children:[(0,i.jsxs)("span",{children:[e+1,"."]}),(0,i.jsx)(r.qE,{alt:o,src:c||"",className:"tw-w-5 tw-h-5 tw-mx-1",rounded:"tw-rounded-full"}),(0,i.jsx)("span",{children:o}),(0,i.jsx)("span",{children:"-"}),(0,i.jsx)("span",{className:"tw-font-bold",children:(0,P.KP)(t.price,A,v.hb.$)}),(0,i.jsx)("span",{children:"/"}),(0,i.jsxs)("span",{children:[(0,i.jsx)("span",{className:"tw-text-secondary-50",children:"Thá»i gian:"})," ",(0,i.jsx)("b",{children:t.created_at?(0,N.i5)(t.created_at):"--:--:--"})]})]},"top-auction-".concat(o,"-").concat(t.price))})}),j&&j[0]&&"CAMPAIGN_QUIZ_WIN"===j[0].type&&(null===(c=j[0].data)||void 0===c?void 0:c.won_comments)&&ti(t),g&&(0,i.jsx)("div",{className:"tw-text-right tw-text-secondary-50",style:{fontSize:"10px"},children:(0,N.EM)(g)})]})})})]}),(0,i.jsxs)("div",{className:"tw-flex",children:[(0,i.jsx)("div",{className:"tw-w-9"}),(0,i.jsx)("div",{className:"tw-flex-1",children:(0,i.jsx)("div",{className:"tw-w-3/4",children:(0,i.jsx)("div",{children:b&&(null==b?void 0:b.length)>0&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"tw-flex tw-flex-col tw-mt-2 tw-gap-y-2",children:null==b?void 0:b.map(function(t){return t&&(0,i.jsx)(k,{fullName:E,replyComment:t},"rep-".concat(u,"-").concat(null==t?void 0:t.id))})})})})})})]})]},"comment-"+u+"-"+g):(0,i.jsx)(i.Fragment,{})})})}),(0,i.jsx)(C.M,{children:O&&(0,i.jsx)(w.E.div,{initial:{height:0,opacity:0}
1,animate:{height:"100%",opacity:1},exit:{height:0,opacity:0},transition:{duration:.5},className:"tw-absolute tw-bottom-0 tw-left-0 tw-bg-transparent tw-h-full tw-w-full tw-rounded-lg tw-max-h-full",children:(0,i.jsx)(I.Z,{userId:Z,sendComment:F,onClose:L,liveId:c,t:A})})})]})]})}),L=n(47568),A=n(70655),F=n(95496),T=n(87536),Z=n(74231),z=function(t){var e,n,a,s=t.collectionStickers,o=t.sendSticker,c=t.t,u=t.giftAtd,w=t.isLoading;(0,E.useRouter)();var m=(0,l.useState)(s[0].name),x=m[0],f=m[1],h=(0,l.useState)([]),g=h[0],j=h[1],y=(0,p.AE)(),b=(0,l.useState)(),_=b[0],N=b[1],k=(0,l.useState)(0),S=k[0],C=k[1],I=(0,d.g)({collection:"send-atd"!=x?x:s[0].name,offset:0,limit:100},{enabled:!1,refetchOnWindowFocus:!1,onSuccess:function(t){j(t.data)}}),O=I.refetch,L=I.isLoading,A=(0,l.useCallback)(function(){if(S&&"send-atd"===x)return u(S);var t,e=null===(t=s.find(function(t){return t.name===x}))||void 0===t?void 0:t.id;if(_&&e)return o({id:_.id,icon:_.icon,name:_.name,collection_id:e})},[S,x,u,o,_,s]);return(0,l.useEffect)(function(){"send-atd"!=x&&O()},[x,O]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"tw-px-4",children:[(0,i.jsxs)("div",{className:"tw-flex tw-items-center tw-w-11/12 tw-overflow-x-auto",children:[s.map(function(t){return(0,i.jsx)("div",{className:"tw-pr-6 tw-text-secondary-70 tw-cursor-pointer ".concat(x===t.name?"tw-font-semibold":""),onClick:function(){return f(t.name)},children:t.name},"sticker-"+t.id)}),(0,i.jsx)("div",{className:"tw-pr-6 tw-text-secondary-70 tw-cursor-pointer ".concat("send-atd"===x?"tw-font-semibold":""),onClick:function(){return f("send-atd")},children:null==y?void 0:null===(e=y.live_stream_gift_atd)||void 0===e?void 0:e.title},"send-atd")]}),(0,i.jsx)("div",{className:"tw-h-28 tw-mt-4 tw-leading-0 tw-justify-start tw-items-start tw-overflow-y-auto tw-flex tw-flex-wrap tw-relative ",children:L?(0,i.jsx)("div",{className:"tw-col-span-5 tw-flex tw-items-center tw-justify-center tw-w-full",children:(0,i.jsx)(r.gb,{})}):(0,i.jsxs)(i.Fragment,{children:["send-atd"===x&&(0,i.jsxs)("div",{children:[(0,i.jsxs)("div",{className:"tw-text-sm",children:[null==y?void 0:null===(n=y.live_stream_gift_atd)||void 0===n?void 0:n.description,"."]}),(0,i.jsxs)("div",{className:"tw-mt-3 tw-grid tw-grid-cols-3 tw-gap-3",children:[null==y?void 0:null===(a=y.live_stream_gift_atd)||void 0===a?void 0:a.amounts.map(function(t){return(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"tw-cursor-pointer tw-relative tw-flex tw-items-center tw-border tw-rounded-5 tw-overflow-hidden before:tw-w-[5px] before:tw-h-full before:tw-bg-primary-main before:tw-absolute before:tw-left-0 before:tw-top-0 tw-p-2 ".concat(S===t?"tw-bg-[#EFFDFA] tw-border-primary-main":"tw-bg-white tw-border-[#9E9E9E]"),onClick:function(){return C(t)},children:[(0,i.jsx)(r.Ee,{src:"/diamond-kam.png",alt:"diamond",className:"tw-w-5 tw-h-5 tw-mr-1"}),(0,i.jsxs)("div",{className:"tw-flex tw-flex-col",children:[(0,i.jsxs)("span",{className:"tw-font-bold tw-text-xs tw-text-primary-main",children:[t," ATD ~"]}),(0,i.jsx)("span",{className:"tw-font-bold tw-text-xs tw-text-warning-90",children:(0,P.KP)(1e5*t,c)})]})]},"amount-".concat(t))})}),(0,i.jsxs)(r.rU,{className:"tw-cursor-pointer tw-relative tw-flex tw-items-center tw-border tw-border-primary-main tw-rounded-5 tw-overflow-hidden before:tw-w-[5px] before:tw-h-full before:tw-bg-primary-main before:tw-absolute before:tw-left-0 before:tw-top-0 tw-p-2 tw-bg-primary-main",url:v._.AccountDepositPage,target:"_blank",children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.yW,{}),className:"tw-w-5 tw-h-5 tw-text-white"}),(0,i.jsx)("div",{className:"tw-flex tw-flex-col tw-text-white",children:"Nạp ATD"})]},"deposit-atd")]})]}),"send-atd"!=x&&g.map(function(t){return(0,i.jsx)("div",{className:"tw-relative tw-mr-3 tw-mb-3 tw-rounded-5 tw-cursor-pointer ".concat((null==_?void 0:_.id)==t.id?"tw-border tw-border-primary-main":""),onClick:function(){return N(t)},children:(0,i.jsx)(r.Ee,{alt:t.name,src:t.icon,className:"tw-w-10 tw-h-10 xl:tw-w-14 xl:tw-h-14",objectFit:"cover"})},"sticker-".concat(t.name))})]})})]}),(0,i.jsx)("div",{className:"tw-flex tw-justify-end tw-pt-2 tw-px-4 tw-bg-white tw-relative tw-z-1",children:(0,i.jsx)(r.zx,{className:"tw-text-white tw-text-13 tw-bg-primary-main tw-px-4 tw-py-1 tw-uppercase !tw-w-auto !tw-rounded-5",onClick:function(){return A()},loading:w,children:"Gá»i tặng"})})]})},D=(0,l.memo)(z),U=(0,l.forwardRef)(function(t,e){var n,a=t.userId,s=t.liveStreamId,o=t.t,c=t.status,m=t.collectionStickers,x=t.setDisabled,f=t.isAuth,p=t.onShowProducts,y=(0,l.useState)(!1),b=y[0],_=y[1],N=(0,l.useState)(!1),k=N[0],S=N[1],E=(0,l.useState)(!1),I=E[0],P=E[1],O=(0,l.useRef)(null),z=(0,d.fk)({onSuccess:function(){H(),u.ZP.success(o("detail.message.add-comment-success")),setTimeout(function(){x()},5e3)}}),U=z.mutate,R=z.isLoading,q=(0,d.Mz)({onSuccess:function(){u.ZP.success("Cảm Æ¡n bạn Ä\xe3 tặng atd cho An Thư. Ch\xfac bạn má»t ng\xe0y tá»t l\xe0nh")},onError:function(t){var e=t.message;u.ZP.error(e)}}).mutate,W=(0,T.cI)({defaultValues:h.Ww,resolver:(0,F.X)(Z.Ry({comment:Z.Z_().trim().required(o("detail.message.comment-required"))}))}),H=W.reset,J=W.control,M=W.handleSubmit,B=W.formState.errors,G=M(function(t){!R&&a&&(U((0,j.Z)((0,g.Z)({},t),{comment:t.comment,user_id:a||0,live_stream_id:+s,images:null})),O.current&&O.current.scrollToBottom())}),K=(0,l.useCallback)(function(t){if(13===t.keyCode)return f?G():S(!0)},[f,G]),V=function(){_(!b)},Q=(0,d.Hu)({onSuccess:function(){_(!1)}}),$=Q.mutate,X=Q.isLoading;(0,l.useImperativeHandle)(e,function(){return{sendComment:function(t){U(t)}}});var Y,tt=function(t){var e={live_stream_id:s,sticker_id:t.id,sticker_collection_id:t.collection_id};_(!1),$(e)},te=(Y=(0,L.Z)(function(t){var e;return(0,A.__generator)(this,function(e){switch(e.label){case 0:P(!0),e.label=1;case 1:return e.trys.push([1,4,5,6]),[4,(0,d.Gg)()];case 2:return[4,q({amount:t,liveId:s,sessionId:e.sent().data.session_id})];case 3:case 4:return e.sent(),[3,6];case 5:return P(!1),_(!1),[7];case 6:return[2]}})}),function(t){return Y.apply(this,arguments)});return(0,i.jsxs)("div",{className:"tw-relative",children:[(0,i.jsx)(C.M,{children:b&&(0,i.jsx)(w.E.div,{initial:"stickerWrapperInitial",exit:"stickerWrapperExit",animate:"stickerWrapperAnimate",transition:{duration:.3},variants:{stickerWrapperInitial:{opacity:0}
1,stickerWrapperExit:{opacity:0},stickerWrapperAnimate:{opacity:1}},children:(0,i.jsx)("div",{className:"tw-absolute bottom-100-12 tw-left-0 tw-w-full tw-bg-white tw-rounded-5 tw-drop-shadow-lg custom-polygon-sticker",children:(0,i.jsxs)("div",{className:"tw-relative tw-w-full",children:[(0,i.jsx)("div",{className:"tw-absolute tw-text-secondary-70 tw-top-3 tw-right-3 tw-flex tw-items-center tw-justify-center tw-w-5 tw-h-5 tw-cursor-pointer",onClick:function(){return _(!1)},children:(0,i.jsx)(r.JO,{className:"tw-w-3 tw-h-3",icon:(0,i.jsx)(r.b0,{})})}),(0,i.jsx)("div",{className:"tw-w-full tw-py-2",children:(0,i.jsx)(D,{giftAtd:te,t:o,isLoading:X||I,collectionStickers:m,sendSticker:tt})})]})})})}),(0,i.jsxs)("div",{className:"tw-flex tw-gap-x-2 tw-items-center ",children:[(0,i.jsx)(r.zx,{loading:R,onClick:p,className:"tw-flex tw-justify-center tw-p-2 !tw-rounded-full !tw-w-fit tw-bg-primary-main",children:(0,i.jsx)(r.JO,{className:"tw-w-4 tw-h-4",icon:(0,i.jsx)(r.pj,{})})}),(0,i.jsx)("div",{className:"tw-flex-1",children:(0,i.jsx)(r.nv,{name:"comment",control:J,showErrorMessage:!1,variant:r.Jf.Outlined,error:null===(n=B.comment)||void 0===n?void 0:n.message,onKeyDown:K,placeholder:o("detail.form.label.comment")+"...",containerClassName:"tw-bg-white tw-rounded-full !tw-border-0 tw-border-white tw-flex-1",className:"tw-px-2 custom-placeholder "})}),(0,i.jsx)(r.zx,{disabled:!a,loading:R,onClick:G,className:"tw-flex tw-justify-center tw-p-2 !tw-rounded-full !tw-w-fit tw-bg-primary-main",children:(0,i.jsx)(r.JO,{className:"tw-w-4 tw-h-4",icon:(0,i.jsx)(r.jE,{})})}),c===h.zN.LIVE_NOW&&!!m.length&&(0,i.jsx)(r.zx,{disabled:!a,loading:R,onClick:V,className:"tw-flex tw-justify-center tw-p-2 !tw-rounded-full !tw-w-fit tw-bg-primary-main",children:(0,i.jsx)(r.JO,{className:"tw-w-4 tw-h-4",icon:(0,i.jsx)(r.pv,{})})})]}),k&&(0,i.jsx)(r.u_,{onClose:function(){return S(!1)},children:(0,i.jsxs)("div",{className:"tw-flex tw-flex-col tw-items-center tw-justify-center",children:[(0,i.jsx)("div",{className:"tw-text-center",children:"Vui l\xf2ng ÄÄng nháºp Äá» sá» dụng t\xednh nÄng n\xe0y."}),(0,i.jsx)(r.rU,{className:"tw-mt-4 !tw-underline tw-text-lg",url:{pathname:v._.LoginPage},children:"ÄÄng nháºp"})]})})]})});(s=a||(a={})).Public="PUBLIC",s.InvitedOnly="INVITED_ONLY";var R,q=n(59394),W=function(t){var e,n,s,o=t.product,c=t.productId,u=t.isDiscount,w=t.t,m=t.userId,x=(0,l.useState)(!1),f=x[0],h=x[1],p=(0,l.useState)(!1),g=p[0],j=p[1],y=function(){h(!0)};return(0,l.useEffect)(function(){var t,e;(null===(t=o.auction)||void 0===t?void 0:t.id)&&(o.auction.type===a.InvitedOnly?(0,d.vc)(null===(e=o.auction)||void 0===e?void 0:e.id).then(function(t){j(!!t.data)}):j(!0))},[o]),(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"tw-bg-white tw-rounded-5 tw-p-2",children:[(0,i.jsxs)("div",{className:" tw-flex tw-gap-x-2",children:[(0,i.jsx)(r.rU,{url:{pathname:v._.ProductDetailPage,query:{id:"".concat((0,P.UR)(o.product_name),"-").concat(c,"-").concat(o.product_code)}},children:(0,i.jsx)("div",{className:"tw-relative !tw-w-20 !tw-h-20 tw-bg-center tw-bg-no-repeat tw-bg-cover tw-rounded-5",style:{backgroundImage:"url('".concat((0,P.C6)(o.images),"')")},title:o.product_name,children:u&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"tw-w-6 tw-h-6 tw-absolute tw-top-2 tw-right-2",children:(0,i.jsx)(r.Ee,{src:"/sale.png",className:"tw-w-full tw-h-full",alt:"sale"})})})})}),(0,i.jsxs)("div",{className:"tw-flex-1 tw-flex tw-flex-col tw-gap-y-1",children:[(0,i.jsx)(r.rU,{className:"tw-w-full",url:{pathname:v._.ProductDetailPage,query:{id:"".concat((0,P.UR)(o.product_name),"-").concat(c,"-").concat(o.product_code)}},children:(0,i.jsx)("h4",{className:"tw-text-primary-main tw-text-sm tw-font-semibold tw-line-clamp-1",dangerouslySetInnerHTML:{__html:o.product_name}})}),(0,i.jsxs)("div",{className:"tw-text-13 ",children:[(0,i.jsx)("span",{className:"tw-text-secondary-70",children:o.product_code}),"-",(0,i.jsxs)("i",{children:["Gi\xe1 khá»i Äiá»m:"," ",(0,i.jsx)("span",{className:"tw-text-warning-90 tw-font-semibold",children:(0,P.KP)((null===(e=o.auction)||void 0===e?void 0:e.origin_price)||0,w,v.hb.$)})]})]}),(0,i.jsx)("div",{className:"tw-text-sm",children:(0,i.jsxs)("i",{children:["Gi\xe1 hiá»n tại:"," ",(0,i.jsx)("span",{className:"tw-text-warning-90 tw-font-semibold",children:(0,P.KP)((null===(n=o.auction)||void 0===n?void 0:n.sell_price)||0,w,v.hb.$)})]})})]})]}),(0,i.jsx)("div",{className:"tw-flex tw-justify-end",children:(0,i.jsxs)(r.zx,{onClick:y,disabled:(null===(s=o.auction)||void 0===s?void 0:s.status)!==v.wo.Started||!m||!g,className:"tw-bg-warning-90 tw-text-white tw-uppercase tw-flex tw-items-center tw-gap-x-2 tw-border-warning-90 tw-text-xs tw-w-max tw-px-6 tw-py-1",children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.CZ,{})}),(0,i.jsx)("span",{children:"Äấu gi\xe1"})]})})]}),f&&c&&(0,i.jsx)(q.Z,{t:w,handleCloseModal:function(){return h(!1)}
1,productCode:o.product_code,productName:o.product_name,productId:c})]})},H=n(47279),J=n(56666),M=function(t){var e,n=(0,H.v0)().isAuth,a=(0,p.Un)(),s=t.product,l=t.productId,o=t.t,c=t.isDisabled,d=t.userId,u=t.onConsultClick,w=t.liveStreamId,m=t.orderProductId,x=J.O.preprocessProductDiscount(s,a),f=x.hasDiscount,h=x.hasUserLevelDiscount,g=x.matchedUserLevelDiscount;return(g&&(s.product_discount=g),s.is_auction)?(0,i.jsx)(W,{t:o,userId:d,product:s,productId:l,isDiscount:f}):(0,i.jsxs)("div",{className:"tw-bg-white tw-rounded-5 tw-flex tw-gap-x-2 tw-p-2",children:[(0,i.jsx)(r.rU,{url:{pathname:v._.ProductDetailPage,query:{id:"".concat((0,P.UR)(s.product_name),"-").concat(l,"-").concat(s.product_code)}},children:(0,i.jsx)("div",{className:"tw-relative !tw-w-20 !tw-h-20 tw-bg-center tw-bg-no-repeat tw-bg-cover tw-rounded-5",style:{backgroundImage:"url('".concat((0,P.C6)(s.images),"')")},title:s.product_name,children:f&&(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"tw-w-6 tw-h-6 tw-absolute tw-top-2 tw-right-2",children:(0,i.jsx)(r.Ee,{src:"/sale.png",className:"tw-w-full tw-h-full",alt:"sale"})})})})}),(0,i.jsxs)("div",{className:"tw-flex-1 tw-flex tw-flex-col tw-gap-y-1",children:[(0,i.jsx)(r.rU,{className:"tw-w-full tw-h-full",url:{pathname:v._.ProductDetailPage,query:{id:"".concat((0,P.UR)(s.product_name),"-").concat(l,"-").concat(s.product_code)}},children:(0,i.jsx)("h4",{className:"tw-text-primary-main tw-text-sm tw-font-semibold tw-line-clamp-1",dangerouslySetInnerHTML:{__html:s.product_name}})}),s.quotation?(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"tw-text-secondary-70",children:[(0,i.jsx)("span",{className:"tw-text-13",children:s.product_code}),(0,i.jsx)("div",{className:"tw-text-warning-90",children:o("layout:btn.contact")})]})}):(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"tw-text-secondary-70 tw-flex tw-flex-wrap tw-items-center tw-gap-2",children:[(0,i.jsx)("span",{className:"tw-text-13",children:s.product_code}),(0,i.jsx)("div",{className:"tw-w-[2px] tw-h-[2px] tw-bg-secondary-70 tw-rounded-full"}),s.product_discount&&f?(0,i.jsx)("div",{className:"tw-flex",children:(0,i.jsx)("span",{className:"tw-text-warning-90 tw-font-medium tw-text-13",children:(0,P.KP)(s.price-s.price*(null===(e=s.product_discount)||void 0===e?void 0:e.discount)/100,o)})}):(0,i.jsx)("div",{className:"tw-flex tw-text-xs tw-items-center lg:tw-gap-x-1",children:(0,i.jsx)("span",{className:"tw-text-warning-90 tw-font-medium tw-text-13",children:(0,P.KP)(s.price,o)})})]}),h&&(0,i.jsx)("div",{className:"tw-text-xs tw-mt-1",children:n?g?(0,i.jsx)(i.Fragment,{}):(0,i.jsx)("span",{className:"tw-text-secondary-70",children:"Hạng thẻ cá»§a bạn chưa c\xf3 ưu Ä\xe3i"}):(0,i.jsx)("span",{className:"tw-text-secondary-70",children:"ÄÄng nháºp Äá» xem ưu Ä\xe3i cá»§a bạn"})})]}),!s.quotation&&(0,i.jsxs)("div",{className:"tw-flex tw-justify-end tw-gap-x-4 lg:tw-gap-x-2 xl:tw-gap-x-4 tw-text-xs tw-items-center",children:[c||s.quantity<=0||m===l?(0,i.jsxs)(r.zx,{disabled:!d,className:"!tw-rounded-5 tw-py-1 tw-uppercase tw-px-3 tw-opacity-70 tw-flex tw-items-center !tw-w-[120px] lg:!tw-w-[110px] xl:!tw-w-[120px]",variant:r.Wu.Outlined,children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.Ce,{}),className:"tw-w-4 tw-h-4 tw-mr-3 lg:tw-mr-2 xl:tw-mr-3"}),o("layout:btn.consult")]}):(0,i.jsxs)(r.zx,{disabled:!d,onClick:u,className:"!tw-rounded-5 tw-py-1 tw-uppercase tw-px-3 tw-opacity-70 tw-flex tw-items-center !tw-w-[120px] lg:!tw-w-[110px] xl:!tw-w-[120px] tw-text-base lg:tw-text-sm xl:tw-text-base",variant:r.Wu.Outlined,children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.Ce,{}),className:"tw-w-4 tw-h-4 tw-mr-3 lg:tw-mr-2 xl:tw-mr-3"}),o("layout:btn.consult")]}),s.quantity<=0||s.status!=v.Pt.Availability||m===l?(0,i.jsxs)(r.zx,{disabled:!0,className:"!tw-rounded-5 tw-text-white tw-bg-primary-main tw-py-1 tw-px-3 tw-flex tw-items-center tw-justify-center !tw-w-max lg:!tw-w-[125px] xl:!tw-w-max tw-uppercase tw-text-base lg:tw-text-sm xl:tw-text-base",children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.o,{}),className:"tw-w-4 tw-h-4 tw-mr-3 lg:tw-mr-2 xl:tw-mr-3 tw-text-white"}),o("layout:btn.deposited")]}):(0,i.jsxs)(r.rU,{url:{pathname:v._.ProductDepositPage,query:{id:l,stream_id:w}},target:"_blank",className:"tw-bg-primary-main !tw-text-white !tw-w-max lg:!tw-w-[125px] xl:!tw-w-max tw-gap-x-1 tw-border tw-px-3 tw-py-1 tw-rounded-5 tw-flex tw-items-center tw-justify-center tw-uppercase tw-text-base lg:tw-text-sm xl:tw-text-base",children:[(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.o,{}),className:"tw-w-4 tw-h-4 tw-mr-3 lg:tw-mr-2 xl:tw-mr-3 tw-text-white"}),(0,i.jsx)("p",{children:o("layout:btn.order")})]})]})]})]})},B=n(17852),G=n(96732),K=function(t){var e=t.liveStreamId,n=t.status,a=t.pinnedProduct,s=t.isAuth,o=t.t,c=t.collectionStickers,u=t.messageData,w=t.retry,m=t.showLotteryBtn,x=t.hideLotteryBtn,f=t.lotteryGame,g=t.commentList,j=t.defaultOffset,y=(0,p.Un)(),b=(null==y?void 0:y.id)||null,_=(0,l.useRef)(null),N=(0,l.useRef)(null),k=(0,l.useState)(),S=k[0],E=k[1],C=(0,l.useState)(),I=C[0],L=C[1],A=(0,l.useState)(),F=A[0],T=A[1],Z=(0,l.useState)(!1),z=Z[0],D=Z[1],R=(0,l.useState)(!1),q=R[0],W=R[1],H=(0,l.useState)(),J=H[0],K=H[1],V=(0,l.useState)((null==f?void 0:f.status)||v.Ck.Ended),Q=V[0],$=V[1],X=(0,l.useState)((null==f?void 0:f.id)||null),Y=X[0],tt=X[1],te=(0,l.useState)(""),tn=te[0],ta=te[1],ts=(0,l.useState)(!0),ti=ts[0],tl=ts[1],tr=(0,d.$E)({lottery_game_id:Y||""},{enabled:!1,retry:!1,onSuccess:function(t){return L(t.data.number)},onError:function(){return L(void 0)}}).refetch,to=(0,G.qW)({}).mutate,tc=(0,d.uJ)({onSuccess:function(t){var e=t.data.conversation;to({id:e.id,data:{content:"TV ".concat(e.type_code),images:[],type:"text"}})},onError:function(t){t.message}}),td=tc.mutate;tc.isLoading;var tu=(0,B.uK)((null==a?void 0:a.product_id)||0,{retry:0,enabled:!1,onSuccess:function(t){var e=t.data||{},n=e.id,a=e.type_code;e.type,to({id:n,data:{content:"TV ".concat(a),images:[],type:"text"}})},onError:function(){return td({title:(null==a?void 0:a.products.product_name)||"",type_id:(null==a?void 0:a.product_id)||0,type_image:(0,P.C6)(null==a?void 0:a.products.images)||"",type_code:(null==a?void 0:a.products.product_code)||"",type:h.i1.Product})}}),tw=tu.refetch;tu.isLoading;var tm=function(){setTimeout(function(){$(v.Ck.Ended),L(void 0)},1e4)}
1,tx=function(t,e,n,a){setTimeout(function(){E({productCode:t,productImage:e,fullname:n,isShow:!0,id:a})},500)};(0,l.useEffect)(function(){Y&&m&&!I&&tr()},[Y,m,I,tr]),(0,l.useEffect)(function(){if((null==u?void 0:u.method)===v.Sf.UserConfirmTicket&&(null===(t=null==u?void 0:u.data.users)||void 0===t?void 0:t.id)===b&&tr(),(null==u?void 0:u.method)===v.Sf.OpenLottery&&($(v.Ck.Pending),tt(u.data.lottery_game_id||null)),(null==u?void 0:u.method)===v.Sf.EndLottery&&tm(),(null==u?void 0:u.method)===v.Sf.AdminPickTicketLottery&&(null===(e=null==u?void 0:u.data.users)||void 0===e?void 0:e.id)===b&&(W(!0),ta((null===(n=u.data.prize)||void 0===n?void 0:n.name)||"")),(null==u?void 0:u.method)===v.zN.CreateOrder&&(null===(s=null==u?void 0:u.data.product)||void 0===s?void 0:s.id)&&(null===(i=null==u?void 0:u.data.product)||void 0===i?void 0:i.id)===(null==a?void 0:a.product_id)){var t,e,n,s,i,l,r,o,c,d=null==u?void 0:u.data;K(null===(l=d.product)||void 0===l?void 0:l.id),tx(null==a?void 0:a.products.product_code,(null==d?void 0:null===(r=d.product)||void 0===r?void 0:r.image)||"",(null==d?void 0:null===(o=d.users)||void 0===o?void 0:o.fullname)||"",(null==d?void 0:null===(c=d.product)||void 0===c?void 0:c.id)||0)}(null==u?void 0:u.method)===v.zN.AuctionEnded&&u.data.winner&&T({fullName:u.data.winner.fullname,productCode:u.data.product_code||""})},[u,a,tr,b]),(0,l.useEffect)(function(){(null==a?void 0:a.product_id)!==(null==S?void 0:S.id)&&E(void 0)},[null==S?void 0:S.id,null==a?void 0:a.product_id]);var tf=(0,d.ll)({onSuccess:function(t){var e=t.data.code;if(e){var n=window.open("".concat("https://landing.anthu.vn/lottery/user.html","?code=").concat(encodeURIComponent(e)),"_blank");n&&(n.opener=null)}}}),th=tf.mutate,tv=tf.isLoading,tp=function(){if(a)return D(!0),N.current&&N.current.sendComment({comment:"TV ".concat(a.products.product_code),user_id:b||0,live_stream_id:+e,images:null}),tw()},tg=function(){Y&&Q===v.Ck.Pending&&th({lottery_game_id:Y})},tj=function(t){t&&(D(!0),N.current&&N.current.sendComment({comment:"TV ".concat(t),user_id:b||0,live_stream_id:+e,images:null}))};return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)("div",{className:"tw-bg-muted-90 tw-rounded-5 tw-h-80-screen tw-flex tw-flex-col tw-gap-y-4 tw-p-4 tw-justify-between",children:[m?(0,i.jsx)(i.Fragment,{children:Q!==v.Ck.Ended&&(0,i.jsxs)("div",{className:"tw-flex tw-bg-white tw-rounded-5 tw-px-4 tw-pt-2 tw-pb-4 tw-gap-x-2 tw-relative",children:[(0,i.jsx)(r.Ee,{src:"/confetti-flat.gif",alt:"confetti",className:"tw-w-16 tw-h-16"}),I?(0,i.jsxs)("div",{className:"tw-flex-1 tw-text-primary-main",children:[o("detail.label.joined-lottery"),": ",I]}):(0,i.jsxs)("div",{className:"tw-flex-1",children:[(0,i.jsx)("span",{className:"tw-text-primary-main",children:o("detail.label.invite-join-lottery")}),(0,i.jsx)("div",{className:"tw-flex tw-justify-end tw-mt-4 tw-w-full",children:(0,i.jsx)(r.zx,{disabled:tv||Q!==v.Ck.Pending,className:"tw-bg-primary-main tw-text-xs tw-uppercase tw-text-white tw-py-1 tw-px-6 tw-rounded !tw-w-max",onClick:tg,children:o("layout:btn.join")})})]}),(0,i.jsx)("div",{className:"tw-absolute tw-right-2 tw-cursor-pointer",onClick:x,children:(0,i.jsx)(r.JO,{icon:(0,i.jsx)(r.pC,{}),className:"tw-w-4 tw-h-4 tw-text-secondary-70"})})]})}):(0,i.jsx)(i.Fragment,{children:a&&(0,i.jsx)(M,{t:o,product:null==a?void 0:a.products,productId:null==a?void 0:a.product_id,isDisabled:z,orderProductId:J,userId:b,liveStreamId:e,onConsultClick:tp})}),(0,i.jsx)(O,{ref:_,isAuth:s,liveId:e,retry:w,messageData:u,commentList:g,defaultOffset:j,isShowProducts:ti,sendComment:tj,hiddenProducts:function(){return tl(!1)},t:o}),n===h.zN.LIVE_NOW&&a&&S&&S.isShow&&(0,i.jsx)("div",{className:"tw-gap-y-2",children:(0,i.jsx)(i.Fragment,{children:(0,i.jsxs)("div",{className:"tw-p-2 tw-flex tw-rounded tw-items-center a-flip-left",style:{backgroundColor:"#EDFFFC"},children:[S.productImage&&(0,i.jsx)(r.Ee,{className:"tw-h-8 tw-w-8",alt:S.productCode,src:S.productImage}),(0,i.jsxs)("span",{className:"tw-font-light tw-flex tw-flex-1 tw-ml-2",style:{color:"#11695A",fontSize:"13px"},children:["Qu\xfd kh\xe1ch ",S.fullname," Ä\xe3 cá»c th\xe0nh c\xf4ng ",S.productC
1ode]})]})})}),F&&(0,i.jsx)("div",{className:"tw-gap-y-2",children:(0,i.jsx)(i.Fragment,{children:(0,i.jsx)("div",{className:"tw-p-2 tw-flex tw-rounded tw-items-center a-flip-left",style:{backgroundColor:"#FFF7E3"},children:(0,i.jsxs)("span",{className:"tw-font-light tw-flex tw-flex-1 tw-ml-2",style:{color:"#A54400",fontSize:"13px"},children:["Qu\xfd kh\xe1ch ",F.fullName," Ä\xe3 Äấu gi\xe1 th\xe0nh c\xf4ng ",F.productCode]})})})}),(0,i.jsx)(U,{ref:N,t:o,liveStreamId:e,status:n,collectionStickers:c,setDisabled:function(){return D(!1)},isAuth:s,userId:b,onShowProducts:function(){return tl(function(t){return!t})}})]}),q&&(0,i.jsxs)(r.wW,{className:"tw-rounded-2xl tw-overflow-hidden tw-w-60 md:tw-w-96 tw-flex tw-items-center tw-flex-col",childrenClass:"!tw-gap-y-0 tw-w-full tw-items-center",children:[(0,i.jsx)(r.Ee,{src:"/confetti-flat.gif",alt:"confetti",className:"tw-w-52 tw-h-52"}),(0,i.jsx)("div",{className:"tw-mt-2 tw-text-center",children:"Ch\xfac mừng bạn Ä\xe3 chiến thắng"}),(0,i.jsx)("div",{className:"tw-mt-1 tw-text-center",children:tn}),(0,i.jsx)("div",{className:"tw-w-full",children:(0,i.jsx)(r.zx,{className:"tw-bg-primary-main tw-text-white tw-mt-4 tw-w-full tw-rounded-full",onClick:function(){return W(!1)},children:"OK"})})]})]})},V=n(37069),Q=n(89777),$=n(10268),X=function(t){var e=t.title;return(0,i.jsxs)("div",{className:"tw-flex tw-gap-x-2 tw-items-center tw-font-normal tw-text-base !tw-text-secondary-70",children:["Trá»±c tiếp \xa0"," > ","\xa0",(0,i.jsx)("span",{className:"tw-line-clamp-1 tw-flex-1",children:e})]})},Y=(0,l.memo)(X),tt=n(3714),te=n(59904),tn=function(t){var e,n,a,s,r=t.liveVideo,o=t.isAuth,c=t.collectionStickers,u=t.comments,w=t.offset,m=(0,$.$G)(["live-video","layout"]).t,x=function(t){if(t.length<=0)return null;var e,n=t.find(function(t){return t.status===h.zN.LIVE_NOW});return n&&n.product_id&&(null===(e=n.products)||void 0===e?void 0:e.status)!==v.Pt.Hide?n:null},p=(0,l.useState)(),g=p[0],j=p[1];(0,l.useEffect)(function(){j(x(r.live_stream_product)||h.UC)},[r]);var y=(0,l.useState)(!1),b=y[0],N=y[1],k=(0,l.useState)(null),S=k[0],E=k[1],C=(0,l.useState)(null),I=C[0],P=C[1],O=(0,l.useState)(0),L=O[0],A=O[1],F=(0,l.useRef)(null),T=(0,l.useRef)(null),Z=(0,l.useRef)(null),z=(0,d.yk)(r.id,{enabled:!1,refetchOnWindowFocus:!1}).refetch;(0,l.useEffect)(function(){var t=(0,H.v0)(),e=t.isAuth,n=t.token;if(!I&&(e||z(),e&&!Z.current)){var a=new WebSocket("".concat("wss://api.anthu.tech/ws/realtime","?token=").concat(n));return Z.current=a,a.onopen=function(){var t={method:"subscribe",type:"unicast",channels:[{id:v.y1.LiveStream,object_id:r.id}]};a.send(JSON.stringify(t)),L||(z(),A(function(t){return t+1})),T.current=setInterval(function(){a.send(JSON.stringify({method:"ping"}))},15e3)},a.onmessage=function(t){var e=JSON.parse(t.data);(null==e?void 0:e.data)&&(E(e),clearTimeout(F.current)),F.current=setTimeout(function(){E(null)},5e3)},a.onclose=function(){Z.current?console.log("ws closed by server"):console.log("ws closed by app component unmount"),P(!0),setTimeout(function(){return P(null)},5e3)},function(){a.close(),console.log("closed"),clearInterval(T.current),T.current=null,Z.current=null}}},[r.id,I]);var D=(null===(e=r.lottery_game)||void 0===e?void 0:e.find(function(t){return t.status!==v.Ck.Ended}))||null;return(0,i.jsxs)(l.Fragment,{children:[(0,i.jsx)(tt.Z,{title:m("detail.title"),description:m("detail.title"),image:r.images[0].url||""}),(0,i.jsx)(te.Z,{schema:{"@context":"https://schema.org","@type":"VideoObject",name:r.name,description:r.description||r.name,thumbnailUrl:(null===(n=r.images[0])||void 0===n?void 0:n.url)||"",uploadDate:r.start_datetime,contentUrl:r.link}}),(0,i.jsxs)("div",{className:"container tw-pt-8 tw-pb-12 tw-mx-auto md:tw-border-t tw-border-primary-main",children:[(0,i.jsx)(Y,{title:r.name}),(0,i.jsxs)("h1",{className:"tw-hidden",children:[" ",r.name]}),(0,i.jsxs)("h2",{className:"tw-hidden",children:[" ",r.name]}),(0,i.jsxs)("h2",{className:"tw-hidden",children:[" ",r.description]}),(0,i.jsxs)("div",{className:"tw-flex tw-flex-col tw-mt-6",children:[(0,i.jsxs)("div",{className:"tw-grid tw-gri
1d-cols-1 sm:tw-grid-cols-12 tw-gap-y-4 tw-gap-x-0 sm:tw-gap-x-4 sm:tw-gap-y-0",children:[(0,i.jsxs)("div",{className:"sm:tw-col-span-6 md:tw-col-span-7 tw-relative tw-flex tw-flex-col",children:[(0,i.jsx)(Q.Z,{t:m}),(0,i.jsx)("div",{className:"tw-relative tw-mt-4 tw-h-full tw-flex tw-flex-1 tw-rounded-5 tw-overflow-hidden",children:r.link&&(0,i.jsx)(V.Z,{url:r.link,liveImage:null===(a=r.images[0])||void 0===a?void 0:a.url,pinnedProduct:g,setPinnedProduct:j,liveStreamId:r.id,liveStatus:r.status,productsRange:(0,_.g)(r.live_stream_product),messageData:S,lotteryGame:D,luckyDetail:null==r?void 0:r.lucky,t:m,isAuth:o,showLotteryBtn:function(){return N(!0)},hideLotteryBtn:function(){return N(!1)},sticker:null==S?void 0:null===(s=S.data)||void 0===s?void 0:s.sticker_icon})})]}),(0,i.jsx)("div",{className:"sm:tw-col-span-6 md:tw-col-span-5",children:(0,i.jsx)(K,{hideLotteryBtn:function(){return N(!1)},showLotteryBtn:b,liveStreamId:r.id,status:r.status,pinnedProduct:g,commentList:u,isAuth:o,collectionStickers:c,messageData:S,lotteryGame:D,defaultOffset:w,products:r.live_stream_product,t:m,retry:I||!1})})]}),(0,i.jsx)("div",{className:"tw-mt-16",children:(0,i.jsx)(f,{t:m})})]})]})]})}},83134:function(t,e,n){n.d(e,{y:function(){return a}});var a={edges:[],count:0}}}]); 2//# sourceMappingURL=7499-31505394e5bd7698.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.