import{j as g}from"./cm-1.0.63-CSIRHMXC.js";import{r as p}from"./redux-1.0.63-Df-eBzJn.js";import{l as N}from"./ActionsDml-1.0.63-nhbCczlS.js";import{a as S}from"./hooks-1.0.63-CWs3kTdT.js";import{l as u,cM as v,S as h,a as x,cP as y,o as j}from"./lib-1.0.63-DJZPtMem.js";import"./vendor-1.0.63-CN03Eozo.js";import"./RestApi-1.0.63-BUfzocgq.js";import"./loglevel-1.0.63-BZ7XahX3.js";import"./lodash-1.0.63-hMxolcpJ.js";import"./moment-1.0.63-C5S46NFB.js";const U=({appId:a,lookupColumn:e,cell:r,metaData:m,highlight:V})=>{u.debug(a,e,r,m);const l=S(),[b,i]=p.useState(r.getValue());return p.useEffect(()=>{var f;if(u.debug(a,e,r),e.lookup!==void 0){const s=v.getSelectors().selectLookupValue(h.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){const o={};o[e.lookup.key]=r.getValue(),u.debug(o);const k=m.isRelationSelectionTable===!0?x.relationTablePrefix+e.columnName:e.columnName;N(a,"table",k,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 c="";if(!e.lookup.value.includes(","))c=t.data[0].value,i(c.toString());else{const d=e.lookup.value.split(",");i(d.map(n=>t.data[0][n]).join(e.lookup.delimiter)),c=d.map(n=>t.data[0][n])}l(y({appId:a,columnName:e.columnName,lookupValue:{key:t.data[0].key,value:c}}))}},t=>{console.error(t)}),l(y({appId:a,columnName:e.columnName,lookupValue:{key:o[e.lookup.key],value:o[e.lookup.key]}}))}}else i("")},[a,r,l,e]),g.jsx(g.Fragment,{children:V(j(b),e,e.columnName+r.row.id)})};export{U as default};
