there is a direct object pronoun involved here, and when that occurs, the past participle takes an ending that matches the gender and number of the object referred to. In this case, the "a" at the end of "vista" tells you the object references is feminine and not masculine. Note--just to make things messier--the agreement between a past participle and a direct object pronoun is required for third person singular and plural, but is considered optional for first and second person singular and plural.
Take a look at the answers from CreyB & BeatlesMusician above. Essentially it's because of the l' in "l'hai". It's a contraction for "la". And you can tell it's "la" (feminine) instead of "lo" (masculine) because of what happens to the verb "vista" as a direct response to the object since it comes before "avere" (hai). So, "vista" says the l' is la (her/it) instead of lo (him/it).