Module 163281

4,232 characters · in 003ce903768ef302.js
Dependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>O});var i=n(627968),l=n(64700),r=n(503698),a=n.n(r),s=n(17928),o=n(26137),d=n(268218),u=n(776231),c=n(614269),h=n(829097),m=n(734057),p=n(401648),g=n(194498),x=n(376595),f=n(773503);let A=[];function y(e){let{timeline:t,userIds:n,videoRef:r,guildId:a,channelId:s}=e,o=l.useMemo(()=>x.H.fromAttachmentTimeline(t),[t]),[d,u]=l.useState({speakingUserIds:[],activeSoundboards:[]});return(0,g.A)(()=>{let e=r.current;if(null==e)return;let t=1e3*e.currentTime;u(o.getEventsAtTimestamp(t))}),(0,i.jsx)(f.A,{speakingUserIds:d.speakingUserIds,activeSoundboards:A,userIds:n,guildId:a,channelId:s})}var w=n(939249),I=n(734066),v=n(274372),C=n(794905),j=n(16590),E=n(375708),M=n(310882);function _(e){let{attachment:t,channelId:n,messageId:r}=e,{enableAdvancedSignals:a}=I.L_.useConfig({location:"DistributedClipShareCTA"}),o=t.clip_remote_id,d=(0,s.bG)([v.A],()=>null!=o?v.A.getClipByRemoteId(o):null),{onShareClick:u}=(0,C.A)(n),c=(0,s.bG)([v.A],()=>null!=d&&null!=n&&null!=o&&v.A.wasClipSharedInChannel(o,n)),h=l.useCallback(e=>{null!=d&&(e.stopPropagation(),u({clips:[d],messageReference:{channel_id:n,message_id:r}}))},[u,d,n,r]);return!a||null==d||c?null:(0,i.jsxs)(i.Fragment,{children:[" \xb7 ",(0,i.jsx)(w.D,{tag:"span",className:M.s,onClick:h,children:E.intl.string(j.default.YKst58)})]})}var S=n(696016),N=n(581874);let b=(0,d.Fe)({createPromise:()=>Promise.all([n.e("18995"),n.e("3302"),n.e("57174"),n.e("84971"),n.e("78010"),n.e("30920"),n.e("91652")]).then(n.bind(n,664111)),webpackId:664111,name:"DiscordVideoPlayer",renderLoader:()=>(0,i.jsx)("div",{className:N.Lq})});function O(e){let{attachment:t,posterUrl:n,className:r,active:d=!1,autoPlay:g,src:x,embed:f=!1,fillContainer:A=!1,minWidth:w=500,maxWidth:I=1/0,maxHeight:v=1/0,channelId:C,messageId:M,showTextContent:O=I>=250,showParticipants:T=!0,volume:V,autoMute:P,onVolumeChange:D,onMutedChange:k,onClick:U,onContextMenu:L,allowFullScreen:R=!0}=e,F=t.width??0,H=t.height??0,W=(0,s.bG)([m.A],()=>m.A.getBasicChannel(C)?.guild_id,[C]),G=F>0&&H>0?F/H:16/9,X=Math.min(F>0?F:w,I),z=X/G;z>v&&(X=(z=v)*G),X<w&&(z=(X=w)/G);let B=Math.round(Math.min(X,I)),Q=Math.round(Math.min(z,v)),Y=F>0&&H>0?Math.min(B/F,Q/H,1):1,Z=(0,u.AE)({src:n,width:Math.round(F*Y),height:Math.round(H*Y)}),[K,q]=l.useState(!1),[$,J]=l.useState(!0),ee=l.useMemo(()=>t.clip_events_timeline?.some(e=>null!=e.speaking)??!1,[t.clip_events_timeline]),et=l.useMemo(()=>{if(ee)return[{id:"speaking-indicators",iconComponent:o.r,label:E.intl.string(j.default.hFWVZQ),active:$,onClick:()=>J(e=>!e),"data-testid":"clips-player-speaking-indicators-toggle"}]},[ee,$]),en=(0,h._)({location:S.Mu}).externalAnalyticsEnabled,ei=l.useMemo(()=>en?{contentId:x,videoStreamType:c.u.isHlsUrl(x)?"hls":"mp4",contentType:"clips",title:t.title}:void 0,[en,x,t.title]),el=l.useMemo(()=>t.clip_participants?.map(e=>{let{id:t}=e;return t})??[],[t.clip_participants]),er=l.useCallback(e=>{let{playerState:n,isControlBarExpanded:l,videoRef:r}=e;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsx)(p.A,{createdAt:null!=t.clip_created_at?Date.parse(t.clip_created_at):void 0,participantIds:T?el:[],applicationId:t.application?.id,title:t.title,guildId:W,playerState:n,isControlBarExpanded:l,isFullScreen:K,showTextContent:O,shareCTA:null!=M&&null!=C&&(0,i.jsx)(_,{attachment:t,messageId:M,channelId:C})}),$&&null!=t.clip_events_timeline&&null!=r&&null!=C&&(0,i.jsx)(y,{guildId:W,timeline:t.clip_events_timeline,videoRef:r,userIds:el,channelId:C})]})},[t,W,K,T,O,C,M,$,el]);return(0,i.jsx)("div",{className:a()(N.kL,{[N.HA]:A},r),onClick:e=>e.stopPropagation(),onKeyUp:f?e=>e.stopPropagation():void 0,onKeyDown:f?e=>e.stopPropagation():void 0,onContextMenu:L,style:A?void 0:{width:B,height:Q},children:(0,i.jsx)(b,{crossOrigin:null,src:x,downloadUrl:t.url,downloadContentType:t.content_type,extraButtons:et,poster:Z,posterPlaceholder:t.placeholder,posterPlaceholderVersion:t.placeholder_version,active:d,autoplay:g,initialVolume:V,initialMuted:P,onVolumeChange:D,onMutedChange:k,orientation:"landscape",loadingSpinnerPosition:"center",renderPersistentOverlay:er,parentTransitionState:null,onFullscreenChange:q,onClick:U,withVideoHalo:!0,objectFit:A?"cover":void 0,muxContentMetadata:ei,hideFullScreenBtn:!R})})}}