/**
 * Skipped minification because the original files appears to be already minified.
 * Original file: /npm/tinode-webapp@0.25.1/umd/index.prod.js
 *
 * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files
 */
!function(){"use strict";var e,t,s,a,i={221:function(e,t,s){s.d(t,{A:function(){return l}});var a=s(1594),i=s.n(a),n=s(8181);class r extends i().Component{constructor(e){super(e),this.state={panX:0,panY:0,originX:0,originY:0,zoom:1,minZoom:.001,maxZoom:8},this.overlay=i().createRef(),this.cutout=i().createRef(),this.preview=i().createRef(),this.boundingBox=i().createRef(),this.imageWidth=0,this.imageHeight=0,this.mouseX=0,this.mouseY=0,this.prevDistance=0,this.cutoutRect={},this.bBoxRect={},this.originX=0,this.originY=0,this.initScaling=this.initScaling.bind(this),this.onZoom=this.onZoom.bind(this),this.handleZoom=this.handleZoom.bind(this),this.mouseDown=this.mouseDown.bind(this),this.mouseUp=this.mouseUp.bind(this),this.mouseMove=this.mouseMove.bind(this),this.mouseTouch=this.mouseTouch.bind(this),this.positionAll=this.positionAll.bind(this),this.translate=this.translate.bind(this)}componentDidMount(){this.overlay.current.addEventListener("mousedown",this.mouseDown,{passive:!0}),this.overlay.current.addEventListener("touchstart",this.mouseDown,{passive:!0}),this.bBoxRect=this.boundingBox.current.getBoundingClientRect(),this.originX=this.bBoxRect.width/2,this.originY=this.bBoxRect.height/2,this.cutoutRect=this.cutout.current.getBoundingClientRect()}componentWillUnmount(){this.overlay.current&&(this.overlay.current.removeEventListener("mousedown",this.mouseDown),this.overlay.current.removeEventListener("touchstart",this.mouseDown))}positionAll(e,t,s){this.setState({panX:e,panY:t,zoom:s,originX:this.originX-e,originY:this.originY-t});const a=(this.originX-e)*s-this.originX,i=(this.originY-t)*s-this.originY;this.props.onChange((a+this.cutoutRect.left-this.bBoxRect.left)/s,(i+this.cutoutRect.top-this.bBoxRect.top)/s,this.cutoutRect.width/s,this.cutoutRect.height/s,s)}static checkBound(e,t,s,a){let i=Math.min(0,s[0]-t[0]-a,t[1]-s[1]+a);return(0==i||Math.min(0,s[0]-t[0],t[1]-s[1])<i)&&(e+=a),e}initScaling(){const e=this.preview.current.getBoundingClientRect();this.imageWidth=e.width,this.imageHeight=e.height;const t=Math.max(this.cutoutRect.width/e.width,this.cutoutRect.height/e.height);this.setState({minZoom:t,maxZoom:8*t});const s=Math.max(this.bBoxRect.width/e.width,this.bBoxRect.height/e.height),a=this.cutoutRect.left-this.bBoxRect.left-(e.width-this.cutoutRect.width)/2,i=this.cutoutRect.top-this.bBoxRect.top-(e.height-this.cutoutRect.height)/2;this.positionAll(a,i,s)}onZoom(e){this.handleZoom(e.target.value)}handleZoom(e){let t=this.state.panX,s=this.state.panY;const a=this.originX-(this.originX-t)*e,i=a+this.imageWidth*e,n=this.originY-(this.originY-s)*e,r=n+this.imageHeight*e,o=this.cutoutRect.left-this.bBoxRect.left,l=o+this.cutoutRect.width,c=this.cutoutRect.top-this.bBoxRect.top,h=c+this.cutoutRect.height;o<a?t-=(a-o)/e:l>i&&(t+=(l-i)/e),c<n?s-=(n-c)/e:h>r&&(s+=(h-r)/e),this.positionAll(t,s,e)}mouseDown(e){e.touches?(this.mouseX=e.touches[0].pageX,this.mouseY=e.touches[0].pageY):(this.mouseX=e.pageX,this.mouseY=e.pageY),window.addEventListener("mousemove",this.mouseMove,{passive:!1}),window.addEventListener("touchmove",this.mouseTouch,{passive:!1}),window.addEventListener("mouseup",this.mouseUp,{passive:!0}),window.addEventListener("touchend",this.mouseUp,{passive:!0}),document.body.style.userSelect="none"}translate(e,t){const s=(e-this.mouseX)/this.state.zoom,a=(t-this.mouseY)/this.state.zoom;this.mouseX=e,this.mouseY=t;const i=this.preview.current.getBoundingClientRect(),n=r.checkBound(this.state.panX,[i.left,i.right],[this.cutoutRect.left,this.cutoutRect.right],s),o=r.checkBound(this.state.panY,[i.top,i.bottom],[this.cutoutRect.top,this.cutoutRect.bottom],a);this.positionAll(n,o,this.state.zoom)}mouseMove(e){e.preventDefault(),this.translate(e.pageX,e.pageY)}mouseTouch(e){if(e.preventDefault(),1==e.touches.length)return void this.translate(e.touches[0].pageX,e.touches[0].pageY);const[t,s]=e.touches,a=Math.sqrt((t.pageX-s.pageX)*(t.pageX-s.pageX)+(t.pageY-s.pageY)*(t.pageY-s.pageY));this.prevDistance||(this.prevDistance=a/this.state.zoom);let i=a/this.prevDistance;this.handleZoom(Math.max(this.minZoom,Math.min(this.maxZoom,i)))}mouseUp(e){window.removeEventListener("mousemove",this.mouseMove),window.removeEventListener("touchmove",this.mouseTouch),window.removeEventListener("mouseup",this.mouseUp),window.removeEventListener("touchend",this.mouseUp),document.body.style.userSelect="",this.positionAll(this.state.panX,this.state.panY,this.state.zoom)}render(){const e=`translate3d(${this.state.panX}px, ${this.state.panY}px, 0) scale(${this.state.zoom})`,t=`${this.state.originX}px ${this.state.originY}px`,s={top:this.originY-this.state.originY*this.state.zoom+"px",left:this.originX-this.state.originX*this.state.zoom+"px",width:this.imageWidth*this.state.zoom+"px",height:this.imageHeight*this.state.zoom+"px"};return i().createElement("div",{className:"cropper"},i().createElement("div",{className:"bounding-box",ref:this.boundingBox},i().createElement("img",{src:this.props.source,className:"preview",alt:"",style:{transform:e,transformOrigin:t},ref:this.preview,onLoad:this.initScaling}),i().createElement("div",{className:"cutout circle",ref:this.cutout}),i().createElement("div",{className:"overlay",style:s,ref:this.overlay})),i().createElement("div",{className:"zoom-wrapper"},i().createElement("input",{type:"range",className:"zoomer",step:"0.001",min:this.state.minZoom,max:this.state.maxZoom,value:this.state.zoom,onChange:this.onZoom})))}}var o=s(6110);class l extends i().PureComponent{constructor(e){super(e),this.state={top:0,left:0,width:0,height:0,scale:1},this.handleSubmit=this.handleSubmit.bind(this),this.handleChange=this.handleChange.bind(this)}handleChange(e,t,s,a,i){this.setState({left:e,top:t,width:s,height:a,scale:i})}handleSubmit(){(0,o.CO)(this.props.mime,this.props.avatar,this.state.left,this.state.top,this.state.width,this.state.height,this.state.scale).then(e=>{this.props.onSubmit(e.mime,e.blob,e.width,e.height)}).catch(e=>{this.props.onError(e)})}render(){return i().createElement("div",{className:"panel-form"},i().createElement("div",{className:"panel-form-row"},i().createElement(r,{source:this.props.avatar,onChange:this.handleChange})),i().createElement("div",{className:"dialog-buttons"},this.props.onCancel?i().createElement("button",{className:"secondary",onClick:this.props.onCancel},i().createElement(n.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})):null,i().createElement("button",{className:"primary",onClick:this.handleSubmit},i().createElement(n.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))))}}},257:function(e,t,s){s.d(t,{i:function(){return a}});const a="0.25.1"},504:function(e,t,s){s.d(t,{A:function(){return r}});var a=s(1594),i=s.n(a);const n={muted:"notifications_off",banned:"block",staff:"verified_user"};class r extends i().PureComponent{render(){let e=null;return this.props.badges&&this.props.badges.length>0?(e=[],this.props.badges.forEach(t=>{const s=t.color?" "+t.color:"";t.icon?e.push(i().createElement("i",{className:"material-icons as-badge"+s,key:t.key||t.icon},n[t.icon]||t.icon)):e.push(i().createElement("span",{className:"badge"+s,key:t.key||t.name},t.name))}),i().createElement(i().Fragment,null,e)):null}}},635:function(e,t,s){var a=s(1594),i=s.n(a),n=s(8181);const r={staff:"verified_user"},o=(0,n.defineMessages)({badge_verified:{id:"badge_verified",defaultMessage:[{type:0,value:"Verified/official"}]},badge_staff:{id:"badge_staff",defaultMessage:[{type:0,value:"Staff-managed"}]},badge_danger:{id:"badge_danger",defaultMessage:[{type:0,value:"Untrustworthy"}]}});class l extends i().PureComponent{render(){const{formatMessage:e}=this.props.intl;let t=null;return this.props.trustedBadges&&this.props.trustedBadges.length>0?(t=[],this.props.trustedBadges.forEach(s=>{const a=this.props.short?null:e(o["badge_"+s]),n="material-icons "+s+"-color";t.push(i().createElement("div",{className:"trusted-badge",key:s},i().createElement("i",{className:n},r[s]||s)," ",a))}),i().createElement(i().Fragment,null,t)):null}}t.A=(0,n.injectIntl)(l)},1013:function(e,t,s){s.d(t,{A:function(){return n}});var a=s(1594),i=s.n(a);class n extends i().PureComponent{render(){const e="load-spinner-box"+(this.props.large?" large":"")+(this.props.clear?" clear":"")+(this.props.centered?" centered":"");return this.props.show?i().createElement("div",{className:e},i().createElement("div",{className:"loader-spinner"})):null}}},1166:function(e,t,s){s.d(t,{A:function(){return n}});var a=s(1594),i=s.n(a);class n extends i().PureComponent{constructor(e){super(e),this.handleChange=this.handleChange.bind(this)}handleChange(){this.props.onChange(this.props.name,!this.props.checked)}render(){let e,t=["material-icons"];Array.isArray(this.props.className)?t.push(...this.props.className):this.props.className&&t.push(this.props.className),this.props.onChange?this.props.checked?(t.push("blue","clickable"),e="check_box"):!1===this.props.checked?(t.push("blue","clickable"),e="check_box_outline_blank"):(t.push("lt-blue"),e="indeterminate_check_box"):e=this.props.checked?"check_box":"check_box_outline_blank";let s={className:t.join(" "),id:this.props.id};return this.props.onChange&&(s.onClick=this.handleChange),i().createElement("i",s,e)}}},1334:function(e,t,s){s.d(t,{A:function(){return r}});var a=s(1594),i=s.n(a),n=s(3913);class r extends i().PureComponent{constructor(e){super(e),this.state={show:!1},this.hide=this.hide.bind(this)}componentDidUpdate(e){e.level!==this.props.level&&this.setState({show:!!this.props.level})}hide(){this.setState({show:!1}),this.props.onClearError&&this.props.onClearError()}render(){const e={err:"error",warn:"warning",info:"info"}[this.props.level]||"",t="info-box "+e;return i().createElement("div",{className:t},i().createElement("div",{className:"icon"},i().createElement("i",{className:"material-icons"},e)),i().createElement("span",null,this.props.text,this.props.action?i().createElement(i().Fragment,null,"  ",i().createElement("a",{href:"#",style:{whiteSpace:"nowrap"},onClick:e=>{e.preventDefault(),this.props.action()}},this.props.actionText)):null),i().createElement("div",{className:"cancel"},i().createElement(n.A,{onCancel:this.hide})))}}},1485:function(e,t,s){s.d(t,{A:function(){return r}});var a=s(1594),i=s.n(a),n=s(6789);class r extends i().Component{constructor(e){super(e),this.selfRef=i().createRef(),this.state={active:e.active,initialValue:e.value||"",value:e.value||"",valid:!0},this.handeTextChange=this.handeTextChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleStartEditing=this.handleStartEditing.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this),this.handlePasswordFinished=this.handlePasswordFinished.bind(this)}componentDidUpdate(e,t){const s=this.props.value||"";t.initialValue==s||t.active||this.setState({initialValue:s,value:s})}handeTextChange(e){this.setState({value:e.target.value||""}),this.props.validator&&Promise.resolve(this.props.validator(e.target.value)).then(e=>{this.setState({valid:e})}).catch(e=>{e&&this.setState({valid:!1})})}handleKeyDown(e){27===e.keyCode?this.setState({value:this.props.value,active:!1}):13===e.keyCode&&this.handleEditingFinished(e)}handleStartEditing(){this.props.readOnly||this.setState({active:!0},e=>{this.selfRef.current&&this.selfRef.current.focus()})}handleEditingFinished(e){const t=this.state.value.trim();!this.props.required||e.target.checkValidity()&&t?(this.setState({active:!1}),(t||this.props.value)&&t!==this.props.value&&this.state.valid&&this.props.onFinished(t)):this.setState({value:this.props.value,active:!1})}handlePasswordFinished(e){this.setState({active:!1}),e&&e!==this.props.value&&this.props.onFinished(e)}render(){if(!this.state.active){let e="password"==this.props.type?"••••••••":this.state.value,t="in-place-edit"+(this.props.readOnly?" disabled":"");return e||(e=this.props.placeholder,t+=" placeholder"),this.props.multiline&&1!=this.props.multiline||(t+=" short"),i().createElement("span",{className:t,onClick:this.handleStartEditing},this.props.iconLeft&&i().createElement("i",{className:"material-icons light-gray"},this.props.iconLeft),i().createElement("span",null,e),this.props.iconRight&&i().createElement("i",{className:"material-icons light-gray"},this.props.iconRight))}let e;const t={};return"password"==this.props.type?(e=n.A,t.onFinished=this.handlePasswordFinished):(this.props.multiline>1?(e="textarea",t.rows=this.props.multiline,t.className="in-place-edit"):(e="input",t.type=this.props.type||"text",t.className="in-place-edit"+(this.props.iconLeft?" with-icon-left":this.props.iconRight?" with-icon-right":""),this.props.maxLength&&(t.maxLength=this.props.maxLength)),t.value=this.state.value,t.className+=this.state.valid?"":" invalid",t.ref=this.selfRef,t.onChange=this.handeTextChange,t.onKeyDown=this.handleKeyDown,t.onBlur=this.handleEditingFinished),t.placeholder=this.props.placeholder,t.required=this.props.required?"required":"",t.autoComplete=this.props.autoComplete,t.autoFocus=!0,void 0!==this.props.spellCheck&&(t.spellCheck=this.props.spellCheck?"true":"false"),this.props.iconLeft||this.props.iconRight?i().createElement(i().Fragment,null,this.props.iconLeft&&i().createElement("i",{className:"material-icons light-gray"},this.props.iconLeft),i().createElement(e,t,null),this.props.iconRight&&i().createElement("i",{className:"material-icons light-gray"},this.props.iconRight)):i().createElement(e,t,null)}}},1594:function(e){e.exports=React},1781:function(e){e.exports=JSON.parse('{"patt":[{"name":"a00.png","size":200},{"name":"a01.jpg","size":384},{"name":"a02.jpg","size":384},{"name":"a03.jpg","size":384},{"name":"a04.png","size":400},{"name":"a05.jpg","size":400},{"name":"a06.jpg","size":256},{"name":"a07.jpg","size":384},{"name":"a08.jpg","size":384},{"name":"a09.jpg","size":400},{"name":"a10.jpg","size":256},{"name":"a11.png","size":200}],"img":[{"name":"w01.jpg","pr":"p01.jpg"},{"name":"w02.jpg","pr":"p02.jpg"},{"name":"w03.jpg","pr":"p03.jpg"},{"name":"w04.jpg","pr":"p04.jpg"},{"name":"w05.jpg","pr":"p05.jpg"},{"name":"w06.jpg","pr":"p06.jpg"},{"name":"w07.jpg","pr":"p07.jpg"},{"name":"w08.jpg","pr":"p08.jpg"},{"name":"w09.jpg","pr":"p09.jpg"},{"name":"w10.jpg","pr":"p10.jpg"},{"name":"w11.jpg","pr":"p11.jpg"},{"name":"w12.jpg","pr":"p12.jpg"},{"name":"w13.jpg","pr":"p13.jpg"},{"name":"w14.jpg","pr":"p14.jpg"},{"name":"w15.jpg","pr":"p15.jpg"},{"name":"w16.jpg","pr":"p16.jpg"},{"name":"w17.jpg","pr":"p17.jpg"},{"name":"w18.jpg","pr":"p18.jpg"},{"name":"w19.jpg","pr":"p19.jpg"},{"name":"w20.jpg","pr":"p20.jpg"},{"name":"w21.jpg","pr":"p21.jpg"},{"name":"w22.jpg","pr":"p22.jpg"},{"name":"w23.jpg","pr":"p23.jpg"},{"name":"w24.jpg","pr":"p24.jpg"}]}')},3307:function(e,t,s){s.d(t,{A:function(){return h}});var a=s(1594),i=s.n(a),n=s(8181),r=s(5874),o=s(4532),l=s(9027),c=s(3540);class h extends i().Component{constructor(e){super(e),this.state={tags:this.props.tags||[],alias:o.Tinode.tagByPrefix(this.props.tags,o.Tinode.TAG_ALIAS)||"",tagInput:"",activated:this.props.activated},this.handleTagInput=this.handleTagInput.bind(this),this.handleAddTag=this.handleAddTag.bind(this),this.handleRemoveTag=this.handleRemoveTag.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}static getDerivedStateFromProps(e,t){const s=e.tags||[];return(0,c.af)(s,t.tags)||t.activated?null:{tags:s||[],alias:o.Tinode.tagByPrefix(s,o.Tinode.TAG_ALIAS)||""}}handleTagInput(e){if(this.setState({tagInput:e}),e.length>0){const t=e[e.length-1];'"'==e[0]?e.length>1&&'"'==t&&this.handleAddTag(e.substring(1,e.length-1)):","!=t&&" "!=t&&";"!=t&&'"'!=t||this.handleAddTag(e.substring(0,e.length-1).trim())}}handleAddTag(e){const t=this.props.tinode.getServerParam(o.Tinode.MAX_TAG_COUNT,l.GB);if(e.length>0&&this.state.tags.length<t){const t=this.state.tags.slice(0);return t.push(e),this.setState({tags:t,tagInput:""}),this.props.onTagsChanged&&this.props.onTagsChanged(t),t}return this.state.tags}handleRemoveTag(e,t){const s=this.state.tags.slice(0);s.splice(t,1),this.setState({tags:s}),this.props.onTagsChanged&&this.props.onTagsChanged(s)}handleSubmit(){let e=this.handleAddTag(this.state.tagInput.trim());e=o.Tinode.setUniqueTag(e,this.state.alias),this.props.onSubmit(e),this.setState({activated:!1,tags:this.props.tags||[]})}handleCancel(){this.setState({activated:!1,tagInput:"",tags:this.props.tags||[]}),this.props.onCancel&&this.props.onCancel()}render(){const e=this.props.tinode.getServerParam(o.Tinode.MIN_TAG_LENGTH,l.rn),t=this.props.tinode.getServerParam(o.Tinode.MAX_TAG_LENGTH,l.Ti);let s=[];return this.state.activated?this.state.tags.forEach(a=>{a!=this.state.alias&&s.push({user:a,invalid:a.length<e||a.length>t})}):(this.state.tags.forEach(e=>{e!=this.state.alias&&s.push(i().createElement("span",{className:"badge",key:s.length},e))}),0==s.length&&(s=i().createElement("i",null,i().createElement(n.FormattedMessage,{id:"tags_not_found",defaultMessage:[{type:0,value:"No tags defined. Add some."}]})))),i().createElement("div",{className:"panel-form-column"},i().createElement("div",{className:"panel-form-row"},i().createElement("label",{className:"small"},this.props.title)),this.state.activated?i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"tags_editor_no_tags",defaultMessage:[{type:0,value:"Add some tags"}]},e=>i().createElement(r.A,{tinode:this.props.tinode,chips:s,avatarDisabled:!0,prompt:e,tabIndex:this.props.tabIndex,onEnter:this.handleAddTag,onFocusLost:this.handleAddTag,onCancel:this.handleCancel,onChipRemoved:this.handleRemoveTag,filterFunc:this.handleTagInput})),this.props.onSubmit||this.props.onCancel?i().createElement("div",{id:"tag-manager-buttons",className:"dialog-buttons panel-form-row"},i().createElement("button",{className:"outline",onClick:this.handleCancel},i().createElement(n.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),i().createElement("button",{className:"primary",onClick:this.handleSubmit},i().createElement(n.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]}))):null):i().createElement("div",{className:"quoted"},i().createElement("a",{href:"#",className:"flat-button",onClick:e=>{e.preventDefault(),this.setState({activated:!0})}},i().createElement("i",{className:"material-icons"},"edit"),"  ",i().createElement(n.FormattedMessage,{id:"title_manage_tags",defaultMessage:[{type:0,value:"Manage"}]})),i().createElement(i().Fragment,null,s)))}}},3540:function(e,t,s){s.d(t,{FH:function(){return u},Jf:function(){return d},Jt:function(){return l},KY:function(){return f},LO:function(){return m},OM:function(){return n},YO:function(){return h},af:function(){return o},iE:function(){return g},k6:function(){return r},wk:function(){return p},xH:function(){return c}});var a=s(4532),i=s(9027);function n(e){const t=document.getElementById("shortcut-icon"),s=document.head||document.getElementsByTagName("head")[0],a=document.createElement("link");a.type="image/png",a.id="shortcut-icon",a.rel="shortcut icon",a.href="img/logo32x32"+(e>0?"a":"")+".png",t&&s.removeChild(t),s.appendChild(a),document.title=(e>0?"("+e+") ":"")+"Tinode"}function r(e,t,s,i){let n=null;if((e=e&&e.trim())&&(n={fn:e}),"string"==typeof(i=i&&i.trim())&&(n=n||{},n.note=i||a.Tinode.DEL_CHAR),t){n=n||{};let e=s;const i=/^data:(image\/[-a-z0-9+.]+)?(;base64)?,/i.exec(t);i?(e=i[1],n.photo={data:t.substring(t.indexOf(",")+1),ref:a.Tinode.DEL_CHAR}):n.photo={data:a.Tinode.DEL_CHAR,ref:t},n.photo.type=(e||"image/jpeg").substring(6)}return n}function o(e,t){if(e===t)return!0;if(!Array.isArray(e)||!Array.isArray(t))return!1;if(e.length!=t.length)return!1;e.sort(),t.sort();for(let s=0,a=e.length;s<a;s++)if(e[s]!==t[s])return!1;return!0}function l(e){return e=e.trim(),/^(?:\+?(\d{1,3}))?[- (.]*(\d{3})[- ).]*(\d{3})[- .]*(\d{2})[- .]*(\d{2})?$/.test(e)?e.replaceAll(/[- ().]*/g,""):null}function c(e){return e=e.trim(),/^[a-z0-9_.+-]+@[a-z0-9-]+(\.[a-z0-9-]+)+$/i.test(e)?e:null}function h(e){return e&&!/^\s*([a-z][a-z0-9+.-]*:|\/\/)/im.test(e.replace(/\\/g,"/"))}function d(e,t){if("string"!=typeof e)return e;if(e=(e=e.replace(/[^\x21-\x7E]/gim,"").trim()).replace(/\\/g,"/"),!/^([a-z][a-z0-9+.-]*:|\/\/)/i.test(e))return e;if(/^blob:http/.test(e))return e;const s=Array.isArray(t)?t.join("|"):"http|https";return new RegExp("^(("+s+"):|//)","i").test(e)?e:null}function p(e,t){if(!e)return null;const s=d(e);if(s)return s;return new RegExp(`data:${t}/[-+.a-z0-9]+;base64,`,"i").test(e.trim())?e:null}function u(e){if(e.startsWith("data:")||e.startsWith("blob:"))return e;let t="",s="";const a=e.indexOf("#");a>0&&(s=e.substring(a+1),e=e.substring(0,a));const i=e.indexOf("?");i>0&&(t=e.substring(i+1),e=e.substring(0,i));const n=new URLSearchParams(t);return n.append("asatt","1"),`${e}?${n.toString()}`+(s?`#${s}`:"")}function m(e){switch(e){case a.Tinode.MESSAGE_STATUS_SENDING:return{name:"access_time"};case a.Tinode.MESSAGE_STATUS_FAILED:case a.Tinode.MESSAGE_STATUS_FATAL:return{name:"warning",color:"danger-color"};case a.Tinode.MESSAGE_STATUS_SENT:return{name:"done"};case a.Tinode.MESSAGE_STATUS_RECEIVED:return{name:"done_all"};case a.Tinode.MESSAGE_STATUS_READ:return{name:"done_all",color:"blue"}}return null}function g(e){let t=!1;return{promise:e instanceof Error?Promise.reject(e):new Promise((s,a)=>{e.then(e=>t?a({isCanceled:!0}):s(e),e=>a(t?{isCanceled:!0}:e))}),cancel(){t=!0}}}function f(){const e=s(1781)[i.S.type][i.S.index];return{name:`../${i.S.path}${e.name}`,size:e.size}}},3913:function(e,t,s){s.d(t,{A:function(){return n}});var a=s(1594),i=s.n(a);class n extends i().PureComponent{render(){return i().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancel()}},i().createElement("i",{className:"material-icons"},"close"))}}},4152:function(e,t,s){s.d(t,{A:function(){return m}});var a=s(1594),i=s.n(a),n=s(8181),r=s(4532),o=s(6005);class l extends i().PureComponent{constructor(e){super(e),this.handleClick=this.handleClick.bind(this)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.onAction(this.props.action)}render(){const{formatMessage:e}=this.props.intl;return i().createElement("li",{onClick:this.handleClick,className:"action"},i().createElement("div",{className:"action-text"},e(this.props.title,this.props.values)))}}var c=(0,n.injectIntl)(l),h=s(6110),d=s(9027);const p=(0,n.defineMessages)({badge_you:{id:"badge_you",defaultMessage:[{type:0,value:"you"}]},badge_owner:{id:"badge_owner",defaultMessage:[{type:0,value:"owner"}]}});class u extends i().Component{render(){const{formatMessage:e}=this.props.intl,t=Array.isArray(this.props.topicSelected),s=[];let a=0;if(this.props.showSelfTopic){const e=t?this.props.topicSelected.indexOf("slf")>-1:"slf"===this.props.topicSelected;s.push(i().createElement(o.A,{tinode:this.props.tinode,avatar:!0,showMode:this.props.showMode,selected:e,showCheckmark:t,onSelected:this.props.onTopicSelected,showContextMenu:this.props.showContextMenu,index:s.length,item:"slf",key:"slf"})),a++}return this.props.contacts&&this.props.contacts.length>0&&this.props.contacts.forEach(n=>{if(n.action)s.push(i().createElement(c,{title:n.title,action:n.action,values:n.values,key:n.action,onAction:this.props.onAction}));else{const l=this.props.showMode?n.user:n.topic||n.user;if(this.props.filterFunc&&this.props.filter){const e=[l];if(n.private&&n.private.comment&&e.push((""+n.private.comment).toLowerCase()),n.public&&n.public.fn&&e.push((""+n.public.fn).toLowerCase()),!this.props.filterFunc(this.props.filter,e))return}const c=r.Tinode.isChannelTopicName(l),u=!c&&r.Tinode.isGroupTopicName(l),m=t?this.props.topicSelected.indexOf(l)>-1:this.props.topicSelected===l,g=[];this.props.showMode&&(l==this.props.myUserId&&g.push({name:e(p.badge_you),color:"green"}),n.acs&&n.acs.isOwner()&&g.push({name:e(p.badge_owner),color:"blue"}));const f=Array.isArray(n.private)?n.private.join(","):n.private?n.private.comment:null;let v,b,E,y;if(!this.props.showMode&&n.latestMessage){const e=n.latestMessage();e&&(b=e.head?e.head.forwarded:null,y=e._status||n.msgStatus(e,!0),E=e.from!=this.props.myUserId,e.content&&(v="string"==typeof e.content?e.content.substr(0,d.sT):r.Drafty.preview(e.content,d.sT)))}s.push(i().createElement(o.A,{tinode:this.props.tinode,title:n.public?n.public.fn:null,avatar:(0,h.to)(n.public?n.public.photo:null),comment:f,preview:v,previewIsResponse:E,forwarded:b,received:y,unread:this.props.showUnread?n.unread:0,now:n.online&&this.props.connected,acs:n.acs,showMode:this.props.showMode,badges:g,showCheckmark:t,selected:m,pinned:n.pinned,showOnline:this.props.showOnline&&!c,isChannel:c,isGroup:u,showContextMenu:this.props.showContextMenu,isVerified:n.trusted&&n.trusted.verified,isStaff:n.trusted&&n.trusted.staff,isDangerous:n.trusted&&n.trusted.danger,deleted:n._deleted,onSelected:this.props.onTopicSelected,item:l,index:s.length,key:l})),a++}},this),i().createElement("div",{className:this.props.noScroll?null:"scrollable-panel"},0==a?i().createElement("div",{className:"center-medium-text",dangerouslySetInnerHTML:{__html:this.props.emptyListMessage}}):null,s.length>0?i().createElement("ul",{className:"contact-box"},s):null)}}var m=(0,n.injectIntl)(u)},4532:function(e){e.exports=tinode},5053:function(e,t,s){var a=s(1594),i=s.n(a),n=s(8181),r=s(8589),o=s(6110);const l="#666C",c=(0,n.defineMessages)({icon_title_play:{id:"icon_title_play",defaultMessage:[{type:0,value:"Play recording"}]}});class h extends i().PureComponent{constructor(e){super(e);let t=(0,o.F8)(this.props.preview);(!Array.isArray(t)||t.length<16)&&(t=null),this.state={canPlay:!1,playing:!1,currentTime:"0:00",duration:this.props.duration>0?(0,r.Ye)(this.props.duration/1e3):"-:--",longMin:this.props.duration>=6e5,preview:t},this.initAudio=this.initAudio.bind(this),this.initCanvas=this.initCanvas.bind(this),this.resampleBars=this.resampleBars.bind(this),this.visualize=this.visualize.bind(this),this.handlePlay=this.handlePlay.bind(this),this.handleSeek=this.handleSeek.bind(this),this.handleError=this.handleError.bind(this),this.audioPlayer=null,this.viewBuffer=[],this.canvasRef=i().createRef()}componentDidMount(){this.props.src&&this.initAudio(),this.initCanvas()}componentWillUnmount(){this.audioPlayer&&(this.audioPlayer.onloadedmetadata=null,this.audioPlayer.ontimeupdate=null,this.audioPlayer.onended=null,this.audioPlayer.pause(),this.audioPlayer=null)}componentDidUpdate(e){if(this.props.src!=e.src&&this.initAudio(),this.props.preview!=e.preview){let e=(0,o.F8)(this.props.preview);(!Array.isArray(e)||e.length<16)&&(e=null),this.setState({preview:e},this.initCanvas)}}initAudio(){this.audioPlayer=new Audio(this.props.src),this.audioPlayer.onloadedmetadata=e=>this.setState({canPlay:!0}),this.audioPlayer.ontimeupdate=e=>this.setState({currentTime:(0,r.Ye)(this.audioPlayer.currentTime,this.state.longMin)}),this.audioPlayer.onended=e=>{this.audioPlayer.currentTime=0,this.setState({playing:!1,currentTime:(0,r.Ye)(0,this.state.longMin)})}}initCanvas(){this.canvasRef.current.width=2*this.canvasRef.current.offsetWidth,this.canvasRef.current.height=2*this.canvasRef.current.offsetHeight,this.canvasContext=this.canvasRef.current.getContext("2d"),this.canvasContext.lineCap="round",this.viewBuffer=this.resampleBars(this.state.preview),this.visualize()}visualize(){if(!this.canvasRef.current)return;const e=this.effectiveWidth,t=this.canvasRef.current.height;this.canvasContext.lineWidth=6;const s=a=>{if(this.canvasRef.current&&this.audioPlayer&&(this.canvasContext.clearRect(0,0,this.canvasRef.current.width,t),this.viewBuffer)){this.state.playing&&window.requestAnimationFrame(s);const a=this.props.duration?Math.max(0,Math.min(1e3*this.audioPlayer.currentTime/this.props.duration,1))*(e-12):-1;this.canvasContext.beginPath(),this.canvasContext.strokeStyle=l;for(let e=0;e<this.viewBuffer.length;e++){let s=1+10*e+3,i=Math.max(this.viewBuffer[e]*t*.9,1);const n=s<a?l:"#888A";this.canvasContext.strokeStyle!=n&&(this.canvasContext.stroke(),this.canvasContext.beginPath(),this.canvasContext.strokeStyle=n),this.canvasContext.moveTo(s,.5*(t-i)),this.canvasContext.lineTo(s,.5*(t+i))}this.canvasContext.stroke(),this.props.duration&&(this.canvasContext.beginPath(),this.canvasContext.arc(a+12,.5*t,12,0,2*Math.PI),this.canvasContext.fillStyle="#1781d7",this.canvasContext.fill())}};s()}resampleBars(e){const t=(this.canvasRef.current.width-4)/10|0;if(this.effectiveWidth=10*t+4,!Array.isArray(e)||0==e.length)return Array.apply(null,Array(t)).map(e=>.01);const s=e.length/t;let a=[],i=-1;for(let n=0;n<t;n++){let t=n*s|0,r=(n+1)*s|0;if(r==t)a[n]=e[t];else{let s=0;for(let a=t;a<r;a++)s+=e[a];a[n]=Math.max(0,s/(r-t))}i=Math.max(a[n],i)}return i>0?a.map(e=>e/i):Array.apply(null,Array(t)).map(e=>.01)}handlePlay(e){e.preventDefault(),this.state.canPlay&&(this.state.playing?(this.audioPlayer.pause(),this.setState({playing:!1})):this.audioPlayer.readyState>=2&&(this.audioPlayer.play(),this.setState({playing:!0},this.visualize)))}handleError(e){console.error(e)}handleSeek(e){if(e.preventDefault(),e.target&&this.props.duration){const t=e.target.getBoundingClientRect(),s=(e.clientX-t.left)/this.effectiveWidth*2;this.audioPlayer.currentTime=this.props.duration*s/1e3,this.setState({currentTime:(0,r.Ye)(this.audioPlayer.currentTime,this.state.longMin)}),this.state.playing||this.visualize()}}render(){const e="material-icons"+(this.props.short?"":" large")+(this.state.canPlay?"":" disabled"),t=i().createElement("a",{href:"#",onClick:this.handlePlay,title:this.props.intl.formatMessage(c.icon_title_play)},i().createElement("i",{className:e},this.state.playing?"pause_circle":this.state.canPlay?"play_circle":"not_interested"));return i().createElement("div",{className:"audio-player"},this.props.short?i().createElement(i().Fragment,null,i().createElement("canvas",{className:"playback",ref:this.canvasRef,onClick:this.handleSeek}),t):i().createElement(i().Fragment,null,t,i().createElement("div",null,i().createElement("canvas",{className:"playback",ref:this.canvasRef,onClick:this.handleSeek}),i().createElement("div",{className:"timer"},this.state.currentTime,"/",this.state.duration))))}}t.A=(0,n.injectIntl)(h)},5206:function(e){e.exports=ReactDOM},5338:function(e,t,s){var a=s(5206);t.H=a.createRoot,a.hydrateRoot},5874:function(e,t,s){s.d(t,{A:function(){return l}});var a=s(1594),i=s.n(a),n=s(6904);class r extends i().PureComponent{constructor(e){super(e),this.handleCancel=this.handleCancel.bind(this)}handleCancel(e){e.preventDefault(),this.props.onCancel(this.props.topic,this.props.index)}render(){const e=this.props.title||this.props.topic,t=this.props.invalid?"chip invalid":"chip";return i().createElement("div",{className:t},this.props.noAvatar?i().createElement("span",{className:"spacer"}):i().createElement("div",{className:"avatar-box"},i().createElement(n.A,{tinode:this.props.tinode,avatar:this.props.avatar||!0,topic:this.props.topic,title:this.props.title})),i().createElement("span",null,e),this.props.onCancel&&!this.props.required?i().createElement("a",{href:"#",onClick:this.handleCancel},"×"):i().createElement("span",{className:"spacer"}))}}var o=s(6110);class l extends i().Component{constructor(e){super(e),this.state=l.deriveStateFromProps(e),this.state.input="",this.state.focused=!1,this.handleTextInput=this.handleTextInput.bind(this),this.removeChipAt=this.removeChipAt.bind(this),this.handleChipCancel=this.handleChipCancel.bind(this),this.handleFocusGained=this.handleFocusGained.bind(this),this.handleFocusLost=this.handleFocusLost.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}static deriveStateFromProps(e){return{placeholder:e.chips?"":e.prompt,sortedChips:l.sortChips(e.chips,e.staticMembers),chipIndex:l.indexChips(e.chips)}}componentDidUpdate(e,t){e.chips==this.props.chips&&e.staticMembers==this.props.staticMembers&&e.prompt==this.props.prompt||this.setState(l.deriveStateFromProps(this.props)),(!t||this.props.chips.length>t.sortedChips.length)&&this.setState({input:""})}static indexChips(e){const t={};let s=0;return e.forEach(e=>{t[e.user]=s,s++}),t}static sortChips(e,t){const s=[],a=[];return e.forEach(e=>{t&&t.includes(e.user)?s.push(e):a.push(e)}),s.concat(a)}handleTextInput(e){this.setState({input:e.target.value}),this.props.filterFunc&&this.props.filterFunc(e.target.value)}removeChipAt(e){const t=this.state.sortedChips[e];this.props.onChipRemoved(t.user,this.state.chipIndex[t.user])}handleChipCancel(e,t){this.removeChipAt(t)}handleFocusGained(){this.setState({focused:!0})}handleFocusLost(){this.setState({focused:!1}),this.props.onFocusLost&&this.props.onFocusLost(this.state.input)}handleKeyDown(e){if("Backspace"===e.key){if(0==this.state.input.length&&this.state.sortedChips.length>0){const e=this.state.sortedChips.length-1;this.state.sortedChips[e].user!==this.props.staticMembers&&this.removeChipAt(e)}}else"Enter"===e.key?this.props.onEnter&&this.props.onEnter(this.state.input):"Escape"===e.key&&this.props.onCancel&&this.props.onCancel()}render(){const e=[];let t=0;const s=this.props.staticMembers||[];this.state.sortedChips.forEach(a=>{e.push(i().createElement(r,{tinode:this.props.tinode,onCancel:this.handleChipCancel,avatar:(0,o.to)(a.public?a.public.photo:null),title:a.public?a.public.fn:void 0,noAvatar:this.props.avatarDisabled,topic:a.user,required:s.includes(a.user),invalid:a.invalid,index:t,key:a.user})),t++});const a="chip-input"+(this.state.focused?" focused":""),n=!(this.props.tabIndex>0);return i().createElement("div",{className:a},e,i().createElement("input",{type:"text",placeholder:this.state.placeholder,onChange:this.handleTextInput,onFocus:this.handleFocusGained,onBlur:this.handleFocusLost,onKeyDown:this.handleKeyDown,value:this.state.input,tabIndex:this.props.tabIndex,autoFocus:n}))}}},6005:function(e,t,s){s.d(t,{A:function(){return g}});var a=s(1594),i=s.n(a),n=s(8181),r=s(4532),o=s(504),l=s(6904);class c extends i().PureComponent{render(){return this.props.count>0?i().createElement("span",{className:"unread"},this.props.count>9?"9+":this.props.count):null}}var h=s(8043),d=s(3540),p=s(8589);const u=(0,n.defineMessages)({self_topic_name:{id:"self_topic_name",defaultMessage:[{type:0,value:"Saved messages"}]},self_topic_comment:{id:"self_topic_comment",defaultMessage:[{type:0,value:"Notes, messages, links, files saved for posterity"}]}});class m extends i().Component{constructor(e){super(e),this.handleClick=this.handleClick.bind(this),this.handleContextClick=this.handleContextClick.bind(this)}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.onSelected&&this.props.onSelected(this.props.item,this.props.index)}handleContextClick(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.props.item,topicTitle:this.props.title,y:e.pageY,x:e.pageX})}render(){let e=this.props.title;const t=r.Tinode.isSelfTopicName(this.props.item);e?e.length>30&&(e=(0,p.W5)(e,30)):e=t?this.props.intl.formatMessage(u.self_topic_name):i().createElement("i",null,i().createElement(n.FormattedMessage,{id:"unnamed_topic",defaultMessage:[{type:0,value:"Unnamed"}]}));const s=this.props.now?"online":"offline",a=!this.props.avatar||this.props.avatar,m=this.props.badges?this.props.badges.slice():[],g=[];let f;this.props.isVerified&&g.push({icon:"verified",color:"verified-color"}),this.props.isStaff&&g.push({icon:"staff",color:"staff-color"}),this.props.isDangerous&&g.push({icon:"dangerous",color:"danger-color"}),this.props.acs&&(this.props.showMode&&m.push({name:this.props.acs.getMode(),key:"mode"}),this.props.acs.isMuted()&&g.push({icon:"muted"}),this.props.acs.isJoiner()||g.push({icon:"banned"})),"string"==typeof this.props.preview?f=this.props.preview:r.Drafty.isValid(this.props.preview)?f=i().createElement(i().Fragment,null,r.Drafty.format(this.props.preview,h.TU,{formatMessage:this.props.intl.formatMessage,previewIsResponse:this.props.previewIsResponse})):this.props.preview&&(f=i().createElement(i().Fragment,null,i().createElement("i",{className:"material-icons gray"},"warning_amber")," ",i().createElement("i",{className:"gray"},i().createElement(n.FormattedMessage,{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]}))));const v=(0,d.LO)(this.props.received),b=v?i().createElement("i",{className:"material-icons small space-right"+(v.color?" "+v.color:"")},v.name):null,E="contact-title"+(this.props.deleted?" deleted":""),y=f||this.props.comment||(t?this.props.intl.formatMessage(u.self_topic_comment):" "),w=this.props.showCheckmark?null:this.props.selected?"selected":this.props.pinned?"tpinned":null;return i().createElement("li",{className:w,onClick:this.handleClick},i().createElement("div",{className:"avatar-box"},i().createElement(l.A,{tinode:this.props.tinode,avatar:a,title:this.props.title,topic:this.props.item,deleted:this.props.deleted}),this.props.deleted?i().createElement("i",{className:"deleted material-icons"},"cancel"):!t&&this.props.showOnline?i().createElement("span",{className:s}):this.props.showCheckmark&&this.props.selected?i().createElement("i",{className:"checkmark material-icons"},"check_circle"):null),i().createElement("div",{className:"text-box"},i().createElement("div",null,i().createElement("span",{className:E},e),this.props.isGroup?i().createElement("i",{className:"material-icons as-badge"},"group"):null,this.props.isChannel?i().createElement("i",{className:"material-icons as-badge"},"podcasts"):null,t?null:i().createElement(o.A,{badges:g}),this.props.deleted?null:i().createElement(c,{count:this.props.unread})),this.props.showMode?i().createElement("span",null,i().createElement(o.A,{badges:m})):this.props.small?null:i().createElement("div",{className:"contact-comment"},b,i().createElement("span",null,y))),this.props.showContextMenu?i().createElement("span",{className:"menuTrigger"},i().createElement("a",{href:"#",onClick:this.handleContextClick},i().createElement("i",{className:"material-icons"},"expand_more"))):null)}}var g=(0,n.injectIntl)(m)},6110:function(e,t,s){s.d(t,{$Z:function(){return u},CO:function(){return c},F8:function(){return f},Pv:function(){return g},Sk:function(){return d},ae:function(){return r},ag:function(){return l},bB:function(){return h},i:function(){return m},iJ:function(){return p},to:function(){return n}});const a=["image/jpeg","image/gif","image/png","image/svg","image/svg+xml"],i=["jpg","gif","png","svg","svg"];function n(e){if(e&&"object"==typeof e){if(e.ref)return e.ref;if(e.data&&e.type){return"data:"+(e.type.startsWith("image/")?e.type:"image/"+e.type)+";base64,"+e.data}}return null}function r(e,t,s,a,i){if(t|=0,s|=0,a|=0,(e|=0)<=0||t<=0||s<=0||a<=0)return null;i&&(s=a=Math.min(s,a));const n=Math.min(Math.min(e,s)/e,Math.min(t,a)/t),r={dstWidth:e*n|0,dstHeight:t*n|0};return i?(r.dstWidth=r.dstHeight=Math.min(r.dstWidth,r.dstHeight),r.srcWidth=r.srcHeight=Math.min(e,t),r.xoffset=(e-r.srcWidth)/2|0,r.yoffset=(t-r.srcWidth)/2|0):(r.xoffset=r.yoffset=0,r.srcWidth=e,r.srcHeight=t),r}function o(e,t){const s=a.indexOf(t);if(s<0||!e)return e;const n=i[s],r=e.lastIndexOf(".");return r>=0&&(e=e.substring(0,r)),e+"."+n}function l(e,t,s,i,n){return new Promise((l,c)=>{const h=new Image;h.crossOrigin="Anonymous",h.onerror=function(e){c(new Error("Image format unrecognized"))},h.onload=async function(){URL.revokeObjectURL(h.src);const d=r(h.width,h.height,t,s,n);if(!d)return void c(new Error("Invalid image"));let p=document.createElement("canvas");p.width=d.dstWidth,p.height=d.dstHeight;let u=p.getContext("2d");u.imageSmoothingEnabled=!0,u.drawImage(h,d.xoffset,d.yoffset,d.srcWidth,d.srcHeight,0,0,d.dstWidth,d.dstHeight);const m=a.includes(e.type)?e.type:"image/jpeg";let g=await new Promise(e=>p.toBlob(e,m));if(g){for(;i>0&&g.length>i;)d.dstWidth=.70710678118*d.dstWidth|0,d.dstHeight=.70710678118*d.dstHeight|0,p.width=d.dstWidth,p.height=d.dstHeight,u=p.getContext("2d"),u.clearRect(0,0,p.width,p.height),u.drawImage(h,d.xoffset,d.yoffset,d.srcWidth,d.srcHeight,0,0,d.dstWidth,d.dstHeight),g=await new Promise(e=>p.toBlob(e,m));p=null,l({mime:m,blob:g,width:d.dstWidth,height:d.dstHeight,name:o(e.name,m)})}else c(new Error("Unsupported image format"))},h.src=URL.createObjectURL(e)})}function c(e,t,s,i,n,r,o){return new Promise((l,c)=>{const h=new Image;h.crossOrigin="Anonymous",h.onerror=e=>{c(new Error("Image format unrecognized"))},h.onload=t=>{URL.revokeObjectURL(h.src);let d=document.createElement("canvas");d.width=n*o,d.height=r*o;let p=d.getContext("2d");p.imageSmoothingEnabled=!0,p.drawImage(h,s,i,n,r,0,0,d.width,d.height),e=a.includes(e)?e:"image/jpeg",d.toBlob(t=>{d=null,t?l({mime:e,blob:t,width:n,height:r}):c(new Error("Unsupported image format"))},e)},h.src=t})}function h(e){return new Promise((t,s)=>{const a=new FileReader;a.onerror=e=>{s(a.error)},a.onload=s=>{t({mime:e.type,bits:a.result.split(",")[1],name:e.name})},a.readAsDataURL(e)})}function d(e){return new Promise((t,s)=>{const a=new FileReader;a.onerror=e=>{s(a.error)},a.onload=s=>{t({mime:e.type,bits:a.result.split(",")[1]})},a.readAsDataURL(e)})}function p(e,t,s,a){const i=(e.clipboardData||e.originalEvent.clipboardData||{}).items;if(!i||!i.length)return!1;for(let e in i){const n=i[e];if("file"===n.kind){const e=n.getAsFile();if(!e){console.error("Failed to get file object from pasted file item",n.kind,n.type),a("Failed to get file object from pasted file item");continue}return e.type&&"image"==e.type.split("/")[0]?t(e):s(e),!0}}return!1}function u(e){if(e){e=e.replace(/-/g,"+").replace(/_/g,"/");try{e=btoa(atob(e))}catch(t){console.error("Failed to base64 re-encode string.",t),e=null}}return e}function m(e,t){if(!e)return null;try{const s=atob(e),a=s.length,i=new ArrayBuffer(a),n=new Uint8Array(i);for(let e=0;e<a;e++)n[e]=s.charCodeAt(e);return new Blob([i],{type:t})}catch(e){console.error("Failed to convert base64 to blob: ",e)}return null}function g(e){if(!Array.isArray(e))return null;try{let t="";return new Uint8Array(e).forEach(e=>t+=String.fromCharCode(e)),window.btoa(t)}catch(e){}return null}function f(e){const t=[];try{return[...window.atob(e)].forEach(e=>{t.push(e.charCodeAt(0))}),t}catch(e){}return null}},6789:function(e,t,s){s.d(t,{A:function(){return n}});var a=s(1594),i=s.n(a);class n extends i().PureComponent{constructor(e){super(e),this.inputRef=i().createRef(),this.state={value:this.props.value||"",visible:!1},this.handleVisibility=this.handleVisibility.bind(this),this.handeTextChange=this.handeTextChange.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this)}componentDidMount(){this.props.autoFocus&&this.inputRef.current.focus()}handeTextChange(e){this.setState({value:e.target.value}),this.props.onChange&&this.props.onChange(e)}handleVisibility(e){e.preventDefault(),this.setState({visible:!this.state.visible})}handleKeyDown(e){27==e.keyCode?(this.setState({value:this.props.value||"",visible:!1}),this.props.onFinished&&this.props.onFinished()):13==e.keyCode&&this.handleEditingFinished()}handleEditingFinished(e){if(e){let t=e.currentTarget;setTimeout(e=>{t.contains(document.activeElement)||this.props.onFinished&&this.props.onFinished(this.state.value)},0)}else this.props.onFinished&&this.props.onFinished(this.state.value.trim())}render(){return i().createElement("div",{tabIndex:"-1",className:"group-focus",onBlur:this.handleEditingFinished},i().createElement("input",{className:"with-icon-right",type:this.state.visible?"text":"password",value:this.state.value,placeholder:this.props.placeholder,maxLength:32,required:this.props.required?"required":"",autoFocus:this.props.autoFocus?"autoFocus":"",autoComplete:this.props.autoComplete,onChange:this.handeTextChange,onKeyDown:this.handleKeyDown,ref:this.inputRef}),i().createElement("span",{onClick:this.handleVisibility},i().createElement("i",{className:"material-icons clickable light-gray"},this.state.visible?"visibility":"visibility_off")))}}},6904:function(e,t,s){s.d(t,{A:function(){return c}});var a=s(1594),i=s.n(a),n=s(4532),r=s(8589),o=s(3540),l=s(9027);class c extends i().PureComponent{render(){let e;if(!0===this.props.avatar)if(n.Tinode.isSelfTopicName(this.props.topic))e=i().createElement("img",{className:"avatar self",alt:"avatar",src:l.Yd});else{const t=n.Tinode.isGroupTopicName(this.props.topic),s=(0,r.kJ)(this.props.topic,t);if(this.props.topic&&this.props.title&&this.props.title.trim()){const t=this.props.title.trim().charAt(0),a="lettertile "+s+(this.props.deleted?" disabled":"");e=i().createElement("div",{className:a},i().createElement("div",null,t))}else{const a="material-icons "+s+(this.props.deleted?" disabled":"");e=t?i().createElement("i",{className:a},"group"):i().createElement("i",{className:a},"person")}}else if(this.props.avatar){const t=this.props.tinode.authorizeURL((0,o.wk)(this.props.avatar,"image")),s="avatar"+(this.props.deleted?" deleted":"");e=i().createElement("img",{className:s,alt:"avatar",src:t,onError:e=>{e.target.onerror=null,e.target.src="img/broken_image.png"}})}else e=null;return e}}},7151:function(e,t,s){s.d(t,{A:function(){return a}});class a{static parseUrlHash(e){const t=e.split("?",2),s={};let a=[];return t[0]&&(a=t[0].replace("#","").split("/")),t[1]&&t[1].split("&").forEach(e=>{const t=e.indexOf("=");t>0&&(s[e.slice(0,t)]=decodeURIComponent(e.slice(t+1)))}),{path:a,params:s}}static navigateTo(e){window.location.hash=e}static composeUrlHash(e,t){let s=e.join("/");const a=[];for(const e in t)t.hasOwnProperty(e)&&void 0!==t[e]&&a.push(e+"="+encodeURIComponent(t[e]));return a.length>0&&(s+="?"+a.join("&")),s}static addUrlParam(e,t,s){const i=a.parseUrlHash(e);return i.params[t]=s,a.composeUrlHash(i.path,i.params)}static removeUrlParam(e,t){const s=a.parseUrlHash(e);return delete s.params[t],a.composeUrlHash(s.path,s.params)}static setUrlSidePanel(e,t){const s=a.parseUrlHash(e);return s.path[0]=t,a.composeUrlHash(s.path,s.params)}static setUrlInfoPanel(e,t){const s=a.parseUrlHash(e);return t?s.params.info=t:delete s.params.info,a.composeUrlHash(s.path,s.params)}static setUrlTopic(e,t){const s=a.parseUrlHash(e);return s.path[1]=t,delete s.params.info,a.composeUrlHash(s.path,s.params)}}},8043:function(e,t,s){s.d(t,{e3:function(){return E},TU:function(){return C},NV:function(){return A}});var a=s(1594),i=s.n(a),n=s(8181),r=s(4532),o=s(5053),l=s(8589);class c extends i().PureComponent{render(){const e=["busy","declined","disconnected","missed"].includes(this.props.callState),t="material-icons medium "+(e?"red":"green"),s=this.props.incoming?e?"call_missed":"call_received":e?"call_missed_outgoing":"call_made",a=this.props.incoming?i().createElement(n.FormattedMessage,{id:"calls_incoming",defaultMessage:[{type:0,value:"Incoming call"}]}):i().createElement(n.FormattedMessage,{id:"calls_outgoing",defaultMessage:[{type:0,value:"Outgoing call"}]});let r;if(e)switch(this.props.callState){case"busy":r=i().createElement(n.FormattedMessage,{id:"call_busy",defaultMessage:[{type:0,value:"busy"}]});break;case"declined":r=i().createElement(n.FormattedMessage,{id:"call_declined",defaultMessage:[{type:0,value:"declined"}]});break;case"missed":r=this.props.incoming?i().createElement(n.FormattedMessage,{id:"call_missed",defaultMessage:[{type:0,value:"missed"}]}):i().createElement(n.FormattedMessage,{id:"call_cancelled",defaultMessage:[{type:0,value:"cancelled"}]});break;default:r=i().createElement(n.FormattedMessage,{id:"call_disconnected",defaultMessage:[{type:0,value:"disconnected"}]})}else r=i().createElement("span",null,(0,l.Ye)(this.props.duration/1e3));return i().createElement("div",{className:"call-message"},i().createElement("div",null,i().createElement("i",{className:"material-icons big gray"},"call")),i().createElement("div",{className:"flex-column narrow"},i().createElement("div",null,a),i().createElement("div",{className:"duration"},i().createElement("i",{className:t},s)," ",r)))}}class h extends i().PureComponent{render(){const e=["busy","declined","disconnected","missed"].includes(this.props.callState),t=this.props.incoming?e?"call_missed":"call_received":e?"call_missed_outgoing":"call_made";let s;if(e)switch(this.props.callState){case"busy":s=i().createElement(n.FormattedMessage,{id:"call_busy",defaultMessage:[{type:0,value:"busy"}]});break;case"declined":s=i().createElement(n.FormattedMessage,{id:"call_declined",defaultMessage:[{type:0,value:"declined"}]});break;case"missed":s=this.props.incoming?i().createElement(n.FormattedMessage,{id:"call_missed",defaultMessage:[{type:0,value:"missed"}]}):i().createElement(n.FormattedMessage,{id:"call_cancelled",defaultMessage:[{type:0,value:"cancelled"}]});break;default:s=i().createElement(n.FormattedMessage,{id:"call_disconnected",defaultMessage:[{type:0,value:"disconnected"}]})}else s=["accepted","started"].includes(this.props.callState)&&!this.props.duration?i().createElement(n.FormattedMessage,{id:"call_in_progress",defaultMessage:[{type:0,value:"in progress"}]}):i().createElement("span",null,(0,l.Ye)(this.props.duration/1e3));return i().createElement(i().Fragment,null,i().createElement("div",{className:"composed-material"},i().createElement("i",{className:"material-icons"},"call"),i().createElement("i",{className:"material-icons second"},t))," ",s)}}class d extends i().PureComponent{constructor(e){super(e),this.videoRef=i().createRef(),this.handleClick=this.handleClick.bind(this)}handleClick(e){this.props.onClick&&this.props.onClick(e)}render(){const e=(0,l.Ye)(this.props["data-duration"]/1e3),t="inline-video"+(this.props.onClick?" image-clickable":"");return i().createElement("div",{className:t},i().createElement("img",this.props),i().createElement("div",{className:"play-control"},this.props.onClick?i().createElement("i",{className:"material-icons white x-big"},"play_arrow"):i().createElement("img",{src:"img/broken_video.png",style:{filter:"invert(100%)"},width:"36",height:"36"})),e?i().createElement("div",{className:"duration"},e):null)}}class p extends i().PureComponent{constructor(e){super(e),this.state={src:this.props.isvideo?"img/blankvid.png":"img/blankimg.png",style:Object.assign({padding:"4px"},this.props.style),className:this.props.className,alt:this.props.alt,onClick:this.props.onClick}}componentDidMount(){this.props.whenDone.promise.then(e=>this.setState({src:e.src,style:{...this.state.style,padding:0}})).catch(e=>this.setState({src:this.props.isvideo?"img/broken_video.png":"img/broken_image.png"}))}componentWillUnmount(){this.props.whenDone.cancel()}componentDidUpdate(e){e.whenDone!=this.props.whenDone&&(this.setState({src:this.props.isvideo?"img/blankvid.png":"img/blankimg.png",style:{...this.state.style,padding:"4px"}}),this.props.whenDone.promise.then(e=>this.setState({src:e.src,style:{...this.state.style,padding:0}})).catch(e=>this.setState({src:this.props.isvideo?"img/broken_video.png":"img/broken_image.png"})))}render(){return i().createElement("img",this.state)}}var u=s(9895);class m extends i().PureComponent{constructor(e){super(e)}render(){return i().createElement("div",{className:"inline-image"},i().createElement("img",this.props),i().createElement("div",{className:"rounded-container"},i().createElement(u.A,{progress:this.props.progress,onCancel:this.props.onCancelUpload})))}}var g=s(9027),f=s(6110),v=s(3540);const b=(0,n.defineMessages)({drafty_form:{id:"drafty_form",defaultMessage:[{type:0,value:"Form:"}]},drafty_attachment:{id:"drafty_attachment",defaultMessage:[{type:0,value:"Attachment"}]},drafty_image:{id:"drafty_image",defaultMessage:[{type:0,value:"Picture"}]},drafty_video:{id:"drafty_video",defaultMessage:[{type:0,value:"Video recording"}]},drafty_unknown:{id:"drafty_unknown",defaultMessage:[{type:0,value:"Unsupported"}]}});function E(e,t,s,a,n){if(n.includes("QQ"))return _.call(this,e,t,s,a);if(!e)return s;let h=r.Drafty.tagName(e),d=r.Drafty.attrValue(e,t)||{};switch(d.key=a,e){case"AU":d.src&&(d.src=this.authorizeURL((0,v.wk)(d.src,"audio")),d.duration=t.duration>0?0|t.duration:void 0,d.preview=t.preview,d.loading="lazy"),h=o.A,s=null;break;case"BR":s=null;break;case"EX":case"RW":break;case"HL":d.className="highlight";break;case"HD":h=null,s=null;break;case"IM":h=y.call(this,h,t,d),s=null;break;case"BN":d.onClick=this.onFormButtonClick;let e=i().Children.map(s,e=>"string"==typeof e?e:void 0);e&&0!=e.length||(e=[d.name]),d["data-title"]=e.join("");break;case"LN":d&&(d.href="string"==typeof d.href?(0,v.Jf)(d.href,g.kA):"");break;case"MN":d.className="mention",t&&(d.className+=" "+(0,l.kJ)(t.val,!1,!0));break;case"FM":d.className="bot-form";break;case"QQ":d.className="reply-quote",d.onClick=this.onQuoteClick;break;case"VC":h=c,s=null,t&&(d.callState=t.state,d.incoming=t.incoming,d.duration=t.duration);break;case"VD":h=w.call(this,h,t,d),s=null;break;default:if(!h){h=i().Fragment,d={key:a};let e=s;Array.isArray(s)&&s.join("").trim()||(e=[i().createElement("span",{key:"x1",className:"gray"},this.formatMessage(b.drafty_unknown))]),s=[i().createElement("i",{key:"x0",className:"material-icons gray"},"extension")," "].concat(e)}}return h?i().createElement(h,d,s):s}function y(e,t,s){if(!t)return s.src="img/broken_image.png",s.style={width:g._g+"px",height:g._g+"px"},e;s.className="inline-image";const a=(0,f.ae)(t.width,t.height,this.viewportWidth>0?Math.min(this.viewportWidth-6.5*g.JS,34.5*g.JS):34.5*g.JS,24*g.JS,!1)||{dstWidth:g._j,dstHeight:g._j};return s.style={width:a.dstWidth+"px",height:a.dstHeight+"px",minWidth:a.dstWidth+"px",minHeight:a.dstHeight+"px"},r.Drafty.isProcessing(t)?e=m:(s.src=this.authorizeURL((0,v.wk)(s.src,"image")),s.alt=t.name,s.src?(Math.max(t.width||0,t.height||0)>g._g&&(s.onClick=this.onImagePreview,s.className+=" image-clickable"),s.loading="lazy"):s.src=null),e}function w(e,t,s){if(!t)return s.src="img/broken_video.png",s.style={width:g._g+"px",height:g._g+"px"},e;s.className="inline-image";const a=(0,f.ae)(t.width,t.height,this.viewportWidth>0?Math.min(this.viewportWidth-6.5*g.JS,34.5*g.JS):34.5*g.JS,24*g.JS,!1)||{dstWidth:g.qV,dstHeight:g.qV};return s.style={width:a.dstWidth+"px",height:a.dstHeight+"px",minWidth:a.dstWidth+"px",minHeight:a.dstHeight+"px"},r.Drafty.isProcessing(t)?e=m:(s.src=this.authorizeURL((0,v.wk)(s.src,"image")),s.alt=t.name,(t.ref||t.val)&&(s.onClick=this.onVideoPreview,s.loading="lazy"),e=d),e}function C(e,t,s,a){if(!e)return s;let n=r.Drafty.tagName(e);const o={key:a};switch(e){case"AU":n=i().Fragment,s=[i().createElement("i",{key:"au",className:"material-icons"},"mic")," ",(0,l.Ye)(t.duration/1e3)];break;case"BR":n=i().Fragment,s=[" "];break;case"HL":o.className="highlight preview";break;case"LN":case"MN":n="span";break;case"IM":n=i().Fragment,s=[i().createElement("i",{key:"im",className:"material-icons"},"photo")," ",this.formatMessage(b.drafty_image)];break;case"BN":n="span",o.className="flat-button faux";break;case"FM":n=i().Fragment,s=[i().createElement("i",{key:"fm",className:"material-icons"},"dashboard"),this.formatMessage(b.drafty_form)].concat(" ",s||[]);break;case"RW":n=i().Fragment;break;case"EX":if(t){if(r.Drafty.isFormResponseType(t.mime))return null;delete t.val,delete t.ref}n=i().Fragment,s=[i().createElement("i",{key:"ex",className:"material-icons"},"attachment")," ",this.formatMessage(b.drafty_attachment)];break;case"VC":n=h,t&&(o.callState=t.state,o.incoming=t.incoming,o.duration=t.duration),s=null;break;case"QQ":case"HD":n=null,s=null;break;case"VD":n=i().Fragment,s=[i().createElement("i",{key:"im",className:"material-icons"},"play_circle_outline")," ",this.formatMessage(b.drafty_video)];break;default:n||(n=i().Fragment,s=[i().createElement("i",{key:"x0",className:"material-icons gray"},"extension")," ",this.formatMessage(b.drafty_unknown)])}return n?i().createElement(n,o,s):s}function S(e,t){return e.style={width:g._g+"px",height:g._g+"px",maxWidth:g._g+"px",maxHeight:g._g+"px"},e.className="inline-image",e.alt=this.formatMessage(b.drafty_image),e.src=t&&e.src||"img/broken_image.png",e.title=e.alt,e}function M(e,t){const s=(0,f.ae)(t.width,t.height,g.iq,g._g);return e.style={width:s.width+"px",height:s.height+"px",maxWidth:g.iq+"px",maxHeight:g._g+"px"},e.className="inline-image",e.alt=this.formatMessage(b.drafty_video),e.title=e.alt,e.src=t&&e.src||"img/broken_video.png",e}function _(e,t,s,a){if(["BR","EX","IM","MN","VD"].includes(e)){let n=r.Drafty.tagName(e),o=r.Drafty.attrValue(e,t)||{};switch(o.key=a,e){case"BR":s=null;break;case"IM":o=S.call(this,o,t),s=[i().createElement("img",o,null)," ",o.alt],n=i().Fragment,o={key:a};break;case"VD":o=M.call(this,o,t),s=[i().createElement("img",o,null)," ",o.alt],n=i().Fragment,o={key:a};break;case"MN":n="span",o.className="mention",t&&(o.className+=" "+(0,l.kJ)(t.val,!1,!0));break;case"EX":let e;if(t){if(r.Drafty.isFormResponseType(t.mime))return null;e=t.name,delete t.val,delete t.ref}n=i().Fragment,s=[i().createElement("i",{key:"ex",className:"material-icons"},"attachment"),(0,l.Tu)(e,16)||this.formatMessage(b.drafty_attachment)]}return i().createElement(n,o,s)}return C.call(this,e,t,s,a)}function T(e,t){let s,a,i,n;if(t?(a=e.preview,n=e.premime||"image/jpeg",i=e.preref):(a=e.val,n=e.mime,i=e.ref),a){const e=(0,f.i)(a,n);if(!e)throw new Error("Invalid image");s=Promise.resolve(e)}else{if(!i)throw new Error("Missing image data");s=fetch(this.authorizeURL((0,v.wk)(i,"image"))).then(e=>{if(e.ok)return e.blob();throw new Error(`Image fetch unsuccessful: ${e.status} ${e.statusText}`)})}return s.then(e=>(0,f.ag)(e,t?g.iq:g._g,g._g,-1,!t)).then(s=>(t?e.premime=s.mime:e.mime=s.mime,e.size=s.blob.size,e.width=s.width,e.height=s.height,delete e.ref,delete e.preref,e.src=URL.createObjectURL(s.blob),(0,f.Sk)(s.blob))).then(s=>(t?e.preview=s.bits:e.val=s.bits,e)).catch(t=>{throw delete e.val,delete e.preview,delete e.src,e.width=g._g,e.height=g._g,t})}function A(e,t,s,a,n){if("IM"==e||"VD"==e){const n="IM"==e?S.call(this,{key:a},t):M.call(this,{key:a},t);let r;try{r=(0,v.iE)(T.call(this,t,"VD"==e))}catch(e){console.warn("Failed to quote image:",e.message),r=(0,v.iE)(e)}return n.whenDone=r,s=[i().createElement(p,n,null)," ",n.alt],i().createElement(i().Fragment,{key:a},s)}if("QQ"==e){if(n.includes("QQ"))return i().createElement("span",{key:a},[i().createElement("i",{key:"qq",className:"material-icons"},"format_quote")," "]);const e=r.Drafty.attrValue("QQ",t)||{};return e.key=a,e.className="reply-quote",i().createElement(r.Drafty.tagName("QQ"),e,s)}return _.call(this,e,t,s,a)}},8089:function(e,t,s){s.d(t,{A:function(){return b}});var a=s(1594),i=s.n(a),n=s(8181),r=s(4532),o=s(221),l=s(9418),c=s(1485),h=s(3307),d=s(9027),p=s(6110),u=s(8589),m=s(3540);const g=(0,n.defineMessages)({alias_invalid:{id:"alias_invalid",defaultMessage:[{type:0,value:"(invalid)"}]},alias_already_taken:{id:"alias_already_taken",defaultMessage:[{type:0,value:"(already taken)"}]},self_topic_name:{id:"self_topic_name",defaultMessage:[{type:0,value:"Saved messages"}]},self_topic_comment:{id:"self_topic_comment",defaultMessage:[{type:0,value:"Notes, messages, links, files saved for posterity"}]}});class f extends i().Component{constructor(e){super(e);const t=this.props.tinode.getTopic(this.props.topic),s=t.getAccessMode(),a=r.Tinode.isSelfTopicName(this.props.topic);this.state={isMe:r.Tinode.isMeTopicName(this.props.topic),isSelf:a,owner:s&&s.isOwner(),fullName:t.public?t.public.fn:a?this.props.intl.formatMessage(g.self_topic_name):null,private:t.private?t.private.comment:null,description:t.public?t.public.note:a?this.props.intl.formatMessage(g.self_topic_comment):null,avatar:(0,p.to)(t.public?t.public.photo:null),tags:t.tags()||[],newAvatar:null,newAvatarMime:null,aliasError:""},this.previousOnTags=null,this.aliasCheckTimer=null,this.aliasCheckPromise=null,this.tnNewTags=this.tnNewTags.bind(this),this.handleFullNameUpdate=this.handleFullNameUpdate.bind(this),this.handleImageUpdated=this.handleImageUpdated.bind(this),this.handleAvatarCropped=this.handleAvatarCropped.bind(this),this.handleAvatarCropCancel=this.handleAvatarCropCancel.bind(this),this.uploadAvatar=this.uploadAvatar.bind(this),this.handlePrivateUpdate=this.handlePrivateUpdate.bind(this),this.handleAliasUpdate=this.handleAliasUpdate.bind(this),this.handleDescriptionUpdate=this.handleDescriptionUpdate.bind(this),this.handleTagsUpdated=this.handleTagsUpdated.bind(this),this.validateAlias=this.validateAlias.bind(this),this.cancelValidator=this.cancelValidator.bind(this)}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);this.previousOnTags=e.onTagsUpdated,e.onTagsUpdated=this.tnNewTags}componentWillUnmount(){this.props.tinode.getTopic(this.props.topic).onTagsUpdated=this.previousOnTags,this.cancelValidator()}tnNewTags(e){this.setState({tags:e})}handleFullNameUpdate(e){(e=(0,u.W5)(e.trim(),d.tS))&&this.state.fullName!==e&&(this.setState({fullName:e}),this.props.onUpdateTopicDesc(this.props.topic,(0,m.k6)(e,null)))}handlePrivateUpdate(e){e=e.trim().substring(0,d.tS),this.state.private!==e&&(this.setState({private:e}),this.props.onUpdateTopicDesc(this.props.topic,null,e||r.Tinode.DEL_CHAR))}handleDescriptionUpdate(e){(e=e.trim().substring(0,d.lQ))&&(this.setState({description:e}),this.props.onUpdateTopicDesc(this.props.topic,(0,m.k6)(null,null,null,e)))}handleImageUpdated(e,t){this.setState({newAvatar:t,newAvatarMime:e}),t||(this.setState({avatar:null}),this.props.onUpdateTopicDesc(this.props.topic,(0,m.k6)(null,r.Tinode.DEL_CHAR)))}handleAvatarCropped(e,t,s,a){const i=t?URL.createObjectURL(t):null;this.setState({avatar:i,newAvatar:null,newAvatarMime:null}),t&&this.uploadAvatar(e,t,s,a)}uploadAvatar(e,t,s,a){const i=e=>{let{mime:t,blob:s}=e;if(s.size>d.Z7){this.props.tinode.getLargeFileHelper().upload(s).then(e=>this.props.onUpdateTopicDesc(this.props.topic,(0,m.k6)(null,e))).catch(e=>this.props.onError(e.message,"err"))}else(0,p.Sk)(s).then(e=>{const s=(0,p.to)({data:e.bits,type:t});this.setState({source:s}),this.props.onUpdateTopicDesc(this.props.topic,(0,m.k6)(null,s))})};s>d.eQ||a>d.eQ||s!=a?(0,p.ag)(t,d.eQ,d.eQ,d.qy,!0).then(e=>i(e)).catch(e=>this.props.onError(e.message,"err")):i({mime:e,blob:t,width:s,height:a})}handleAvatarCropCancel(){this.setState({newAvatar:null,newAvatarMime:null})}handleAliasUpdate(e){const t=(e=(e||"").trim())?r.Tinode.setUniqueTag(this.state.tags,r.Tinode.TAG_ALIAS+e.toLowerCase()):r.Tinode.clearTagPrefix(this.state.tags,r.Tinode.TAG_ALIAS);this.handleTagsUpdated(t)}validateAlias(e){if(this.cancelValidator(),!(e=e.trim()))return this.setState({aliasError:""}),!0;if(!r.Tinode.isValidTagValue(e))return this.setState({aliasError:this.props.intl.formatMessage(g.alias_invalid)}),!1;this.setState({aliasError:""});const t=this.props.tinode.getFndTopic();if(!t)return this.setState({aliasError:""}),!0;this.aliasCheckPromise={};const s=new Promise((e,t)=>{this.aliasCheckPromise.resolve=e,this.aliasCheckPromise.reject=t});return this.aliasCheckTimer=setTimeout(s=>{this.aliasCheckTimer=null,t.checkTagUniqueness(`${r.Tinode.TAG_ALIAS}${e}`,this.props.topic).then(e=>{this.aliasCheckPromise.resolve(e),this.setState({aliasError:e?"":this.props.intl.formatMessage(g.alias_already_taken)})}).catch(e=>{this.aliasCheckPromise.reject(e),this.setState({aliasError:e.message})})},1e3),s}cancelValidator(){this.aliasCheckTimer&&(clearTimeout(this.aliasCheckTimer),this.aliasCheckTimer=null,this.aliasCheckPromise.reject(null))}handleTagsUpdated(e){(0,m.af)(this.state.tags.slice(0),e.slice(0))||this.props.onUpdateTags(e)}render(){if(this.state.newAvatar)return i().createElement(o.A,{avatar:this.state.newAvatar,mime:this.state.newAvatarMime,onSubmit:this.handleAvatarCropped,onCancel:this.handleAvatarCropCancel,onError:this.props.onError});const e=this.state.isMe||this.state.owner&&!this.state.isSelf;let t=this.state.tags&&this.state.tags.find(e=>e.startsWith("alias:"));return t&&(t=t.substring(6)),i().createElement(i().Fragment,null,i().createElement("div",{className:"panel-form-column"},i().createElement("center",null,i().createElement(l.A,{tinode:this.props.tinode,avatar:this.state.avatar,readOnly:!e,uid:this.props.topic,title:this.state.fullName,onImageUpdated:this.handleImageUpdated,onError:this.props.onError})),this.state.isMe?i().createElement("div",{className:"group"},i().createElement("label",{className:"small"},i().createElement(n.FormattedMessage,{id:"label_your_name",defaultMessage:[{type:0,value:"Your name"}]})),i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"full_name_prompt",defaultMessage:[{type:0,value:"Full name, e.g. John Doe"}]},e=>i().createElement(c.A,{placeholder:e,value:this.state.fullName,required:!0,onFinished:this.handleFullNameUpdate})))):i().createElement(i().Fragment,null,i().createElement("div",{className:"group"},i().createElement("div",null,i().createElement("label",{className:"small"},i().createElement(n.FormattedMessage,{id:"label_topic_name",defaultMessage:[{type:0,value:"Name"}]}))),i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:[{type:0,value:"Freeform name of the group"}]},t=>i().createElement(c.A,{placeholder:t,readOnly:!e,value:this.state.fullName,required:!0,maxLength:32,onFinished:this.handleFullNameUpdate})))),i().createElement("div",{className:"group"},i().createElement("div",null,i().createElement("label",{className:"small"},i().createElement(n.FormattedMessage,{id:"label_private",defaultMessage:[{type:0,value:"Private comment"}]}))),i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:[{type:0,value:"Visible to you only"}]},e=>i().createElement(c.A,{placeholder:e,value:this.state.private,onFinished:this.handlePrivateUpdate}))))),e||t?i().createElement("div",{className:"group"},i().createElement("div",null,i().createElement("label",{className:"small "+(this.state.aliasError?"invalid":"")},i().createElement(n.FormattedMessage,{id:"label_alias_edit",defaultMessage:[{type:0,value:"Alias"}]})," ",this.state.aliasError)),i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"alias_editing_placeholder",defaultMessage:[{type:0,value:"Alias (optional)"}]},s=>i().createElement(c.A,{placeholder:s,readOnly:!e,value:t,validator:this.validateAlias,iconLeft:"alternate_email",maxLength:24,spellCheck:!1,onFinished:this.handleAliasUpdate})))):null,e||this.state.description?i().createElement("div",{className:"group"},i().createElement("div",null,i().createElement("label",{className:"small"},i().createElement(n.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]}))),i().createElement("div",null,i().createElement(n.FormattedMessage,{id:"description_editing_placeholder",defaultMessage:[{type:0,value:"Description (optional)"}]},t=>i().createElement(c.A,{placeholder:t,readOnly:!e,value:this.state.description,multiline:2,onFinished:this.handleDescriptionUpdate})))):null),e&&!this.state.isMe?i().createElement(i().Fragment,null,i().createElement("div",{className:"hr"}),i().createElement(n.FormattedMessage,{id:"title_tag_manager",defaultMessage:[{type:0,value:"Tags (search & discovery)"}]},e=>i().createElement(h.A,{tinode:this.props.tinode,title:e,activated:!1,tags:this.state.tags,onSubmit:this.handleTagsUpdated}))):null)}}var v=(0,n.injectIntl)(f);class b extends i().Component{constructor(e){super(e);this.props.tinode.getTopic(this.props.topic).getAccessMode();this.state={tags:[]},this.previousTagsUpdated=void 0,this.onTagsUpdated=this.onTagsUpdated.bind(this),this.handleTagsUpdated=this.handleTagsUpdated.bind(this)}componentDidUpdate(e){const t=this.props.tinode.getTopic(e.topic);t&&(t.onTagsUpdated!=this.onTagsUpdated&&("grp"==t.getType()?(this.previousTagsUpdated=t.onTagsUpdated,t.onTagsUpdated=this.onTagsUpdated):this.previousTagsUpdated=void 0),this.state.topic!=e.topic&&this.setState({topic:e.topic}))}componentWillUnmount(){this.props.tinode.getTopic(this.props.topic).onTagsUpdated=this.previousTagsUpdated}onTagsUpdated(e){this.setState({tags:e}),this.previousTagsUpdated&&this.previousTagsUpdated!=this.onTagsUpdated&&this.previousTagsUpdated(e)}handleTagsUpdated(e){(0,m.af)(this.state.tags.slice(0),e.slice(0))||this.props.onUpdateTagsRequest(this.props.topic,e)}render(){return i().createElement("div",{className:"scrollable-panel"},i().createElement(v,{tinode:this.props.tinode,topic:this.props.topic,onUpdateTopicDesc:this.props.onUpdateTopicDesc,onUpdateTags:this.handleTagsUpdated,onError:this.props.onError}))}}},8181:function(e){e.exports=ReactIntl},8262:function(e,t,s){s.d(t,{A:function(){return a}});class a{static setObject(e,t){localStorage.setItem(e,JSON.stringify(t))}static getObject(e){const t=localStorage.getItem(e);return t&&JSON.parse(t)}static updateObject(e,t){const s=this.getObject(e);this.setObject(e,Object.assign(s||{},t))}static removeItem(e){localStorage.removeItem(e)}}},8589:function(e,t,s){function a(e,t){t=t||window.navigator.userLanguage||window.navigator.language;const s=new Date;return e.getFullYear()==s.getFullYear()?e.getMonth()==s.getMonth()&&e.getDate()==s.getDate()?e.toLocaleTimeString(t,{hour12:!1,hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{hour12:!1,month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"}):e.toLocaleDateString(t,{year:"numeric",month:"short",day:"numeric"})}function i(e,t){t=t||window.navigator.userLanguage||window.navigator.language;const s=new Date,a=Math.floor((e.getTime()-6e4*e.getTimezoneOffset())/864e5)-Math.floor((s.getTime()-6e4*s.getTimezoneOffset())/864e5);return Math.abs(a)<2?new Intl.RelativeTimeFormat(t,{numeric:"auto"}).format(a,"day"):new Intl.DateTimeFormat(t).format(e)}function n(e,t){if("number"!=typeof e)return"";let s=(0|Math.floor(e/60))%60,a=0|Math.floor(e/3600);(t||a>0)&&(s=s<10?`0${s}`:s);let i=(0|e)%60;return i=i<10?`0${i}`:i,0==a?`${s}:${i}`:`${a}:${s}:${i}`}function r(e){if(!e||0==e)return"0 Bytes";const t=["Bytes","KB","MB","GB","TB","PB"],s=Math.min(0|Math.floor(Math.log2(e)/10),t.length-1),a=e/Math.pow(1024,s),i=s>0?a<3?2:a<30?1:0:0;return a.toFixed(i)+" "+t[s]}function o(e,t){return"string"!=typeof e?e:e.length>t?e.slice(0,t/2-1)+"…"+e.slice(1-t/2):e}function l(e,t,s){return(t?"lt-":"dk-")+(s?"fg-":"bg-")+(a=e,Math.abs(function(e){let t=0;e=""+e;for(let s=0;s<e.length;s++)t=(t<<5)-t+e.charCodeAt(s),t&=t;return t}(a))%16);var a}function c(e){const t=e.toUpperCase().split("").map(e=>127397+e.charCodeAt());return String.fromCodePoint(...t)}function h(e,t){if("string"!=typeof e)return e;if(e.length<=t)return e;return/[\u0590-\u05FF\u0600-\u06FF\u0750-\u077F\u08A0-\u08FF\uFB50-\uFDFF\uFE70-\uFEFF]/.test(e)?"…"+e.slice(0,t-1):e.slice(0,t-1)+"…"}s.d(t,{Tu:function(){return o},W5:function(){return h},Ye:function(){return n},cq:function(){return a},kJ:function(){return l},lX:function(){return r},lb:function(){return c},mf:function(){return i}})},9027:function(e,t,s){s.d(t,{C3:function(){return a},Cx:function(){return T},D3:function(){return m},DT:function(){return N},GB:function(){return p},H1:function(){return w},HX:function(){return r},J:function(){return c},JS:function(){return f},Lq:function(){return i},NR:function(){return l},QG:function(){return M},RS:function(){return B},Rz:function(){return R},S:function(){return Z},SE:function(){return n},TR:function(){return x},Ti:function(){return d},Tn:function(){return H},U3:function(){return o},Uv:function(){return J},V9:function(){return q},VJ:function(){return g},Yd:function(){return G},Z7:function(){return b},ZW:function(){return K},_g:function(){return A},_j:function(){return E},bn:function(){return Q},cL:function(){return X},cZ:function(){return u},eQ:function(){return v},fi:function(){return j},gb:function(){return Y},hB:function(){return U},hT:function(){return W},iB:function(){return O},iq:function(){return k},kA:function(){return V},lQ:function(){return I},mp:function(){return C},mu:function(){return P},qV:function(){return y},qy:function(){return S},rl:function(){return z},rn:function(){return h},sT:function(){return F},tS:function(){return D},wj:function(){return _},wl:function(){return L},yS:function(){return $}});const a="TinodeWeb/"+(s(257).i||"0.24"),i="AQEAAAABAAD_rAp4DJh05a1HAwFT3A6K",n={hosted:"web.tinode.co",local:"localhost:6060"},r=n.hosted,o=!0,l=3e3,c=1500,h=2,d=96,p=16,u="JRWPS",m="N",g=640,f=13,v=384,b=4096,E=32,y=128,w=24,C=262144,S=1<<23,M=1024,_=64,T=96,A=36,k=48,N=4,D=60,I=360,P=24,F=80,R=30,x=84,U=48,L=2e3,O=6e5,j="mailto:support@tinode.co",B="https://tinode.co/privacy.html",q="https://tinode.co/terms.html",z=!1,V=["http","https","ftp","ftps"],H=128,W=8e4,K=1e3,$=3*f,G="data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZpZXdCb3g9IjAgMCAxNyAxNyIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMy41NjIgMXYxNS40NTlsNC42ODYtMy4yNyA0Ljc1MiAzLjI2di0xNS40NDloLTkuNDM4ek0xMiAxNC41NTFsLTMuNzU2LTIuNTc4LTMuNjgxIDIuNTY4di0xMi41NDFoNy40Mzd2MTIuNTUxeiIgZmlsbD0iIzU1NTU1NSIgLz48L3N2Zz4=",Q=3e3,Y="auto",X=10,J="application/json",Z={type:"patt",index:0,path:"img/bkg/"}},9418:function(e,t,s){s.d(t,{A:function(){return c}});var a=s(1594),i=s.n(a),n=s(6904),r=s(1013),o=s(3540),l=s(9027);class c extends i().Component{constructor(e){super(e),this.state={source:e.avatar},this.handleFileReceived=this.handleFileReceived.bind(this)}componentDidUpdate(e){this.props.avatar!=e.avatar&&this.setState({source:this.props.avatar})}handleFileReceived(e){const t=e.target.files[0];this.props.onImageUpdated(t.type,URL.createObjectURL(t),t.name),e.target.value=""}render(){const e="file-input-avatar-"+(""+Math.random()).substring(0,4),t="avatar-upload"+(this.props.readOnly?" read-only":"");return i().createElement("div",{className:t},this.props.readOnly||!this.state.source?null:i().createElement("a",{href:"#",className:"clear-avatar",onClick:e=>{e.preventDefault(),this.props.onImageUpdated()}},i().createElement("i",{className:"material-icons"},"clear")),this.state.source?i().createElement("img",{src:this.props.tinode.authorizeURL((0,o.wk)(this.state.source,"image")),className:"preview"}):this.props.readOnly&&this.props.uid?i().createElement("div",{className:"avatar-box"},i().createElement(n.A,{tinode:this.props.tinode,avatar:!0,topic:this.props.uid,title:this.props.title})):i().createElement("div",{className:"blank"},l.eQ,"×",l.eQ),this.props.readOnly?null:i().createElement("input",{type:"file",id:e,className:"inputfile hidden",accept:"image/*",onChange:this.handleFileReceived}),this.props.readOnly?null:i().createElement("label",{htmlFor:e,className:"round"},i().createElement("i",{className:"material-icons"},"file_upload")),i().createElement(r.A,{show:this.props.uploading,large:!0,clear:!0,centered:!0}))}}},9593:function(e){e.exports=QRCode},9895:function(e,t,s){s.d(t,{A:function(){return r}});var a=s(1594),i=s.n(a),n=s(8181);class r extends i().PureComponent{render(){return i().createElement("div",{className:"uploader"},i().createElement("div",null,i().createElement("span",{style:{width:100*this.props.progress+"%"}})),this.props.progress<.999?i().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancel()}},i().createElement("i",{className:"material-icons"},"close")," ",i().createElement(n.FormattedMessage,{id:"action_cancel",defaultMessage:[{type:0,value:"cancel"}]})):i().createElement(n.FormattedMessage,{id:"upload_finishing",defaultMessage:[{type:0,value:"finishing..."}]}))}}}},n={};function r(e){var t=n[e];if(void 0!==t)return t.exports;var s=n[e]={exports:{}};return i[e].call(s.exports,s,s.exports,r),s.exports}r.m=i,r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,{a:t}),t},t=Object.getPrototypeOf?function(e){return Object.getPrototypeOf(e)}:function(e){return e.__proto__},r.t=function(s,a){if(1&a&&(s=this(s)),8&a)return s;if("object"==typeof s&&s){if(4&a&&s.__esModule)return s;if(16&a&&"function"==typeof s.then)return s}var i=Object.create(null);r.r(i);var n={};e=e||[null,t({}),t([]),t(t)];for(var o=2&a&&s;("object"==typeof o||"function"==typeof o)&&!~e.indexOf(o);o=t(o))Object.getOwnPropertyNames(o).forEach(function(e){n[e]=function(){return s[e]}});return n.default=function(){return s},r.d(i,n),i},r.d=function(e,t){for(var s in t)r.o(t,s)&&!r.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},r.f={},r.e=function(e){return Promise.all(Object.keys(r.f).reduce(function(t,s){return r.f[s](e,t),t},[]))},r.u=function(e){return e+".prod.js"},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},s={},a="tinode-webapp:",r.l=function(e,t,i,n){if(s[e])s[e].push(t);else{var o,l;if(void 0!==i)for(var c=document.getElementsByTagName("script"),h=0;h<c.length;h++){var d=c[h];if(d.getAttribute("src")==e||d.getAttribute("data-webpack")==a+i){o=d;break}}o||(l=!0,(o=document.createElement("script")).charset="utf-8",r.nc&&o.setAttribute("nonce",r.nc),o.setAttribute("data-webpack",a+i),o.src=e),s[e]=[t];var p=function(t,a){o.onerror=o.onload=null,clearTimeout(u);var i=s[e];if(delete s[e],o.parentNode&&o.parentNode.removeChild(o),i&&i.forEach(function(e){return e(a)}),t)return t(a)},u=setTimeout(p.bind(null,void 0,{type:"timeout",target:o}),12e4);o.onerror=p.bind(null,o.onerror),o.onload=p.bind(null,o.onload),l&&document.head.appendChild(o)}},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.p="/umd/",function(){var e={57:0};r.f.j=function(t,s){var a=r.o(e,t)?e[t]:void 0;if(0!==a)if(a)s.push(a[2]);else{var i=new Promise(function(s,i){a=e[t]=[s,i]});s.push(a[2]=i);var n=r.p+r.u(t),o=new Error;r.l(n,function(s){if(r.o(e,t)&&(0!==(a=e[t])&&(e[t]=void 0),a)){var i=s&&("load"===s.type?"missing":s.type),n=s&&s.target&&s.target.src;o.message="Loading chunk "+t+" failed.\n("+i+": "+n+")",o.name="ChunkLoadError",o.type=i,o.request=n,a[1](o)}},"chunk-"+t,t)}};var t=function(t,s){var a,i,n=s[0],o=s[1],l=s[2],c=0;if(n.some(function(t){return 0!==e[t]})){for(a in o)r.o(o,a)&&(r.m[a]=o[a]);if(l)l(r)}for(t&&t(s);c<n.length;c++)i=n[c],r.o(e,i)&&e[i]&&e[i][0](),e[i]=0},s=self.webpackChunktinode_webapp=self.webpackChunktinode_webapp||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))}();var o=r(1594),l=r.n(o),c=r(5338),h=r(8181);const d=function(e){const t=[];let s=0;for(let a=0;a<e.length;a++){let i=e.charCodeAt(a);i<128?t[s++]=i:i<2048?(t[s++]=i>>6|192,t[s++]=63&i|128):55296==(64512&i)&&a+1<e.length&&56320==(64512&e.charCodeAt(a+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++a)),t[s++]=i>>18|240,t[s++]=i>>12&63|128,t[s++]=i>>6&63|128,t[s++]=63&i|128):(t[s++]=i>>12|224,t[s++]=i>>6&63|128,t[s++]=63&i|128)}return t},p={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const s=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,a=[];for(let t=0;t<e.length;t+=3){const i=e[t],n=t+1<e.length,r=n?e[t+1]:0,o=t+2<e.length,l=o?e[t+2]:0,c=i>>2,h=(3&i)<<4|r>>4;let d=(15&r)<<2|l>>6,p=63&l;o||(p=64,n||(d=64)),a.push(s[c],s[h],s[d],s[p])}return a.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(d(e),t)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let s=0,a=0;for(;s<e.length;){const i=e[s++];if(i<128)t[a++]=String.fromCharCode(i);else if(i>191&&i<224){const n=e[s++];t[a++]=String.fromCharCode((31&i)<<6|63&n)}else if(i>239&&i<365){const n=((7&i)<<18|(63&e[s++])<<12|(63&e[s++])<<6|63&e[s++])-65536;t[a++]=String.fromCharCode(55296+(n>>10)),t[a++]=String.fromCharCode(56320+(1023&n))}else{const n=e[s++],r=e[s++];t[a++]=String.fromCharCode((15&i)<<12|(63&n)<<6|63&r)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const s=t?this.charToByteMapWebSafe_:this.charToByteMap_,a=[];for(let t=0;t<e.length;){const i=s[e.charAt(t++)],n=t<e.length?s[e.charAt(t)]:0;++t;const r=t<e.length?s[e.charAt(t)]:64;++t;const o=t<e.length?s[e.charAt(t)]:64;if(++t,null==i||null==n||null==r||null==o)throw new u;const l=i<<2|n>>4;if(a.push(l),64!==r){const e=n<<4&240|r>>2;if(a.push(e),64!==o){const e=r<<6&192|o;a.push(e)}}}return a},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}};class u extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const m=function(e){return function(e){const t=d(e);return p.encodeByteArray(t,!0)}(e).replace(/\./g,"")},g=function(e){try{return p.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};const f=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,v=()=>{try{return f()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&g(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},b=()=>{var e;return null===(e=v())||void 0===e?void 0:e.config};class E{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,s)=>{t?this.reject(t):this.resolve(s),"function"==typeof e&&(this.promise.catch(()=>{}),1===e.length?e(t):e(t,s))}}}function y(){try{return"object"==typeof indexedDB}catch(e){return!1}}function w(){return new Promise((e,t)=>{try{let s=!0;const a="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(a);i.onsuccess=()=>{i.result.close(),s||self.indexedDB.deleteDatabase(a),e(!0)},i.onupgradeneeded=()=>{s=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}class C extends Error{constructor(e,t,s){super(t),this.code=e,this.customData=s,this.name="FirebaseError",Object.setPrototypeOf(this,C.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,S.prototype.create)}}class S{constructor(e,t,s){this.service=e,this.serviceName=t,this.errors=s}create(e,...t){const s=t[0]||{},a=`${this.service}/${e}`,i=this.errors[e],n=i?function(e,t){return e.replace(M,(e,s)=>{const a=t[s];return null!=a?String(a):`<${s}?>`})}(i,s):"Error",r=`${this.serviceName}: ${n} (${a}).`;return new C(a,r,s)}}const M=/\{\$([^}]+)}/g;function _(e,t){if(e===t)return!0;const s=Object.keys(e),a=Object.keys(t);for(const i of s){if(!a.includes(i))return!1;const s=e[i],n=t[i];if(T(s)&&T(n)){if(!_(s,n))return!1}else if(s!==n)return!1}for(const e of a)if(!s.includes(e))return!1;return!0}function T(e){return null!==e&&"object"==typeof e}function A(e){return e&&e._delegate?e._delegate:e}class k{constructor(e,t,s){this.name=e,this.instanceFactory=t,this.type=s,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}const N="[DEFAULT]";class D{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new E;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const s=this.getOrInitializeService({instanceIdentifier:t});s&&e.resolve(s)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const s=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),a=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(s)&&!this.shouldAutoInitialize()){if(a)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:s})}catch(e){if(a)return null;throw e}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,this.shouldAutoInitialize()){if(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:N})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const s=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:s});t.resolve(e)}catch(e){}}}}clearInstance(e=N){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=N){return this.instances.has(e)}getOptions(e=N){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,s=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(s))throw Error(`${this.name}(${s}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const a=this.getOrInitializeService({instanceIdentifier:s,options:t});for(const[e,t]of this.instancesDeferred.entries()){s===this.normalizeInstanceIdentifier(e)&&t.resolve(a)}return a}onInit(e,t){var s;const a=this.normalizeInstanceIdentifier(t),i=null!==(s=this.onInitCallbacks.get(a))&&void 0!==s?s:new Set;i.add(e),this.onInitCallbacks.set(a,i);const n=this.instances.get(a);return n&&e(n,a),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const s=this.onInitCallbacks.get(t);if(s)for(const a of s)try{a(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let s=this.instances.get(e);if(!s&&this.component&&(s=this.component.instanceFactory(this.container,{instanceIdentifier:(a=e,a===N?void 0:a),options:t}),this.instances.set(e,s),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(s,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,s)}catch(e){}var a;return s||null}normalizeInstanceIdentifier(e=N){return this.component?this.component.multipleInstances?e:N:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);const t=new D(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const P=[];var F;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(F||(F={}));const R={debug:F.DEBUG,verbose:F.VERBOSE,info:F.INFO,warn:F.WARN,error:F.ERROR,silent:F.SILENT},x=F.INFO,U={[F.DEBUG]:"log",[F.VERBOSE]:"log",[F.INFO]:"info",[F.WARN]:"warn",[F.ERROR]:"error"},L=(e,t,...s)=>{if(t<e.logLevel)return;const a=(new Date).toISOString(),i=U[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${a}]  ${e.name}:`,...s)};let O,j;const B=new WeakMap,q=new WeakMap,z=new WeakMap,V=new WeakMap,H=new WeakMap;let W={get(e,t,s){if(e instanceof IDBTransaction){if("done"===t)return q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||z.get(e);if("store"===t)return s.objectStoreNames[1]?void 0:s.objectStore(s.objectStoreNames[0])}return G(e[t])},set(e,t,s){return e[t]=s,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function K(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(j||(j=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(Q(this),t),G(B.get(this))}:function(...t){return G(e.apply(Q(this),t))}:function(t,...s){const a=e.call(Q(this),t,...s);return z.set(a,t.sort?t.sort():[t]),G(a)}}function $(e){return"function"==typeof e?K(e):(e instanceof IDBTransaction&&function(e){if(q.has(e))return;const t=new Promise((t,s)=>{const a=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",n),e.removeEventListener("abort",n)},i=()=>{t(),a()},n=()=>{s(e.error||new DOMException("AbortError","AbortError")),a()};e.addEventListener("complete",i),e.addEventListener("error",n),e.addEventListener("abort",n)});q.set(e,t)}(e),t=e,(O||(O=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some(e=>t instanceof e)?new Proxy(e,W):e);var t}function G(e){if(e instanceof IDBRequest)return function(e){const t=new Promise((t,s)=>{const a=()=>{e.removeEventListener("success",i),e.removeEventListener("error",n)},i=()=>{t(G(e.result)),a()},n=()=>{s(e.error),a()};e.addEventListener("success",i),e.addEventListener("error",n)});return t.then(t=>{t instanceof IDBCursor&&B.set(t,e)}).catch(()=>{}),H.set(t,e),t}(e);if(V.has(e))return V.get(e);const t=$(e);return t!==e&&(V.set(e,t),H.set(t,e)),t}const Q=e=>H.get(e);function Y(e,t,{blocked:s,upgrade:a,blocking:i,terminated:n}={}){const r=indexedDB.open(e,t),o=G(r);return a&&r.addEventListener("upgradeneeded",e=>{a(G(r.result),e.oldVersion,e.newVersion,G(r.transaction),e)}),s&&r.addEventListener("blocked",e=>s(e.oldVersion,e.newVersion,e)),o.then(e=>{n&&e.addEventListener("close",()=>n()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}function X(e,{blocked:t}={}){const s=indexedDB.deleteDatabase(e);return t&&s.addEventListener("blocked",e=>t(e.oldVersion,e)),G(s).then(()=>{})}const J=["get","getKey","getAll","getAllKeys","count"],Z=["put","add","delete","clear"],ee=new Map;function te(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(ee.get(t))return ee.get(t);const s=t.replace(/FromIndex$/,""),a=t!==s,i=Z.includes(s);if(!(s in(a?IDBIndex:IDBObjectStore).prototype)||!i&&!J.includes(s))return;const n=async function(e,...t){const n=this.transaction(e,i?"readwrite":"readonly");let r=n.store;return a&&(r=r.index(t.shift())),(await Promise.all([r[s](...t),i&&n.done]))[0]};return ee.set(t,n),n}W=(e=>({...e,get:(t,s,a)=>te(t,s)||e.get(t,s,a),has:(t,s)=>!!te(t,s)||e.has(t,s)}))(W);class se{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null}).filter(e=>e).join(" ")}}const ae="@firebase/app",ie="0.13.2",ne=new class{constructor(e){this.name=e,this._logLevel=x,this._logHandler=L,this._userLogHandler=null,P.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in F))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?R[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,F.DEBUG,...e),this._logHandler(this,F.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,F.VERBOSE,...e),this._logHandler(this,F.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,F.INFO,...e),this._logHandler(this,F.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,F.WARN,...e),this._logHandler(this,F.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,F.ERROR,...e),this._logHandler(this,F.ERROR,...e)}}("@firebase/app"),re="@firebase/app-compat",oe="@firebase/analytics-compat",le="@firebase/analytics",ce="@firebase/app-check-compat",he="@firebase/app-check",de="@firebase/auth",pe="@firebase/auth-compat",ue="@firebase/database",me="@firebase/data-connect",ge="@firebase/database-compat",fe="@firebase/functions",ve="@firebase/functions-compat",be="@firebase/installations",Ee="@firebase/installations-compat",ye="@firebase/messaging",we="@firebase/messaging-compat",Ce="@firebase/performance",Se="@firebase/performance-compat",Me="@firebase/remote-config",_e="@firebase/remote-config-compat",Te="@firebase/storage",Ae="@firebase/storage-compat",ke="@firebase/firestore",Ne="@firebase/ai",De="@firebase/firestore-compat",Ie="firebase",Pe="[DEFAULT]",Fe={[ae]:"fire-core",[re]:"fire-core-compat",[le]:"fire-analytics",[oe]:"fire-analytics-compat",[he]:"fire-app-check",[ce]:"fire-app-check-compat",[de]:"fire-auth",[pe]:"fire-auth-compat",[ue]:"fire-rtdb",[me]:"fire-data-connect",[ge]:"fire-rtdb-compat",[fe]:"fire-fn",[ve]:"fire-fn-compat",[be]:"fire-iid",[Ee]:"fire-iid-compat",[ye]:"fire-fcm",[we]:"fire-fcm-compat",[Ce]:"fire-perf",[Se]:"fire-perf-compat",[Me]:"fire-rc",[_e]:"fire-rc-compat",[Te]:"fire-gcs",[Ae]:"fire-gcs-compat",[ke]:"fire-fst",[De]:"fire-fst-compat",[Ne]:"fire-vertex","fire-js":"fire-js",[Ie]:"fire-js-all"},Re=new Map,xe=new Map,Ue=new Map;function Le(e,t){try{e.container.addComponent(t)}catch(s){ne.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,s)}}function Oe(e){const t=e.name;if(Ue.has(t))return ne.debug(`There were multiple attempts to register component ${t}.`),!1;Ue.set(t,e);for(const t of Re.values())Le(t,e);for(const t of xe.values())Le(t,e);return!0}function je(e,t){const s=e.container.getProvider("heartbeat").getImmediate({optional:!0});return s&&s.triggerHeartbeat(),e.container.getProvider(t)}const Be=new S("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class qe{constructor(e,t,s){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=s,this.container.addComponent(new k("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Be.create("app-deleted",{appName:this._name})}}function ze(e,t={}){let s=e;if("object"!=typeof t){t={name:t}}const a=Object.assign({name:Pe,automaticDataCollectionEnabled:!0},t),i=a.name;if("string"!=typeof i||!i)throw Be.create("bad-app-name",{appName:String(i)});if(s||(s=b()),!s)throw Be.create("no-options");const n=Re.get(i);if(n){if(_(s,n.options)&&_(a,n.config))return n;throw Be.create("duplicate-app",{appName:i})}const r=new I(i);for(const e of Ue.values())r.addComponent(e);const o=new qe(s,a,r);return Re.set(i,o),o}function Ve(e,t,s){var a;let i=null!==(a=Fe[e])&&void 0!==a?a:e;s&&(i+=`-${s}`);const n=i.match(/\s|\//),r=t.match(/\s|\//);if(n||r){const e=[`Unable to register library "${i}" with version "${t}":`];return n&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),n&&r&&e.push("and"),r&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void ne.warn(e.join(" "))}Oe(new k(`${i}-version`,()=>({library:i,version:t}),"VERSION"))}const He="firebase-heartbeat-store";let We=null;function Ke(){return We||(We=Y("firebase-heartbeat-database",1,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(He)}catch(e){console.warn(e)}}}).catch(e=>{throw Be.create("idb-open",{originalErrorMessage:e.message})})),We}async function $e(e,t){try{const s=(await Ke()).transaction(He,"readwrite"),a=s.objectStore(He);await a.put(t,Ge(e)),await s.done}catch(e){if(e instanceof C)ne.warn(e.message);else{const t=Be.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});ne.warn(t.message)}}}function Ge(e){return`${e.name}!${e.options.appId}`}class Qe{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new Xe(t),this._heartbeatsCachePromise=this._storage.read().then(e=>(this._heartbeatsCache=e,e))}async triggerHeartbeat(){var e,t;try{const s=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),a=Ye();if(null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)&&(this._heartbeatsCache=await this._heartbeatsCachePromise,null==(null===(t=this._heartbeatsCache)||void 0===t?void 0:t.heartbeats)))return;if(this._heartbeatsCache.lastSentHeartbeatDate===a||this._heartbeatsCache.heartbeats.some(e=>e.date===a))return;if(this._heartbeatsCache.heartbeats.push({date:a,agent:s}),this._heartbeatsCache.heartbeats.length>30){const e=function(e){if(0===e.length)return-1;let t=0,s=e[0].date;for(let a=1;a<e.length;a++)e[a].date<s&&(s=e[a].date,t=a);return t}(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(e,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ne.warn(e)}}async getHeartbeatsHeader(){var e;try{if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null===(e=this._heartbeatsCache)||void 0===e?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)return"";const t=Ye(),{heartbeatsToSend:s,unsentEntries:a}=function(e,t=1024){const s=[];let a=e.slice();for(const i of e){const e=s.find(e=>e.agent===i.agent);if(e){if(e.dates.push(i.date),Je(s)>t){e.dates.pop();break}}else if(s.push({agent:i.agent,dates:[i.date]}),Je(s)>t){s.pop();break}a=a.slice(1)}return{heartbeatsToSend:s,unsentEntries:a}}(this._heartbeatsCache.heartbeats),i=m(JSON.stringify({version:2,heartbeats:s}));return this._heartbeatsCache.lastSentHeartbeatDate=t,a.length>0?(this._heartbeatsCache.heartbeats=a,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i}catch(e){return ne.warn(e),""}}}function Ye(){return(new Date).toISOString().substring(0,10)}class Xe{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!y()&&w().then(()=>!0).catch(()=>!1)}async read(){if(await this._canUseIndexedDBPromise){const e=await async function(e){try{const t=(await Ke()).transaction(He),s=await t.objectStore(He).get(Ge(e));return await t.done,s}catch(e){if(e instanceof C)ne.warn(e.message);else{const t=Be.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});ne.warn(t.message)}}}(this.app);return(null==e?void 0:e.heartbeats)?e:{heartbeats:[]}}return{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return $e(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const s=await this.read();return $e(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:s.lastSentHeartbeatDate,heartbeats:[...s.heartbeats,...e.heartbeats]})}}}function Je(e){return m(JSON.stringify({version:2,heartbeats:e})).length}var Ze;Ze="",Oe(new k("platform-logger",e=>new se(e),"PRIVATE")),Oe(new k("heartbeat",e=>new Qe(e),"PRIVATE")),Ve(ae,ie,Ze),Ve(ae,ie,"esm2017"),Ve("fire-js","");Ve("firebase","11.10.0","app");const et="@firebase/installations",tt="0.6.18",st=1e4,at=`w:${tt}`,it="FIS_v2",nt=36e5,rt=new S("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function ot(e){return e instanceof C&&e.code.includes("request-failed")}function lt({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function ct(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function ht(e,t){const s=(await t.json()).error;return rt.create("request-failed",{requestName:e,serverCode:s.code,serverMessage:s.message,serverStatus:s.status})}function dt({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function pt(e,{refreshToken:t}){const s=dt(e);return s.append("Authorization",function(e){return`${it} ${e}`}(t)),s}async function ut(e){const t=await e();return t.status>=500&&t.status<600?e():t}function mt(e){return new Promise(t=>{setTimeout(t,e)})}const gt=/^[cdef][\w-]{21}$/;function ft(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){const t=(s=e,btoa(String.fromCharCode(...s)).replace(/\+/g,"-").replace(/\//g,"_"));var s;return t.substr(0,22)}(e);return gt.test(t)?t:""}catch(e){return""}}function vt(e){return`${e.appName}!${e.appId}`}const bt=new Map;function Et(e,t){const s=vt(e);yt(s,t),function(e,t){const s=Ct();s&&s.postMessage({key:e,fid:t});St()}(s,t)}function yt(e,t){const s=bt.get(e);if(s)for(const e of s)e(t)}let wt=null;function Ct(){return!wt&&"BroadcastChannel"in self&&(wt=new BroadcastChannel("[Firebase] FID Change"),wt.onmessage=e=>{yt(e.data.key,e.data.fid)}),wt}function St(){0===bt.size&&wt&&(wt.close(),wt=null)}const Mt="firebase-installations-store";let _t=null;function Tt(){return _t||(_t=Y("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(Mt)}})),_t}async function At(e,t){const s=vt(e),a=(await Tt()).transaction(Mt,"readwrite"),i=a.objectStore(Mt),n=await i.get(s);return await i.put(t,s),await a.done,n&&n.fid===t.fid||Et(e,t.fid),t}async function kt(e){const t=vt(e),s=(await Tt()).transaction(Mt,"readwrite");await s.objectStore(Mt).delete(t),await s.done}async function Nt(e,t){const s=vt(e),a=(await Tt()).transaction(Mt,"readwrite"),i=a.objectStore(Mt),n=await i.get(s),r=t(n);return void 0===r?await i.delete(s):await i.put(r,s),await a.done,!r||n&&n.fid===r.fid||Et(e,r.fid),r}async function Dt(e){let t;const s=await Nt(e.appConfig,s=>{const a=function(e){const t=e||{fid:ft(),registrationStatus:0};return Ft(t)}(s),i=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(rt.create("app-offline"))}}const s={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},a=async function(e,t){try{const s=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:s}){const a=lt(e),i=dt(e),n=t.getImmediate({optional:!0});if(n){const e=await n.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const r={fid:s,authVersion:it,appId:e.appId,sdkVersion:at},o={method:"POST",headers:i,body:JSON.stringify(r)},l=await ut(()=>fetch(a,o));if(l.ok){const e=await l.json();return{fid:e.fid||s,registrationStatus:2,refreshToken:e.refreshToken,authToken:ct(e.authToken)}}throw await ht("Create Installation",l)}(e,t);return At(e.appConfig,s)}catch(s){throw ot(s)&&409===s.customData.serverCode?await kt(e.appConfig):await At(e.appConfig,{fid:t.fid,registrationStatus:0}),s}}(e,s);return{installationEntry:s,registrationPromise:a}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:It(e)}:{installationEntry:t}}(e,a);return t=i.registrationPromise,i.installationEntry});return""===s.fid?{installationEntry:await t}:{installationEntry:s,registrationPromise:t}}async function It(e){let t=await Pt(e.appConfig);for(;1===t.registrationStatus;)await mt(100),t=await Pt(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:s}=await Dt(e);return s||t}return t}function Pt(e){return Nt(e,e=>{if(!e)throw rt.create("installation-not-found");return Ft(e)})}function Ft(e){return 1===(t=e).registrationStatus&&t.registrationTime+st<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function Rt({appConfig:e,heartbeatServiceProvider:t},s){const a=function(e,{fid:t}){return`${lt(e)}/${t}/authTokens:generate`}(e,s),i=pt(e,s),n=t.getImmediate({optional:!0});if(n){const e=await n.getHeartbeatsHeader();e&&i.append("x-firebase-client",e)}const r={installation:{sdkVersion:at,appId:e.appId}},o={method:"POST",headers:i,body:JSON.stringify(r)},l=await ut(()=>fetch(a,o));if(l.ok){return ct(await l.json())}throw await ht("Generate Auth Token",l)}async function xt(e,t=!1){let s;const a=await Nt(e.appConfig,a=>{if(!Lt(a))throw rt.create("not-registered");const i=a.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+nt}(e)}(i))return a;if(1===i.requestStatus)return s=async function(e,t){let s=await Ut(e.appConfig);for(;1===s.authToken.requestStatus;)await mt(100),s=await Ut(e.appConfig);const a=s.authToken;return 0===a.requestStatus?xt(e,t):a}(e,t),a;{if(!navigator.onLine)throw rt.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(a);return s=async function(e,t){try{const s=await Rt(e,t),a=Object.assign(Object.assign({},t),{authToken:s});return await At(e.appConfig,a),s}catch(s){if(!ot(s)||401!==s.customData.serverCode&&404!==s.customData.serverCode){const s=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await At(e.appConfig,s)}else await kt(e.appConfig);throw s}}(e,t),t}});return s?await s:a.authToken}function Ut(e){return Nt(e,e=>{if(!Lt(e))throw rt.create("not-registered");const t=e.authToken;return 1===(s=t).requestStatus&&s.requestTime+st<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var s})}function Lt(e){return void 0!==e&&2===e.registrationStatus}async function Ot(e,t=!1){const s=e;await async function(e){const{registrationPromise:t}=await Dt(e);t&&await t}(s);return(await xt(s,t)).token}function jt(e){return rt.create("missing-app-config-values",{valueName:e})}const Bt="installations",qt=e=>{const t=je(e.getProvider("app").getImmediate(),Bt).getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:s,registrationPromise:a}=await Dt(t);return a?a.catch(console.error):xt(t).catch(console.error),s.fid}(t),getToken:e=>Ot(t,e)}};Oe(new k(Bt,e=>{const t=e.getProvider("app").getImmediate(),s=function(e){if(!e||!e.options)throw jt("App Configuration");if(!e.name)throw jt("App Name");const t=["projectId","apiKey","appId"];for(const s of t)if(!e.options[s])throw jt(s);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:s,heartbeatServiceProvider:je(t,"heartbeat"),_delete:()=>Promise.resolve()}},"PUBLIC")),Oe(new k("installations-internal",qt,"PRIVATE")),Ve(et,tt),Ve(et,tt,"esm2017");const zt="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4",Vt="google.c.a.c_id",Ht=1e4;var Wt,Kt;function $t(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function Gt(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),s=atob(t),a=new Uint8Array(s.length);for(let e=0;e<s.length;++e)a[e]=s.charCodeAt(e);return a}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(Wt||(Wt={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(Kt||(Kt={}));const Qt="fcm_token_details_db",Yt="fcm_token_object_Store";const Xt="firebase-messaging-store";let Jt=null;function Zt(){return Jt||(Jt=Y("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(Xt)}})),Jt}async function es(e){const t=ss(e),s=await Zt(),a=await s.transaction(Xt).objectStore(Xt).get(t);if(a)return a;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map(e=>e.name);if(!e.includes(Qt))return null}let t=null;return(await Y(Qt,5,{upgrade:async(s,a,i,n)=>{var r;if(a<2)return;if(!s.objectStoreNames.contains(Yt))return;const o=n.objectStore(Yt),l=await o.index("fcmSenderId").get(e);if(await o.clear(),l)if(2===a){const e=l;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:$t(e.vapidKey)}}}else if(3===a){const e=l;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:$t(e.auth),p256dh:$t(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:$t(e.vapidKey)}}}else if(4===a){const e=l;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:$t(e.auth),p256dh:$t(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:$t(e.vapidKey)}}}}})).close(),await X(Qt),await X("fcm_vapid_details_db"),await X("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await ts(e,t),t}}async function ts(e,t){const s=ss(e),a=(await Zt()).transaction(Xt,"readwrite");return await a.objectStore(Xt).put(t,s),await a.done,t}function ss({appConfig:e}){return e.appId}const as=new S("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function is(e,t){const s={method:"DELETE",headers:await rs(e)};try{const a=await fetch(`${ns(e.appConfig)}/${t}`,s),i=await a.json();if(i.error){const e=i.error.message;throw as.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw as.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function ns({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function rs({appConfig:e,installations:t}){const s=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${s}`})}function os({p256dh:e,auth:t,endpoint:s,vapidKey:a}){const i={web:{endpoint:s,auth:t,p256dh:e}};return a!==zt&&(i.web.applicationPubKey=a),i}async function ls(e){const t=await async function(e,t){const s=await e.pushManager.getSubscription();if(s)return s;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:Gt(t)})}(e.swRegistration,e.vapidKey),s={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:$t(t.getKey("auth")),p256dh:$t(t.getKey("p256dh"))},a=await es(e.firebaseDependencies);if(a){if(function(e,t){const s=t.vapidKey===e.vapidKey,a=t.endpoint===e.endpoint,i=t.auth===e.auth,n=t.p256dh===e.p256dh;return s&&a&&i&&n}(a.subscriptionOptions,s))return Date.now()>=a.createTime+6048e5?async function(e,t){try{const s=await async function(e,t){const s=await rs(e),a=os(t.subscriptionOptions),i={method:"PATCH",headers:s,body:JSON.stringify(a)};let n;try{const s=await fetch(`${ns(e.appConfig)}/${t.token}`,i);n=await s.json()}catch(e){throw as.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(n.error){const e=n.error.message;throw as.create("token-update-failed",{errorInfo:e})}if(!n.token)throw as.create("token-update-no-token");return n.token}(e.firebaseDependencies,t),a=Object.assign(Object.assign({},t),{token:s,createTime:Date.now()});return await ts(e.firebaseDependencies,a),s}catch(e){throw e}}(e,{token:a.token,createTime:Date.now(),subscriptionOptions:s}):a.token;try{await is(e.firebaseDependencies,a.token)}catch(e){console.warn(e)}return hs(e.firebaseDependencies,s)}return hs(e.firebaseDependencies,s)}async function cs(e){const t=await es(e.firebaseDependencies);t&&(await is(e.firebaseDependencies,t.token),await async function(e){const t=ss(e),s=(await Zt()).transaction(Xt,"readwrite");await s.objectStore(Xt).delete(t),await s.done}(e.firebaseDependencies));const s=await e.swRegistration.pushManager.getSubscription();return!s||s.unsubscribe()}async function hs(e,t){const s=await async function(e,t){const s=await rs(e),a=os(t),i={method:"POST",headers:s,body:JSON.stringify(a)};let n;try{const t=await fetch(ns(e.appConfig),i);n=await t.json()}catch(e){throw as.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(n.error){const e=n.error.message;throw as.create("token-subscribe-failed",{errorInfo:e})}if(!n.token)throw as.create("token-subscribe-no-token");return n.token}(e,t),a={token:s,createTime:Date.now(),subscriptionOptions:t};return await ts(e,a),a.token}function ds(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const s=t.notification.title;s&&(e.notification.title=s);const a=t.notification.body;a&&(e.notification.body=a);const i=t.notification.image;i&&(e.notification.image=i);const n=t.notification.icon;n&&(e.notification.icon=n)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var s,a,i,n,r;if(!t.fcmOptions&&!(null===(s=t.notification)||void 0===s?void 0:s.click_action))return;e.fcmOptions={};const o=null!==(i=null===(a=t.fcmOptions)||void 0===a?void 0:a.link)&&void 0!==i?i:null===(n=t.notification)||void 0===n?void 0:n.click_action;o&&(e.fcmOptions.link=o);const l=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;l&&(e.fcmOptions.analyticsLabel=l)}(t,e),t}function ps(e){return as.create("missing-app-config-values",{valueName:e})}!function(e,t){const s=[];for(let a=0;a<e.length;a++)s.push(e.charAt(a)),a<t.length&&s.push(t.charAt(a));s.join("")}("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class us{constructor(e,t,s){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const a=function(e){if(!e||!e.options)throw ps("App Configuration Object");if(!e.name)throw ps("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:s}=e;for(const e of t)if(!s[e])throw ps(e);return{appName:e.name,projectId:s.projectId,apiKey:s.apiKey,appId:s.appId,senderId:s.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:a,installations:t,analyticsProvider:s}}_delete(){return Promise.resolve()}}async function ms(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch(()=>{}),await async function(e){return new Promise((t,s)=>{const a=setTimeout(()=>s(new Error("Service worker not registered after 10000 ms")),Ht),i=e.installing||e.waiting;e.active?(clearTimeout(a),t()):i?i.onstatechange=e=>{var s;"activated"===(null===(s=e.target)||void 0===s?void 0:s.state)&&(i.onstatechange=null,clearTimeout(a),t())}:(clearTimeout(a),s(new Error("No incoming service worker found.")))})}(e.swRegistration)}catch(e){throw as.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}async function gs(e,t){if(!navigator)throw as.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw as.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=zt)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await ms(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw as.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),ls(e)}async function fs(e,t,s){const a=function(e){switch(e){case Kt.NOTIFICATION_CLICKED:return"notification_open";case Kt.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(a,{message_id:s[Vt],message_name:s["google.c.a.c_l"],message_time:s["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}async function vs(e,t){const s=t.data;if(!s.isFirebaseMessaging)return;e.onMessageHandler&&s.messageType===Kt.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(ds(s)):e.onMessageHandler.next(ds(s)));const a=s.data;var i;"object"==typeof(i=a)&&i&&Vt in i&&"1"===a["google.c.a.e"]&&await fs(e,s.messageType,a)}const bs="@firebase/messaging",Es="0.12.22",ys=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>gs(t,e)}};async function ws(){try{await w()}catch(e){return!1}return"undefined"!=typeof window&&y()&&!("undefined"==typeof navigator||!navigator.cookieEnabled)&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function Cs(e=function(e=Pe){const t=Re.get(e);if(!t&&e===Pe&&b())return ze();if(!t)throw Be.create("no-app",{appName:e});return t}()){return ws().then(e=>{if(!e)throw as.create("unsupported-browser")},e=>{throw as.create("indexed-db-unsupported")}),je(A(e),"messaging").getImmediate()}async function Ss(e,t){return gs(e=A(e),t)}function Ms(e){return async function(e){if(!navigator)throw as.create("only-available-in-window");return e.swRegistration||await ms(e),cs(e)}(e=A(e))}function _s(e,t){return function(e,t){if(!navigator)throw as.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=A(e),t)}Oe(new k("messaging",e=>{const t=new us(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",e=>vs(t,e)),t},"PUBLIC")),Oe(new k("messaging-internal",ys,"PRIVATE")),Ve(bs,Es),Ve(bs,Es,"esm2017");var Ts=r(4532);class As extends l().PureComponent{render(){return l().createElement("div",{className:"alert-container"},l().createElement("div",{className:"alert"},l().createElement("div",{className:"title"},this.props.title),l().createElement("div",{className:"content"},this.props.content),l().createElement("div",{className:"dialog-buttons"},this.props.onReject?l().createElement("button",{className:"outline",onClick:this.props.onReject},this.props.reject||l().createElement(h.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})):null,this.props.onConfirm?l().createElement("button",{className:"primary",onClick:this.props.onConfirm},this.props.confirm||l().createElement(h.FormattedMessage,{id:"button_ok",defaultMessage:[{type:0,value:"OK"}]})):null)))}}var ks=r(9027);const Ns=(0,h.defineMessages)({info:{id:"menu_item_info",defaultMessage:[{type:0,value:"Info"}]},clear_messages:{id:"menu_item_clear_messages",defaultMessage:[{type:0,value:"Clear messages"}]},clear_for_all:{id:"menu_item_clear_messages_for_all",defaultMessage:[{type:0,value:"Clear for All"}]},delete:{id:"menu_item_delete",defaultMessage:[{type:0,value:"Delete"}]},delete_for_all:{id:"menu_item_delete_for_all",defaultMessage:[{type:0,value:"Delete for All"}]},send_retry:{id:"menu_item_send_retry",defaultMessage:[{type:0,value:"Retry"}]},mute:{id:"menu_item_mute",defaultMessage:[{type:0,value:"Mute"}]},unmute:{id:"menu_item_unmute",defaultMessage:[{type:0,value:"Unmute"}]},reply:{id:"menu_item_reply",defaultMessage:[{type:0,value:"Reply"}]},forward:{id:"menu_item_forward",defaultMessage:[{type:0,value:"Forward"}]},edit:{id:"menu_item_edit",defaultMessage:[{type:0,value:"Edit"}]},topic_delete:{id:"menu_item_delete_topic",defaultMessage:[{type:0,value:"Delete"}]},topic_delete_warning:{id:"topic_delete_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete this conversation? It cannot be undone."}]},delete_messages_warning:{id:"delete_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to delete all messages for everyone? It cannot be undone."}]},unblock:{id:"menu_item_unblock",defaultMessage:[{type:0,value:"Unblock"}]},block:{id:"menu_item_block",defaultMessage:[{type:0,value:"Block"}]},topic_block_warning:{id:"topic_block_warning",defaultMessage:[{type:0,value:"Are you sure you want to block this conversation?"}]},member_delete:{id:"menu_item_member_delete",defaultMessage:[{type:0,value:"Remove"}]},archive:{id:"menu_item_archive_topic",defaultMessage:[{type:0,value:"Archive"}]},unarchive:{id:"menu_item_restore_topic",defaultMessage:[{type:0,value:"Restore"}]},edit_permissions:{id:"menu_item_edit_permissions",defaultMessage:[{type:0,value:"Edit permissions"}]},clear_messages_warning:{id:"clear_messages_warning",defaultMessage:[{type:0,value:"Are you sure you want to clear all messages? It cannot be undone."}]},pin_message:{id:"pin_message",defaultMessage:[{type:0,value:"Pin"}]},unpin_message:{id:"unpin_message",defaultMessage:[{type:0,value:"Unpin"}]},pin_chat:{id:"pin_chat",defaultMessage:[{type:0,value:"Pin"}]},unpin_chat:{id:"unpin_chat",defaultMessage:[{type:0,value:"Unpin"}]}});class Ds extends l().Component{constructor(e){super(e),this.selfRef=l().createRef();const{formatMessage:t}=e.intl;this.handlePageClick=this.handlePageClick.bind(this),this.handleEscapeKey=this.handleEscapeKey.bind(this),this.handleClick=this.handleClick.bind(this),this.MenuItems={topic_info:{id:"topic_info",title:t(Ns.info),handler:null},messages_clear:{id:"messages_clear",title:t(Ns.clear_messages),handler:(s,a)=>e.onShowAlert(s.topicTitle||t(Ns.clear_messages),t(Ns.clear_messages_warning),e=>{this.deleteMessages(!0,!1,s,a)},null,!0,null)},messages_clear_hard:{id:"messages_clear_hard",title:t(Ns.clear_for_all),handler:(s,a)=>e.onShowAlert(s.topicTitle||t(Ns.clear_for_all),t(Ns.delete_messages_warning),e=>this.deleteMessages(!0,!0,s,a),null,!0,null)},message_delete:{id:"message_delete",title:t(Ns.delete),handler:(e,t)=>this.deleteMessages(!1,!1,e,t)},message_delete_hard:{id:"message_delete_hard",title:t(Ns.delete_for_all),handler:(e,t)=>this.deleteMessages(!1,!0,e,t)},message_delete_generic:{id:"message_delete_generic",title:t(Ns.delete),handler:(e,t)=>this.deleteMessages(!1,!0,e,t)},menu_item_send_retry:{id:"menu_item_send_retry",title:t(Ns.send_retry),handler:(e,t)=>this.retryMessage(e,t)},menu_item_reply:{id:"menu_item_reply",title:t(Ns.reply),handler:(e,t)=>this.replyToMessage(e,t)},menu_item_forward:{id:"menu_item_forward",title:t(Ns.forward),handler:e=>{}},menu_item_edit:{id:"menu_item_edit",title:t(Ns.edit),handler:(e,t)=>this.editMessage(e,t)},menu_item_pin:{id:"menu_item_pin",title:t(Ns.pin_message),handler:(e,t)=>this.pinMessage(!0,e,t)},menu_item_unpin:{id:"menu_item_unpin",title:t(Ns.unpin_message),handler:(e,t)=>this.pinMessage(!1,e,t)},topic_unmute:{id:"topic_unmute",title:t(Ns.unmute),handler:this.topicPermissionSetter.bind(this,"+P")},topic_mute:{id:"topic_mute",title:t(Ns.mute),handler:this.topicPermissionSetter.bind(this,"-P")},topic_unblock:{id:"topic_unblock",title:t(Ns.unblock),handler:this.topicPermissionSetter.bind(this,"+JP")},topic_block:{id:"topic_block",title:t(Ns.block),handler:(s,a)=>e.onShowAlert(s.topicTitle||t(Ns.block),t(Ns.topic_block_warning),e=>this.topicPermissionSetter("-JP",s,a).then(e=>(this.props.onTopicRemoved(s.topicName),e)),null,!0,null)},topic_delete:{id:"topic_delete",title:t(Ns.topic_delete),handler:(s,a)=>e.onShowAlert(s.topicTitle||t(Ns.topic_delete),t(Ns.topic_delete_warning),e=>{const t=this.props.tinode.getTopic(s.topicName);if(t)return t.delTopic(!0).catch(e=>{a&&a(e.message,"err")});console.warn("Topic not found: ",s.topicName)},null,!0,null)},topic_archive:{id:"topic_archive",title:t(Ns.archive),handler:(e,t)=>{const s=this.props.tinode.getTopic(e.topicName);if(s)return s.archive(!0).catch(e=>{t&&t(e.message,"err")});console.warn("Topic not found: ",e.topicName)}},topic_restore:{id:"topic_restore",title:t(Ns.unarchive),handler:(e,t)=>{const s=this.props.tinode.getTopic(e.topicName);if(s)return s.archive(!1).catch(e=>{t&&t(e.message,"err")});console.warn("Topic not found: ",e.topicName)}},topic_pin:{id:"topic_pin",title:t(Ns.pin_chat),handler:(e,t)=>{const s=this.props.tinode.getMeTopic();if(s)return s.pinTopic(e.topicName,!0).catch(e=>{t&&t(e.message,"err")});console.warn("'me' topic not found")}},topic_unpin:{id:"topic_unpin",title:t(Ns.unpin_chat),handler:(e,t)=>{const s=this.props.tinode.getMeTopic();if(s)return s.pinTopic(e.topicName,!1).catch(e=>{t&&t(e.message,"err")});console.warn("'me' topic not found")}},permissions:{id:"permissions",title:t(Ns.edit_permissions),handler:null},member_delete:{id:"member_delete",title:t(Ns.member_delete),handler:(e,t)=>{const s=this.props.tinode.getTopic(e.topicName);if(s&&e.user)return s.delSubscription(e.user).catch(e=>{t&&t(e.message,"err")});console.warn("Topic or user not found: '"+e.topicName+"', '"+e.user+"'")}},member_mute:{id:"member_mute",title:t(Ns.mute),handler:this.topicPermissionSetter.bind(this,"-P")},member_unmute:{id:"member_unmute",title:t(Ns.unmute),handler:this.topicPermissionSetter.bind(this,"+P")},member_block:{id:"member_block",title:t(Ns.block),handler:this.topicPermissionSetter.bind(this,"-JP")},member_unblock:{id:"member_unblock",title:t(Ns.unblock),handler:this.topicPermissionSetter.bind(this,"+JP")}}}componentDidMount(){document.addEventListener("mousedown",this.handlePageClick,!1),document.addEventListener("keyup",this.handleEscapeKey,!1)}componentWillUnmount(){document.removeEventListener("mousedown",this.handlePageClick,!1),document.removeEventListener("keyup",this.handleEscapeKey,!1)}handlePageClick(e){this.selfRef.current.contains(e.target)||(e.preventDefault(),e.stopPropagation(),this.props.hide())}handleEscapeKey(e){27===e.keyCode&&this.props.hide()}handleClick(e){e.preventDefault(),e.stopPropagation(),this.props.hide();let t=this.props.items[e.currentTarget.dataset.id];"string"==typeof t&&(t=this.MenuItems[t]),t?this.props.onAction(t.id,t.handler(this.props.params,this.props.onError),this.props.params):console.error("Invalid menu item ID",e.currentTarget.dataset.id)}deleteMessages(e,t,s,a){const i=this.props.tinode.getTopic(s.topicName);if(!i)return void console.warn("Topic not found: ",s.topicName);if(!e&&i.cancelSend(s.seq))return;return(e?i.delMessagesAll(t):s.replace>0?i.delMessagesEdits(s.replace,t):i.delMessagesList([s.seq],t)).catch(e=>{a&&a(e.message,"err")})}retryMessage(e,t){const s=this.props.tinode.getTopic(e.topicName);if(!s||!s.flushMessage(e.seq))return;const a=s.createMessage(e.content,!1);return s.publishDraft(a).catch(e=>{t&&t(e.message,"err")})}pinMessage(e,t,s){const a=this.props.tinode.getTopic(t.topicName);a&&a.pinMessage(t.seq,e).catch(e=>s?s(e.message,"err"):null)}topicPermissionSetter(e,t,s){const a=this.props.tinode.getTopic(t.topicName);if(!a)return void console.warn("Topic not found",t.topicName);let i=a.updateMode(t.user,e);return s&&(i=i.catch(e=>s(e.message,"err"))),i}replyToMessage(e,t){e.pickReply(e.seq,e.content,e.userFrom,e.userName,t)}editMessage(e,t){e.editMessage(e.replace||e.seq,e.content,t)}render(){const e=[];let t=0;this.props.items.forEach(s=>{if("string"==typeof s&&(s=this.MenuItems[s]),s&&s.title){const a=s.disabled?"disabled":void 0;e.push("-"==s.title?l().createElement("li",{className:"separator",key:t}):l().createElement("li",{className:a,onClick:this.handleClick,"data-id":t,key:t},s.title))}t++});const s=12*ks.JS,a=ks.JS*(.7+2.5*e.length),i={left:(this.props.bounds.right-this.props.clickAt.x<s?this.props.clickAt.x-this.props.bounds.left-s:this.props.clickAt.x-this.props.bounds.left)+"px",top:(this.props.bounds.bottom-this.props.clickAt.y<a?this.props.clickAt.y-this.props.bounds.top-a:this.props.clickAt.y-this.props.bounds.top)+"px"};return l().createElement("ul",{className:"menu",style:i,ref:this.selfRef},e)}}var Is=(0,h.injectIntl)(Ds),Ps=r(4152);class Fs extends l().PureComponent{constructor(e){super(e),this.state={edited:!1,search:""},this.handleSearchChange=this.handleSearchChange.bind(this),this.handleSearch=this.handleSearch.bind(this),this.handleClear=this.handleClear.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentWillUnmount(){this.state.edited&&(this.setState({search:"",edited:!1}),this.props.onSearchContacts(Ts.Tinode.DEL_CHAR))}handleSearchChange(e){this.setState({search:e.target.value})}handleSearch(e){e.preventDefault();const t=this.state.search.trim();this.setState({edited:t.length>0}),this.props.onSearchContacts(t.length>0?t:Ts.Tinode.DEL_CHAR)}handleClear(e){e.preventDefault(),this.state.edited&&this.props.onSearchContacts(Ts.Tinode.DEL_CHAR),this.setState({search:"",edited:!1})}handleKeyDown(e){"Enter"===e.key?this.handleSearch(e):"Escape"===e.key&&this.handleClear()}render(){return l().createElement("div",{className:"panel-form"},l().createElement("div",{className:"panel-form-row"},l().createElement("i",{className:"material-icons search"},"search"),l().createElement("input",{className:"search",type:"text",placeholder:this.props.placeholder,value:this.state.search,onChange:this.handleSearchChange,onKeyDown:this.handleKeyDown,required:!0,autoFocus:!0}),this.state.search?l().createElement("a",{href:"#",onClick:this.handleClear},l().createElement("i",{className:"material-icons"},"highlight_off")):l().createElement("span",null,l().createElement("i",{className:"material-icons"}," "))))}}class Rs extends l().Component{constructor(e){super(e),this.state={query:null},this.handleEscapeKey=this.handleEscapeKey.bind(this),this.handleClose=this.handleClose.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleContactSelected=this.handleContactSelected.bind(this)}componentDidMount(){this.props.onInitFind()}handleEscapeKey(e){27===e.keyCode&&this.props.hide(!1)}handleClose(e){e.preventDefault(),this.props.hide(!1)}handleSearchContacts(e){this.setState({query:Ts.Tinode.isNullValue(e)?null:e}),this.props.onSearchContacts(e)}handleContactSelected(e){this.props.onTopicSelected(e),this.props.hide(!0)}render(){let e=null!=this.state.query?this.props.searchResults:this.props.contacts;return e=e.filter(e=>e.name!=this.props.topicSelected&&e.acs.isJoiner()&&e.acs.isWriter()),l().createElement("div",{className:"alert-container"},l().createElement("div",{className:"forward-dialog"},l().createElement("div",{className:"title with-control"},l().createElement("div",null,l().createElement(h.FormattedMessage,{id:"forward_to",defaultMessage:[{type:0,value:"Forward to"}],desription:"Title of the contact selector dialog when forwarding a message"})),l().createElement("div",null,l().createElement("a",{href:"#",onClick:this.handleClose},l().createElement("i",{className:"material-icons"},"close")))),l().createElement(h.FormattedMessage,{id:"forward_to_search_placeholder",defaultMessage:[{type:0,value:"Search contacts"}]},e=>l().createElement(Fs,{placeholder:e,onSearchContacts:this.handleSearchContacts})),l().createElement(h.FormattedMessage,{id:"search_no_results",defaultMessage:[{type:0,value:"Search returned no results"}]},t=>l().createElement(Ps.A,{tinode:this.props.tinode,contacts:e,myUserId:this.props.myUserId,emptyListMessage:t,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleContactSelected}))))}}var xs=r(635),Us=r(6904);const Ls="started";var Os=r(6110),js=r(8589);const Bs=new Audio("audio/call-in.m4a");class qs extends l().Component{constructor(e){super(e),this.state={topic:null,fullName:void 0,avatar:null,trustedBadges:[],previousMetaDesc:void 0},this.resetDesc=this.resetDesc.bind(this),this.onMetaDesc=this.onMetaDesc.bind(this),this.handleRejectCall=this.handleRejectCall.bind(this),this.handleAcceptCall=this.handleAcceptCall.bind(this),this.ringTimer=null}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);e&&(this.resetDesc(e),2==this.props.callState&&(Bs.play().catch(e=>{}),this.ringTimer=setInterval(e=>{Bs.play().catch(e=>{})},2e3),this.props.onRinging(this.props.topic,this.props.seq)))}componentDidUpdate(e){const t=this.props.tinode.getTopic(e.topic);t&&(this.onMetaDesc!=t.onMetaDesc&&(this.previousMetaDesc=t.onMetaDesc,t.onMetaDesc=this.onMetaDesc),this.state.topic!=e.topic&&(this.setState({topic:e.topic}),this.resetDesc(t,e)))}componentWillUnmount(){null!=this.ringTimer&&(clearInterval(this.ringTimer),Bs.pause());const e=this.props.tinode.getTopic(this.props.topic);e&&(this.setState({topic:null}),e.onMetaDesc=this.previousMetaDesc)}resetDesc(e){const t=[];if(e.trusted)for(const[s,a]of Object.entries(e.trusted))a&&t.push(s);this.setState({fullName:(0,js.W5)(e.public?e.public.fn:void 0,ks.tS),avatar:(0,Os.to)(e.public?e.public.photo:null),trustedBadges:t})}onMetaDesc(e){const t=this.props.tinode.getTopic(this.props.topic);t&&(this.resetDesc(t),this.previousMetaDesc&&this.previousMetaDesc!=this.onMetaDesc&&this.previousMetaDesc(e))}handleAcceptCall(){this.props.onAcceptCall(this.props.topic)}handleRejectCall(){this.props.onReject(this.props.topic,this.props.seq),this.props.onClose()}render(){return l().createElement("div",{className:"alert-container"},l().createElement("div",{className:"incoming-call"},l().createElement("div",{className:"caller-card incoming pulse"},l().createElement("div",{className:"avatar-box"},l().createElement(Us.A,{tinode:this.props.tinode,avatar:this.state.avatar||!0,topic:this.props.topic,title:this.state.fullName})),l().createElement("div",{className:"caller-name"},(0,js.W5)(this.state.fullName,ks.mu),l().createElement(xs.A,{short:!0,trustedBadges:this.state.trustedBadges}))),l().createElement("div",{id:"controls"},2==this.props.callState?l().createElement(l().Fragment,null,l().createElement("button",{className:"danger",onClick:this.handleRejectCall},l().createElement("i",{className:"material-icons"},"call_end")),l().createElement("button",{className:"positive",onClick:this.handleAcceptCall},l().createElement("i",{className:"material-icons"},"call"))):null)))}}const zs=new Audio("audio/call-out.m4a");zs.loop=!0;const Vs=new Audio("audio/call-end.m4a");Vs.loop=!0;const Hs=new Audio("audio/dialing.m4a"),Ws="video:muted",Ks="video:unmuted",$s=(0,h.defineMessages)({already_in_call:{id:"already_in_call",defaultMessage:[{type:0,value:"You already in an ongoing call!"}]}});class Gs extends l().PureComponent{constructor(e){super(e),this.state={localStream:void 0,remoteStream:void 0,pc:void 0,dataChannel:void 0,previousOnInfo:void 0,waitingForPeer:!1,callInitialSetupComplete:!1,audioOnly:e.callAudioOnly,videoToggleInProgress:!1,remoteVideoLive:!1},this.localStreamConstraints={audio:!0,video:!e.callAudioOnly},this.isOutgoingCall=1==e.callState,this.containerRef=l().createRef(),this.localRef=l().createRef(),this.remoteRef=l().createRef(),this.remoteIceCandidatesCache=[],this.onInfo=this.onInfo.bind(this),this.start=this.start.bind(this),this.stop=this.stop.bind(this),this.createPeerConnection=this.createPeerConnection.bind(this),this.canSendOffer=this.canSendOffer.bind(this),this.drainRemoteIceCandidatesCache=this.drainRemoteIceCandidatesCache.bind(this),this.handleNegotiationNeededEvent=this.handleNegotiationNeededEvent.bind(this),this.handleICECandidateEvent=this.handleICECandidateEvent.bind(this),this.handleNewICECandidateMsg=this.handleNewICECandidateMsg.bind(this),this.handleICEConnectionStateChangeEvent=this.handleICEConnectionStateChangeEvent.bind(this),this.handleSignalingStateChangeEvent=this.handleSignalingStateChangeEvent.bind(this),this.handleICEGatheringStateChangeEvent=this.handleICEGatheringStateChangeEvent.bind(this),this.handleIceCandidateErrorEvent=this.handleIceCandidateErrorEvent.bind(this),this.handleTrackEvent=this.handleTrackEvent.bind(this),this.handleVideoOfferMsg=this.handleVideoOfferMsg.bind(this),this.handleVideoAnswerMsg=this.handleVideoAnswerMsg.bind(this),this.handleNewICECandidateMsg=this.handleNewICECandidateMsg.bind(this),this.reportError=this.reportError.bind(this),this.handleGetUserMediaError=this.handleGetUserMediaError.bind(this),this.stopTracks=this.stopTracks.bind(this),this.disconnectMedia=this.disconnectMedia.bind(this),this.handleCloseClick=this.handleCloseClick.bind(this),this.handleToggleCameraClick=this.handleToggleCameraClick.bind(this),this.handleToggleMicClick=this.handleToggleMicClick.bind(this),this.handleRemoteHangup=this.handleRemoteHangup.bind(this),this.handleVideoCallAccepted=this.handleVideoCallAccepted.bind(this),this.muteVideo=this.muteVideo.bind(this),this.unmuteVideo=this.unmuteVideo.bind(this),this.emptyVideoTrack=this.emptyVideoTrack.bind(this),this.handleDataChannelEvent=this.handleDataChannelEvent.bind(this),this.handleDataChannelError=this.handleDataChannelError.bind(this),this.handleDataChannelMessage=this.handleDataChannelMessage.bind(this),this.handleDataChannelOpen=this.handleDataChannelOpen.bind(this),this.handleDataChannelClose=this.handleDataChannelClose.bind(this),this.bounds={},this.dragStart=e=>{if(e.target.classList.contains("draggable")&&!window.matchMedia("(width<=640px)")&&this.props.minimized&&this.containerRef){e.stopPropagation(),this.containerRef.current.setPointerCapture(e.pointerId),this.containerRef.current.style.cursor="grabbing",this.bounds.left=this.containerRef.current.offsetLeft,this.bounds.top=this.containerRef.current.offsetTop,this.bounds.width=this.containerRef.current.offsetWidth,this.bounds.height=this.containerRef.current.offsetHeight;const t=this.containerRef.current.offsetParent;this.bounds.maxX=t.offsetWidth,this.bounds.maxY=t.offsetHeight}},this.drag=e=>{e.stopPropagation();const t=this.containerRef.current;this.props.minimized&&this.containerRef&&t.hasPointerCapture(e.pointerId)&&(this.bounds.left=Math.min(Math.max(this.bounds.left+e.movementX,0),this.bounds.maxX-this.bounds.width),this.bounds.top=Math.min(Math.max(this.bounds.top+e.movementY,0),this.bounds.maxY-this.bounds.height),t.style.left=`${this.bounds.left}px`,t.style.top=`${this.bounds.top}px`)},this.dragEnd=e=>{e.stopPropagation(),this.props.minimized&&this.containerRef&&(this.containerRef.current.releasePointerCapture(e.pointerId),this.containerRef.current.style.cursor="grab")}}componentDidMount(){const e=this.props.tinode.getTopic(this.props.topic);this.previousOnInfo=e.onInfo,e.onInfo=this.onInfo,1!=this.props.callState&&3!=this.props.callState||!this.localRef.current||this.start(),this.containerRef&&(this.containerRef.current.addEventListener("pointerdown",this.dragStart),this.containerRef.current.addEventListener("pointermove",this.drag),this.containerRef.current.addEventListener("pointerup",this.dragEnd))}componentWillUnmount(){this.props.tinode.getTopic(this.props.topic).onInfo=this.previousOnInfo,this.stop(),this.containerRef&&(this.containerRef.current.removeEventListener("pointerdown",this.dragStart),this.containerRef.current.removeEventListener("pointermove",this.drag),this.containerRef.current.removeEventListener("pointerup",this.dragEnd))}handleVideoCallAccepted(e){zs.pause();const t=this.createPeerConnection(!0),s=this.state.localStream;s.getTracks().forEach(e=>{t.addTrack(e,s),"video"==e.kind&&this.state.audioOnly&&(e.enabled=!1,e.stop(),s.removeTrack(e))})}onInfo(e){if("call"==e.what)switch(e.event){case"accept":this.handleVideoCallAccepted(e);break;case"answer":this.handleVideoAnswerMsg(e);break;case"ice-candidate":this.handleNewICECandidateMsg(e);break;case"hang-up":this.handleRemoteHangup(e);break;case"offer":this.handleVideoOfferMsg(e);break;case"ringing":zs.play().catch(e=>{});break;default:console.warn("Unknown call event",e.event)}}emptyVideoTrack(){const e=Object.assign(document.createElement("canvas"),{width:640,height:480});e.getContext("2d").fillRect(0,0,640,480);const t=e.captureStream(0);return Object.assign(t.getVideoTracks()[0],{enabled:!1})}start(){this.state.localStream?this.props.onError(this.props.intl.formatMessage($s.already_in_call),"info"):3!=this.props.callState?navigator.mediaDevices.getUserMedia(this.localStreamConstraints).then(e=>{this.localStreamConstraints.video||e.addTrack(this.emptyVideoTrack()),this.setState({localStream:e,waitingForPeer:!0}),this.localRef.current.srcObject=e,Hs.play(),this.props.onInvite(this.props.topic,this.props.seq,this.props.callState,this.props.callAudioOnly)}).catch(this.handleGetUserMediaError):this.props.onInvite(this.props.topic,this.props.seq,3,this.props.callAudioOnly)}stop(){Vs.pause(),Vs.currentTime=0,zs.pause(),zs.currentTime=0,this.stopTracks(this.state.localStream),this.stopTracks(this.state.remoteStream),this.disconnectMedia(this.localRef.current),this.disconnectMedia(this.remoteRef.current),this.state.pc&&(this.state.pc.ontrack=null,this.state.pc.onremovetrack=null,this.state.pc.onremovestream=null,this.state.pc.onicecandidate=null,this.state.pc.oniceconnectionstatechange=null,this.state.pc.onsignalingstatechange=null,this.state.pc.onicegatheringstatechange=null,this.state.pc.onnegotiationneeded=null,this.state.pc.onicecandidateerror=null,this.state.pc.ondatachannel=null,!this.state.dataChannel||"open"!=this.state.dataChannel.readyState&&"connecting"!=this.state.dataChannel.readyState||this.state.dataChannel.close(),this.state.pc.close()),this.setState({pc:null,waitingForPeer:!1})}disconnectMedia(e){e&&(e.srcObject=null,e.src="")}stopTracks(e){if(!e)return;let t=e.getTracks();t&&t.forEach(e=>{e.stop(),e.enabled=!1})}handleDataChannelError(e){console.error("data channel error",e)}handleDataChannelMessage(e){switch(e.data){case Ws:this.setState({remoteVideoLive:!1},e=>{this.remoteRef.current.srcObject=this.state.remoteStream});break;case Ks:this.setState({remoteVideoLive:!0},e=>{this.remoteRef.current.srcObject=this.state.remoteStream})}}handleDataChannelOpen(e){this.state.audioOnly||e.target.send(Ks)}handleDataChannelClose(e){console.log("close data channel:",e)}handleDataChannelEvent(e){console.log("data channel event:",e);const t=e.channel;t.onerror=this.handleDataChannelError,t.onmessage=this.handleDataChannelMessage,t.onopen=this.handleDataChannelOpen,t.onclose=this.handleDataChannelClose,this.setState({dataChannel:t})}createPeerConnection(e){const t=this.props.tinode.getServerParam("iceServers",null),s=t?new RTCPeerConnection({iceServers:t}):new RTCPeerConnection;s.onicecandidate=this.handleICECandidateEvent,s.oniceconnectionstatechange=this.handleICEConnectionStateChangeEvent,s.onicegatheringstatechange=this.handleICEGatheringStateChangeEvent,s.onsignalingstatechange=this.handleSignalingStateChangeEvent,s.onnegotiationneeded=this.handleNegotiationNeededEvent,s.onicecandidateerror=this.handleIceCandidateErrorEvent,s.ontrack=this.handleTrackEvent,s.ondatachannel=this.handleDataChannelEvent;let a={pc:s,waitingForPeer:!1};if(e){const e=s.createDataChannel("events",{ordered:!0});e.onerror=this.handleDataChannelError,e.onmessage=this.handleDataChannelMessage,e.onopen=this.handleDataChannelOpen,e.onclose=this.handleDataChannelClose,a.dataChannel=e}return this.setState(a),s}handleVideoAnswerMsg(e){const t=new RTCSessionDescription(e.payload);this.state.pc.setRemoteDescription(t).then(e=>{this.setState({callInitialSetupComplete:!0},e=>this.drainRemoteIceCandidatesCache())}).catch(e=>this.reportError(e))}reportError(e){this.props.onError(e.message,"err")}canSendOffer(){return this.isOutgoingCall||this.state.callInitialSetupComplete}handleNegotiationNeededEvent(e){const t=e.target;this.canSendOffer()&&t.createOffer().then(e=>t.setLocalDescription(e)).then(e=>{this.props.onSendOffer(this.props.topic,this.props.seq,t.localDescription.toJSON())}).catch(e=>this.reportError(e))}handleIceCandidateErrorEvent(e){console.warn("ICE candidate error:",e)}handleICECandidateEvent(e){e.candidate&&this.props.onIceCandidate(this.props.topic,this.props.seq,e.candidate.toJSON())}handleNewICECandidateMsg(e){const t=new RTCIceCandidate(e.payload);this.state.callInitialSetupComplete?this.state.pc.addIceCandidate(t).catch(e=>{t.candidate&&this.reportError(e),console.warn("Error adding new ice candidate",t,e)}):this.remoteIceCandidatesCache.push(t)}drainRemoteIceCandidatesCache(){this.remoteIceCandidatesCache.forEach(e=>{this.state.pc.addIceCandidate(e).catch(t=>{e.candidate&&this.reportError(t),console.warn("Error adding cached ice candidate",e,t)})}),this.remoteIceCandidatesCache=[]}handleICEConnectionStateChangeEvent(e){switch(e.target.iceConnectionState){case"closed":case"failed":this.handleCloseClick()}}handleSignalingStateChangeEvent(e){"closed"==e.target.signalingState&&this.handleCloseClick()}handleICEGatheringStateChangeEvent(e){}handleTrackEvent(e){this.remoteRef.current.srcObject=e.streams[0],this.setState({remoteStream:e.streams[0]})}handleGetUserMediaError(e){switch(console.error("Error opening camera and/or microphone",e),e.name){case"NotFoundError":default:this.reportError(e);case"SecurityError":case"PermissionDeniedError":}this.handleCloseClick()}handleVideoOfferMsg(e){let t=null;const s=this.state.pc?this.state.pc:this.createPeerConnection(!1),a=new RTCSessionDescription(e.payload);s.setRemoteDescription(a).then(e=>navigator.mediaDevices.getUserMedia(this.localStreamConstraints)).then(e=>{let a;this.localStreamConstraints.video||(a=this.emptyVideoTrack(),e.addTrack(a)),t=e,this.localRef.current.srcObject=e,this.setState({localStream:e}),t.getTracks().forEach(e=>{s.addTrack(e,t)}),a&&(a.enabled=!1,a.stop(),e.removeTrack(a))}).then(e=>s.createAnswer()).then(e=>s.setLocalDescription(e)).then(e=>{this.props.onSendAnswer(this.props.topic,this.props.seq,s.localDescription.toJSON()),this.setState({callInitialSetupComplete:!0},e=>this.drainRemoteIceCandidatesCache())}).catch(this.handleGetUserMediaError)}handleRemoteHangup(){this.state.waitingForPeer?(this.setState({waitingForPeer:!1}),zs.pause(),zs.currentTime=0,Vs.loop=!0,Vs.play().catch(e=>{}),setTimeout(e=>{this.handleCloseClick()},2e3)):this.handleCloseClick()}handleCloseClick(){this.stop(),this.props.onHangup(this.props.topic,this.props.seq)}muteVideo(){if(!this.state.pc||!this.state.dataChannel)return;const e=this.state.localStream,t=e.getVideoTracks()[0];t.enabled=!1,t.stop(),e.removeTrack(t),this.state.dataChannel.send(Ws),this.setState({videoToggleInProgress:!1})}unmuteVideo(){this.state.pc&&this.state.dataChannel&&navigator.mediaDevices.getUserMedia({video:!0}).then(e=>{this.localRef.current.srcObject=null;const t=this.state.pc.getSenders().find(e=>"video"==e.track.kind),s=e.getVideoTracks()[0];return e.removeTrack(s),this.state.localStream.addTrack(s),t.replaceTrack(s)}).then(e=>{this.localRef.current.srcObject=this.state.localStream,this.state.dataChannel.send(Ks)}).catch(e=>this.handleGetUserMediaError(e)).finally(e=>{this.setState({videoToggleInProgress:!1})})}handleToggleCameraClick(){if(this.state.videoToggleInProgress)return;const e=this.state.localStream.getVideoTracks();this.setState({videoToggleInProgress:!0},t=>{e&&e.length>0&&e[0].enabled&&"live"==e[0].readyState?this.muteVideo():this.unmuteVideo(),this.setState({audioOnly:!this.state.audioOnly})})}handleToggleMicClick(){const e=this.state.localStream.getAudioTracks()[0];e.enabled=!e.enabled,this.forceUpdate()}render(){const e=this.state.localStream&&this.state.localStream.getAudioTracks(),t=!this.state.audioOnly&&this.state.localStream&&this.state.localStream.getVideoTracks(),s=!this.state.pc||!this.state.dataChannel||!(e&&e[0]),a=e&&e[0]&&e[0].enabled?"mic":"mic_off",i=t&&t[0]&&t[0].enabled&&"live"==t[0].readyState?"videocam":"videocam_off",n=(0,js.W5)(this.props.title,ks.mu),r=this.state.waitingForPeer?" pulse":"";let o=!1;if(this.remoteRef.current&&this.remoteRef.current.srcObject&&this.state.remoteVideoLive){const e=this.remoteRef.current.srcObject;if(e.getVideoTracks().length>0){const t=e.getVideoTracks()[0];o=t.enabled&&"live"==t.readyState}}const c=this.props.minimized?"minimized":null,d=this.props.minimized?"fullscreen":"fullscreen_exit";return l().createElement("div",{id:"video-container",className:c,ref:this.containerRef},l().createElement("div",{id:"video-container-panel"},l().createElement("div",{className:"call-party self",disabled:this.state.audioOnly||this.props.minimized},l().createElement("video",{ref:this.localRef,autoPlay:!0,muted:!0,playsInline:!0}),l().createElement("div",{className:"caller-name inactive"},l().createElement(h.FormattedMessage,{id:"calls_you_label",defaultMessage:[{type:0,value:"You"}]}))),l().createElement("div",{className:"call-party peer",disabled:!o},o?l().createElement(l().Fragment,null,l().createElement("video",{ref:this.remoteRef,autoPlay:!0,playsInline:!0}),l().createElement("div",{className:"caller-name inactive"},n)):l().createElement(l().Fragment,null,l().createElement("audio",{ref:this.remoteRef,autoPlay:!0}),l().createElement("div",{className:`caller-card${r} draggable`},l().createElement("div",{className:"avatar-box"},l().createElement(Us.A,{tinode:this.props.tinode,avatar:this.props.avatar,topic:this.props.topic,title:this.props.title})),l().createElement("div",{className:"caller-name"},n))))),l().createElement("button",{className:"full-screen",onClick:this.props.onToggleMinimize},l().createElement("i",{className:"material-icons"},d)),l().createElement("div",{id:"controls",className:c},l().createElement("button",{className:"danger",onClick:this.handleCloseClick},l().createElement("i",{className:"material-icons"},"call_end")),l().createElement("button",{className:"secondary",onClick:this.handleToggleCameraClick,disabled:s},l().createElement("i",{className:"material-icons"},i)),l().createElement("button",{className:"secondary",onClick:this.handleToggleMicClick,disabled:s},l().createElement("i",{className:"material-icons"},a))))}}var Qs=(0,h.injectIntl)(Gs),Ys=r(9895),Xs=r(3540);class Js extends l().Component{constructor(e){super(e),this.state={downloader:null,progress:0},this.downloadFile=this.downloadFile.bind(this),this.handleCancel=this.handleCancel.bind(this)}downloadFile(e,t,s){if(!e)return void this.props.onError("Invalid download URL '"+e+"'");const a=this.props.tinode.getLargeFileHelper();this.setState({downloader:a}),a.download(e,t,s,e=>this.setState({progress:e/this.props.size}),e=>this.props.onError(e,"err")).then(e=>this.setState({downloader:null,progress:0})).catch(e=>{e&&this.props.onError("Error downloading file: "+e.message,"err"),this.setState({downloader:null,progress:0})})}handleCancel(){this.props.uploading?this.props.onCancelUpload():this.state.downloader&&this.state.downloader.cancel()}render(){let e=this.props.filename||"file_attachment";e.length>36&&(e=e.substr(0,16)+"..."+e.substr(-16));let t,s,a=this.props.size>0?l().createElement("span",{className:"small gray"},"(",(0,js.lX)(this.props.size),")"):null;this.props.uploading||this.state.downloader||!(0,Xs.YO)(this.props.downloadUrl)?(t=(0,Xs.Jf)(this.props.downloadUrl),s=null):(t="#",s=e=>{e.preventDefault(),this.downloadFile(this.props.downloadUrl,this.props.filename,this.props.mimetype)});const i=l().createElement(l().Fragment,null,l().createElement("i",{className:"material-icons"},"file_download")," ",l().createElement(h.FormattedMessage,{id:"save_attachment",defaultMessage:[{type:0,value:"save"}]}));return l().createElement("div",{className:"attachment"},l().createElement("div",null,l().createElement("i",{className:"material-icons big gray"},"insert_drive_file")),l().createElement("div",{className:"flex-column"},l().createElement("div",null,e," ",a),this.props.uploading||this.state.downloader?l().createElement(Ys.A,{progress:this.props.uploading?this.props.progress:this.state.progress,onCancel:this.handleCancel}):l().createElement("div",null,t?l().createElement("a",{href:t,download:this.props.filename,onClick:s},i):l().createElement("span",{className:"light-gray"},i))))}}const Zs=(0,h.defineMessages)({message_sending:{id:"message_sending",defaultMessage:[{type:0,value:"sending..."}]},message_sending_failed:{id:"message_sending_failed",defaultMessage:[{type:0,value:"failed"}]},message_edited_marker:{id:"message_edited_marker",defaultMessage:[{type:0,value:", edited"}]}});class ea extends l().PureComponent{render(){const{formatMessage:e}=this.props.intl;let t;t=this.props.received<=Ts.Tinode.MESSAGE_STATUS_SENDING?e(Zs.message_sending):this.props.received==Ts.Tinode.MESSAGE_STATUS_FAILED||this.props.received==Ts.Tinode.MESSAGE_STATUS_FATAL?e(Zs.message_sending_failed):this.props.timestamp.toLocaleTimeString(this.props.intl.locale,{timeStyle:"short"});const s=(0,Xs.LO)(this.props.received),a=s?l().createElement("i",{className:"material-icons small "+s.color},s.name):null,i=this.props.edited?e(Zs.message_edited_marker):null;return l().createElement("span",{className:"timestamp"},t,i," ",a)}}var ta=(0,h.injectIntl)(ea),sa=r(8043);function aa(){return aa=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var s=arguments[t];for(var a in s)({}).hasOwnProperty.call(s,a)&&(e[a]=s[a])}return e},aa.apply(null,arguments)}class ia extends l().PureComponent{constructor(e){super(e),this.state={progress:0},e.uploader&&(e.uploader.onProgress=this.handleProgress.bind(this)),this.handleExpandImage=this.handleExpandImage.bind(this),this.handlePlayVideo=this.handlePlayVideo.bind(this),this.handleFormButtonClick=this.handleFormButtonClick.bind(this),this.handleContextClick=this.handleContextClick.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.formatterContext={formatMessage:e.intl.formatMessage.bind(e.intl),viewportWidth:e.viewportWidth,authorizeURL:e.tinode.authorizeURL.bind(e.tinode),onImagePreview:this.handleExpandImage,onVideoPreview:this.handlePlayVideo,onFormButtonClick:this.handleFormButtonClick,onQuoteClick:this.handleQuoteClick}}handleExpandImage(e){e.preventDefault(),this.props.onExpandMedia({url:e.target.src,filename:e.target.dataset.name,width:e.target.dataset.width,height:e.target.dataset.height,size:e.target.dataset.size,type:e.target.dataset.mime})}handlePlayVideo(e){e.preventDefault(),this.props.onExpandMedia({video:!0,url:e.target.dataset.src,preview:e.target.src,filename:e.target.dataset.name,width:e.target.dataset.width,height:e.target.dataset.height,duration:e.target.dataset.duration,size:e.target.dataset.size,type:e.target.dataset.mime})}handleFormButtonClick(e){e.preventDefault();const t={seq:this.props.seq,resp:{}};e.target.dataset.name&&(t.resp[e.target.dataset.name]=e.target.dataset.val?e.target.dataset.val:void 0===e.target.dataset.val?1:""+e.target.dataset.val),"url"==e.target.dataset.act&&(t.ref=(0,Xs.Jf)(e.target.dataset.ref)||"about:blank");const s=e.target.dataset.title||"unknown";this.props.onFormResponse(e.target.dataset.act,s,t)}handleContextClick(e){e.preventDefault(),e.stopPropagation();const t=[];if(this.props.received==Ts.Tinode.MESSAGE_STATUS_FAILED&&t.push("menu_item_send_retry"),this.props.received>Ts.Tinode.MESSAGE_STATUS_FATAL){if(this.props.userIsWriter&&(t.push("menu_item_reply"),!this.props.response)){let e=!1;Ts.Drafty.entities(this.props.content,(t,s,a)=>(e=["AU","EX","FM","IM","VC","VD"].includes(a),e)),e||Ts.Drafty.styles(this.props.content,t=>(e=["QQ"].includes(t),e)),e||t.push("menu_item_edit")}this.props.userIsAdmin&&t.push(this.props.pinned?"menu_item_unpin":"menu_item_pin")}t.push("menu_item_forward"),this.props.showContextMenu({seq:this.props.seq,replace:this.props.edited?parseInt(this.props.edited.split(":")[1]):0,content:this.props.content,userFrom:this.props.userFrom,userName:this.props.userName,y:e.pageY,x:e.pageX,pickReply:this.props.pickReply,editMessage:this.props.editMessage,timestamp:this.props.timestamp},t)}handleProgress(e){this.setState({progress:e})}handleCancelUpload(){this.props.onCancelUpload(this.props.seq,this.props.uploader)}handleQuoteClick(e){e.preventDefault(),e.stopPropagation();const t=this.props.replyToSeq;t&&this.props.onQuoteClick(t)}render(){const e=this.props.sequence+" "+(this.props.response?"left":"right"),t="single"==this.props.sequence||"last"==this.props.sequence?"bubble tip":"bubble",s=this.props.userAvatar||!0;let a="message-content";const i=this.props.isGroup&&this.props.response&&("single"==this.props.sequence||"last"==this.props.sequence);let n=this.props.content;const r=[];if(this.props.mimeType==Ts.Drafty.getContentType()&&Ts.Drafty.isValid(n)){Ts.Drafty.attachments(n,(e,t)=>{Ts.Drafty.isFormResponseType(e.mime)||r.push(l().createElement(Js,{tinode:this.props.tinode,downloadUrl:Ts.Drafty.getDownloadUrl(e),filename:e.name,uploading:Ts.Drafty.isProcessing(e),mimetype:e.mime,size:Ts.Drafty.getEntitySize(e),progress:this.state.progress,onCancelUpload:this.handleCancelUpload,onError:this.props.onError,key:t}))},this);const e=Ts.Drafty.format(n,sa.e3,this.formatterContext);n=l().createElement(l().Fragment,null,e)}else"string"==typeof n?new RegExp("^\\p{RGI_Emoji}{1,5}$","v").test(n||"")&&(a+=" emoji-"+(n||"").match(/(?:👨🏻‍❤️‍💋‍👨🏻|👨🏻‍❤️‍💋‍👨🏼|👨🏻‍❤️‍💋‍👨🏽|👨🏻‍❤️‍💋‍👨🏾|👨🏻‍❤️‍💋‍👨🏿|👨🏼‍❤️‍💋‍👨🏻|👨🏼‍❤️‍💋‍👨🏼|👨🏼‍❤️‍💋‍👨🏽|👨🏼‍❤️‍💋‍👨🏾|👨🏼‍❤️‍💋‍👨🏿|👨🏽‍❤️‍💋‍👨🏻|👨🏽‍❤️‍💋‍👨🏼|👨🏽‍❤️‍💋‍👨🏽|👨🏽‍❤️‍💋‍👨🏾|👨🏽‍❤️‍💋‍👨🏿|👨🏾‍❤️‍💋‍👨🏻|👨🏾‍❤️‍💋‍👨🏼|👨🏾‍❤️‍💋‍👨🏽|👨🏾‍❤️‍💋‍👨🏾|👨🏾‍❤️‍💋‍👨🏿|👨🏿‍❤️‍💋‍👨🏻|👨🏿‍❤️‍💋‍👨🏼|👨🏿‍❤️‍💋‍👨🏽|👨🏿‍❤️‍💋‍👨🏾|👨🏿‍❤️‍💋‍👨🏿|👩🏻‍❤️‍💋‍👨🏻|👩🏻‍❤️‍💋‍👨🏼|👩🏻‍❤️‍💋‍👨🏽|👩🏻‍❤️‍💋‍👨🏾|👩🏻‍❤️‍💋‍👨🏿|👩🏻‍❤️‍💋‍👩🏻|👩🏻‍❤️‍💋‍👩🏼|👩🏻‍❤️‍💋‍👩🏽|👩🏻‍❤️‍💋‍👩🏾|👩🏻‍❤️‍💋‍👩🏿|👩🏼‍❤️‍💋‍👨🏻|👩🏼‍❤️‍💋‍👨🏼|👩🏼‍❤️‍💋‍👨🏽|👩🏼‍❤️‍💋‍👨🏾|👩🏼‍❤️‍💋‍👨🏿|👩🏼‍❤️‍💋‍👩🏻|👩🏼‍❤️‍💋‍👩🏼|👩🏼‍❤️‍💋‍👩🏽|👩🏼‍❤️‍💋‍👩🏾|👩🏼‍❤️‍💋‍👩🏿|👩🏽‍❤️‍💋‍👨🏻|👩🏽‍❤️‍💋‍👨🏼|👩🏽‍❤️‍💋‍👨🏽|👩🏽‍❤️‍💋‍👨🏾|👩🏽‍❤️‍💋‍👨🏿|👩🏽‍❤️‍💋‍👩🏻|👩🏽‍❤️‍💋‍👩🏼|👩🏽‍❤️‍💋‍👩🏽|👩🏽‍❤️‍💋‍👩🏾|👩🏽‍❤️‍💋‍👩🏿|👩🏾‍❤️‍💋‍👨🏻|👩🏾‍❤️‍💋‍👨🏼|👩🏾‍❤️‍💋‍👨🏽|👩🏾‍❤️‍💋‍👨🏾|👩🏾‍❤️‍💋‍👨🏿|👩🏾‍❤️‍💋‍👩🏻|👩🏾‍❤️‍💋‍👩🏼|👩🏾‍❤️‍💋‍👩🏽|👩🏾‍❤️‍💋‍👩🏾|👩🏾‍❤️‍💋‍👩🏿|👩🏿‍❤️‍💋‍👨🏻|👩🏿‍❤️‍💋‍👨🏼|👩🏿‍❤️‍💋‍👨🏽|👩🏿‍❤️‍💋‍👨🏾|👩🏿‍❤️‍💋‍👨🏿|👩🏿‍❤️‍💋‍👩🏻|👩🏿‍❤️‍💋‍👩🏼|👩🏿‍❤️‍💋‍👩🏽|👩🏿‍❤️‍💋‍👩🏾|👩🏿‍❤️‍💋‍👩🏿|🧑🏻‍❤️‍💋‍🧑🏼|🧑🏻‍❤️‍💋‍🧑🏽|🧑🏻‍❤️‍💋‍🧑🏾|🧑🏻‍❤️‍💋‍🧑🏿|🧑🏼‍❤️‍💋‍🧑🏻|🧑🏼‍❤️‍💋‍🧑🏽|🧑🏼‍❤️‍💋‍🧑🏾|🧑🏼‍❤️‍💋‍🧑🏿|🧑🏽‍❤️‍💋‍🧑🏻|🧑🏽‍❤️‍💋‍🧑🏼|🧑🏽‍❤️‍💋‍🧑🏾|🧑🏽‍❤️‍💋‍🧑🏿|🧑🏾‍❤️‍💋‍🧑🏻|🧑🏾‍❤️‍💋‍🧑🏼|🧑🏾‍❤️‍💋‍🧑🏽|🧑🏾‍❤️‍💋‍🧑🏿|🧑🏿‍❤️‍💋‍🧑🏻|🧑🏿‍❤️‍💋‍🧑🏼|🧑🏿‍❤️‍💋‍🧑🏽|🧑🏿‍❤️‍💋‍🧑🏾|🏴󠁧󠁢󠁥󠁮󠁧󠁿|🏴󠁧󠁢󠁳󠁣󠁴󠁿|🏴󠁧󠁢󠁷󠁬󠁳󠁿|👨🏻‍❤️‍👨🏻|👨🏻‍❤️‍👨🏼|👨🏻‍❤️‍👨🏽|👨🏻‍❤️‍👨🏾|👨🏻‍❤️‍👨🏿|👨🏻‍🐰‍👨🏼|👨🏻‍🐰‍👨🏽|👨🏻‍🐰‍👨🏾|👨🏻‍🐰‍👨🏿|👨🏻‍🤝‍👨🏼|👨🏻‍🤝‍👨🏽|👨🏻‍🤝‍👨🏾|👨🏻‍🤝‍👨🏿|👨🏻‍🫯‍👨🏼|👨🏻‍🫯‍👨🏽|👨🏻‍🫯‍👨🏾|👨🏻‍🫯‍👨🏿|👨🏼‍❤️‍👨🏻|👨🏼‍❤️‍👨🏼|👨🏼‍❤️‍👨🏽|👨🏼‍❤️‍👨🏾|👨🏼‍❤️‍👨🏿|👨🏼‍🐰‍👨🏻|👨🏼‍🐰‍👨🏽|👨🏼‍🐰‍👨🏾|👨🏼‍🐰‍👨🏿|👨🏼‍🤝‍👨🏻|👨🏼‍🤝‍👨🏽|👨🏼‍🤝‍👨🏾|👨🏼‍🤝‍👨🏿|👨🏼‍🫯‍👨🏻|👨🏼‍🫯‍👨🏽|👨🏼‍🫯‍👨🏾|👨🏼‍🫯‍👨🏿|👨🏽‍❤️‍👨🏻|👨🏽‍❤️‍👨🏼|👨🏽‍❤️‍👨🏽|👨🏽‍❤️‍👨🏾|👨🏽‍❤️‍👨🏿|👨🏽‍🐰‍👨🏻|👨🏽‍🐰‍👨🏼|👨🏽‍🐰‍👨🏾|👨🏽‍🐰‍👨🏿|👨🏽‍🤝‍👨🏻|👨🏽‍🤝‍👨🏼|👨🏽‍🤝‍👨🏾|👨🏽‍🤝‍👨🏿|👨🏽‍🫯‍👨🏻|👨🏽‍🫯‍👨🏼|👨🏽‍🫯‍👨🏾|👨🏽‍🫯‍👨🏿|👨🏾‍❤️‍👨🏻|👨🏾‍❤️‍👨🏼|👨🏾‍❤️‍👨🏽|👨🏾‍❤️‍👨🏾|👨🏾‍❤️‍👨🏿|👨🏾‍🐰‍👨🏻|👨🏾‍🐰‍👨🏼|👨🏾‍🐰‍👨🏽|👨🏾‍🐰‍👨🏿|👨🏾‍🤝‍👨🏻|👨🏾‍🤝‍👨🏼|👨🏾‍🤝‍👨🏽|👨🏾‍🤝‍👨🏿|👨🏾‍🫯‍👨🏻|👨🏾‍🫯‍👨🏼|👨🏾‍🫯‍👨🏽|👨🏾‍🫯‍👨🏿|👨🏿‍❤️‍👨🏻|👨🏿‍❤️‍👨🏼|👨🏿‍❤️‍👨🏽|👨🏿‍❤️‍👨🏾|👨🏿‍❤️‍👨🏿|👨🏿‍🐰‍👨🏻|👨🏿‍🐰‍👨🏼|👨🏿‍🐰‍👨🏽|👨🏿‍🐰‍👨🏾|👨🏿‍🤝‍👨🏻|👨🏿‍🤝‍👨🏼|👨🏿‍🤝‍👨🏽|👨🏿‍🤝‍👨🏾|👨🏿‍🫯‍👨🏻|👨🏿‍🫯‍👨🏼|👨🏿‍🫯‍👨🏽|👨🏿‍🫯‍👨🏾|👩🏻‍❤️‍👨🏻|👩🏻‍❤️‍👨🏼|👩🏻‍❤️‍👨🏽|👩🏻‍❤️‍👨🏾|👩🏻‍❤️‍👨🏿|👩🏻‍❤️‍👩🏻|👩🏻‍❤️‍👩🏼|👩🏻‍❤️‍👩🏽|👩🏻‍❤️‍👩🏾|👩🏻‍❤️‍👩🏿|👩🏻‍🐰‍👩🏼|👩🏻‍🐰‍👩🏽|👩🏻‍🐰‍👩🏾|👩🏻‍🐰‍👩🏿|👩🏻‍🤝‍👨🏼|👩🏻‍🤝‍👨🏽|👩🏻‍🤝‍👨🏾|👩🏻‍🤝‍👨🏿|👩🏻‍🤝‍👩🏼|👩🏻‍🤝‍👩🏽|👩🏻‍🤝‍👩🏾|👩🏻‍🤝‍👩🏿|👩🏻‍🫯‍👩🏼|👩🏻‍🫯‍👩🏽|👩🏻‍🫯‍👩🏾|👩🏻‍🫯‍👩🏿|👩🏼‍❤️‍👨🏻|👩🏼‍❤️‍👨🏼|👩🏼‍❤️‍👨🏽|👩🏼‍❤️‍👨🏾|👩🏼‍❤️‍👨🏿|👩🏼‍❤️‍👩🏻|👩🏼‍❤️‍👩🏼|👩🏼‍❤️‍👩🏽|👩🏼‍❤️‍👩🏾|👩🏼‍❤️‍👩🏿|👩🏼‍🐰‍👩🏻|👩🏼‍🐰‍👩🏽|👩🏼‍🐰‍👩🏾|👩🏼‍🐰‍👩🏿|👩🏼‍🤝‍👨🏻|👩🏼‍🤝‍👨🏽|👩🏼‍🤝‍👨🏾|👩🏼‍🤝‍👨🏿|👩🏼‍🤝‍👩🏻|👩🏼‍🤝‍👩🏽|👩🏼‍🤝‍👩🏾|👩🏼‍🤝‍👩🏿|👩🏼‍🫯‍👩🏻|👩🏼‍🫯‍👩🏽|👩🏼‍🫯‍👩🏾|👩🏼‍🫯‍👩🏿|👩🏽‍❤️‍👨🏻|👩🏽‍❤️‍👨🏼|👩🏽‍❤️‍👨🏽|👩🏽‍❤️‍👨🏾|👩🏽‍❤️‍👨🏿|👩🏽‍❤️‍👩🏻|👩🏽‍❤️‍👩🏼|👩🏽‍❤️‍👩🏽|👩🏽‍❤️‍👩🏾|👩🏽‍❤️‍👩🏿|👩🏽‍🐰‍👩🏻|👩🏽‍🐰‍👩🏼|👩🏽‍🐰‍👩🏾|👩🏽‍🐰‍👩🏿|👩🏽‍🤝‍👨🏻|👩🏽‍🤝‍👨🏼|👩🏽‍🤝‍👨🏾|👩🏽‍🤝‍👨🏿|👩🏽‍🤝‍👩🏻|👩🏽‍🤝‍👩🏼|👩🏽‍🤝‍👩🏾|👩🏽‍🤝‍👩🏿|👩🏽‍🫯‍👩🏻|👩🏽‍🫯‍👩🏼|👩🏽‍🫯‍👩🏾|👩🏽‍🫯‍👩🏿|👩🏾‍❤️‍👨🏻|👩🏾‍❤️‍👨🏼|👩🏾‍❤️‍👨🏽|👩🏾‍❤️‍👨🏾|👩🏾‍❤️‍👨🏿|👩🏾‍❤️‍👩🏻|👩🏾‍❤️‍👩🏼|👩🏾‍❤️‍👩🏽|👩🏾‍❤️‍👩🏾|👩🏾‍❤️‍👩🏿|👩🏾‍🐰‍👩🏻|👩🏾‍🐰‍👩🏼|👩🏾‍🐰‍👩🏽|👩🏾‍🐰‍👩🏿|👩🏾‍🤝‍👨🏻|👩🏾‍🤝‍👨🏼|👩🏾‍🤝‍👨🏽|👩🏾‍🤝‍👨🏿|👩🏾‍🤝‍👩🏻|👩🏾‍🤝‍👩🏼|👩🏾‍🤝‍👩🏽|👩🏾‍🤝‍👩🏿|👩🏾‍🫯‍👩🏻|👩🏾‍🫯‍👩🏼|👩🏾‍🫯‍👩🏽|👩🏾‍🫯‍👩🏿|👩🏿‍❤️‍👨🏻|👩🏿‍❤️‍👨🏼|👩🏿‍❤️‍👨🏽|👩🏿‍❤️‍👨🏾|👩🏿‍❤️‍👨🏿|👩🏿‍❤️‍👩🏻|👩🏿‍❤️‍👩🏼|👩🏿‍❤️‍👩🏽|👩🏿‍❤️‍👩🏾|👩🏿‍❤️‍👩🏿|👩🏿‍🐰‍👩🏻|👩🏿‍🐰‍👩🏼|👩🏿‍🐰‍👩🏽|👩🏿‍🐰‍👩🏾|👩🏿‍🤝‍👨🏻|👩🏿‍🤝‍👨🏼|👩🏿‍🤝‍👨🏽|👩🏿‍🤝‍👨🏾|👩🏿‍🤝‍👩🏻|👩🏿‍🤝‍👩🏼|👩🏿‍🤝‍👩🏽|👩🏿‍🤝‍👩🏾|👩🏿‍🫯‍👩🏻|👩🏿‍🫯‍👩🏼|👩🏿‍🫯‍👩🏽|👩🏿‍🫯‍👩🏾|🧑🏻‍❤️‍🧑🏼|🧑🏻‍❤️‍🧑🏽|🧑🏻‍❤️‍🧑🏾|🧑🏻‍❤️‍🧑🏿|🧑🏻‍🐰‍🧑🏼|🧑🏻‍🐰‍🧑🏽|🧑🏻‍🐰‍🧑🏾|🧑🏻‍🐰‍🧑🏿|🧑🏻‍🤝‍🧑🏻|🧑🏻‍🤝‍🧑🏼|🧑🏻‍🤝‍🧑🏽|🧑🏻‍🤝‍🧑🏾|🧑🏻‍🤝‍🧑🏿|🧑🏻‍🫯‍🧑🏼|🧑🏻‍🫯‍🧑🏽|🧑🏻‍🫯‍🧑🏾|🧑🏻‍🫯‍🧑🏿|🧑🏼‍❤️‍🧑🏻|🧑🏼‍❤️‍🧑🏽|🧑🏼‍❤️‍🧑🏾|🧑🏼‍❤️‍🧑🏿|🧑🏼‍🐰‍🧑🏻|🧑🏼‍🐰‍🧑🏽|🧑🏼‍🐰‍🧑🏾|🧑🏼‍🐰‍🧑🏿|🧑🏼‍🤝‍🧑🏻|🧑🏼‍🤝‍🧑🏼|🧑🏼‍🤝‍🧑🏽|🧑🏼‍🤝‍🧑🏾|🧑🏼‍🤝‍🧑🏿|🧑🏼‍🫯‍🧑🏻|🧑🏼‍🫯‍🧑🏽|🧑🏼‍🫯‍🧑🏾|🧑🏼‍🫯‍🧑🏿|🧑🏽‍❤️‍🧑🏻|🧑🏽‍❤️‍🧑🏼|🧑🏽‍❤️‍🧑🏾|🧑🏽‍❤️‍🧑🏿|🧑🏽‍🐰‍🧑🏻|🧑🏽‍🐰‍🧑🏼|🧑🏽‍🐰‍🧑🏾|🧑🏽‍🐰‍🧑🏿|🧑🏽‍🤝‍🧑🏻|🧑🏽‍🤝‍🧑🏼|🧑🏽‍🤝‍🧑🏽|🧑🏽‍🤝‍🧑🏾|🧑🏽‍🤝‍🧑🏿|🧑🏽‍🫯‍🧑🏻|🧑🏽‍🫯‍🧑🏼|🧑🏽‍🫯‍🧑🏾|🧑🏽‍🫯‍🧑🏿|🧑🏾‍❤️‍🧑🏻|🧑🏾‍❤️‍🧑🏼|🧑🏾‍❤️‍🧑🏽|🧑🏾‍❤️‍🧑🏿|🧑🏾‍🐰‍🧑🏻|🧑🏾‍🐰‍🧑🏼|🧑🏾‍🐰‍🧑🏽|🧑🏾‍🐰‍🧑🏿|🧑🏾‍🤝‍🧑🏻|🧑🏾‍🤝‍🧑🏼|🧑🏾‍🤝‍🧑🏽|🧑🏾‍🤝‍🧑🏾|🧑🏾‍🤝‍🧑🏿|🧑🏾‍🫯‍🧑🏻|🧑🏾‍🫯‍🧑🏼|🧑🏾‍🫯‍🧑🏽|🧑🏾‍🫯‍🧑🏿|🧑🏿‍❤️‍🧑🏻|🧑🏿‍❤️‍🧑🏼|🧑🏿‍❤️‍🧑🏽|🧑🏿‍❤️‍🧑🏾|🧑🏿‍🐰‍🧑🏻|🧑🏿‍🐰‍🧑🏼|🧑🏿‍🐰‍🧑🏽|🧑🏿‍🐰‍🧑🏾|🧑🏿‍🤝‍🧑🏻|🧑🏿‍🤝‍🧑🏼|🧑🏿‍🤝‍🧑🏽|🧑🏿‍🤝‍🧑🏾|🧑🏿‍🤝‍🧑🏿|🧑🏿‍🫯‍🧑🏻|🧑🏿‍🫯‍🧑🏼|🧑🏿‍🫯‍🧑🏽|🧑🏿‍🫯‍🧑🏾|👨‍❤️‍💋‍👨|👨‍👨‍👦‍👦|👨‍👨‍👧‍👦|👨‍👨‍👧‍👧|👨‍👩‍👦‍👦|👨‍👩‍👧‍👦|👨‍👩‍👧‍👧|👩‍❤️‍💋‍👨|👩‍❤️‍💋‍👩|👩‍👩‍👦‍👦|👩‍👩‍👧‍👦|👩‍👩‍👧‍👧|🧑‍🧑‍🧒‍🧒|🏃🏻‍♀️‍➡️|🏃🏻‍♂️‍➡️|🏃🏼‍♀️‍➡️|🏃🏼‍♂️‍➡️|🏃🏽‍♀️‍➡️|🏃🏽‍♂️‍➡️|🏃🏾‍♀️‍➡️|🏃🏾‍♂️‍➡️|🏃🏿‍♀️‍➡️|🏃🏿‍♂️‍➡️|👨🏻‍🦯‍➡️|👨🏻‍🦼‍➡️|👨🏻‍🦽‍➡️|👨🏼‍🦯‍➡️|👨🏼‍🦼‍➡️|👨🏼‍🦽‍➡️|👨🏽‍🦯‍➡️|👨🏽‍🦼‍➡️|👨🏽‍🦽‍➡️|👨🏾‍🦯‍➡️|👨🏾‍🦼‍➡️|👨🏾‍🦽‍➡️|👨🏿‍🦯‍➡️|👨🏿‍🦼‍➡️|👨🏿‍🦽‍➡️|👩🏻‍🦯‍➡️|👩🏻‍🦼‍➡️|👩🏻‍🦽‍➡️|👩🏼‍🦯‍➡️|👩🏼‍🦼‍➡️|👩🏼‍🦽‍➡️|👩🏽‍🦯‍➡️|👩🏽‍🦼‍➡️|👩🏽‍🦽‍➡️|👩🏾‍🦯‍➡️|👩🏾‍🦼‍➡️|👩🏾‍🦽‍➡️|👩🏿‍🦯‍➡️|👩🏿‍🦼‍➡️|👩🏿‍🦽‍➡️|🚶🏻‍♀️‍➡️|🚶🏻‍♂️‍➡️|🚶🏼‍♀️‍➡️|🚶🏼‍♂️‍➡️|🚶🏽‍♀️‍➡️|🚶🏽‍♂️‍➡️|🚶🏾‍♀️‍➡️|🚶🏾‍♂️‍➡️|🚶🏿‍♀️‍➡️|🚶🏿‍♂️‍➡️|🧎🏻‍♀️‍➡️|🧎🏻‍♂️‍➡️|🧎🏼‍♀️‍➡️|🧎🏼‍♂️‍➡️|🧎🏽‍♀️‍➡️|🧎🏽‍♂️‍➡️|🧎🏾‍♀️‍➡️|🧎🏾‍♂️‍➡️|🧎🏿‍♀️‍➡️|🧎🏿‍♂️‍➡️|🧑🏻‍🦯‍➡️|🧑🏻‍🦼‍➡️|🧑🏻‍🦽‍➡️|🧑🏼‍🦯‍➡️|🧑🏼‍🦼‍➡️|🧑🏼‍🦽‍➡️|🧑🏽‍🦯‍➡️|🧑🏽‍🦼‍➡️|🧑🏽‍🦽‍➡️|🧑🏾‍🦯‍➡️|🧑🏾‍🦼‍➡️|🧑🏾‍🦽‍➡️|🧑🏿‍🦯‍➡️|🧑🏿‍🦼‍➡️|🧑🏿‍🦽‍➡️|🫱🏻‍🫲🏼|🫱🏻‍🫲🏽|🫱🏻‍🫲🏾|🫱🏻‍🫲🏿|🫱🏼‍🫲🏻|🫱🏼‍🫲🏽|🫱🏼‍🫲🏾|🫱🏼‍🫲🏿|🫱🏽‍🫲🏻|🫱🏽‍🫲🏼|🫱🏽‍🫲🏾|🫱🏽‍🫲🏿|🫱🏾‍🫲🏻|🫱🏾‍🫲🏼|🫱🏾‍🫲🏽|🫱🏾‍🫲🏿|🫱🏿‍🫲🏻|🫱🏿‍🫲🏼|🫱🏿‍🫲🏽|🫱🏿‍🫲🏾|🏃‍♀️‍➡️|🏃‍♂️‍➡️|👨‍❤️‍👨|👨‍👦‍👦|👨‍👧‍👦|👨‍👧‍👧|👨‍👨‍👦|👨‍👨‍👧|👨‍👩‍👦|👨‍👩‍👧|👨‍🦯‍➡️|👨‍🦼‍➡️|👨‍🦽‍➡️|👩‍❤️‍👨|👩‍❤️‍👩|👩‍👦‍👦|👩‍👧‍👦|👩‍👧‍👧|👩‍👩‍👦|👩‍👩‍👧|👩‍🦯‍➡️|👩‍🦼‍➡️|👩‍🦽‍➡️|🚶‍♀️‍➡️|🚶‍♂️‍➡️|🧎‍♀️‍➡️|🧎‍♂️‍➡️|🧑‍🤝‍🧑|🧑‍🦯‍➡️|🧑‍🦼‍➡️|🧑‍🦽‍➡️|🧑‍🧑‍🧒|🧑‍🧒‍🧒|🏃🏻‍♀️|🏃🏻‍♂️|🏃🏻‍➡️|🏃🏼‍♀️|🏃🏼‍♂️|🏃🏼‍➡️|🏃🏽‍♀️|🏃🏽‍♂️|🏃🏽‍➡️|🏃🏾‍♀️|🏃🏾‍♂️|🏃🏾‍➡️|🏃🏿‍♀️|🏃🏿‍♂️|🏃🏿‍➡️|🏄🏻‍♀️|🏄🏻‍♂️|🏄🏼‍♀️|🏄🏼‍♂️|🏄🏽‍♀️|🏄🏽‍♂️|🏄🏾‍♀️|🏄🏾‍♂️|🏄🏿‍♀️|🏄🏿‍♂️|🏊🏻‍♀️|🏊🏻‍♂️|🏊🏼‍♀️|🏊🏼‍♂️|🏊🏽‍♀️|🏊🏽‍♂️|🏊🏾‍♀️|🏊🏾‍♂️|🏊🏿‍♀️|🏊🏿‍♂️|🏋🏻‍♀️|🏋🏻‍♂️|🏋🏼‍♀️|🏋🏼‍♂️|🏋🏽‍♀️|🏋🏽‍♂️|🏋🏾‍♀️|🏋🏾‍♂️|🏋🏿‍♀️|🏋🏿‍♂️|🏌🏻‍♀️|🏌🏻‍♂️|🏌🏼‍♀️|🏌🏼‍♂️|🏌🏽‍♀️|🏌🏽‍♂️|🏌🏾‍♀️|🏌🏾‍♂️|🏌🏿‍♀️|🏌🏿‍♂️|👁️‍🗨️|👨🏻‍⚕️|👨🏻‍⚖️|👨🏻‍✈️|👨🏻‍🌾|👨🏻‍🍳|👨🏻‍🍼|👨🏻‍🎓|👨🏻‍🎤|👨🏻‍🎨|👨🏻‍🏫|👨🏻‍🏭|👨🏻‍💻|👨🏻‍💼|👨🏻‍🔧|👨🏻‍🔬|👨🏻‍🚀|👨🏻‍🚒|👨🏻‍🦯|👨🏻‍🦰|👨🏻‍🦱|👨🏻‍🦲|👨🏻‍🦳|👨🏻‍🦼|👨🏻‍🦽|👨🏼‍⚕️|👨🏼‍⚖️|👨🏼‍✈️|👨🏼‍🌾|👨🏼‍🍳|👨🏼‍🍼|👨🏼‍🎓|👨🏼‍🎤|👨🏼‍🎨|👨🏼‍🏫|👨🏼‍🏭|👨🏼‍💻|👨🏼‍💼|👨🏼‍🔧|👨🏼‍🔬|👨🏼‍🚀|👨🏼‍🚒|👨🏼‍🦯|👨🏼‍🦰|👨🏼‍🦱|👨🏼‍🦲|👨🏼‍🦳|👨🏼‍🦼|👨🏼‍🦽|👨🏽‍⚕️|👨🏽‍⚖️|👨🏽‍✈️|👨🏽‍🌾|👨🏽‍🍳|👨🏽‍🍼|👨🏽‍🎓|👨🏽‍🎤|👨🏽‍🎨|👨🏽‍🏫|👨🏽‍🏭|👨🏽‍💻|👨🏽‍💼|👨🏽‍🔧|👨🏽‍🔬|👨🏽‍🚀|👨🏽‍🚒|👨🏽‍🦯|👨🏽‍🦰|👨🏽‍🦱|👨🏽‍🦲|👨🏽‍🦳|👨🏽‍🦼|👨🏽‍🦽|👨🏾‍⚕️|👨🏾‍⚖️|👨🏾‍✈️|👨🏾‍🌾|👨🏾‍🍳|👨🏾‍🍼|👨🏾‍🎓|👨🏾‍🎤|👨🏾‍🎨|👨🏾‍🏫|👨🏾‍🏭|👨🏾‍💻|👨🏾‍💼|👨🏾‍🔧|👨🏾‍🔬|👨🏾‍🚀|👨🏾‍🚒|👨🏾‍🦯|👨🏾‍🦰|👨🏾‍🦱|👨🏾‍🦲|👨🏾‍🦳|👨🏾‍🦼|👨🏾‍🦽|👨🏿‍⚕️|👨🏿‍⚖️|👨🏿‍✈️|👨🏿‍🌾|👨🏿‍🍳|👨🏿‍🍼|👨🏿‍🎓|👨🏿‍🎤|👨🏿‍🎨|👨🏿‍🏫|👨🏿‍🏭|👨🏿‍💻|👨🏿‍💼|👨🏿‍🔧|👨🏿‍🔬|👨🏿‍🚀|👨🏿‍🚒|👨🏿‍🦯|👨🏿‍🦰|👨🏿‍🦱|👨🏿‍🦲|👨🏿‍🦳|👨🏿‍🦼|👨🏿‍🦽|👩🏻‍⚕️|👩🏻‍⚖️|👩🏻‍✈️|👩🏻‍🌾|👩🏻‍🍳|👩🏻‍🍼|👩🏻‍🎓|👩🏻‍🎤|👩🏻‍🎨|👩🏻‍🏫|👩🏻‍🏭|👩🏻‍💻|👩🏻‍💼|👩🏻‍🔧|👩🏻‍🔬|👩🏻‍🚀|👩🏻‍🚒|👩🏻‍🦯|👩🏻‍🦰|👩🏻‍🦱|👩🏻‍🦲|👩🏻‍🦳|👩🏻‍🦼|👩🏻‍🦽|👩🏼‍⚕️|👩🏼‍⚖️|👩🏼‍✈️|👩🏼‍🌾|👩🏼‍🍳|👩🏼‍🍼|👩🏼‍🎓|👩🏼‍🎤|👩🏼‍🎨|👩🏼‍🏫|👩🏼‍🏭|👩🏼‍💻|👩🏼‍💼|👩🏼‍🔧|👩🏼‍🔬|👩🏼‍🚀|👩🏼‍🚒|👩🏼‍🦯|👩🏼‍🦰|👩🏼‍🦱|👩🏼‍🦲|👩🏼‍🦳|👩🏼‍🦼|👩🏼‍🦽|👩🏽‍⚕️|👩🏽‍⚖️|👩🏽‍✈️|👩🏽‍🌾|👩🏽‍🍳|👩🏽‍🍼|👩🏽‍🎓|👩🏽‍🎤|👩🏽‍🎨|👩🏽‍🏫|👩🏽‍🏭|👩🏽‍💻|👩🏽‍💼|👩🏽‍🔧|👩🏽‍🔬|👩🏽‍🚀|👩🏽‍🚒|👩🏽‍🦯|👩🏽‍🦰|👩🏽‍🦱|👩🏽‍🦲|👩🏽‍🦳|👩🏽‍🦼|👩🏽‍🦽|👩🏾‍⚕️|👩🏾‍⚖️|👩🏾‍✈️|👩🏾‍🌾|👩🏾‍🍳|👩🏾‍🍼|👩🏾‍🎓|👩🏾‍🎤|👩🏾‍🎨|👩🏾‍🏫|👩🏾‍🏭|👩🏾‍💻|👩🏾‍💼|👩🏾‍🔧|👩🏾‍🔬|👩🏾‍🚀|👩🏾‍🚒|👩🏾‍🦯|👩🏾‍🦰|👩🏾‍🦱|👩🏾‍🦲|👩🏾‍🦳|👩🏾‍🦼|👩🏾‍🦽|👩🏿‍⚕️|👩🏿‍⚖️|👩🏿‍✈️|👩🏿‍🌾|👩🏿‍🍳|👩🏿‍🍼|👩🏿‍🎓|👩🏿‍🎤|👩🏿‍🎨|👩🏿‍🏫|👩🏿‍🏭|👩🏿‍💻|👩🏿‍💼|👩🏿‍🔧|👩🏿‍🔬|👩🏿‍🚀|👩🏿‍🚒|👩🏿‍🦯|👩🏿‍🦰|👩🏿‍🦱|👩🏿‍🦲|👩🏿‍🦳|👩🏿‍🦼|👩🏿‍🦽|👮🏻‍♀️|👮🏻‍♂️|👮🏼‍♀️|👮🏼‍♂️|👮🏽‍♀️|👮🏽‍♂️|👮🏾‍♀️|👮🏾‍♂️|👮🏿‍♀️|👮🏿‍♂️|👯🏻‍♀️|👯🏻‍♂️|👯🏼‍♀️|👯🏼‍♂️|👯🏽‍♀️|👯🏽‍♂️|👯🏾‍♀️|👯🏾‍♂️|👯🏿‍♀️|👯🏿‍♂️|👰🏻‍♀️|👰🏻‍♂️|👰🏼‍♀️|👰🏼‍♂️|👰🏽‍♀️|👰🏽‍♂️|👰🏾‍♀️|👰🏾‍♂️|👰🏿‍♀️|👰🏿‍♂️|👱🏻‍♀️|👱🏻‍♂️|👱🏼‍♀️|👱🏼‍♂️|👱🏽‍♀️|👱🏽‍♂️|👱🏾‍♀️|👱🏾‍♂️|👱🏿‍♀️|👱🏿‍♂️|👳🏻‍♀️|👳🏻‍♂️|👳🏼‍♀️|👳🏼‍♂️|👳🏽‍♀️|👳🏽‍♂️|👳🏾‍♀️|👳🏾‍♂️|👳🏿‍♀️|👳🏿‍♂️|👷🏻‍♀️|👷🏻‍♂️|👷🏼‍♀️|👷🏼‍♂️|👷🏽‍♀️|👷🏽‍♂️|👷🏾‍♀️|👷🏾‍♂️|👷🏿‍♀️|👷🏿‍♂️|💁🏻‍♀️|💁🏻‍♂️|💁🏼‍♀️|💁🏼‍♂️|💁🏽‍♀️|💁🏽‍♂️|💁🏾‍♀️|💁🏾‍♂️|💁🏿‍♀️|💁🏿‍♂️|💂🏻‍♀️|💂🏻‍♂️|💂🏼‍♀️|💂🏼‍♂️|💂🏽‍♀️|💂🏽‍♂️|💂🏾‍♀️|💂🏾‍♂️|💂🏿‍♀️|💂🏿‍♂️|💆🏻‍♀️|💆🏻‍♂️|💆🏼‍♀️|💆🏼‍♂️|💆🏽‍♀️|💆🏽‍♂️|💆🏾‍♀️|💆🏾‍♂️|💆🏿‍♀️|💆🏿‍♂️|💇🏻‍♀️|💇🏻‍♂️|💇🏼‍♀️|💇🏼‍♂️|💇🏽‍♀️|💇🏽‍♂️|💇🏾‍♀️|💇🏾‍♂️|💇🏿‍♀️|💇🏿‍♂️|🕵🏻‍♀️|🕵🏻‍♂️|🕵🏼‍♀️|🕵🏼‍♂️|🕵🏽‍♀️|🕵🏽‍♂️|🕵🏾‍♀️|🕵🏾‍♂️|🕵🏿‍♀️|🕵🏿‍♂️|🙅🏻‍♀️|🙅🏻‍♂️|🙅🏼‍♀️|🙅🏼‍♂️|🙅🏽‍♀️|🙅🏽‍♂️|🙅🏾‍♀️|🙅🏾‍♂️|🙅🏿‍♀️|🙅🏿‍♂️|🙆🏻‍♀️|🙆🏻‍♂️|🙆🏼‍♀️|🙆🏼‍♂️|🙆🏽‍♀️|🙆🏽‍♂️|🙆🏾‍♀️|🙆🏾‍♂️|🙆🏿‍♀️|🙆🏿‍♂️|🙇🏻‍♀️|🙇🏻‍♂️|🙇🏼‍♀️|🙇🏼‍♂️|🙇🏽‍♀️|🙇🏽‍♂️|🙇🏾‍♀️|🙇🏾‍♂️|🙇🏿‍♀️|🙇🏿‍♂️|🙋🏻‍♀️|🙋🏻‍♂️|🙋🏼‍♀️|🙋🏼‍♂️|🙋🏽‍♀️|🙋🏽‍♂️|🙋🏾‍♀️|🙋🏾‍♂️|🙋🏿‍♀️|🙋🏿‍♂️|🙍🏻‍♀️|🙍🏻‍♂️|🙍🏼‍♀️|🙍🏼‍♂️|🙍🏽‍♀️|🙍🏽‍♂️|🙍🏾‍♀️|🙍🏾‍♂️|🙍🏿‍♀️|🙍🏿‍♂️|🙎🏻‍♀️|🙎🏻‍♂️|🙎🏼‍♀️|🙎🏼‍♂️|🙎🏽‍♀️|🙎🏽‍♂️|🙎🏾‍♀️|🙎🏾‍♂️|🙎🏿‍♀️|🙎🏿‍♂️|🚣🏻‍♀️|🚣🏻‍♂️|🚣🏼‍♀️|🚣🏼‍♂️|🚣🏽‍♀️|🚣🏽‍♂️|🚣🏾‍♀️|🚣🏾‍♂️|🚣🏿‍♀️|🚣🏿‍♂️|🚴🏻‍♀️|🚴🏻‍♂️|🚴🏼‍♀️|🚴🏼‍♂️|🚴🏽‍♀️|🚴🏽‍♂️|🚴🏾‍♀️|🚴🏾‍♂️|🚴🏿‍♀️|🚴🏿‍♂️|🚵🏻‍♀️|🚵🏻‍♂️|🚵🏼‍♀️|🚵🏼‍♂️|🚵🏽‍♀️|🚵🏽‍♂️|🚵🏾‍♀️|🚵🏾‍♂️|🚵🏿‍♀️|🚵🏿‍♂️|🚶🏻‍♀️|🚶🏻‍♂️|🚶🏻‍➡️|🚶🏼‍♀️|🚶🏼‍♂️|🚶🏼‍➡️|🚶🏽‍♀️|🚶🏽‍♂️|🚶🏽‍➡️|🚶🏾‍♀️|🚶🏾‍♂️|🚶🏾‍➡️|🚶🏿‍♀️|🚶🏿‍♂️|🚶🏿‍➡️|🤦🏻‍♀️|🤦🏻‍♂️|🤦🏼‍♀️|🤦🏼‍♂️|🤦🏽‍♀️|🤦🏽‍♂️|🤦🏾‍♀️|🤦🏾‍♂️|🤦🏿‍♀️|🤦🏿‍♂️|🤵🏻‍♀️|🤵🏻‍♂️|🤵🏼‍♀️|🤵🏼‍♂️|🤵🏽‍♀️|🤵🏽‍♂️|🤵🏾‍♀️|🤵🏾‍♂️|🤵🏿‍♀️|🤵🏿‍♂️|🤷🏻‍♀️|🤷🏻‍♂️|🤷🏼‍♀️|🤷🏼‍♂️|🤷🏽‍♀️|🤷🏽‍♂️|🤷🏾‍♀️|🤷🏾‍♂️|🤷🏿‍♀️|🤷🏿‍♂️|🤸🏻‍♀️|🤸🏻‍♂️|🤸🏼‍♀️|🤸🏼‍♂️|🤸🏽‍♀️|🤸🏽‍♂️|🤸🏾‍♀️|🤸🏾‍♂️|🤸🏿‍♀️|🤸🏿‍♂️|🤹🏻‍♀️|🤹🏻‍♂️|🤹🏼‍♀️|🤹🏼‍♂️|🤹🏽‍♀️|🤹🏽‍♂️|🤹🏾‍♀️|🤹🏾‍♂️|🤹🏿‍♀️|🤹🏿‍♂️|🤼🏻‍♀️|🤼🏻‍♂️|🤼🏼‍♀️|🤼🏼‍♂️|🤼🏽‍♀️|🤼🏽‍♂️|🤼🏾‍♀️|🤼🏾‍♂️|🤼🏿‍♀️|🤼🏿‍♂️|🤽🏻‍♀️|🤽🏻‍♂️|🤽🏼‍♀️|🤽🏼‍♂️|🤽🏽‍♀️|🤽🏽‍♂️|🤽🏾‍♀️|🤽🏾‍♂️|🤽🏿‍♀️|🤽🏿‍♂️|🤾🏻‍♀️|🤾🏻‍♂️|🤾🏼‍♀️|🤾🏼‍♂️|🤾🏽‍♀️|🤾🏽‍♂️|🤾🏾‍♀️|🤾🏾‍♂️|🤾🏿‍♀️|🤾🏿‍♂️|🦸🏻‍♀️|🦸🏻‍♂️|🦸🏼‍♀️|🦸🏼‍♂️|🦸🏽‍♀️|🦸🏽‍♂️|🦸🏾‍♀️|🦸🏾‍♂️|🦸🏿‍♀️|🦸🏿‍♂️|🦹🏻‍♀️|🦹🏻‍♂️|🦹🏼‍♀️|🦹🏼‍♂️|🦹🏽‍♀️|🦹🏽‍♂️|🦹🏾‍♀️|🦹🏾‍♂️|🦹🏿‍♀️|🦹🏿‍♂️|🧍🏻‍♀️|🧍🏻‍♂️|🧍🏼‍♀️|🧍🏼‍♂️|🧍🏽‍♀️|🧍🏽‍♂️|🧍🏾‍♀️|🧍🏾‍♂️|🧍🏿‍♀️|🧍🏿‍♂️|🧎🏻‍♀️|🧎🏻‍♂️|🧎🏻‍➡️|🧎🏼‍♀️|🧎🏼‍♂️|🧎🏼‍➡️|🧎🏽‍♀️|🧎🏽‍♂️|🧎🏽‍➡️|🧎🏾‍♀️|🧎🏾‍♂️|🧎🏾‍➡️|🧎🏿‍♀️|🧎🏿‍♂️|🧎🏿‍➡️|🧏🏻‍♀️|🧏🏻‍♂️|🧏🏼‍♀️|🧏🏼‍♂️|🧏🏽‍♀️|🧏🏽‍♂️|🧏🏾‍♀️|🧏🏾‍♂️|🧏🏿‍♀️|🧏🏿‍♂️|🧑🏻‍⚕️|🧑🏻‍⚖️|🧑🏻‍✈️|🧑🏻‍🌾|🧑🏻‍🍳|🧑🏻‍🍼|🧑🏻‍🎄|🧑🏻‍🎓|🧑🏻‍🎤|🧑🏻‍🎨|🧑🏻‍🏫|🧑🏻‍🏭|🧑🏻‍💻|🧑🏻‍💼|🧑🏻‍🔧|🧑🏻‍🔬|🧑🏻‍🚀|🧑🏻‍🚒|🧑🏻‍🦯|🧑🏻‍🦰|🧑🏻‍🦱|🧑🏻‍🦲|🧑🏻‍🦳|🧑🏻‍🦼|🧑🏻‍🦽|🧑🏻‍🩰|🧑🏼‍⚕️|🧑🏼‍⚖️|🧑🏼‍✈️|🧑🏼‍🌾|🧑🏼‍🍳|🧑🏼‍🍼|🧑🏼‍🎄|🧑🏼‍🎓|🧑🏼‍🎤|🧑🏼‍🎨|🧑🏼‍🏫|🧑🏼‍🏭|🧑🏼‍💻|🧑🏼‍💼|🧑🏼‍🔧|🧑🏼‍🔬|🧑🏼‍🚀|🧑🏼‍🚒|🧑🏼‍🦯|🧑🏼‍🦰|🧑🏼‍🦱|🧑🏼‍🦲|🧑🏼‍🦳|🧑🏼‍🦼|🧑🏼‍🦽|🧑🏼‍🩰|🧑🏽‍⚕️|🧑🏽‍⚖️|🧑🏽‍✈️|🧑🏽‍🌾|🧑🏽‍🍳|🧑🏽‍🍼|🧑🏽‍🎄|🧑🏽‍🎓|🧑🏽‍🎤|🧑🏽‍🎨|🧑🏽‍🏫|🧑🏽‍🏭|🧑🏽‍💻|🧑🏽‍💼|🧑🏽‍🔧|🧑🏽‍🔬|🧑🏽‍🚀|🧑🏽‍🚒|🧑🏽‍🦯|🧑🏽‍🦰|🧑🏽‍🦱|🧑🏽‍🦲|🧑🏽‍🦳|🧑🏽‍🦼|🧑🏽‍🦽|🧑🏽‍🩰|🧑🏾‍⚕️|🧑🏾‍⚖️|🧑🏾‍✈️|🧑🏾‍🌾|🧑🏾‍🍳|🧑🏾‍🍼|🧑🏾‍🎄|🧑🏾‍🎓|🧑🏾‍🎤|🧑🏾‍🎨|🧑🏾‍🏫|🧑🏾‍🏭|🧑🏾‍💻|🧑🏾‍💼|🧑🏾‍🔧|🧑🏾‍🔬|🧑🏾‍🚀|🧑🏾‍🚒|🧑🏾‍🦯|🧑🏾‍🦰|🧑🏾‍🦱|🧑🏾‍🦲|🧑🏾‍🦳|🧑🏾‍🦼|🧑🏾‍🦽|🧑🏾‍🩰|🧑🏿‍⚕️|🧑🏿‍⚖️|🧑🏿‍✈️|🧑🏿‍🌾|🧑🏿‍🍳|🧑🏿‍🍼|🧑🏿‍🎄|🧑🏿‍🎓|🧑🏿‍🎤|🧑🏿‍🎨|🧑🏿‍🏫|🧑🏿‍🏭|🧑🏿‍💻|🧑🏿‍💼|🧑🏿‍🔧|🧑🏿‍🔬|🧑🏿‍🚀|🧑🏿‍🚒|🧑🏿‍🦯|🧑🏿‍🦰|🧑🏿‍🦱|🧑🏿‍🦲|🧑🏿‍🦳|🧑🏿‍🦼|🧑🏿‍🦽|🧑🏿‍🩰|🧔🏻‍♀️|🧔🏻‍♂️|🧔🏼‍♀️|🧔🏼‍♂️|🧔🏽‍♀️|🧔🏽‍♂️|🧔🏾‍♀️|🧔🏾‍♂️|🧔🏿‍♀️|🧔🏿‍♂️|🧖🏻‍♀️|🧖🏻‍♂️|🧖🏼‍♀️|🧖🏼‍♂️|🧖🏽‍♀️|🧖🏽‍♂️|🧖🏾‍♀️|🧖🏾‍♂️|🧖🏿‍♀️|🧖🏿‍♂️|🧗🏻‍♀️|🧗🏻‍♂️|🧗🏼‍♀️|🧗🏼‍♂️|🧗🏽‍♀️|🧗🏽‍♂️|🧗🏾‍♀️|🧗🏾‍♂️|🧗🏿‍♀️|🧗🏿‍♂️|🧘🏻‍♀️|🧘🏻‍♂️|🧘🏼‍♀️|🧘🏼‍♂️|🧘🏽‍♀️|🧘🏽‍♂️|🧘🏾‍♀️|🧘🏾‍♂️|🧘🏿‍♀️|🧘🏿‍♂️|🧙🏻‍♀️|🧙🏻‍♂️|🧙🏼‍♀️|🧙🏼‍♂️|🧙🏽‍♀️|🧙🏽‍♂️|🧙🏾‍♀️|🧙🏾‍♂️|🧙🏿‍♀️|🧙🏿‍♂️|🧚🏻‍♀️|🧚🏻‍♂️|🧚🏼‍♀️|🧚🏼‍♂️|🧚🏽‍♀️|🧚🏽‍♂️|🧚🏾‍♀️|🧚🏾‍♂️|🧚🏿‍♀️|🧚🏿‍♂️|🧛🏻‍♀️|🧛🏻‍♂️|🧛🏼‍♀️|🧛🏼‍♂️|🧛🏽‍♀️|🧛🏽‍♂️|🧛🏾‍♀️|🧛🏾‍♂️|🧛🏿‍♀️|🧛🏿‍♂️|🧜🏻‍♀️|🧜🏻‍♂️|🧜🏼‍♀️|🧜🏼‍♂️|🧜🏽‍♀️|🧜🏽‍♂️|🧜🏾‍♀️|🧜🏾‍♂️|🧜🏿‍♀️|🧜🏿‍♂️|🧝🏻‍♀️|🧝🏻‍♂️|🧝🏼‍♀️|🧝🏼‍♂️|🧝🏽‍♀️|🧝🏽‍♂️|🧝🏾‍♀️|🧝🏾‍♂️|🧝🏿‍♀️|🧝🏿‍♂️|⛹🏻‍♀️|⛹🏻‍♂️|⛹🏼‍♀️|⛹🏼‍♂️|⛹🏽‍♀️|⛹🏽‍♂️|⛹🏾‍♀️|⛹🏾‍♂️|⛹🏿‍♀️|⛹🏿‍♂️|🏋️‍♀️|🏋️‍♂️|🏌️‍♀️|🏌️‍♂️|🏳️‍⚧️|🏳️‍🌈|🕵️‍♀️|🕵️‍♂️|😶‍🌫️|⛓️‍💥|⛹️‍♀️|⛹️‍♂️|❤️‍🔥|❤️‍🩹|🍄‍🟫|🍋‍🟩|🏃‍♀️|🏃‍♂️|🏃‍➡️|🏄‍♀️|🏄‍♂️|🏊‍♀️|🏊‍♂️|🏴‍☠️|🐕‍🦺|🐦‍🔥|🐻‍❄️|👨‍⚕️|👨‍⚖️|👨‍✈️|👨‍🌾|👨‍🍳|👨‍🍼|👨‍🎓|👨‍🎤|👨‍🎨|👨‍🏫|👨‍🏭|👨‍👦|👨‍👧|👨‍💻|👨‍💼|👨‍🔧|👨‍🔬|👨‍🚀|👨‍🚒|👨‍🦯|👨‍🦰|👨‍🦱|👨‍🦲|👨‍🦳|👨‍🦼|👨‍🦽|👩‍⚕️|👩‍⚖️|👩‍✈️|👩‍🌾|👩‍🍳|👩‍🍼|👩‍🎓|👩‍🎤|👩‍🎨|👩‍🏫|👩‍🏭|👩‍👦|👩‍👧|👩‍💻|👩‍💼|👩‍🔧|👩‍🔬|👩‍🚀|👩‍🚒|👩‍🦯|👩‍🦰|👩‍🦱|👩‍🦲|👩‍🦳|👩‍🦼|👩‍🦽|👮‍♀️|👮‍♂️|👯‍♀️|👯‍♂️|👰‍♀️|👰‍♂️|👱‍♀️|👱‍♂️|👳‍♀️|👳‍♂️|👷‍♀️|👷‍♂️|💁‍♀️|💁‍♂️|💂‍♀️|💂‍♂️|💆‍♀️|💆‍♂️|💇‍♀️|💇‍♂️|😮‍💨|😵‍💫|🙂‍↔️|🙂‍↕️|🙅‍♀️|🙅‍♂️|🙆‍♀️|🙆‍♂️|🙇‍♀️|🙇‍♂️|🙋‍♀️|🙋‍♂️|🙍‍♀️|🙍‍♂️|🙎‍♀️|🙎‍♂️|🚣‍♀️|🚣‍♂️|🚴‍♀️|🚴‍♂️|🚵‍♀️|🚵‍♂️|🚶‍♀️|🚶‍♂️|🚶‍➡️|🤦‍♀️|🤦‍♂️|🤵‍♀️|🤵‍♂️|🤷‍♀️|🤷‍♂️|🤸‍♀️|🤸‍♂️|🤹‍♀️|🤹‍♂️|🤼‍♀️|🤼‍♂️|🤽‍♀️|🤽‍♂️|🤾‍♀️|🤾‍♂️|🦸‍♀️|🦸‍♂️|🦹‍♀️|🦹‍♂️|🧍‍♀️|🧍‍♂️|🧎‍♀️|🧎‍♂️|🧎‍➡️|🧏‍♀️|🧏‍♂️|🧑‍⚕️|🧑‍⚖️|🧑‍✈️|🧑‍🌾|🧑‍🍳|🧑‍🍼|🧑‍🎄|🧑‍🎓|🧑‍🎤|🧑‍🎨|🧑‍🏫|🧑‍🏭|🧑‍💻|🧑‍💼|🧑‍🔧|🧑‍🔬|🧑‍🚀|🧑‍🚒|🧑‍🦯|🧑‍🦰|🧑‍🦱|🧑‍🦲|🧑‍🦳|🧑‍🦼|🧑‍🦽|🧑‍🧒|🧑‍🩰|🧔‍♀️|🧔‍♂️|🧖‍♀️|🧖‍♂️|🧗‍♀️|🧗‍♂️|🧘‍♀️|🧘‍♂️|🧙‍♀️|🧙‍♂️|🧚‍♀️|🧚‍♂️|🧛‍♀️|🧛‍♂️|🧜‍♀️|🧜‍♂️|🧝‍♀️|🧝‍♂️|🧞‍♀️|🧞‍♂️|🧟‍♀️|🧟‍♂️|\*️⃣|🇦🇨|🇦🇩|🇦🇪|🇦🇫|🇦🇬|🇦🇮|🇦🇱|🇦🇲|🇦🇴|🇦🇶|🇦🇷|🇦🇸|🇦🇹|🇦🇺|🇦🇼|🇦🇽|🇦🇿|🇧🇦|🇧🇧|🇧🇩|🇧🇪|🇧🇫|🇧🇬|🇧🇭|🇧🇮|🇧🇯|🇧🇱|🇧🇲|🇧🇳|🇧🇴|🇧🇶|🇧🇷|🇧🇸|🇧🇹|🇧🇻|🇧🇼|🇧🇾|🇧🇿|🇨🇦|🇨🇨|🇨🇩|🇨🇫|🇨🇬|🇨🇭|🇨🇮|🇨🇰|🇨🇱|🇨🇲|🇨🇳|🇨🇴|🇨🇵|🇨🇶|🇨🇷|🇨🇺|🇨🇻|🇨🇼|🇨🇽|🇨🇾|🇨🇿|🇩🇪|🇩🇬|🇩🇯|🇩🇰|🇩🇲|🇩🇴|🇩🇿|🇪🇦|🇪🇨|🇪🇪|🇪🇬|🇪🇭|🇪🇷|🇪🇸|🇪🇹|🇪🇺|🇫🇮|🇫🇯|🇫🇰|🇫🇲|🇫🇴|🇫🇷|🇬🇦|🇬🇧|🇬🇩|🇬🇪|🇬🇫|🇬🇬|🇬🇭|🇬🇮|🇬🇱|🇬🇲|🇬🇳|🇬🇵|🇬🇶|🇬🇷|🇬🇸|🇬🇹|🇬🇺|🇬🇼|🇬🇾|🇭🇰|🇭🇲|🇭🇳|🇭🇷|🇭🇹|🇭🇺|🇮🇨|🇮🇩|🇮🇪|🇮🇱|🇮🇲|🇮🇳|🇮🇴|🇮🇶|🇮🇷|🇮🇸|🇮🇹|🇯🇪|🇯🇲|🇯🇴|🇯🇵|🇰🇪|🇰🇬|🇰🇭|🇰🇮|🇰🇲|🇰🇳|🇰🇵|🇰🇷|🇰🇼|🇰🇾|🇰🇿|🇱🇦|🇱🇧|🇱🇨|🇱🇮|🇱🇰|🇱🇷|🇱🇸|🇱🇹|🇱🇺|🇱🇻|🇱🇾|🇲🇦|🇲🇨|🇲🇩|🇲🇪|🇲🇫|🇲🇬|🇲🇭|🇲🇰|🇲🇱|🇲🇲|🇲🇳|🇲🇴|🇲🇵|🇲🇶|🇲🇷|🇲🇸|🇲🇹|🇲🇺|🇲🇻|🇲🇼|🇲🇽|🇲🇾|🇲🇿|🇳🇦|🇳🇨|🇳🇪|🇳🇫|🇳🇬|🇳🇮|🇳🇱|🇳🇴|🇳🇵|🇳🇷|🇳🇺|🇳🇿|🇴🇲|🇵🇦|🇵🇪|🇵🇫|🇵🇬|🇵🇭|🇵🇰|🇵🇱|🇵🇲|🇵🇳|🇵🇷|🇵🇸|🇵🇹|🇵🇼|🇵🇾|🇶🇦|🇷🇪|🇷🇴|🇷🇸|🇷🇺|🇷🇼|🇸🇦|🇸🇧|🇸🇨|🇸🇩|🇸🇪|🇸🇬|🇸🇭|🇸🇮|🇸🇯|🇸🇰|🇸🇱|🇸🇲|🇸🇳|🇸🇴|🇸🇷|🇸🇸|🇸🇹|🇸🇻|🇸🇽|🇸🇾|🇸🇿|🇹🇦|🇹🇨|🇹🇩|🇹🇫|🇹🇬|🇹🇭|🇹🇯|🇹🇰|🇹🇱|🇹🇲|🇹🇳|🇹🇴|🇹🇷|🇹🇹|🇹🇻|🇹🇼|🇹🇿|🇺🇦|🇺🇬|🇺🇲|🇺🇳|🇺🇸|🇺🇾|🇺🇿|🇻🇦|🇻🇨|🇻🇪|🇻🇬|🇻🇮|🇻🇳|🇻🇺|🇼🇫|🇼🇸|🇽🇰|🇾🇪|🇾🇹|🇿🇦|🇿🇲|🇿🇼|🎅🏻|🎅🏼|🎅🏽|🎅🏾|🎅🏿|🏂🏻|🏂🏼|🏂🏽|🏂🏾|🏂🏿|🏃🏻|🏃🏼|🏃🏽|🏃🏾|🏃🏿|🏄🏻|🏄🏼|🏄🏽|🏄🏾|🏄🏿|🏇🏻|🏇🏼|🏇🏽|🏇🏾|🏇🏿|🏊🏻|🏊🏼|🏊🏽|🏊🏾|🏊🏿|🏋🏻|🏋🏼|🏋🏽|🏋🏾|🏋🏿|🏌🏻|🏌🏼|🏌🏽|🏌🏾|🏌🏿|🐈‍⬛|🐦‍⬛|👂🏻|👂🏼|👂🏽|👂🏾|👂🏿|👃🏻|👃🏼|👃🏽|👃🏾|👃🏿|👆🏻|👆🏼|👆🏽|👆🏾|👆🏿|👇🏻|👇🏼|👇🏽|👇🏾|👇🏿|👈🏻|👈🏼|👈🏽|👈🏾|👈🏿|👉🏻|👉🏼|👉🏽|👉🏾|👉🏿|👊🏻|👊🏼|👊🏽|👊🏾|👊🏿|👋🏻|👋🏼|👋🏽|👋🏾|👋🏿|👌🏻|👌🏼|👌🏽|👌🏾|👌🏿|👍🏻|👍🏼|👍🏽|👍🏾|👍🏿|👎🏻|👎🏼|👎🏽|👎🏾|👎🏿|👏🏻|👏🏼|👏🏽|👏🏾|👏🏿|👐🏻|👐🏼|👐🏽|👐🏾|👐🏿|👦🏻|👦🏼|👦🏽|👦🏾|👦🏿|👧🏻|👧🏼|👧🏽|👧🏾|👧🏿|👨🏻|👨🏼|👨🏽|👨🏾|👨🏿|👩🏻|👩🏼|👩🏽|👩🏾|👩🏿|👫🏻|👫🏼|👫🏽|👫🏾|👫🏿|👬🏻|👬🏼|👬🏽|👬🏾|👬🏿|👭🏻|👭🏼|👭🏽|👭🏾|👭🏿|👮🏻|👮🏼|👮🏽|👮🏾|👮🏿|👯🏻|👯🏼|👯🏽|👯🏾|👯🏿|👰🏻|👰🏼|👰🏽|👰🏾|👰🏿|👱🏻|👱🏼|👱🏽|👱🏾|👱🏿|👲🏻|👲🏼|👲🏽|👲🏾|👲🏿|👳🏻|👳🏼|👳🏽|👳🏾|👳🏿|👴🏻|👴🏼|👴🏽|👴🏾|👴🏿|👵🏻|👵🏼|👵🏽|👵🏾|👵🏿|👶🏻|👶🏼|👶🏽|👶🏾|👶🏿|👷🏻|👷🏼|👷🏽|👷🏾|👷🏿|👸🏻|👸🏼|👸🏽|👸🏾|👸🏿|👼🏻|👼🏼|👼🏽|👼🏾|👼🏿|💁🏻|💁🏼|💁🏽|💁🏾|💁🏿|💂🏻|💂🏼|💂🏽|💂🏾|💂🏿|💃🏻|💃🏼|💃🏽|💃🏾|💃🏿|💅🏻|💅🏼|💅🏽|💅🏾|💅🏿|💆🏻|💆🏼|💆🏽|💆🏾|💆🏿|💇🏻|💇🏼|💇🏽|💇🏾|💇🏿|💏🏻|💏🏼|💏🏽|💏🏾|💏🏿|💑🏻|💑🏼|💑🏽|💑🏾|💑🏿|💪🏻|💪🏼|💪🏽|💪🏾|💪🏿|🕴🏻|🕴🏼|🕴🏽|🕴🏾|🕴🏿|🕵🏻|🕵🏼|🕵🏽|🕵🏾|🕵🏿|🕺🏻|🕺🏼|🕺🏽|🕺🏾|🕺🏿|🖐🏻|🖐🏼|🖐🏽|🖐🏾|🖐🏿|🖕🏻|🖕🏼|🖕🏽|🖕🏾|🖕🏿|🖖🏻|🖖🏼|🖖🏽|🖖🏾|🖖🏿|🙅🏻|🙅🏼|🙅🏽|🙅🏾|🙅🏿|🙆🏻|🙆🏼|🙆🏽|🙆🏾|🙆🏿|🙇🏻|🙇🏼|🙇🏽|🙇🏾|🙇🏿|🙋🏻|🙋🏼|🙋🏽|🙋🏾|🙋🏿|🙌🏻|🙌🏼|🙌🏽|🙌🏾|🙌🏿|🙍🏻|🙍🏼|🙍🏽|🙍🏾|🙍🏿|🙎🏻|🙎🏼|🙎🏽|🙎🏾|🙎🏿|🙏🏻|🙏🏼|🙏🏽|🙏🏾|🙏🏿|🚣🏻|🚣🏼|🚣🏽|🚣🏾|🚣🏿|🚴🏻|🚴🏼|🚴🏽|🚴🏾|🚴🏿|🚵🏻|🚵🏼|🚵🏽|🚵🏾|🚵🏿|🚶🏻|🚶🏼|🚶🏽|🚶🏾|🚶🏿|🛀🏻|🛀🏼|🛀🏽|🛀🏾|🛀🏿|🛌🏻|🛌🏼|🛌🏽|🛌🏾|🛌🏿|🤌🏻|🤌🏼|🤌🏽|🤌🏾|🤌🏿|🤏🏻|🤏🏼|🤏🏽|🤏🏾|🤏🏿|🤘🏻|🤘🏼|🤘🏽|🤘🏾|🤘🏿|🤙🏻|🤙🏼|🤙🏽|🤙🏾|🤙🏿|🤚🏻|🤚🏼|🤚🏽|🤚🏾|🤚🏿|🤛🏻|🤛🏼|🤛🏽|🤛🏾|🤛🏿|🤜🏻|🤜🏼|🤜🏽|🤜🏾|🤜🏿|🤝🏻|🤝🏼|🤝🏽|🤝🏾|🤝🏿|🤞🏻|🤞🏼|🤞🏽|🤞🏾|🤞🏿|🤟🏻|🤟🏼|🤟🏽|🤟🏾|🤟🏿|🤦🏻|🤦🏼|🤦🏽|🤦🏾|🤦🏿|🤰🏻|🤰🏼|🤰🏽|🤰🏾|🤰🏿|🤱🏻|🤱🏼|🤱🏽|🤱🏾|🤱🏿|🤲🏻|🤲🏼|🤲🏽|🤲🏾|🤲🏿|🤳🏻|🤳🏼|🤳🏽|🤳🏾|🤳🏿|🤴🏻|🤴🏼|🤴🏽|🤴🏾|🤴🏿|🤵🏻|🤵🏼|🤵🏽|🤵🏾|🤵🏿|🤶🏻|🤶🏼|🤶🏽|🤶🏾|🤶🏿|🤷🏻|🤷🏼|🤷🏽|🤷🏾|🤷🏿|🤸🏻|🤸🏼|🤸🏽|🤸🏾|🤸🏿|🤹🏻|🤹🏼|🤹🏽|🤹🏾|🤹🏿|🤼🏻|🤼🏼|🤼🏽|🤼🏾|🤼🏿|🤽🏻|🤽🏼|🤽🏽|🤽🏾|🤽🏿|🤾🏻|🤾🏼|🤾🏽|🤾🏾|🤾🏿|🥷🏻|🥷🏼|🥷🏽|🥷🏾|🥷🏿|🦵🏻|🦵🏼|🦵🏽|🦵🏾|🦵🏿|🦶🏻|🦶🏼|🦶🏽|🦶🏾|🦶🏿|🦸🏻|🦸🏼|🦸🏽|🦸🏾|🦸🏿|🦹🏻|🦹🏼|🦹🏽|🦹🏾|🦹🏿|🦻🏻|🦻🏼|🦻🏽|🦻🏾|🦻🏿|🧍🏻|🧍🏼|🧍🏽|🧍🏾|🧍🏿|🧎🏻|🧎🏼|🧎🏽|🧎🏾|🧎🏿|🧏🏻|🧏🏼|🧏🏽|🧏🏾|🧏🏿|🧑🏻|🧑🏼|🧑🏽|🧑🏾|🧑🏿|🧒🏻|🧒🏼|🧒🏽|🧒🏾|🧒🏿|🧓🏻|🧓🏼|🧓🏽|🧓🏾|🧓🏿|🧔🏻|🧔🏼|🧔🏽|🧔🏾|🧔🏿|🧕🏻|🧕🏼|🧕🏽|🧕🏾|🧕🏿|🧖🏻|🧖🏼|🧖🏽|🧖🏾|🧖🏿|🧗🏻|🧗🏼|🧗🏽|🧗🏾|🧗🏿|🧘🏻|🧘🏼|🧘🏽|🧘🏾|🧘🏿|🧙🏻|🧙🏼|🧙🏽|🧙🏾|🧙🏿|🧚🏻|🧚🏼|🧚🏽|🧚🏾|🧚🏿|🧛🏻|🧛🏼|🧛🏽|🧛🏾|🧛🏿|🧜🏻|🧜🏼|🧜🏽|🧜🏾|🧜🏿|🧝🏻|🧝🏼|🧝🏽|🧝🏾|🧝🏿|🫃🏻|🫃🏼|🫃🏽|🫃🏾|🫃🏿|🫄🏻|🫄🏼|🫄🏽|🫄🏾|🫄🏿|🫅🏻|🫅🏼|🫅🏽|🫅🏾|🫅🏿|🫰🏻|🫰🏼|🫰🏽|🫰🏾|🫰🏿|🫱🏻|🫱🏼|🫱🏽|🫱🏾|🫱🏿|🫲🏻|🫲🏼|🫲🏽|🫲🏾|🫲🏿|🫳🏻|🫳🏼|🫳🏽|🫳🏾|🫳🏿|🫴🏻|🫴🏼|🫴🏽|🫴🏾|🫴🏿|🫵🏻|🫵🏼|🫵🏽|🫵🏾|🫵🏿|🫶🏻|🫶🏼|🫶🏽|🫶🏾|🫶🏿|🫷🏻|🫷🏼|🫷🏽|🫷🏾|🫷🏿|🫸🏻|🫸🏼|🫸🏽|🫸🏾|🫸🏿|#️⃣|0️⃣|1️⃣|2️⃣|3️⃣|4️⃣|5️⃣|6️⃣|7️⃣|8️⃣|9️⃣|☝🏻|☝🏼|☝🏽|☝🏾|☝🏿|⛹🏻|⛹🏼|⛹🏽|⛹🏾|⛹🏿|✊🏻|✊🏼|✊🏽|✊🏾|✊🏿|✋🏻|✋🏼|✋🏽|✋🏾|✋🏿|✌🏻|✌🏼|✌🏽|✌🏾|✌🏿|✍🏻|✍🏼|✍🏽|✍🏾|✍🏿|🅰️|🅱️|🅾️|🅿️|🈂️|🈷️|🌡️|🌤️|🌥️|🌦️|🌧️|🌨️|🌩️|🌪️|🌫️|🌬️|🌶️|🍽️|🎖️|🎗️|🎙️|🎚️|🎛️|🎞️|🎟️|🏋️|🏌️|🏍️|🏎️|🏔️|🏕️|🏖️|🏗️|🏘️|🏙️|🏚️|🏛️|🏜️|🏝️|🏞️|🏟️|🏳️|🏵️|🏷️|🐿️|👁️|📽️|🕉️|🕊️|🕯️|🕰️|🕳️|🕴️|🕵️|🕶️|🕷️|🕸️|🕹️|🖇️|🖊️|🖋️|🖌️|🖍️|🖐️|🖥️|🖨️|🖱️|🖲️|🖼️|🗂️|🗃️|🗄️|🗑️|🗒️|🗓️|🗜️|🗝️|🗞️|🗡️|🗣️|🗨️|🗯️|🗳️|🗺️|🛋️|🛍️|🛎️|🛏️|🛠️|🛡️|🛢️|🛣️|🛤️|🛥️|🛩️|🛰️|🛳️|©️|®️|‼️|⁉️|™️|ℹ️|↔️|↕️|↖️|↗️|↘️|↙️|↩️|↪️|⌨️|⏏️|⏭️|⏮️|⏯️|⏱️|⏲️|⏸️|⏹️|⏺️|Ⓜ️|▪️|▫️|▶️|◀️|◻️|◼️|☀️|☁️|☂️|☃️|☄️|☎️|☑️|☘️|☝️|☠️|☢️|☣️|☦️|☪️|☮️|☯️|☸️|☹️|☺️|♀️|♂️|♟️|♠️|♣️|♥️|♦️|♨️|♻️|♾️|⚒️|⚔️|⚕️|⚖️|⚗️|⚙️|⚛️|⚜️|⚠️|⚧️|⚰️|⚱️|⛈️|⛏️|⛑️|⛓️|⛩️|⛰️|⛱️|⛴️|⛷️|⛸️|⛹️|✂️|✈️|✉️|✌️|✍️|✏️|✒️|✔️|✖️|✝️|✡️|✳️|✴️|❄️|❇️|❣️|❤️|➡️|⤴️|⤵️|⬅️|⬆️|⬇️|〰️|〽️|㊗️|㊙️|[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55\u{1F004}\u{1F0CF}\u{1F18E}\u{1F191}-\u{1F19A}\u{1F201}\u{1F21A}\u{1F22F}\u{1F232}-\u{1F236}\u{1F238}-\u{1F23A}\u{1F250}\u{1F251}\u{1F300}-\u{1F320}\u{1F32D}-\u{1F335}\u{1F337}-\u{1F37C}\u{1F37E}-\u{1F393}\u{1F3A0}-\u{1F3CA}\u{1F3CF}-\u{1F3D3}\u{1F3E0}-\u{1F3F0}\u{1F3F4}\u{1F3F8}-\u{1F43E}\u{1F440}\u{1F442}-\u{1F4FC}\u{1F4FF}-\u{1F53D}\u{1F54B}-\u{1F54E}\u{1F550}-\u{1F567}\u{1F57A}\u{1F595}\u{1F596}\u{1F5A4}\u{1F5FB}-\u{1F64F}\u{1F680}-\u{1F6C5}\u{1F6CC}\u{1F6D0}-\u{1F6D2}\u{1F6D5}-\u{1F6D8}\u{1F6DC}-\u{1F6DF}\u{1F6EB}\u{1F6EC}\u{1F6F4}-\u{1F6FC}\u{1F7E0}-\u{1F7EB}\u{1F7F0}\u{1F90C}-\u{1F93A}\u{1F93C}-\u{1F945}\u{1F947}-\u{1F9FF}\u{1FA70}-\u{1FA7C}\u{1FA80}-\u{1FA8A}\u{1FA8E}-\u{1FAC6}\u{1FAC8}\u{1FACD}-\u{1FADC}\u{1FADF}-\u{1FAEA}\u{1FAEF}-\u{1FAF8}])/gu).length):n=l().createElement(l().Fragment,null,l().createElement("i",{className:"material-icons gray"},"warning_amber")," ",l().createElement("i",{className:"gray"},l().createElement(h.FormattedMessage,{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]})));return l().createElement("li",{ref:this.props.innerRef,className:e},this.props.isGroup&&this.props.response?l().createElement("div",{className:"avatar-box"},i?l().createElement(Us.A,{tinode:this.props.tinode,topic:this.props.userFrom,title:this.props.userName,avatar:s}):null):null,l().createElement("div",null,l().createElement("div",{className:t},l().createElement("div",{className:"content-meta"},l().createElement("div",{className:a},n,r),this.props.timestamp?l().createElement(ta,{edited:this.props.edited,timestamp:this.props.timestamp,received:this.props.received}):null),this.props.showContextMenu?l().createElement("span",{className:"menuTrigger"},l().createElement("a",{href:"#",onClick:this.handleContextClick},l().createElement("i",{className:"material-icons"},"expand_more"))):null),i?l().createElement("div",{className:"author"},this.props.userName||l().createElement("i",null,l().createElement(h.FormattedMessage,{id:"user_not_found",defaultMessage:[{type:0,value:"Not found"}]}))):null))}}const na=(0,h.injectIntl)(ia);var ra=l().forwardRef((e,t)=>l().createElement(na,aa({innerRef:t},e))),oa=r(504);const la=l().lazy(e=>Promise.all([r.e(537),r.e(0)]).then(r.bind(r,4e3))),ca=(0,h.defineMessages)({messaging_disabled:{id:"messaging_disabled_prompt",defaultMessage:[{type:0,value:"Messaging disabled"}]},type_new_message:{id:"new_message_prompt",defaultMessage:[{type:0,value:"New message"}]},add_image_caption:{id:"image_caption_prompt",defaultMessage:[{type:0,value:"Image caption"}]},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:[{type:0,value:"The file size "},{type:1,value:"size"},{type:0,value:" exceeds the "},{type:1,value:"limit"},{type:0,value:" limit."}]},cannot_initiate_upload:{id:"cannot_initiate_file_upload",defaultMessage:[{type:0,value:"Cannot initiate file upload."}]},icon_title_record_voice:{id:"icon_title_record_voice",defaultMessage:[{type:0,value:"Record voice message"}]},icon_title_attach_file:{id:"icon_title_attach_file",defaultMessage:[{type:0,value:"Attach file"}]},icon_title_add_image:{id:"icon_title_add_image",defaultMessage:[{type:0,value:"Add image"}]},icon_title_send:{id:"icon_title_send",defaultMessage:[{type:0,value:"Send message"}]}});class ha extends l().PureComponent{constructor(e){super(e),this.state={quote:null,message:"",audioRec:!1,audioAvailable:!(!navigator.mediaDevices||!navigator.mediaDevices.getUserMedia)},this.keypressTimestamp=0,this.handlePasteEvent=this.handlePasteEvent.bind(this),this.handleAttachImage=this.handleAttachImage.bind(this),this.handleAttachFile=this.handleAttachFile.bind(this),this.handleAttachAudio=this.handleAttachAudio.bind(this),this.handleSend=this.handleSend.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleMessageTyping=this.handleMessageTyping.bind(this),this.handleDropAttach=this.handleDropAttach.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.formatReply=this.formatReply.bind(this)}componentDidMount(){this.messageEditArea&&(this.messageEditArea.addEventListener("paste",this.handlePasteEvent,!1),"all"==window.getComputedStyle(this.messageEditArea).getPropertyValue("transition-property")&&this.messageEditArea.focus()),this.setState({quote:this.formatReply()})}componentWillUnmount(){this.messageEditArea&&this.messageEditArea.removeEventListener("paste",this.handlePasteEvent,!1)}componentDidUpdate(e){if(this.messageEditArea&&("all"==window.getComputedStyle(this.messageEditArea).getPropertyValue("transition-property")&&this.messageEditArea.focus(),this.messageEditArea.style.height="0px",this.messageEditArea.style.height=this.messageEditArea.scrollHeight+"px"),e.topicName!=this.props.topicName)this.setState({message:this.props.initMessage||"",audioRec:!1,quote:null});else if(e.initMessage!=this.props.initMessage){const e=this.props.initMessage||"";this.setState({message:e},t=>{this.messageEditArea.scrollTop=this.messageEditArea.scrollHeight,this.messageEditArea.setSelectionRange(e.length,e.length)})}e.reply!=this.props.reply&&this.setState({quote:this.formatReply()})}formatReply(){return this.props.reply?Ts.Drafty.format(this.props.reply.content,sa.NV,{formatMessage:this.props.intl.formatMessage.bind(this.props.intl),authorizeURL:this.props.tinode.authorizeURL.bind(this.props.tinode)}):null}handlePasteEvent(e){this.props.disabled||(0,Os.iJ)(e,e=>{this.props.onAttachImage(e)},e=>{this.props.onAttachFile(e)},this.props.onError)&&e.preventDefault()}handleAttachImage(e){e.target.files&&e.target.files.length>0&&this.props.onAttachImage(e.target.files[0]),e.target.value=""}handleAttachFile(e){e.target.files&&e.target.files.length>0&&this.props.onAttachFile(e.target.files[0]),e.target.value=""}handleDropAttach(e){e&&e.length>0&&this.props.onAttachFile(e[0])}handleAttachAudio(e,t,s){this.setState({audioRec:!1}),this.props.onAttachAudio(e,t,s)}handleSend(e){e.preventDefault();const t=this.state.message.trim();(t||this.props.acceptBlank||this.props.noInput)&&(this.props.onSendMessage(t),this.setState({message:""}))}handleKeyPress(e){if(this.state.audioRec)return e.preventDefault(),void e.stopPropagation();"Enter"===e.key&&("plain"==this.props.sendOnEnter?e.shiftKey||(e.preventDefault(),e.stopPropagation(),this.handleSend(e)):(e.ctrlKey||e.metaKey)&&(e.preventDefault(),e.stopPropagation(),this.handleSend(e)))}handleMessageTyping(e){if(this.setState({message:e.target.value}),this.props.onKeyPress){const e=(new Date).getTime();e-this.keypressTimestamp>ks.NR&&(this.props.onKeyPress(),this.keypressTimestamp=e)}}handleQuoteClick(e){if(e.preventDefault(),e.stopPropagation(),this.props.reply&&this.props.onQuoteClick){const e=this.props.reply.seq;this.props.onQuoteClick(e)}}render(){const{formatMessage:e}=this.props.intl,t=this.props.disabled?e(ca.messaging_disabled):this.props.messagePrompt?e(ca[this.props.messagePrompt]):e(ca.type_new_message),s=this.props.reply&&this.props.reply.editing?"check_circle":"send",a=this.state.quote?l().createElement("div",{id:"reply-quote-preview"},l().createElement("div",{className:"cancel"},l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onCancelReply()}},l().createElement("i",{className:"material-icons gray"},"close"))),this.state.quote):null,i=this.state.audioAvailable&&this.props.onAttachAudio;return l().createElement("div",{id:"send-message-wrapper"},this.props.noInput?null:a,l().createElement("div",{id:"send-message-panel"},this.props.disabled?l().createElement("div",{id:"writing-disabled"},t):l().createElement(l().Fragment,null,this.props.onAttachFile&&!this.state.audioRec?l().createElement(l().Fragment,null,l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.attachImage.click()},title:e(ca.icon_title_add_image)},l().createElement("i",{className:"material-icons secondary"},"photo")),l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.attachFile.click()},title:e(ca.icon_title_attach_file)},l().createElement("i",{className:"material-icons secondary"},"attach_file"))):null,this.props.noInput?a||l().createElement("div",{className:"hr thin"}):this.state.audioRec?l().createElement(o.Suspense,{fallback:l().createElement("div",null,l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(la,{onRecordingProgress:e=>this.props.onKeyPress(!0),onDeleted:e=>this.setState({audioRec:!1}),onFinished:this.handleAttachAudio})):l().createElement("textarea",{id:"send-message-input",placeholder:t,value:this.state.message,onChange:this.handleMessageTyping,onKeyDown:this.handleKeyPress,ref:e=>{this.messageEditArea=e}}),this.state.message||!i?l().createElement("a",{href:"#",onClick:this.handleSend,title:e(ca.icon_title_send)},l().createElement("i",{className:"material-icons"},s)):this.state.audioRec?null:l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.setState({audioRec:!0})},title:e(ca.icon_title_record_voice)},l().createElement("i",{className:"material-icons"},"mic")),l().createElement("input",{type:"file",ref:e=>{this.attachFile=e},onChange:this.handleAttachFile,style:{display:"none"}}),l().createElement("input",{type:"file",ref:e=>{this.attachImage=e},accept:"image/*, video/*",onChange:this.handleAttachImage,style:{display:"none"}}))))}}var da=(0,h.injectIntl)(ha);class pa extends l().PureComponent{constructor(e){super(e),this.handleSendDoc=this.handleSendDoc.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()}handleSendDoc(e){this.props.onClose(),this.props.onSendMessage(this.props.content.file)}render(){return this.props.content?l().createElement("div",{id:"image-preview"},l().createElement("div",{id:"image-preview-caption-panel"},l().createElement("span",null,this.props.content.name),l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()}},l().createElement("i",{className:"material-icons gray"},"close"))),l().createElement("div",{id:"image-preview-container"},l().createElement("div",{className:"doc-card"},l().createElement("i",{className:"material-icons gray"},function(e){const t={default:"insert_drive_file",image:"image",text:"description",video:"theaters"};return t[e]||t[(e||"").split("/")[0]]||t.default}(this.props.content.type)),l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_file_name",defaultMessage:[{type:0,value:"File name:"}]}))," ",(0,js.Tu)(this.props.content.name,24)||"-"),l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_content_type",defaultMessage:[{type:0,value:"Content type:"}]}))," ",this.props.content.type||"application/octet-stream"),l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_size",defaultMessage:[{type:0,value:"Size:"}]}))," ",(0,js.lX)(this.props.content.size)))),l().createElement(da,{noInput:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendDoc,onError:this.props.onError})):null}}var ua=r(1334);class ma extends l().Component{constructor(e){super(e)}render(){const e=[],t=(this.props.subscribers||[]).length,s=Math.min(ks.DT,t);return(this.props.subscribers||[]).some(t=>(e.push(l().createElement("div",{className:"avatar-box",key:t.user},l().createElement(Us.A,{tinode:this.props.tinode,topic:t.user,avatar:(0,Os.to)(t.public?t.public.photo:null)||!0,title:t.public?t.public.fn:null}))),e.length==s)),0==e.length?null:l().createElement("div",{id:"topic-users"},e," ",t>s?l().createElement("span",null,l().createElement(h.FormattedMessage,{id:"more_online_members",defaultMessage:[{type:0,value:"+"},{type:1,value:"overflow"},{type:0,value:" more"}],values:{overflow:t-s}})):null)}}class ga extends l().PureComponent{constructor(e){super(e),this.state={width:0,height:0},this.handleSendImage=this.handleSendImage.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}handleKeyDown(e){this.props.onSendMessage||(e.preventDefault(),"Escape"===e.key&&this.props.onClose())}assignWidth(e){if(e&&!this.state.width){const t=e.getBoundingClientRect();this.setState({width:0|t.width,height:0|t.height})}}handleSendImage(e){this.props.onClose(),this.props.onSendMessage(e,this.props.content.blob)}render(){if(!this.props.content)return null;const e=(0,Os.ae)(this.props.content.width,this.props.content.height,this.state.width,this.state.height,!1),t=e?{width:e.dstWidth+"px",height:e.dstHeight+"px"}:this.props.content.width>this.props.content.height?{width:"100%"}:{height:"100%"};t.maxWidth="100%",t.maxHeight="100%";const s=Math.max((this.state.width/ks.JS/1.5|0)-2,12),a=(0,js.Tu)(this.props.content.filename,s)||"-",i=this.props.content.width||"-",n=this.props.content.height||"-",r=(0,Xs.FH)(this.props.content.url);return l().createElement("div",{id:"image-preview"},l().createElement("div",{id:"image-preview-caption-panel"},this.props.onSendMessage?l().createElement("span",null,a):l().createElement("a",{href:r,download:this.props.content.filename},l().createElement("i",{className:"material-icons"},"file_download")," ",l().createElement(h.FormattedMessage,{id:"download_action",defaultMessage:[{type:0,value:"download"}]})),l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()}},l().createElement("i",{className:"material-icons gray"},"close"))),l().createElement("div",{id:"image-preview-container",ref:e=>this.assignWidth(e)},l().createElement("img",{src:this.props.content.url,style:t,className:"image-preview",alt:this.props.content.filename})),this.props.onSendMessage?l().createElement(da,{messagePrompt:"add_image_caption",acceptBlank:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendImage,onError:this.props.onError}):l().createElement("div",{id:"image-preview-footer"},l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_file_name",defaultMessage:[{type:0,value:"File name:"}]}))),l().createElement("div",null,l().createElement("span",{title:this.props.content.filename},a))),l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_content_type",defaultMessage:[{type:0,value:"Content type:"}]}))),l().createElement("div",null,this.props.content.type)),l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_size",defaultMessage:[{type:0,value:"Size:"}]}))),l().createElement("div",null,i," × ",n," px; ",(0,js.lX)(this.props.content.size)))))}}class fa extends l().PureComponent{constructor(e){super(e),this.handleButtonAction=this.handleButtonAction.bind(this)}handleButtonAction(e,t){e.preventDefault(),this.props.onAction(t)}render(){return l().createElement("div",{className:"accept-invite-panel"},l().createElement("div",{className:"title"},l().createElement(h.FormattedMessage,{id:"chat_invitation",defaultMessage:[{type:0,value:"You are invited to start a new chat. What would you like to do?"}]})),l().createElement("div",{className:"footer"},l().createElement("button",{className:"primary",onClick:e=>{this.handleButtonAction(e,"accept")}},l().createElement(h.FormattedMessage,{id:"chat_invitation_accept",defaultMessage:[{type:0,value:"Accept"}]})),l().createElement("button",{className:"secondary",onClick:e=>{this.handleButtonAction(e,"delete")}},l().createElement(h.FormattedMessage,{id:"chat_invitation_ignore",defaultMessage:[{type:0,value:"Ignore"}]})),l().createElement("button",{className:"secondary",onClick:e=>{this.handleButtonAction(e,"block")}},l().createElement(h.FormattedMessage,{id:"chat_invitation_block",defaultMessage:[{type:0,value:"Block"}]}))))}}var va=r(1013);class ba extends l().PureComponent{render(){const e=ks.C3+" ("+Ts.Tinode.getLibrary()+")";return l().createElement("div",{id:"dummy-view"},l().createElement("div",null,l().createElement("a",{href:"https://github.com/tinode/chat/"},l().createElement("img",{id:"logo",alt:"logo",src:"img/logo.svg"}),l().createElement("h2",null,"Tinode Web")),l().createElement("p",null,l().createElement(h.FormattedMessage,{id:"label_client",defaultMessage:[{type:0,value:"Client:"}]})," ",e),l().createElement("p",null,l().createElement(h.FormattedMessage,{id:"label_server",defaultMessage:[{type:0,value:"Server:"}]})," ",this.props.serverVersion," (",this.props.serverAddress,")")))}}class Ea extends l().PureComponent{constructor(e){super(e)}render(){let e=null,t="bubble";return this.props.date&&(e=l().createElement(l().Fragment,null,this.props.date),t+=" date"),e?l().createElement("li",{className:"meta"},l().createElement("div",{className:t},l().createElement("div",{className:"message-content"},e))):l().createElement(l().Fragment,null,null)}}const ya=(0,h.defineMessages)({message_not_found:{id:"message_not_found",defaultMessage:[{type:0,value:"message not found"}]},message_deleted:{id:"message_deleted",defaultMessage:[{type:0,value:"message deleted"}]}});class wa extends l().PureComponent{constructor(e){super(e),this.touchX=null,this.touchY=null,this.touchSurface=l().createRef(),this.getSelectedIndex=this.getSelectedIndex.bind(this),this.handleCancel=this.handleCancel.bind(this),this.handleSelected=this.handleSelected.bind(this),this.handleMoveNext=this.handleMoveNext.bind(this),this.handleMovePrev=this.handleMovePrev.bind(this),this.handleTouchEventStart=this.handleTouchEventStart.bind(this),this.handleTouchEventEnd=this.handleTouchEventEnd.bind(this),this.handleTouchCancel=this.handleTouchCancel.bind(this)}componentDidMount(){this.touchSurface.current.addEventListener("touchstart",this.handleTouchEventStart,{passive:!0}),this.touchSurface.current.addEventListener("touchend",this.handleTouchEventEnd,{passive:!0}),this.touchSurface.current.addEventListener("touchcancel",this.handleTouchCancel,{passive:!0})}componentWillUnmount(){this.touchSurface.current.removeEventListener("touchstart",this.handleTouchEventStart),this.touchSurface.current.removeEventListener("touchend",this.handleTouchEventEnd),this.touchSurface.current.removeEventListener("touchcancel",this.handleTouchCancel)}getSelectedIndex(){return(this.props.pins||[]).length-this.props.selected-1}handleCancel(e){e.preventDefault(),this.props.onCancel(this.props.pins[this.getSelectedIndex()])}handleSelected(e){e.preventDefault(),this.props.onSelected(this.props.pins[this.getSelectedIndex()])}handleMoveNext(e,t){t||e.preventDefault(),e.stopPropagation();const s=Math.max(this.props.selected-1,0);s!=this.props.selected&&this.props.setSelected(s)}handleMovePrev(e,t){t||e.preventDefault(),e.stopPropagation();const s=Math.min(this.props.selected+1,(this.props.pins||[]).length-1);s!=this.props.selected&&this.props.setSelected(s)}handleTouchEventStart(e){1==e.touches.length&&(this.touchX=e.touches[0].clientX,this.touchY=e.touches[0].clientY)}handleTouchEventEnd(e){if(null===this.touchX||1!=e.changedTouches.length)return void(this.touchX=null);const t=this.touchX-e.changedTouches[0].clientX,s=this.touchY-e.changedTouches[0].clientY;this.touchX=null,Math.abs(t)>Math.abs(s)||Math.abs(s)<ks.yS||(s>0?this.handleMovePrev(e,!0):this.handleMoveNext(e,!0))}handleTouchCancel(){this.touchX=null}render(){const e=this.getSelectedIndex();let t=(this.props.messages||[])[e];t=t?t._deleted?l().createElement("i",{className:"gray"},this.props.intl.formatMessage(ya.message_deleted)):Ts.Drafty.format(t.content,sa.TU,{formatMessage:this.props.intl.formatMessage.bind(this.props.intl),authorizeURL:this.props.tinode.authorizeURL.bind(this.props.tinode)}):l().createElement("i",{className:"gray"},this.props.intl.formatMessage(ya.message_not_found));const s=[];return this.props.pins.forEach(t=>{const a=s.length==e?"adot":"dot";s.push(l().createElement("div",{key:t,className:a}))}),l().createElement("div",{id:"pinned-wrapper",ref:this.touchSurface},this.props.isAdmin?l().createElement("div",{className:"cancel"},l().createElement("a",{href:"#",onClick:this.handleCancel},l().createElement("i",{className:"material-icons gray"},"close"))):l().createElement("div",null,l().createElement("i",{className:"material-icons gray"},"push_pin")),l().createElement("div",{className:"pinned-scroll"},s),l().createElement("div",{className:"pinned",onClick:this.handleSelected},l().createElement("p",null,t)),l().createElement("div",{className:"pinned-menu"},l().createElement("span",{className:"menuTrigger upper"},e>0?l().createElement("a",{href:"#",onClick:this.handleMovePrev},l().createElement("i",{className:"material-icons"},"expand_less")):null),l().createElement("span",{className:"menuTrigger lower"},this.props.selected>0?l().createElement("a",{href:"#",onClick:this.handleMoveNext},l().createElement("i",{className:"material-icons"},"expand_more")):null)))}}var Ca=(0,h.injectIntl)(wa);const Sa=(0,h.defineMessages)({unrecognized_video_format:{id:"unrecognized_video_format",defaultMessage:[{type:0,value:"Format of this video is not recognized"}]}});class Ma extends l().PureComponent{constructor(e){super(e),this.videoRef=l().createRef(),this.handleSendVideo=this.handleSendVideo.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}componentDidMount(){document.addEventListener("keydown",this.handleKeyDown)}componentWillUnmount(){document.removeEventListener("keydown",this.handleKeyDown)}handleKeyDown(e){this.props.onSendMessage||(e.preventDefault(),"Escape"===e.key&&this.props.onClose())}handleSendVideo(e){this.props.onClose();const t={width:this.videoRef.current.videoWidth,height:this.videoRef.current.videoHeight,duration:1e3*this.videoRef.current.duration|0,mime:this.props.content.mime,name:this.props.content.filename};if(0==t.width||0==t.height)return void this.props.onError(this.props.intl.formatMessage(Sa.unrecognized_video_format),"err");const s=document.createElement("canvas");s.width=t.width,s.height=t.height;const a=s.getContext("2d");a.drawImage(this.videoRef.current,0,0,s.width,s.height),a.canvas.toBlob(s=>this.props.onSendMessage(e,this.props.content.blob,s,t),"image/jpeg",.75)}render(){if(!this.props.content)return null;const e=this.props.content.width||"-",t=this.props.content.height||"-",s=this.props.onSendMessage?"nodownload":"",a=!this.props.onSendMessage;return l().createElement("div",{id:"image-preview"},l().createElement("div",{id:"image-preview-caption-panel"},l().createElement("span",null,this.props.content.filename),l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onClose()}},l().createElement("i",{className:"material-icons gray"},"close"))),l().createElement("div",{id:"image-preview-container"},l().createElement("video",{className:"image-preview",controls:!0,controlsList:s,disablePictureInPicture:!0,ref:this.videoRef,autoPlay:a,src:this.props.tinode.authorizeURL(this.props.content.url),poster:this.props.content.preview,alt:this.props.content.filename})),this.props.onSendMessage?l().createElement(da,{messagePrompt:"add_image_caption",acceptBlank:!0,tinode:this.props.tinode,reply:this.props.reply,onCancelReply:this.props.onCancelReply,onSendMessage:this.handleSendVideo,onError:this.props.onError}):l().createElement("div",{id:"image-preview-footer"},l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_file_name",defaultMessage:[{type:0,value:"File name:"}]}))),l().createElement("div",null,l().createElement("span",{title:this.props.content.filename},this.props.content.filename))),l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_content_type",defaultMessage:[{type:0,value:"Content type:"}]}))),l().createElement("div",null,this.props.content.type)),l().createElement("div",null,l().createElement("div",null,l().createElement("b",null,l().createElement(h.FormattedMessage,{id:"label_size",defaultMessage:[{type:0,value:"Size:"}]}))),l().createElement("div",null,e," × ",t," px; ",(0,js.lX)(this.props.content.size)))))}}var _a=(0,h.injectIntl)(Ma),Ta=r(7151);const Aa=(0,h.defineMessages)({online_now:{id:"online_now",defaultMessage:[{type:0,value:"online now"}]},last_seen:{id:"last_seen_timestamp",defaultMessage:[{type:0,value:"Last seen: "},{type:1,value:"timestamp"}]},not_found:{id:"title_not_found",defaultMessage:[{type:0,value:"Not found"}]},channel:{id:"channel",defaultMessage:[{type:0,value:"channel"}]},file_attachment_too_large:{id:"file_attachment_too_large",defaultMessage:[{type:0,value:"The file size "},{type:1,value:"size"},{type:0,value:" exceeds the "},{type:1,value:"limit"},{type:0,value:" limit."}]},invalid_content:{id:"invalid_content",defaultMessage:[{type:0,value:"invalid content"}]},editing_message:{id:"editing_message",defaultMessage:[{type:0,value:"Editing"}]},drag_file:{id:"drag_file",defaultMessage:[{type:0,value:"Drag file here"}]},self_topic_name:{id:"self_topic_name",defaultMessage:[{type:0,value:"Saved messages"}]},subscriber_count:{id:"subscriber_count",defaultMessage:[{type:6,value:"count",options:{one:{value:[{type:2,value:"count",style:null},{type:0,value:" subscriber"}]},two:{value:[{type:2,value:"count",style:null},{type:0,value:" subscribers"}]},three:{value:[{type:2,value:"count",style:null},{type:0,value:" subscribers"}]},few:{value:[{type:2,value:"count",style:null},{type:0,value:" subscribers"}]},many:{value:[{type:2,value:"count",style:null},{type:0,value:" subscribers"}]},other:{value:[{type:2,value:"count",style:null},{type:0,value:" subscribers"}]}},offset:0,pluralType:"cardinal"}]},member_count:{id:"member_count",defaultMessage:[{type:6,value:"count",options:{one:{value:[{type:2,value:"count",style:null},{type:0,value:" member"}]},two:{value:[{type:2,value:"count",style:null},{type:0,value:" members"}]},three:{value:[{type:2,value:"count",style:null},{type:0,value:" members"}]},few:{value:[{type:2,value:"count",style:null},{type:0,value:" members"}]},many:{value:[{type:2,value:"count",style:null},{type:0,value:" members"}]},other:{value:[{type:2,value:"count",style:null},{type:0,value:" members"}]}},offset:0,pluralType:"cardinal"}]}});function ka(e){if(e){const t=e.getExcessive()||"";return e.isJoiner("given")&&(t.includes("R")||t.includes("W"))}return!1}function Na(e){if(e){const t=e.getMissing()||"";return e.isJoiner("want")&&(t.includes("R")||t.includes("W"))}return!1}function Da(e){return 1==e||3==e}class Ia extends l().Component{constructor(e){super(e),this.state=Ia.getDerivedStateFromProps(e,{}),this.componentSetup=this.componentSetup.bind(this),this.leave=this.leave.bind(this),this.sendMessage=this.sendMessage.bind(this),this.retrySend=this.retrySend.bind(this),this.sendImageAttachment=this.sendImageAttachment.bind(this),this.sendVideoAttachment=this.sendVideoAttachment.bind(this),this.sendFileAttachment=this.sendFileAttachment.bind(this),this.sendAudioAttachment=this.sendAudioAttachment.bind(this),this.sendKeyPress=this.sendKeyPress.bind(this),this.subscribe=this.subscribe.bind(this),this.handleScrollReference=this.handleScrollReference.bind(this),this.mountDnDEvents=this.mountDnDEvents.bind(this),this.handleScrollEvent=this.handleScrollEvent.bind(this),this.handleDescChange=this.handleDescChange.bind(this),this.handleSubsUpdated=this.handleSubsUpdated.bind(this),this.handleMessageUpdate=this.handleMessageUpdate.bind(this),this.handleAuxUpdate=this.handleAuxUpdate.bind(this),this.handleAllMessagesReceived=this.handleAllMessagesReceived.bind(this),this.handleInfoReceipt=this.handleInfoReceipt.bind(this),this.handleExpandMedia=this.handleExpandMedia.bind(this),this.handleClosePreview=this.handleClosePreview.bind(this),this.handleCallPanelToggle=this.handleCallPanelToggle.bind(this),this.handleFormResponse=this.handleFormResponse.bind(this),this.handleContextClick=this.handleContextClick.bind(this),this.handleShowMessageContextMenu=this.handleShowMessageContextMenu.bind(this),this.handleNewChatAcceptance=this.handleNewChatAcceptance.bind(this),this.handleEnablePeer=this.handleEnablePeer.bind(this),this.handleAttachFile=this.handleAttachFile.bind(this),this.handleAttachImageOrVideo=this.handleAttachImageOrVideo.bind(this),this.handleCancelUpload=this.handleCancelUpload.bind(this),this.postReadNotification=this.postReadNotification.bind(this),this.clearNotificationQueue=this.clearNotificationQueue.bind(this),this.goToLatestMessage=this.goToLatestMessage.bind(this),this.handleFileDrop=this.handleFileDrop.bind(this),this.handlePickReply=this.handlePickReply.bind(this),this.handleEditMessage=this.handleEditMessage.bind(this),this.handleCancelReply=this.handleCancelReply.bind(this),this.handleQuoteClick=this.handleQuoteClick.bind(this),this.handleUnpinMessage=this.handleUnpinMessage.bind(this),this.handleCallHangup=this.handleCallHangup.bind(this),this.isDragEnabled=this.isDragEnabled.bind(this),this.handleDragStart=this.handleDragStart.bind(this),this.handleDragIn=this.handleDragIn.bind(this),this.handleDragOut=this.handleDragOut.bind(this),this.handleDrag=this.handleDrag.bind(this),this.handleDrop=this.handleDrop.bind(this),this.chatMessageRefs=[],this.getOrCreateMessageRef=this.getOrCreateMessageRef.bind(this),this.getVisibleMessageRange=this.getVisibleMessageRange.bind(this),this.dragCounter=0,this.dndRef=null,this.readNotificationQueue=[],this.readNotificationTimer=null,this.keyPressTimer=null}getOrCreateMessageRef(e){if(this.chatMessageRefs[e])return this.chatMessageRefs[e];const t=l().createRef();return this.chatMessageRefs[e]=t,t}getVisibleMessageRange(e){let t=Number.MAX_SAFE_INTEGER,s=-1,a=!1;return this.chatMessageRefs.every((i,n)=>{if(i.current){const{top:r,bottom:o,height:l}=i.current.getBoundingClientRect();if(r<=e.top?e.top-r<=l:o-e.bottom<=l)a=!0,t=Math.min(t,n),s=Math.max(s,n);else if(a)return!1}return!0}),s>=t?{min:t,max:s}:{min:0,max:0}}componentDidMount(){this.messagesScroller&&this.messagesScroller.addEventListener("scroll",this.handleScrollEvent),this.mountDnDEvents(this.dndRef),this.componentSetup({},{})}componentWillUnmount(){this.messagesScroller&&this.messagesScroller.removeEventListener("scroll",this.handleScrollEvent),this.clearNotificationQueue(),this.dndRef&&(this.dndRef.removeEventListener("dragstart",this.handleDragStart),this.dndRef.removeEventListener("dragenter",this.handleDragIn),this.dndRef.removeEventListener("dragleave",this.handleDragOut),this.dndRef.removeEventListener("dragover",this.handleDrag),this.dndRef.removeEventListener("drop",this.handleDrop))}componentDidUpdate(e,t){!this.messagesScroller||t.topic==this.state.topic&&t.maxSeqId==this.state.maxSeqId&&t.minSeqId==this.state.minSeqId||this.state.scrollPosition<100&&(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition-this.messagesScroller.offsetHeight),this.props.applicationVisible?this.postReadNotification(0):this.clearNotificationQueue(),this.componentSetup(e,t)}componentSetup(e,t){const s=this.props.tinode?this.props.tinode.getTopic(this.state.topic):void 0;if(this.state.topic!=t.topic&&(t.topic&&!Ts.Tinode.isNewGroupTopicName(t.topic)&&(this.leave(t.topic),t.rtcPanel&&this.handleCallHangup(t.topic,e.callSeq)),s&&(s.onData=this.handleMessageUpdate,s.onAllMessagesReceived=this.handleAllMessagesReceived,s.onInfo=this.handleInfoReceipt,s.onMetaDesc=this.handleDescChange,s.onSubsUpdated=this.handleSubsUpdated,s.onPres=this.handleSubsUpdated,s.onAuxUpdated=this.handleAuxUpdate)),s)if(this.state.topic!=t.topic||this.props.myUserId&&!e.myUserId){const e=this.props.newTopicParams&&this.props.newTopicParams._topicName==this.props.topic;s.isP2PType()&&e&&!ks.rl?s.getMeta(s.startMetaQuery().withDesc().build()):this.props.myUserId&&this.subscribe(s)}else s.isSubscribed()&&this.state.isReader&&!t.isReader&&s.getMeta(s.startMetaQuery().withLaterData().build())}static getDerivedStateFromProps(e,t){let s={};if(e.topic)if(e.topic!=t.topic){const a=e.tinode.getTopic(e.topic);if(s={topic:e.topic,deleted:a._deleted,docPreview:null,imagePreview:null,imagePostview:null,videoPreview:null,videoPostview:null,rtcPanel:null,minimizedCallPanel:!1,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1,showGoToLastButton:!1,contentToEdit:null,dragging:!1,selectedPin:0},e.forwardMessage?s.reply={content:e.forwardMessage.preview,seq:null}:s.reply=null,a){const i=[];e.connected&&a.subscribers(t=>{t.online&&t.user!=e.myUserId&&i.push(t)}),Object.assign(s,{onlineSubs:i}),a.isSelfType()?Object.assign(s,{title:e.intl.formatMessage(Aa.self_topic_name),avatar:!0}):a.public?Object.assign(s,{title:a.public.fn,avatar:(0,Os.to)(a.public.photo)}):Object.assign(s,{title:"",avatar:null});const n=a.p2pPeerDesc();n?Object.assign(s,{peerMessagingDisabled:Na(n.acs)}):t.peerMessagingDisabled&&Object.assign(s,{peerMessagingDisabled:!1}),Object.assign(s,{minSeqId:a.minMsgSeq(),maxSeqId:a.maxMsgSeq(),latestClearId:a.maxClearId(),channel:a.isChannelType(),pins:(a.aux("pins")||[]).slice(),pinsLoaded:!1}),e.callTopic==a.name&&Da(e.callState)&&(s.rtcPanel=e.callTopic)}else Object.assign(s,{minSeqId:-1,maxSeqId:-1,latestClearId:-1,onlineSubs:[],title:"",avatar:null,peerMessagingDisabled:!1,channel:!1,pins:[],pinsLoaded:!1})}else e.callTopic==t.topic&&!t.rtcPanel&&Da(e.callState)&&(s.rtcPanel=e.callTopic);else s={minSeqId:-1,maxSeqId:-1,latestClearId:-1,onlineSubs:[],topic:null,title:"",avatar:null,isVerified:!1,isStaff:!1,isDangerous:!1,deleted:!1,docPreview:null,imagePreview:null,imagePostview:null,videoPreview:null,videoPostview:null,rtcPanel:null,minimizedCallPanel:!1,typingIndicator:!1,scrollPosition:0,fetchingMessages:!1,peerMessagingDisabled:!1,channel:!1,reply:null,contentToEdit:null,showGoToLastButton:!1,dragging:!1,pins:[],pinsLoaded:!1,selectedPin:0,subsVersion:0};return e.acs?(e.acs.isWriter()!=t.isWriter&&(s.isWriter=!t.isWriter),e.acs.isReader()!=t.isReader&&(s.isReader=!t.isReader),e.acs.isAdmin()!=t.isAdmin&&(s.isAdmin=!t.isAdmin),!e.acs.isReader("given")!=t.readingBlocked&&(s.readingBlocked=!t.readingBlocked),e.acs.isSharer()!=t.isSharer&&(s.isSharer=!t.isSharer)):(t.isWriter&&(s.isWriter=!1),t.isReader&&(s.isReader=!1),t.isAdmin&&(s.isAdmin=!1),t.readingBlocked||(t.readingBlocked=!0),t.isSharer&&(s.isSharer=!1)),ka(e.acs)==!t.unconformed&&(s.unconfirmed=!t.unconformed),!e.connected&&t.onlineSubs&&t.onlineSubs.length>0&&(s.onlineSubs=[]),s}subscribe(e){if(e.isSubscribed()||!this.props.ready)return;const t=this.props.newTopicParams&&this.props.newTopicParams._topicName==this.props.topic;let s=e.startMetaQuery().withLaterDesc().withLaterSub().withAux();(this.state.isReader||t)&&(s=s.withLaterData(ks.H1),this.state.isReader&&(s=s.withLaterDel()),this.setState({fetchingMessages:!0}));const a=t?this.props.newTopicParams:void 0;e.subscribe(s.build(),a).then(t=>{if(303==t.code)return void Ta.A.navigateTo(Ta.A.setUrlTopic("",t.params.topic));this.state.topic!=t.topic&&this.setState({topic:t.topic}),this.state.deleted&&this.setState({deleted:!1}),this.props.onNewTopicCreated(this.props.topic,t.topic);let s=[];e.queuedMessages(t=>{t._sending||(t._fatal||t.head&&t.head.webrtc?s.push(t.seq):e.isSubscribed()&&this.retrySend(t))}),s.length>0&&e.delMessagesList(s,!0)}).catch(e=>{console.error("Failed subscription to",this.state.topic,e),this.props.onError(e.message,"err");const t=Ia.getDerivedStateFromProps({},{});t.title=this.props.intl.formatMessage(Aa.not_found),this.setState(t)})}leave(e){if(!e||!this.props.tinode.isTopicCached(e))return;const t=this.props.tinode.getTopic(e);t&&t.isSubscribed()&&t.leave(!1).catch(e=>{}).finally(e=>{this.setState({fetchingMessages:!1}),t.onData=void 0,t.onAllMessagesReceived=void 0,t.onInfo=void 0,t.onMetaDesc=void 0,t.onSubsUpdated=void 0,t.onPres=void 0,t.onAuxUpdated=void 0})}handleScrollReference(e){e&&(e.addEventListener("scroll",this.handleScrollEvent),this.messagesScroller=e,this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition-this.messagesScroller.offsetHeight)}handleScrollEvent(e){const t=e.target.scrollHeight-e.target.scrollTop-e.target.offsetHeight;if(this.setState({scrollPosition:t,showGoToLastButton:t>100&&t<this.state.scrollPosition}),!this.state.fetchingMessages&&!this.processingScrollEvent){if(e.target.scrollTop<=40){const t=this.props.tinode.getTopic(this.state.topic);if(t&&t.isSubscribed()){this.processingScrollEvent=!0;const{min:s,max:a}=this.getVisibleMessageRange(e.target.getBoundingClientRect()),i=t.msgHasMoreMessages(s,a,!1);i.length>0&&this.setState({fetchingMessages:!0},e=>{t.getMessagesPage(ks.H1,i,s,a).catch(e=>this.props.onError(e.message,"err")).finally(e=>this.setState({fetchingMessages:!1}))})}}this.processingScrollEvent=!1}}mountDnDEvents(e){e&&(e.addEventListener("dragstart",this.handleDragStart),e.addEventListener("dragenter",this.handleDragIn),e.addEventListener("dragleave",this.handleDragOut),e.addEventListener("dragover",this.handleDrag),e.addEventListener("drop",this.handleDrop),this.dndRef=e)}goToLatestMessage(){this.setState({scrollPosition:0}),this.messagesScroller&&(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.messagesScroller.offsetHeight)}handleDescChange(e){Ts.Tinode.isSelfTopicName(this.props.topic)?this.setState({title:this.props.intl.formatMessage(Aa.self_topic_name),avatar:!0}):e.public?this.setState({title:e.public.fn,avatar:(0,Os.to)(e.public.photo)}):this.setState({title:"",avatar:null}),e.acs&&this.setState({isWriter:e.acs.isWriter(),isReader:e.acs.isReader(),isAdmin:e.acs.isAdmin(),readingBlocked:!e.acs.isReader("given"),unconfirmed:ka(e.acs)})}postReadNotification(e){if(!this.props.applicationVisible||!this.state.topic)return;this.readNotificationTimer||(this.readNotificationTimer=setInterval(e=>{if(0==this.readNotificationQueue.length)return clearInterval(this.readNotificationTimer),void(this.readNotificationTimer=null);let t=-1;for(;this.readNotificationQueue.length>0;){const e=this.readNotificationQueue[0];if(e.topicName!=this.state.topic){this.readNotificationQueue.shift();continue}const s=new Date;if(!(e.sendAt<=s))break;this.readNotificationQueue.shift(),(0==e.seq||Ts.Tinode.isServerAssignedSeq(e.seq))&&(t=Math.max(t,e.seq))}if(t>=0){const e=this.props.tinode.getTopic(this.state.topic);if(e)try{e.noteRead(t)}catch(e){console.error("Failed to send read notification",e)}}},300));const t=new Date;this.readNotificationQueue.push({topicName:this.state.topic,seq:e,sendAt:t.setMilliseconds(t.getMilliseconds()+ks.J)})}clearNotificationQueue(){this.readNotificationQueue=[],this.readNotificationTimer&&(clearInterval(this.readNotificationTimer),this.readNotificationTimer=null)}handleSubsUpdated(){if(this.state.topic){const e=[],t=this.props.tinode.getTopic(this.state.topic);t.subscribers(t=>{t.online&&t.user!=this.props.myUserId&&e.push(t)});const s={onlineSubs:e,subsVersion:this.state.subsVersion+1},a=t.p2pPeerDesc();a?Object.assign(s,{peerMessagingDisabled:Na(a.acs)}):this.state.peerMessagingDisabled&&Object.assign(s,{peerMessagingDisabled:!1}),this.setState(s)}}handleMessageUpdate(e){if(!this.state.topic)return;const t=this.props.tinode.getTopic(this.state.topic);if(!e)return void this.setState({latestClearId:t.maxClearId()});clearTimeout(this.keyPressTimer),this.setState({maxSeqId:t.maxMsgSeq(),minSeqId:t.minMsgSeq(),typingIndicator:!1},s=>{t.isNewMessage(e.seq)?this.state.scrollPosition>100?this.setState({showGoToLastButton:!0}):this.goToLatestMessage():this.messagesScroller&&(this.messagesScroller.scrollTop=this.messagesScroller.scrollHeight-this.state.scrollPosition-this.messagesScroller.offsetHeight)});t.msgStatus(e,!0)>=Ts.Tinode.MESSAGE_STATUS_SENT&&e.from!=this.props.myUserId&&this.postReadNotification(e.seq)}handleAllMessagesReceived(e){if(this.setState({fetchingMessages:!1}),!e){const e=this.props.tinode.getTopic(this.state.topic);return void(e&&this.postReadNotification(e.seq))}if(this.state.pinsLoaded)this.setState({pinsLoaded:!1});else{const e=this.props.tinode.getTopic(this.state.topic);this.setState({pinsLoaded:!0},t=>{e.getPinnedMessages()})}}handleAuxUpdate(e){const t=(e.pins||[]).slice();let s=this.state.selectedPin;t.length>this.state.pins.length?s=0:s>=t.length&&(s=Math.max(0,t.length-1)),this.setState({pins:t,selectedPin:s})}handleInfoReceipt(e){switch(e.what){case"kp":clearTimeout(this.keyPressTimer),this.keyPressTimer=setTimeout(e=>this.setState({typingIndicator:!1}),ks.NR+1e3),this.state.typingIndicator||this.setState({typingIndicator:!0});break;case"read":case"recv":this.forceUpdate();break;default:console.info("Other change in topic: ",e.what)}}handleExpandMedia(e){e&&(e.video?this.setState({videoPostview:e}):this.setState({imagePostview:e}))}handleClosePreview(){this.state.imagePreview&&this.state.imagePreview.url&&URL.revokeObjectURL(this.state.imagePreview.url),this.state.videoPreview&&this.state.videoPreview.url&&URL.revokeObjectURL(this.state.videoPreview.url),this.setState({imagePostview:null,imagePreview:null,docPreview:null,videoPreview:null,videoPostview:null})}handleFormResponse(e,t,s){if("pub"==e)this.sendMessage(Ts.Drafty.attachJSON(Ts.Drafty.parse(t),s));else if("url"==e){const e=new URL(s.ref),t=e.searchParams;for(let e in s.resp)s.resp.hasOwnProperty(e)&&t.set(e,s.resp[e]);["name","seq"].forEach(e=>{s[e]&&t.set(e,s[e])}),t.set("uid",this.props.myUserId),t.set("topic",this.state.topic),e.search=t,window.open(e,"_blank")}else console.info("Unknown action in form",e)}handleContextClick(e){e.preventDefault(),e.stopPropagation(),this.props.showContextMenu({topicName:this.state.topic,y:e.pageY,x:e.pageX})}handleShowMessageContextMenu(e,t){"chan"==e.userFrom&&(e.userFrom=this.state.topic,e.userName=this.state.title),e.topicName=this.state.topic;const s=t||[],a=this.props.tinode.getTopic(e.topicName);if(a)if(a.isSelfType())s.push("message_delete_generic");else{a.isChannelType()||s.push("message_delete");const t=a.getAccessMode();if(t&&t.isDeleter()){let a=t.isOwner();if(!a){const t=0|this.props.tinode.getServerParam(Ts.Tinode.MSG_DELETE_AGE,0);a=0==t||!!(t>0&&e.timestamp)&&e.timestamp.getTime()>(new Date).getTime()-1e3*t}a&&s.push("message_delete_hard")}}this.props.showContextMenu(e,s)}handleNewChatAcceptance(e){this.props.onNewChat(this.state.topic,e)}handleEnablePeer(e){e.preventDefault(),this.props.onChangePermissions(this.state.topic,ks.cZ,this.state.topic)}sendKeyPress(e){const t=this.props.tinode.getTopic(this.state.topic);t.isSubscribed()&&(e?t.noteRecording(!0):t.noteKeyPress())}sendMessage(e,t,s){let a;if(this.props.forwardMessage)e=this.props.forwardMessage.msg,a=this.props.forwardMessage.head,this.handleCancelReply();else if(this.state.reply){if(this.state.reply.editing){if(e==this.state.contentToEdit)return void this.handleCancelReply();a={replace:":"+this.state.reply.seq}}else this.state.reply.content&&(a={reply:""+this.state.reply.seq},"string"==typeof e&&(e=Ts.Drafty.parse(e)),e=Ts.Drafty.append(Ts.Drafty.sanitizeEntities(this.state.reply.content),e));this.handleCancelReply()}this.props.sendMessage(e,t,s,a)}retrySend(e){this.props.sendMessage(e.content,void 0,void 0,e.head).then(t=>{this.props.tinode.getTopic(this.state.topic).delMessagesList([e.seq],!0)})}sendFileAttachment(e){const t=.75*this.props.tinode.getServerParam("maxMessageSize",ks.mp)-1024|0,s=e=>e===ks.Uv?"application/octet-stream":e;if(e.size>t){const t=this.props.tinode.getLargeFileHelper();if(!t)return void this.props.onError(this.props.intl.formatMessage(Aa.cannot_initiate_upload));const a=t.upload(e),i=Ts.Drafty.attachFile(null,{mime:s(e.type),filename:e.name,size:e.size,urlPromise:a});this.sendMessage(i,a,t)}else(0,Os.bB)(e).then(t=>this.sendMessage(Ts.Drafty.attachFile(null,{mime:s(t.mime),data:t.bits,filename:t.name,size:e.size}))).catch(e=>this.props.onError(e.message,"err"))}handleAttachFile(e){const t=this.props.tinode.getServerParam("maxFileUploadSize",ks.qy);e.size>t?this.props.onError(this.props.intl.formatMessage(Aa.file_attachment_too_large,{size:(0,js.lX)(e.size),limit:(0,js.lX)(t)}),"err"):this.setState({docPreview:{file:e,name:e.name,size:e.size,type:e.type}})}handleCallHangup(e,t){this.props.onVideoCallClosed(),this.setState({rtcPanel:null}),this.props.onCallHangup(e,t)}handleCallPanelToggle(){this.setState({minimizedCallPanel:!this.state.minimizedCallPanel})}sendImageAttachment(e,t){const s=this.state.imagePreview.mime,a=this.state.imagePreview.width,i=this.state.imagePreview.height,n=this.state.imagePreview.filename,r=.75*this.props.tinode.getServerParam("maxMessageSize",ks.mp)-1024|0;if(t.size>r){const r=this.props.tinode.getLargeFileHelper();if(!r)return void this.props.onError(this.props.intl.formatMessage(Aa.cannot_initiate_upload));const o=r.upload(t);return void(0,Os.ag)(t,ks.wj,ks.wj,-1,!1).then(e=>(0,Os.Sk)(e.blob)).then(l=>{let c=Ts.Drafty.insertImage(null,0,{mime:s,_tempPreview:l.bits,bits:l.bits,width:a,height:i,filename:n,size:t.size,urlPromise:o});e&&(c=Ts.Drafty.appendLineBreak(c),c=Ts.Drafty.append(c,Ts.Drafty.parse(e))),this.sendMessage(c,o,r)}).catch(e=>this.props.onError(e,"err"))}(0,Os.Sk)(t).then(s=>{let r=Ts.Drafty.insertImage(null,0,{mime:s.mime,bits:s.bits,width:a,height:i,filename:n,size:t.size});e&&(r=Ts.Drafty.appendLineBreak(r),r=Ts.Drafty.append(r,Ts.Drafty.parse(e))),this.sendMessage(r)})}sendVideoAttachment(e,t,s,a){const i=a.width,n=a.height,r=.75*this.props.tinode.getServerParam("maxMessageSize",ks.mp)-1024|0,o=[];let l;if(t.size+s.size>r){if(l=this.props.tinode.getLargeFileHelper(),!l)return void this.props.onError(this.props.intl.formatMessage(Aa.cannot_initiate_upload));o[0]=t.size>.675*r?l.upload(t):null,o[1]=s.size>.275*r?l.upload(s):null}if(0==o.length)return void Promise.all([(0,Os.Sk)(t),(0,Os.Sk)(s)]).then(s=>{const[r,o]=s;let l=Ts.Drafty.insertVideo(null,0,{mime:r.mime,bits:r.bits,preview:o.bits,premime:o.mime,width:i,height:n,duration:a.duration,filename:a.name,size:t.size});e&&(l=Ts.Drafty.appendLineBreak(l),l=Ts.Drafty.append(l,Ts.Drafty.parse(e))),this.sendMessage(l)});const c=Promise.all(o),h=[];h[0]=o[0]?null:(0,Os.Sk)(t),h[1]=o[1]?null:(0,Os.ag)(s,ks.QG,ks.QG,-1,!1).then(e=>(0,Os.Sk)(e.blob)),h[2]=(0,Os.ag)(s,ks.Cx,ks.Cx,-1,!1).then(e=>(0,Os.Sk)(e.blob)),Promise.all(h).then(s=>{const[r,o,h]=s;let d=Ts.Drafty.insertVideo(null,0,{mime:a.mime,bits:r?r.bits:null,_tempPreview:h.bits,preview:o?o.bits:h.bits,premime:o?o.mime:h.mime,width:i,height:n,duration:a.duration,filename:a.name,size:t.size,urlPromise:c});e&&(d=Ts.Drafty.appendLineBreak(d),d=Ts.Drafty.append(d,Ts.Drafty.parse(e))),this.sendMessage(d,c,l)}).catch(e=>this.props.onError(e.message,"err"))}handleAttachImageOrVideo(e){const t=this.props.tinode.getServerParam("maxFileUploadSize",ks.qy);e.type.startsWith("video/")?this.setState({videoPreview:{url:URL.createObjectURL(e),blob:e,filename:e.name,size:e.size,mime:e.type}}):(0,Os.ag)(e,ks.QG,ks.QG,t,!1).then(e=>{this.setState({imagePreview:{url:URL.createObjectURL(e.blob),blob:e.blob,filename:e.name,width:e.width,height:e.height,size:e.blob.size,mime:e.mime}})}).catch(e=>{this.props.onError(e.message,"err")})}handleFileDrop(e){if(!e||0==e.length)return;const t=e[0];t.type&&t.type.startsWith("image/")?this.handleAttachImageOrVideo(t):this.handleAttachFile(t)}sendAudioAttachment(e,t,s){fetch(e).then(e=>e.blob()).then(e=>{const a=.75*this.props.tinode.getServerParam("maxMessageSize",ks.mp)-1024;if(e.size>a){const a=this.props.tinode.getLargeFileHelper();if(!a)return void this.props.onError(this.props.intl.formatMessage(Aa.cannot_initiate_upload));const i=a.upload(e),n=Ts.Drafty.appendAudio(null,{mime:e.type,size:e.size,duration:s,preview:t,urlPromise:i});this.sendMessage(n,i,a)}else(0,Os.Sk)(e).then(a=>{this.sendMessage(Ts.Drafty.appendAudio(null,{mime:a.mime,bits:a.bits,size:e.size,duration:s,preview:t}))})}).catch(e=>{this.props.onError(e.message,"err")})}handleCancelUpload(e,t){const s=this.props.tinode.getTopic(this.state.topic).findMessage(e);s&&(s._cancelled=!0),t.cancel()}handlePickReply(e,t,s,a){e&&t?(t="string"==typeof t?Ts.Drafty.init(t):t,t=Ts.Drafty.isValid(t)?Ts.Drafty.replyContent(t,ks.Rz):Ts.Drafty.append(Ts.Drafty.init("⚠ "),Ts.Drafty.wrapInto(this.props.intl.formatMessage(Aa.invalid_content),"EM")),this.setState({reply:{content:Ts.Drafty.quote(a,s,t),seq:e}}),this.props.onCancelForwardMessage()):this.setState({reply:null})}handleEditMessage(e,t){if(!e||!t)return void this.setState({reply:null});t="string"==typeof t?Ts.Drafty.init(t):t;const s=Ts.Drafty.toMarkdown(t);t=Ts.Drafty.isValid(t)?Ts.Drafty.replyContent(t,ks.hB):Ts.Drafty.append(Ts.Drafty.init("⚠ "),Ts.Drafty.wrapInto(this.props.intl.formatMessage(Aa.invalid_content),"EM")),this.setState({reply:{content:Ts.Drafty.quote(this.props.intl.formatMessage(Aa.editing_message),null,t),seq:e,editing:!0},contentToEdit:s}),this.props.onCancelForwardMessage()}handleCancelReply(){this.setState({reply:null,contentToEdit:null}),this.props.onCancelForwardMessage()}handleQuoteClick(e){const t=this.getOrCreateMessageRef(e);t&&t.current?(t.current.scrollIntoView({block:"center",behavior:"smooth"}),t.current.classList.add("flash"),setTimeout(e=>{t.current.classList.remove("flash")},1e3)):console.error("Unresolved message ref",e)}handleUnpinMessage(e){this.props.tinode.getTopic(this.state.topic).pinMessage(e,!1)}isDragEnabled(){return this.state.isWriter&&!this.state.unconfirmed&&!this.props.forwardMessage&&!this.state.peerMessagingDisabled}handleDragStart(e){e.preventDefault(),e.stopPropagation(),e.dataTransfer.clearData()}handleDragIn(e){e.preventDefault(),e.stopPropagation(),this.dragCounter++,e.dataTransfer.items&&e.dataTransfer.items.length>0&&this.setState({dragging:!0})}handleDragOut(e){e.preventDefault(),e.stopPropagation(),this.dragCounter--,this.dragCounter<=0&&this.setState({dragging:!1})}handleDrag(e){e.preventDefault(),e.stopPropagation()}handleDrop(e){e.preventDefault(),e.stopPropagation(),this.setState({dragging:!1}),this.isDragEnabled()&&e.dataTransfer.files&&e.dataTransfer.files.length>0&&(this.handleFileDrop(e.dataTransfer.files),this.dragCounter=0)}render(){const{formatMessage:e}=this.props.intl,t=this.state.rtcPanel?l().createElement(Qs,{topic:this.state.topic,seq:this.props.callSeq,callState:this.props.callState,callAudioOnly:this.props.callAudioOnly,tinode:this.props.tinode,title:this.state.title,avatar:this.state.avatar||!0,minimized:this.state.minimizedCallPanel,onError:this.props.onError,onHangup:this.handleCallHangup,onToggleMinimize:this.handleCallPanelToggle,onInvite:this.props.onCallInvite,onSendOffer:this.props.onCallSendOffer,onIceCandidate:this.props.onCallIceCandidate,onSendAnswer:this.props.onCallSendAnswer}):null;let s;if(this.state.topic){let a;if(this.state.imagePreview)a=l().createElement(ga,{content:this.state.imagePreview,tinode:this.props.tinode,reply:this.state.reply,onCancelReply:this.handleCancelReply,onClose:this.handleClosePreview,onSendMessage:this.sendImageAttachment});else if(this.state.videoPreview)a=l().createElement(_a,{content:this.state.videoPreview,tinode:this.props.tinode,reply:this.state.reply,onError:this.props.onError,onCancelReply:this.handleCancelReply,onClose:this.handleClosePreview,onSendMessage:this.sendVideoAttachment});else if(this.state.imagePostview)a=l().createElement(ga,{content:this.state.imagePostview,onClose:this.handleClosePreview});else if(this.state.videoPostview)a=l().createElement(_a,{content:this.state.videoPostview,tinode:this.props.tinode,onError:this.props.onError,onClose:this.handleClosePreview});else if(this.state.docPreview)a=l().createElement(pa,{content:this.state.docPreview,tinode:this.props.tinode,reply:this.state.reply,onCancelReply:this.handleCancelReply,onClose:this.handleClosePreview,onSendMessage:this.sendFileAttachment});else{const t=this.props.tinode.getTopic(this.state.topic),s=t.isChannelType()||t.chan,i=t.isGroupType()&&!s,n=[];t.trusted&&(t.trusted.verified&&n.push({icon:"verified",color:"badge-inv"}),t.trusted.staff&&n.push({icon:"staff",color:"badge-inv"}),t.trusted.danger&&n.push({icon:"dangerous",color:"badge-inv"}));const r=[];this.state.pins.forEach(e=>r.push(t.latestMsgVersion(e)||t.findMessage(e)));const o=[];let c=null,d=null,p=null;t.messages((e,s,a,n)=>{let r=a?a.from||"chan":null,h="single",u=e.from||"chan";u==c?h=u==r?"middle":"last":u==r&&(h="first"),c=u;const m=!(u==this.props.myUserId),g=t.msgStatus(e,!0);let f,v,b=u;const E=t.userDesc(u);E&&E.public&&(f=E.public.fn,v=(0,Os.to)(E.public.photo)),p=i?"chat-box group":"chat-box";const y=this.getOrCreateMessageRef(e.seq);let w=e.head?parseInt(e.head.reply):null;if(w&&!isNaN(w)||(w=null),e.hi)o.push(l().createElement(Ea,{deleted:!0,key:e.seq}));else{const t=new Date(e.ts);d&&d.toDateString()==t.toDateString()||(o.push(l().createElement(Ea,{date:(0,js.mf)(e.ts),locale:this.props.intl.locale,key:"date-"+e.seq})),d=t),o.push(l().createElement(ra,{tinode:this.props.tinode,topic:this.state.topic,content:e.content,mimeType:e.head&&e.head.mime,replyToSeq:w,edited:e.head&&!e.head.webrtc&&e.head.replace,timestamp:e.ts,response:m,seq:e.seq,isGroup:i,isChan:this.state.channel,userFrom:b,userName:f,userAvatar:v,sequence:h,received:g,uploader:e._uploader,userIsWriter:this.state.isWriter,userIsAdmin:this.state.isAdmin,pinned:this.state.pins.includes(e.seq),viewportWidth:this.props.viewportWidth,showContextMenu:this.handleShowMessageContextMenu,onExpandMedia:this.handleExpandMedia,onFormResponse:this.handleFormResponse,onCancelUpload:this.handleCancelUpload,pickReply:this.handlePickReply,editMessage:this.handleEditMessage,onQuoteClick:this.handleQuoteClick,onAcceptCall:this.props.onAcceptCall,onError:this.props.onError,ref:y,key:e.seq}))}});let u=null;if(s)t.subcnt&&(u=e(Aa.subscriber_count,{count:t.subcnt}));else{const s=this.props.tinode.getMeTopic().getContact(this.state.topic);s&&(Ts.Tinode.isP2PTopicName(s.topic)?s.online?u=e(Aa.online_now):s.seen&&(u=e(Aa.last_seen,{timestamp:(0,js.cq)(s.seen.when,this.props.intl.locale)})):Ts.Tinode.isGroupTopicName(s.topic)&&t.subcnt&&(u=e(Aa.member_count,{count:t.subcnt})))}const m=this.state.avatar||!0,g=this.state.deleted||t.isSelfType()?null:this.props.online?"online"+(this.state.typingIndicator?" typing":""):"offline",f="panel-title"+(this.state.deleted?" deleted":""),v="dark"==this.props.colorSchema?"dark":"";let b=l().createElement(l().Fragment,null,l().createElement("div",{id:"messages-container",className:v},l().createElement("button",{id:"go-to-latest",className:"action-button"+(this.state.showGoToLastButton?"":" hidden"),onClick:this.goToLatestMessage},l().createElement("i",{className:"material-icons"},"arrow_downward")),l().createElement("div",{id:"messages-panel",ref:this.handleScrollReference},l().createElement("ul",{id:"scroller",className:p},o)),this.state.isReader?null:l().createElement("div",{id:"write-only-background"},this.state.readingBlocked?l().createElement("div",{id:"write-only-note"},l().createElement(h.FormattedMessage,{id:"messages_not_readable",defaultMessage:[{type:0,value:"no access to messages"}]})):null)),this.state.peerMessagingDisabled&&!this.state.unconfirmed?l().createElement("div",{id:"peer-messaging-disabled-note"},l().createElement("i",{className:"material-icons secondary"},"block")," ",l().createElement(h.FormattedMessage,{id:"peers_messaging_disabled",defaultMessage:[{type:0,value:"Peer's messaging is disabled."}]})," ",l().createElement("a",{href:"#",onClick:this.handleEnablePeer},l().createElement(h.FormattedMessage,{id:"enable_peers_messaging",defaultMessage:[{type:0,value:"Enable"}]})),"."):null,this.state.unconfirmed?l().createElement(fa,{onAction:this.handleNewChatAcceptance}):l().createElement(da,{tinode:this.props.tinode,topicName:this.state.topic,noInput:!!this.props.forwardMessage,disabled:!this.state.isWriter||this.state.deleted,reply:this.state.reply,initMessage:this.state.contentToEdit,sendOnEnter:this.props.sendOnEnter,onKeyPress:this.sendKeyPress,onRecordingProgress:this.sendKeyPress,onSendMessage:this.sendMessage,onAttachFile:this.props.forwardMessage?null:this.handleAttachFile,onAttachImage:this.props.forwardMessage?null:this.handleAttachImageOrVideo,onAttachAudio:this.props.forwardMessage?null:this.sendAudioAttachment,onError:this.props.onError,onQuoteClick:this.handleQuoteClick,onCancelReply:this.handleCancelReply}));a=l().createElement(l().Fragment,null,l().createElement("div",{id:"topic-caption-panel",className:"caption-panel"},this.props.displayMobile?l().createElement("a",{href:"#",id:"hide-message-view",onClick:e=>{e.preventDefault(),this.leave(this.state.topic),this.props.onHideMessagesView()}},l().createElement("i",{className:"material-icons"},"arrow_back")):null,l().createElement("div",{className:"avatar-box"},l().createElement(Us.A,{tinode:this.props.tinode,avatar:m,topic:this.state.topic,title:this.state.title,deleted:this.state.deleted}),s?null:l().createElement("span",{className:g})),l().createElement("div",{id:"topic-title-group"},l().createElement("div",{id:"topic-title",className:f},this.state.title||l().createElement("i",null,l().createElement(h.FormattedMessage,{id:"unnamed_topic",defaultMessage:[{type:0,value:"Unnamed"}]})),l().createElement(oa.A,{badges:n})),l().createElement("div",{id:"topic-last-seen"},u)),l().createElement("div",{style:{marginLeft:"auto"}}),!this.props.displayMobile&&this.state.pins.length>0?l().createElement(Ca,{tinode:this.props.tinode,pins:this.state.pins,messages:r,selected:this.state.selectedPin,isAdmin:this.state.isAdmin,setSelected:e=>this.setState({selectedPin:e}),onSelected:this.handleQuoteClick,onCancel:this.handleUnpinMessage}):null,i?l().createElement(ma,{tinode:this.props.tinode,subscribers:this.state.onlineSubs}):null,l().createElement("div",null,l().createElement("a",{href:"#",onClick:this.handleContextClick},l().createElement("i",{className:"material-icons"},"more_vert")))),this.props.displayMobile?l().createElement(l().Fragment,null,this.state.pins.length>0?l().createElement(Ca,{tinode:this.props.tinode,pins:this.state.pins,messages:r,selected:this.state.selectedPin,isAdmin:this.state.isAdmin,setSelected:e=>this.setState({selectedPin:e}),onSelected:this.handleQuoteClick,onCancel:this.handleUnpinMessage}):null,l().createElement(ua.A,{level:this.props.errorLevel,text:this.props.errorText,onClearError:this.props.onError})):null,l().createElement(va.A,{show:this.state.fetchingMessages}),b,this.state.dragging&&this.isDragEnabled()?l().createElement("div",{className:"drag-n-drop"},e(Aa.drag_file)):null)}s=l().createElement("div",{id:"topic-view",ref:this.mountDnDEvents},a,t)}else s=l().createElement(ba,{serverVersion:this.props.serverVersion,serverAddress:this.props.serverAddress});return s}}var Pa=(0,h.injectIntl)(Ia);class Fa extends l().PureComponent{render(){return l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onBack()}},l().createElement("i",{className:"material-icons"},"arrow_back"))}}class Ra extends l().PureComponent{render(){return l().createElement("div",null,l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onNewTopic()}},l().createElement("i",{className:"material-icons"},"chat"))," ",l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSettings()}},l().createElement("i",{className:"material-icons"},"settings")))}}class xa extends l().PureComponent{render(){return l().createElement("div",null,l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSignUp()}},l().createElement("i",{className:"material-icons"},"person_add"))," ",l().createElement("a",{href:"#",onClick:e=>{e.preventDefault(),this.props.onSettings()}},l().createElement("i",{className:"material-icons"},"settings")))}}class Ua extends l().PureComponent{render(){const e=[];this.props.trustedBadges&&this.props.trustedBadges.forEach(t=>{e.push({icon:t,color:"badge-inv"})});let t=null;return this.props.tinode&&(t=this.props.tinode.authorizeURL((0,Xs.wk)(this.props.avatar,"image"))),l().createElement("div",{id:"side-caption-panel",className:"caption-panel"},this.props.onCancel?l().createElement(Fa,{onBack:this.props.onCancel}):null,t?l().createElement("div",{id:"self-avatar",className:"avatar-box"},l().createElement(Us.A,{tinode:this.props.tinode,avatar:t,topic:this.props.myUserId,title:this.props.title})):null,l().createElement("div",{id:"sidepanel-title",className:"panel-title"},this.props.title,l().createElement(oa.A,{badges:e})),"login"===this.props.state?l().createElement(xa,{onSignUp:this.props.onSignUp,onSettings:this.props.onSettings}):"contacts"===this.props.state?l().createElement(Ra,{onNewTopic:this.props.onNewTopic,onSettings:this.props.onSettings}):null)}}var La=r(8089);const Oa=(0,h.defineMessages)({archived_contacts_title:{id:"archived_contacts",defaultMessage:[{type:0,value:"Archived contacts ("},{type:1,value:"count"},{type:0,value:")"}]}});class ja extends l().Component{constructor(e){super(e),this.handleAction=this.handleAction.bind(this),this.state=ja.deriveStateFromProps(e)}static deriveStateFromProps(e){const t=[];let s=0,a=0;const i=e.tinode.getMeTopic();return e.chatList.forEach(n=>{const r=n.acs&&!n.acs.isJoiner();n.pinned=i.pinnedTopicRank(n.topic),r&&e.blocked&&t.push(n),r||e.blocked||(n.private&&n.private.arch?e.archive?t.push(n):a++:e.archive||(t.push(n),s+=n.unread>0?1:0))}),t.sort((e,t)=>{const s=t.pinned-e.pinned;return 0!=s?s:(t.touched||0)-(e.touched||0)}),a>0&&t.push({action:"archive",title:Oa.archived_contacts_title,values:{count:a}}),{contactList:t,unreadThreads:s}}componentDidUpdate(e,t){if(e.chatList!=this.props.chatList||e.archive!=this.props.archive||e.blocked!=this.props.blocked){const e=ja.deriveStateFromProps(this.props);this.setState(e),e.unreadThreads!=t.unreadThreads&&(0,Xs.OM)(e.unreadThreads)}}handleAction(e){this.props.onShowArchive()}render(){return l().createElement(h.FormattedMessage,{id:"contacts_not_found",defaultMessage:[{type:0,value:"You have no chats"},{type:0,value:"<br/>"},{type:0,value:"¯∖_(ツ)_/¯"}]},e=>l().createElement(Ps.A,{tinode:this.props.tinode,connected:this.props.connected,contacts:this.state.contactList,emptyListMessage:e,topicSelected:this.props.topicSelected,myUserId:this.props.myUserId,showOnline:!0,showUnread:!0,onTopicSelected:this.props.onTopicSelected,showContextMenu:this.props.showContextMenu,onAction:this.handleAction}))}}class Ba extends l().PureComponent{constructor(e){super(e),this.state={colorSchema:e.colorSchema||"auto",textSize:10*e.textSize||"100",sendOnEnter:e.sendOnEnter||"plain"},this.isMac=(navigator.userAgentData&&navigator.userAgentData.platform||navigator.platform).toLowerCase().startsWith("mac"),this.handleColorSchemaSelected=this.handleColorSchemaSelected.bind(this),this.handleTextSizeChanged=this.handleTextSizeChanged.bind(this),this.handleSendOnEnterSelected=this.handleSendOnEnterSelected.bind(this)}handleColorSchemaSelected(e){this.setState({colorSchema:e.currentTarget.value}),this.props.onChangeColorSchema(e.currentTarget.value)}handleTextSizeChanged(e){this.setState({textSize:e.currentTarget.value}),this.props.onTextSizeChanged(e.currentTarget.value/10|0)}handleSendOnEnterSelected(e){this.setState({sendOnEnter:e.currentTarget.value}),this.props.onSendOnEnterChanged(e.currentTarget.value)}render(){return l().createElement("div",{id:"settings-form",className:"scrollable-panel"},l().createElement("div",{className:"panel-form-column"},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_color_schema",defaultMessage:[{type:0,value:"Theme:"}]}))),l().createElement("div",{className:"panel-form-row"},l().createElement("ul",{className:"quoted"},l().createElement("li",{key:"system"},l().createElement("input",{type:"radio",id:"system",name:"color-scheme-select",value:"auto",checked:"auto"==this.state.colorSchema,onChange:this.handleColorSchemaSelected})," ",l().createElement("label",{htmlFor:"system"},l().createElement(h.FormattedMessage,{id:"color_schema_system",defaultMessage:[{type:0,value:"System default"}]})," ",l().createElement("img",{src:"img/routine.svg",style:{verticalAlign:"top",width:"1.6rem",height:"1.6rem"}}))),l().createElement("li",{key:"light"},l().createElement("input",{type:"radio",id:"light",name:"color-scheme-select",value:"light",checked:"light"==this.state.colorSchema,onChange:this.handleColorSchemaSelected})," ",l().createElement("label",{htmlFor:"light"},l().createElement(h.FormattedMessage,{id:"color_schema_light",defaultMessage:[{type:0,value:"Light"}]})," ",l().createElement("i",{className:"material-icons orange large"},"light_mode"))),l().createElement("li",{key:"dark"},l().createElement("input",{type:"radio",id:"dark",name:"color-scheme-select",value:"dark",checked:"dark"==this.state.colorSchema,onChange:this.handleColorSchemaSelected})," ",l().createElement("label",{htmlFor:"dark"},l().createElement(h.FormattedMessage,{id:"color_schema_dark",defaultMessage:[{type:0,value:"Dark"}]})," ",l().createElement("i",{className:"material-icons blue large"},"dark_mode")))))),l().createElement("div",{className:"hr"}),l().createElement("div",{className:"panel-form-row clean-clickable"},l().createElement("a",{onClick:this.props.onSelectWallpapers,className:"flat-button"},l().createElement("i",{className:"material-icons"},"wallpaper")," ",l().createElement(h.FormattedMessage,{id:"wallpapers",defaultMessage:[{type:0,value:"Wallpapers"}]}))),l().createElement("div",{className:"hr"}),l().createElement("div",{className:"panel-form-column"},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_text_size",defaultMessage:[{type:0,value:"Text size:"}]}))),l().createElement("div",{className:"panel-form-row"},l().createElement("input",{type:"range",id:"text_size",name:"text_size",min:"80",max:"120",step:"10",list:"text_size_options",value:this.state.textSize,onChange:this.handleTextSizeChanged})),l().createElement("div",{className:"panel-form-row"},l().createElement("datalist",{id:"text_size_options"},l().createElement("option",{value:"80",label:"80%"}),l().createElement("option",{value:"90",label:"90%"}),l().createElement("option",{value:"100",label:"100%"}),l().createElement("option",{value:"110",label:"110%"}),l().createElement("option",{value:"120",label:"120%"})))),l().createElement("div",{className:"hr"}),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_keyboard",defaultMessage:[{type:0,value:"Keyboard:"}]}))),l().createElement("div",{className:"panel-form-row"},l().createElement("ul",{className:"quoted"},l().createElement("li",{key:"plain"},l().createElement("input",{type:"radio",id:"plain",name:"send-select",value:"plain",checked:"plain"==this.state.sendOnEnter,onChange:this.handleSendOnEnterSelected})," ",l().createElement("label",{htmlFor:"send_plain"},l().createElement(h.FormattedMessage,{id:"send_plain",defaultMessage:[{type:0,value:"Send on Enter"}]})," "),l().createElement("div",{className:"panel-form-row"},l().createElement("span",{className:"small gray"},l().createElement(h.FormattedMessage,{id:"send_plain_explained",defaultMessage:[{type:0,value:"Press Shift + Enter for new line"}]})))),l().createElement("li",{key:"command"},l().createElement("input",{type:"radio",id:"command",name:"send-select",value:"command",checked:"command"==this.state.sendOnEnter,onChange:this.handleSendOnEnterSelected})," ",l().createElement("label",{htmlFor:"send_command"},l().createElement(h.FormattedMessage,{id:"send_command",defaultMessage:[{type:0,value:"Send on "},{type:1,value:"key"}],values:{key:this.isMac?"⌘ + Enter":"Ctrl + Enter"}})," "),l().createElement("div",{className:"panel-form-row"},l().createElement("span",{className:"small gray"},l().createElement(h.FormattedMessage,{id:"send_command_explained",defaultMessage:[{type:0,value:"Press Enter for new line"}]})))))))}}var qa=r(1166);class za extends l().PureComponent{constructor(e){super(e),this.handleCheckboxClick=this.handleCheckboxClick.bind(this)}handleCheckboxClick(e,t){"sound"==e?this.props.onToggleMessageSounds(t):"alert"==e&&this.props.onTogglePushNotifications(t)}render(){return l().createElement("div",{className:"scrollable-panel"},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{htmlFor:"message-sound"},l().createElement(h.FormattedMessage,{id:"label_message_sound",defaultMessage:[{type:0,value:"Message sound:"}]})),l().createElement(qa.A,{name:"sound",id:"message-sound",checked:this.props.messageSounds,onChange:this.handleCheckboxClick})),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{htmlFor:"desktop-alerts"},this.props.desktopAlertsEnabled?l().createElement(h.FormattedMessage,{id:"label_push_notifications",defaultMessage:[{type:0,value:"Notification alerts:"}]}):l().createElement(h.FormattedMessage,{id:"label_push_notifications_disabled",defaultMessage:[{type:0,value:"Notification alerts (requires HTTPS):"}]})),l().createElement(qa.A,{name:"alert",id:"desktop-alerts",checked:this.props.desktopAlerts,onChange:this.props.desktopAlertsEnabled?this.handleCheckboxClick:null})))}}class Va extends l().PureComponent{render(){return l().createElement("div",{className:"scrollable-panel"},l().createElement("div",{className:"panel-form-column"},l().createElement("a",{href:ks.fi,className:"flat-button",target:"_blank"},l().createElement("i",{className:"material-icons"},"email"),"  ",l().createElement(h.FormattedMessage,{id:"link_contact_us",defaultMessage:[{type:0,value:"Contact Us"}]})),l().createElement("a",{href:ks.V9,className:"flat-button",target:"_blank"},l().createElement("i",{className:"material-icons"},"description"),"  ",l().createElement(h.FormattedMessage,{id:"link_terms_of_service",defaultMessage:[{type:0,value:"Terms of Service"}]})),l().createElement("a",{href:ks.RS,className:"flat-button",target:"_blank"},l().createElement("i",{className:"material-icons"},"policy"),"  ",l().createElement(h.FormattedMessage,{id:"link_privacy_policy",defaultMessage:[{type:0,value:"Privacy Policy"}]}))),l().createElement("div",{className:"hr"}),l().createElement("div",{className:"panel-form-column"},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_client",defaultMessage:[{type:0,value:"Client:"}]})),ks.C3),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_sdk",defaultMessage:[{type:0,value:"SDK:"}]})),Ts.Tinode.getLibrary()),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_server",defaultMessage:[{type:0,value:"Server:"}]})),this.props.serverVersion),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_server_address",defaultMessage:[{type:0,value:"Server address:"}]})),this.props.serverAddress)))}}var Ha=r(6789);class Wa extends l().Component{constructor(e){super(e),this.state={login:e.login,password:"",hostName:e.serverAddress,saveToken:e.persist},this.handleLoginChange=this.handleLoginChange.bind(this),this.handlePasswordChange=this.handlePasswordChange.bind(this),this.handleToggleSaveToken=this.handleToggleSaveToken.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}handleLoginChange(e){this.setState({login:e.target.value})}handlePasswordChange(e){this.setState({password:e.target.value})}handleToggleSaveToken(){this.props.onPersistenceChange(!this.state.saveToken),this.setState({saveToken:!this.state.saveToken})}handleSubmit(e){e.preventDefault(),this.props.onLogin(this.state.login.trim(),this.state.password.trim())}render(){let e="primary";return this.props.disabled&&(e+=" disabled"),l().createElement("form",{id:"login-form",onSubmit:this.handleSubmit},l().createElement(h.FormattedMessage,{id:"login_prompt",defaultMessage:[{type:0,value:"Login"}]},e=>l().createElement("input",{type:"text",id:"inputLogin",placeholder:e,autoComplete:"username",autoCorrect:"off",autoCapitalize:"none",value:this.state.login,onChange:this.handleLoginChange,required:!0,autoFocus:!0})),l().createElement(h.FormattedMessage,{id:"password_prompt",defaultMessage:[{type:0,value:"Password"}]},e=>l().createElement(Ha.A,{type:"password",id:"inputPassword",placeholder:e,autoComplete:"current-password",value:this.state.password,onChange:this.handlePasswordChange,required:!0})),l().createElement("div",{className:"panel-form-row"},l().createElement(qa.A,{id:"save-token",name:"save-token",checked:this.state.saveToken,onChange:this.handleToggleSaveToken}),l().createElement("label",{htmlFor:"save-token"}," ",l().createElement(h.FormattedMessage,{id:"stay_logged_in",defaultMessage:[{type:0,value:"Stay logged in"}]})),l().createElement("a",{href:"#reset"},l().createElement(h.FormattedMessage,{id:"forgot_password_link",defaultMessage:[{type:0,value:"Forgot password?"}]}))),l().createElement("div",{className:"dialog-buttons"},l().createElement("button",{className:e,type:"submit"},l().createElement(h.FormattedMessage,{id:"button_sign_in",defaultMessage:[{type:0,value:"Sign in"}]}))))}}var Ka=r(9593),$a=r.n(Ka);const Ga=(0,h.defineMessages)({invalid_id:{id:"error_invalid_id",defaultMessage:[{type:0,value:"Invalid ID"}]}});class Qa extends l().PureComponent{constructor(e){super(e),this.qrCodeRef=l().createRef(),this.state={groupId:""},this.handleChange=this.handleChange.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){new($a())(this.qrCodeRef.current,{text:this.props.myURI,width:ks.Tn,height:ks.Tn})}handleChange(e){this.setState({groupId:e.target.value})}handleKeyPress(e){"Enter"===e.key&&this.handleSubmit(e)}handleSubmit(e){if(e.preventDefault(),this.state.groupId){const e=this.state.groupId.trim(),t=e.substring(0,3);e.length>3&&["usr","grp","chn"].includes(t)?this.props.onSubmit(e):this.props.onError(this.props.intl.formatMessage(Ga.invalid_id),"err")}}render(){return l().createElement("div",{className:"panel-form"},l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"group_user_id_prompt",defaultMessage:[{type:0,value:"Group or User ID"}]},e=>l().createElement("input",{type:"text",placeholder:e,value:this.state.groupId,onChange:this.handleChange,onKeyDown:this.handleKeyPress,required:!0,autoFocus:!0}))),l().createElement("div",{className:"dialog-buttons"},l().createElement("button",{className:"primary",onClick:this.handleSubmit},l().createElement(h.FormattedMessage,{id:"button_subscribe",defaultMessage:[{type:0,value:"Subscribe"}]}))),l().createElement("br",null),l().createElement("div",{className:"panel-form-column"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_scan_id",defaultMessage:[{type:0,value:"Scan my ID:"}]})),l().createElement("div",{className:"qr-code",ref:this.qrCodeRef})))}}var Ya=(0,h.injectIntl)(Qa),Xa=r(221),Ja=r(9418),Za=r(3307);class ei extends l().PureComponent{constructor(e){super(e),this.fullName=l().createRef(),this.state={fullName:"",private:"",description:"",imageUrl:null,tags:[],isChannel:!1,newAvatar:null,newAvatarMime:null},this.handleFieldEdit=this.handleFieldEdit.bind(this),this.handleImageChanged=this.handleImageChanged.bind(this),this.handleAvatarCropped=this.handleAvatarCropped.bind(this),this.handleAvatarCropCancel=this.handleAvatarCropCancel.bind(this),this.uploadAvatar=this.uploadAvatar.bind(this),this.handleTagsChanged=this.handleTagsChanged.bind(this),this.handleChannelToggle=this.handleChannelToggle.bind(this),this.handleSubmit=this.handleSubmit.bind(this)}componentDidMount(){}handleFieldEdit(e,t){this.setState({[e]:t.target.value||""})}handleImageChanged(e,t){this.setState({newAvatar:t,newAvatarMime:e})}handleAvatarCropped(e,t,s,a){const i=t?URL.createObjectURL(t):null;this.setState({imageUrl:i,newAvatar:null,newAvatarMime:null}),t&&this.uploadAvatar(e,t,s,a)}handleAvatarCropCancel(){this.setState({newAvatar:null,newAvatarMime:null})}uploadAvatar(e,t,s,a){const i=e=>{let{mime:t,blob:s}=e;if(s.size>ks.Z7){this.props.tinode.getLargeFileHelper().upload(s).then(e=>this.setState({imageUrl:e})).catch(e=>this.props.onError(e.message,"err"))}else(0,Os.Sk)(s).then(e=>this.setState({imageUrl:(0,Os.to)({data:e.bits,type:t})}))};s>ks.eQ||a>ks.eQ||s!=a?(0,Os.ag)(t,ks.eQ,ks.eQ,ks.qy,!0).then(e=>i(e)).catch(e=>this.props.onError(e.message,"err")):i({mime:e,blob:t,width:s,height:a})}handleTagsChanged(e){this.setState({tags:e})}handleChannelToggle(){this.setState({isChannel:!this.state.isChannel})}handleSubmit(e){e.preventDefault();const t=(0,js.W5)(this.state.fullName.trim(),ks.tS),s=(0,js.W5)(this.state.private.trim(),ks.tS),a=(0,js.W5)(this.state.description.trim(),ks.lQ);t&&this.props.onSubmit(t,a,this.state.imageUrl,s,this.state.tags,this.state.isChannel)}render(){if(this.state.newAvatar)return l().createElement(Xa.A,{avatar:this.state.newAvatar,mime:this.state.newAvatarMime,onSubmit:this.handleAvatarCropped,onCancel:this.handleAvatarCropCancel,onError:this.props.onError});let e="primary";return this.props.disabled&&(e+=" disabled"),l().createElement("form",{className:"panel-form",onSubmit:this.handleSubmit},l().createElement("div",{className:"panel-form-column"},l().createElement("center",null,l().createElement(Ja.A,{tinode:this.props.tinode,avatar:this.state.imageUrl,onError:this.props.onError,onImageUpdated:this.handleImageChanged})),l().createElement("div",{className:"group"},l().createElement("label",{className:"small",htmlFor:"new-topic-fn"},l().createElement(h.FormattedMessage,{id:"label_topic_name",defaultMessage:[{type:0,value:"Name"}]})),l().createElement(h.FormattedMessage,{id:"topic_name_editing_placeholder",defaultMessage:[{type:0,value:"Freeform name of the group"}]},e=>l().createElement("input",{type:"text",id:"new-topic-fn",placeholder:e,ref:this.fullName,value:this.state.fullName,onChange:this.handleFieldEdit.bind(this,"fullName"),autoFocus:!0,required:!0,tabIndex:0}))),l().createElement("div",{className:"group"},l().createElement("label",{className:"small",htmlFor:"new-topic-priv"},l().createElement(h.FormattedMessage,{id:"label_private",defaultMessage:[{type:0,value:"Private comment"}]})),l().createElement(h.FormattedMessage,{id:"private_editing_placeholder",defaultMessage:[{type:0,value:"Visible to you only"}]},e=>l().createElement("input",{type:"text",id:"new-topic-priv",placeholder:e,value:this.state.private,onChange:this.handleFieldEdit.bind(this,"private"),tabIndex:1}))),l().createElement("div",{className:"group"},l().createElement("label",{className:"small",htmlFor:"new-topic-desc"},l().createElement(h.FormattedMessage,{id:"label_description",defaultMessage:[{type:0,value:"Description"}]})),l().createElement(h.FormattedMessage,{id:"description_editing_placeholder",defaultMessage:[{type:0,value:"Description (optional)"}]},e=>l().createElement("input",{type:"text",id:"new-topic-desc",placeholder:e,value:this.state.description,onChange:this.handleFieldEdit.bind(this,"description"),tabIndex:2})))),l().createElement("div",{className:"panel-form-row"},l().createElement(qa.A,{checked:this.state.isChannel,tabIndex:3,onChange:this.handleChannelToggle})," ",l().createElement("label",{onClick:this.handleChannelToggle},l().createElement(h.FormattedMessage,{id:"channel_prompt",defaultMessage:[{type:0,value:"This is a channel"}]}))),l().createElement(h.FormattedMessage,{id:"title_tag_manager",defaultMessage:[{type:0,value:"Tags (search & discovery)"}]},e=>l().createElement(Za.A,{tinode:this.props.tinode,tags:this.state.tags,activated:!0,onTagsChanged:this.handleTagsChanged,tabIndex:4,title:e})),l().createElement("div",{className:"dialog-buttons"},l().createElement("button",{className:e},l().createElement(h.FormattedMessage,{id:"button_create",defaultMessage:[{type:0,value:"Create"}]}))))}}const ti=(0,h.defineMessages)({search_for_contacts:{id:"search_for_contacts",defaultMessage:[{type:0,value:"Use search to find contacts"}]},search_no_results:{id:"search_no_results",defaultMessage:[{type:0,value:"Search returned no results"}]},search_placeholder:{id:"search_placeholder",defaultMessage:[{type:0,value:"List like alice@example.com, +17025550003..."}]}});class si extends l().Component{constructor(e){super(e),this.state={tabSelected:"find",searchQuery:null},this.handleTabClick=this.handleTabClick.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleSearchResultSelected=this.handleSearchResultSelected.bind(this),this.handleNewGroupSubmit=this.handleNewGroupSubmit.bind(this),this.handleGroupByID=this.handleGroupByID.bind(this)}componentDidMount(){this.props.onInitFind()}handleTabClick(e){e.preventDefault(),Ta.A.navigateTo(Ta.A.addUrlParam(window.location.hash,"tab",e.currentTarget.dataset.id)),this.setState({tabSelected:e.currentTarget.dataset.id})}handleSearchContacts(e){if(e=e.trim()||Ts.Tinode.DEL_CHAR,!/[\s,:]/.test(e)&&e!=Ts.Tinode.DEL_CHAR){const t=(0,Xs.xH)(e);if(t)e=`${Ts.Tinode.TAG_EMAIL}${t}`;else{const t=(0,Xs.Jt)(e);t?e=`${Ts.Tinode.TAG_PHONE}${t}`:("@"==e[0]&&(e=e.substring(1)),e=`${Ts.Tinode.TAG_ALIAS}${e},${e}`)}}this.props.onSearchContacts(e),this.setState({searchQuery:Ts.Tinode.isNullValue(e)?null:e})}handleSearchResultSelected(e){"find"==this.state.tabSelected&&(Ta.A.navigateTo(Ta.A.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e))}handleNewGroupSubmit(e,t,s,a,i,n){Ta.A.navigateTo(Ta.A.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(void 0,{public:(0,Xs.k6)(e,s,null,t),private:a,tags:i},n)}handleGroupByID(e){Ta.A.navigateTo(Ta.A.removeUrlParam(window.location.hash,"tab")),this.props.onCreateTopic(e)}render(){const{formatMessage:e}=this.props.intl,t=e(this.state.searchQuery?ti.search_no_results:ti.search_for_contacts),s=e(ti.search_placeholder);return l().createElement("div",{className:"flex-column"},l().createElement("ul",{className:"tabbar"},l().createElement("li",{className:"find"===this.state.tabSelected?"active":null},l().createElement("a",{href:"#","data-id":"find",onClick:this.handleTabClick},l().createElement(h.FormattedMessage,{id:"tabtitle_find_user",defaultMessage:[{type:0,value:"find"}]}))),l().createElement("li",{className:"grp"===this.state.tabSelected?"active":null},l().createElement("a",{href:"#","data-id":"grp",onClick:this.handleTabClick},l().createElement(h.FormattedMessage,{id:"tabtitle_new_group",defaultMessage:[{type:0,value:"new group"}]}))),l().createElement("li",{className:"byid"===this.state.tabSelected?"active":null},l().createElement("a",{href:"#","data-id":"byid",onClick:this.handleTabClick},l().createElement(h.FormattedMessage,{id:"tabtitle_group_by_id",defaultMessage:[{type:0,value:"by id"}]})))),"grp"===this.state.tabSelected?l().createElement(ei,{tinode:this.props.tinode,onSubmit:this.handleNewGroupSubmit,onError:this.props.onError}):"byid"===this.state.tabSelected?l().createElement(Ya,{myURI:Ts.Tinode.URI_TOPIC_ID_PREFIX+this.props.tinode.getCurrentUserID(),onSubmit:this.handleGroupByID,onError:this.props.onError}):l().createElement("div",{className:"flex-column"},l().createElement(Fs,{placeholder:s,onSearchContacts:this.handleSearchContacts}),l().createElement(Ps.A,{tinode:this.props.tinode,contacts:this.props.searchResults,myUserId:this.props.myUserId,emptyListMessage:t,showSelfTopic:!this.state.searchQuery,showOnline:!1,showUnread:!1,showContextMenu:!1,onTopicSelected:this.handleSearchResultSelected})))}}var ai=(0,h.injectIntl)(si);class ii extends l().PureComponent{constructor(e){super(e),this.state={hostName:e.serverAddress,changed:!1},this.handleHostNameChange=this.handleHostNameChange.bind(this),this.handleEditingFinished=this.handleEditingFinished.bind(this),this.handleKeyDown=this.handleKeyDown.bind(this)}handleHostNameChange(e){this.setState({hostName:e.target.value,changed:!0})}handleEditingFinished(){this.state.changed&&(this.setState({changed:!1}),this.props.onServerAddressChange(this.state.hostName.trim()))}handleKeyDown(e){"Enter"==e.key&&this.handleEditingFinished()}render(){const e=[];for(let t in ks.SE){let s=ks.SE[t];e.push(l().createElement("option",{key:s,value:s}))}return l().createElement("div",{className:"panel-form-row"},l().createElement("input",{type:"search",id:"host-name",placeholder:this.props.hostName,list:"known-hosts",className:"quoted",value:this.state.hostName,onChange:this.handleHostNameChange,onBlur:this.handleEditingFinished,onKeyDown:this.handleKeyDown,required:!0}),l().createElement("datalist",{id:"known-hosts"},e))}}class ni extends l().PureComponent{constructor(e){super(e),this.state={transport:e.transport||"def",serverAddress:e.serverAddress,secureConnection:e.secureConnection},this.handleSubmit=this.handleSubmit.bind(this),this.handleTransportSelected=this.handleTransportSelected.bind(this),this.handleServerAddressChange=this.handleServerAddressChange.bind(this),this.handleToggleSecure=this.handleToggleSecure.bind(this)}handleSubmit(e){e.preventDefault(),this.props.onUpdate({transport:this.state.transport,serverAddress:this.state.serverAddress,secureConnection:this.state.secureConnection})}handleTransportSelected(e){this.setState({transport:e.currentTarget.value})}handleServerAddressChange(e){this.setState({serverAddress:e})}handleToggleSecure(e){this.setState({secureConnection:!this.state.secureConnection})}render(){const e={def:"default",ws:"websocket",lp:"long polling"},t=[];return["def","ws","lp"].forEach(s=>{const a="transport-"+s,i=e[s];t.push(l().createElement("li",{key:s},l().createElement("input",{type:"radio",id:a,name:"transport-select",value:s,checked:this.state.transport===s,onChange:this.handleTransportSelected}),l().createElement("label",{htmlFor:a},i)))}),l().createElement("form",{id:"settings-form",className:"panel-form",onSubmit:this.handleSubmit},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_server_to_use",defaultMessage:[{type:0,value:"Server to use:"}]}))),l().createElement(ii,{serverAddress:this.state.serverAddress,onServerAddressChange:this.handleServerAddressChange}),l().createElement("div",{className:"panel-form-row"},l().createElement(qa.A,{id:"secure-connection",name:"secure-connection",checked:this.state.secureConnection,className:"quoted",onChange:this.handleToggleSecure}),l().createElement("label",{htmlFor:"secure-connection"},l().createElement(h.FormattedMessage,{id:"label_use_secure_connection",defaultMessage:[{type:0,value:"Use secure connection"}]}))),l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small"},l().createElement(h.FormattedMessage,{id:"label_wire_transport",defaultMessage:[{type:0,value:"Wire transport:"}]}))),l().createElement("div",{className:"panel-form-row"},l().createElement("ul",{className:"quoted"},t)),l().createElement("div",{className:"dialog-buttons"},l().createElement("button",{type:"submit",className:"primary"},l().createElement(h.FormattedMessage,{id:"button_update",defaultMessage:[{type:0,value:"Update"}]}))))}}const ri=(0,h.defineMessages)({phone:{id:"phone_dative",defaultMessage:[{type:0,value:"phone"}]},email:{id:"email_dative",defaultMessage:[{type:0,value:"email"}]}});class oi extends l().PureComponent{constructor(e){super(e),this.state={code:e.credCode||"",codeReceived:e.credCode},this.handleCodeChange=this.handleCodeChange.bind(this),this.handleKeyPress=this.handleKeyPress.bind(this),this.handleSubmit=this.handleSubmit.bind(this),this.handleCancel=this.handleCancel.bind(this)}static getDerivedStateFromProps(e,t){return e.credCode!=t.codeReceived?{code:e.credCode||"",codeReceived:e.credCode}:t}componentDidMount(){this.props.credCode&&this.props.onSubmit(this.props.credMethod,this.props.credCode,this.props.credToken)}componentDidUpdate(e,t){this.state.codeReceived&&this.state.code&&this.state.code!=t.code&&this.props.onSubmit(this.props.credMethod,this.state.code,this.props.credToken)}handleCodeChange(e){this.setState({code:e.target.value.replace(/[^\d]/g,"")})}handleKeyPress(e){"Enter"===e.key?this.handleSubmit(e):"Escape"==e.key&&this.handleCancel(e)}handleSubmit(e){e.preventDefault(),this.state.code&&this.state.code.trim()&&this.props.onSubmit(this.props.credMethod,this.state.code.trim(),this.props.credToken)}handleCancel(e){e.preventDefault(),this.props.onCancel()}render(){const{formatMessage:e}=this.props.intl,t={email:e(ri.email),tel:e(ri.phone)}[this.props.credMethod]||this.props.credMethod;return l().createElement("div",{className:"panel-form"},l().createElement("div",{className:"panel-form-row"},l().createElement("label",{className:"small gray",htmlFor:"enter-confirmation-code"},l().createElement(h.FormattedMessage,{id:"enter_confirmation_code_prompt",defaultMessage:[{type:0,value:"Confirmation code"}],values:{method:t}}))),l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"numeric_confirmation_code_prompt",defaultMessage:[{type:0,value:"Numbers only"}]},e=>l().createElement("input",{type:"text",id:"enter-confirmation-code",placeholder:e,value:this.state.code,onChange:this.handleCodeChange,onKeyDown:this.handleKeyPress,required:!0}))),l().createElement("div",{className:"dialog-buttons"},l().createElement("button",{className:"secondary",onClick:this.handleCancel},l().createElement(h.FormattedMessage,{id:"button_cancel",defaultMessage:[{type:0,value:"Cancel"}]})),l().createElement("button",{className:"primary",onClick:this.handleSubmit},l().createElement(h.FormattedMessage,{id:"button_confirm",defaultMessage:[{type:0,value:"Confirm"}]}))))}}var li=(0,h.injectIntl)(oi);const ci=l().lazy(e=>Promise.all([r.e(961),r.e(271)]).then(r.bind(r,4271))),hi=l().lazy(e=>Promise.all([r.e(961),r.e(996)]).then(r.bind(r,3996))),di=l().lazy(e=>r.e(352).then(r.bind(r,2352))),pi=l().lazy(e=>Promise.all([r.e(961),r.e(993)]).then(r.bind(r,3993))),ui=l().lazy(e=>r.e(827).then(r.bind(r,3827))),mi=(0,h.defineMessages)({login:{id:"sidepanel_title_login",defaultMessage:[{type:0,value:"Sign In"}]},register:{id:"sidepanel_title_register",defaultMessage:[{type:0,value:"Create Account"}]},settings:{id:"sidepanel_title_settings",defaultMessage:[{type:0,value:"Settings"}]},edit:{id:"sidepanel_title_account_settings",defaultMessage:[{type:0,value:"Account Settings"}]},general:{id:"panel_title_general",defaultMessage:[{type:0,value:"General"}]},security:{id:"panel_title_security",defaultMessage:[{type:0,value:"Security"}]},crop:{id:"panel_title_crop",defaultMessage:[{type:0,value:"Drag to Adjust"}]},notif:{id:"sidepanel_title_acc_notifications",defaultMessage:[{type:0,value:"Notifications"}]},acc_general:{id:"sidepanel_title_acc_general",defaultMessage:[{type:0,value:"General"}]},support:{id:"sidepanel_title_acc_support",defaultMessage:[{type:0,value:"Support"}]},newtpk:{id:"sidepanel_title_newtpk",defaultMessage:[{type:0,value:"Start New Chat"}]},cred:{id:"sidepanel_title_cred",defaultMessage:[{type:0,value:"Confirm Credentials"}]},reset:{id:"sidepanel_title_reset",defaultMessage:[{type:0,value:"Reset Password"}]},archive:{id:"sidepanel_title_archive",defaultMessage:[{type:0,value:"Archived Chats"}]},blocked:{id:"sidepanel_title_blocked",defaultMessage:[{type:0,value:"Blocked Chats"}]},wallpapers:{id:"wallpapers",defaultMessage:[{type:0,value:"Wallpapers"}]}});class gi extends l().PureComponent{constructor(e){super(e),this.handleNewTopic=this.handleNewTopic.bind(this)}handleNewTopic(){this.props.onNavigate("newtpk")}render(){const{formatMessage:e}=this.props.intl,t=this.props.state||(this.props.myUserId?"contacts":"login");let s,a,i,n;return"contacts"==t?(s=this.props.title,a=!this.props.avatar||this.props.avatar,i=this.props.trustedBadges):(s=e(mi[t]),a=!1,i=null),-1==["login","contacts"].indexOf(t)&&(n=this.props.onCancel),l().createElement("div",{id:"sidepanel"},l().createElement(Ua,{state:t,title:s,avatar:a,tinode:this.props.tinode,trustedBadges:i,myUserId:this.props.myUserId,onSignUp:this.props.onSignUp,onSettings:this.props.onSettings,onNewTopic:this.handleNewTopic,onCancel:n}),l().createElement(ua.A,{level:this.props.errorLevel,text:this.props.errorText,action:this.props.errorAction,actionText:this.props.errorActionText,onClearError:this.props.onError}),l().createElement(va.A,{show:this.props.loadSpinnerVisible}),"login"===t?l().createElement(Wa,{login:this.props.login,disabled:this.props.loginDisabled,persist:this.props.persist,onLogin:this.props.onLoginRequest,onPersistenceChange:this.props.onPersistenceChange}):"register"===t?l().createElement(o.Suspense,{fallback:l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(hi,{tinode:this.props.tinode,reqCredMethod:this.props.reqCredMethod,onShowCountrySelector:this.props.onShowCountrySelector,onCreateAccount:this.props.onCreateAccount,onCancel:this.props.onCancel,onError:this.props.onError})):"settings"===t?l().createElement(ni,{transport:this.props.transport,serverAddress:this.props.serverAddress,secureConnection:this.props.secureConnection,onCancel:this.props.onCancel,onUpdate:this.props.onGlobalSettings}):"edit"===t?l().createElement(o.Suspense,{fallback:l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(ci,{tinode:this.props.tinode,myUserId:this.props.myUserId,trustedBadges:this.props.trustedBadges,reqCredMethod:this.props.reqCredMethod,onShowCountrySelector:this.props.onShowCountrySelector,onNavigate:this.props.onNavigate,onCredAdd:this.props.onCredAdd,onCredDelete:this.props.onCredDelete,onCredConfirm:this.props.onCredConfirm,onError:this.props.onError})):"general"===t||"crop"===t?l().createElement(La.A,{topic:"me",tinode:this.props.tinode,myUserId:this.props.myUserId,reqCredMethod:this.props.reqCredMethod,onUpdateTopicDesc:this.props.onUpdateAccountDesc,onUpdateTagsRequest:this.props.onUpdateAccountTags,onError:this.props.onError}):"acc_general"===t?l().createElement(Ba,{colorSchema:this.props.colorSchema,onSelectWallpapers:this.props.onSelectWallpapers,textSize:this.props.textSize,sendOnEnter:this.props.sendOnEnter,onChangeColorSchema:this.props.onChangeColorSchema,onTextSizeChanged:this.props.onTextSizeChanged,onSendOnEnterChanged:this.props.onSendOnEnterChanged}):"notif"===t?l().createElement(za,{messageSounds:this.props.messageSounds,desktopAlerts:this.props.desktopAlerts,desktopAlertsEnabled:this.props.desktopAlertsEnabled,onTogglePushNotifications:this.props.onTogglePushNotifications,onToggleMessageSounds:this.props.onToggleMessageSounds}):"security"===t?l().createElement(o.Suspense,{fallback:l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(di,{tinode:this.props.tinode,incognitoMode:this.props.incognitoMode,onUpdateAccountDesc:this.props.onUpdateAccountDesc,onUpdatePassword:this.props.onUpdatePassword,onLogout:this.props.onLogout,onDeleteAccount:this.props.onDeleteAccount,onShowAlert:this.props.onShowAlert,onShowBlocked:this.props.onShowBlocked,onToggleIncognitoMode:this.props.onToggleIncognitoMode})):"support"===t?l().createElement(Va,{serverAddress:this.props.serverAddress,serverVersion:this.props.serverVersion}):"wallpapers"===t?l().createElement(o.Suspense,{fallback:l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(ui,{colorSchema:"auto"!==this.props.colorSchema?this.props.colorSchema:this.props.systemColorSchema,onWallpaperSelected:this.props.onWallpaperSelected})):"contacts"===t||"archive"==t||"blocked"==t?l().createElement(ja,{tinode:this.props.tinode,myUserId:this.props.myUserId,connected:this.props.connected,topicSelected:this.props.topicSelected,archive:"archive"==t,blocked:"blocked"==t,chatList:this.props.chatList,showContextMenu:this.props.showContextMenu,onTopicSelected:this.props.onTopicSelected,onShowArchive:this.props.onShowArchive}):"newtpk"===t?l().createElement(ai,{tinode:this.props.tinode,searchResults:this.props.searchResults,onInitFind:this.props.onInitFind,onSearchContacts:this.props.onSearchContacts,onCreateTopic:this.props.onCreateTopic,onError:this.props.onError}):"cred"===t?l().createElement(li,{credCode:this.props.credCode,credMethod:this.props.credMethod,credToken:this.props.credToken,onSubmit:this.props.onValidateCredentials,onCancel:this.props.onCancel}):"reset"===t?l().createElement(o.Suspense,{fallback:l().createElement("div",{className:"panel-form-row"},l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(pi,{tinode:this.props.tinode,reqCredMethod:this.props.reqCredMethod,onShowCountrySelector:this.props.onShowCountrySelector,onRequest:this.props.onPasswordResetRequest,onReset:this.props.onResetPassword,onCancel:this.props.onCancel,onError:this.props.onError})):null)}}var fi=(0,h.injectIntl)(gi),vi=r(257);function bi(){let e=ks.HX;return"object"==typeof window.location&&("file:"==window.location.protocol||"localhost"==window.location.hostname?e=ks.SE.local:window.location.hostname&&(e=window.location.hostname+(window.location.port?":"+window.location.port:""))),e}function Ei(){return"object"==typeof window.location&&"https:"==window.location.protocol}var yi=r(8262);const wi=l().lazy(e=>r.e(316).then(r.bind(r,4316))),Ci=l().lazy(e=>r.e(747).then(r.bind(r,7747))),Si=new Audio("audio/msg.m4a"),Mi=(0,h.defineMessages)({reconnect_countdown:{id:"reconnect_countdown",defaultMessage:[{type:0,value:"Disconnected. Reconnecting in "},{type:1,value:"seconds"},{type:0,value:"…"}]},reconnect_now:{id:"reconnect_now",defaultMessage:[{type:0,value:"Try now"}]},push_init_failed:{id:"push_init_failed",defaultMessage:[{type:0,value:"Failed to initialize push notifications"}]},invalid_security_token:{id:"invalid_security_token",defaultMessage:[{type:0,value:"Invalid security token"}]},no_connection:{id:"no_connection",defaultMessage:[{type:0,value:"No connection"}]},code_doesnot_match:{id:"code_doesnot_match",defaultMessage:[{type:0,value:"Code does not match"}]},menu_item_info:{id:"menu_item_info",defaultMessage:[{type:0,value:"Info"}]},menu_item_audio_call:{id:"menu_item_audio_call",defaultMessage:[{type:0,value:"Call"}]},menu_item_video_call:{id:"menu_item_video_call",defaultMessage:[{type:0,value:"Video call"}]},cred_confirmed_successfully:{id:"cred_confirmed_successfully",defaultMessage:[{type:0,value:"Confirmed successfully"}]},password_reset_success:{id:"password_reset_success",defaultMessage:[{type:0,value:"Password reset successfully"}]},select_country:{id:"select_country",defaultMessage:[{type:0,value:"Select country"}]}});class _i extends l().Component{constructor(e){super(e),this.selfRef=l().createRef(),this.state=this.getBlankState(),this.handleResize=this.handleResize.bind(this),this.handleHashRoute=this.handleHashRoute.bind(this),this.handleOnline=this.handleOnline.bind(this),this.handleColorSchemeChange=this.handleColorSchemeChange.bind(this),this.checkForAppUpdate=this.checkForAppUpdate.bind(this),this.handleVisibilityEvent=this.handleVisibilityEvent.bind(this),this.handleError=this.handleError.bind(this),this.handleLoginRequest=this.handleLoginRequest.bind(this),this.handlePersistenceChange=this.handlePersistenceChange.bind(this),this.handleConnected=this.handleConnected.bind(this),this.handleAutoreconnectIteration=this.handleAutoreconnectIteration.bind(this),this.doLogin=this.doLogin.bind(this),this.handleLoginSuccessful=this.handleLoginSuccessful.bind(this),this.handleDisconnect=this.handleDisconnect.bind(this),this.tnMeMetaDesc=this.tnMeMetaDesc.bind(this),this.tnMeContactUpdate=this.tnMeContactUpdate.bind(this),this.tnMeSubsUpdated=this.tnMeSubsUpdated.bind(this),this.resetContactList=this.resetContactList.bind(this),this.tnInitFind=this.tnInitFind.bind(this),this.tnFndSubsUpdated=this.tnFndSubsUpdated.bind(this),this.handleSearchContacts=this.handleSearchContacts.bind(this),this.handleTopicSelected=this.handleTopicSelected.bind(this),this.handleHideMessagesView=this.handleHideMessagesView.bind(this),this.handleSendMessage=this.handleSendMessage.bind(this),this.handleNewChatInvitation=this.handleNewChatInvitation.bind(this),this.handleNewAccount=this.handleNewAccount.bind(this),this.handleNewAccountRequest=this.handleNewAccountRequest.bind(this),this.handleUpdatePasswordRequest=this.handleUpdatePasswordRequest.bind(this),this.handleUpdateAccountTagsRequest=this.handleUpdateAccountTagsRequest.bind(this),this.handleToggleIncognitoMode=this.handleToggleIncognitoMode.bind(this),this.handleChangeColorSchema=this.handleChangeColorSchema.bind(this),this.handleChangeTextSize=this.handleChangeTextSize.bind(this),this.handleSendOnEnter=this.handleSendOnEnter.bind(this),this.handleSelectWallpapers=this.handleSelectWallpapers.bind(this),this.handleWallpaperSelected=this.handleWallpaperSelected.bind(this),this.handleSettings=this.handleSettings.bind(this),this.handleGlobalSettings=this.handleGlobalSettings.bind(this),this.handleShowArchive=this.handleShowArchive.bind(this),this.handleShowBlocked=this.handleShowBlocked.bind(this),this.handleToggleMessageSounds=this.handleToggleMessageSounds.bind(this),this.handleCredAdd=this.handleCredAdd.bind(this),this.handleCredDelete=this.handleCredDelete.bind(this),this.handleCredConfirm=this.handleCredConfirm.bind(this),this.initFCMessaging=this.initFCMessaging.bind(this),this.toggleFCMToken=this.toggleFCMToken.bind(this),this.handlePushMessage=this.handlePushMessage.bind(this),this.handleSidepanelCancel=this.handleSidepanelCancel.bind(this),this.handleStartTopicRequest=this.handleStartTopicRequest.bind(this),this.handleNewTopicCreated=this.handleNewTopicCreated.bind(this),this.handleTopicUpdateRequest=this.handleTopicUpdateRequest.bind(this),this.handleUnarchive=this.handleUnarchive.bind(this),this.handleChangePermissions=this.handleChangePermissions.bind(this),this.handleTagsUpdateRequest=this.handleTagsUpdateRequest.bind(this),this.handleLogout=this.handleLogout.bind(this),this.handleDeleteAccount=this.handleDeleteAccount.bind(this),this.handleDeleteTopicRequest=this.handleDeleteTopicRequest.bind(this),this.handleDeleteMessagesRequest=this.handleDeleteMessagesRequest.bind(this),this.handleLeaveUnsubRequest=this.handleLeaveUnsubRequest.bind(this),this.handleBlockTopicRequest=this.handleBlockTopicRequest.bind(this),this.handleReportTopic=this.handleReportTopic.bind(this),this.handleShowContextMenu=this.handleShowContextMenu.bind(this),this.defaultTopicContextMenu=this.defaultTopicContextMenu.bind(this),this.handleHideContextMenu=this.handleHideContextMenu.bind(this),this.handleShowAlert=this.handleShowAlert.bind(this),this.handleShowInfoView=this.handleShowInfoView.bind(this),this.handleMemberUpdateRequest=this.handleMemberUpdateRequest.bind(this),this.handleValidateCredentialsRequest=this.handleValidateCredentialsRequest.bind(this),this.handlePasswordResetRequest=this.handlePasswordResetRequest.bind(this),this.handleResetPassword=this.handleResetPassword.bind(this),this.handleContextMenuAction=this.handleContextMenuAction.bind(this),this.handleShowCountrySelector=this.handleShowCountrySelector.bind(this),this.handleShowForwardDialog=this.handleShowForwardDialog.bind(this),this.handleHideForwardDialog=this.handleHideForwardDialog.bind(this),this.handleStartVideoCall=this.handleStartVideoCall.bind(this),this.handleStartAudioCall=this.handleStartAudioCall.bind(this),this.handleInfoMessage=this.handleInfoMessage.bind(this),this.handleDataMessage=this.handleDataMessage.bind(this),this.handleCallClose=this.handleCallClose.bind(this),this.handleCallInvite=this.handleCallInvite.bind(this),this.handleCallRinging=this.handleCallRinging.bind(this),this.handleCallHangup=this.handleCallHangup.bind(this),this.handleCallSendOffer=this.handleCallSendOffer.bind(this),this.handleCallIceCandidate=this.handleCallIceCandidate.bind(this),this.handleCallSendAnswer=this.handleCallSendAnswer.bind(this),this.handleCallAccept=this.handleCallAccept.bind(this),this.sendMessageToTopic=this.sendMessageToTopic.bind(this),this.callTimeoutTimer=null}getBlankState(){const e=yi.A.getObject("settings")||{},t=!!yi.A.getObject("keep-logged-in");if(!e.wallpaper){const t=(0,Xs.KY)();e.wallpaper=t.name||"",e.wallpaperSize=t.size||0,e.wallpaperBlur=0}return{connected:!1,ready:!1,autoLogin:!1,transport:e.transport||null,serverAddress:e.serverAddress||bi(),secureConnection:void 0===e.secureConnection?Ei():e.secureConnection,serverVersion:"no connection",messageSounds:!e.messageSoundsOff,incognitoMode:!1,colorSchema:e.colorSchema||ks.gb,systemColorSchema:window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light",wallpaper:e.wallpaper,wallpaperSize:e.wallpaperSize,wallpaperBlur:0,textSize:e.textSize||ks.cL,sendOnEnter:e.sendOnEnter||"plain",desktopAlerts:t&&!!e.desktopAlerts,desktopAlertsEnabled:(Ei()||"object"==typeof window.location&&"localhost"==window.location.hostname)&&void 0!==ze&&"undefined"!=typeof navigator&&"undefined"!=typeof FIREBASE_INIT,firebaseToken:t?yi.A.getObject("firebase-token"):null,applicationVisible:!document.hidden,errorText:"",errorLevel:null,errorAction:void 0,errorActionText:null,sidePanelSelected:"login",sidePanelTitle:null,sidePanelAvatar:null,myTrustedBadges:[],loadSpinnerVisible:!1,login:"",password:"",persist:t,myUserId:null,liveConnection:navigator.onLine,topicSelected:"",topicSelectedOnline:!1,topicSelectedAcs:null,newTopicParams:null,loginDisabled:!1,displayMobile:window.innerWidth<=ks.VJ,infoPanel:void 0,mobilePanel:"sidepanel",callTopic:void 0,callState:0,callAudioOnly:void 0,callShouldStart:!1,contextMenuVisible:!1,contextMenuBounds:null,contextMenuClickAt:null,contextMenuParams:null,contextMenuItems:[],forwardDialogVisible:!1,forwardMessage:null,alertVisible:!1,alertParams:{},chatList:[],searchResults:[],searchableContacts:[],reqCredMethod:void 0,credMethod:void 0,credCode:void 0,credToken:void 0,requestedTopic:void 0}}componentDidMount(){if(window.addEventListener("resize",this.handleResize),this.handleOnlineOn=e=>{this.handleOnline(!0)},window.addEventListener("online",this.handleOnlineOn),this.handleOnlineOff=e=>{this.handleOnline(!1)},window.addEventListener("offline",this.handleOnlineOff),window.addEventListener("hashchange",this.handleHashRoute),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",this.handleColorSchemeChange),document.addEventListener("visibilitychange",this.handleVisibilityEvent),document.documentElement.style.colorScheme="auto"==this.state.colorSchema?"light dark":this.state.colorSchema,document.documentElement.style.setProperty("--message-text-size",`${this.state.textSize}pt`),this.applyWallpaperSettings(this.state.wallpaper,this.state.wallpaperSize,this.state.wallpaperBlur,"auto"==this.state.colorSchema?this.state.systemColorSchema:this.state.colorSchema),"function"==typeof BroadcastChannel){new BroadcastChannel("tinode-sw").addEventListener("message",this.handlePushMessage)}else console.warn("Your browser does not support BroadcastChannel. Some features will not be available");this.lastWakeUpCheck=(new Date).getTime(),this.wakeUpTicker=setInterval(e=>{const t=(new Date).getTime();t-this.lastWakeUpCheck>ks.hT&&this.handleOnlineOn(),this.lastWakeUpCheck=t},ks.ZW),this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),new Promise((e,t)=>{this.tinode=_i.tnSetup(this.state.serverAddress,Ei(),this.state.transport,this.props.intl.locale,this.state.persist,e),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage}).then(e=>{this.state.desktopAlertsEnabled&&this.initFCMessaging().catch(e=>{}),this.resetContactList();const t=this.state.persist?yi.A.getObject("auth-token"):void 0;t&&(this.setState({autoLogin:!0}),t.expires=new Date(t.expires),this.tinode.setAuthToken(t),this.tinode.connect().catch(e=>{this.handleError(e.message,"err")}));const s=Ta.A.parseUrlHash(window.location.hash);if(["cred","reset","register"].includes(s.path[0]))this.handleHashRoute();else{this.setState({requestedTopic:s.path[1]});const e=s.params&&s.params.cred_done?Ta.A.addUrlParam("","cred_done",s.params.cred_done):"";Ta.A.navigateTo(e)}})}componentWillUnmount(){window.removeEventListener("resize",this.handleResize),window.removeEventListener("hashchange",this.handleHashRoute),window.removeEventListener("online",this.handleOnlineOn),window.removeEventListener("offline",this.handleOnlineOff),window.matchMedia("(prefers-color-scheme: dark)").removeEventListener("change",this.handleColorSchemeChange),document.removeEventListener("visibilitychange",this.handleVisibilityEvent),clearInterval(this.wakeUpTicker)}static tnSetup(e,t,s,a,i,n){const r=new Ts.Tinode({appName:ks.C3,host:e,apiKey:ks.Lq,transport:s,secure:t,persist:i},n);return r.setHumanLanguage(a),r.enableLogging(ks.U3,!0),r}handlePushMessage(e){this.tinode.oobNotification(e.data||{})}initFCMessaging(){const{formatMessage:e,locale:t}=this.props.intl,s=(t,s)=>{console.error(t,s),this.handleError(e(Mi.push_init_failed),"err"),this.setState({firebaseToken:null}),yi.A.updateObject("settings",{desktopAlerts:!1})};try{return this.fcm=Cs(ze(FIREBASE_INIT,ks.C3)),navigator.serviceWorker.getRegistration("/service-worker.js").then(e=>e||navigator.serviceWorker.register("/service-worker.js").then(e=>(this.checkForAppUpdate(e),e))).then(e=>((e.active||e.installing).postMessage(JSON.stringify({locale:t,version:vi.i})),_i.requestFCMToken(this.fcm,e))).then(e=>{const t=yi.A.getObject("keep-logged-in");e!=this.state.firebaseToken&&(this.tinode.setDeviceToken(e),t&&yi.A.setObject("firebase-token",e)),this.setState({firebaseToken:e,desktopAlerts:!0}),t&&yi.A.updateObject("settings",{desktopAlerts:!0}),_s(this.fcm,e=>{this.handlePushMessage(e)})}).catch(e=>{throw s(e),e})}catch(e){return s(e),Promise.reject(e)}}static requestFCMToken(e,t){return Ss(e,{serviceWorkerRegistration:t,vapidKey:FIREBASE_INIT.messagingVapidKey}).then(t=>{if(t)return t;if("undefined"!=typeof Notification)return Notification.requestPermission().then(t=>{if("granted"===t)return Ss(e,{serviceWorkerRegistration:reg,vapidKey:FIREBASE_INIT.messagingVapidKey}).then(e=>{if(e)return e;throw new Error("Failed to initialize notifications")});throw new Error("No permission to send notifications: "+t)});throw new Error("Notifications are not supported")})}handleResize(){const e=document.documentElement.clientWidth<=ks.VJ;this.setState({viewportWidth:document.documentElement.clientWidth,viewportHeight:document.documentElement.clientHeight}),this.state.displayMobile!=e&&this.setState({displayMobile:e})}checkForAppUpdate(e){e.onupdatefound=t=>{const s=e.installing;s.onstatechange=e=>{if("installed"==s.state&&navigator.serviceWorker.controller){const e=l().createElement(l().Fragment,null,l().createElement(h.FormattedMessage,{id:"update_available",defaultMessage:[{type:0,value:"Update available."}]})," ",l().createElement("a",{href:""},l().createElement(h.FormattedMessage,{id:"reload_update",defaultMessage:[{type:0,value:"Reload"}]})),".");this.handleError(e,"info")}}}}handleHashRoute(){const e=Ta.A.parseUrlHash(window.location.hash),t={infoPanel:e.params.info,newTopicTabSelected:e.params.tab};if(e.path&&e.path.length>0){["acc_general","archive","blocked","contacts","cred","crop","edit","general","newtpk","notif","register","reset","security","settings","support","wallpapers",""].includes(e.path[0])?t.sidePanelSelected=e.path[0]:console.warn("Unknown sidepanel view",e.path[0]);let s=e.path[1]||null;s!=this.state.topicSelected&&(Ts.Tinode.topicType(s)?t.mobilePanel="topic-view":(s=null,t.mobilePanel="sidepanel"),Object.assign(t,{topicSelected:s,topicSelectedAcs:this.tinode.getTopicAccessMode(s)}))}else Object.assign(t,{sidePanelSelected:"",topicSelected:null});e.params.method&&(t.credMethod=e.params.method),e.params.code&&(t.credCode=e.params.code),e.params.token&&(t.credToken=e.params.token),e.params.cred_done&&Object.assign(t,_i.stateForError(this.props.intl.formatMessage(Mi.cred_confirmed_successfully),"info")),this.setState(t)}handleOnline(e){e?(this.handleError(),clearInterval(this.reconnectCountdown),this.tinode.reconnect()):this.handleError(this.props.intl.formatMessage(Mi.no_connection),"warn"),this.setState({liveConnection:e})}handleVisibilityEvent(){this.setState({applicationVisible:!document.hidden})}static stateForError(e,t,s,a){return{errorText:e,errorLevel:t,errorAction:s,errorActionText:a,callShouldStart:!1}}handleError(e,t,s,a){this.setState(_i.stateForError(e,t,s,a))}handleLoginRequest(e,t){this.setState({loginDisabled:!0,login:e,password:t,loadSpinnerVisible:!0,autoLogin:!0}),this.handleError("",null),this.tinode.isConnected()?this.doLogin(e,t,null,{meth:this.state.credMethod,resp:this.state.credCode}):this.tinode.connect().catch(e=>{this.setState({loginDisabled:!1,autoLogin:!1,loadSpinnerVisible:!1}),this.handleError(e.message,"err")}),this.state.desktopAlertsEnabled&&!this.state.firebaseToken&&this.initFCMessaging()}handlePersistenceChange(e){e?this.tinode.initStorage().then(e=>{yi.A.setObject("keep-logged-in",!0),this.setState({persist:!0})}):this.tinode.clearStorage().then(e=>{yi.A.setObject("keep-logged-in",!1),this.setState({persist:!1})})}handleConnected(){clearInterval(this.reconnectCountdown),this.handleError();const e=this.tinode.getServerInfo();this.setState({serverVersion:e.ver+" "+(e.build?e.build:"none"),reqCredMethod:((e.reqCred||{}).auth||[])[0]||"email"}),this.state.autoLogin&&this.doLogin(this.state.login,this.state.password,null,{meth:this.state.credMethod,resp:this.state.credCode})}handleAutoreconnectIteration(e,t){if(clearInterval(this.reconnectCountdown),e<0)return void this.handleError();if(t)return void t.then(e=>{this.handleError()}).catch(e=>{this.handleError(e.message,"err")});const{formatMessage:s}=this.props.intl;let a=e/1e3;a|=a,this.reconnectCountdown=setInterval(e=>{if(a<-10)return clearInterval(this.reconnectCountdown),void this.tinode.reconnect();const t=a>99?(0,js.Ye)(a):a;this.handleError(s(Mi.reconnect_countdown,{seconds:t}),"warn",e=>{clearInterval(this.reconnectCountdown),this.tinode.reconnect()},s(Mi.reconnect_now)),a-=1},1e3)}handleDisconnect(e){this.setState({connected:!1,ready:!1,topicSelectedOnline:!1,errorText:e&&e.message?e.message:"Disconnected",errorLevel:e&&e.message?"err":"warn",loginDisabled:!1,contextMenuVisible:!1,forwardDialogVisible:!1,serverVersion:"no connection"})}doLogin(e,t,s,a){if(this.tinode.isAuthenticated())return void Ta.A.navigateTo("");let i=s||(this.tinode.getAuthToken()||{}).token;if(!(e&&t||i))return Ta.A.navigateTo(""),void this.setState({loginDisabled:!1});a=Ts.Tinode.credential(a);let n,r=this.tinode.isConnected()?Promise.resolve():this.tinode.connect();e&&t?(i=null,this.setState({password:null}),n=r.then(s=>this.tinode.loginBasic(e,t,a))):n=r.then(e=>this.tinode.loginToken(i,a)),n.then(e=>{e.code>=300&&"validate credentials"===e.text?(this.setState({loadSpinnerVisible:!1}),a&&this.handleError(this.props.intl.formatMessage(Mi.code_doesnot_match),"warn"),_i.navigateToCredentialsView(e.params)):this.handleLoginSuccessful()}).catch(e=>{const t=e.code>=500;this.setState({loginDisabled:!1,credMethod:void 0,credCode:void 0,loadSpinnerVisible:!1,autoLogin:t}),this.handleError(e.message,"err"),console.warn("Login failed",e),t||(i&&this.handleLogout(),Ta.A.navigateTo(""))})}static navigateToCredentialsView(e){const t=Ta.A.parseUrlHash(window.location.hash);t.path[0]="cred",t.params.method=e.cred[0],t.params.token=e.token,t.params.code=e.code,Ta.A.navigateTo(Ta.A.composeUrlHash(t.path,t.params))}handleLoginSuccessful(){this.handleError(),yi.A.getObject("keep-logged-in")&&yi.A.setObject("auth-token",this.tinode.getAuthToken());const e=this.state.requestedTopic,t=this.tinode.getMeTopic();t.onMetaDesc=this.tnMeMetaDesc,t.onContactUpdate=this.tnMeContactUpdate,t.onSubsUpdated=this.tnMeSubsUpdated,this.setState({connected:!0,credMethod:void 0,credCode:void 0,credToken:void 0,myUserId:this.tinode.getCurrentUserID(),autoLogin:!0,requestedTopic:void 0}),t.subscribe(t.startMetaQuery().withLaterSub().withDesc().withTags().withCred().build()).catch(e=>{this.tinode.disconnect(),localStorage.removeItem("auth-token"),this.handleError(e.message,"err"),Ta.A.navigateTo("")}).finally(e=>{this.setState({loadSpinnerVisible:!1})});let s=Ta.A.setUrlSidePanel(window.location.hash,"contacts");e&&(s=Ta.A.setUrlTopic(s,e)),Ta.A.navigateTo(s)}tnMeMetaDesc(e){if(e){if(e.public&&this.setState({sidePanelTitle:e.public.fn,sidePanelAvatar:(0,Os.to)(e.public.photo)}),e.trusted){const t=[];for(const[s,a]of Object.entries(e.trusted))a&&t.push(s);this.setState({myTrustedBadges:t})}e.acs&&this.setState({incognitoMode:!e.acs.isPresencer()}),_i.checkIfPinsUpdated(e,this.state.chatList)&&this.resetContactList()}}tnMeContactUpdate(e,t){if("on"==e||"off"==e)this.resetContactList(),this.state.topicSelected==t.topic&&this.setState({topicSelectedOnline:"on"==e});else if("read"==e)this.resetContactList();else if("msg"==e&&t){const e=this.tinode.getTopic(t.topic),s=e&&e.isArchived();t.unread>0&&this.state.messageSounds&&!s&&(document.hidden||this.state.topicSelected!=t.topic)&&Si.play().catch(e=>{}),this.resetContactList()}else"recv"==e||("gone"==e||"unsub"==e?(this.state.topicSelected==t.topic&&this.handleTopicSelected(null),this.resetContactList()):"acs"==e?this.state.topicSelected==t.topic&&this.setState({topicSelectedAcs:t.acs}):"del"==e||"upd"==e||"call"==e||console.info("Unsupported (yet) presence update:",e,"in",(t||{}).topic))}tnMeSubsUpdated(e){this.resetContactList()}static prepareSearchableContacts(e,t){const s={};for(const t of e)Ts.Tinode.isP2PTopicName(t.topic)&&(s[t.topic]={user:t.topic,updated:t.updated,public:t.public,private:t.private,acs:t.acs});for(const e of t)s[e.user]||(s[e.user]=e);return Object.values(s)}resetContactList(){const e={chatList:[]};this.state.ready||(e.ready=!0);const t=this.tinode.getMeTopic();t.contacts(t=>{t.topic||t.user||(t.topic=t.name),e.chatList.push(t),this.state.topicSelected==t.topic&&(e.topicSelectedOnline=t.online,e.topicSelectedAcs=t.acs)});const s=new Date(0);e.chatList.sort((e,a)=>{const i=t.pinnedTopicRank(a.topic)-t.pinnedTopicRank(e.topic);return 0!=i?i:(a.touched||s).getTime()-(e.touched||s).getTime()}),e.searchableContacts=_i.prepareSearchableContacts(e.chatList,this.state.searchResults),this.setState(e)}static checkIfPinsUpdated(e,t){for(let s=0;s<t.length;s++){const a=t[s];if(!!e.pinnedTopicRank(a.topic)!=a.pinned)return!0}return!1}tnInitFind(){const e=this.tinode.getFndTopic();e.onSubsUpdated=this.tnFndSubsUpdated,e.isSubscribed()?this.tnFndSubsUpdated():e.subscribe(e.startMetaQuery().withSub().build()).catch(e=>{this.handleError(e.message,"err")})}tnFndSubsUpdated(){const e=[];this.tinode.getFndTopic().contacts(t=>{e.push(t)}),this.setState({searchResults:e,searchableContacts:_i.prepareSearchableContacts(this.state.chatList,e)})}handleSearchContacts(e){const t=this.tinode.getFndTopic();t.setMeta({desc:{public:e}}).then(e=>t.getMeta(t.startMetaQuery().withSub().build())).catch(e=>this.handleError(e.message,"err"))}handleTopicSelected(e){this.state.newTopicParams&&this.state.newTopicParams._topicName!=e&&this.setState({newTopicParams:null}),e?(this.setState({errorText:"",errorLevel:null,mobilePanel:"topic-view",infoPanel:void 0}),this.state.topicSelected!=e&&(this.setState({topicSelectedOnline:this.tinode.isTopicOnline(e),topicSelectedAcs:this.tinode.getTopicAccessMode(e),forwardMessage:null}),Ta.A.navigateTo(Ta.A.setUrlTopic("",e)))):(this.setState({topicSelected:null,errorText:"",errorLevel:null,mobilePanel:"sidepanel",topicSelectedOnline:!1,topicSelectedAcs:null,infoPanel:void 0,forwardMessage:null}),Ta.A.navigateTo(Ta.A.setUrlTopic("",null)))}handleHideMessagesView(){this.setState({mobilePanel:"sidepanel"}),Ta.A.navigateTo(Ta.A.setUrlTopic(window.location.hash,null))}handleSendMessage(e,t,s,a){const i=this.tinode.getTopic(this.state.topicSelected);return this.sendMessageToTopic(i,e,t,s,a)}sendMessageToTopic(e,t,s,a,i){(t=e.createMessage(t,!1))._uploader=a,i&&(t.head=Object.assign(t.head||{},i));const n=[];if(s&&n.push(s),!e.isSubscribed()){const s=e.subscribe().then(s=>{let a=[];e.queuedMessages(s=>{s._sending||s.seq==t.seq||(s.head&&s.head.webrtc?a.push(s.seq):e.isSubscribed()&&e.publishMessage(s))}),a.length>0&&e.delMessagesList(a,!0)});n.push(s)}return e.publishDraft(t,Promise.all(n)).then(t=>(e.isArchived()&&e.archive(!1),t)).catch(e=>this.handleError(e.message,"err"))}handleNewChatInvitation(e,t){const s=this.tinode.getTopic(e);let a=null;switch(t){case"accept":const i=s.getAccessMode().getGiven();a=s.setMeta({sub:{mode:i}}),s.isP2PType()&&(a=a.then(t=>s.setMeta({sub:{user:e,mode:i}})));break;case"delete":a=s.delTopic(!0);break;case"block":const n=s.getAccessMode().updateWant("-JP").getWant();a=s.setMeta({sub:{mode:n}}).then(e=>this.handleTopicSelected(null));break;default:console.warn("Unknown invitation action",'"'+t+'""')}null!=a&&a.catch(e=>this.handleError(e.message,"err"))}handleNewAccount(){this.handleError(),Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,"register"))}handleNewAccountRequest(e,t,s,a,i){this.handleError(),this.tinode.connect(this.state.serverAddress).then(n=>{let r;return s&&s.photo&&s.photo.ref&&(r=[s.photo.ref]),this.tinode.createAccountBasic(e,t,{public:s,tags:i,cred:Ts.Tinode.credential(a),attachments:r})}).then(e=>{e.code>=300&&"validate credentials"==e.text?_i.navigateToCredentialsView(e.params):this.handleLoginSuccessful(this)}).catch(e=>{this.handleError(e.message,"err")})}handleToggleIncognitoMode(e){this.setState({incognitoMode:null});const t=this.tinode.getMeTopic(),s=t.getAccessMode().updateWant(e?"-P":"+P").getWant();t.setMeta({sub:{mode:s}}).catch(t=>{this.setState({incognitoMode:!e}),this.handleError(t.message,"err")})}handleChangeColorSchema(e){this.setState({colorSchema:e}),yi.A.updateObject("settings",{colorSchema:e}),document.documentElement.style.colorScheme="auto"==e?"light dark":e,this.applyColorSchema(e,this.state.systemColorSchema,this.state.wallpaperSize)}handleColorSchemeChange(e){const t=e.matches?"dark":"light";this.setState({systemColorSchema:t}),this.applyColorSchema(this.state.colorSchema,t,this.state.wallpaperSize)}applyColorSchema(e,t,s){const a="auto"==e?t:e;document.documentElement.style.setProperty("--wallpaper-invert","dark"==a&&s?"1":"0"),document.documentElement.style.setProperty("--wallpaper-brightness","dark"!=a||s?"1":"0.5")}handleSelectWallpapers(){this.handleError(),Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,"wallpapers"))}applyWallpaperSettings(e,t,s,a){document.documentElement.style.setProperty("--wallpaper-url",`url('${e}')`),document.documentElement.style.setProperty("--wallpaper-repeat",t?"repeat":"no-repeat"),document.documentElement.style.setProperty("--wallpaper-blur",t?"0px":`${s}px`),document.documentElement.style.setProperty("--wallpaper-size",t?`${t}px`:"cover"),document.documentElement.style.setProperty("--wallpaper-position",t?"unset":"center"),document.documentElement.style.setProperty("--wallpaper-invert","dark"==a&&t?"1":"0"),document.documentElement.style.setProperty("--wallpaper-brightness","dark"!=a||t?"1":"0.5")}handleWallpaperSelected(e,t,s){this.handleError(),yi.A.updateObject("settings",{wallpaper:e,wallpaperSize:t,wallpaperBlur:s}),this.setState({wallpaper:e,wallpaperSize:t,wallpaperBlur:s}),this.applyWallpaperSettings(e,t,s,"auto"==this.state.colorSchema?this.state.systemColorSchema:this.state.colorSchema)}handleChangeTextSize(e){this.setState({textSize:0|e}),yi.A.updateObject("settings",{textSize:e}),document.documentElement.style.setProperty("--message-text-size",`${e}pt`)}handleSendOnEnter(e){this.setState({sendOnEnter:e}),yi.A.updateObject("settings",{sendOnEnter:e})}handleUpdateAccountTagsRequest(e,t){this.tinode.getMeTopic().setMeta({tags:t}).catch(e=>this.handleError(e.message,"err"))}handleSettings(){this.handleError(),Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,this.state.myUserId?"edit":"settings"))}handleGlobalSettings(e){const t=e.serverAddress||this.state.serverAddress,s=e.transport||this.state.transport,a=void 0===e.secureConnection?this.state.secureConnection:e.secureConnection;this.tinode&&(this.tinode.clearStorage(),this.tinode.onDisconnect=void 0,this.tinode.disconnect()),this.tinode=_i.tnSetup(t,a,s,this.props.intl.locale,yi.A.getObject("keep-logged-in")),this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage,this.setState({serverAddress:t,transport:s,secureConnection:a}),yi.A.setObject("settings",{serverAddress:t,transport:s,secureConnection:a}),Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,""))}handleShowArchive(){Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,this.state.myUserId?"archive":""))}handleShowBlocked(){Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,this.state.myUserId?"blocked":""))}toggleFCMToken(e){e?(this.setState({desktopAlerts:null}),this.state.firebaseToken?(this.setState({desktopAlerts:!0}),yi.A.getObject("keep-logged-in")&&yi.A.updateObject("settings",{desktopAlerts:!0})):this.initFCMessaging()):this.state.firebaseToken&&this.fcm?Ms(this.fcm).catch(e=>{console.error("Unable to delete token.",e)}).finally(e=>{yi.A.updateObject("settings",{desktopAlerts:!1}),localStorage.removeItem("firebase-token"),this.setState({desktopAlerts:!1,firebaseToken:null}),this.tinode.setDeviceToken(null)}):(this.setState({desktopAlerts:!1,firebaseToken:null}),yi.A.updateObject("settings",{desktopAlerts:!1}))}handleToggleMessageSounds(e){this.setState({messageSounds:e}),yi.A.updateObject("settings",{messageSoundsOff:!e})}handleCredAdd(e,t){this.tinode.getMeTopic().setMeta({cred:{meth:e,val:t}}).catch(e=>this.handleError(e.message,"err"))}handleCredDelete(e,t){this.tinode.getMeTopic().delCredential(e,t).catch(e=>this.handleError(e.message,"err"))}handleCredConfirm(e,t){_i.navigateToCredentialsView({cred:[e],code:t})}handleSidepanelCancel(){const e=Ta.A.parseUrlHash(window.location.hash);let t="";["security","support","general","notif","acc_general"].includes(e.path[0])?t="edit":"crop"==e.path[0]?t="general":"blocked"==e.path[0]?t="security":"wallpapers"==e.path[0]?t="acc_general":this.state.myUserId&&(t="contacts"),e.path[0]=t,e.params&&(delete e.params.code,delete e.params.method,delete e.params.tab,delete e.params.scheme,delete e.params.token),Ta.A.navigateTo(Ta.A.composeUrlHash(e.path,e.params)),this.setState({errorText:"",errorLevel:null})}basicNavigator(e){Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,e))}infoNavigator(e){Ta.A.navigateTo(Ta.A.setUrlInfoPanel(window.location.hash,e))}handleStartTopicRequest(e,t,s){if(e&&this.tinode.isTopicCached(e))return void this.handleTopicSelected(e);const a={};Ts.Tinode.isP2PTopicName(e)?(a.sub={mode:ks.cZ},a.desc={defacs:{auth:ks.cZ}}):(e=e||this.tinode.newGroupTopicName(s),t&&(a.desc={public:t.public,private:{comment:t.private}},a.tags=t.tags)),a._topicName=e,this.setState({newTopicParams:a},t=>{this.handleTopicSelected(e)})}handleNewTopicCreated(e,t){let s={};this.state.callShouldStart&&(s={callState:3,callShouldStart:!1}),this.state.topicSelected==e&&e!=t&&(s.topicSelected=t),this.setState(s,e=>{Ta.A.navigateTo(Ta.A.setUrlTopic("",t))})}handleTopicUpdateRequest(e,t,s,a){this.handleError();const i=this.tinode.getTopic(e);if(i){const e={};let n;t&&(t.photo&&(t.photo.ref&&t.photo.ref!=Ts.Tinode.DEL_CHAR?n=[t.photo.ref]:t.photo.data&&t.photo.data!=Ts.Tinode.DEL_CHAR||(t.photo=Ts.Tinode.DEL_CHAR)),e.public=t),"string"==typeof s&&(e.private=s===Ts.Tinode.DEL_CHAR?Ts.Tinode.DEL_CHAR:{comment:s}),a&&(e.defacs=a),i.setMeta({desc:e,attachments:n}).catch(e=>this.handleError(e.message,"err"))}}handleUnarchive(e){const t=this.tinode.getTopic(e);t&&t.archive(!1).catch(e=>this.handleError(e.message,"err"))}handleUpdatePasswordRequest(e){this.handleError(),e&&this.tinode.updateAccountBasic(null,this.tinode.getCurrentLogin(),e).catch(e=>this.handleError(e.message,"err"))}handleChangePermissions(e,t,s){const a=this.tinode.getTopic(e);if(a){const e=a.getAccessMode();s?(e.updateGiven(t),t=e.getGiven()):(e.updateWant(t),t=e.getWant()),a.setMeta({sub:{user:s,mode:t}}).catch(e=>this.handleError(e.message,"err"))}}handleTagsUpdateRequest(e,t){const s=this.tinode.getTopic(e);s&&s.setMeta({tags:t}).catch(e=>this.handleError(e.message,"err"))}handleLogout(){let e;(0,Xs.OM)(0),localStorage.removeItem("auth-token"),localStorage.removeItem("firebase-token"),localStorage.removeItem("settings"),this.state.firebaseToken&&Ms(this.fcm),document.documentElement.style.colorScheme="auto"==ks.gb?"light dark":ks.gb,document.documentElement.style.setProperty("--message-text-size",`${ks.cL}pt`),clearInterval(this.reconnectCountdown),this.tinode?(e=this.tinode.clearStorage(),this.tinode.onDisconnect=void 0,this.tinode.disconnect()):e=Promose.resolve(),this.setState(this.getBlankState()),e.then(e=>{this.tinode=_i.tnSetup(this.state.serverAddress,Ei(),this.state.transport,this.props.intl.locale,yi.A.getObject("keep-logged-in"),e=>{this.tinode.onConnect=this.handleConnected,this.tinode.onDisconnect=this.handleDisconnect,this.tinode.onAutoreconnectIteration=this.handleAutoreconnectIteration,this.tinode.onInfoMessage=this.handleInfoMessage,this.tinode.onDataMessage=this.handleDataMessage,Ta.A.navigateTo("")})})}handleDeleteAccount(){this.tinode.delCurrentUser(!0).then(e=>{this.handleLogout()})}handleDeleteTopicRequest(e){const t=this.tinode.getTopic(e);t&&t.delTopic(!0).then(e=>{Ta.A.navigateTo(Ta.A.setUrlTopic(window.location.hash,""))}).catch(e=>{this.handleError(e.message,"err")})}handleDeleteMessagesRequest(e){const t=this.tinode.getTopic(e);t&&t.delMessagesAll(!0).catch(e=>this.handleError(e.message,"err"))}handleLeaveUnsubRequest(e){const t=this.tinode.getTopic(e);t&&t.leave(!0).then(e=>{Ta.A.navigateTo(Ta.A.setUrlTopic(window.location.hash,""))}).catch(e=>{this.handleError(e.message,"err")})}handleBlockTopicRequest(e){const t=this.tinode.getTopic(e);t&&t.updateMode(null,"-JP").then(e=>{Ta.A.navigateTo(Ta.A.setUrlTopic(window.location.hash,""))}).catch(e=>this.handleError(e.message,"err"))}handleReportTopic(e){const t=this.tinode.getTopic(e);t&&(this.tinode.report("report",e),t.updateMode(null,"-JP").then(e=>{Ta.A.navigateTo(Ta.A.setUrlTopic(window.location.hash,""))}).catch(e=>this.handleError(e.message,"err")))}handleShowContextMenu(e,t){this.setState({contextMenuVisible:!0,contextMenuClickAt:{x:e.x,y:e.y},contextMenuParams:e,contextMenuItems:t||this.defaultTopicContextMenu(e.topicName),contextMenuBounds:this.selfRef.current.getBoundingClientRect()})}handleShowForwardDialog(e){"newtpk"==this.state.sidePanelSelected&&this.handleSidepanelCancel();const t="➦ "+e.userName,s="string"==typeof e.content?Ts.Drafty.init(e.content):Ts.Drafty.forwardedContent(e.content),a=Ts.Drafty.preview(s,ks.TR,!0),i=Ts.Drafty.append(Ts.Drafty.appendLineBreak(Ts.Drafty.mention(t,e.userFrom)),s),n=Ts.Drafty.quote(t,e.userFrom,a),r={forwarded:e.topicName+":"+e.seq};this.setState({forwardDialogVisible:!0,forwardMessage:{head:r,msg:i,preview:n}})}defaultTopicContextMenu(e){const t=this.tinode.getTopic(e);if(t._deleted)return["topic_delete"];const s=this.tinode.getMeTopic();let a=!1,i=!1,n=!1,r=!1,o=!1,l=!1,c=!1,h=!1,d=!1,p=!1,u=!1;if(t){r=t.isSubscribed(),l=t.isArchived(),c=s.pinnedTopicRank(e)>0;const h=t.getAccessMode();h&&(a=h.isMuted(),i=!h.isJoiner(),n=!h.isJoiner("want"),o=h.isDeleter(),d=h.isWriter())}return h=d&&!!this.tinode.getServerParam("iceServers"),p=Ts.Tinode.isP2PTopicName(e),u=Ts.Tinode.isSelfTopicName(e),[r?{title:this.props.intl.formatMessage(Mi.menu_item_info),handler:this.handleShowInfoView}:null,r&&p&&h?{title:this.props.intl.formatMessage(Mi.menu_item_audio_call),handler:this.handleStartAudioCall}:null,r&&p&&h?{title:this.props.intl.formatMessage(Mi.menu_item_video_call),handler:this.handleStartVideoCall}:null,r?"messages_clear":null,r&&o&&!u?"messages_clear_hard":null,u?null:a?i?null:"topic_unmute":"topic_mute",u?null:n?"topic_unblock":"topic_block",c?"topic_unpin":"topic_pin",l?"topic_restore":"topic_archive","topic_delete"]}handleHideContextMenu(){this.setState({contextMenuVisible:!1,contextMenuClickAt:null,contextMenuParams:null,contextMenuBounds:null})}handleHideForwardDialog(e){this.setState({forwardDialogVisible:!1,forwardMessage:e?this.state.forwardMessage:null})}handleContextMenuAction(e,t,s){"topic_archive"==e?t&&s.topicName&&s.topicName==this.state.topicSelected&&t.then(e=>{this.handleTopicSelected(null)}):"menu_item_forward"==e&&this.handleShowForwardDialog(s)}handleShowAlert(e,t,s,a,i,n){this.setState({alertVisible:!0,alertParams:{title:e,content:t,onConfirm:s,confirm:a,onReject:i,reject:n}})}handleShowInfoView(){Ta.A.navigateTo(Ta.A.addUrlParam(window.location.hash,"info","info")),this.setState({infoPanel:"info"})}handleMemberUpdateRequest(e,t,s){if(!e)return;const a=this.tinode.getTopic(e);a&&(t&&t.length>0&&t.forEach(e=>{a.invite(e,null).catch(e=>this.handleError(e.message,"err"))}),s&&s.length>0&&s.forEach(e=>{a.delSubscription(e).catch(e=>this.handleError(e.message,"err"))}))}handleValidateCredentialsRequest(e,t,s){this.tinode.isAuthenticated()?this.tinode.getMeTopic().setMeta({cred:{meth:e,resp:t}}).then(e=>Ta.A.navigateTo(Ta.A.setUrlSidePanel(window.location.hash,"contacts"))).catch(e=>this.handleError(e.message,"err")):(this.setState({credMethod:e,credCode:t,credToken:s}),this.doLogin(null,null,s,{meth:e,resp:t}))}handlePasswordResetRequest(e,t){return this.tinode.connect().then(s=>this.tinode.requestResetAuthSecret("basic",e,t)).catch(e=>{this.handleError(e.message,"err")})}handleResetPassword(e,t){const s=(0,Os.$Z)(t.secret);s&&t.scheme?this.tinode.connect().then(a=>this.tinode.updateAccountBasic(null,null,e,{scheme:t.scheme,secret:s})).then(e=>{this.handleError(this.props.intl.formatMessage(Mi.password_reset_success),"info"),Ta.A.navigateTo("")}).catch(e=>{this.handleError(e.message,"err")}):this.handleError(this.props.intl.formatMessage(Mi.invalid_security_token),"err")}handleShowCountrySelector(e,t,s){this.handleShowAlert(this.props.intl.formatMessage(Mi.select_country),l().createElement(o.Suspense,{fallback:l().createElement("div",null,l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(wi,{selected:e,onSubmit:(e,t)=>{this.setState({alertVisible:!1}),s(e,t)}})),null,null,e=>{},null)}handleStartVideoCall(){this.setState({callTopic:this.state.topicSelected,callState:1,callAudioOnly:!1})}handleStartAudioCall(){this.setState({callTopic:this.state.topicSelected,callState:1,callAudioOnly:!0})}handleCallInvite(e,t,s,a){switch(s){case 1:const s={webrtc:Ls,aonly:!!a};return this.handleSendMessage(Ts.Drafty.videoCall(a),void 0,void 0,s).then(e=>e.code<200||e.code>=300||!e.params||!e.params.seq?(this.handleCallClose(),e):(this.setState({callSeq:e.params.seq}),e));case 3:const i=this.tinode.getTopic(e);if(!i)return;i.videoCall("accept",t)}}handleCallRinging(e,t){const s=this.tinode.getTopic(e);s&&s.videoCall("ringing",t)}handleCallHangup(e,t){const s=this.tinode.getTopic(e);s&&s.videoCall("hang-up",t)}handleCallSendOffer(e,t,s){const a=this.tinode.getTopic(e);a&&a.videoCall("offer",t,s)}handleCallIceCandidate(e,t,s){const a=this.tinode.getTopic(e);a&&a.videoCall("ice-candidate",t,s)}handleCallSendAnswer(e,t,s){const a=this.tinode.getTopic(e);a&&a.videoCall("answer",t,s)}handleCallClose(){this.callTimeoutTimer&&clearTimeout(this.callTimeoutTimer),this.setState({callTopic:void 0,callState:0,callAudioOnly:void 0})}handleCallAccept(e,t,s){const a=this.tinode.getTopic(e);if(a)if(a.isSubscribed()){this.handleTopicSelected(t?e:this.state.callTopic);const a={callState:3};t&&(a.callTopic=e,a.callSeq=s),this.setState(a)}else this.setState({callShouldStart:!0},e=>this.handleTopicSelected(this.state.callTopic))}handleInfoMessage(e){if("call"==e.what)switch(e.event){case"accept":if(Ts.Tinode.isMeTopicName(e.topic)&&this.tinode.isMe(e.from))return void this.setState({callTopic:null,callState:0,callSeq:null,callAudioOnly:void 0});e.topic==this.state.callTopic&&this.setState({callState:3});break;case"hang-up":this.handleCallClose()}}handleDataMessage(e){if(e.head&&e.head.webrtc&&e.head.webrtc==Ls&&Ts.Tinode.isP2PTopicName(e.topic)){const t=this.tinode.getTopic(e.topic);if(t){const s=t.latestMsgVersion(e.seq)||e;s.head&&s.head.webrtc&&s.head.webrtc==Ls&&e.from!=this.state.myUserId&&(0==this.state.callState?this.setState({callTopic:e.topic,callState:2,callSeq:e.seq,callAudioOnly:!!s.head.aonly}):this.handleCallHangup(e.topic,e.seq))}else console.warn("Received vc data message from unknown topic",e.topic)}}render(){const e="auto"!==this.state.colorSchema?this.state.colorSchema:this.state.systemColorSchema;return l().createElement("div",{id:"app-container",ref:this.selfRef},this.state.contextMenuVisible?l().createElement(Is,{tinode:this.tinode,bounds:this.state.contextMenuBounds,clickAt:this.state.contextMenuClickAt,params:this.state.contextMenuParams,items:this.state.contextMenuItems,hide:this.handleHideContextMenu,onShowAlert:this.handleShowAlert,onAction:this.handleContextMenuAction,onTopicRemoved:e=>{e==this.state.topicSelected&&this.handleTopicSelected(null)},onError:this.handleError}):null,this.state.forwardDialogVisible?l().createElement(Rs,{tinode:this.tinode,contacts:this.state.chatList,topicSelected:this.state.topicSelected,myUserId:this.state.myUserId,hide:this.handleHideForwardDialog,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,onTopicSelected:this.handleStartTopicRequest}):null,this.state.callTopic&&2==this.state.callState?l().createElement(qs,{tinode:this.tinode,topic:this.state.callTopic,seq:this.state.callSeq,callState:this.state.callState,audioOnly:this.state.callAudioOnly,onClose:this.handleCallClose,onRinging:this.handleCallRinging,onAcceptCall:this.handleCallAccept,onReject:this.handleCallHangup}):null,this.state.alertVisible?l().createElement(As,{title:this.state.alertParams.title,content:this.state.alertParams.content,onReject:this.state.alertParams.onReject?e=>this.setState({alertVisible:!1}):null,reject:this.state.alertParams.reject,onConfirm:this.state.alertParams.onConfirm?e=>{this.setState({alertVisible:!1}),this.state.alertParams.onConfirm()}:null,confirm:this.state.alertParams.confirm}):null,this.state.displayMobile&&"sidepanel"!=this.state.mobilePanel?null:l().createElement(fi,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,state:this.state.sidePanelSelected,title:this.state.sidePanelTitle,avatar:this.state.sidePanelAvatar,trustedBadges:this.state.myTrustedBadges,login:this.state.login,persist:this.state.persist,myUserId:this.state.myUserId,loginDisabled:this.state.loginDisabled,loadSpinnerVisible:this.state.loadSpinnerVisible,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,topicSelected:this.state.topicSelected,chatList:this.state.chatList,credMethod:this.state.credMethod,credCode:this.state.credCode,credToken:this.state.credToken,transport:this.state.transport,messageSounds:this.state.messageSounds,desktopAlerts:this.state.desktopAlerts,desktopAlertsEnabled:this.state.desktopAlertsEnabled,incognitoMode:this.state.incognitoMode,serverAddress:this.state.serverAddress,secureConnection:this.state.secureConnection,serverVersion:this.state.serverVersion,reqCredMethod:this.state.reqCredMethod,textSize:this.state.textSize,colorSchema:this.state.colorSchema,systemColorSchema:this.state.systemColorSchema,sendOnEnter:this.state.sendOnEnter,onGlobalSettings:this.handleGlobalSettings,onSignUp:this.handleNewAccount,onSettings:this.handleSettings,onNavigate:this.basicNavigator,onLoginRequest:this.handleLoginRequest,onPersistenceChange:this.handlePersistenceChange,onCreateAccount:this.handleNewAccountRequest,onUpdateAccountDesc:this.handleTopicUpdateRequest,onUpdatePassword:this.handleUpdatePasswordRequest,onUpdateAccountTags:this.handleUpdateAccountTagsRequest,onTogglePushNotifications:this.toggleFCMToken,onToggleMessageSounds:this.handleToggleMessageSounds,onToggleIncognitoMode:this.handleToggleIncognitoMode,onChangeColorSchema:this.handleChangeColorSchema,onTextSizeChanged:this.handleChangeTextSize,onSendOnEnterChanged:this.handleSendOnEnter,onSelectWallpapers:this.handleSelectWallpapers,onWallpaperSelected:this.handleWallpaperSelected,onCredAdd:this.handleCredAdd,onCredDelete:this.handleCredDelete,onCredConfirm:this.handleCredConfirm,onTopicSelected:this.handleTopicSelected,onCreateTopic:this.handleStartTopicRequest,onLogout:this.handleLogout,onDeleteAccount:this.handleDeleteAccount,onShowAlert:this.handleShowAlert,onCancel:this.handleSidepanelCancel,onError:this.handleError,onValidateCredentials:this.handleValidateCredentialsRequest,onPasswordResetRequest:this.handlePasswordResetRequest,onResetPassword:this.handleResetPassword,onShowArchive:this.handleShowArchive,onShowBlocked:this.handleShowBlocked,onShowCountrySelector:this.handleShowCountrySelector,onInitFind:this.tnInitFind,searchResults:this.state.searchResults,onSearchContacts:this.handleSearchContacts,showContextMenu:this.handleShowContextMenu}),!this.state.displayMobile||"topic-view"==this.state.mobilePanel&&!this.state.infoPanel?l().createElement(Pa,{tinode:this.tinode,connected:this.state.connected,ready:this.state.ready,online:this.state.topicSelectedOnline,acs:this.state.topicSelectedAcs,displayMobile:this.state.displayMobile,viewportWidth:this.state.viewportWidth,viewportHeight:this.state.viewportHeight,topic:this.state.topicSelected,myUserId:this.state.myUserId,myUserName:this.state.sidePanelTitle,serverVersion:this.state.serverVersion,serverAddress:this.state.serverAddress,applicationVisible:this.state.applicationVisible,colorSchema:e,sendOnEnter:this.state.sendOnEnter,wallpaper:this.state.wallpaper,forwardMessage:this.state.forwardMessage,onCancelForwardMessage:this.handleHideForwardDialog,callTopic:this.state.callTopic,callSeq:this.state.callSeq,callState:this.state.callState,callAudioOnly:this.state.callAudioOnly,onCallHangup:this.handleCallHangup,onAcceptCall:this.handleCallAccept,onCallInvite:this.handleCallInvite,onCallSendOffer:this.handleCallSendOffer,onCallIceCandidate:this.handleCallIceCandidate,onCallSendAnswer:this.handleCallSendAnswer,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,newTopicParams:this.state.newTopicParams,onHideMessagesView:this.handleHideMessagesView,onError:this.handleError,onNewTopicCreated:this.handleNewTopicCreated,showContextMenu:this.handleShowContextMenu,onChangePermissions:this.handleChangePermissions,onNewChat:this.handleNewChatInvitation,sendMessage:this.handleSendMessage,onVideoCallClosed:this.handleCallClose}):null,this.state.infoPanel?l().createElement(o.Suspense,{fallback:l().createElement("div",null,l().createElement(h.FormattedMessage,{id:"loading_note",defaultMessage:[{type:0,value:"Loading..."}]}))},l().createElement(Ci,{tinode:this.tinode,connected:this.state.connected,displayMobile:this.state.displayMobile,topic:this.state.topicSelected,searchableContacts:this.state.searchableContacts,myUserId:this.state.myUserId,panel:this.state.infoPanel,errorText:this.state.errorText,errorLevel:this.state.errorLevel,errorAction:this.state.errorAction,errorActionText:this.state.errorActionText,onNavigate:this.infoNavigator,onTopicDescUpdateRequest:this.handleTopicUpdateRequest,onShowAlert:this.handleShowAlert,onChangePermissions:this.handleChangePermissions,onMemberUpdateRequest:this.handleMemberUpdateRequest,onDeleteTopic:this.handleDeleteTopicRequest,onDeleteMessages:this.handleDeleteMessagesRequest,onLeaveTopic:this.handleLeaveUnsubRequest,onBlockTopic:this.handleBlockTopicRequest,onReportTopic:this.handleReportTopic,onAddMember:this.handleManageGroupMembers,onTopicTagsUpdateRequest:this.handleTagsUpdateRequest,onTopicUnArchive:this.handleUnarchive,onInitFind:this.tnInitFind,onError:this.handleError,showContextMenu:this.handleShowContextMenu})):null)}}var Ti=(0,h.injectIntl)(_i);if("undefined"!=typeof FIREBASE_INIT&&FIREBASE_INIT&&FIREBASE_INIT.measurementId){const xi=document.getElementsByTagName("head")[0];let Ui=document.createElement("script");function Li(){dataLayer.push(arguments)}Ui.src="https://www.googletagmanager.com/gtag/js?id="+FIREBASE_INIT.measurementId,Ui.async=!0,xi.prepend(Ui),window.dataLayer=window.dataLayer||[],Li("js",new Date),Li("config",FIREBASE_INIT.measurementId)}const Ai={ar:e=>r.e(143).then(r.t.bind(r,7143,19)),de:e=>r.e(175).then(r.t.bind(r,2175,19)),en:e=>r.e(399).then(r.t.bind(r,3399,19)),es:e=>r.e(64).then(r.t.bind(r,6064,19)),fr:e=>r.e(500).then(r.t.bind(r,2500,19)),it:e=>r.e(197).then(r.t.bind(r,7197,19)),ko:e=>r.e(186).then(r.t.bind(r,1186,19)),ro:e=>r.e(780).then(r.t.bind(r,8399,19)),ru:e=>r.e(553).then(r.t.bind(r,5553,19)),th:e=>r.e(536).then(r.t.bind(r,2536,19)),uk:e=>r.e(552).then(r.t.bind(r,4552,19)),zh:e=>r.e(570).then(r.t.bind(r,570,19)),"zh-TW":e=>r.e(744).then(r.t.bind(r,5744,19))},{params:ki}=Ta.A.parseUrlHash(window.location.hash),Ni=ki&&ki.hl||navigator.languages&&navigator.languages[0]||navigator.language||navigator.userLanguage||"en",Di=Ni.replace("_","-"),Ii=Di.split("-")[0].toLowerCase(),Pi=Ai[Di]?Ni:Ai[Ii]?Ii:"en",Fi=document.getElementsByTagName("html")[0];Fi.setAttribute("lang",Pi),["ar","fa","he","ur"].includes(Ii)&&Fi.setAttribute("dir","rtl");const Ri=(0,c.H)(document.getElementById("mountPoint"));Ai[Pi]().then(e=>Ri.render(l().createElement(h.IntlProvider,{locale:Ni,messages:e,textComponent:l().Fragment},l().createElement(Ti,null))))}();
//# sourceMappingURL=index.prod.js.map