A giant panda on loan from China to Thailand who captivated animal lovers through a 24-hour live broadcast of her antics died on Wednesday aged 21, said the zoo where she was housed.

Lin Hui was the last of three pandas in Thailand and had lived in an air-conditioned enclosure at Chiang Mai Zoo since 2003, but was due to return to China in October.

The notoriously sex-shy bear and her mate Chuang Chuang -- who died of a heart attack in 2019 -- were part of Beijing's so-called "panda diplomacy" programme.

Zoo director Wutthichai Muangman said Lin Hui suffered a nosebleed on Tuesday and was in a critical condition by the evening, before dying in the early hours of Wednesday.

"We helped her as much as we could until Lin Hui left us," Wutthichai told reporters.

Dejboon Maprasert, chairman of the Zoological Park Organisation of Thailand, said Chinese and Thai experts would jointly conduct an autopsy.

For years Lin Hui and Chuang Chuang struggled to conceive and were even shown "panda pornography" in an attempt to spice up their sex life.

Following artificial insemination, Lin Hui finally gave birth to Lin Ping in 2009, sparking panda mania in Thailand.

Animal lovers in the country were glued to a live 24-hour "Panda Channel" broadcast between 2009 and 2012.

Fans took to social media Wednesday to express sorrow over the animal's death.

"I used to watch her on the TV all the time. She was my motivation. RIP Lin Hui," one Twitter user wrote.

Srettha Thavisin, a prime ministerial candidate for the country's opposition Pheu Thai Party, tweeted that the panda had brought much joy to Thais over the years.

- 'Deeply loved' -

As Lin Hui's health deteriorated, vets at the Thai zoo consulted Chinese experts in Chengdu on treatment options.

On Tuesday night the Chinese consulate in Chiang Mai sent officials to the facility.

"During her 20 years in Thailand, Lin Hui was deeply loved by the Thai people and became an envoy of friendly exchanges between the people of China and Thailand," the consulate said in a statement Wednesday.

Chinese foreign ministry spokesman Wang Wenbin said the panda fell into a coma on Tuesday night.

"It is very regrettable that her life could not be saved," Wang told reporters in Beijing.

"Chinese authorities will set up an expert team to go to Thailand as soon as possible."

Wutthichai said Thailand would have to pay a 15 million baht ($435,000) insurance payout to China over the death.

Giant pandas are known for their low sex drive and are among the world's most endangered animals.

They can live up to 30 years in captivity, while in the wild their life expectancy ranges from 15 to 20 years, according to the World Wildlife Fund.

Chuang Chuang's death four years ago sparked outrage on social media in China and Chinese authorities sent a team to investigate and jointly carry out the autopsy.

Cub Lin Ping meanwhile was sent back to China in 2013 on a quest to find love.