Refactor this component to improve its testability.
Extract the component's deterministic state transformation into build_component_view_model(props). The function must not access browser globals, perform I/O, mutate props, or depend on rendering state. Return a view model containing enabled items, the valid selected item, and whether the empty state should be shown.
Input props is a dictionary with items, a list of {id, label, enabled} objects, and selectedId, which may be null. Return {visibleItems, selectedId, showEmptyState}.
props contains an items list and may contain a null or missing selectedIdid, string label, and boolean enabled fieldsdef build_component_view_model(props):