import{i as e}from"./chunk-aKtaBQYM.js";import{Vt as t,wt as n,zt as r}from"./mui-B6lh3XSP.js";import{l as i,u as a}from"./IconButton-BEBOUWhl.js";import{t as o}from"./Container-CHg71Wor.js";import{i as s,n as c,r as l,t as u}from"./ExpandMore-BvigPYWL.js";import{t as d}from"./TextField-DOdnjCrL.js";import{t as f}from"./Typography-DfQXhGTT.js";import{n as p}from"./MenuItem-HQNtf0LG.js";import{Bt as m,Ft as h,Gt as g,Nt as _,Qt as v,Wt as y,en as b,mt as x,w as S,yt as C}from"./index-KVuxnkWj.js";import{n as w,t as T}from"./useSettingsStyles-X3caKosH.js";var E=e(t(),1),D=n(),O=()=>{let e=i(),{classes:t}=T(),n=C(),{id:O}=a(),k=r(e=>e.session.server.textEnabled),[A,j]=(0,E.useState)({type:`custom`,attributes:{}}),M=x(async()=>{await S(`/api/commands/send?${new URLSearchParams({groupId:O}).toString()}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(A)}),e(-1)});return(0,D.jsx)(p,{menu:(0,D.jsx)(w,{}),breadcrumbs:[`settingsTitle`,`deviceCommand`],children:(0,D.jsxs)(o,{maxWidth:`xs`,className:t.container,children:[(0,D.jsxs)(s,{defaultExpanded:!0,children:[(0,D.jsx)(c,{expandIcon:(0,D.jsx)(u,{}),children:(0,D.jsx)(f,{variant:`subtitle1`,children:n(`sharedRequired`)})}),(0,D.jsxs)(l,{className:t.details,children:[(0,D.jsxs)(g,{fullWidth:!0,children:[(0,D.jsx)(m,{children:n(`sharedType`)}),(0,D.jsx)(_,{label:n(`sharedType`),value:`custom`,disabled:!0,children:(0,D.jsx)(h,{value:`custom`,children:n(`commandCustom`)})})]}),(0,D.jsx)(d,{value:A.attributes.data,onChange:e=>j({...A,attributes:{...A.attributes,data:e.target.value}}),label:n(`commandData`)}),k&&(0,D.jsx)(y,{control:(0,D.jsx)(v,{checked:A.textChannel,onChange:e=>j({...A,textChannel:e.target.checked})}),label:n(`commandSendSms`)})]})]}),(0,D.jsxs)(`div`,{className:t.buttons,children:[(0,D.jsx)(b,{type:`button`,color:`primary`,variant:`outlined`,onClick:()=>e(-1),children:n(`sharedCancel`)}),(0,D.jsx)(b,{type:`button`,color:`primary`,variant:`contained`,onClick:M,disabled:!A.attributes.data,children:n(`commandSend`)})]})]})})};export{O as default};