import{aa as C,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{s as r}from"./machine.-tangy-colts-beg-869.js";import{f as c,a as d}from"./machineh-tangy-colts-beg-709.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(a,e){return this.cache.has(a)?this.cache.get(a):(this.cache.set(a,e),e)}};const E=C(({helpers:a})=>({states:{components:[{addConnectionHelpingText:o('You can find credentials from <a target="_blank" class="text-blue-600 underline" rel="noopener noreferrer nofollow" href="https://ui.benchmarkemail.com/Integrate#API">Here</a>'),componentName:a.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:o("API Key"),showKey:!1,type:"api_key",verifyConnection:{headers:{Accept:"application/json",AuthToken:""},method:"GET",responseKeyMatch:["Response","Response.Email","Response.Login"],url:"https://clientapi.benchmarkemail.com/Client/"}}],fieldType:"config",id:"connection-id",label:o("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:a.componentName.select,fieldType:"config",id:"list-id",label:o("Contact list"),onChange:"SELECT_LIST",onRefetch:"REFETCH_CONTACT_LIST",optionFilterProp:"label",options:[],placeholder:o("Select a list"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:a.componentName.mixInput,fieldType:"config",helperText:o("Must need contact id for update existing contact"),id:"contact-id",label:o("Contact ID"),onChange:"SELECT_CONTACT_ID",path:"contactId",placeholder:o("Select a list"),render:"IF_CONNECTION_SELECTED",value:void 0},{addItemButtonLabel:o("Add Contact Field"),componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.select,label:o("Field"),name:"benchmarkField",options:[],required:!0,style:{width:150},value:""},{componentName:a.componentName.mixInput,label:o("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"contact-row",label:o("Field Mapping"),onChange:"ON_FIELD_MAP_CHANGE",render:"IF_LIST_SELECTED",value:void 0}]},actions:{SET_CONNECTION:async({$:e,e:n})=>{e.setThisComponent(t=>{t.value=n}),e.setDb(t=>{t.connectionId=n}),await c(e)},IF_CONNECTION_SELECTED:({$:e})=>{var n;return s((n=e.getComponent("connection-id"))==null?void 0:n.value)},IF_LIST_SELECTED:({$:e})=>{var n;return s((n=e.getComponent("list-id"))==null?void 0:n.value)},REFETCH_CONTACT_LIST:async({$:e})=>{await c(e)},SELECT_LIST:async({$:e,e:n})=>{e.setThisComponent(t=>{t.value=n}),e.setDb(t=>{t.listId=n}),await d(e)},SELECT_CONTACT_ID:async({$:e,e:n})=>{e.setThisComponent(t=>{t.value=n}),e.setDb(t=>{t.contactId=n})},CONNECTION_ADD_CHANGE:({$:e,e:n})=>{e.setThisComponent(t=>{e.util.isConnectionComponent(t)&&t.connectionsTypes.forEach(i=>{var l;i.type==="api_key"&&((l=i.verifyConnection)!=null&&l.headers)&&(i.verifyConnection.headers.AuthToken=n.value)})})},ON_FIELD_MAP_CHANGE:async({$:e,e:n})=>{e.setThisComponent(t=>{t.value=n}),e.setDb(t=>{t.contactRow=n})},ON_MACHINE_LOAD:async({$:e})=>{r(e,[{db:"connectionId",id:"connection-id"},{db:"listId",id:"list-id"},{db:"contactId",id:"contact-id"},{db:"contactRow",id:"contact-row"}]),await c(e),await d(e)}}}));export{E as default};
