import{aa as s,ab as E}from"./_applist-tangy-colts-beg-36.js";import{_ as t}from"./main-tangy-colts-beg.js";import{h as c,s as T}from"./machine.-tangy-colts-beg-869.js";import{b as l,c as C}from"./machineh-tangy-colts-beg-966.js";import{h,c as r}from"./zoomcomm-tangy-colts-beg-477.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(n,e){return this.cache.has(n)?this.cache.get(n):(this.cache.set(n,e),e)}};const g=s(({helpers:n})=>({states:{components:[r(n),{allowClear:!0,componentName:n.componentName.select,fieldType:"config",helperText:t("Select whether to target a channel or a contact."),id:"targetType",label:t("Target Type"),onChange:"SET_TARGET_TYPE",options:[{label:t("Channel"),value:"channel"},{label:t("Contact"),value:"contact"}],placeholder:t("Select target type"),render:"IF_CONNECTION_SELECTED",value:void 0},{allowClear:!0,componentName:n.componentName.select,helperText:t("Select a channel."),id:"channelId",label:t("Channels"),onChange:"SET_CHANNEL",onRefetch:"REFETCH_CHANNELS",options:[],path:"to_channel",placeholder:t("Select a channel"),render:"IF_CHANNEL_SELECTED",showSearch:!0,value:""},{allowClear:!0,componentName:n.componentName.select,helperText:t("Select a contact."),id:"contactId",label:t("Contacts"),onChange:"SET_CONTACT",onRefetch:"REFETCH_CONTACTS",options:[],path:"to_contact",placeholder:t("Select a contact"),render:"IF_CONTACT_SELECTED",showSearch:!0,value:""},{componentName:n.componentName.mixInput,helperText:t("Enter the message to send."),id:"message",label:t("Message"),onChange:"SET_MESSAGE",path:"message",placeholder:t("Type your message"),render:"IF_CONNECTION_SELECTED",value:[]}]},actions:{SET_CONNECTION:async({$:e,e:a})=>{c("connectionId")({$:e,e:a}),await Promise.all([l(e),C(e)])},IF_CHANNEL_SELECTED:({$:e})=>{var a,o;return E((a=e.getComponent("connection-id"))==null?void 0:a.value)&&((o=e.getComponent("targetType"))==null?void 0:o.value)==="channel"},IF_CONTACT_SELECTED:({$:e})=>{var a,o;return E((a=e.getComponent("connection-id"))==null?void 0:a.value)&&((o=e.getComponent("targetType"))==null?void 0:o.value)==="contact"},CONNECTION_ADD_CHANGE:h,IF_CONNECTION_SELECTED:({$:e})=>{var a;return E((a=e.getComponent("connection-id"))==null?void 0:a.value)},REFETCH_CHANNELS:({$:e})=>C(e),REFETCH_CONTACTS:({$:e})=>l(e),SET_CHANNEL:c("channel"),SET_CONTACT:c("contact"),SET_MESSAGE:c("message"),SET_TARGET_TYPE:async({$:e,e:a})=>{c("targetType")({$:e,e:a}),a==="contact"?await l(e):C(e)},ON_MACHINE_LOAD:async({$:e})=>{T(e,[{db:"connectionId",id:"connection-id"},{db:"targetType",id:"targetType"},{db:"channel",id:"channelId"},{db:"contact",id:"contactId"},{db:"message",id:"message"}]),await Promise.all([l(e),C(e)])}}}));export{g as default};
