Loading
function(e,t,n){"use strict";n.d(t,{A:()=>v,e:()=>y});var l=n(627968),i=n(64700),s=n(503698),r=n.n(s),a=n(796873),o=n.n(a),u=n(17928),c=n(911608),d=n(939249),m=n(789645),h=n(349288),p=n(834730),f=n(228366),g=n(31717),E=n(399263);let A={cancel(e,t){f.h.dispatch({type:"UPLOAD_CANCEL_REQUEST",channelId:e,file:t});let n=E.A.getMessageForFile(t.id);null==n||""===g.A.getDraft(n.channel_id,g.C.ChannelMessage)&&f.h.dispatch({type:"DRAFT_SAVE",channelId:n.channel_id,draft:n.content,draftType:g.C.ChannelMessage})}};var C=n(46054),x=n(453771),I=n(375708),_=n(490563);function S(e){let{filename:t}=e,i=(0,x.GD)(t),s=n(714694)(`./icon-file-${i}.svg`);return(0,l.jsx)("img",{className:_.Kk,src:s,alt:I.intl.formatToPlainString(I.t.g6KdFv,{fileType:i}),title:i})}function y(e){let{channelId:t,file:n}=e,s=(0,u.bG)([E.A],()=>E.A.getMessageForFile(n.id)?.content),r=i.useMemo(()=>{let e=n.items;return null==e?I.intl.string(I.t.jfKTes):1===e.length&&null!=e[0].filename?e[0].filename:I.intl.formatToPlainString(I.t.D0noUt,{count:e.length})},[n.items]),a=i.useCallback(()=>{A.cancel(t,n)},[t,n]),h=100===n.progress,p=!h&&n.currentSize>0,f=i.useMemo(()=>null==s||""===s.trim()?null:C.A.parse(s),[s]);return(0,l.jsxs)(l.Fragment,{children:[null!=f&&(0,l.jsx)("div",{className:_.Qs,children:f}),(0,l.jsx)("div",{className:_.Ig,children:(0,l.jsxs)("div",{className:_.NJ,children:[(0,l.jsx)(S,{filename:r}),(0,l.jsxs)("div",{className:_.Jg,children:[(0,l.jsxs)("div",{className:_.tP,children:[(0,l.jsx)("div",{className:_.iW,children:r}),p?(0,l.jsx)("div",{className:_.Ej,children:`\u{2014} ${o().filesize(n.currentSize)}`}):null]}),(0,l.jsx)("div",{className:_.L$,children:h?I.intl.string(I.t.jfKTes):(0,l.jsx)(c.z,{value:n.progress,"aria-label":r})})]}),h?null:(0,l.jsx)(d.D,{onClick:a,children:(0,l.jsx)(m.P,{size:"md",color:"currentColor",className:_.x7})})]})})]})}let v=function(e){let{className:t,url:n,fileName:i,fileSize:s,onClick:a,onContextMenu:u,renderAdjacentContent:c}=e;return(0,l.jsxs)("div",{className:r()(_.Ig,t),children:[(0,l.jsxs)("div",{className:_.NJ,children:[(0,l.jsx)(S,{filename:i}),(0,l.jsxs)("div",{className:_.Jg,children:[(0,l.jsx)("div",{className:_.RT,children:(0,l.jsx)(h.Anchor,{className:_.AD,href:n,onClick:a,onContextMenu:u,children:i})}),(0,l.jsx)(p.E,{variant:"text-xs/normal",color:"text-muted",children:o().filesize(s)})]})]}),null!=c&&c()]})}}