import{aa as p,ab as r}from"./_applist-tangy-colts-beg-36.js";import{_ as a}from"./main-tangy-colts-beg.js";import{s as l}from"./machine.-tangy-colts-beg-869.js";import{f as s}from"./machineh-tangy-colts-beg-791.js";import{w as d}from"./woodpeck-tangy-colts-beg-773.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 f=p(({helpers:t})=>({states:{components:[{addConnectionHelpingText:a('You can find your API key in <a target="_blank" class="text-blue-600 underline" rel="noopener noreferrer nofollow" href="https://app.woodpecker.co/settings/api">Woodpecker Settings</a>'),componentName:t.componentName.connection,connectionsTypes:[{encryptKeys:["value"],label:a("Api Key"),showKey:!1,type:"api_key",verifyConnection:{headers:{Authorization:"","Content-Type":"application/json"},method:"GET",responseKeyMatch:["0.id"],url:"https://api.woodpecker.co/rest/v1/campaign_list"}}],fieldType:"config",id:"connection-id",label:a("Select Connection"),onConnectionAddChange:"CONNECTION_ADD_CHANGE",onConnectionChange:"SET_CONNECTION",render:!0,value:void 0},{addItemButtonLabel:a("Add Prospect Fields"),componentName:t.componentName.repeaterField,fieldsMetaData:[{componentName:t.componentName.select,id:"prospects-entry",label:a("Field"),name:"woodpeckerField",options:d,required:!0,style:{width:150},value:""},{componentName:t.componentName.mixInput,label:a("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"prospects-list",label:a("Field Mapping"),onChange:"ON_FIELD_MAP_CHANGE",render:"IF_CONNECTION_SELECTED",value:[]}]},actions:{SET_CONNECTION:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.connectionId=o}),await s(e)},IF_CONNECTION_SELECTED:({$:e})=>{var o;return r((o=e.getComponent("connection-id"))==null?void 0:o.value)},ON_FIELD_MAP_CHANGE:async({$:e,e:o})=>{e.setThisComponent(n=>{n.value=o}),e.setDb(n=>{n.prospects=o})},CONNECTION_ADD_CHANGE:({$:e,e:o})=>{e.setThisComponent(n=>{e.util.isConnectionComponent(n)&&n.connectionsTypes.forEach(i=>{var c;i.type==="api_key"&&((c=i.verifyConnection)!=null&&c.headers)&&o.value&&(i.verifyConnection.headers.Authorization="Basic "+btoa(`${o.value}`))})})},ON_MACHINE_LOAD:async({$:e})=>{var o;l(e,[{db:"connectionId",id:"connection-id"},{db:"prospects",id:"prospects-list"}]),(o=e.db)!=null&&o.connectionId&&await s(e)}}}));export{f as default};
