{"version":3,"file":"tableUtils.mjs","sources":["../../../../../../../../../web/src/adminPortal/shared/utils/tableUtils.ts"],"sourcesContent":["import { ReactNode } from 'react';\n\nexport const validateRowKey = <T extends { id?: string } | string>(\n  items: T[],\n  rowKeyExtractor?: (item: T) => string,\n): void => {\n  if (\n    items.length > 0 &&\n    typeof items[0] !== 'string' &&\n    (!items[0]?.id || typeof items[0].id !== 'string') &&\n    !rowKeyExtractor\n  ) {\n    throw new Error('rowKeyExtractor is required if items are not strings or do not have an id property');\n  }\n};\n\nexport const getTableCellValue = (children: ReactNode): ReactNode => {\n  let value = children;\n  if (typeof children === 'string' || typeof children === 'number' || typeof children === 'boolean') {\n    value = String(children);\n  }\n\n  if (!children) {\n    value = '–';\n  }\n  return value;\n};\n"],"names":["validateRowKey","items","rowKeyExtractor","length","id","Error","getTableCellValue","children","value","String"],"mappings":"AAEO,MAAMA,cAAAA,GAAiB,CAC5BC,KAAAA,EACAC,eAAAA,GAAAA;IAEA,IACED,KAAAA,CAAME,MAAM,GAAG,CAAA,IACf,OAAOF,KAAK,CAAC,CAAA,CAAE,KAAK,QAAA,KACnB,CAACA,KAAK,CAAC,CAAA,CAAE,EAAEG,EAAAA,IAAM,OAAOH,KAAK,CAAC,CAAA,CAAE,CAACG,EAAE,KAAK,QAAO,CAAA,IAChD,CAACF,eAAAA,EACD;AACA,QAAA,MAAM,IAAIG,KAAAA,CAAM,oFAAA,CAAA;AAClB,IAAA;AACF;AAEO,MAAMC,oBAAoB,CAACC,QAAAA,GAAAA;AAChC,IAAA,IAAIC,KAAAA,GAAQD,QAAAA;IACZ,IAAI,OAAOA,aAAa,QAAA,IAAY,OAAOA,aAAa,QAAA,IAAY,OAAOA,aAAa,SAAA,EAAW;AACjGC,QAAAA,KAAAA,GAAQC,MAAAA,CAAOF,QAAAA,CAAAA;AACjB,IAAA;AAEA,IAAA,IAAI,CAACA,QAAAA,EAAU;QACbC,KAAAA,GAAQ,GAAA;AACV,IAAA;IACA,OAAOA,KAAAA;AACT;;;;"}