"use strict";(self.webpackChunkdami=self.webpackChunkdami||[]).push([[3827],{73827:(e,a,t)=>{t.r(a),t.d(a,{default:()=>r});var s=t(9924),n=t(31263);async function r({data:e,id:a},{refData:t}){if((0,n.cb)(e.spreadsheetId))throw new Error("empty-spreadsheet-id");if((0,n.cb)(e.range))throw new Error("empty-spreadsheet-range");let r=[];if("get"===e.type){const a=await async function({spreadsheetId:e,range:a,firstRowAsKey:t}){const r=await s.qH.getValues({spreadsheetId:e,range:a}),o=await r.json();if(!r.ok)throw new Error(o.message);return t?(0,n.Ac)(o.values):o.values}(e);r=a,e.refKey&&!(0,n.cb)(e.refKey)&&(t.googleSheets[e.refKey]=a)}else"getRange"===e.type?(r=await async function({spreadsheetId:e,range:a}){const t=await s.qH.getRange({spreadsheetId:e,range:a}),n=await t.json();if(!t.ok)throw new Error(n.message);return{tableRange:n.tableRange||null,lastRange:n.updates.updatedRange}}(e),e.assignVariable&&this.setVariable(e.variableName,r),e.saveData&&this.addDataToColumn(e.dataColumn,r)):["update","append"].includes(e.type)?r=await async function({range:e,append:a,dataFrom:t,customData:r,spreadsheetId:o,keysAsFirstRow:i,insertDataOption:d,valueInputOption:p},u){let c=[];if(["data-columns","table"].includes(t)?c=i?(0,n.ex)(u):u.map((e=>Object.values(e))):"custom"===t&&(c=(0,n.Rx)(r,r)),Array.isArray(c)){const e=["boolean","string","number"];c.forEach(((a,t)=>{a.forEach(((a,s)=>{a&&e.includes(typeof a)||(c[t][s]=" ")}))}))}const l={valueInputOption:p||"RAW"};a&&Object.assign(l,{includeValuesInResponse:!1,insertDataOption:d||"INSERT_ROWS"});const g=await s.qH.updateValues({range:e,append:a,spreadsheetId:o,options:{queries:l,body:JSON.stringify({values:c})}});if(!g.ok){const e=await g.json();throw new Error(e.message)}}({...e,append:"append"===e.type},t.table):"clear"===e.type&&(r=await async function({spreadsheetId:e,range:a}){const t=await s.qH.clearValues({spreadsheetId:e,range:a}),n=await t.json();if(!t.ok)throw new Error(n.message);return n}(e));return{data:r,nextBlockId:this.getBlockConnections(a)}}}}]);