import{aa as r,ab as l}from"./_applist-tangy-colts-beg-36.js";import{_ as i}from"./main-tangy-colts-beg.js";import{s as p}from"./machine.-tangy-colts-beg-869.js";import{f as c}from"./machineh-tangy-colts-beg-716.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 N=r(({helpers:t})=>({states:{components:[{addConnectionHelpingText:i('You can find credentials from <a target="_blank" class="text-blue-600 underline" rel="noopener noreferrer nofollow" href="https://my.demio.com/manage/settings/api-details">Here</a>'),componentName:t.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:i("API Key"),type:"api_key",verifyConnection:{headers:{Accept:"application/json","api-key":"","api-secret":""},method:"GET",responseKeyMatch:["pong"],url:"https://my.demio.com/api/v1/ping"}}],fieldType:"config",id:"connection-id",label:i("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{componentName:t.componentName.select,fieldType:"config",id:"event-id",label:i("Event"),onChange:"SELECT_EVENT",onRefetch:"REFETCH_EVENT",optionFilterProp:"label",options:[],placeholder:i("Select an event"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0}]},actions:{IF_CONNECTION_SELECTED:({$:e})=>{var o;return l((o=e.getComponent("connection-id"))==null?void 0:o.value)},ON_MACHINE_LOAD:async({$:e})=>{p(e,[{db:"connectionId",id:"connection-id"},{db:"eventId",id:"event-id"}]),await c(e)},REFETCH_EVENT:async({$:e})=>{await c(e)},SELECT_EVENT:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setComponent("project-title",n=>{n.value=void 0}),e.setDb(n=>{n.eventId=o,n.projectTitle=void 0})},CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isConnectionComponent(n)&&n.connectionsTypes.forEach(a=>{var s;a.type==="api_key"&&((s=a.verifyConnection)!=null&&s.headers)&&(a.verifyConnection.headers["api-key"]=o.key,a.verifyConnection.headers["api-secret"]=o.value)})})},SET_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.connectionId=o}),await c(e)}}}));export{N as default};
