A court in South Korea has declared the bankruptcy of Hanjin Shipping, after two weeks of appeals that ended Friday, bringing to a close 40 years of the company’s history as a leading shipping line and leaving challenges for the industry. The demise of the company — once the largest shipping company here and the world’s seventh biggest — began in 2008 in the midst of the financial crisis.