Loading
function(e,l,i){i.d(l,{default:()=>L}),i(321073);var s=i(477900),a=i(582128),n=i(855986),t=i(189213),o=i(276293),r=i(939249),c=i(834730),d=i(289873),m=i(534514),u=i(664343),h=i(565645),j=i(47167),x=i(713654),N=i(573435),_=i(915089),A=i(121681),p=i(7584),g=i(682163),E=i(714991),C=i(976860),y=i(734057),f=i(71393),b=i(576705),k=i(147925),v=i(129230),I=i(225315),S=i(684407),G=i(652215),w=i(818348),R=i(792996),T=i(138742);let D=e=>{let{channelData:l,onClose:i,trackOptionClick:a}=e,t=(0,n.bG)([y.A],()=>y.A.getChannel(l.channel_id)),d=(0,j.Ay)(t),m=(0,n.bG)([b.A],()=>null!=t&&b.A.can(w.xB.VIEW_CHANNEL,t)),u=(0,n.bG)([A.Ay],()=>null!=l.emoji_id?A.Ay.getCustomEmojiById(l.emoji_id):null,[l.emoji_id]),N=null!=l.emoji_name?p.Ay.getByName(p.Ay.convertSurrogateToName(l.emoji_name,!1)):null,_=(0,x.gU)(t)??o.TextIcon;return null!=t&&m?(0,s.jsxs)(r.D,{className:T.NV,onClick:()=>{a(),i(),(0,C.uh)(t.guild_id,t.id)},children:[null!=u||null!=N?(0,s.jsx)(h.A,{emojiName:null!=l.emoji_id?u?.name:l.emoji_name,animated:null!=u&&u.animated,emojiId:u?.id,autoplay:!0,className:T.oK}):(0,s.jsx)(_,{className:T.p}),(0,s.jsxs)("div",{className:T.uP,children:[(0,s.jsx)(c.E,{variant:"body-md/normal",className:T.I0,children:l.description}),(0,s.jsxs)(c.E,{variant:"body-xs/normal",color:"text-default",children:[(0,s.jsx)(_,{className:T.nO,size:"xxs",color:"currentColor"}),(0,s.jsx)("span",{children:d})]})]}),(0,s.jsx)(k.A,{direction:k.A.Directions.RIGHT,className:T.R_})]}):null},L=function(e){let{onClose:l,transitionState:i,guildId:o,isPreview:r}=e,h=(0,n.bG)([f.A],()=>f.A.getGuild(o)),{welcomeScreen:j,fetching:x,hasError:A}=(0,n.cf)([S.A],()=>({welcomeScreen:S.A.get(o),fetching:S.A.isFetching(),hasError:S.A.hasError()})),p=(0,_.GV)();a.useEffect(()=>{null==j&&(0,I.Fy)(o)},[o,j]),a.useEffect(()=>{!1===x&&!0===A&&null==j&&l()},[x,A,l,j]),a.useEffect(()=>{j===S.E&&!1===x&&l()},[l,j,x]),a.useEffect(()=>{!0!==r&&v.default.track(G.HAw.OPEN_MODAL,{type:"Guild Welcome Screen",guild_id:o})},[o,r]);let C=a.useCallback(e=>{if(null==j||!0===r)return;let l=[],i=[],s=!1;j.welcome_channels?.forEach(e=>{l.push(e.description),i.push(e.channel_id),null!=e.emoji_id&&(s=!0)}),v.default.track(G.HAw.GUILD_WELCOME_SCREEN_OPTION_SELECTED,{index:e,guild_id:o,options:l,options_channel_ids:i,guild_description:j.description,has_custom_emojis:s})},[o,r,j]);return null==h?null:null==j?(0,s.jsx)(t.a,{transitionState:i,"aria-label":R.intl.string(R.t.ZTNur7),title:R.intl.string(R.t.ZTNur7),onClose:()=>Promise.resolve(l()),actions:[],children:(0,s.jsx)(d.y,{type:d.y.Type.SPINNING_CIRCLE})}):(0,s.jsx)(t.a,{transitionState:i,"aria-labelledby":p,actions:[{text:R.intl.string(R.t.jizr82),onClick:l,variant:"secondary"}],title:R.intl.string(R.t["3iCBUn"]),onClose:()=>Promise.resolve(l()),children:(0,s.jsxs)("div",{className:T.jE,children:[(0,s.jsx)(N.Ay,{mask:N.Ay.Masks.SQUIRCLE,width:64,height:64,className:T.$f,children:(0,s.jsx)(g.Ay,{size:g.Ay.Sizes.LARGER,guild:h,active:!0,animate:!0,tabIndex:-1})}),(0,s.jsx)(m.D,{variant:"heading-xl/semibold",className:T.wx,id:p,children:R.intl.format(R.t["0aydCN"],{guildName:h.name,guildNameHook:(e,l)=>(0,s.jsxs)("span",{children:[(0,s.jsx)(E.A,{guild:h,className:T.eZ,flowerStarClassName:T.mP,tooltipColor:u.ST.Colors.PRIMARY}),(0,s.jsx)("strong",{className:T.aC,children:e})]},l)})}),null!=j.description?(0,s.jsx)(c.E,{variant:"body-sm/normal",color:"text-default",className:T.eF,children:j.description}):null,(0,s.jsx)(m.D,{variant:"heading-xs/semibold",className:T.XU,children:R.intl.string(R.t["haj5+i"])}),(0,s.jsx)("div",{className:T.fF,children:j.welcome_channels?.map((e,i)=>(0,s.jsx)(D,{channelData:e,trackOptionClick:()=>C(i),onClose:l},`${e.channel_id}-${i}`))})]})})}}