import{aa as l,ab as d}from"./_applist-tangy-colts-beg-36.js";import{_ as n}from"./main-tangy-colts-beg.js";import{s as m}from"./machine.-tangy-colts-beg-869.js";import{h as r,c as C}from"./gohighle-tangy-colts-beg-43.js";import{f as i,b as c,a as s}from"./machineh-tangy-colts-beg-622.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const g=l(({helpers:o})=>({states:{components:[C(o),{componentName:o.componentName.select,fieldType:"config",id:"contact-id",label:n("Select Contact"),onChange:"HANDLE_CONTACT_ID",onRefetch:"REFETCH_CONTACTS",options:[],path:"contactId",placeholder:n("Select a contact"),render:"IF_CONNECTION_SELECTED",required:!0,value:void 0},{addItemButtonLabel:n("Add Item"),componentName:o.componentName.repeaterField,fieldsMetaData:[{componentName:o.componentName.select,label:n("Field"),name:"goHighLevelField",optionFilterProp:"label",options:[],required:!0,showSearch:!0,value:void 0,wrapperClassName:"w-100"},{componentName:o.componentName.mixInput,label:n("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"field-map",label:n("Field Map"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_FIELDS",labelActionText:n("Refetch Fields"),loading:!1,onChange:"ON_CHANGE_FIELD_MAP",render:"IF_CONNECTION_SELECTED",value:[],wrapperClassName:"mt-3"},{componentName:o.componentName.select,helperText:n("Choose from pre-existing tags or add new tags by writing and pressing Enter."),id:"tags",label:n("Tags"),mode:"tags",onChange:"HANDLE_TAGS",onRefetch:"REFETCH_TAGS",options:[],path:"tags",placeholder:n("Select Tags to attach with the contact."),render:"IF_CONNECTION_SELECTED",value:void 0}]},actions:{ON_MACHINE_LOAD:async({$:e})=>{m(e,[{db:"connectionId",id:"connection-id"},{db:"contactId",id:"contact-id"},{db:"fieldMap",id:"field-map"},{db:"tags",id:"tags"},{db:"status",id:"status"},{db:"overrideExisting",id:"override-existing"}]),await Promise.all([c(e),s(e),i(e)])},CONNECTION_ADD_CHANGE:r,HANDLE_CONTACT_ID:({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.contactId=a})},HANDLE_TAGS:({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.tags=a})},HANDLE_MIX_INPUT:({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a})},IF_CONNECTION_SELECTED:({$:e})=>{var a;return d((a=e.getComponent("connection-id"))==null?void 0:a.value)},ON_CHANGE_FIELD_MAP:({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.fieldMap=a})},SET_CONNECTION:async({$:e,e:a})=>{e.setThisComponent(t=>{t.value=a}),e.setDb(t=>{t.connectionId=a}),await Promise.all([c(e),s(e),i(e)])},REFETCH_FIELDS:async({$:e})=>{await s(e)},REFETCH_CONTACTS:async({$:e})=>{await c(e)},REFETCH_TAGS:async({$:e})=>{await i(e)}}}));export{g as default};
