var x=Object.defineProperty;var I=(n,i,e)=>i in n?x(n,i,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[i]=e;var a=(n,i,e)=>I(n,typeof i!="symbol"?i+"":i,e);import{j as o}from"./client-By3tlFYA.js";import{P as d}from"./short_number-C9zm8Jg6.js";import{p as j,q as b}from"./useSelectableClick-DFE6ksOx.js";import{g as P}from"./index-TEHZzOO_.js";import{z as c,aO as w,aP as C,aQ as L}from"./status_quoted-Bnf38BMc.js";var h,f;function _(){if(f)return h;f=1;function n(){}return h=n,h}var N=_();const v=P(N);class y extends j{constructor(){super(...arguments);a(this,"updateOnProps",["status"]);a(this,"renderLoadingMediaGallery",()=>{const{height:e,width:r}=this.props;return o.jsx("div",{className:"media-gallery",style:{height:e,width:r}})});a(this,"renderLoadingVideoPlayer",()=>{const{height:e,width:r}=this.props;return o.jsx("div",{className:"video-player",style:{height:e,width:r}})});a(this,"renderLoadingAudioPlayer",()=>{const{height:e,width:r}=this.props;return o.jsx("div",{className:"audio-player",style:{height:e,width:r}})})}render(){const{status:e,width:r,height:l,visible:m}=this.props,s=e.get("media_attachments"),g=e.getIn(["language","translation"])||e.get("language")||this.props.lang;if(s.size===0)return null;if(s.getIn([0,"type"])==="audio"){const t=s.get(0),p=t.getIn(["translation","description"])||t.get("description");return o.jsx(c,{fetchComponent:w,loading:this.renderLoadingAudioPlayer,children:u=>o.jsx(u,{src:t.get("url"),alt:p,lang:g,width:r,height:l,poster:t.get("preview_url")||e.getIn(["account","avatar_static"]),backgroundColor:t.getIn(["meta","colors","background"]),foregroundColor:t.getIn(["meta","colors","foreground"]),accentColor:t.getIn(["meta","colors","accent"]),duration:t.getIn(["meta","original","duration"],0)})})}else if(s.getIn([0,"type"])==="video"){const t=s.get(0),p=t.getIn(["translation","description"])||t.get("description");return o.jsx(c,{fetchComponent:C,loading:this.renderLoadingVideoPlayer,children:u=>o.jsx(u,{preview:t.get("preview_url"),frameRate:t.getIn(["meta","original","frame_rate"]),blurhash:t.get("blurhash"),src:t.get("url"),alt:p,lang:g,width:r,height:l,inline:!0,sensitive:e.get("sensitive"),visible:m,onOpenVideo:v})})}else return o.jsx(c,{fetchComponent:L,loading:this.renderLoadingMediaGallery,children:t=>o.jsx(t,{media:s,lang:g,sensitive:e.get("sensitive"),defaultWidth:r,visible:m,height:l,onOpenMedia:v})})}}a(y,"propTypes",{status:b.map.isRequired,lang:d.string,height:d.number,width:d.number,visible:d.bool}),a(y,"defaultProps",{height:110,width:239});export{y as M};
//# sourceMappingURL=media_attachments-CCzfoNXW.js.map
