Demand for electronic components related to AI helped offset headwinds from the conflict in the Middle East in the first half of the year.