import{aa as c,ab as r}from"./_applist-tangy-colts-beg-36.js";import{_ as s}from"./main-tangy-colts-beg.js";import{h as a,s as m}from"./machine.-tangy-colts-beg-869.js";import{f as i}from"./machineh-tangy-colts-beg-971.js";import{h as S,c as u}from"./twilioco-tangy-colts-beg-300.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(t,e){return this.cache.has(t)?this.cache.get(t):(this.cache.set(t,e),e)}};const g=c(({helpers:t})=>({states:{components:[u(t),{componentName:t.componentName.switch,fieldType:"config",helperText:s("Enable to use Message Service instead of Phone Number"),id:"use-message-service-switch",label:s("Use Message Service"),onChange:"SET_USE_MESSAGE_SERVICE",render:"IF_CONNECTION_SELECTED",size:"small",value:!1},{componentName:t.componentName.mixInput,helperText:s("Enter the Sender Phone Number (e.g., +1234567890)."),id:"sender-phone-number",label:s("Sender Phone Number"),onChange:"SET_SENDER_PHONE_NUMBER",path:"From",render:"IF_PHONE_NUMBER_MODE",required:!0,value:[]},{allowClear:!0,componentName:t.componentName.select,helperText:s("Select a Message Service to send SMS from."),id:"message-service-id",label:s("Message Service"),onChange:"SET_MESSAGE_SERVICE",onRefetch:"REFETCH_MESSAGE_SERVICES",optionFilterProp:"label",options:[],path:"messageServiceId",placeholder:s("Select Message Service"),render:"IF_MESSAGE_SERVICE_MODE",required:!0,showSearch:!0,value:void 0},{componentName:t.componentName.mixInput,helperText:s("Enter the recipient phone number (e.g., +1234567890)."),id:"recipient-phone-number",label:s("Recipient Phone Number"),onChange:"SET_TO_PHONE_NUMBER",path:"To",render:"IF_CONNECTION_SELECTED",required:!0,value:[]},{componentName:t.componentName.mixInput,helperText:s("Enter the message you want to send."),id:"message",label:s("Message"),onChange:"SET_MESSAGE",path:"Body",render:"IF_CONNECTION_SELECTED",required:!0,value:[]}]},actions:{CONNECTION_ADD_CHANGE:S,IF_CONNECTION_SELECTED:({$:e})=>{var n;return r((n=e.getComponent("connection-id"))==null?void 0:n.value)},IF_MESSAGE_SERVICE_MODE:({$:e})=>{var n,o;return r((n=e.getComponent("connection-id"))==null?void 0:n.value)&&((o=e.getComponent("use-message-service-switch"))==null?void 0:o.value)===!0},IF_PHONE_NUMBER_MODE:({$:e})=>{var n,o;return r((n=e.getComponent("connection-id"))==null?void 0:n.value)&&((o=e.getComponent("use-message-service-switch"))==null?void 0:o.value)===!1},REFETCH_MESSAGE_SERVICES:({$:e})=>{i(e)},SET_CONNECTION:async({$:e,e:n})=>{var E;a("connectionId")({$:e,e:n}),((E=e.getComponent("use-message-service-switch"))==null?void 0:E.value)===!0&&await i(e)},SET_MESSAGE:a("message"),SET_MESSAGE_SERVICE:a("messageServiceId"),SET_SENDER_PHONE_NUMBER:a("senderPhoneNumber"),SET_TO_PHONE_NUMBER:a("recipientPhoneNumber"),SET_USE_MESSAGE_SERVICE:async({$:e,e:n})=>{a("useMessageService")({$:e,e:n}),n===!0&&await i(e)},ON_MACHINE_LOAD:async({$:e})=>{var o;m(e,[{db:"connectionId",id:"connection-id"},{db:"senderPhoneNumber",id:"sender-phone-number"},{db:"recipientPhoneNumber",id:"recipient-phone-number"},{db:"message",id:"message"},{db:"useMessageService",id:"use-message-service-switch"},{db:"messageServiceId",id:"message-service-id"}]),((o=e.getComponent("use-message-service-switch"))==null?void 0:o.value)===!0&&await i(e)}}}));export{g as default};
