# -*- 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-digital-media-ms.html"},\n];'
assert anchor in idx, "PROGRAMS anchor not found"

new_progs = (
'{id:"gatech-medphys-ms",s:"gatech",n:"医学物理硕士（MS Medical Physics）",en:"Master of Science in Medical Physics",dept:"核与放射工程/医学物理系（NRE）",college:"Georgia Tech",disc:"eng",lvl:"m",deg:"MS",dur:"35 学分；Thesis/Non-Thesis 双选；在校 on-campus MS；distance learning 视频版排除",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-medical-physics-ms.html"},\n'
'{id:"gatech-musictech-ms",s:"gatech",n:"音乐技术硕士（MS Music Technology）",en:"Master of Science in Music Technology",dept:"School of Music 跨 CS/ECE/ME/ID",college:"Georgia Tech",disc:"cs",lvl:"m",deg:"MS",dur:"48 学分；4 学期；Project/Thesis 双轨；需 portfolio",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-music-technology-ms.html"},\n'
'{id:"gatech-gist-ms",s:"gatech",n:"地理信息科学与技术硕士（MS GIST）",en:"Master of Science in Geographic Information Science and Technology",dept:"城市与区域规划学院（CRP）",college:"Georgia Tech",disc:"cs",lvl:"m",deg:"MS",dur:"34 学分；全日制 1 年含夏 capstone；先修 GIS 基础",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-gist-ms.html"},\n'
'{id:"gatech-eas-ms",s:"gatech",n:"地球与大气科学硕士（MS Earth and Atmospheric Sciences）",en:"Master of Science in Earth and Atmospheric Sciences",dept:"地球与大气科学学院（EAS）",college:"Georgia Tech",disc:"sci",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；先修微积分/化学/物理各 1 年",stem:1,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-earth-atmospheric-sciences-ms.html"},\n'
'{id:"gatech-bcfm-ms",s:"gatech",n:"建筑施工与设施管理硕士（MS Building Construction and Facility Management）",en:"Master of Science in Building Construction and Facility Management",dept:"School of Building Construction",college:"Georgia Tech",disc:"biz",lvl:"m",deg:"MS",dur:"30 学分；Thesis/Non-Thesis 双选；两个 concentration；evening classes 在校版",stem:0,rank:"",test:{cls:""},ddl:"catalog 页未列具体轮次（待补）",lang:"TOEFL iBT / IELTS Academic（最低分待补）",tui:"catalog 页未列打包学费（待补）",url:"details/gatech-building-construction-facility-management-ms.html"},\n'
)

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

# CATD 补录 4 条新建（Medical Physics 已有占位）
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", "School of Music", "Music Technology", "音乐技术", "MS", "https://catalog.gatech.edu/programs/music-technology-ms/", "cs", "details/gatech-music-technology-ms.html"]'
',["gatech", "城市与区域规划学院", "Geographic Information Science and Technology", "地理信息科学与技术", "MS", "https://catalog.gatech.edu/programs/gist-ms/", "cs", "details/gatech-gist-ms.html"]'
',["gatech", "地球与大气科学学院", "Earth and Atmospheric Sciences", "地球与大气科学", "MS", "https://catalog.gatech.edu/programs/earth-atmospheric-sciences-ms/", "sci", "details/gatech-earth-atmospheric-sciences-ms.html"]'
',["gatech", "建筑施工学院", "Building Construction and Facility Management", "建筑施工与设施管理", "MS", "https://catalog.gatech.edu/programs/building-construction-facility-management-ms/", "biz", "details/gatech-building-construction-facility-management-ms.html"]'
)
idx = idx[:abs_catd_end] + catd_new + idx[abs_catd_end:]

# VD 追加 5 条
vd_start2 = idx.find("const VERIFIED_DETAILS=new Set([")
vd_end = idx.find("]);", vd_start2)
vd_new = (
',"details/gatech-medical-physics-ms.html"'
',"details/gatech-music-technology-ms.html"'
',"details/gatech-gist-ms.html"'
',"details/gatech-earth-atmospheric-sciences-ms.html"'
',"details/gatech-building-construction-facility-management-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")
