# -*- coding: utf-8 -*-
import io, sys, os, ast
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding="utf-8")
os.chdir(r"D:\work buddy\2026-11-05-14-15-52")

idx = open("index_main.html", encoding="utf-8").read()

# 1) PROGRAMS 末条锚点
anchor = 'url:"details/gatech-bioinformatics-ms.html"},\n];'
assert anchor in idx, "PROGRAMS anchor not found"

new_progs = (
'{id:"gatech-bme-ms",s:"gatech",n:"生物医学工程硕士（MS Biomedical Engineering）",en:"Master of Science in Biomedical Engineering",dept:"生物医学工程系（BME）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"Thesis/Non-Thesis 双选；基础课 + 方向 + 选修",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-biomedical-engineering-ms.html"},\n'
'{id:"gatech-cheme-ms",s:"gatech",n:"化学工程硕士（MS Chemical Engineering）",en:"Master of Science in Chemical Engineering",dept:"化学与生物分子工程系（ChBE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"31 学分，授课型；CHBE 选修 + 其他选修",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-chemical-engineering-ms.html"},\n'
'{id:"gatech-ce-ms",s:"gatech",n:"土木工程硕士（MS Civil Engineering）",en:"Master of Science in Civil Engineering",dept:"土木与环境工程系（CEE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；专业方向 + 选修",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-civil-engineering-ms.html"},\n'
'{id:"gatech-math-ms",s:"gatech",n:"数学硕士（MS Mathematics）",en:"Master of Science in Mathematics",dept:"数学学院",college:"Georgia Tech",disc:"sci",lvl:"m",deg:"MS",dur:"30 学分；Analysis Concentration + 跨领域；Thesis/Non-Thesis 双选",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-mathematics-ms.html"},\n'
'{id:"gatech-robotics-ms",s:"gatech",n:"机器人学硕士（MS Robotics）",en:"Master of Science in Robotics",dept:"跨学院机器人方向",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"36 学分；Foundation + 机器人选修 + 实习；Thesis/Non-Thesis 双选",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-robotics-ms.html"},\n'
)

idx = idx.replace(anchor, 'url:"details/gatech-bioinformatics-ms.html"},\n' + new_progs + '];', 1)

# 2) CATD 补录 5 条（全部无占位）
catd_start = idx.find("const CATD=")
vd_start = idx.find("const VERIFIED_DETAILS=")
catd_seg = idx[catd_start:vd_start]
catd_end = catd_seg.rfind("];")
abs_catd_end = catd_start + catd_end
catd_new = (
',["gatech", "生物医学工程系", "Biomedical Engineering", "生物医学工程", "MS", "https://catalog.gatech.edu/programs/biomedical-engineering-ms/", "eng", "details/gatech-biomedical-engineering-ms.html"]'
',["gatech", "化学与生物分子工程系", "Chemical Engineering", "化学工程", "MS", "https://catalog.gatech.edu/programs/chemical-engineering-ms/", "eng", "details/gatech-chemical-engineering-ms.html"]'
',["gatech", "土木与环境工程系", "Civil Engineering", "土木工程", "MS", "https://catalog.gatech.edu/programs/civil-engineering-ms/", "eng", "details/gatech-civil-engineering-ms.html"]'
',["gatech", "数学学院", "Mathematics", "数学", "MS", "https://catalog.gatech.edu/programs/mathematics-ms/", "sci", "details/gatech-mathematics-ms.html"]'
',["gatech", "跨学院机器人方向", "Robotics", "机器人学", "MS", "https://catalog.gatech.edu/programs/robotics-ms/", "eng", "details/gatech-robotics-ms.html"]'
)
idx = idx[:abs_catd_end] + catd_new + idx[abs_catd_end:]

# 3) VD 追加 5 条
vd_start2 = idx.find("const VERIFIED_DETAILS=new Set([")
vd_end = idx.find("]);", vd_start2)
vd_new = (
',"details/gatech-biomedical-engineering-ms.html"'
',"details/gatech-chemical-engineering-ms.html"'
',"details/gatech-civil-engineering-ms.html"'
',"details/gatech-mathematics-ms.html"'
',"details/gatech-robotics-ms.html"'
)
idx = idx[:vd_end] + vd_new + idx[vd_end:]

open("index_main.html", "w", encoding="utf-8").write(idx)
print("DONE size:", len(idx))
ast.parse(open(__file__, encoding="utf-8").read())
print("syntax OK")
