A unified Thai kingdom was established in the mid-14th century .