import{aa as c,ab as n}from"./_applist-tangy-colts-beg-36.js";import{_ as o}from"./main-tangy-colts-beg.js";import{h as l,s as E}from"./machine.-tangy-colts-beg-869.js";import{f as d,a as i,b as r,h as s,c as C,d as p}from"./machineh-tangy-colts-beg-230.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 b=c(({helpers:t})=>({states:{components:[C(t),{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select your Airtable Base from the list."),id:"base-id",label:o("Select Base"),onChange:"SELECT_BASE",onRefetch:"REFETCH_BASES",optionFilterProp:"label",options:[],placeholder:o("Select Base"),render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:t.componentName.select,fieldType:"config",helperText:o("Select the table where you want to update a record."),id:"table-id",label:o("Select Table"),onChange:"SELECT_TABLE",onRefetch:"REFETCH_TABLES",optionFilterProp:"label",options:[],path:"table-id",render:"IF_BASE_ID_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:t.componentName.mixInput,fieldType:"config",helperText:o("Select or enter the record ID you want to update."),id:"record-id",label:o("Record ID"),onChange:"SELECT_RECORD",path:"record-id",render:"IF_TABLE_SELECTED",required:!0,value:[]},{addItemButtonLabel:"Add Field",componentName:t.componentName.repeaterField,fieldsMetaData:[{allowClear:!0,componentName:t.componentName.select,label:o("Field Name"),name:"airtableFieldKey",options:[],placeholder:o("Select Field"),showSearch:!0,value:void 0,wrapperClassName:"w-100"},{componentName:t.componentName.mixInput,label:o("Field Value"),name:"value",value:[],wrapperClassName:"w-100"}],helperText:o("Map the fields to update the record. Select field names and provide their new values."),id:"record-fields",label:o("Record Fields"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_FIELDS",labelActionText:o("Refetch Fields"),onChange:"SET_RECORD_FIELDS",path:"record-fields",render:"IF_TABLE_SELECTED",value:[]}]},actions:{CONNECTION_ADD_CHANGE:s,SELECT_BASE:({$:e,e:a})=>{l("baseId")({$:e,e:a}),d(e)},SELECT_RECORD:l("recordId"),SELECT_TABLE:({$:e,e:a})=>{l("tableId")({$:e,e:a}),i(e)},IF_BASE_ID_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("base-id"))==null?void 0:a.value)},IF_CONNECTION_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("connection-id"))==null?void 0:a.value)},IF_TABLE_SELECTED:({$:e})=>{var a;return n((a=e.getComponent("table-id"))==null?void 0:a.value)},ON_MACHINE_LOAD:async({$:e})=>{E(e,[{db:"connectionId",id:"connection-id"},{db:"baseId",id:"base-id"},{db:"recordFields",id:"record-fields"},{db:"recordId",id:"record-id"},{db:"tableId",id:"table-id"},{db:"fieldTypes",id:"fieldTypes"}]),await Promise.all([r(e),d(e),i(e)])},REFETCH_BASES:({$:e})=>r(e),REFETCH_FIELDS:({$:e})=>i(e),REFETCH_TABLES:({$:e})=>d(e),SET_CONNECTION:({$:e,e:a})=>{l("connectionId")({$:e,e:a}),r(e),p(e,t)},SET_RECORD_FIELDS:l("recordFields")}}));export{b as default};
