import{aa as s}from"./_applist-tangy-colts-beg-36.js";import{_ as i}from"./main-tangy-colts-beg.js";import{s as r}from"./machine.-tangy-colts-beg-869.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,n){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,n),n)}};const d=s(({helpers:o})=>({states:{components:[{addConnectionHelpingText:i("You can get your API key from your OneHash My Settings > Settings > API Access"),componentName:o.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:i("API Key"),type:"api_key",verifyConnection:{headers:{Authorization:"","Content-Type":"application/json"},method:"GET",responseKeyMatch:["data"],url:""}}],extraComponents:[{componentName:o.componentName.input,id:"domain",label:i("Domain"),onChange:"SET_DOMAIN",placeholder:i("Enter Domain"),render:!0,required:!0,value:void 0,wrapperClassName:"mb-2"}],extraData:{},fieldType:"config",id:"connection-id",label:i("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0}]},actions:{ON_MACHINE_LOAD:({$:n})=>{r(n,[{db:"connectionId",id:"connection-id"}])},CONNECTION_ADD_CHANGE:({$:n,e:t})=>{n.setThisComponent(e=>{var a,c;n.util.isConnectionComponent(e)&&(c=(a=e.connectionsTypes[0])==null?void 0:a.verifyConnection)!=null&&c.headers&&(e.connectionsTypes[0].verifyConnection.headers.Authorization=`token ${t.key}:${t.value}`)})},SET_DOMAIN:({$:n,e:t})=>{n.setThisComponent(e=>{n.util.isInputComponent(e)&&(e.value=t.target.value,e.status=void 0)}),n.setComponent("connection-id",e=>{var a;n.util.isConnectionComponent(e)&&((a=e.connectionsTypes[0])!=null&&a.verifyConnection&&(e.connectionsTypes[0].verifyConnection.url=`https://${t.target.value}.onehash.is/api/resource/Lead`),e.extraData||(e.extraData={}),e.extraData.domain=t.target.value)})}}}));export{d as default};
