# -*- 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()

anchor = 'url:"details/gatech-robotics-ms.html"},\n];'
assert anchor in idx, "PROGRAMS anchor not found"

new_progs = (
'{id:"gatech-aerospace-ms",s:"gatech",n:"航空航天工程硕士（MS Aerospace Engineering）",en:"Master of Science in Aerospace Engineering",dept:"航空航天工程系（AE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"Thesis/Non-Thesis 双选；毕业 GPA 2.7；在校全日制（在线版排除）",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-aerospace-engineering-ms.html"},\n'
'{id:"gatech-mse-ms",s:"gatech",n:"材料科学与工程硕士（MS Materials Science and Engineering）",en:"Master of Science in Materials Science and Engineering",dept:"材料科学与工程系（MSE）",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-materials-science-engineering-ms.html"},\n'
'{id:"gatech-physics-ms",s:"gatech",n:"物理学硕士（MS Physics）",en:"Master of Science in Physics",dept:"物理系（School of Physics）",college:"Georgia Tech",disc:"sci",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-physics-ms.html"},\n'
'{id:"gatech-pubp-ms",s:"gatech",n:"公共政策硕士（MS Public Policy）",en:"Master of Science in Public Policy",dept:"Ivan Allen 公共政策学院（School of Public Policy）",college:"Georgia Tech",disc:"soc",lvl:"m",deg:"MS",dur:"Thesis/Paper-Project 双选；政策方法/微观经济/公共财政核心；毕业 GPA 2.7",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-public-policy-ms.html"},\n'
'{id:"gatech-hci-ms",s:"gatech",n:"人机交互硕士（MS Human-Computer Interaction）",en:"Master of Science in Human-Computer Interaction",dept:"跨学院（Computing / Ivan Allen / Design / Psychology）",college:"Georgia Tech",disc:"cs",lvl:"m",deg:"MS",dur:"跨学院 HCI；Fixed Core + Specialization + Project；GPA 3.0",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-human-computer-interaction-ms.html"},\n'
)

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

# CATD 补录 4 条（HCI 已有占位，跳过）
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", "航空航天工程系", "Aerospace Engineering", "航空航天工程", "MS", "https://catalog.gatech.edu/programs/aerospace-engineering-ms/", "eng", "details/gatech-aerospace-engineering-ms.html"]'
',["gatech", "材料科学与工程系", "Materials Science and Engineering", "材料科学与工程", "MS", "https://catalog.gatech.edu/programs/materials-science-engineering-ms/", "eng", "details/gatech-materials-science-engineering-ms.html"]'
',["gatech", "物理系", "Physics", "物理学", "MS", "https://catalog.gatech.edu/programs/physics-ms/", "sci", "details/gatech-physics-ms.html"]'
',["gatech", "Ivan Allen 公共政策学院", "Public Policy", "公共政策", "MS", "https://catalog.gatech.edu/programs/public-policy-ms/", "soc", "details/gatech-public-policy-ms.html"]'
)
idx = idx[:abs_catd_end] + catd_new + idx[abs_catd_end:]

# VD 追加 5 条（含 HCI 覆盖占位，重新登记一次）
vd_start2 = idx.find("const VERIFIED_DETAILS=new Set([")
vd_end = idx.find("]);", vd_start2)
vd_new = (
',"details/gatech-aerospace-engineering-ms.html"'
',"details/gatech-materials-science-engineering-ms.html"'
',"details/gatech-physics-ms.html"'
',"details/gatech-public-policy-ms.html"'
',"details/gatech-human-computer-interaction-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")
