265.b51a90cb5b1fd4dc.js 49.3 KB
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[265],{3073:(e,t,n)=>{n.d(t,{$u:()=>o,EF:()=>l,IM:()=>c,QX:()=>a,e:()=>u,fM:()=>i,ib:()=>s,oU:()=>r});let l="20vw",i=418,r=202,a=16,s=2,o=48,u="bg-mask-light w-fit max-w-[75%] rounded-lg p-2",c="bg-mask-light w-fit max-w-[60%] rounded-lg px-2 py-1.5"},22811:(e,t,n)=>{n.d(t,{n:()=>v});var l=n(25771),i=n(87163),r=n(11866),a=n(85151),s=n(31164),o=n(34438),u=n(61086),c=n(45928),d=n(51529),m=n(56315),f=n(26575);function h(e){let{emoji:t,comboCount:n}=e,r=(0,s.E)();return(0,i.useEffect)(()=>{r.start({scale:n<=1?[.82,1.24,.96,1]:[1.24,.96,1],rotate:[0,(0,m.Ob)(n),0],transition:{duration:n<=1?.4:.28,times:n<=1?[0,.55,.82,1]:[0,.65,1],ease:[.22,1,.36,1]}})},[n,r]),(0,l.jsx)(o.P.span,{animate:r,className:"inline-flex leading-none",children:(0,l.jsx)(c.z,{"aria-label":t,children:t})})}let p=(0,i.memo)(function(e){let{emoji:t,comboButtonKey:n,comboCount:r,comboBurstId:a,disabled:s,animationEnabled:o,onActiveComboButtonKeyChange:u,onSelect:p}=e,x=r>0&&null!=a,v=(0,i.useRef)(0),b=(0,i.useCallback)(()=>{s||(u(n),p(t))},[n,s,t,u,p]),g=(0,i.useCallback)(()=>{let e=Date.now();e-v.current<f.tn||(v.current=e,b())},[b]),w=(0,i.useCallback)(()=>Date.now()-v.current<f.K9,[]);return(0,l.jsxs)("span",{className:"relative flex size-9",children:[(0,l.jsx)("button",{type:"button",disabled:s,className:(0,d.cn)("flex size-full cursor-pointer touch-manipulation items-center justify-center rounded-lg text-xl transition-colors","hover:bg-white/10 active:scale-95","disabled:pointer-events-none disabled:opacity-40"),onTouchStart:e=>{e.preventDefault(),e.stopPropagation(),g()},onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),g()},onClick:e=>{e.stopPropagation(),w()||b()},children:o&&x?(0,l.jsx)(h,{emoji:t,comboCount:r}):(0,l.jsx)("span",{className:"inline-flex leading-none",children:(0,l.jsx)(c.z,{"aria-label":t,children:t})})}),r>0&&null!=a?(0,l.jsx)("span",{className:"pointer-events-none absolute bottom-full left-1/2 z-20 mb-1 -translate-x-1/2",children:(0,l.jsx)("span",{className:"flex overflow-hidden rounded-full bg-black px-2 py-1.5",children:(0,l.jsx)(m.$k,{burstId:a,count:r,showGlow:!1,animationEnabled:o})})}):null]})});function x(e){let{emojis:t,sectionId:n,activeComboButtonKey:i,comboEntry:r,disabled:a,animationEnabled:s,onActiveComboButtonKeyChange:o,onSelect:u}=e;return(0,l.jsx)("div",{className:"grid w-fit grid-cols-8 gap-1",children:t.map((e,t)=>{let c="".concat(n,"-").concat(t,"-").concat(e),d=i===c&&(null==r?void 0:r.emojiContent)===e?r.count:0;return(0,l.jsx)(p,{emoji:e,comboButtonKey:c,comboCount:d,comboBurstId:d>0?null==r?void 0:r.burstId:void 0,disabled:a,animationEnabled:s,onActiveComboButtonKeyChange:o,onSelect:u},c)})})}function v(e){let{emojis:t,recentEmojis:n=[],comboEntry:s,open:o,disabled:c,animationEnabled:d,anchorRef:m,onSelect:f,onClose:h}=e,{t:p}=(0,a.Bd)(),v=(0,i.useRef)(null),[b,g]=(0,i.useState)(null),[w,j]=(0,i.useState)(!0),y=function(e,t){let[n,l]=(0,i.useState)(null);return(0,i.useLayoutEffect)(()=>{if(!e)return void l(null);let n=()=>{let e=t.current;if(!e)return;let n=e.getBoundingClientRect();l({left:n.left,width:n.width,bottom:window.innerHeight-n.top+8})};return n(),window.addEventListener("resize",n),window.addEventListener("scroll",n,!0),()=>{window.removeEventListener("resize",n),window.removeEventListener("scroll",n,!0)}},[e,t]),n}(o,m),D=n.length>0;return((0,i.useEffect)(()=>{o||g(null)},[o]),o&&"undefined"!=typeof document&&null!=y)?(0,r.createPortal)((0,l.jsxs)("div",{className:"fixed inset-0 z-40",children:[(0,l.jsx)("button",{type:"button",tabIndex:-1,"aria-label":p("components.discover.worldLiveDetail.emojiPickerClose"),className:"absolute inset-0 bg-black/50",onPointerDown:e=>{e.preventDefault(),h()},onClick:h}),(0,l.jsxs)("div",{ref:v,role:"dialog","aria-label":p("components.discover.worldLiveDetail.emojiPickerLabel"),className:"bg-background-third/95 absolute w-fit max-w-[calc(100vw-1rem)] rounded-2xl border border-white/10 p-3 shadow-lg sm:backdrop-blur-xl",onPointerDown:e=>e.stopPropagation(),onClick:e=>e.stopPropagation(),style:{left:y.left,bottom:y.bottom},children:[w?(0,l.jsxs)("div",{className:"mb-2 flex h-9 items-center gap-2 rounded-[12px] bg-white/[0.08] py-1 pr-1 pl-3 text-xs text-white/80",children:[(0,l.jsx)("span",{className:"min-w-0 flex-1 truncate",children:p("components.discover.worldLiveDetail.emojiPickerComboHint")}),(0,l.jsx)("button",{type:"button","aria-label":p("components.discover.worldLiveDetail.emojiPickerComboHintClose"),className:"flex size-7 shrink-0 cursor-pointer touch-manipulation items-center justify-center rounded-lg text-white/50 transition-colors hover:bg-white/10 hover:text-white/80",onClick:()=>j(!1),children:(0,l.jsx)(u.A,{className:"size-4",strokeWidth:2,"aria-hidden":!0})})]}):null,(0,l.jsxs)("div",{className:"flex flex-col gap-2",children:[D?(0,l.jsxs)("section",{children:[(0,l.jsx)("h3",{className:"mb-1.5 text-xs font-medium text-white/60",children:p("components.discover.worldLiveDetail.emojiPickerRecent")}),(0,l.jsx)(x,{emojis:n,sectionId:"recent",activeComboButtonKey:b,comboEntry:s,disabled:c,animationEnabled:d,onActiveComboButtonKeyChange:g,onSelect:f})]}):null,(0,l.jsxs)("section",{children:[(0,l.jsx)("h3",{className:"mb-1.5 text-xs font-medium text-white/60",children:p("components.discover.worldLiveDetail.emojiPickerDefault")}),(0,l.jsx)(x,{emojis:t,sectionId:"default",activeComboButtonKey:b,comboEntry:s,disabled:c,animationEnabled:d,onActiveComboButtonKeyChange:g,onSelect:f})]})]})]})]}),document.body):null}},26575:(e,t,n)=>{n.d(t,{Fv:()=>f,HC:()=>m,K9:()=>s,LT:()=>i,NS:()=>l,YF:()=>r,Yd:()=>c,dP:()=>d,hk:()=>u,iG:()=>o,qB:()=>p,tn:()=>a,xM:()=>h});let l=500,i=80,r=600,a=50,s=500,o=4e3,u=6,c=3,d="\uD83D\uDC4D\uD83D\uDC4E\uD83D\uDE4F\uD83E\uDD18\uD83D\uDC40❤️\uD83D\uDC94✅❌\uD83C\uDF89\uD83D\uDCAF\uD83D\uDD25\uD83D\uDE80\uD83D\uDE08\uD83E\uDD21\uD83D\uDC7B\uD83D\uDCA9\uD83D\uDE48\uD83C\uDF1A\uD83D\uDD1E\uD83D\uDE03\uD83D\uDE06\uD83D\uDE05\uD83D\uDE02\uD83E\uDD23\uD83D\uDE1D\uD83D\uDE0D\uD83E\uDD29\uD83D\uDE18\uD83D\uDE1D\uD83D\uDE1C\uD83D\uDE0E\uD83D\uDC80\uD83D\uDE31\uD83D\uDE33\uD83D\uDE44\uD83D\uDE21\uD83D\uDE2D\uD83D\uDE30",m="\uD83D\uDC4D❤️\uD83D\uDE18",f="\uD83C\uDFC6\uD83C\uDFC5⚽️",h="dress-live-recent-emojis",p=8},28906:(e,t,n)=>{n.d(t,{a:()=>D});var l=n(25771),i=n(95113),r=n(30008),a=n(85151),s=n(34438),o=n(67036),u=n(8640),c=n(51529),d=n(56315),m=n(26575);function f(e){let{entries:t,variant:n,animationEnabled:r}=e,{t:s}=(0,a.Bd)(),o="fixed"===n?t.slice(-m.Yd):t,u=o.length>0;return(0,l.jsx)("ul",{className:(0,c.cn)("flex w-full list-none flex-col gap-1.5 px-3","fixed"===n?(0,c.cn)("shrink-0",u?"pb-2":"pb-0"):u?"mb-2":"mb-0"),"aria-label":s("components.discover.worldLiveDetail.emojiComboLabel"),children:r?(0,l.jsx)(i.N,{initial:!1,children:o.map(e=>(0,l.jsx)(d.sq,{entry:e,animationEnabled:!0},e.burstId))}):o.map(e=>(0,l.jsx)(d.sq,{entry:e,animationEnabled:!1},e.burstId))})}var h=n(88355),p=n(25781),x=n(3073);function v(e){var t,n;return[e.uid,e.chat,null!=(n=null!=(t=e.sent_at)?t:e.timestamp)?n:""].join("\x1f")}function b(e){let{message:t,index:n,variant:i,compact:r=!1}=e,{t:s}=(0,a.Bd)(),{userInfo:o}=(0,p.kH)(),u=t.uid===(null==o?void 0:o.accountId)?s("components.discover.worldLiveDetail.chatYouSuffix"):"",c=1===t.msg_type?(0,l.jsx)("p",{className:(0,h.A)("wrap-break-word",r?"text-xs leading-4":"text-sm leading-relaxed","fixed"===i?"text-white/55":"text-white/85"),children:s("components.discover.worldLiveDetail.chatUserJoined",{name:t.name,self:u})}):(0,l.jsxs)("p",{className:(0,h.A)("wrap-break-word whitespace-pre-wrap",r?"text-xs leading-4":"text-sm leading-relaxed"),children:[(0,l.jsxs)("span",{className:"text-text-grey-light-secondary",children:[t.name,u]}),(0,l.jsx)("span",{className:"text-text-grey-light-secondary",children:": "}),(0,l.jsx)("span",{className:"text-white",children:t.chat})]});return(0,l.jsx)("li",{className:(0,h.A)("min-w-0 shrink-0","fixed"===i?r?"mb-1.5 last:mb-0":"mb-2 last:mb-0":r?x.IM:x.e),children:c})}var g=n(87163);function w(e){var t,n,l;let i=null!=(n=null!=(t=e.sent_at)?t:e.timestamp)?n:"";return[null!=(l=e.msg_type)?l:0,e.uid,i,e.name,e.chat].join("\x1f")}function j(e){let{messages:t,open:n,emojiEntries:i,emojiAnimationEnabled:r}=e,{t:c}=(0,a.Bd)(),{listRef:d,pendingNewCount:m,updateAtBottom:h,scrollListToBottom:p}=function(e,t){let[n,l]=(0,g.useState)(0),i=(0,g.useRef)(null),r=(0,g.useRef)(!0),a=(0,g.useRef)([]),s=(0,g.useRef)(!1),o=(0,g.useCallback)(()=>{let e=i.current;e&&(r.current=e.scrollHeight-e.scrollTop-e.clientHeight<=x.$u,r.current?l(0):s.current=!1)},[]),u=(0,g.useCallback)(function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"smooth",t=i.current;t&&(s.current=!1,t.scrollTo({top:t.scrollHeight,behavior:e}),r.current=!0,l(0))},[]);(0,g.useLayoutEffect)(()=>{let t=i.current,n=a.current,{added:o,isReplacement:u}=function(e,t){if(0===t.length)return{added:0,isReplacement:!1};if(0===e.length)return{added:t.length,isReplacement:!1};let n=Math.min(e.length,t.length);for(let l=n;l>0;l-=1){let n=!0;for(let i=0;i<l;i+=1)if(w(e[e.length-l+i])!==w(t[i])){n=!1;break}if(n)return{added:t.length-l,isReplacement:!1}}return{added:0,isReplacement:!0}}(n,e);if(a.current=e,0===e.length){l(0),s.current=!1;return}if(u){if(s.current=!1,!t||!r.current)return;t.scrollTop=t.scrollHeight,r.current=!0,l(0);return}!(o<=0)&&t&&(r.current||0===n.length?(0===n.length?(t.scrollTop=t.scrollHeight,s.current=!1):s.current=!0,l(0)):(s.current=!1,l(e=>e+o)))},[e]),(0,g.useEffect)(()=>{if(!s.current)return;s.current=!1;let e=i.current;e&&e.scrollTo({top:e.scrollHeight,behavior:"smooth"})},[e]);let c=(0,g.useRef)(t);return(0,g.useLayoutEffect)(()=>{let n=c.current;if(c.current=t,!t||n)return;let a=i.current;a&&0!==e.length&&(s.current=!1,a.scrollTop=a.scrollHeight,r.current=!0,l(0))},[t,e.length]),{listRef:i,pendingNewCount:n,updateAtBottom:o,scrollListToBottom:u}}(t,n);return(0,l.jsxs)(s.P.div,{className:"flex min-h-0 flex-col pb-4",style:{width:x.EF,gap:x.QX,maxWidth:x.fM},initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.2,ease:[.25,.1,.25,1]},children:[(0,l.jsx)(f,{entries:i,variant:"fixed",animationEnabled:r}),(0,l.jsx)("div",{className:"relative box-border min-h-0 w-full overflow-hidden px-3",style:{height:x.oU},children:0===t.length?(0,l.jsx)("div",{className:"flex h-full min-h-0 items-end pb-1",children:(0,l.jsx)("p",{className:"text-sm leading-relaxed text-white/45",children:c("components.discover.worldLiveDetail.emptyChat")})}):(0,l.jsxs)(l.Fragment,{children:[m>0?(0,l.jsx)(s.P.div,{className:"pointer-events-none absolute right-3 bottom-1 left-3 z-20 flex justify-center",children:(0,l.jsx)(u.$,{type:"secondary",size:"small",shape:"round",onClick:()=>p("smooth"),className:"pointer-events-auto h-auto gap-1.5 border border-white/15 bg-black/80 px-3 py-1.5 text-xs shadow-lg backdrop-blur-md hover:bg-black/90",icon:(0,l.jsx)(o.A,{className:"size-3.5 shrink-0 opacity-90","aria-hidden":!0}),iconOpacity:!1,children:c("components.discover.worldLiveDetail.chatNewMessages",{count:m})})}):null,(0,l.jsx)("ul",{ref:d,onScroll:h,className:"scrollbar-hide h-full min-h-0 w-full list-none overflow-x-hidden overflow-y-auto overscroll-contain scroll-smooth [overflow-anchor:none]","aria-label":c("components.discover.worldLiveDetail.chatTitle"),children:t.map((e,t)=>(0,l.jsx)(b,{message:e,index:t,variant:"fixed"},v(e)))})]})})]})}function y(e){let{messages:t,emojiEntries:n,emojiAnimationEnabled:i,visibleCount:r=x.ib,compact:o=!1}=e,{t:u}=(0,a.Bd)(),d=r>0,m=d?t.slice(-r):[];return(0,l.jsxs)(s.P.div,{className:(0,c.cn)("pointer-events-auto flex w-full flex-col",o?"mb-2 gap-1.5 px-2.5":"mb-3 gap-2 px-3"),initial:{opacity:0,y:8},animate:{opacity:1,y:0},exit:{opacity:0,y:8},transition:{duration:.2,ease:[.25,.1,.25,1]},children:[(0,l.jsx)(f,{entries:n,variant:"overlay",animationEnabled:i}),d?(0,l.jsx)("ul",{className:(0,c.cn)("flex w-full list-none flex-col",o?"gap-1.5":"gap-2"),"aria-label":u("components.discover.worldLiveDetail.chatTitle"),children:0===m.length?(0,l.jsx)("li",{className:(0,c.cn)("text-white/45",o?"text-xs leading-4":"text-sm leading-relaxed"),children:u("components.discover.worldLiveDetail.emptyChat")}):m.map((e,t)=>(0,l.jsx)(b,{message:e,index:t,variant:"bubble",compact:o},v(e)))}):null]})}function D(e){let{open:t,fixed:n,emojiEntries:a,emojiAnimationEnabled:s,overlayVisibleCount:o,compact:u}=e,{messages:c}=r.Z.useMessages();return(0,l.jsx)(i.N,{mode:"wait",initial:!1,children:n?(0,l.jsx)(j,{messages:c,open:t,emojiEntries:a,emojiAnimationEnabled:s},"fixed"):(0,l.jsx)(y,{messages:c,emojiEntries:a,emojiAnimationEnabled:s,visibleCount:o,compact:u},"overlay")})}},39651:(e,t,n)=>{n.d(t,{B:()=>p});var l=n(25771),i=n(11353),r=n(88355),a=n(30008),s=n(62902),o=n(93397),u=n(15313),c=n(11656),d=n(25234);let m={background:"linear-gradient(180deg, rgba(0, 0, 0, 0.46) 0%, rgba(0, 0, 0, 0) 12%)"};function f(e){let{detailAudioMuted:t,videoPublisherUid:n,fillScreen:a}=e,s=(0,i.iT)(),o=!t,u=s.filter(e=>null!=n&&Number(e.uid)===Number(n)).map(e=>(0,l.jsx)(i.aG,{user:e,playVideo:!0,playAudio:o,className:(0,r.$)("h-full w-full object-cover",!a&&"rounded-lg")},e.uid));return(0,l.jsxs)("div",{className:(0,r.$)("relative flex h-full min-h-0 w-full min-w-0 flex-col"),children:[u,(0,l.jsx)("div",{"aria-hidden":!0,className:(0,r.$)("pointer-events-none absolute inset-0",!a&&"rounded-lg"),style:m})]})}function h(e){let{state:t}=e;return(0,l.jsxs)("div",{className:(0,r.$)("relative z-1 flex h-full w-full items-center justify-center"),children:[(0,l.jsx)(s.A,{className:(0,r.$)("absolute! top-0 left-0 z-0 h-full w-full"),color1:"#423900",color2:"#040024",color3:"#3b006b",timeSpeed:1.45,colorBalance:-.02,warpStrength:1.4,warpFrequency:5,warpSpeed:2.3,warpAmplitude:36,blendAngle:-94,blendSoftness:.29,rotationAmount:480,noiseScale:2.35,grainAmount:.18,grainScale:2.2,grainAnimated:!1,contrast:1.55,gamma:1.6,saturation:1.65,centerX:-.02,centerY:0,zoom:1.65}),"connecting"===t?(0,l.jsx)(d.R,{}):"block"===t?(0,l.jsx)(o.e,{}):"error"===t?(0,l.jsx)(c.$,{}):(0,l.jsx)(u.o,{})]})}function p(e){let{detailAudioMuted:t,fillScreen:n}=e,{sessionState:i}=a.Z.useData(),{liveInfo:r}=a.Z.useOptions(),s=null==r?void 0:r.server_uid;return"playing"===i?(0,l.jsx)(f,{detailAudioMuted:t,videoPublisherUid:s,fillScreen:n},"playing"):(0,l.jsx)(h,{state:i},"fallback")}},42348:(e,t,n)=>{n.d(t,{W:()=>g});var l=n(25771),i=n(87163),r=n(85151),a=n(88355),s=n(89671),o=n(30008),u=n(20622),c=n(8640),d=n(52054),m=n(38557),f=n(28858),h=n(51529),p=n(25781),x=n(10407),v=n(89232);let b="flex h-8 items-center rounded-full bg-white/8 backdrop-blur-md";function g(e){var t,n,g,w,j,y,D,k,N,C,E,S;let{className:I,onShareClick:z}=e,{liveInfo:A}=o.Z.useOptions(),{userNumber:_}=o.Z.useData(),{on:L,off:M}=o.Z.useEvents(),{userInfo:P}=(0,p.kH)(),{t:R}=(0,r.Bd)(),W=(0,f.kE)(),{reportExit:T}=(0,v.r)(),[F,U]=(0,i.useState)(()=>{var e,t,n,l,i,r;return{viewed:null!=(i=null==A||null==(t=A.extra)||null==(e=t.stats)?void 0:e.viewed)?i:0,created:null!=(r=null==A||null==(l=A.extra)||null==(n=l.stats)?void 0:n.created)?r:0}}),B=null!=(k=null==A||null==(t=A.preset_info)?void 0:t.title)?k:"",O=(0,x.f_)((null==A||null==(n=A.creator)?void 0:n.avatar)||"",{size:"small"}),Z=null!=(N=null==A||null==(w=A.extra)||null==(g=w.stats)?void 0:g.viewed)?N:0,H=null!=(C=null==A||null==(y=A.extra)||null==(j=y.stats)?void 0:j.created)?C:0,{viewed:X,created:$}=F,q=null!=(E=null!=_?_:null==A?void 0:A.online_count)?E:0,G=(null!=(S=null==A||null==(D=A.extra)?void 0:D.onlineUsers)?S:[]).filter(e=>Number(e.uid)!==Number(P.accountId)).slice(0,4),K=[{avatar:P.userAvatar,key:"self"},...G.map(e=>({avatar:e.avatar,key:String(e.uid)}))];return(0,i.useEffect)(()=>{U({viewed:Z,created:H})},[null==A?void 0:A.db_session_id,Z,H]),(0,i.useEffect)(()=>{let e=e=>{U({viewed:e.viewed,created:e.created})};return L("live_stats",e),()=>M("live_stats",e)},[L,M]),(0,l.jsxs)("header",{className:(0,a.A)("h-header pointer-events-none z-5 flex w-full items-center justify-between px-4",I),children:[(0,l.jsxs)("div",{className:"pointer-events-auto flex h-8 min-w-0 origin-left scale-90 items-center gap-2 sm:scale-100",children:[(0,m.P5)()?null:(0,l.jsx)(c.$,{type:"secondary",size:"small",shape:"round",className:"size-8 shrink-0",icon:(0,l.jsx)(s.A,{className:"size-5 text-white"}),"aria-label":R("components.discover.worldLiveDetail.back"),onClick:()=>{T("back_prev_page"),W.push("/discover/gallery/")}}),(0,l.jsxs)("div",{className:(0,h.cn)(b,"min-w-0 gap-2 py-0.5 pr-3 pl-1"),children:[(0,l.jsx)(u.e,{src:O,size:24,fallbackIconSize:16,className:"shrink-0"}),(0,l.jsxs)("div",{className:"min-w-0",children:[(0,l.jsx)("p",{className:"truncate text-xs leading-4 font-medium text-white",children:B}),(0,l.jsxs)("div",{className:"flex truncate text-[10px] leading-3.5 text-white/50",children:[(0,l.jsx)("span",{children:R("components.liveShare.viewed",{value:function(e){if(e>=1e6){let t=e/1e6;return Number.isInteger(t)?"".concat(t,"M"):"".concat(t.toFixed(1),"M")}if(e>=1e3){let t=e/1e3;return Number.isInteger(t)?"".concat(t,"K"):"".concat(t.toFixed(1),"K")}return String(e)}(X)})}),(0,l.jsx)("div",{className:"w-2","aria-hidden":!0}),(0,l.jsx)("span",{children:R("components.liveShare.created",{count:$})})]})]})]})]}),(0,l.jsxs)("div",{className:"pointer-events-auto flex h-8 shrink-0 origin-right scale-90 items-center gap-2 sm:scale-100",children:[(0,l.jsxs)("div",{className:(0,h.cn)(b,"gap-2 py-0.5 pr-2 pl-1"),children:[(0,l.jsx)("div",{className:"flex items-center",children:K.map((e,t)=>{let{avatar:n,key:i}=e;return(0,l.jsx)("div",{className:(0,h.cn)("relative shrink-0",t>0&&"-ml-2"),style:{zIndex:t},children:(0,l.jsx)(u.e,{src:n?(0,x.f_)(n,{size:"small"}):null,size:24,fallbackIconSize:16,className:"border border-white/40 ring-0"})},i)})}),(0,l.jsx)("span",{className:"text-xs font-normal text-white/60 tabular-nums",children:q})]}),(0,m.P5)()?null:(0,l.jsx)(c.$,{type:"secondary",size:"small",shape:"round",className:"size-8 shrink-0",icon:(0,l.jsx)(d.G,{className:"text-lg text-white"}),"aria-label":R("common.share","Share"),onClick:z})]})]})}},43143:(e,t,n)=>{n.d(t,{Yq:()=>W});var l=n(25771),i=n(87163),r=n(30008),a=n(51529),s=n(8640),o=n(51298),u=n(10407),c=n(26279);function d(e){let{canSend:t,loading:n}=e;return{isLocked:!t||n,interactive:t&&!n}}var m=n(65319);let f=2*Math.PI*18.5;function h(e){let{progress:t}=e,n=Math.min(100,Math.max(0,Math.round(t)));return(0,l.jsxs)("span",{className:"relative flex size-10 items-center justify-center text-white",children:[(0,l.jsxs)("svg",{className:"absolute inset-0 -rotate-90",width:40,height:40,viewBox:"0 0 ".concat(40," ").concat(40),"aria-hidden":!0,children:[(0,l.jsx)("circle",{cx:20,cy:20,r:18.5,fill:"none",stroke:"currentColor",strokeWidth:3,className:"opacity-20"}),(0,l.jsx)("circle",{cx:20,cy:20,r:18.5,fill:"none",stroke:"currentColor",strokeLinecap:"round",strokeWidth:3,strokeDasharray:f,strokeDashoffset:f*(1-n/100),className:"transition-[stroke-dashoffset] duration-150 ease-out"})]}),(0,l.jsxs)("span",{className:"relative z-10 text-[10px] leading-none font-medium tabular-nums",children:[n,"%"]})]})}function p(e){let{handleSend:t,loading:n,sendType:r,uploadProgress:f,canSend:p,slotClassName:x}=e,v=(0,i.useRef)(null),{isLocked:b}=d({canSend:p,loading:n}),g="upload"===r&&n,w=b&&!g;return(0,l.jsxs)("div",{className:(0,a.cn)(x,b&&"pointer-events-none",!p&&!n&&"opacity-60"),children:[(0,l.jsx)("input",{ref:v,type:"file",accept:m.Ft.join(","),className:"hidden",disabled:b,onChange:e=>{var n;let l=null==(n=e.target.files)?void 0:n[0];e.target.value="",l&&!b&&t({file:l})}}),(0,l.jsx)(s.$,{type:"secondary",ring:!1,iconOpacity:!1,stopPropagation:!1,disabled:w||g,onClick:()=>{b||(async()=>{var e;await (0,u.Zm)(!0)&&((0,c.dl)(),null==(e=v.current)||e.click())})()},icon:g?(0,l.jsx)(h,{progress:null!=f?f:0}):(0,l.jsxs)("span",{className:"flex translate-y-0.5 flex-col items-center justify-center gap-0.5 text-white",children:[(0,l.jsx)(o.i,{className:"text-2xl","aria-hidden":!0}),(0,l.jsx)("span",{className:"text-xs leading-none font-medium",children:"DIY"})]}),className:"h-full w-full shrink-0 border border-dashed border-white/50"})]})}var x=n(85151),v=n(61086),b=n(39270),g=n(25781);let w=()=>{let{userInfo:e}=(0,g.kH)(),{on:t,off:n}=r.Z.useEvents(),[a,o]=(0,i.useState)("ready"),c=(0,i.useRef)(""),{queuePosition:d,queueItem:m,cancelQueue:f}=r.Z.useDress();(0,i.useEffect)(()=>{o(e=>"failed"===e?null==m||m.queueId===c.current?"failed":"queue":"queue"===e||"ready"===e?null==m?"ready":"queue":e)},[d,m]);let{t:h}=(0,x.Bd)();(0,i.useEffect)(()=>{let l=t=>{Number(t.uid)===Number(null==e?void 0:e.accountId)&&(b.o.error(h("components.dressLive.generationFailed","Generation failed. Please try another outfit.")),o("failed"),c.current=t.queueId)};return t("generation_failed",l),()=>{n("generation_failed",l)}},[null==e?void 0:e.accountId,t,n]);let p=null!=m?m.thumbnailUrl.trim()||m.imageUrl.trim():"";return(0,l.jsxs)("div",{className:"mb-4 flex h-7 min-w-0 items-center",children:["ready"===a&&(0,l.jsx)("p",{className:"min-w-0 truncate text-sm font-medium text-white",children:h("components.dressLive.uploadHint","Upload an outfit or pick one below")}),"queue"===a&&null!=m&&(0,l.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[p?(0,l.jsx)("img",{src:(0,u.f_)(p,{size:"small"}),alt:"",className:"size-7 shrink-0 rounded-sm border border-white/25 object-cover"}):(0,l.jsx)("div",{className:"size-7 shrink-0 rounded-sm border border-white/25 bg-white/10","aria-hidden":!0}),(0,l.jsxs)("p",{className:"min-w-0 truncate text-sm leading-4.5 text-white/60",children:[h("components.dressLive.yourPosition","You're in line "),":"]}),(0,l.jsxs)("p",{className:"text-sm font-medium text-white",children:["#",d+1||"-"]}),(0,l.jsx)(s.$,{type:"secondary",size:"small",shape:"round",ring:!1,iconOpacity:!1,"aria-label":h("pages.generate.status.leaveQueue","Leave queue"),icon:(0,l.jsx)(v.A,{className:"size-4",strokeWidth:2,"aria-hidden":!0}),className:"size-5 shrink-0",onClick:()=>{null!=m&&f().catch(()=>{b.o.error(h("pages.generate.status.leaveQueueFailed","Failed to leave queue"))})}})]}),"failed"===a&&(0,l.jsx)("p",{className:"text-dress-live-generation-failed min-w-0 truncate text-sm font-medium",children:h("components.dressLive.generationFailed","Generation failed. Please try another outfit.")})]})};var j=n(95113),y=n(34438),D=n(77769);let k={duration:.45,ease:[.22,1,.36,1]},N={initial:e=>({y:"from-bottom"===e?"100%":"from-top"===e?"-100%":0}),animate:{y:0},exit:e=>({y:"from-bottom"===e?"-100%":"from-top"===e?"100%":0})};function C(e){let{outfit:t,enterFrom:n,handleSend:i,canSend:r,loading:s,slotClassName:o,directSendOnClick:c,onHoverChange:m}=e,{isLocked:f,interactive:h}=d({canSend:r,loading:s}),p=t.imageUrl.trim(),x=t.thumbnailUrl.trim(),v=x||p,b=v?(0,u.f_)(v,{size:"small"}):"",g=x?(0,u.f_)(x):"",w=p?(0,u.f_)(p):g,C=g||w,E=!!(c&&h&&b),S=n?k:{duration:0};return(0,l.jsx)("div",{className:(0,a.cn)("relative overflow-hidden rounded-sm",o,E&&"cursor-pointer",f&&"pointer-events-none",!r&&!s&&"opacity-60"),onClick:()=>{E&&i({outfitId:t.outfitId,imageUrl:w,thumbnailUrl:C})},onMouseEnter:()=>null==m?void 0:m(!0),onMouseLeave:()=>null==m?void 0:m(!1),children:(0,l.jsx)(j.N,{mode:"popLayout",initial:!1,custom:n,children:b?(0,l.jsx)(y.P.div,{className:"absolute inset-0",custom:n,variants:N,initial:"initial",animate:"animate",exit:"exit",transition:S,children:(0,l.jsx)(D.X,{src:b,outfitId:t.outfitId,imageUrl:w,thumbnailUrl:C,onSend:i,interactive:h,showSendButton:!c})},t.outfitId):(0,l.jsx)(y.P.div,{className:"absolute inset-0 bg-white/10","aria-hidden":!0,custom:n,variants:N,initial:"initial",animate:"animate",exit:"exit",transition:S},"empty-".concat(t.outfitId))})})}let E="aspect-square min-w-[60px] max-w-[100px] shrink flex-1 basis-0",S=[{minViewportWidth:1920,panelWidth:918,visibleSlotCount:7},{minViewportWidth:1512,panelWidth:720,visibleSlotCount:6},{minViewportWidth:1200,panelWidth:480,visibleSlotCount:5},{minViewportWidth:980,panelWidth:480,visibleSlotCount:4},{minViewportWidth:0,panelWidth:0,visibleSlotCount:4}];function I(e,t){return(e-32-12*t)/(t+1)}function z(e,t){let n=[...t].sort((e,t)=>t.minViewportWidth-e.minViewportWidth),l=n.find(t=>e>=t.minViewportWidth);return null!=l?l:n[n.length-1]}function A(e,t,n){var l,i,r;let a=null!=(l=null==n?void 0:n.fullWidth)&&l,s=a||t.panelWidth<=0?e:t.panelWidth,o=null!=(r=null!=(i=null==n?void 0:n.fixedSlotCount)?i:t.visibleSlotCount)?r:function(e){if(e<=0)return 4;for(let t=6;t>=4;t--)if(I(e,t)>=60)return t;return 4}(s),u=Math.min(100,Math.max(60,Math.floor(I(s,o))));if(!a&&t.panelWidth>0)for(;u>60&&32+(o+1)*u+12*o>s;)u-=1;return{visibleSlotCount:o,panelWidth:s,thumbSize:u,gap:12,paddingX:32,fullWidth:a||t.panelWidth<=0}}function _(){return window.innerWidth}function L(e,t){return null!=t&&e.outfitId===t}function M(e,t,n){return t<=0?[]:e.filter(e=>!L(e,n)).slice(0,t)}function P(e,t,n){return e.some((e,l)=>l!==n&&e.outfitId===t)}function R(e,t){return new Promise((n,l)=>{if(t.aborted)return void l(t.reason);let i=window.setTimeout(()=>{t.removeEventListener("abort",r),n()},e),r=()=>{window.clearTimeout(i),l(t.reason)};t.addEventListener("abort",r,{once:!0})})}function W(){let{fixed:e,className:t,showInputTip:n=!0,breakpoints:s,fullWidth:o,fixedConfig:c}=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},d=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},{breakpoints:t=S,fullWidth:n,fixed:l,fixedConfig:r}=e,[a,s]=(0,i.useState)(_);return(0,i.useEffect)(()=>{let e=()=>s(window.innerWidth);return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]),(0,i.useMemo)(()=>{var e,i,s,o,u;if(l){let t=null!=(e=null==r?void 0:r.visibleSlotCount)?e:a>0?a<375?3:null!=(u=z(a,S).visibleSlotCount)?u:4:4,n=A(a,{minViewportWidth:0,panelWidth:0,visibleSlotCount:t},{fullWidth:!0,fixedSlotCount:t});return{...n,panelWidth:null!=(i=null==r?void 0:r.panelWidth)?i:a,thumbSize:null!=(s=null==r?void 0:r.thumbSize)?s:n.thumbSize,fullWidth:!0}}if((null==r?void 0:r.visibleSlotCount)!=null&&null!=r.panelWidth){let e=r.visibleSlotCount,t=r.panelWidth,n=A(a,{minViewportWidth:0,panelWidth:t,visibleSlotCount:e});return{visibleSlotCount:e,panelWidth:t,thumbSize:null!=(o=r.thumbSize)?o:n.thumbSize,gap:n.gap,paddingX:n.paddingX,fullWidth:t<=0}}let c=z(a,t);return A(a,c,{fullWidth:n})},[t,l,r,n,a])}({breakpoints:s,fullWidth:e||o,fixed:e,fixedConfig:c}),[f,h]=(0,i.useState)(null),{queueItem:x}=r.Z.useDress(),{outfits:v,enterDirections:b}=function(e){var t;let n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[],l=arguments.length>2?arguments[2]:void 0,{liveInfo:a}=r.Z.useOptions(),s=null==a||null==(t=a.extra)?void 0:t.defaultImages,[o,c]=(0,i.useState)(()=>M(null!=s?s:[],e,l)),[d,m]=(0,i.useState)({}),f=(0,i.useRef)(o);f.current=o;let h=(0,i.useRef)(null!=s?s:[]);h.current=null!=s?s:[];let p=(0,i.useRef)(e);p.current=e;let x=(0,i.useRef)(l);x.current=l;let v=(0,i.useRef)(new Set(n));return v.current=new Set(n),(0,i.useEffect)(()=>{let t=M(null!=s?s:[],Math.max(0,e),l);c(t),f.current=t,m({})},[s,l,e]),(0,i.useEffect)(()=>{let t=null!=s?s:[];if(0===t.length||e<=0)return;h.current=t;let n=new AbortController,{signal:l}=n;return(async()=>{for(;!l.aborted;){var e;let t=f.current,n=p.current;if(0===t.length||n<=0)return;let i=h.current;if(0===i.length)return;let r=v.current,a=t.map((e,t)=>t).filter(e=>!r.has(e));if(0===a.length){try{await R(5e3,l)}catch(e){return}continue}let s=1===a.length?a[0]:a[Math.floor(Math.random()*a.length)],o=new Set(t.map(e=>e.outfitId)),d=i.filter(e=>!o.has(e.outfitId)&&!L(e,x.current));if(0===d.length){try{await R(5e3,l)}catch(e){return}continue}let b=d[Math.floor(Math.random()*d.length)],g=.5>Math.random()?"from-bottom":"from-top",w=(function(e){return new Promise((t,n)=>{if(!e)return void t();let l=new window.Image;l.onload=()=>t(),l.onerror=()=>n(Error("Image preload failed")),l.src=e})})(function(e){let t=e.thumbnailUrl.trim()||e.imageUrl.trim();return t?(0,u.f_)(t,{size:"small"}):""}(b)).catch(()=>void 0);try{await Promise.all([w,R(5e3,l)])}catch(e){return}if(v.current.has(s)||L(b,x.current))continue;let j=f.current;(null==(e=j[s])?void 0:e.outfitId)===b.outfitId||P(j,b.outfitId,s)||(m(e=>({...e,[s]:g})),c(e=>{var t;if(L(b,x.current)||(null==(t=e[s])?void 0:t.outfitId)===b.outfitId||P(e,b.outfitId,s))return f.current=e,e;let n=[...e];return n[s]=b,f.current=n,n}))}})(),()=>n.abort()},[s,l,e]),{outfits:o,enterDirections:d}}(d.visibleSlotCount,null==f?[]:[f],null==x?void 0:x.outfitId),g=(0,m.FM)(),j=!!e,y=v.slice(0,d.visibleSlotCount),D=(0,i.useCallback)(e=>t=>{h(n=>t?e:n===e?null:n)},[]);return(0,l.jsxs)("div",{className:(0,a.cn)(e?"w-full":"border border-b-0 border-white/20 bg-white/18 px-4 pt-4 pb-4","flex shrink-0 flex-col","rounded-t-[20px]",d.fullWidth&&"w-full max-w-full",!d.fullWidth&&"max-w-full",t),style:!d.fullWidth&&d.panelWidth>0?{width:d.panelWidth}:void 0,children:[n?(0,l.jsx)(w,{}):null,(0,l.jsxs)("div",{className:(0,a.cn)("flex w-full flex-row flex-nowrap items-center gap-3",d.fullWidth&&"justify-between overflow-x-auto"),children:[y.map((e,t)=>(0,l.jsx)(C,{...g,outfit:e,slotClassName:E,enterFrom:b[t],directSendOnClick:j,onHoverChange:D(t)},t)),(0,l.jsx)(p,{...g,slotClassName:E})]})]})}},45502:(e,t,n)=>{n.d(t,{I:()=>y});var l=n(87163),i=n(58885),r=n(30008),a=n(46443),s=n(29112),o=n(25781),u=n(26575);function c(e){return"undefined"!=typeof Intl&&"Segmenter"in Intl?[...new Intl.Segmenter(void 0,{granularity:"grapheme"}).segment(e)].map(e=>e.segment):[...e]}var d=n(10407),m=n(65983),f=n.n(m),h=n(86226),p=n.n(h);function x(){return f().utc().valueOf()}function v(e){return null!=e&&Number.isFinite(e)?f().utc(e<1e12?1e3*e:e).valueOf():x()}function b(e){return{uid:e.uid,avatar:e.avatar,name:e.name,nickname:e.nickname,emojiContent:e.emojiContent,burstId:e.burstId,count:e.count,createdAt:e.createdAt,updatedAt:e.updatedAt}}function g(e,t){return null!=t&&Number(e)===t}function w(e,t){let{accountId:n,userAvatar:l,displayName:i}=t;if(!g(e.uid,n))return e;let r=null!=l?l:"";return e.avatar===r&&e.name===i&&e.nickname===i?e:{...e,avatar:r,name:i,nickname:i}}f().extend(p());var j=n(4867);function y(){var e,t;let{userInfo:n}=(0,o.kH)(),m=(0,s.a)(),{sessionState:f}=r.Z.useData(),{liveInfo:h}=r.Z.useOptions(),{send:p,on:y,off:D}=r.Z.useEvents(),[k,{setTrue:N,setFalse:C,toggle:E}]=(0,i.A)(!1),{recentEmojis:S,addRecentEmoji:I}=function(){let[e,t]=(0,j.A)(u.xM,{defaultValue:[],listenStorageChange:!0});return{recentEmojis:null!=e?e:[],addRecentEmoji:(0,l.useCallback)(e=>{t(t=>[e,...(null!=t?t:[]).filter(t=>t!==e)].slice(0,u.qB))},[t])}}(),{animationEnabled:z}=(0,a.Y)({disabled:m}),A="end"===f||"block"===f,_=(0,l.useCallback)(()=>{A||E()},[A,E]),L=n.accountId,M=!!(null!=(t=null==h?void 0:h.worldcupLeaderboard)?t:null==h||null==(e=h.extra)?void 0:e.worldcupLeaderboard),P=M?u.Fv:u.HC,R=(0,l.useMemo)(()=>[...new Set(c(u.dP))],[]),W=(0,l.useMemo)(()=>c(P),[P]),{activeSelfEntry:T,visibleEntries:F,syncSelfEntry:U,receiveEmojiEvent:B}=function(e){let{accountId:t,userAvatar:n,nickname:i,email:r}=e,[a,s]=(0,l.useState)(()=>new Map),o=i||r||"",c=(0,l.useCallback)(e=>{let{emojiContent:l,burstId:i,count:r}=e;if(null==t)return;let a=x();s(e=>{var s;let u=e.get(i),c=new Map(e);return c.set(i,b({uid:t,avatar:null!=n?n:"",name:o,nickname:o,emojiContent:l,burstId:i,count:r,createdAt:null!=(s=null==u?void 0:u.createdAt)?s:a,updatedAt:a})),c})},[t,o,n]),d=(0,l.useCallback)(e=>{if(g(e.uid,t))return;let n=v(e.timestamp),l=e.burstId||e.burst_id||null;if(!l)return;let i=Number(e.uid);s(t=>{var r;let a=t.get(l);if(!function(e,t){let n=v(t.timestamp);return null==e||!(t.count<e.count)&&(t.count!==e.count||!(n<e.updatedAt))}(a,e))return t;let s=new Map(t);return s.set(l,b({uid:i,avatar:e.avatar,name:e.name,nickname:e.nickname,emojiContent:e.emojiContent,burstId:l,count:e.count,createdAt:null!=(r=null==a?void 0:a.createdAt)?r:n,updatedAt:n})),s})},[t]);(0,l.useEffect)(()=>{let e=window.setInterval(()=>{let e=x();(0,l.startTransition)(()=>{s(t=>(function(e,t){let n=!1,l=new Map;for(let[i,r]of e){if(t-r.updatedAt<u.iG){l.set(i,r);continue}n=!0}return n?l:e})(t,e))})},500);return()=>window.clearInterval(e)},[]);let m=(0,l.useMemo)(()=>{let e=x();return[...a.values()].filter(t=>e-t.updatedAt<u.iG).sort((e,t)=>e.createdAt-t.createdAt).slice(-u.hk).map(e=>w(e,{accountId:t,userAvatar:n,displayName:o}))},[t,o,a,n]);return{activeSelfEntry:(0,l.useMemo)(()=>{var e;if(null==t)return null;let l=x(),i=null!=(e=[...a.values()].filter(e=>e.uid===t&&l-e.updatedAt<u.iG).sort((e,t)=>t.updatedAt-e.updatedAt)[0])?e:null;return i?w(i,{accountId:t,userAvatar:n,displayName:o}):null},[t,o,a,n]),receiveEmojiEvent:d,syncSelfEntry:c,visibleEntries:m}}({accountId:L,userAvatar:n.userAvatar,nickname:n.nickname,email:n.email}),{endBurstSession:O,tap:Z}=function(e){let{accountId:t,disabled:n,sendEmoji:i,addRecentEmoji:r,syncSelfEntry:a}=e,s=(0,l.useRef)(null),o=(0,l.useRef)(null),c=(0,l.useRef)(!0),m=(0,l.useRef)(0),f=(0,l.useRef)(0),h=(0,l.useRef)(null),p=(0,l.useRef)(null),x=(0,l.useRef)(null),v=(0,l.useRef)(0),b=(0,l.useCallback)(()=>{null!=h.current&&(clearInterval(h.current),h.current=null)},[]),g=(0,l.useCallback)(()=>{null!=p.current&&(clearTimeout(p.current),p.current=null)},[]),w=(0,l.useCallback)(()=>{null!=x.current&&(clearTimeout(x.current),x.current=null)},[]),j=(0,l.useCallback)(()=>{let e=s.current,t=o.current,n=m.current;e&&t&&!(n<=0)&&(v.current=Date.now(),a({emojiContent:e,burstId:t,count:n}))},[a]),y=(0,l.useCallback)(()=>{w(),j()},[w,j]),D=(0,l.useCallback)(()=>{if(null==s.current||null==o.current)return;let e=Date.now(),t=u.LT-(e-v.current);if(t<=0)return void y();null==x.current&&(x.current=setTimeout(()=>{x.current=null,j()},t))},[y,j]),k=(0,l.useCallback)(()=>{let e=s.current,t=o.current,n=m.current;e&&t&&!(n<=0)&&(i({emojiContent:e,burstId:t,count:n}),f.current=n)},[i]),N=(0,l.useCallback)(()=>{b(),g(),w(),s.current=null,o.current=null,c.current=!0,m.current=0,f.current=0,v.current=0},[g,b,w]),C=(0,l.useCallback)(function(){let e=!(arguments.length>0)||void 0===arguments[0]||arguments[0],t=s.current;e&&m.current>0&&y(),e&&m.current>f.current&&k(),e&&t&&c.current&&r(t),N()},[r,N,y,k]),E=(0,l.useCallback)(()=>{b(),k(),h.current=setInterval(()=>{null!=s.current&&null!=o.current&&(m.current<=0||k())},u.NS)},[b,k]),S=(0,l.useCallback)(()=>{g(),p.current=setTimeout(()=>{p.current=null,C(!0)},u.YF)},[g,C]),I=(0,l.useCallback)(function(e){let n=!(arguments.length>1)||void 0===arguments[1]||arguments[1];if(null==t)return;let l="".concat(t,"-").concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,11));s.current=e,o.current=l,c.current=n,m.current=1,f.current=0,v.current=Date.now(),a({emojiContent:e,burstId:l,count:1}),E(),S()},[t,S,E,a]),z=(0,l.useCallback)(async(e,t)=>{var l;if(n)return;let i=null==(l=null==t?void 0:t.recordRecent)||l,r=s.current;if(null!=r&&r!==e){if(C(!0),!await (0,d.Zm)())return;I(e,i);return}if(s.current!==e){if(!await (0,d.Zm)())return;I(e,i);return}i&&(c.current=!0),m.current+=1,o.current&&(D(),S())},[I,n,C,S,D]);return(0,l.useEffect)(()=>()=>{C(!1)},[C]),{endBurstSession:C,tap:z}}({accountId:L,disabled:A,sendEmoji:(0,l.useCallback)(e=>p("emoji",e),[p]),addRecentEmoji:I,syncSelfEntry:U}),H=(0,l.useCallback)(e=>{Z(e,{recordRecent:!M})},[M,Z]),X=(0,l.useCallback)(e=>{B(e)},[B]);return(0,l.useEffect)(()=>(y("emoji_received",X),()=>D("emoji_received",X)),[X,y,D]),(0,l.useEffect)(()=>{A&&(C(),O(!1))},[A,C,O]),{activeSelfEntry:T,visibleEntries:F,tap:Z,tapQuickEmoji:H,disabled:A,pickerOpen:k,openPicker:N,closePicker:C,togglePicker:_,fullEmojis:R,quickEmojis:W,recentEmojis:S,animationEnabled:z}}},51732:(e,t,n)=>{n.d(t,{V:()=>D});var l=n(25771),i=n(87163),r=n(85151),a=n(73860),s=n(30990),o=n(39270),u=n(30008),c=n(8640),d=n(45928),m=n(63040),f=n(91714),h=n(56789),p=n(99351),x=n(49855),v=n(51529),b=n(25781),g=n(10407),w=n(89232),j=n(26575),y=n(3073);let D=(0,i.forwardRef)(function(e,t){var n;let{fixed:D,onOpenChange:k,onFocusChange:N,quickEmojis:C,emojiDisabled:E,pickerOpen:S,collapsed:I,onCollapse:z,onExpand:A,onPickerToggle:_,onQuickEmojiTap:L}=e,{t:M}=(0,r.Bd)(),{userInfo:P}=(0,b.kH)(),[R,W]=(0,i.useState)(""),T=(0,i.useRef)(null),F=(0,i.useRef)(null),U=(0,i.useRef)(0),B=(0,a.A)(T),{sessionState:O}=u.Z.useData(),{send:Z}=u.Z.useEvents(),{recordComment:H}=(0,w.r)(),X="end"===O||"block"===O,$=P.loading||X,q=null!=E?E:X,G=function(e,t){if(e<=0||t<=0)return 0;for(let n=t;n>0;n-=1)if(function(e,t){return e-24-(t<=0?0:32*t+(t-1)*2)-32-28-18}(e,n)>=96)return n;return 0}(null!=(n=null==B?void 0:B.width)?n:0,C.length),K=C.slice(0,G),V=(0,i.useCallback)(e=>{T.current=e,function(e,t){if("function"==typeof e)return e(t);e&&(e.current=t)}(t,e)},[t]),{run:Y,loading:Q}=(0,s.A)(async()=>{if(!Q&&"end"!==O&&"block"!==O&&""!==R.trim()&&await (0,g.Zm)())try{await Z("chat",R),H(),W(""),setTimeout(()=>{var e;null==(e=F.current)||e.focus({preventScroll:!0})},0)}catch(e){o.o.error((null==e?void 0:e.message)||M("global.common.sendFailed"))}},{manual:!0}),J=Q||!R.trim()||X||P.loading,ee=(0,i.useCallback)(async()=>{if($||Q)return!1;let e=await (0,g.Zm)();if(!e){var t;null==(t=F.current)||t.blur()}return e},[$,Q]),et=(0,i.useCallback)(e=>{$||Q||W(e)},[$,Q]),en=(0,i.useCallback)(()=>{(async()=>{await ee()&&(k(!0),null==N||N(!0))})()},[ee,N,k]),el=(0,i.useCallback)(()=>{var e;if(I){k(!0),null==A||A();return}null==(e=F.current)||e.blur(),k(!1),null==N||N(!1),null==z||z()},[I,z,A,N,k]),ei=(0,i.useCallback)(e=>{q||null==L||L(e)},[q,L]),er=(0,i.useCallback)(()=>{q||null==_||_()},[q,_]),ea=(0,i.useCallback)(e=>{let t=Date.now();t-U.current<j.tn||(U.current=t,ei(e))},[ei]),es=(0,i.useCallback)(()=>{let e=Date.now();e-U.current<j.tn||(U.current=e,er())},[er]),eo=(0,i.useCallback)(()=>Date.now()-U.current<j.K9,[]),eu=(0,l.jsxs)("div",{ref:V,className:(0,v.cn)("flex min-w-0 items-center gap-1.5 rounded-full px-3","border border-white/10",D?"":"mt-3 flex-1",D&&"bg-button-secondary-normal"),style:{height:x.GD,...D?{width:y.EF,maxWidth:y.fM}:void 0},children:[(0,l.jsx)("input",{ref:F,maxLength:100,type:"text",value:R,onChange:e=>{et(e.target.value)},placeholder:M("components.discover.worldLiveDetail.chatPlaceholder"),className:"h-full min-w-0 flex-1 rounded-full border-0 bg-transparent py-0 text-sm leading-5 text-white caret-white shadow-none outline-none placeholder:text-white/40 read-only:cursor-default disabled:cursor-not-allowed disabled:opacity-50",disabled:$,readOnly:Q,"aria-busy":Q,onFocus:en,onBlur:()=>{k(!1),null==N||N(!1)},onKeyDown:e=>{Q||P.loading||X||"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),Y())}}),K.length>0?(0,l.jsx)("div",{className:"flex shrink-0 items-center gap-0.5",children:K.map(e=>(0,l.jsx)("button",{type:"button",disabled:q,className:"flex size-8 cursor-pointer touch-manipulation items-center justify-center rounded-full text-[1.25rem] leading-none transition-colors hover:bg-white/10 active:scale-95 disabled:pointer-events-none disabled:opacity-40",onTouchStart:t=>{t.preventDefault(),ea(e)},onPointerDown:t=>{t.preventDefault(),ea(e)},onClick:()=>{eo()||ei(e)},children:(0,l.jsx)(d.z,{"aria-label":e,children:e})},e))}):null,(0,l.jsx)("button",{type:"button",disabled:q,"aria-label":M("components.discover.worldLiveDetail.emojiPickerOpen"),"aria-expanded":S,className:(0,v.cn)("flex size-8 shrink-0 cursor-pointer touch-manipulation items-center justify-center rounded-full text-white/80 transition-colors","hover:bg-white/10 active:scale-95 disabled:pointer-events-none disabled:opacity-40",S&&"bg-white/15 text-white"),onTouchStart:e=>{e.preventDefault(),e.stopPropagation(),es()},onPointerDown:e=>{e.preventDefault(),e.stopPropagation(),es()},onClick:()=>{eo()||er()},children:(0,l.jsx)(f.I,{className:"text-[24px]","aria-hidden":!0})}),(0,l.jsx)(c.$,{type:"gradient",size:"small",shape:"round",icon:(0,l.jsx)(p.J,{className:"relative right-0.5"}),"aria-label":M("components.discover.worldLiveDetail.sendChat"),onClick:Y,disabled:J,loading:Q,className:"size-7 shrink-0 [&>span]:text-base"})]});return D?(0,l.jsxs)("div",{className:"flex items-center gap-2",children:[eu,(0,l.jsx)(c.$,{type:"secondary","aria-label":M(I?"components.discover.worldLiveDetail.expandChatInput":"components.discover.worldLiveDetail.collapseChatInput"),"aria-expanded":!I,shape:"round",size:"middle",icon:I?(0,l.jsx)(h.p,{className:"text-[20px]","aria-hidden":!0}):(0,l.jsx)(m.y,{className:"text-[20px]","aria-hidden":!0}),onClick:el})]}):eu})},56315:(e,t,n)=>{n.d(t,{$k:()=>m,Ob:()=>h,sq:()=>f});var l=n(25771),i=n(87163),r=n(95113),a=n(34438),s=n(31164),o=n(20622),u=n(45928),c=n(51529),d=n(10407);function m(e){let{burstId:t,count:n,showGlow:i=!0,animationEnabled:s=!0}=e,o=n>=5&&n%5==0,u=n>=20,d=n>=30?"text-[34px]":n>=10?"text-[28px]":"text-[24px]";return s?(0,l.jsxs)("div",{className:"relative flex h-9 min-w-[4rem] shrink-0 items-center justify-center px-2",children:[i?(0,l.jsx)(r.N,{initial:!1,children:(0,l.jsx)(a.P.div,{initial:{opacity:0,scale:.72},animate:{opacity:[0,u?.75:.4,0],scale:[.72,1.08,1.28]},exit:{opacity:0},transition:{duration:u?.52:.36,ease:[.22,1,.36,1]},className:(0,c.cn)("pointer-events-none absolute inset-[-0.2rem] rounded-full",u?"bg-emoji-combo-hot-glow":"bg-emoji-combo-cool-glow")},"".concat(t,"-glow-").concat(n))}):null,(0,l.jsx)(r.N,{initial:!1,mode:"popLayout",children:(0,l.jsxs)(a.P.span,{initial:{y:18,scale:.72,opacity:0},animate:{y:0,scale:[1.24,.96,1],opacity:1,rotate:o?[0,-5,3,0]:0},exit:{y:-16,scale:1.14,opacity:0},transition:{y:{type:"spring",stiffness:520,damping:28},scale:{duration:.34,times:[0,.58,1],ease:[.22,1,.36,1]},opacity:{duration:.16},rotate:{duration:.22}},className:"absolute inset-0 flex items-center justify-center gap-1 font-black whitespace-nowrap text-white italic tabular-nums",children:[(0,l.jsx)("span",{className:"text-[18px] text-white/65",children:"x"}),(0,l.jsx)("span",{className:(0,c.cn)("drop-shadow-emoji-combo-count-glow leading-none text-white",d),children:n})]},"".concat(t,"-").concat(n))})]}):(0,l.jsx)("div",{className:"relative flex h-9 min-w-[4rem] shrink-0 items-center justify-center px-2",children:(0,l.jsxs)("span",{className:"absolute inset-0 flex items-center justify-center gap-1 font-black whitespace-nowrap text-white italic tabular-nums",children:[(0,l.jsx)("span",{className:"text-[18px] text-white/65",children:"x"}),(0,l.jsx)("span",{className:(0,c.cn)("drop-shadow-emoji-combo-count-glow leading-none text-white",d),children:n})]})})}function f(e){let{entry:t,animationEnabled:n}=e,r=(0,s.E)(),f=(0,d.f_)(t.avatar,{size:"small"});(0,i.useEffect)(()=>{n&&r.start({scale:t.count<=1?[.82,1.24,.96,1]:[1.24,.96,1],rotate:[0,h(t.count),0],transition:{duration:t.count<=1?.4:.28,times:t.count<=1?[0,.55,.82,1]:[0,.65,1],ease:[.22,1,.36,1]}})},[n,r,t.count]);let p=(0,c.cn)("flex w-fit max-w-full items-center gap-2 rounded-full px-2.5 py-1.5","bg-black/60 backdrop-blur-sm"),x=(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(o.e,{src:f,size:28,fallbackIconSize:20,alt:""}),(0,l.jsxs)("span",{className:"min-w-0 truncate text-sm text-white",children:[t.nickname,(0,l.jsx)("span",{className:"text-white/80",children:":"})]}),(0,l.jsxs)("div",{className:"flex shrink-0 items-center gap-1.5",children:[n?(0,l.jsx)(a.P.span,{initial:{scale:.82},animate:r,className:"inline-flex text-[1.75rem] leading-none",children:(0,l.jsx)(u.z,{className:"text-[1.75rem]",children:t.emojiContent})}):(0,l.jsx)("span",{className:"inline-flex text-[1.75rem] leading-none",children:(0,l.jsx)(u.z,{className:"text-[1.75rem]",children:t.emojiContent})}),(0,l.jsx)(m,{burstId:t.burstId,count:t.count,animationEnabled:n})]})]});return n?(0,l.jsx)(a.P.li,{layout:"position",initial:{opacity:0,x:-34,y:12,scale:.88},animate:{opacity:1,x:0,y:0,scale:1},exit:{opacity:0,x:-15.3,y:-8,scale:.94},transition:{layout:{type:"spring",stiffness:420,damping:34},opacity:{duration:.2},x:{type:"spring",stiffness:420,damping:28},y:{type:"spring",stiffness:380,damping:26},scale:{duration:.24,ease:[.22,1,.36,1]}},className:p,children:x}):(0,l.jsx)("li",{className:p,children:x})}function h(e){return e>=20&&e%5==0?10:4*(e>1)}},65319:(e,t,n)=>{n.d(t,{FM:()=>D,Ft:()=>x,xN:()=>k});var l=n(25771),i=n(87163),r=n(85151),a=n(30990),s=n(39270),o=n(30008),u=n(49855),c=n(65303),d=n(10407),m=n(39502),f=n(45335),h=n(26279),p=n(89232);let x=["image/jpeg","image/jpg","image/png","image/webp"],v={source:null},b=(0,i.createContext)(null),g=e=>{let{presetId:t,sessionId:n,imageUrl:l="",isSuccess:i}=e;(0,m.u4)({key:m.yW.REALTIME_UPLOAD_MEDIA,params:{[m.pX.PRESET_ID]:null==t?"":String(t),[m.pX.SESSION_ID]:null==n?"":String(n),[m.pX.IMAGE_URL]:l,[m.pX.REALTIME_MODEL]:"V",[m.pX.IS_SUCCESS]:i?"1":"0"}})};function w(e){return Math.min(100,Math.max(0,Math.round(e)))}function j(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:70;return w(t+(n-t)*Math.min(1,Math.max(0,e)))}async function y(e){if(e.size<=2097152)return e;let t=await (0,f.w)(e,{maxSizeMB:1.95,maxWidthOrHeight:void 0,initialQuality:1,maxIteration:24,alwaysKeepResolution:!0});return t.size<=2097152?t:(0,f.w)(e,{maxSizeMB:1.95,maxWidthOrHeight:void 0,initialQuality:1,maxIteration:24})}function D(){let e=(0,i.useContext)(b);if(!e)throw Error("useDressSend must be used within DressSendProvider");return e}function k(e){var t;let{children:n}=e,{send:D}=o.Z.useEvents(),{liveInfo:k}=o.Z.useOptions(),{queuePosition:N}=o.Z.useDress(),{t:C}=(0,r.Bd)(),{recordUploadMedia:E,setUploadingMedia:S}=(0,p.r)(),[I,z]=(0,i.useState)(null),[A,_]=(0,i.useState)(null),[L,M]=(0,i.useState)(v),P=(0,i.useRef)(null),R=(0,i.useRef)(0),W=null==k?void 0:k.db_session_id,T=null==k||null==(t=k.preset_info)?void 0:t.preset_id,F=-1===N,U=(0,i.useCallback)(e=>{if(null==e){R.current=0,_(null);return}let t=w(e);R.current=t,_(t)},[]),B=(0,i.useCallback)(e=>{let t=w(e);t<=R.current||(R.current=t,_(t))},[]),O=(0,i.useCallback)(()=>{null!=P.current&&(window.clearInterval(P.current),P.current=null)},[]),Z=(0,i.useCallback)(e=>{O();let t=Date.now(),n=Math.min(25e3,Math.max(6e3,e/262144*1e3)),l=R.current;P.current=window.setInterval(()=>{B(j(Math.min(1,(Date.now()-t)/n),l,88))},120)},[B,O]);(0,i.useEffect)(()=>O,[O]);let H=(0,i.useCallback)(async e=>{if(!x.includes(e.type)){g({presetId:T,sessionId:W,isSuccess:!1}),s.o.error(C("components.GenerateConfig.imageFormatError"));return}let t="";z("upload"),S(!0),U(4),Z(e.size),e.size>5242880&&s.o.info(C("components.GenerateConfig.largeImageUploadNotice"));try{let[n,l]=await Promise.all([y(e),(0,f.w)(e,{maxSizeMB:.05})]);B(10);let[i,r]=await Promise.all([(0,h.Kr)({file:n,multipartUpload:"dynamic",config:{multipart:{progress:e=>{"number"==typeof e&&B(j(e))}}}}),(0,h.Kr)({file:l})]);t=i.image_url,O(),B(94),await D("outfit_selection",{isDefault:!1,imageUrl:i.image_key,thumbnailUrl:r.image_key}),g({presetId:T,sessionId:W,imageUrl:t,isSuccess:!0}),E(),B(100)}catch(e){throw g({presetId:T,sessionId:W,imageUrl:t,isSuccess:!1}),e}finally{S(!1),O()}},[B,O,T,E,D,W,S,U,Z,C]),X=(0,i.useCallback)(async e=>{let{outfitId:t,imageUrl:n="",thumbnailUrl:l=""}=e;z("default"),U(null),await D("outfit_selection",{isDefault:!0,outfitId:t}),(e=>{let{sessionId:t,imageUrl:n,thumbnailUrl:l,isDefault:i,outfitId:r}=e;(0,m.u4)({key:m.yW.REALTIME_DRESS_OUTFIT_SELECT,params:{[m.pX.SESSION_ID]:null==t?"":String(t),[m.pX.OUTFIT_IMAGE_URI]:n,[m.pX.OUTFIT_THUMBNAIL_URI]:l,[m.pX.OUTFIT_IS_DEFAULT]:+!!i,...i&&null!=r?{[m.pX.OUTFIT_DEFAULT_ID]:r}:{}}})})({sessionId:W,imageUrl:n,thumbnailUrl:l,isDefault:!0,outfitId:t})},[D,W,U]),{error:$,loading:q,run:G}=(0,a.A)(async e=>{var t;if(M({source:null!=(t=e.source)?t:"dress-layout",activeOutfitId:e.outfitId,activeCountryCode:e.countryCode,activeCountryName:e.countryName}),!await (0,d.Zm)(!0))return;let{file:n,outfitId:l,imageUrl:i,thumbnailUrl:r}=e;if(n&&null!=l)throw Error("file and outfitId cannot be both provided");if(n)return H(n);if(null==l)throw Error("file or outfitId must be provided and cannot be both empty");return X({outfitId:l,imageUrl:i,thumbnailUrl:r})},{manual:!0,onError:e=>{if(e instanceof c.d){if(e.code===u.EJ.UPLOAD_AUDIT_REJECTED)return void s.o.error(C("components.GenerateConfig.imageAuditRejected","Image does not meet content guidelines. Please upload another image."));if(e.code===u.EJ.UPLOAD_AUDIT_FAILED)return void s.o.error(C("components.GenerateConfig.imageAuditServiceUnavailable","Image could not be processed right now. Please try again later or upload another image."))}let t=e instanceof Error?e.message:C("global.common.sendFailed");s.o.error(t)},onFinally:()=>{O(),z(null),U(null),M(v)}}),K=!F||q,V=(0,i.useCallback)(e=>{K||G(e)},[G,K]),Y=(0,i.useMemo)(()=>({canSend:F,sendDisabled:K,loading:q,error:$,handleSend:V,sendType:I,uploadProgress:A,...L}),[L,F,$,V,q,K,I,A]);return(0,l.jsx)(b.Provider,{value:Y,children:n})}},77769:(e,t,n)=>{n.d(t,{X:()=>c});var l=n(25771),i=n(85151),r=n(8640),a=n(77438),s=n(41550),o=n(51529);let u=(0,l.jsx)("div",{className:"flex h-full w-full items-center justify-center rounded-sm bg-[#292929]","aria-hidden":!0,children:(0,l.jsx)(a.u,{className:"!aspect-[241/84] !h-auto w-[72%] max-w-16 opacity-30 [&>svg]:!h-auto [&>svg]:!w-full"})});function c(e){let{src:t,outfitId:n,imageUrl:a,thumbnailUrl:c,onSend:d,interactive:m,showSendButton:f,badgeLabel:h}=e,{t:p}=(0,i.Bd)();return(0,l.jsxs)("div",{className:"group/outfit relative h-full w-full",children:[(0,l.jsx)(s._,{wrapperClassName:"h-full w-full",className:"h-full w-full rounded-sm object-cover",errorSkeleton:u,skeleton:u,src:t,alt:""}),h?(0,l.jsx)("span",{className:"absolute top-0 left-0 z-10 flex min-w-6 items-center justify-center rounded-br-md bg-black/80 px-1.5 py-1 text-xs leading-none font-semibold text-white",children:h}):null,f?(0,l.jsxs)("div",{className:(0,o.cn)("absolute inset-0 flex items-center justify-center rounded-sm opacity-0",m&&"pointer-events-none group-hover/outfit:pointer-events-auto group-hover/outfit:opacity-100"),children:[(0,l.jsx)("div",{className:"absolute inset-0 rounded-sm bg-black/50","aria-hidden":!0}),(0,l.jsx)(r.$,{type:"secondary",size:"small",shape:"round",ring:!0,iconOpacity:!1,className:(0,o.cn)("relative z-10 h-8 border-0 px-3 text-xs font-medium","bg-black/30 text-white backdrop-blur-none","hover:bg-gradient hover:text-text-white-primary"),onClick:e=>{e.stopPropagation(),d({outfitId:n,imageUrl:a,thumbnailUrl:c})},children:p("components.RealtimeVideo.sendPrompt","Send")})]}):null]})}}}]);