How would you refactor this component to improve its readability and performance?
Assume the component receives items, a list of dictionaries containing id, visible, and value. Implement refactor_component(items) to return visible items with duplicate IDs removed, keeping the first occurrence, and ordered by ascending id. The result must not mutate the input.
Input and output values are plain lists and dictionaries.
id, boolean visible, and any valuedef refactor_component(items):