import{aa as C,ab as s}from"./_applist-tangy-colts-beg-36.js";import{_ as a}from"./main-tangy-colts-beg.js";import{s as d}from"./machine.-tangy-colts-beg-869.js";import{f as c,a as r}from"./machineh-tangy-colts-beg-709.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 E=C(({helpers:t})=>({states:{components:[{addConnectionHelpingText:a('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:t.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:a("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:a("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",id:"list-id",label:a("Contact list"),onChange:"SELECT_LIST",onRefetch:"REFETCH_CONTACT_LIST",optionFilterProp:"label",options:[],placeholder:a("Select a list"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{addItemButtonLabel:a("Add Contact Field"),componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.select,label:a("Field"),name:"benchmarkField",options:[],required:!0,style:{width:150},value:""},{componentName:t.componentName.mixInput,label:a("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"contact-row",label:a("Field Mapping"),onChange:"ON_FIELD_MAP_CHANGE",render:"IF_LIST_SELECTED",value:void 0}]},actions:{SET_CONNECTION:async({$:e,e:n})=>{e.setThisComponent(o=>{o.value=n}),e.setDb(o=>{o.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(o=>{o.value=n}),e.setDb(o=>{o.listId=n}),await r(e)},CONNECTION_ADD_CHANGE:({$:e,e:n})=>{e.setThisComponent(o=>{e.util.isConnectionComponent(o)&&o.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(o=>{o.value=n}),e.setDb(o=>{o.contactRow=n})},ON_MACHINE_LOAD:async({$:e})=>{d(e,[{db:"connectionId",id:"connection-id"},{db:"listId",id:"list-id"},{db:"contactRow",id:"contact-row"}]),await c(e),await r(e)}}}));export{E as default};
