Build 545032stable
Module 373863
6,672 characters · in 666feb05e7a410fc.jsDependencies
Source Raw
function(e,t,n){n.d(t,{A:()=>P});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 C(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 y=n(661531),w=n(834730),v=n(734066),I=n(274372),j=n(794905),E=n(996682),M=n(27989);function _(e){let{size:t="md",width:n,height:l,color:r=y.A.colors.INTERACTIVE_ICON_DEFAULT,colorClass:a="",...s}=e,o=(0,M.J)(t),d=o?.width??n,u=o?.height??l;return(0,i.jsxs)("svg",{...(0,E.A)(s),width:d,height:u,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,i.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M28.8334 13.3379C29.1092 13.3381 29.3332 13.562 29.3334 13.8379V25.3379C29.3334 27.5469 27.5423 29.3376 25.3334 29.3379H6.66738C4.45825 29.3379 2.66739 27.547 2.66738 25.3379V13.8379C2.66755 13.5619 2.89134 13.3379 3.16738 13.3379H28.8334ZM14.5853 15.7471C14.0777 15.2396 13.2551 15.2396 12.7475 15.7471L8.74746 19.7471C8.50377 19.9908 8.3666 20.3213 8.3666 20.666C8.3666 20.9676 8.47106 21.2589 8.66054 21.4902L8.74746 21.5849L12.7475 25.5849C13.2551 26.0923 14.0777 26.0924 14.5853 25.5849C15.0927 25.0773 15.0927 24.2547 14.5853 23.7471L12.8041 21.9658H16.0004C18.4117 21.9662 20.3666 23.9216 20.3666 26.333C20.3668 27.0508 20.9495 27.6328 21.6674 27.6328C22.3847 27.6322 22.967 27.0504 22.9672 26.333C22.9672 22.4857 19.8476 19.3666 16.0004 19.3662H12.8041L14.5853 17.5849C15.0927 17.0773 15.0927 16.2547 14.5853 15.7471Z",fill:"string"==typeof r?r:r.css,className:a}),(0,i.jsx)("path",{d:"M9.27675 4.02342C9.67707 3.95309 9.99001 4.3646 9.81484 4.73143L6.81191 11.0146C6.74229 11.1603 6.60667 11.2639 6.44765 11.292L3.27382 11.8515C3.00188 11.8995 2.74267 11.7172 2.69472 11.4453L2.31777 9.31248C1.93416 7.13691 3.38731 5.06133 5.56289 4.67772L9.27675 4.02342Z",fill:"string"==typeof r?r:r.css,className:a}),(0,i.jsx)("path",{d:"M19.7807 2.17088C20.1811 2.10027 20.494 2.51195 20.3187 2.87889L17.3168 9.16209C17.2472 9.30779 17.1116 9.4114 16.9525 9.43944L10.8852 10.5088C10.4848 10.5792 10.1718 10.1676 10.3471 9.80077L13.35 3.51756C13.4197 3.37203 13.5554 3.26921 13.7143 3.2412L19.7807 2.17088Z",fill:"string"==typeof r?r:r.css,className:a}),(0,i.jsx)("path",{d:"M24.2221 1.39745C26.2944 1.17734 28.2121 2.59832 28.5795 4.68163L28.9564 6.81541C29.0042 7.08724 28.822 7.34658 28.5502 7.39452L21.39 8.65721C20.9897 8.72774 20.6769 8.31607 20.8519 7.9492L23.8539 1.66698C23.9239 1.52058 24.0607 1.4146 24.2221 1.39745Z",fill:"string"==typeof r?r:r.css,className:a})]})}var S=n(16590),N=n(375708),L=n(310882);function b(e){let{attachment:t,channelId:n,messageId:r,isControlBarExpanded:o,isPlayerActive:d}=e,{enableAdvancedSignals:u}=v.L_.useConfig({location:"DistributedClipShareCTA"}),c=t.clip_remote_id,h=(0,s.bG)([I.A],()=>null!=c?I.A.getClipByRemoteId(c):null),{onShareClick:m}=(0,j.A)(n),p=(0,s.bG)([I.A],()=>null!=h&&null!=n&&null!=c&&I.A.wasClipSharedInChannel(c,n)),g=l.useCallback(e=>{null!=h&&(e.stopPropagation(),m({clips:[h],messageReference:{channel_id:n,message_id:r}}))},[m,h,n,r]);return!u||null==h||p?null:(0,i.jsxs)("button",{className:a()(L.eZ,{[L.vu]:o,[L.jn]:!d}),onClick:g,children:[(0,i.jsx)(_,{size:"refresh_sm",color:y.A.colors.WHITE}),(0,i.jsx)(w.E,{variant:"text-xs/semibold",color:"always-white",children:N.intl.string(S.default.YKst58)})]})}var T=n(696016),O=n(581874);let V=(0,d.Fe)({createPromise:()=>Promise.all([n.e("52127"),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:O.Lq})});function P(e){let{attachment:t,posterUrl:n,className:r,active:d=!1,autoPlay:g,src:x,embed:f=!1,fillContainer:A=!1,minWidth:y=500,maxWidth:w=1/0,maxHeight:v=1/0,channelId:I,messageId:j,showTextContent:E=w>=250,showParticipants:M=!0,volume:_,autoMute:L,onVolumeChange:P,onMutedChange:D,onClick:U,onContextMenu:k,allowFullScreen:R=!0}=e,H=t.width??0,F=t.height??0,W=(0,s.bG)([m.A],()=>m.A.getBasicChannel(I)?.guild_id,[I]),G=H>0&&F>0?H/F:16/9,X=Math.min(H>0?H:y,w),Z=X/G;Z>v&&(X=(Z=v)*G),X<y&&(Z=(X=y)/G);let B=Math.round(Math.min(X,w)),z=Math.round(Math.min(Z,v)),Q=H>0&&F>0?Math.min(B/H,z/F,1):1,Y=(0,u.AE)({src:n,width:Math.round(H*Q),height:Math.round(F*Q)}),[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:N.intl.string(S.default.hFWVZQ),active:$,onClick:()=>J(e=>!e),"data-testid":"clips-player-speaking-indicators-toggle"}]},[ee,$]),en=(0,h._)({location:T.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,isActive:a}=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:M?el:[],applicationId:t.application?.id,title:t.title,guildId:W,playerState:n,isControlBarExpanded:l,isFullScreen:K,showTextContent:E}),null!=j&&null!=I&&(0,i.jsx)(b,{isControlBarExpanded:l,isPlayerActive:a,attachment:t,messageId:j,channelId:I}),$&&null!=t.clip_events_timeline&&null!=r&&null!=I&&(0,i.jsx)(C,{guildId:W,timeline:t.clip_events_timeline,videoRef:r,userIds:el,channelId:I})]})},[t,W,K,M,E,I,j,$,el]);return(0,i.jsx)("div",{className:a()(O.kL,{[O.HA]:A},r),onClick:e=>e.stopPropagation(),onKeyUp:f?e=>e.stopPropagation():void 0,onKeyDown:f?e=>e.stopPropagation():void 0,onContextMenu:k,style:A?void 0:{width:B,height:z},children:(0,i.jsx)(V,{crossOrigin:null,src:x,downloadUrl:t.url,downloadContentType:t.content_type,extraButtons:et,poster:Y,posterPlaceholder:t.placeholder,posterPlaceholderVersion:t.placeholder_version,active:d,autoplay:g,initialVolume:_,initialMuted:L,onVolumeChange:P,onMutedChange:D,orientation:"landscape",loadingSpinnerPosition:"center",renderPersistentOverlay:er,parentTransitionState:null,onFullscreenChange:q,onClick:U,withVideoHalo:!0,objectFit:A?"cover":void 0,muxContentMetadata:ei,hideFullScreenBtn:!R})})}}