import{i as e}from"./chunk-aKtaBQYM.js";import{Vt as t,wt as n}from"./mui-B6lh3XSP.js";import{l as r}from"./IconButton-BEBOUWhl.js";import{t as i}from"./Container-CHg71Wor.js";import{i as a,n as o,r as s,t as c}from"./ExpandMore-BvigPYWL.js";import{t as l}from"./TextField-DOdnjCrL.js";import{t as u}from"./Typography-DfQXhGTT.js";import{n as d}from"./MenuItem-HQNtf0LG.js";import{en as f,ht as p,tt as m,w as h,yt as g}from"./index-KVuxnkWj.js";import{t as _}from"./SelectField-9K8NpSQG.js";import{n as v,t as y}from"./useSettingsStyles-X3caKosH.js";var b=e(t(),1),x=n(),S=()=>{let e=r(),{classes:t}=y(),n=g(),[S,C]=(0,b.useState)([]),[w,T]=(0,b.useState)(),[E,D]=(0,b.useState)({}),O=p(async()=>{let t=new URLSearchParams;S.forEach(e=>t.append(`userId`,e)),await h(`/api/notifications/send/${w}?${t.toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(E)}),e(-1)},[S,w,E,e]);return(0,x.jsx)(d,{menu:(0,x.jsx)(v,{}),breadcrumbs:[`serverAnnouncement`],children:(0,x.jsxs)(i,{maxWidth:`xs`,className:t.container,children:[(0,x.jsxs)(a,{defaultExpanded:!0,children:[(0,x.jsx)(o,{expandIcon:(0,x.jsx)(c,{}),children:(0,x.jsx)(u,{variant:`subtitle1`,children:n(`sharedRequired`)})}),(0,x.jsxs)(s,{className:t.details,children:[(0,x.jsx)(_,{multiple:!0,value:S,onChange:e=>C(e.target.value),endpoint:`/api/users`,label:n(`settingsUsers`)}),(0,x.jsx)(_,{value:w,onChange:e=>T(e.target.value),endpoint:`/api/notifications/notificators?announcement=true`,keyGetter:e=>e.type,titleGetter:e=>n(m(`notificator`,e.type)),label:n(`notificationNotificators`)}),(0,x.jsx)(l,{value:E.subject,onChange:e=>D({...E,subject:e.target.value}),label:n(`sharedSubject`)}),(0,x.jsx)(l,{value:E.body,onChange:e=>D({...E,body:e.target.value}),label:n(`commandMessage`)})]})]}),(0,x.jsxs)(`div`,{className:t.buttons,children:[(0,x.jsx)(f,{type:`button`,color:`primary`,variant:`outlined`,onClick:()=>e(-1),children:n(`sharedCancel`)}),(0,x.jsx)(f,{type:`button`,color:`primary`,variant:`contained`,onClick:O,disabled:!w||!E.subject||!E.body,children:n(`commandSend`)})]})]})})};export{S as default};