<think>
Okay, I need to implement the functions tags_of and tag_index as per the given interface. Let me start by understanding the requirements.

First, the tags_of function. The task says to break a comma-separated line into tags, trimming spaces around each and leaving out any that are empty. So, the input is a string (line), and the output is a list of tags. But wait, the function is called tags_of, which takes a line. So, the line is a string that's comma-separated, but each tag might have surrounding spaces. For example, if the line is "  apple,  banana ,  orange ", splitting by commas would give ["  apple", "  banana ", "  orange "]. Then, we need to trim each of these strings. So, for each part, we strip whitespace. Then, if the stripped part is empty, we exclude it. So, the function should process each part, trim, and filter out empty strings.

So, the steps for tags_of would be: split the line by commas, then for each part, strip whitespace, and collect those that are not empty.

Next, the tag_index function. It takes a list of lines and returns a mapping from each tag to the lines that carry it, in the order the lines came. So, for each line in the input list, we process it using tags_of to get the tags. Then, for each tag in that line, we add the line to the list associated with that tag in the dictionary. But we need to make sure that if a line has multiple tags, each tag is mapped to the line. Also, the order of the lines in the list for each tag should be the same as the order they appeared in the input lines.

But wait, the problem says to "reject a line that is not text with an error." So, for each line in the input lines list, we need to check if it's a valid text line. How is a line considered valid? The problem says that tags_of breaks a line into tags, but if the line is not text, then it's invalid. Wait, the function tag_index is supposed to reject a line that is not text. So, perhaps a line is considered valid if it's not empty? Or maybe if it's a non-empty string? Or maybe if it's a line that can be split into tags. Wait, the problem says that tags_of is supposed to reject a line that is not text. Wait, the original problem says: "Reject a line that is not text with an error." So, for each line in the input to tag_index, we need to check if it's a valid text line. But how is a line considered text? Well, perhaps a line is considered text if it's not empty and can be split into tags. But maybe the line is considered text if it's not empty. Wait, the problem says that tags_of breaks a line into tags, trimming spaces and leaving out empty ones. So, if the line is empty, then tags_of would return an empty list. But the problem says that tag_index should reject a line that is not text. So, perhaps a line is considered text if it's not empty. But maybe the line is considered text if it's not empty and can be split into at least one tag. Wait, but the problem says that tag_index should reject a line that is not text. So, perhaps the line is considered text if it's not empty. But how to determine that? Because if the line is empty, then tags_of would return an empty list, but the line is not text. So, in the tag_index function, for each line in the input lines, we need to check if it's a