Module 331969

4,061 characters · in 33645dc6ae61c139.js
Dependencies
Required by (1)
Lazily required by (0)none
Lazily requires (0)none
Source Raw
function(e,t,n){n.d(t,{A:()=>b}),n(321073);var i=n(627968),s=n(64700),l=n(158954),r=n(311907),a=n(397927),o=n(97260),d=n(337692),c=n(235986),u=n(586068),m=n(734057),g=n(808728),_=n(71393),x=n(967198),h=n(926140),A=n(985018),p=n(194152);function T(){}let f=[h.rD.VOICE_CHANNEL];function S(e){e.setOptions({voiceChannelGuildFilter:null}),e.setLimit(1/0)}function E(){return(0,i.jsx)("div",{className:p.i1,children:(0,i.jsx)(a.Text,{variant:"text-md/medium",color:"text-muted",className:p.GN,children:A.intl.string(A.t.zHjCd1)})})}function b(e){let{keybind:t}=e,n=s.useRef(t);s.useEffect(()=>{n.current=t});let[l,r]=s.useState(t.params?.channelId??void 0),d=s.useCallback(()=>{(0,a.mMO)(async()=>e=>(0,i.jsx)(C,{...e,onSelect:e=>{r(e),o.A.setKeybind({...n.current,params:{channelId:e}})}}))},[]);return(0,i.jsx)("div",{className:p.a8,children:(0,i.jsx)(a.D0$,{label:A.intl.string(A.t.q4JpM8),children:(0,i.jsxs)(c.A,{align:c.A.Align.STRETCH,children:[(0,i.jsx)("div",{className:p.$X,children:(0,i.jsx)(v,{channelId:l})}),(0,i.jsx)(c.A.Child,{grow:0,shrink:0,children:(0,i.jsx)(a.Button,{variant:"primary",text:A.intl.string(A.t.Dm8O4e),onClick:d})})]})})})}function C(e){let t,n,{transitionState:o,onClose:c,onSelect:T}=e,b=s.useId(),C=s.useRef(null),{query:v,updateQuery:N,queryResults:I}=(0,d.A)({visible:!0,autocompleterResultTypes:f,autocompleterBeforeCreateSearchContext:S}),j=(t=""!==v,n=(0,r.yK)([g.Ay,m.A,x.A],()=>{let e=x.A.getGuildId();if(t||null==e)return[];let n=[];for(let t of g.Ay.getVocalChannelIds(e)){let e=m.A.getChannel(t);null!=e&&n.push(e)}return n},[t]),t?null:n),{focusedIndex:y,setFocusedIndex:O}=function(e){let[t,n]=s.useState(0),i=s.useRef(e);return e!==i.current&&0!==t&&n(0),s.useEffect(()=>{i.current=e}),{focusedIndex:t,setFocusedIndex:n}}(v);s.useEffect(()=>{let{current:e}=C;null==e||e.isItemVisible(0,y,!0)||e.scrollToIndex({section:0,row:y})},[y]);let R=null!=j?j.length:I.length,L=(()=>{if(null!=j)return j[y]?.id;let e=I[y];if(e?.type===h.rD.VOICE_CHANNEL)return e.record.id})(),P=R>0||""===v?{innerId:b,innerRole:"listbox",innerAriaLabel:A.intl.string(A.t["+N3fW7"]),ref:C,sections:[R],renderRow:function(e){let{row:t}=e,n=(()=>{if(null!=j)return j[t];let e=I[t];if(e?.type===h.rD.VOICE_CHANNEL)return e.record})();if(null==n)return null;let s=null!=n.parent_id?m.A.getChannel(n.parent_id):void 0,l=_.A.getGuild(n.guild_id);return(0,i.jsx)(u.c3,{id:n.id,channel:n,category:s,focused:y===t,onMouseEnter:()=>O(t),onClick:()=>{T(n.id),c()},onFocus:()=>O(t),children:null!=l?(0,i.jsx)("div",{className:p.J5,children:l.name}):null},n.id)},sectionHeight:0,rowHeight:34}:{sections:[1],renderRow:()=>(0,i.jsx)(E,{}),sectionHeight:0,rowHeight:52};return(0,i.jsx)(l.Modal,{transitionState:o,onClose:c,title:A.intl.string(A.t.Dm8O4e),subtitle:A.intl.string(A.t.q4JpM8),actions:void 0,input:(0,i.jsx)(a.ksK,{value:v,onChange:N,onKeyDown:function(e){let t=e.key.toLowerCase();if("arrowdown"===t||"arrowup"===t||"enter"===t||"escape"===t)switch(e.preventDefault(),t){case"escape":c();break;case"enter":{let e=(()=>{if(null!=j)return j[y];let e=I[y];if(e?.type===h.rD.VOICE_CHANNEL)return e.record})();null==e?T(void 0):T(e.id),c();break}case"arrowup":0===y?O(R-1):O(y-1);break;case"arrowdown":y>=R-1?O(0):O(y+1)}},placeholder:A.intl.string(A.t.tG0r7g),role:"combobox","aria-controls":b,"aria-expanded":R>0,"aria-activedescendant":R>0&&null!=L?L:void 0,"aria-autocomplete":"list",spellCheck:!1,autoFocus:!0}),listProps:P})}function v(e){let{channelId:t}=e,{channel:n,category:s,guild:l}=(0,r.cf)([m.A,_.A],()=>{let e=null!=t?m.A.getChannel(t):void 0;return null!=e?{channel:e,category:null!=e.parent_id?m.A.getChannel(e.parent_id):void 0,guild:null!=e.guild_id?_.A.getGuild(e.guild_id):void 0}:{channel:void 0,category:void 0,guild:void 0}});return null==n?(0,i.jsx)(a.Text,{variant:"text-md/medium",color:"text-muted",className:p.GN,children:A.intl.string(A.t["/fYIK7"])}):(0,i.jsx)(u.c3,{channel:n,id:n.id,category:s,onClick:T,onFocus:T,onMouseEnter:T,focused:!1,children:null!=l?(0,i.jsx)("div",{className:p.J5,children:l.name}):null})}}