import { ChipColor , EnumValueConfig , EnumValues } from "../../models" ; export function enumToObjectEntries ( enumValues ) { return enumValues instanceof Map ? Array . from ( enumValues . entries ( ) ) : Object . entries < string | EnumValueConfig > ( enumValues ) ; } export function getLabelOrConfigFrom ( enumValues , key ) { return enumValues instanceof Map ? enumValues . get ( key ) : enumValues [ key ] ; } export function getColorSchemaKey ( enumValues , key ) { const labelOrConfig = getLabelOrConfigFrom ( enumValues , key ) ; if ( typeof labelOrConfig === "object" && "color" in labelOrConfig ) { return labelOrConfig . color ; } return undefined ; } export function isEnumValueDisabled ( labelOrConfig ? ) { return typeof labelOrConfig === "object" && ( labelOrConfig as EnumValueConfig ) . disabled ; } export function buildEnumLabel ( labelOrConfig ? ) { if ( labelOrConfig === undefined ) return undefined ; if ( typeof labelOrConfig === "object" ) { return labelOrConfig . label ; } else { return labelOrConfig ; } }