Module 802867

6,770 characters · in 600f84e867c088a1.js
Dependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>el,D:()=>en});var l=n(477900),i=n(582128),s=n(503698),r=n.n(s),a=n(17928),o=n(821609),u=n(866665),c=n(408278),d=n(622631),m=n(367513),p=n(401843),g=n(964486),h=n(684339),f=n(164617),x=n(402216),A=n(626584),v=n(525505),E=n(753727),C=n(652896),I=n(638480),j=n(607407),S=n(872363),_=n(451988),N=n(765671),b=n(461782),y=n(426179),D=n(51092),R=n(40056),k=n(109294);function T(e){return(1&e.buttons)==1}let w=i.memo(function(e){let{...t}=e,{streamId:n,onResize:s,wrapperClassName:a}=t,{onActive:o}=i.useContext(b.k3),{enabled:u,minZoom:c,isDragging:d,setIsDragging:m,panOffset:p,setPanOffset:h,zoomLevel:f,isWheeling:x,setIsWheeling:A,isSlidering:v,setVideoAspectRatio:E,wrapperRef:C,doZoom:I,clampPanOffset:j}=i.useContext(R.e9),[S,w]=i.useState(null),[L,O]=i.useState(null),[M,V]=i.useState(0),[G,P]=i.useState(null),[F,H]=i.useState(null),[U,W]=i.useState(!1),z=i.useRef(new _.Ep),$=i.useRef(new _.Ep),B=i.useRef(null),Y=f>c,Z=i.useCallback(e=>{e.width>0&&e.height>0&&E(e.width/e.height),s?.(e)},[s,E]),Q=i.useCallback(e=>{if(null==C.current)return R.qd;let t=C.current.getBoundingClientRect();return{x:e.clientX-t.left-t.width/2,y:e.clientY-t.top-t.height/2}},[C]),K=i.useCallback(e=>{if(!Y||!T(e))return;e.preventDefault(),e.stopPropagation();let t=Q(e);m(!0),O(t),w(t),V(Date.now()),H(t),P(p)},[Q,Y,p,m]),X=i.useCallback(e=>{if((u||Y)&&o(),!d||!Y||null==F||null==G)return;e.preventDefault(),e.stopPropagation();let t=Q(e),n=t.x-F.x,l=t.y-F.y;h(j({x:G.x+n,y:G.y+l})),w(t)},[j,F,G,u,Q,d,Y,o,h]),q=i.useCallback(e=>{!d||T(e)||(e.preventDefault(),e.stopPropagation(),m(!1),H(null),P(null))},[d,m]),J=i.useCallback(e=>{if(Y&&null!=L&&null!=S){let{x:t,y:n}=L,{x:l,y:i}=S;(Math.sqrt((l-t)**2+(i-n)**2)>.01||Date.now()-M>=500)&&(e.preventDefault(),e.stopPropagation())}},[Y,L,M,S]),ee=i.useCallback(()=>{m(!1),H(null),P(null)},[m]),et=i.useCallback(e=>{u&&(A(!0),I(f-e.deltaY/100,Q(e),"wheel"),o(),z.current.start(100,()=>{A(!1)}))},[u,I,f,Q,o,A]);(0,N.i4)(C,i.useCallback(e=>{let{width:t,height:n}=e;if(!Y||null==t||null==n)return;let l=B.current;if(null==l){B.current={width:t,height:n};return}let{width:i,height:s}=l;1>Math.abs(t-i)&&1>Math.abs(n-s)||(W(!0),h(e=>{let l=i*(f-1)/2,r=s*(f-1)/2,a=t*(f-1)/2,o=n*(f-1)/2;return j({x:(0!==l?e.x/l:0)*a,y:(0!==r?e.y/r:0)*o})}),B.current={width:t,height:n},$.current.start(100,()=>{W(!1)}))},[j,Y,f,h]),[Y,f]),(0,g.l0)(()=>{z.current.stop(),$.current.stop()}),i.useEffect(()=>{null!=n&&(0,y.c)(n,void 0,u&&Y?f:1)},[u,Y,n,f]);let en=i.useMemo(()=>{let e=j(p);return{"--custom-zoom-scale":f,"--custom-pan-x":`${e.x}px`,"--custom-pan-y":`${e.y}px`,"--custom-zoom-transition":d||U||x||v?"none":"transform 0.15s ease-out"}},[j,d,U,x,v,p,f]);return(0,l.jsx)("div",{ref:C,className:r()(k.iE,a,{[k.rc]:u&&Y,[k.d$]:d}),onMouseDown:K,onMouseMove:X,onMouseUp:q,onMouseLeave:ee,onWheel:et,onClick:J,children:null!=n&&(0,l.jsx)("div",{className:r()(k.j,k.L2),style:en,children:(0,l.jsx)(D.A,{...t,onResize:Z,wrapperClassName:void 0})})})});var L=n(742023),O=n(919706),M=n(616356),V=n(280450),G=n(734057),P=n(453028),F=n(531685),H=n(200749),U=n(566331),W=n(768088),z=n(256195),$=n(834730),B=n(1215),Y=n(375708),Z=n(584841);function Q(e){let{stream:t,isSmall:n,selected:i,isSelfStream:s}=e;return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(j.A,{className:r()(Z.HL,Z.gH),stream:t,noText:!0}),!i&&(0,l.jsxs)("div",{className:r()(Z.Qs,Z.JK,{[Z.EX]:n}),children:[(0,l.jsx)($.E,{className:Z.gS,color:"text-overlay-light",variant:n?"text-sm/semibold":"text-md/semibold",children:s?Y.intl.string(Y.t.UeEwjy):Y.intl.string(Y.t["1i3tSY"])}),(0,l.jsx)(u.m,{asContainer:!0,text:s?Y.intl.string(Y.t["ro/HN8"]):Y.intl.string(Y.t.UPf6ZM),children:(0,l.jsx)("div",{children:(0,l.jsx)(B.n,{size:"md",color:"currentColor",className:Z.uI,colorClass:Z.g$})})})]})]})}var K=n(275731),X=n(345812),q=n(652215),J=n(806931),ee=n(731854);let et=new A.A("StreamTile");function en(e){let{participant:t,selected:n,focused:i,idle:s,width:r,premiumIndicator:o}=e,u=(0,a.bG)([M.A],()=>M.A.getActiveStreamForUser(t.user.id,t.stream.guildId)),c=(0,X.VE)(r);return(0,l.jsxs)(l.Fragment,{children:[n||i?null:(0,l.jsx)(K.A,{participant:t}),i||null==u||u.state===q.XYD.ENDED||u.state===q.XYD.FAILED?null:(0,l.jsx)(S.A,{size:x.Ay.Sizes.SMALL,className:Z.Ok,participant:t,showQuality:!c&&!s,isUpsellEnabled:!1,premiumIndicator:o})]})}function el(e){let{participant:t,selected:n,onVideoResize:s,fit:x,popoutType:A,width:S,wrapperClassName:_,paused:N=!1}=e,b=P.Ay.getVideoComponent(),y=(0,a.bG)([V.default],()=>V.default.getId()),D=(0,E.A)(),{stream:R,user:k,streamId:T}=t,$=(0,a.bG)([G.A],()=>G.A.getChannel(R.channelId)),B=(0,a.bG)([M.A],()=>M.A.getActiveStreamForUser(k.id,R.guildId),[k.id,R.guildId]),K=(0,a.bG)([M.A],()=>M.A.getAllActiveStreams().length>0),X=(0,a.bG)([F.A],()=>F.A.isFocused()),en=(0,a.bG)([L.Ay],()=>L.Ay.pauseSelfStreamPreviewWhenUnfocused),el=B?.ownerId===y,ei=el&&en&&!X&&A===f.N.NO_POPOUT,es=null!=B?(0,I.A)(B,k,k.id===y,ei):null,er=S<195;(0,g.Ay)(()=>{!K&&$?.isGuildStageVoice()&&!el&&!M.A.isStreamMarkedFull((0,C._z)(R))&&((0,p.A9)(R),m.A.updateStageStreamSize(R.channelId,!1))});let ea=(0,v.u)(ee.x.STREAM,t.user.id);if(i.useEffect(()=>{et.info(`Stream Tile State - activeStream: ${null!=B} | selected: ${n} | Video: ${null!=b} | MediaEngine: ${P.Ay.supports(ee.O5.VIDEO)}`)},[b,B,n]),D)return(0,l.jsx)(Q,{stream:t.stream,isSmall:er,selected:n,isSelfStream:k.id===y});if(B?.state===q.XYD.ENDED)return(0,l.jsx)(U.A,{selected:n,stream:B,width:S});if(null!=ea||B?.state===q.XYD.FAILED)return(0,l.jsx)(W.A,{avError:ea?.type,avErrorContext:ea,selected:n,stream:t.stream,width:S});if(t.type===J.lp.HIDDEN_STREAM)return(0,l.jsx)(z.A,{selected:n,participant:t,width:S});if(null!=B&&!n&&null!=b&&P.Ay.supports(ee.O5.VIDEO))return(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)(w,{onResize:s,wrapperClassName:r()(A!==f.N.CALL_TILE?Z.tN:void 0,_),className:Z.Qs,streamId:T,videoComponent:b,fit:x,paused:N||B?.state===q.XYD.PAUSED||ei,videoSpinnerContext:el?h.u.SELF_STREAM:h.u.REMOTE_STREAM,userId:k.id,streamKey:t.id},T),null!=es?(0,l.jsx)(O.A,{size:(0,H.J)(S),...es}):null]});else return(0,l.jsxs)("div",{className:r()(Z.Qs,Z.Rh,{[Z.EX]:er}),children:[(0,l.jsx)(j.A,{noImage:!0,noText:!0,className:r()(Z.HL,{[Z.gH]:null==B}),stream:t.stream}),n?null:(0,l.jsxs)(l.Fragment,{children:[(0,l.jsx)("div",{className:Z.lO,children:(0,l.jsx)(o.$,{variant:"secondary",size:er?"sm":"md",text:S<175?Y.intl.string(Y.t.I6JG46):Y.intl.string(Y.t["7Xq/nV"])})}),K?(0,l.jsx)("div",{className:r()(Z.lO,Z.EU),children:(0,l.jsx)(u.m,{text:Y.intl.string(Y.t.wCrzut),children:(0,l.jsx)(c.K,{variant:"secondary",size:er?"sm":"md",icon:d.v,"aria-label":Y.intl.string(Y.t.wCrzut),onClick:e=>{e.stopPropagation(),(0,p.A9)(t.stream,{forceMultiple:!0})}})})}):null]})]})}}