"use strict";(self.webpackChunkmattermost_webapp=self.webpackChunkmattermost_webapp||[]).push([[9163],{61544:(e,t,a)=>{a.r(t),a.d(t,{default:()=>m});var n=a(23453),s=a(7380),r=(a(17046),a(4290),a(71633)),i=a.n(r),l=a(97023),o=a.n(l),c=a(14778),p=a(78451),u=a(19513),b=a(85873);function h(e,t,a){return(t=function(e){var t=function(e){if("object"!=typeof e||!e)return e;var t=e[Symbol.toPrimitive];if(void 0!==t){var a=t.call(e,"string");if("object"!=typeof a)return a;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(e)}(e);return"symbol"==typeof t?t:t+""}(t))in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}class d extends o().PureComponent{constructor(e){super(e),h(this,"handleClick",((e,t)=>{var a;t.preventDefault(),this.props.updateTab(e.name),null===(a=t.target.closest(".settings-modal"))||void 0===a||a.classList.add("display--content")})),h(this,"handleKeyUp",((e,t)=>{(0,u.e)(t,p.Ay.KeyCodes.UP)?e>0?(this.props.updateTab(this.totalTabs[e-1].name),(0,b.b6)(this.buttonRefs[e-1].current)):(this.props.updateTab(this.totalTabs[this.totalTabs.length-1].name),(0,b.b6)(this.buttonRefs[this.buttonRefs.length-1].current)):(0,u.e)(t,p.Ay.KeyCodes.DOWN)&&(e<this.totalTabs.length-1?(this.props.updateTab(this.totalTabs[e+1].name),(0,b.b6)(this.buttonRefs[e+1].current)):(this.props.updateTab(this.totalTabs[0].name),(0,b.b6)(this.buttonRefs[0].current)))})),this.totalTabs=[...this.props.tabs,...this.props.pluginTabs||[]],this.buttonRefs=this.totalTabs.map((()=>o().createRef()))}renderTab(e,t){const a="".concat(e.name,"_li"),n=this.props.activeTab===e.name;let s;return s="string"==typeof e.icon?o().createElement("i",{className:e.icon,title:e.iconTitle}):o().createElement("img",{src:e.icon.url,alt:e.iconTitle,className:"icon"}),o().createElement("button",{key:a,ref:this.buttonRefs[t],id:"".concat(e.name,"Button"),className:i()("cursor--pointer style--none nav-pills__tab",{active:n}),onClick:this.handleClick.bind(null,e),onKeyUp:this.handleKeyUp.bind(null,t),"aria-label":e.uiName.toLowerCase(),role:"tab","aria-selected":n,tabIndex:n||this.props.isMobileView?0:-1,"aria-controls":"".concat(e.name,"Settings")},s,e.uiName)}render(){var e;const t=this.props.tabs.map(((e,t)=>this.renderTab(e,t)));let a;return null!==(e=this.props.pluginTabs)&&void 0!==e&&e.length&&(a=o().createElement(o().Fragment,null,o().createElement("hr",null),o().createElement("div",{role:"group","aria-labelledby":"userSettingsModal.pluginPreferences.header"},o().createElement("div",{key:"plugin preferences heading",role:"heading",className:"header","aria-level":3,id:"userSettingsModal_pluginPreferences_header"},o().createElement(c.FormattedMessage,{id:"userSettingsModal.pluginPreferences.header",defaultMessage:"PLUGIN PREFERENCES"})),this.props.pluginTabs.map(((e,t)=>this.renderTab(e,t+this.props.tabs.length)))))),o().createElement("div",{id:"tabList",className:"nav nav-pills nav-stacked",role:"tablist","aria-orientation":"vertical"},o().createElement("div",{role:"group"},t),a)}}const m=(0,n.connect)((function(e){return{isMobileView:(0,s.w3)(e)}}))(d)}}]);
//# sourceMappingURL=9163.543c527816dc264dbb92.js.map