"use strict";(self.webpackChunkapp=self.webpackChunkapp||[]).push([[35712],{35712:(n,e,o)=>{o.r(e),o.d(e,{AddonModChatUsersModalComponent:()=>f});var t=o(10467),s=o(94455),i=o(52749),a=o(79555),r=o(35853),d=o(86654),l=o(25572),c=o(54438),u=o(60177),m=o(2910),_=o(64422),p=o(16658),h=o(86198),C=o(88246),b=o(43570),M=o(73955);function AddonModChatUsersModalComponent_ion_item_12_ng_container_5_Template(n,e){if(1&n){const n=c.RV6();c.qex(0),c.j41(1,"ion-button",9),c.bIt("click",(function AddonModChatUsersModalComponent_ion_item_12_ng_container_5_Template_ion_button_click_1_listener(){c.eBV(n);const e=c.XpG().$implicit,o=c.XpG();return c.Njj(o.talkTo(e))})),c.nrm(2,"ion-icon",10),c.EFF(3),c.nI1(4,"translate"),c.k0s(),c.j41(5,"ion-button",9),c.bIt("click",(function AddonModChatUsersModalComponent_ion_item_12_ng_container_5_Template_ion_button_click_5_listener(){c.eBV(n);const e=c.XpG().$implicit,o=c.XpG();return c.Njj(o.beepTo(e))})),c.nrm(6,"ion-icon",11),c.EFF(7),c.nI1(8,"translate"),c.k0s(),c.bVm()}2&n&&(c.R7$(3),c.SpI(" ",c.bMT(4,2,"addon.mod_chat.talk")," "),c.R7$(4),c.SpI(" ",c.bMT(8,4,"addon.mod_chat.beep")," "))}function AddonModChatUsersModalComponent_ion_item_12_Template(n,e){if(1&n&&(c.j41(0,"ion-item",5),c.nrm(1,"core-user-avatar",6),c.j41(2,"ion-label")(3,"p",7),c.EFF(4),c.k0s(),c.DNE(5,AddonModChatUsersModalComponent_ion_item_12_ng_container_5_Template,9,6,"ng-container",8),c.k0s()()),2&n){const n=e.$implicit,o=c.XpG();c.AVh("addon-mod-chat-user",o.currentUserId!==n.id&&o.isOnline),c.R7$(),c.Y8G("user",n)("linkProfile",!1),c.R7$(3),c.JRh(n.fullname),c.R7$(),c.Y8G("ngIf",o.currentUserId!==n.id&&o.isOnline)}}let f=(()=>{var n;class AddonModChatUsersModalComponent{constructor(){this.users=[],this.usersLoaded=!1,this.isOnline=s.WE.isOnline(),this.currentUserId=i.CoreSites.getCurrentSiteUserId(),this.onlineSubscription=s.WE.onChange().subscribe((()=>{a.SK.run((()=>{this.isOnline=s.WE.isOnline()}))}))}ngOnInit(){var n=this;return(0,t.A)((function*(){try{const e=yield r.V.getChatUsers(n.sessionId,{cmId:n.cmId});n.users=e.users}catch(n){l.CoreAlerts.showError(n,{default:a.HT.instant("addon.mod_chat.errorwhilegettingchatusers")})}finally{n.usersLoaded=!0}}))()}closeModal(){a.W3.dismiss({users:this.users})}talkTo(n){a.W3.dismiss({talkTo:n.fullname,users:this.users})}beepTo(n){a.W3.dismiss({beepTo:n.id,users:this.users})}ngOnDestroy(){this.onlineSubscription.unsubscribe()}}return(n=AddonModChatUsersModalComponent).ɵfac=function AddonModChatUsersModalComponent_Factory(e){return new(e||n)},n.ɵcmp=c.VBU({type:n,selectors:[["addon-mod-chat-users-modal"]],inputs:{sessionId:"sessionId",cmId:"cmId"},standalone:!0,features:[c.aNF],decls:13,vars:8,consts:[["slot","end"],["fill","clear",3,"click","ariaLabel"],["slot","icon-only","name","fas-xmark","aria-hidden","true"],[3,"hideUntil"],["class","ion-text-wrap",3,"addon-mod-chat-user",4,"ngFor","ngForOf"],[1,"ion-text-wrap"],["slot","start",3,"user","linkProfile"],[1,"item-heading"],[4,"ngIf"],["fill","clear",3,"click"],["name","fas-comments","slot","start","aria-hidden","true"],["name","fas-bell","slot","start","aria-hidden","true"]],template:function AddonModChatUsersModalComponent_Template(n,e){1&n&&(c.j41(0,"ion-header")(1,"ion-toolbar")(2,"ion-title")(3,"h1"),c.EFF(4),c.nI1(5,"translate"),c.k0s()(),c.j41(6,"ion-buttons",0)(7,"ion-button",1),c.nI1(8,"translate"),c.bIt("click",(function AddonModChatUsersModalComponent_Template_ion_button_click_7_listener(){return e.closeModal()})),c.nrm(9,"ion-icon",2),c.k0s()()()(),c.j41(10,"ion-content")(11,"core-loading",3),c.DNE(12,AddonModChatUsersModalComponent_ion_item_12_Template,6,6,"ion-item",4),c.k0s()()),2&n&&(c.R7$(4),c.JRh(c.bMT(5,4,"addon.mod_chat.currentusers")),c.R7$(3),c.Y8G("ariaLabel",c.bMT(8,6,"core.close")),c.R7$(4),c.Y8G("hideUntil",e.usersLoaded),c.R7$(),c.Y8G("ngForOf",e.users))},dependencies:[d.n,u.Sq,u.bT,m.Jm,m.QW,m.W9,m.eU,m.iq,m.uz,m.he,m.BC,m.ai,_.R,p.T,h.t,C.i,b.T,M.D9],encapsulation:2}),AddonModChatUsersModalComponent})()}}]);