import{b as m,i as l}from"./useflows-BpG3C9m1.js";import{e as t}from"./main-few-lands-burn.js";import{s,h as n}from"./machine.-BRuqPpdF.js";import{h as p,c}from"./commons.-bP-saOXM.js";import{f as r,a as i,s as E}from"./machineh-5vGV0ecU.js";import"./mutative-C6xjlr6O.js";import"./lodash-YpNkAOPN.js";const A=m(({helpers:a})=>({states:{components:[c(a),{allowClear:!0,componentName:a.componentName.select,fieldType:"config",helperText:t("Select the spreadsheet."),id:"spreadsheet-id",label:t("Spreadsheet"),onChange:"HANDLE_SPREADSHEET",onRefetch:"REFETCH_SPREADSHEETS",optionFilterProp:"label",options:[],render:"IF_CONNECTION_SELECTED",required:!0,showSearch:!0,value:void 0},{allowClear:!0,componentName:a.componentName.select,fieldType:"config",helperText:t("Select the sheet."),id:"sheet-title",label:t("Sheet"),onChange:"HANDLE_SHEET",onRefetch:"REFETCH_SHEETS",optionFilterProp:"label",options:[],render:"IF_SPREADSHEET_SELECTED",required:!0,showSearch:!0,value:void 0},{componentName:a.componentName.mixInput,helperText:t("The range where the row will be updated, e.g., A1:C1."),id:"target-range",label:t("Range"),onChange:"HANDLE_TARGET_RANGE",path:"targetRange",render:"IF_SHEET_SELECTED",required:!0,value:[]},{addItemButtonLabel:"Add Column",componentName:a.componentName.repeaterField,fieldsMetaData:[{componentName:a.componentName.select,label:t("Column"),name:"column",options:[],required:!0,style:{width:100},value:""},{componentName:a.componentName.mixInput,label:t("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"row-data",label:t("Field Mapping"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_COLUMNS",labelActionText:t("Refetch Columns"),onChange:"HANDLE_ROW_DATA",path:"rowData",render:"IF_SHEET_SELECTED",value:[],wrapperClassName:"mt-3"}]},actions:{CONNECTION_ADD_CHANGE:p,HANDLE_ROW_DATA:n("rowData"),HANDLE_TARGET_RANGE:n("targetRange"),IF_CONNECTION_SELECTED:({$:e})=>l(e.getComponent("connection-id")?.value),IF_SHEET_SELECTED:({$:e})=>l(e.getComponent("sheet-title")?.value),IF_SPREADSHEET_SELECTED:({$:e})=>l(e.getComponent("spreadsheet-id")?.value),REFETCH_COLUMNS:({$:e})=>E(e),REFETCH_SHEETS:({$:e})=>Promise.all([i(e),E(e)]),REFETCH_SPREADSHEETS:({$:e})=>r(e),HANDLE_SHEET:({$:e,e:o})=>{n("sheetTitle")({$:e,e:o}),E(e)},SET_CONNECTION:({$:e,e:o})=>{n("connectionId")({$:e,e:o}),r(e)},HANDLE_SPREADSHEET:({$:e,e:o})=>{n("spreadsheetId")({$:e,e:o}),e.setComponent("sheet-title",d=>{d.value=void 0}),i(e)},ON_MACHINE_LOAD:({$:e})=>{s(e,[{db:"connectionId",id:"connection-id"},{db:"spreadsheetId",id:"spreadsheet-id"},{db:"sheetTitle",id:"sheet-title"},{db:"targetRange",id:"target-range"},{db:"rowData",id:"row-data"}]),Promise.all([r(e),i(e),E(e)])}}}));export{A as default};
