"use strict";(self.webpackChunktinode_webapp=self.webpackChunktinode_webapp||[]).push([[942],{8942:function(e,s,n){n.r(s),n.d(s,{default:function(){return v}});var a=n(1594),i=n.n(a),o=n(8181),d=n(8892),t=n(1725),r=n(6904),l=n(4532),c=n(6110),h=n(5446);const p=(0,o.defineMessages)({unknown_name:{id:"unknown_name",defaultMessage:"Unknown",description:"Name to show when the name is missing"}});class v extends i().PureComponent{constructor(e){super(e),this.state={content:e.content.object},e.content.object||(0,c.QJ)(e.content.file).then(e=>{this.setState({content:e})}),this.handleSendCard=this.handleSendCard.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}handleKeyDown(e){e.preventDefault(),"Escape"===e.key&&this.props.onClose()}handleSendCard(){this.props.onClose(),this.props.onSendMessage(this.props.content)}render(){const e=this.state.content,s=l.TheCard.getFn(e),n=l.TheCard.getPhotoUrl(e)||null,a=e?.note,i=l.TheCard.getOrg(e),c=l.TheCard.getComm(e,"email")||[],v=l.TheCard.getComm(e,"tel")||[],m=l.TheCard.getComm(e,"tinode")||[],u=l.TheCard.getComm(e,"http")||[],D=[];return c.forEach((e,s)=>{const n=Array.isArray(e.des)?e.des.join(", "):"";D.push((0,h.jsxDEV)("div",{className:"group quoted",children:[(0,h.jsxDEV)("tt",{children:e.value},void 0,!1),(0,h.jsxDEV)("span",{className:"small gray",children:[" ",n?`(${n})`:""]},void 0,!0)]},`email-${s}`,!0))}),v.forEach((e,s)=>{let n=e.value;try{const s=(0,d.L)(e.value);n=s?s.formatInternational():e.value}catch(e){}const a=Array.isArray(e.des)?e.des.join(", "):"";D.push((0,h.jsxDEV)("div",{className:"group quoted",children:[(0,h.jsxDEV)("tt",{children:n},void 0,!1),(0,h.jsxDEV)("span",{className:"small gray",children:[" ",a?`(${a})`:""]},void 0,!0)]},`tel-${s}`,!0))}),m.forEach((e,s)=>{const n=Array.isArray(e.des)?e.des.join(", "):"";D.push((0,h.jsxDEV)("div",{className:"group quoted",children:[(0,h.jsxDEV)("tt",{children:e.value},void 0,!1),(0,h.jsxDEV)("span",{className:"small gray",children:[" ",n?`(${n})`:""]},void 0,!0)]},`tinode-${s}`,!0))}),u.forEach((e,s)=>{const n=Array.isArray(e.des)?e.des.join(", "):"";D.push((0,h.jsxDEV)("div",{className:"group quoted",children:[(0,h.jsxDEV)("tt",{children:e.value},void 0,!1),(0,h.jsxDEV)("span",{className:"small gray",children:[" ",n?`(${n})`:""]},void 0,!0)]},`url-${s}`,!0))}),(0,h.jsxDEV)("div",{id:"image-preview",children:[(0,h.jsxDEV)("div",{id:"preview-caption-panel",children:[(0,h.jsxDEV)("span",{children:(0,h.jsxDEV)(o.FormattedMessage,{id:"label_contact_card",defaultMessage:"Contact Card",description:"Label for contact card preview"},void 0,!1)},void 0,!1),(0,h.jsxDEV)("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()},children:(0,h.jsxDEV)("i",{className:"material-icons gray",children:"close"},void 0,!1)},void 0,!1)]},void 0,!0),(0,h.jsxDEV)("div",{id:"image-preview-container",children:(0,h.jsxDEV)("div",{className:"doc-card",children:(0,h.jsxDEV)("div",{className:"panel-form-column",children:[(0,h.jsxDEV)("center",{children:(0,h.jsxDEV)("div",{className:"avatar-box",children:(0,h.jsxDEV)(r.A,{authorizeURL:this.props.tinode.authorizeURL,avatar:n||!0,topic:"usrXXX123",title:s},void 0,!1)},void 0,!1)},void 0,!1),(0,h.jsxDEV)("div",{className:"group",children:(0,h.jsxDEV)("div",{className:"large ellipsized",children:s||(0,h.jsxDEV)(o.FormattedMessage,{...p.unknown_name},void 0,!1)},void 0,!1)},void 0,!1),i?(0,h.jsxDEV)("div",{className:"group",children:(0,h.jsxDEV)("div",{children:i},void 0,!1)},void 0,!1):null,a?(0,h.jsxDEV)("div",{className:"group",children:[(0,h.jsxDEV)("label",{className:"small",children:(0,h.jsxDEV)(o.FormattedMessage,{id:"label_description",defaultMessage:"Description",description:"Label for description of user or topic"},void 0,!1)},void 0,!1),(0,h.jsxDEV)("div",{className:"quoted",children:a},void 0,!1)]},void 0,!0):null,D.length>0?(0,h.jsxDEV)("div",{className:"group",children:[(0,h.jsxDEV)("label",{className:"small",children:(0,h.jsxDEV)(o.FormattedMessage,{id:"label_contacts",defaultMessage:"Contacts",description:"Label for contact information"},void 0,!1)},void 0,!1),D]},void 0,!0):null]},void 0,!0)},void 0,!1)},void 0,!1),(0,h.jsxDEV)(t.A,{noInput:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendCard,onError:this.props.onError},void 0,!1)]},void 0,!0)}}}}]); //# sourceMappingURL=942.prod.js.map