Loading
function(e,t,n){n.d(t,{A:()=>eS});var i=n(627968),l=n(64700),a=n(503698),s=n.n(a),r=n(17928),o=n(876230),d=n(26137),u=n(268218),c=n(776231),m=n(614269),h=n(829097),p=n(734057),g=n(945810);let C=(0,g.mj)({kind:"user",name:"2026-05-clips-scrub-preview-frontend",defaultConfig:{enableScrubPreview:!1},variations:{1:{enableScrubPreview:!0}}});var I=n(505124),f=n(43990),v=n(922016),A=n(460905),_=n(110384),x=n(720149),j=n(565645),M=n(822123),S=n(267889),E=n(451909),b=n(118517),N=n(232835),y=n(625494);let T=(0,g.mj)({kind:"user",name:"2026-05-clips-media-comments",defaultConfig:{enableMediaComments:!1},variations:{1:{enableMediaComments:!0}}});var L=n(652215),k=n(307731),w=n(381941),R=n(909022);function P(e,t){let n=t?.current?.currentTime;return null==n?{attachment_id:e,timestamp:0}:{attachment_id:e,timestamp:Math.floor(1e3*n)}}function G(e){let{attachmentId:t,channelId:n,messageId:a,guildId:o,videoRef:d,hidden:u=!1}=e,c=(0,M.QZ)(o).slice(0,3),m=(0,r.bG)([p.A],()=>p.A.getChannel(n),[n]),{enableMediaComments:h}=T.useConfig({location:"ClipEmbedMediaMentionBar"}),g=l.useRef(null);function C(e,n){e?.stopPropagation(),function(e){if(null==m||null==a||null==d?.current?.currentTime)return;let n=null!=e.id?!0===e.animated?`<a:${e.name}:${e.id}>`:`<:${e.name}:${e.id}>`:"surrogates"in e&&null!=e.surrogates?e.surrogates:e.name;x.A.sendMessage(m.id,E.Ay.parse(m,n),!1,{location:w.Hx.MEDIA_MENTION,messageReference:{channel_id:m.id,guild_id:m.getGuildId()??void 0,message_id:a},mediaMention:P(t,d)})}(n)}return h&&null!=m&&null!=a?(0,i.jsxs)("div",{className:s()(R.M0,{[R.pd]:u}),children:[(0,i.jsx)("div",{className:R.gm,children:c.map(e=>(0,i.jsx)("button",{type:"button",className:R.x6,onClick:t=>C(t,e),children:(0,i.jsx)(j.A,{emojiId:e.id,emojiName:null!=e.id?e.name:e.surrogates,shouldAnimate:!1,animated:"animated"in e?e.animated:void 0,surrogate:"surrogates"in e?e.surrogates:void 0})},`${e.id??0}:${e.name}`))}),(0,i.jsx)(U,{}),(0,i.jsx)(v.Y,{targetElementRef:g,renderPopout:e=>{let{closePopout:t}=e;return(0,i.jsx)(S.A,{channel:m,closePopout:t,messageId:a,pickerIntention:k.EmojiIntention.CHAT,onSelectEmoji:e=>{let{emoji:t}=e;null!=t&&C(void 0,t)}})},position:"top",align:"center",clickTrap:!0,children:e=>(0,i.jsx)("button",{...e,ref:g,type:"button",className:R.x6,children:(0,i.jsx)(A.n,{size:"sm"})})}),(0,i.jsx)("button",{type:"button",className:R.x6,onClick:function(e){if(e.stopPropagation(),null==m||null==a)return;let n=N.A.getMessage(m.id,a);null==n||null!=d?.current?.currentTime&&((0,b.Yf)({channel:m,message:n,shouldMention:!e.shiftKey,showMentionToggle:!m.isPrivate(),mediaMention:P(t,d)}),y._.dispatch(L.jej.FOCUS_CHANNEL_TEXT_AREA,{channelId:m.id}))},children:(0,i.jsx)(_.W,{size:"sm"})})]}):null}function U(){return(0,i.jsx)("div",{className:R.yF})}var D=n(459192),H=n(534890),B=n(661531),F=n(97808),O=n(778712),V=n(228366);let K=[],Z={},$={};function z(e){if(null==e.id||null==e.channel_id||null==e.media_mention||null!=$[e.id])return!1;let t={attachmentId:e.media_mention.attachment_id,timestamp:e.media_mention.timestamp,channelId:e.channel_id,messageId:e.id},n=Z[t.attachmentId]??(Z[t.attachmentId]=[]);return Z[t.attachmentId]=n.concat(t).sort((e,t)=>e.timestamp-t.timestamp),$[e.id]=t.attachmentId,!0}function Y(e){let t=$[e];if(null==t)return!1;let n=Z[t];if(null!=n){let i=n.filter(t=>t.messageId!==e);0===i.length?delete Z[t]:Z[t]=i}return delete $[e],!0}class J extends r.Ay.Store{static displayName="MediaMentionStore";getMentionsForAttachment(e){return Z[e]??K}}let Q=new J(V.h,{LOAD_MESSAGES_SUCCESS:function(e){let{messages:t}=e;return t.reduce((e,t)=>z(t)||e,!1)},LOAD_MESSAGES_AROUND_SUCCESS:function(e){let{messages:t}=e;return t.reduce((e,t)=>z(t)||e,!1)},MESSAGE_CREATE:function(e){let{message:t}=e;return z(t)},MESSAGE_DELETE:function(e){let{id:t}=e;return Y(t)},MESSAGE_DELETE_BULK:function(e){let{ids:t}=e;return t.reduce((e,t)=>Y(t)||e,!1)},LOGOUT:function(){Z={},$={}}});var W=n(7584);let q=/^<(a)?:(\w+):(\d+)>$/;var X=n(465364),ee=n(933668);function et(e){let{attachmentId:t,durationSeconds:n,hidden:l=!1}=e,a=(0,r.bG)([Q],()=>Q.getMentionsForAttachment(t),[t]),{enableMediaComments:o}=T.useConfig({location:"ClipEmbedMediaMentionTimeline"});return!o||0===a.length||n<=0?null:(0,i.jsx)("div",{className:s()(ee.IO,{[ee.pd]:l}),children:a.map(e=>(0,i.jsx)(en,{entry:e,durationSeconds:n},e.messageId))})}function en(e){let{entry:t,durationSeconds:n}=e,a=(0,r.bG)([N.A],()=>N.A.getMessage(t.channelId,t.messageId),[t.channelId,t.messageId]),s=`${Math.min(100,t.timestamp/1e3/n*100)}%`,o=l.useMemo(()=>(function(e){let t=e.trim();if(0===t.length)return null;let n=t.match(q);return null!=n?{animated:"a"===n[1],emojiName:n[2],emojiId:n[3]}:""!==W.Ay.convertSurrogateToName(t,!1)?{surrogate:t,emojiName:t}:null})(a?.content??""),[a?.content]),d=l.useMemo(()=>null!=a&&""!==a.content?(0,X.Ay)(a,{formatInline:!0}).content:null,[a]);if(null==a)return null;let u=(0,i.jsx)("div",{className:ee.xL,style:{left:s},children:null!=o?(0,i.jsx)(j.A,{emojiId:o.emojiId,emojiName:o.emojiName,shouldAnimate:!1,animated:o.animated,surrogate:o.surrogate,className:ee.Zg}):(0,i.jsx)(H.o,{colorClass:ee.Or,color:B.A.colors.ICON_OVERLAY_LIGHT,size:"refresh_sm"})});return null==d?u:(0,i.jsx)(D.u,{asset:(0,i.jsx)(F.eu,{src:a.author.getAvatarURL(void 0,16),size:O._3.SIZE_16,"aria-hidden":!0}),assetSize:16,lineClamp:1,body:d,children:u})}var ei=n(783384),el=n(194498),ea=n(376595),es=n(773503);let er=[];function eo(e){let{timeline:t,userIds:n,videoRef:a,guildId:s,channelId:r}=e,o=l.useMemo(()=>ea.H.fromAttachmentTimeline(t),[t]),[d,u]=l.useState({speakingUserIds:[],activeSoundboards:[]});return(0,el.A)(()=>{let e=a.current;if(null==e)return;let t=1e3*e.currentTime;u(o.getEventsAtTimestamp(t))}),(0,i.jsx)(es.A,{speakingUserIds:d.speakingUserIds,activeSoundboards:er,userIds:n,guildId:s,channelId:r})}var ed=n(834730),eu=n(274372),ec=n(458977),em=n(352527),eh=n(996682),ep=n(27989);function eg(e){let{size:t="md",width:n,height:l,color:a=B.A.colors.INTERACTIVE_ICON_DEFAULT,colorClass:s="",...r}=e,o=(0,ep.J)(t),d=o?.width??n,u=o?.height??l;return(0,i.jsxs)("svg",{...(0,eh.A)(r),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 a?a:a.css,className:s}),(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 a?a:a.css,className:s}),(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 a?a:a.css,className:s}),(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 a?a:a.css,className:s})]})}var eC=n(16590),eI=n(375708),ef=n(310882);function ev(e){let{attachment:t,channelId:n,messageId:a,isControlBarExpanded:o,isPlayerActive:d}=e,{enableDistributedClips:u}=ec.A.useConfig({location:"DistributedClipShareCTA"}),c=t.clip_remote_id,m=(0,r.bG)([eu.Ay],()=>null!=c?eu.Ay.getClipByRemoteId(c):null),{onShareClick:h}=(0,em.A)(n),p=(0,r.bG)([eu.Ay],()=>null!=m&&null!=n&&null!=c&&eu.Ay.wasClipSharedInChannel(c,n)),g=l.useCallback(e=>{null!=m&&(e.stopPropagation(),h({clips:[m],messageReference:{channel_id:n,message_id:a}}))},[h,m,n,a]);return!u||null==m||p?null:(0,i.jsxs)("button",{className:s()(ef.eZ,{[ef.vu]:o,[ef.jn]:!d}),onClick:g,children:[(0,i.jsx)(eg,{size:"refresh_sm",color:B.A.colors.WHITE}),(0,i.jsx)(ed.E,{variant:"text-xs/semibold",color:"always-white",children:eI.intl.string(eC.default.YKst58)})]})}var eA=n(834926);function e_(e){let{playerState:t,isControlBarExpanded:n,videoRef:l,isActive:a,isVolumeExpanded:r,attachment:o,guildId:d,isFullScreen:u,showParticipants:c,showTextContent:m,channelId:h,messageId:p,showSpeakingIndicators:g,clipUserIds:C,durationSeconds:v}=e;return(0,i.jsx)(f.N,{theme:I.NJ.MIDNIGHT,children:e=>(0,i.jsxs)("div",{className:s()(eA.MU,e),children:[(0,i.jsx)(ei.A,{createdAt:null!=o.clip_created_at?Date.parse(o.clip_created_at):void 0,participantIds:c?C:[],applicationId:o.application?.id,title:o.title,guildId:d,playerState:t,isControlBarExpanded:n,isFullScreen:u,showTextContent:m}),null!=p&&null!=h&&(0,i.jsx)(ev,{isControlBarExpanded:n,isPlayerActive:a,attachment:o,messageId:p,channelId:h}),g&&null!=o.clip_events_timeline&&null!=l&&null!=h&&(0,i.jsx)(eo,{guildId:d,timeline:o.clip_events_timeline,videoRef:l,userIds:C,channelId:h}),a&&null!=d&&(0,i.jsx)(G,{attachmentId:o.id,channelId:h,messageId:p,guildId:d,videoRef:l,hidden:!n||r}),null!=d&&(0,i.jsx)(et,{attachmentId:o.id,durationSeconds:o.duration_secs??v,hidden:!n})]})})}var ex=n(696016),ej=n(581874);let eM=(0,u.Fe)({createPromise:()=>Promise.resolve().then(n.bind(n,664111)),webpackId:664111,name:"DiscordVideoPlayer",renderLoader:()=>(0,i.jsx)("div",{className:ej.Lq})});function eS(e){let{attachment:t,posterUrl:n,className:a,autoPlay:u,src:g,fillContainer:I=!1,minWidth:f=500,maxWidth:v=1/0,maxHeight:A=1/0,channelId:_,messageId:x,showTextContent:j=v>=250,showParticipants:M=!0,volume:S,autoMute:E,onVolumeChange:b,onMutedChange:N,onClick:y,onContextMenu:T,onPlay:L,allowFullScreen:k=!0}=e,w=t.width??0,R=t.height??0,P=(0,r.bG)([p.A],()=>p.A.getBasicChannel(_)?.guild_id,[_]),G=w>0&&R>0?w/R:16/9,U=Math.min(w>0?w:f,v),D=U/G;D>A&&(U=(D=A)*G),U<f&&(D=(U=f)/G);let H=Math.round(Math.min(U,v)),B=Math.round(Math.min(D,A)),F=w>0&&R>0?Math.min(H/w,B/R,1):1,O=(0,c.AE)({src:n,width:Math.round(w*F),height:Math.round(R*F)}),[V,K]=l.useState(!1),[Z,$]=l.useState(!0),[z,Y]=l.useState(0),J=l.useRef(0),Q=l.useCallback((e,t)=>{t!==o.KB.BUFFERING_RECOVERY&&e===o.Q6.PLAYING&&L?.(t!==o.KB.USER,1e3*J.current,1e3*z)},[z,L]),W=l.useCallback((e,t)=>{J.current=e,Number.isFinite(t)&&t>0&&Y(e=>e===t?e:t)},[]),q=l.useMemo(()=>t.clip_events_timeline?.some(e=>null!=e.speaking)??!1,[t.clip_events_timeline]),X=l.useMemo(()=>{if(q)return[{id:"speaking-indicators",iconComponent:d.r,label:eI.intl.string(eC.default.hFWVZQ),active:Z,onClick:()=>$(e=>!e),"data-testid":"clips-player-speaking-indicators-toggle"}]},[q,Z]),ee=(0,h._)({location:ex.Mu}).externalAnalyticsEnabled,et=l.useMemo(()=>ee?{contentId:g,videoStreamType:m.u.isHlsUrl(g)?"hls":"mp4",contentType:"clips",title:t.title}:void 0,[ee,g,t.title]),en=l.useMemo(()=>t.clip_participants?.map(e=>{let{id:t}=e;return t})??[],[t.clip_participants]),{enableScrubPreview:ei}=C.useConfig({location:"ClipsPlayer"}),el=l.useCallback(e=>{let{playerState:n,isControlBarExpanded:l,videoRef:a,isActive:s,isVolumeExpanded:r}=e;return(0,i.jsx)(e_,{attachment:t,guildId:P,isFullScreen:V,showParticipants:M,showTextContent:j,channelId:_,messageId:x,showSpeakingIndicators:Z,clipUserIds:en,durationSeconds:z,playerState:n,isControlBarExpanded:l,videoRef:a,isActive:s,isVolumeExpanded:r})},[t,P,V,M,j,_,x,Z,en,z]);return(0,i.jsx)("div",{className:s()(ej.kL,{[ej.HA]:I},a),onClick:e=>e.stopPropagation(),onContextMenu:T,style:I?void 0:{width:H,height:B},children:(0,i.jsx)(eM,{src:g,downloadUrl:t.url,downloadContentType:t.content_type,extraButtons:X,poster:O,posterPlaceholder:t.placeholder,posterPlaceholderVersion:t.placeholder_version,autoplay:u,initialActive:!1,initialVolume:S,initialMuted:E,onVolumeChange:b,onMutedChange:N,onProgressUpdate:W,orientation:"landscape",loadingSpinnerPosition:"center",renderPersistentOverlay:el,parentTransitionState:null,onFullscreenChange:K,onClick:y,onPlayerStateChange:Q,withVideoHalo:!0,objectFit:I?"cover":void 0,muxContentMetadata:et,hideFullScreenBtn:!k,hideSkipButtons:!0,compactTimeDisplay:!0,autoHideVolumeSlider:!0,hidePlaybackSpeedBtn:!0,scrubPreviewVttUrl:ei?t.spritesheet_vtt_url:void 0,scrubPreviewImageUrl:ei?t.spritesheet_image_url:void 0})})}}