import{i as e}from"./chunk-aKtaBQYM.js";import{Ft as t,vt as n}from"./mui-BgU4WrXF.js";import{l as r}from"./IconButton-oialqkv3.js";import{t as i}from"./Container-fY8-hTkD.js";import{i as a,n as o,r as s,t as c}from"./ExpandMore-D0ycvrdR.js";import{t as l}from"./Typography-7EcQ2i3p.js";import{n as u}from"./MenuItem-BNgF7Xqv.js";import{t as d}from"./TextField-DctlzLY-.js";import{Ut as f,Y as p,lt as m,pt as h,w as g}from"./index-bel1r0Sr.js";import{t as _}from"./SelectField-Bcp-L6wk.js";import{n as v,t as y}from"./useSettingsStyles-Bugi6oTj.js";var b=e(t(),1),x=n(),S=()=>{let e=r(),{classes:t}=y(),n=h(),[S,C]=(0,b.useState)([]),[w,T]=(0,b.useState)(),[E,D]=(0,b.useState)({}),O=m(async()=>{let t=new URLSearchParams;S.forEach(e=>t.append(`userId`,e)),await g(`/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)(u,{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)(l,{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(p(`notificator`,e.type)),label:n(`notificationNotificators`)}),(0,x.jsx)(d,{value:E.subject,onChange:e=>D({...E,subject:e.target.value}),label:n(`sharedSubject`)}),(0,x.jsx)(d,{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};