-
Notifications
You must be signed in to change notification settings - Fork 40
/
matrix-element.2.min.js
2 lines (2 loc) · 27.1 KB
/
matrix-element.2.min.js
1
2
(window["matrixElement_jsonp"]=window["matrixElement_jsonp"]||[]).push([[2],{"0084":function(e,t,i){var n=i("24fb");t=n(!1),t.push([e.i,".opacity[data-v-59e90d10]{opacity:0}.chatIcon[data-v-59e90d10]{width:100%;position:relative}.unknowngroupusersicon[data-v-59e90d10]{position:absolute;left:0;top:0;bottom:0;right:0;font-size:.7em;display:flex;justify-content:center;align-items:center;color:#fff}.unknowngroupusers .bgimage[data-v-59e90d10]{transform:scale(.7)}.chatGroupIcon[data-v-59e90d10],.chatGroupIcon img[data-v-59e90d10]{width:100%;height:100%}.chatGroupIcon img[data-v-59e90d10]{border-radius:50%;-o-object-fit:cover;object-fit:cover;-o-object-position:50% 50%;object-position:50% 50%;position:absolute;top:0;z-index:100}",""]),e.exports=t},"07c5":function(e,t,i){var n=i("24fb");t=n(!1),t.push([e.i,".eventWrapper[data-v-7cedee84] .event{padding:.25em 0}.eventWrapper[data-v-7cedee84]{transition:background .3s}.eventWrapper.fromsearch[data-v-7cedee84],.eventWrapper.fromsearch[data-v-7cedee84] .allscreen{background:rgba(var(--color-bg-ac-bright),.1)}.eventWrapper.attention[data-v-7cedee84],.eventWrapper.attention[data-v-7cedee84] .allscreen{background:rgb(var(--neutral-grad-0))}.list-enter-active[data-v-7cedee84],.list-leave-active[data-v-7cedee84]{transition:all 1s}.list-enter[data-v-7cedee84],.list-leave-to[data-v-7cedee84]{opacity:0}#events[data-v-7cedee84]{--events-padding-bottom:51px;left:0;right:0;top:0;bottom:0;padding-bottom:50px;position:absolute;transition:.3s}#events[data-chat-input-embedded=true][data-v-7cedee84]{--events-padding-bottom:100px}#events.mobile[data-v-7cedee84]{padding-bottom:calc(var(--app-margin-bottom, 0) + var(--events-padding-bottom));transform:translate3d(0,calc(var(--keyboardheight, 0)*-1 - -1px),0)}#events.mobile .scrollbottom[data-v-7cedee84]{bottom:6em}.dummyheight[data-v-7cedee84]{height:100%;width:2px;left:0;right:0;top:0;bottom:0;background:rgb(var(--color-shadow-base))}.preloadingWrapper[data-v-7cedee84]{padding:2em;text-align:center;opacity:.5;color:rgb(var(--text-color))}.scrollbottom[data-v-7cedee84]{position:absolute;right:.5em;bottom:4em;cursor:pointer;border-radius:50%;background:rgb(var(--background-main));box-shadow:0 5px 7px -5px rgba(var(--color-shadow-base),.7);color:rgb(var(--color-txt-gray-dark));width:35px;height:35px;line-height:35px;text-align:center;z-index:3}.scrollbottom i[data-v-7cedee84]{font-size:.7em}.eventsflex[data-v-7cedee84]{display:flex;flex-flow:column;overflow-y:overlay;overflow-x:hidden;max-width:640px;margin:0 auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;flex-wrap:nowrap;width:100%;height:100%;scroll-behavior:auto;continue:fragments;justify-content:flex-start;transform:scaleY(-1);contain:strict}.eventsflex.freeze[data-v-7cedee84]{overflow-y:hidden}.eventsflex .ewr[data-v-7cedee84]{position:relative}.eventsflex .eventspage[data-v-7cedee84],.eventsflex .ewr[data-v-7cedee84]{width:100%;display:flex;flex-flow:column;flex-wrap:nowrap;justify-content:flex-start}.eventsflex .errorWrapper[data-v-7cedee84]{padding:.5em}.eventsflex .errorWrapper .btnwrp[data-v-7cedee84]{padding-top:.5em}.eventsflex .errorWrapper .error[data-v-7cedee84]{padding:1em;border-radius:1em;background:rgb(var(--neutral-grad-0))}.eventsflex .errorWrapper[data-v-7cedee84],.eventsflex .eventWrapper[data-v-7cedee84]{width:100%;transform:scaleY(-1)}.eventsflex.mobile[data-v-7cedee84]{scroll-behavior:smooth}.eventsflex.mobile[data-v-7cedee84] .dropdown.visible{top:-55px}.eventsflex.mobile[data-v-7cedee84] .outer-div .backgr,.eventsflex.mobile[data-v-7cedee84] .outer-div .menuwrapper{position:absolute}.eventsflex.mobile.ios.menuOpen[data-v-7cedee84]{overflow:visible}.galleryRow[data-v-7cedee84]{display:flex;align-items:flex-end}.galleryRow .messageImg[data-v-7cedee84]{max-width:50%;margin:0 10px;position:relative}.galleryRow .messageImg .img[data-v-7cedee84]{display:block;border-radius:.5em;position:relative;max-width:100%}.galleryRow .messageImg .loadingImg[data-v-7cedee84]{display:flex;align-items:center;justify-content:center;border-radius:.5em;position:relative;max-width:300px;height:250px}.galleryRow .messageImg .loadingImg .imgPreview[data-v-7cedee84]{border-radius:.5em;position:relative;max-width:100%;height:100%;opacity:.6}.galleryRow .messageImg .loadingImg .clipLoader[data-v-7cedee84]{position:absolute;z-index:9999;left:50%;right:0;top:50%;bottom:0;transform:translate(-50,50);display:flex;align-items:center;justify-content:center}.galleryRow .messageImg .imgMsg img[data-v-7cedee84]{max-width:100%;-o-object-fit:cover;object-fit:cover;border-radius:1em;display:block}.galleryRow .messageImg .metaLink[data-v-7cedee84]{background:#000}.galleryRow .messageImg .metaLink .metaMessageLink .metaTitle[data-v-7cedee84]{font-weight:700;font-size:.9em}.galleryRow .messageImg .metaLink .metaMessageLink .metaDescription[data-v-7cedee84]{margin:.5em 0;font-size:.8em}.galleryRow .messageImg .metaLink .metaMessageLink .metaImgWrapper[data-v-7cedee84]{display:block;max-width:300px;-o-object-fit:cover;object-fit:cover}.galleryRow .messageImg .metaLink .metaMessageLink .metaImgWrapper img[data-v-7cedee84]{display:block;width:100%;height:100%}",""]),e.exports=t},1945:function(e,t,i){var n=i("4b78");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var s=i("35d6").default;e.exports.__inject__=function(e){s("629a693a",n,e)}},"25dd":function(e,t,i){"use strict";i.r(t);var n=i("5c94");for(var s in n)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(s)},3094:function(e,t,i){"use strict";var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"chatIcon",class:{unknowngroupusers:e.unknowngroupusers}},[e.groupAvatar?t("div",{staticClass:"chatGroupIcon"},[t("userpic",{attrs:{image:e.groupAvatar}})],1):t("userspic",{key:e.allnotifications,class:{opacity:e.groupAvatar},attrs:{slidesPerView:e.slidesPerView,users:e.usersinfo,status:e.status,unseen:e.unseen,single:e.singleAvatar}})],1)},s=[],r=i("3139"),a={name:"chatIcon",data:function(){return{single:[]}},props:{chat:{},m_chat:{},slidesPerView:Number,hideunseen:Boolean,dontuseslides:Boolean},computed:{allnotifications:function(){return this.$store.state.allnotifications||"0"},unseen:function(){return this.hideunseen||this.blockedCheck?0:"invite"===this.m_chat.selfMembership&&r["a"].date.addseconds(moment.utc(this.m_chat.summary.lastModified).toDate(),86400)>new Date?1:(this.allnotifications,this.m_chat.getUnreadNotificationCount())},users:function(){if(!this.chat)return[];var e=this.core.mtrx.anotherChatUsers(this.chat.roomId);return this.dontuseslides&&(e=_.first(e,4)),_.first(_.shuffle(e),49)},singleAvatar:function(){if(!this.chat&&!this.m_chat)return{};if("public"===this.m_chat.getJoinRule()&&1===this.m_chat.currentState.getMembers().length){var e=this.m_chat.currentState.getMembers()[0],t=this.$store.state.users[r["a"].getmatrixid(e.userId)];if(t)return t.status=e.membership,t.image=t.source.i,t}return{}},blockedCheck:function(){var e=this.core.mtrx.anotherChatUsers(this.m_chat.roomId);if(1==e.length)return this.core.mtrx.blockeduser(e[0].userId)},usersinfo:function(){var e=this.core.mtrx.chatUsersInfo(this.chat.roomId,"anotherChatUsers");return this.dontuseslides&&(e=_.first(e,4)),_.first(_.shuffle(e),49)},status:function(){var e={};return _.each(this.users,t=>{e[t.userId]=this.core.mtrx.blockeduser(t.userId)?"blocked":t.membership}),e},unknowngroupusers:function(){return this.core.mtrx.kit.unknowngroupusers(this.m_chat)},groupAvatar:function(){var e;const t=null===(e=this.m_chat.currentState.getStateEvents("m.room.avatar")[0])||void 0===e?void 0:e.event.content.avatarUrl;return""!==t?t:""}}},o=a,c=i("2877");function l(e){var t=i("25dd");t.__inject__&&t.__inject__(e)}var d=Object(c["a"])(o,n,s,!1,l,"59e90d10",null,!0);t["a"]=d.exports},"3ba75":function(e,t,i){"use strict";i.r(t);var n=i("b195");for(var s in n)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(s)},"4b78":function(e,t,i){var n=i("24fb");t=n(!1),t.push([e.i,"[data-v-430b7992] .eventMember{text-align:left}[data-v-430b7992] .eventMember span{font-size:.9em}.pswp img[data-v-430b7992]{max-width:none;-o-object-fit:contain;object-fit:contain}#chatList.minimized:not(.active) .timeLineWrapper[data-v-430b7992]{padding-left:.5em}",""]),e.exports=t},"4e29":function(e,t,i){"use strict";var n=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{class:{bin:e.pocketnet,bout:!e.pocketnet,minimized:e.minimized,fix:e.pocketnet,active:e.active},attrs:{id:"chatList"}},[t("div",{ref:"work",staticClass:"work"},[t("div",{ref:"events",staticClass:"timeLineWrapper"},[e.timeline?t("events",{ref:"eventslist",attrs:{error:e.error,timeline:e.timeline,events:e.events,chat:e.chat,loading:e.lloading,scrollType:e.scrollType,selectedMessages:e.selectedMessages,searchresults:e.searchresults},on:{updated:e.updatedSize,scroll:e.scrollE,removeEvent:e.removeEvent,editingEvent:e.editingEvent,replyEvent:e.replyEvent,galleryEventOpen:t=>e.imageGallery(t),menuIsVisible:e.menuIsVisibleHandler,toreference:e.scrollToEvent}}):e._e()],1)])])},s=[],r=i("1da1"),a=(i("d9e2"),i("2f62")),o=function(){var e=this,t=e._self._c;e._self._setupProxy;return t("div",{staticClass:"maskedtop",class:{mobile:e.mobile,ios:e.ios,menuOpen:e.menuOpen,imagesList:"custom"===this.scrollType?"imagesList":""},attrs:{id:"events","data-chat-input-embedded":e.hasInputChatEmbedded}},[t("div",{ref:"container",staticClass:"eventsflex",class:{mobile:e.mobile,ios:e.ios,menuOpen:e.menuOpen},on:{wheel:e.mousewheel,scroll:e.dscroll}},[t("div",{staticClass:"ewr"},e._l(e.events,(function(i,n){return t("div",{key:i.event.event_id,ref:i.event.event_id,refInFor:!0,staticClass:"eventWrapper",class:{fromsearch:e.eventinsearchresult(i)},attrs:{event:i.event.event_id}},[t("eventsEvent",{attrs:{event:i,prevevent:e.events[n+1],galleryData:e.events,chat:e.chat,timeline:e.timeline,multiSelect:e.multiSelect,selectedMessages:e.selectedMessages},on:{showMultiSelect:e.showMultiSelect,selectMessage:e.selectMessage,removeMessage:e.removeMessage,openImageEvent:t=>e.galleryOpen(t),removeEvent:t=>e.removeEvent(i),editing:t=>e.editingEvent({event:i,text:t}),reply:t=>e.replyEvent({event:i}),mounted:e.emounted,menuIsVisible:e.menuIsVisibleHandler,toreference:e.toreference}})],1)})),0),e.loading?t("div",{staticClass:"preloadingWrapper"},[t("linepreloader")],1):e._e()]),t("transition",{attrs:{name:"fade"}},[t("div",{directives:[{name:"show",rawName:"v-show",value:e.scrollbottomshow,expression:"scrollbottomshow"}],staticClass:"scrollbottom",on:{click:e.scrolldown}},[t("i",{staticClass:"fas fa-chevron-down"})])])],1)},c=[],l=(i("14d9"),i("3139")),d=i("d7a6"),h={name:"events",props:{timeline:Object,events:Array,chat:Object,loading:Boolean,scrollType:"",searchresults:null,error:[Object,Error,String],selectedMessages:[]},inject:["matches","menuState"],components:{},data:function(){return{lastScrollPosition:0,type:"",tmt:null,lscroll:null,menuOpen:!1,c:1,ls:0,voiceMessageQueue:[],countshow:0,multiSelect:!1}},provide(){return{addToQueue:(e,t)=>{var i=_.find(this.voiceMessageQueue,e=>e.id==t);i||(this.voiceMessageQueue=[...this.voiceMessageQueue,{message:e,id:t}])},playNext:e=>{let t=this.sortedVoiceMessageQueue.findIndex(t=>t.id===e),i=-1===t?null:this.sortedVoiceMessageQueue[t+1];i&&(i.message.setTime(0),i.message.play())}}},activated(){this.restoreScrollPosition()},deactivated(){this.saveScrollPosition()},watch:{events:function(e){},selectedMessages:{immediate:!0,handler:function(){0===this.selectedMessages.length&&(this.multiSelect=!1)}},notificationCount:function(){this.lscroll&&this.lscroll.scrollTop<180&&this.chat&&this.chat.getUnreadNotificationCount()&&this.scrollToNew()}},computed:{sortedVoiceMessageQueue(){return _.sortBy(this.voiceMessageQueue,e=>e.id)},ios(){return l["a"].isios()},...Object(a["d"])({auth:e=>e.auth,mobile:e=>e.mobile,scrollbottomshow:function(){return this.lscroll&&this.lscroll.scrollTop>500},minimized:e=>e.minimized,notificationCount:e=>e.allnotifications}),...Object(d["mapGetters"])(["hasInputChatEmbedded"]),eventsByPages:function(){var e=[],t=0;return _.each(this.events,(function(i){t||e.push([]),e[e.length-1].push(i),t++,t>19&&(t=0)})),e}},destroyed:function(){this.menuState.set(null)},updated:function(){},methods:{eventinsearchresult:function(e){return!!this.searchresults&&_.find(this.searchresults,t=>t.event.event_id==e.event.event_id)},restoreScrollPosition(){const e=this.$refs.container,t=e.style.scrollBehavior;e.style.scrollBehavior="auto",this.$nextTick(()=>{e.scrollTo({top:this.lastScrollPosition}),e.style.scrollBehavior=t})},saveScrollPosition(){var e;this.lastScrollPosition=null===(e=this.lscroll)||void 0===e?void 0:e.scrollTop},scrollToReadMessages:function(){},shareEvent:function({event:e}){this.$emit("shareEvent",{event:e})},showerror:function(){return this.$dialog.alert(this.stringifyiedError,{okText:"Ok",backdropClose:!0}).catch(e=>{})},dupdated:_.debounce((function(){this.$emit("updated",this.size())}),75),dscroll:_.debounce((function(){return this.scroll()}),35),ddscroll:function(e){this.dscroll()},emounted:function(){this.$nextTick((function(){this.scrollCorrection(),this.dupdated()}))},scroll:function(){this.$emit("scroll",this.size())},size:function(){var e={scrollHeight:0,scrollTop:0,clientHeight:0};return this.$refs["container"]&&(e.scrollHeight=this.$refs["container"].scrollHeight,e.scrollTop=this.c*this.$refs["container"].scrollTop,e.clientHeight=this.$refs["container"].clientHeight),this.lscroll=e,e},editingEvent:function({event:e,text:t}){this.$emit("editingEvent",{event:e,text:t})},replyEvent:function({event:e}){this.$emit("replyEvent",{event:e})},removeEvent:function(e){this.$emit("removeEvent",e)},showPhotoSwipe(e){this.isOpen=!0,this.$set(this.options,"index",e)},hidePhotoSwipe(){this.isOpen=!1},galleryOpen(e){this.$emit("galleryEventOpen",e)},scrolldown(){this.scrollToNew(0)},scrollCorrection(){},scrollToNew(e){const t=this.$refs["container"];t.scrolling?t.scrolling(-1,this.c*e):t.scrollTop=this.c*e},scrollToEvent(e){if(this.$refs[e.event.event_id]){var t=this.$refs[e.event.event_id][0];this.scrollToNew(t.offsetTop-this.lscroll.clientHeight/2+t.clientHeight/2),t.classList.add("attention"),setTimeout(()=>{t.classList.remove("attention")},1e3)}},menuIsVisibleHandler:function(e){this.menuOpen=e,this.$emit("menuIsVisible",e)},mousewheel:function(e){return"custom"===this.scrollType?void 0:(e.preventDefault(),this.$refs["container"].scrollTop+=-e.deltaY,!1)},smoothScroll:function(e,t,i){let n=!1,s=e.scrollTop,r=e===document.body&&document.documentElement?document.documentElement:e;function a(e){return e.detail?e.wheelDelta?e.wheelDelta/e.detail/40*(e.detail>0?1:-1):-e.detail/3:e.wheelDelta?e.wheelDelta/120:e}function o(){n=!0;let t=(s-e.scrollTop)/i;e.scrollTop+=t,Math.abs(t)>.5?c(o):n=!1}e.scrolling=function(i,c){let l=a(i);s+=l*t,s=Math.max(0,Math.min(s,c||e.scrollHeight-r.clientHeight)),n||o()};let c=function(){return window.requestAnimationFrame||window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(e){window.setTimeout(e,20)}}()},showMultiSelect(){this.multiSelect=!0},selectMessage(e){0===this.selectedMessages.filter(t=>t.message_id===e.message_id).length&&this.selectedMessages.push(e)},removeMessage(e){const t=this.selectedMessages.findIndex(t=>t.message_id===e.message_id);-1!==t&&this.selectedMessages.splice(t,1)},toreference(e){this.$emit("toreference",e)}}},u=h,m=i("2877");function v(e){var t=i("87ab");t.__inject__&&t.__inject__(e)}var p=Object(m["a"])(u,o,c,!1,v,"7cedee84",null,!0),f=p.exports,g={name:"chatList",props:{chat:Object,filterType:String,error:[Object,Error,String],selectedMessages:{type:Array,default:()=>[]},searchresults:null},components:{events:f},inject:["streamMode"],data:function(){return{encryptedEvents:[],loading:!1,scrolling:!1,scrollingTo:0,cancelNextScroll:!1,timeline:null,lastEvent:{},scrollType:String,esize:{},p_b:!1,p_f:!1,updateTimeout:null,updateInterval:null,events:[],firstPaginate:!0,readPromise:null,activated:!1}},mounted:function(){this.init(),this.chat},watch:{active:function(){},filterType:function(){this.init()},activated:{immediate:!0,handler:function(){this.updateInterval&&(clearInterval(this.updateInterval),this.updateInterval=null),this.activated&&(this.updateInterval=setInterval(this.update,300))}}},computed:{...Object(a["d"])({lloading:function(){return this.loading||this["p_f"]||this["p_b"]},auth:e=>e.auth,settings_read:e=>!e.dontreadreceipts,eventsTypes:function(){var e={"m.room.message":!0,"p.room.encrypt.message":!0,"p.room.":!0,"m.room.image":!0,"m.room.audio":!0,"m.room.file":!0,"m.call.invite":!0,"m.room.request_calls_access":!0,"m.call.hangup":!0,"m.call.reject":!0,"m.fully_read":!0};return _.toArray(this.chat&&this.chat.currentState.members||{}).length>2&&(e["m.room.member"]=!0,e["m.room.power_levels"]=!0),e},pocketnet:e=>e.pocketnet,minimized:e=>e.minimized,active:e=>e.active,bin:function(e){return e.pocketnet}})},created(){this.activated=!0},beforeDestroy(){this.activated=!1,this.timeline&&this.timeline.unpaginate(this.timeline._eventCount,!0)},activated(){this.activated=!0},deactivated(){this.activated=!1},methods:{editingEvent:function({event:e,text:t}){this.$emit("editingEvent",{event:e,text:t})},replyEvent:function({event:e}){this.$emit("replyEvent",{event:e})},removeEvent:function(e){this.chat.getLiveTimeline().removeEvent(e.event.event_id)},wh:function(){if(this.esize.clientHeight)return this.esize.clientHeight},getEvents:function(){var e=this.timeline.getEvents(),t=e.filter(e=>"m.room.request_calls_access"===e.event.type).pop();return e=_.filter(e,e=>{var i=e.event.type;if(!e.localRedactionEvent()&&!e.getRedactionEvent()){if("m.room.request_calls_access"===e.event.type)return e.event.event_id===t.event.event_id&&null===e.event.content.accepted;if(("m.room.power_levels"!==e.event.type||1!==Object.keys(e.event.content.users).length)&&!(this.chat.currentState.getMembers().length<=2&&"m.room.member"===e.event.type))return!this.eventsTypes||this.eventsTypes[i]}}),e=e.reverse(),this.relations(e),e=_.sortBy(e,(function(e){return e.replacingEventDate()||e.getDate()||1/0})),e=e.reverse(),e=_.uniq(e,e=>this.core.mtrx.clearEventId(e)||l["a"].makeid()),e=_.sortBy(e,(function(e){return e.getDate()||1/0})),e=e.reverse(),this.$emit("getEvents",e),e},getEventsAndEncrypt:function(){var e=this.getEvents();return Promise.all(_.map(e,e=>{if(!this.chat.pcrypto)return Promise.resolve();if(e.event.decrypted)return Promise.resolve();var t=null,i=l["a"].deep(e,"event.content.msgtype"),n=l["a"].deep(e,"event.content.info.secrets")||l["a"].deep(e,"event.content.pbody.secrets");return n?"m.audio"==i&&(t=this.core.mtrx.getAudio(this.chat,e).catch(t=>{console.error(t),e.event.decrypted={msgtype:"m.bad.encrypted"}})):("m.audio"==i&&(t=this.core.mtrx.getAudioUnencrypt(this.chat,e)),"m.encrypted"==i&&(t=this.chat.pcrypto.decryptEvent(e.event).then(t=>(e.event.decrypted=t,Promise.resolve())).catch(e=>(e.event.decrypted={msgtype:"m.bad.encrypted"},Promise.resolve())))),t?t.catch(e=>Promise.resolve()):Promise.resolve()})).then(()=>Promise.resolve(e))},relations:function(e){var t=this.timeline.timelineSet;_.each(e,e=>{try{var i=t.relations.getChildEventsForEvent(e.event.event_id,"m.replace","m.room.message");if(i){var n=i.getLastReplacement();n&&(e.event.content.body=n.event.content.body,e.event.content.edited=n.event.event_id,e.event.content.block=n.event.content.block,e.event.content.msgtype=n.event.content.msgtype,e.event.decrypted=n.event.decrypted)}}catch(e){console.error(e)}})},customTimelineSet:function(){var e=Object(r["a"])((function*(e,t){if(e){var i=new this.core.mtrx.sdk.Filter(client.getUserId());return"function"===typeof t?t(i):i.setDefinition({room:{timeline:{contains_url:"images"===this.filterType,types:["m.room.message"]}}}),i.filterId=yield this.core.mtrx.client.getOrCreateFilter(`FILTER_${e}_`+this.core.mtrx.client.credentials.userId,i),this.chat.getOrCreateFilteredTimelineSet(i)}}));return function(t,i){return e.apply(this,arguments)}}(),init:function(){var e=Object(r["a"])((function*(){var e;switch(this.loading=!0,this.firstPaginate=!0,this.filterType){case"images":this.scrollType="custom",e=yield this.customTimelineSet("FILES");break;case"text":e=yield this.customTimelineSet("TEXT",e=>{e.setDefinition({room:{timeline:{types:["m.room.message"]}}})});break;case"donate":e=yield this.customTimelineSet("TEXT",e=>{e.setDefinition({room:{timeline:{contains_url:!0,types:["m.room.message"]}}})});break;default:var t=this.chat.getLiveTimeline();e=t.getTimelineSet()}this.timeline=new this.core.mtrx.sdk.TimelineWindow(this.core.mtrx.client,e),setTimeout(()=>{this.timeline.load().then(e=>this.getEventsAndEncrypt()).then(e=>{this.events=e,this.loading=!1,setTimeout(()=>{this.autoPaginateAll()},300)}).catch(e=>{this.loading=!1})},30)}));return function(){return e.apply(this,arguments)}}(),paginateToEvent:function(e){var t=_.find(this.events,t=>t.event.event_id==e);if(t)return Promise.resolve(t);var i=this.paginate("b");return i?i.then(()=>this.paginateToEvent(e)).catch(e=>{if(console.error("EROR",e),!t)return Promise.resolve(null)}):t?void 0:Promise.resolve(null)},autoPaginate:function(e){if(this.needLoad(e)){var t=this.paginate(e);t&&t.catch(e=>{})}},paginate:function(e,t){if(!this.loading&&this.timeline&&!this["p_"+e]){if(this.timeline.canPaginate(e)||t){this["p_"+e]=!0;let t=20;return this.timeline.paginate(e,t).then(e=>Promise.resolve()).catch(e=>(e,Promise.resolve())).then(e=>this.getEventsAndEncrypt()).then(t=>{this.events=t,this.firstPaginate=!1,this["p_"+e]=!1}).catch(e=>{if(e)return Promise.reject(e)})}this.readAll()}},autoPaginateAll:function(){"images"===this.filterType?this.autoPaginate("b"):(this.autoPaginate("b"),this.autoPaginate("f"))},needLoad:function(e){var t=!1,i=this.esize.scrollHeight||0,n=this.esize.scrollTop||0,s=Math.max(this.esize.clientHeight||0,800);if("b"==e){var r=s;i-n<s+r&&(t=!0)}else n<s&&(t=!0);return t},readEvent:function(e){if(!this.streamMode){var t=this.core.mtrx.me(e.event.sender);t||this.core.mtrx.client.sendReadReceipt(e)}},readFirst:function(){if(!this.streamMode){var e=this.timeline.getEvents();this.readEvent(e[0])}},readLast:function(){if(!this.streamMode){var e=this.timeline.getEvents();this.readEvent(e[e.length-1])}},readEvents:function(e){this.streamMode||_.each(e,e=>{this.readEvent(e)})},readOne(){this.streamMode||this.core.mtrx.client(this.chat.timeline[this.chat.timeline.length-1]).then(e=>e)},debouncedReadAll:_.debounce((function(){if(this.chat&&!this.streamMode&&!this.readPromise){var e=this.chat.timeline.length-1,t=null;if(t=this.chat.timeline[e],t){if(t.readError)return;var i=t.event.event_id;this.readPromise=this.streamMode||this.core.mtrx.client.setRoomReadMarkers(this.chat.currentState.roomId,i,t).then(e=>(t.readed=!0,e)).catch(e=>{console.error(e),t.readError=e}).finally(()=>{this.readPromise=null})}}}),100),readAll:function(){document.hasFocus()&&(!this.pocketnet||this.active)&&!this.core.hiddenInParent&&this.chat&&this.chat.getJoinedMemberCount()>0&&0!==this.chat.getUnreadNotificationCount()&&this.debouncedReadAll()},scrollE:function(e){this.updatedSize(e),this.$emit("scroll",e)},updatedSize:function(e){this.esize=e},update:function(e){this.activated&&(this.scrolling||this.autoPaginateAll())},scrollToNew:function(e){this.scrolling=!0,this.$refs.eventslist.scrollToNew(e),this.scrolling=!1},imageGallery:function(e){this.$emit("eventImage",e)},menuIsVisibleHandler:function(e){this.$emit("menuIsVisible",e)},scrollToEvent:function(e){l["a"].pretry(()=>!this.loading&&this.timeline&&!this["p_b"]).then(()=>(this.$store.state.globalpreloader=!0,this.paginateToEvent(e.event.event_id))).then(e=>{e&&setTimeout(()=>{this.$refs.eventslist.scrollToEvent(e)},300)}).catch(e=>{console.error(e)}).finally(()=>{this.$store.state.globalpreloader=!1})}}},b=g;function y(e){var t=i("87f5");t.__inject__&&t.__inject__(e)}var x=Object(m["a"])(b,n,s,!1,y,"430b7992",null,!0);t["a"]=x.exports},"5c94":function(e,t,i){var n=i("0084");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var s=i("35d6").default;e.exports.__inject__=function(e){s("39da9174",n,e)}},"76f3":function(e,t,i){var n=i("07c5");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var s=i("35d6").default;e.exports.__inject__=function(e){s("95b02382",n,e)}},"87ab":function(e,t,i){"use strict";i.r(t);var n=i("76f3");for(var s in n)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(s)},"87f5":function(e,t,i){"use strict";i.r(t);var n=i("1945");for(var s in n)["default"].indexOf(s)<0&&function(e){i.d(t,e,(function(){return n[e]}))}(s)},aa20:function(e,t,i){"use strict";var n=function(){var e=this,t=e._self._c;return t("div",{staticClass:"nameline"},[e.isShowGroupIcon?t("div",{staticClass:"iconGroup",class:{public:e.isPublic}},[e.isPublic?t("i",{staticClass:"fas fa-users"}):t("i",{staticClass:"fas fa-user-friends"})]):e._e(),e.miniappicon?t("div",{staticClass:"miniappicon"},[t("bgimage",{attrs:{src:e.miniappicon}})],1):e._e(),t("div",{staticClass:"nameofchat"},[e._v(e._s(e.convertedName))])])},s=[],r={name:"chatName",props:{chat:Object,preview:Boolean,m_chat:{}},inject:["matches","markText"],data:function(){return{}},computed:{users:function(){return this.chat?this.core.mtrx.anotherChatUsers(this.chat.roomId):[]},convertedName:function(){var e,t,i;if(this.m_chat&&"public"===this.m_chat.getJoinRule()&&this.m_chat.currentState.getStateEvents("m.room.name").length>0)return null===(i=this.m_chat.currentState.getStateEvents("m.room.name")[0].getContent())||void 0===i?void 0:i.name;var n=_.filter(this.users,e=>e.userId!=this.core.user.userinfo.id),s=_.filter(_.map(n,e=>{if(this.$store.state.users[e.userId])return this.$store.state.users[e.userId].name}),(function(e){return e}));return s.length?0==(null===(e=this.m_chat)||void 0===e?void 0:e.name.indexOf("@"))?null===(t=this.m_chat)||void 0===t?void 0:t.name.replace("@",""):s.join(", "):(this.core.mtrx.chatUsers(this.chat.roomId).length,"-")},markMatches:function(){return this.markText?this.markText(this.convertedName,!0):this.convertedName},isPublic(){return this.isShowGroupIcon&&"public"===this.m_chat.getJoinRule()},isShowGroupIcon(){var e;return!this.chat.miniappchat&&"@"===(null===(e=this.m_chat)||void 0===e?void 0:e.name.slice(0,1))},miniappicon(){return this.chat.miniappchat?this.chat.miniappchat.icon:null}},mounted:function(){}},a=r,o=i("2877");function c(e){var t=i("3ba75");t.__inject__&&t.__inject__(e)}var l=Object(o["a"])(a,n,s,!1,c,"0cdce284",null,!0);t["a"]=l.exports},b195:function(e,t,i){var n=i("cae6");n.__esModule&&(n=n.default),"string"===typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);var s=i("35d6").default;e.exports.__inject__=function(e){s("2c649d38",n,e)}},cae6:function(e,t,i){var n=i("24fb");t=n(!1),t.push([e.i,".nameofchat[data-v-0cdce284]{white-space:nowrap}.nameline[data-v-0cdce284]{display:flex;align-items:flex-end}.miniappicon[data-v-0cdce284]{margin-right:.25em;margin-block:.25em}.miniappicon .bgimage[data-v-0cdce284]{width:12px;height:12px;border-radius:2px}.iconGroup[data-v-0cdce284]{font-size:.4em;width:16px;min-width:16px;text-align:center;height:16px;line-height:16px;border-radius:8px;background:rgb(var(--neutral-grad-2));margin-right:.5em;margin-block:.25em}.iconGroup.public[data-v-0cdce284]{background:rgb(var(--color-good))}.iconGroup.public i[data-v-0cdce284]{color:rgb(var(--text-on-bg-shadow-color))}.iconGroup i[data-v-0cdce284]{color:rgb(var(--neutral-grad-1))}",""]),e.exports=t}}]);
//# sourceMappingURL=matrix-element.2.min.js.map