"use strict";(self.webpackChunkelement_web=self.webpackChunkelement_web||[]).push([[896],{"./node_modules/matrix-react-sdk/src/async-components/views/dialogs/eventindex/ManageEventIndexDialog.tsx":(e,t,s)=>{s.r(t),s.d(t,{default:()=>h});var n=s("./node_modules/@babel/runtime/helpers/esm/defineProperty.js"),o=s("./node_modules/react/index.js"),a=s("./node_modules/matrix-react-sdk/src/languageHandler.tsx"),r=s("./node_modules/matrix-react-sdk/src/SdkConfig.ts"),i=s("./node_modules/matrix-react-sdk/src/settings/SettingsStore.ts"),c=s("./node_modules/matrix-react-sdk/src/Modal.tsx"),l=s("./node_modules/matrix-react-sdk/src/utils/FormattingUtils.ts"),m=s("./node_modules/matrix-react-sdk/src/indexing/EventIndexPeg.ts"),d=s("./node_modules/matrix-react-sdk/src/settings/SettingLevel.ts"),u=s("./node_modules/matrix-react-sdk/src/components/views/elements/Field.tsx"),g=s("./node_modules/matrix-react-sdk/src/components/views/dialogs/BaseDialog.tsx"),_=s("./node_modules/matrix-react-sdk/src/components/views/elements/DialogButtons.tsx");class h extends o.Component{constructor(e){super(e),(0,n.c)(this,"updateCurrentRoom",(async e=>{var t,s,n,o;const a=m.c.get();if(!a)return;let r;try{r=await a.getStats()}catch{return}let i=null;e&&(i=e.name);const c=a.crawlingRooms(),l=c.crawlingRooms.size,d=c.totalRooms.size;this.setState({eventIndexSize:null!==(t=null===(s=r)||void 0===s?void 0:s.size)&&void 0!==t?t:0,eventCount:null!==(n=null===(o=r)||void 0===o?void 0:o.eventCount)&&void 0!==n?n:0,crawlingRoomsCount:l,roomCount:d,currentRoom:i})})),(0,n.c)(this,"onDisable",(async()=>{const e=(await s.e(532).then(s.bind(s,"./node_modules/matrix-react-sdk/src/async-components/views/dialogs/eventindex/DisableEventIndexDialog.tsx"))).default;c.cp.createDialog(e,void 0,void 0,!1,!0)})),(0,n.c)(this,"onCrawlerSleepTimeChange",(e=>{this.setState({crawlerSleepTime:parseInt(e.target.value,10)}),i.c.setValue("crawlerSleepTime",null,d.m.DEVICE,e.target.value)})),this.state={eventIndexSize:0,eventCount:0,crawlingRoomsCount:0,roomCount:0,currentRoom:null,crawlerSleepTime:i.c.getValueAt(d.m.DEVICE,"crawlerSleepTime")}}componentWillUnmount(){const e=m.c.get();null!==e&&e.removeListener("changedCheckpoint",this.updateCurrentRoom)}async componentDidMount(){let e=0,t=0,s=0,n=0,o=null;const a=m.c.get();if(null!==a){a.on("changedCheckpoint",this.updateCurrentRoom);try{const t=await a.getStats();t&&(e=t.size,n=t.eventCount)}catch{}const r=a.crawlingRooms();t=r.crawlingRooms.size,s=r.totalRooms.size;const i=a.currentRoom();i&&(o=i.name)}this.setState({eventIndexSize:e,eventCount:n,crawlingRoomsCount:t,roomCount:s,currentRoom:o})}render(){const e=r.cp.get().brand;let t;t=null===this.state.currentRoom?(0,a._t)("settings|security|message_search_indexing_idle"):(0,a._t)("settings|security|message_search_indexing",{currentRoom:this.state.currentRoom});const s=Math.max(0,this.state.roomCount-this.state.crawlingRoomsCount),n=o.createElement("div",null,(0,a._t)("settings|security|message_search_intro",{brand:e}),o.createElement("div",{className:"mx_SettingsTab_subsectionText"},t,o.createElement("br",null),(0,a._t)("settings|security|message_search_space_used")," ",(0,l.IB)(this.state.eventIndexSize,0),o.createElement("br",null),(0,a._t)("settings|security|message_search_indexed_messages")," ",(0,l.wz)(this.state.eventCount),o.createElement("br",null),(0,a._t)("settings|security|message_search_indexed_rooms")," ",(0,a._t)("settings|security|message_search_room_progress",{doneRooms:(0,l.wz)(s),totalRooms:(0,l.wz)(this.state.roomCount)})," ",o.createElement("br",null),o.createElement(u.c,{label:(0,a._t)("settings|security|message_search_sleep_time"),type:"number",value:this.state.crawlerSleepTime.toString(),onChange:this.onCrawlerSleepTimeChange})));return o.createElement(g.c,{className:"mx_ManageEventIndexDialog",onFinished:this.props.onFinished,title:(0,a._t)("settings|security|message_search_section")},n,o.createElement(_.c,{primaryButton:(0,a._t)("action|done"),onPrimaryButtonClick:this.props.onFinished,primaryButtonClass:"primary",cancelButton:(0,a._t)("action|disable"),onCancel:this.onDisable,cancelButtonClass:"danger"}))}}}}]);
//# sourceMappingURL=896.js.map