import{j as V}from"./tanstack-1.0.74-aU0azVkW.js";import{r as b}from"./redux-1.0.74-D8bIc6ki.js";import{l as h}from"./ActionsDml-1.0.74-C175Bq0Y.js";import{a as v}from"./hooks-1.0.74-NYCTWeI9.js";import{l as u,c1 as x,S as j,b as A,cI as p,r as E}from"./lib-1.0.74-B5IEqfHg.js";import"./vendor-1.0.74-CN03Eozo.js";import"./RestApi-1.0.74-5XKxNzpR.js";import"./utils-1.0.74-7xWhx9mc.js";const q=({appId:a,lookupColumn:e,cell:r,metaData:d,highlight:k})=>{u.debug(a,e,r,d);const c=v(),[N,i]=b.useState(r.getValue());return b.useEffect(()=>{var f,m,g;if(u.debug(a,e,r),e.lookup!==void 0){const s=x.getSelectors().selectLookupValue(j.getState().lookups,a,e.columnName,r.getValue());if(u.debug(s),s!==void 0&&s.length>0)Array.isArray(s)?i(s.join(e.lookup.delimiter)):i(s);else if(((f=e.lookup)==null?void 0:f.loadOnStartup)!==!0||((g=(m=e.lookup)==null?void 0:m.dynamicConditions)==null?void 0:g.length)>0){const o={};o[e.lookup.key]=r.getValue(),u.debug(o);const S=d.isRelationSelectionTable===!0?A.relationTablePrefix+e.columnName:e.columnName;h(a,"table",S,e.lookup.key,e.lookup.value,o,{},t=>{if(u.debug(t.data),e.lookup!==void 0&&Array.isArray(t.data)&&t.data.length>0){let n="";if(!e.lookup.value.includes(","))n=t.data[0].value,i(n.toString());else{const y=e.lookup.value.split(",");i(y.map(l=>t.data[0][l]).join(e.lookup.delimiter)),n=y.map(l=>t.data[0][l])}c(p({appId:a,columnName:e.columnName,lookupValue:{key:t.data[0].key,value:n}}))}},t=>{console.error(t)}),c(p({appId:a,columnName:e.columnName,lookupValue:{key:o[e.lookup.key],value:o[e.lookup.key]}}))}}else i("")},[a,r,c,e]),V.jsx(V.Fragment,{children:k(E(N),e,e.columnName+r.row.id)})};export{q as default};
