import{aa as d,ab as i}from"./_applist-tangy-colts-beg-36.js";import{_ as n}from"./main-tangy-colts-beg.js";import{s as c}from"./machine.-tangy-colts-beg-869.js";import{h as p,f as E,s,c as T,a as r,b as l}from"./machineh-tangy-colts-beg-115.js";import"./lodash-tangy-colts-beg-516.js";globalThis.jotaiAtomCache=globalThis.jotaiAtomCache||{cache:new Map,get(o,e){return this.cache.has(o)?this.cache.get(o):(this.cache.set(o,e),e)}};const N=d(({helpers:o})=>({states:{components:[T(o),{componentName:o.componentName.select,fieldType:"config",id:"spreadsheet-id",label:n("Spreadsheet"),onChange:"SELECT_SPREADSHEET",onRefetch:"REFETCH_SPREADSHEETS",optionFilterProp:"label",options:[],placeholder:n("Select a spreadsheet"),render:"IF_CONNECTION_SELECTED",showSearch:!0,value:void 0},{componentName:o.componentName.select,fieldType:"config",id:"sheet-title",label:n("Sheet"),onChange:"SELECT_SHEET",onRefetch:"REFETCH_SHEETS",optionFilterProp:"label",options:[],placeholder:n("Select a sheet"),render:"IF_SPREADSHEET_SELECTED",showSearch:!0,value:void 0},{addItemButtonLabel:"Add Column",componentName:o.componentName.repeaterField,fieldsMetaData:[{componentName:o.componentName.select,label:n("Column"),name:"column",options:[],required:!0,style:{width:100},value:""},{componentName:o.componentName.mixInput,label:n("Value"),name:"value",required:!0,value:[],wrapperClassName:"w-100"}],id:"row-data",label:n("Field Mapping"),labelActionIconName:"refresh-cw",labelActionOnClick:"REFETCH_COLUMNS",labelActionText:n("Refetch Columns"),onChange:"ON_CHANGE_ROW_DATA",path:"rowData",render:"IF_SHEET_SELECTED",value:[],wrapperClassName:"mt-3"},{componentName:o.componentName.switch,id:"show-advanced-settings",label:n("Show Advanced Settings"),onChange:"HANDLE_SHOW_ADVANCED_SETTINGS",render:"IF_SHEET_SELECTED"},{componentName:o.componentName.select,fieldType:"config",helperText:n("Choose how new data is added relative to existing sheet content. 'Overwrite' updates empty columns without affecting existing data; 'Insert Rows' always adds new rows."),id:"insert-data-option",label:n("Insert Data Option"),onChange:"SELECT_INSERT_DATA_OPTION",options:[{label:n("Insert Rows"),value:"INSERT_ROWS"},{label:n("Overwrite"),value:"OVERWRITE"}],render:"IF_ADVANCED_SETTINGS_ENABLED",value:"INSERT_ROWS"},{componentName:o.componentName.select,fieldType:"config",helperText:n("Specifies how input data is interpreted: store as-is (RAW) or parse like user input in Sheets (USER_ENTERED)."),id:"value-input-option",label:n("Value Input Option"),onChange:"SELECT_VALUE_INPUT_OPTION",options:[{label:n("User Entered"),value:"USER_ENTERED"},{label:n("Raw"),value:"RAW"}],render:"IF_ADVANCED_SETTINGS_ENABLED",value:"USER_ENTERED"}]},actions:{ON_MACHINE_LOAD:async({$:e})=>{c(e,[{db:"connectionId",id:"connection-id"},{db:"spreadsheetId",id:"spreadsheet-id"},{db:"sheetTitle",id:"sheet-title"},{db:"rowData",id:"row-data"},{db:"insertDataOption",id:"insert-data-option"},{db:"valueInputOption",id:"value-input-option"}]),await Promise.all([E(e),l(e),s(e)])},IF_ADVANCED_SETTINGS_ENABLED:({$:e})=>{var t,a;return i((t=e.getComponent("sheet-title"))==null?void 0:t.value)&&((a=e.getComponent("show-advanced-settings"))==null?void 0:a.value)===!0},IF_CONNECTION_SELECTED:({$:e})=>{var t;return i((t=e.getComponent("connection-id"))==null?void 0:t.value)},IF_SHEET_SELECTED:({$:e})=>{var t;return i((t=e.getComponent("sheet-title"))==null?void 0:t.value)},IF_SPREADSHEET_SELECTED:({$:e})=>{var t;return i((t=e.getComponent("spreadsheet-id"))==null?void 0:t.value)},REFETCH_COLUMNS:({$:e})=>s(e),REFETCH_SHEETS:({$:e})=>Promise.all([l(e),s(e)]),REFETCH_SPREADSHEETS:({$:e})=>E(e),CONNECTION_ADD_CHANGE:p,HANDLE_SHOW_ADVANCED_SETTINGS:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t})},ON_CHANGE_ROW_DATA:({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.rowData=t})},SELECT_INSERT_DATA_OPTION:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.insertDataOption=t})},SELECT_SHEET:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.sheetTitle=t}),await s(e)},SELECT_SPREADSHEET:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setComponent("sheet-title",a=>{a.value=void 0}),e.setDb(a=>{a.spreadsheetId=t,a.sheetTitle=void 0}),await l(e)},SELECT_VALUE_INPUT_OPTION:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.valueInputOption=t})},SET_CONNECTION:async({$:e,e:t})=>{e.setThisComponent(a=>{a.value=t}),e.setDb(a=>{a.connectionId=t}),await E(e),r(e,o)}}}));export{N as default};
