@intent-hq/web 2.345.0 → 2.346.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/web/app/immutable/assets/{0.BtTQsuHZ.css → 0.C6uvaa87.css} +1 -1
- package/web/app/immutable/chunks/-UJlOg-6.js +1 -0
- package/web/app/immutable/chunks/-Wo302Zr.js +9 -0
- package/web/app/immutable/chunks/0qEvU7Aj.js +8 -0
- package/web/app/immutable/chunks/1_fC7X8z.js +1 -0
- package/web/app/immutable/chunks/2V4-p70U.js +408 -0
- package/web/app/immutable/chunks/{D3mUsAm9.js → 3DAIKGff.js} +1 -1
- package/web/app/immutable/chunks/{6Zmm5CZL.js → 3as4gwP9.js} +7 -7
- package/web/app/immutable/chunks/{BqRoJfH0.js → 3h5ZjEwa.js} +1 -1
- package/web/app/immutable/chunks/{Dz4sFk1c.js → 4sUGQp1u.js} +1 -1
- package/web/app/immutable/chunks/{fZqvRnJh.js → 5Ixgq0WC.js} +1 -1
- package/web/app/immutable/chunks/{CgQ2Q_uI.js → 71L4lHBq.js} +1 -1
- package/web/app/immutable/chunks/7eL9Pgig.js +1 -0
- package/web/app/immutable/chunks/{CWE4oREl.js → 9XVQ1GVX.js} +1 -1
- package/web/app/immutable/chunks/{C8dU7SM3.js → A8_BT67P.js} +1 -1
- package/web/app/immutable/chunks/ACNn9MHT.js +2 -0
- package/web/app/immutable/chunks/{Cv_J2c72.js → B-7vt8Nv.js} +1 -1
- package/web/app/immutable/chunks/B0-4rCYZ.js +2 -0
- package/web/app/immutable/chunks/{Chj7QpdD.js → B0WVH3Hg.js} +1 -1
- package/web/app/immutable/chunks/B0mNIdOb.js +1 -0
- package/web/app/immutable/chunks/{CWQrbZgx.js → B1HPKTBI.js} +1 -1
- package/web/app/immutable/chunks/{s_GzTTEG.js → B1U_DCBw.js} +1 -1
- package/web/app/immutable/chunks/{VyOfhH-C.js → B3D9gAmi.js} +1 -1
- package/web/app/immutable/chunks/{C-M7eh_Z.js → B4XZNQ4a.js} +1 -1
- package/web/app/immutable/chunks/{BqqN40AD.js → B4gIvcP2.js} +1 -1
- package/web/app/immutable/chunks/{C4dCVzfY.js → B55-cQLT.js} +1 -1
- package/web/app/immutable/chunks/B5HeJKYE.js +1 -0
- package/web/app/immutable/chunks/{Dlag9Uxb.js → B79pUPc3.js} +9 -9
- package/web/app/immutable/chunks/{34C5M9lk.js → B7dTLx8u.js} +1 -1
- package/web/app/immutable/chunks/B83M2_sj.js +1 -0
- package/web/app/immutable/chunks/BAGVOK-j.js +4 -0
- package/web/app/immutable/chunks/{DXDMhDlS.js → BBlTlRXR.js} +1 -1
- package/web/app/immutable/chunks/{D3I0DcnM.js → BDDEv5gU.js} +1 -1
- package/web/app/immutable/chunks/BDPAYMJ1.js +4 -0
- package/web/app/immutable/chunks/BDPqCRJm.js +2 -0
- package/web/app/immutable/chunks/{B0a-wzQr.js → BDZoh7yg.js} +1 -1
- package/web/app/immutable/chunks/{oilydQC6.js → BDtb6AfX.js} +1 -1
- package/web/app/immutable/chunks/{oxLL7zSC.js → BDzYiKUH.js} +3 -3
- package/web/app/immutable/chunks/{PwvNS9aJ.js → BJZ04Dji.js} +1 -1
- package/web/app/immutable/chunks/{A34-FDia.js → BK2lpqz4.js} +1 -1
- package/web/app/immutable/chunks/{BC2xxkKo.js → BK64B_Ic.js} +7 -7
- package/web/app/immutable/chunks/{8XhHIJcn.js → BKw5KoGy.js} +1 -1
- package/web/app/immutable/chunks/{1MWULgfl.js → BLaIjbEF.js} +1 -1
- package/web/app/immutable/chunks/{BkbQGifa.js → BLl22NdQ.js} +1 -1
- package/web/app/immutable/chunks/{ByTOmivs.js → BM7oCSp5.js} +1 -1
- package/web/app/immutable/chunks/{C8BVjzNA.js → BMKkyPLo.js} +1 -1
- package/web/app/immutable/chunks/BO8NImWp.js +1 -0
- package/web/app/immutable/chunks/BOxkenyY.js +1 -0
- package/web/app/immutable/chunks/{CW_fORnH.js → BOyF7pe9.js} +1 -1
- package/web/app/immutable/chunks/BQ5F0iVp.js +1 -0
- package/web/app/immutable/chunks/BQbcEQz0.js +1 -0
- package/web/app/immutable/chunks/{DW36BCXj.js → BTNEDHav.js} +1 -1
- package/web/app/immutable/chunks/{zN8eBYty.js → BVURea8L.js} +1 -1
- package/web/app/immutable/chunks/{C6WI65lc.js → BW9EApvt.js} +10 -10
- package/web/app/immutable/chunks/BWAGtvpD.js +1 -0
- package/web/app/immutable/chunks/BWTugGQ8.js +1 -0
- package/web/app/immutable/chunks/{D_2_kcuU.js → BWZmCaEW.js} +1 -1
- package/web/app/immutable/chunks/{Bj3n1RUK.js → BY3nRRgO.js} +3 -3
- package/web/app/immutable/chunks/{DZxSFexp.js → BYDvuR-h.js} +1 -1
- package/web/app/immutable/chunks/{CaGwo1Kh.js → BZYeogxf.js} +1 -1
- package/web/app/immutable/chunks/{RvvsGyv8.js → Ba1C4iSG.js} +1 -1
- package/web/app/immutable/chunks/{DSf8k2cE.js → BaYeKXL3.js} +1 -1
- package/web/app/immutable/chunks/{BZLRqiW7.js → BaYzTmbw.js} +1 -1
- package/web/app/immutable/chunks/Bbkml6DP.js +1 -0
- package/web/app/immutable/chunks/{9HNwwiNt.js → BcbQZUsh.js} +1 -1
- package/web/app/immutable/chunks/BcgSXbtK.js +1 -0
- package/web/app/immutable/chunks/{DLJVFWjT.js → BeJ5WWx4.js} +22 -22
- package/web/app/immutable/chunks/{A0r9TbR7.js → BfbZn9QX.js} +1 -1
- package/web/app/immutable/chunks/BgKhYgm8.js +1 -0
- package/web/app/immutable/chunks/Bgi2L8Br.js +1 -0
- package/web/app/immutable/chunks/Bgw3O9rE.js +1 -0
- package/web/app/immutable/chunks/Big_dnEI.js +1 -0
- package/web/app/immutable/chunks/{D6yqDOhs.js → BjURBDIt.js} +5 -5
- package/web/app/immutable/chunks/{CJ58g2zu.js → BlEwAz4v.js} +1 -1
- package/web/app/immutable/chunks/{BUGXi07N.js → BmEcZoA2.js} +1 -1
- package/web/app/immutable/chunks/{Bb-m1QhD.js → BnkmaA34.js} +1 -1
- package/web/app/immutable/chunks/BpYNQf9o.js +1 -0
- package/web/app/immutable/chunks/{m3ndyWcI.js → BqBqZaGQ.js} +1 -1
- package/web/app/immutable/chunks/{D419Hgek.js → BqyYlCY3.js} +1 -1
- package/web/app/immutable/chunks/BrIsEZwT.js +1 -0
- package/web/app/immutable/chunks/Brqq8vhd.js +6 -0
- package/web/app/immutable/chunks/{Dx41gQiN.js → Bxnf75xq.js} +1 -1
- package/web/app/immutable/chunks/ByLCbaqp.js +1 -0
- package/web/app/immutable/chunks/{xOJeCqJf.js → C-OtpXcF.js} +1 -1
- package/web/app/immutable/chunks/{B7w_8Qom.js → C1CDOGnh.js} +2 -2
- package/web/app/immutable/chunks/C1osWUn_.js +1 -0
- package/web/app/immutable/chunks/{BI7MYBTt.js → C33Dw59E.js} +1 -1
- package/web/app/immutable/chunks/{BMm9sGZ6.js → C3NeTp2u.js} +1 -1
- package/web/app/immutable/chunks/{DdSX2jjJ.js → C3VPe7p1.js} +1 -1
- package/web/app/immutable/chunks/{BYMNRS4c.js → C3oF1SK5.js} +1 -1
- package/web/app/immutable/chunks/{CW13jkE8.js → C4HHXGmJ.js} +1 -1
- package/web/app/immutable/chunks/{ByCIOkhM.js → C59or46M.js} +1 -1
- package/web/app/immutable/chunks/{CL2hu5s-.js → C5SissXF.js} +1 -1
- package/web/app/immutable/chunks/{C-ZPZDJB.js → C8XrM-qb.js} +1 -1
- package/web/app/immutable/chunks/CA6TS0WC.js +1 -0
- package/web/app/immutable/chunks/CAUaU8Wh.js +1 -0
- package/web/app/immutable/chunks/CAdgzoaK.js +1 -0
- package/web/app/immutable/chunks/{BrRRz1w6.js → CCm1BgPl.js} +1 -1
- package/web/app/immutable/chunks/CDbQwqu1.js +1 -0
- package/web/app/immutable/chunks/CEsW1euQ.js +1 -0
- package/web/app/immutable/chunks/{CYEd8dKU.js → CFs6uWH2.js} +1 -1
- package/web/app/immutable/chunks/{D6YDmdhV.js → CGcQAX9W.js} +1 -1
- package/web/app/immutable/chunks/{CVYjvOCP.js → CHfmHJ17.js} +1 -1
- package/web/app/immutable/chunks/{DwKUz42C.js → CJ_dtcmM.js} +1 -1
- package/web/app/immutable/chunks/{DqvXXMrh.js → CNT1n9YR.js} +1 -1
- package/web/app/immutable/chunks/CP8WYBBE.js +1 -0
- package/web/app/immutable/chunks/{DtKh4Q6Q.js → CQB76zlc.js} +1 -1
- package/web/app/immutable/chunks/{DpMTpLDQ.js → CQbtnalz.js} +1 -1
- package/web/app/immutable/chunks/{CNIUwMPp.js → CQyjMIYw.js} +1 -1
- package/web/app/immutable/chunks/CSQXURhP.js +1 -0
- package/web/app/immutable/chunks/{DnpnDt-B.js → CSg3z6A2.js} +1 -1
- package/web/app/immutable/chunks/{m18NZZRr.js → CVa6MqnK.js} +1 -1
- package/web/app/immutable/chunks/{DInreQbI.js → CXVUfxHv.js} +2 -2
- package/web/app/immutable/chunks/{C0p8rhDn.js → CXpFRnSj.js} +1 -1
- package/web/app/immutable/chunks/C_EpV6jU.js +2 -0
- package/web/app/immutable/chunks/Cb0zVN4i.js +1 -0
- package/web/app/immutable/chunks/{BP7CI4Qx.js → CbZEAbX5.js} +1 -1
- package/web/app/immutable/chunks/{BqQiAH0O.js → CcaAQlGA.js} +1 -1
- package/web/app/immutable/chunks/CgLoJgPR.js +1 -0
- package/web/app/immutable/chunks/{B4ilKCwe.js → CguBowm8.js} +1 -1
- package/web/app/immutable/chunks/{Ds3Wirif.js → ChNPgGKQ.js} +1 -1
- package/web/app/immutable/chunks/{B203wRvP.js → Chpqmkx4.js} +1 -1
- package/web/app/immutable/chunks/{DbK3CxeL.js → CiIELmgj.js} +1 -1
- package/web/app/immutable/chunks/CiKocWhX.js +1 -0
- package/web/app/immutable/chunks/{BYtSPAAW.js → CjbCpI18.js} +1 -1
- package/web/app/immutable/chunks/{BvZrnx87.js → Ckp5dOHW.js} +1 -1
- package/web/app/immutable/chunks/{BfZCAeqU.js → ClMg3ew2.js} +1 -1
- package/web/app/immutable/chunks/{A8JjhnEv.js → Clhk_Z-l.js} +1 -1
- package/web/app/immutable/chunks/{CXNfY5OA.js → CmoBwSCp.js} +1 -1
- package/web/app/immutable/chunks/{B5tGFpkq.js → CpHzYkzi.js} +1 -1
- package/web/app/immutable/chunks/{p3fN-Vr3.js → Cq2aackv.js} +1 -1
- package/web/app/immutable/chunks/Cq8oeEXe.js +1 -0
- package/web/app/immutable/chunks/CrHk5l6X.js +1 -0
- package/web/app/immutable/chunks/{BUdcKH65.js → CrjpdU4V.js} +1 -1
- package/web/app/immutable/chunks/CswFIiBb.js +1 -0
- package/web/app/immutable/chunks/{BA3fud46.js → CtDj7gZD.js} +1 -1
- package/web/app/immutable/chunks/{CaXjFtDt.js → CvGEpOsC.js} +1 -1
- package/web/app/immutable/chunks/CvHwMug-.js +2 -0
- package/web/app/immutable/chunks/{CaxyE6o_.js → Cx31i8ng.js} +1 -1
- package/web/app/immutable/chunks/CzcD2H5U.js +2 -0
- package/web/app/immutable/chunks/CzdMU9Bu.js +2 -0
- package/web/app/immutable/chunks/{CKzqOQI8.js → D-TVq_rK.js} +1 -1
- package/web/app/immutable/chunks/{ChY17Glq.js → D-i7C44m.js} +2 -2
- package/web/app/immutable/chunks/{DDfvytcD.js → D0I9E6A0.js} +1 -1
- package/web/app/immutable/chunks/{DYk0s6f0.js → D1CYDv8t.js} +1 -1
- package/web/app/immutable/chunks/{BuTNFoR8.js → D31IcU1_.js} +1 -1
- package/web/app/immutable/chunks/{DDMEgpvU.js → D3toWTag.js} +8 -8
- package/web/app/immutable/chunks/{Bywuf0q4.js → D492HRYt.js} +1 -1
- package/web/app/immutable/chunks/{BkNc2eFX.js → D7NdkRF-.js} +4 -4
- package/web/app/immutable/chunks/{GETqdV-9.js → D7dPbXji.js} +1 -1
- package/web/app/immutable/chunks/D9jYN6_J.js +1 -0
- package/web/app/immutable/chunks/{n58mTCVv.js → D9jvlcNy.js} +1 -1
- package/web/app/immutable/chunks/{BabPi6C5.js → DByMRbHr.js} +1 -1
- package/web/app/immutable/chunks/{aETzmnsD.js → DDySjsub.js} +1 -1
- package/web/app/immutable/chunks/{B9Hetctu.js → DE8QOEZV.js} +1 -1
- package/web/app/immutable/chunks/{DCDhq2rq.js → DF1uIj8u.js} +1 -1
- package/web/app/immutable/chunks/{BYFJ74nm.js → DFs6FJS8.js} +1 -1
- package/web/app/immutable/chunks/{CgW9XFcu.js → DGmRhalF.js} +1 -1
- package/web/app/immutable/chunks/DH-29Rs_.js +11 -0
- package/web/app/immutable/chunks/{B3kzQQLK.js → DHGSAfCZ.js} +1 -1
- package/web/app/immutable/chunks/DHROL4K5.js +1 -0
- package/web/app/immutable/chunks/DKKFIb2l.js +1 -0
- package/web/app/immutable/chunks/DKTqwHrN.js +1 -0
- package/web/app/immutable/chunks/DMYKSC8W.js +2 -0
- package/web/app/immutable/chunks/{-7ARPWgR.js → DMjNjha0.js} +1 -1
- package/web/app/immutable/chunks/{C1nHAGLu.js → DNWBkvFP.js} +1 -1
- package/web/app/immutable/chunks/DNjgs7AU.js +1 -0
- package/web/app/immutable/chunks/{DkQ7I_3J.js → DOB2ATTF.js} +5 -5
- package/web/app/immutable/chunks/{BTWq1_ry.js → DOCWMdWU.js} +1 -1
- package/web/app/immutable/chunks/{Bc6DihnT.js → DOKxXiSI.js} +18 -18
- package/web/app/immutable/chunks/DOPeTAKk.js +13 -0
- package/web/app/immutable/chunks/{PrJr0a2j.js → DPUWJyjX.js} +1 -1
- package/web/app/immutable/chunks/{_xNtAuSN.js → DQlH_Wce.js} +1 -1
- package/web/app/immutable/chunks/{BIEvH8pu.js → DRZKWEq3.js} +1 -1
- package/web/app/immutable/chunks/DTSEdINd.js +2 -0
- package/web/app/immutable/chunks/{j5aoAM0N.js → DUQV_xq3.js} +1 -1
- package/web/app/immutable/chunks/{Dsmvkh8d.js → DW9MEQey.js} +1 -1
- package/web/app/immutable/chunks/{BL8tUtYB.js → DXnd4CJZ.js} +1 -1
- package/web/app/immutable/chunks/DYnCJwSs.js +1 -0
- package/web/app/immutable/chunks/DZ3SUe8R.js +1 -0
- package/web/app/immutable/chunks/{BmP1Wws6.js → DZyAzxxC.js} +1 -1
- package/web/app/immutable/chunks/D_SZXZdx.js +1 -0
- package/web/app/immutable/chunks/{BhMsVKL2.js → DcZKw8cP.js} +2 -2
- package/web/app/immutable/chunks/{B9x-giji.js → DccrGg38.js} +22 -22
- package/web/app/immutable/chunks/DcwC09tE.js +1 -0
- package/web/app/immutable/chunks/{Bvc8qRhk.js → DdVIXVso.js} +1 -1
- package/web/app/immutable/chunks/DeCAcSD9.js +19 -0
- package/web/app/immutable/chunks/DfjJilaB.js +2 -0
- package/web/app/immutable/chunks/{XzMpMF29.js → DgHZa_R5.js} +1 -1
- package/web/app/immutable/chunks/{ZI2UcNVx.js → DgwMMJRI.js} +1 -1
- package/web/app/immutable/chunks/{CVoXekIe.js → DhHSeQsG.js} +3 -3
- package/web/app/immutable/chunks/{CG3imlyr.js → Dj8J0eqI.js} +1 -1
- package/web/app/immutable/chunks/DjdPlKc4.js +2 -0
- package/web/app/immutable/chunks/{finAdq6c.js → DknPpgEW.js} +1 -1
- package/web/app/immutable/chunks/Dkr_RXdV.js +1 -0
- package/web/app/immutable/chunks/Dkva_evl.js +11 -0
- package/web/app/immutable/chunks/{7teYU7wH.js → Do80Vc58.js} +1 -1
- package/web/app/immutable/chunks/{X8W_BfF4.js → Dr45ln4z.js} +1 -1
- package/web/app/immutable/chunks/DryyHkNv.js +1 -0
- package/web/app/immutable/chunks/{BdkEw9JP.js → DtAyUyC0.js} +1 -1
- package/web/app/immutable/chunks/Dto-4yb7.js +1 -0
- package/web/app/immutable/chunks/{CSdIXJpO.js → DukmxKgk.js} +1 -1
- package/web/app/immutable/chunks/{BwSA3fCS.js → DwA_Z_f6.js} +1 -1
- package/web/app/immutable/chunks/{Drt5qRI8.js → Dx3sZmi8.js} +1 -1
- package/web/app/immutable/chunks/{CcXuSxXv.js → DxBGs1BP.js} +1 -1
- package/web/app/immutable/chunks/{CeswpNyE.js → DzGNgfrZ.js} +1 -1
- package/web/app/immutable/chunks/DzKYjnRy.js +2 -0
- package/web/app/immutable/chunks/{HvBMlLJP.js → DzejiLWr.js} +3 -3
- package/web/app/immutable/chunks/{CBqGKeYg.js → G_wYaln-.js} +1 -1
- package/web/app/immutable/chunks/GzTl4Sb0.js +1 -0
- package/web/app/immutable/chunks/IRbjhecv.js +8 -0
- package/web/app/immutable/chunks/OPvMR-5p.js +1 -0
- package/web/app/immutable/chunks/{gURPJ1oX.js → SVZRr24P.js} +1 -1
- package/web/app/immutable/chunks/{DYmPPjiq.js → T9tywf_e.js} +1 -1
- package/web/app/immutable/chunks/TL85KYB9.js +1 -0
- package/web/app/immutable/chunks/{BgX4ALX_.js → U6cHmbYS.js} +3 -3
- package/web/app/immutable/chunks/{DLqztIqC.js → V9qci_dz.js} +1 -1
- package/web/app/immutable/chunks/{CpLvDQcH.js → W7sv3DY6.js} +1 -1
- package/web/app/immutable/chunks/{CrfXhNNb.js → WbTmlouE.js} +1 -1
- package/web/app/immutable/chunks/{BAxqzRwc.js → Y4VeEPHl.js} +1 -1
- package/web/app/immutable/chunks/{BVviSubD.js → YYacqJ9a.js} +1 -1
- package/web/app/immutable/chunks/{BdCclrfD.js → Zl17pAXX.js} +1 -1
- package/web/app/immutable/chunks/{BVt_T8ao.js → aQy6qVNs.js} +1 -1
- package/web/app/immutable/chunks/{C3SYquhf.js → ahX1JzRb.js} +1 -1
- package/web/app/immutable/chunks/{B0biUQQF.js → asQ_ruFQ.js} +1 -1
- package/web/app/immutable/chunks/{BGX6W-wu.js → bKyElw3h.js} +1 -1
- package/web/app/immutable/chunks/cATI0wnI.js +1 -0
- package/web/app/immutable/chunks/ciTxbtqU.js +1 -0
- package/web/app/immutable/chunks/d-Ep-sfP.js +1 -0
- package/web/app/immutable/chunks/dBZS3-kp.js +3 -0
- package/web/app/immutable/chunks/{Bk2z5Cd0.js → eNHX5lds.js} +1 -1
- package/web/app/immutable/chunks/etVaBLxV.js +6 -0
- package/web/app/immutable/chunks/euZ22sAu.js +1 -0
- package/web/app/immutable/chunks/{COrK0goa.js → ftma9Ybn.js} +1 -1
- package/web/app/immutable/chunks/fzs92dqr.js +1 -0
- package/web/app/immutable/chunks/i2sZiDEq.js +1 -0
- package/web/app/immutable/chunks/iKgBWWl-.js +2 -0
- package/web/app/immutable/chunks/{BXTuZcZW.js → jlJQSpH6.js} +1 -1
- package/web/app/immutable/chunks/{t_3vjEsA.js → ouMKS3MA.js} +1 -1
- package/web/app/immutable/chunks/{DpsFFL7J.js → s0TWEExr.js} +1 -1
- package/web/app/immutable/chunks/{XIXbmV8F.js → txy0Txom.js} +1 -1
- package/web/app/immutable/chunks/{CYf2hryc.js → wTgWcOy1.js} +1 -1
- package/web/app/immutable/chunks/{BIlaJXMS.js → z-RLr2Z1.js} +1 -1
- package/web/app/immutable/chunks/zGl9gaL0.js +1 -0
- package/web/app/immutable/chunks/{DXCE75Ih.js → z_Tdw9N5.js} +1 -1
- package/web/app/immutable/entry/app.BXnRxWvG.js +4 -0
- package/web/app/immutable/entry/start.BX3EKd8C.js +1 -0
- package/web/app/immutable/nodes/0.CFk1FXLg.js +1 -0
- package/web/app/immutable/nodes/1.Bd67D1tA.js +1 -0
- package/web/app/immutable/nodes/10.CTZ0L3wZ.js +41 -0
- package/web/app/immutable/nodes/11.CH_h0WbH.js +1 -0
- package/web/app/immutable/nodes/12.DhihsAtw.js +1 -0
- package/web/app/immutable/nodes/{13.CscEwLVK.js → 13.B727xJXs.js} +5 -5
- package/web/app/immutable/nodes/14.CgITgBOZ.js +3 -0
- package/web/app/immutable/nodes/15.CCzIPJGf.js +1 -0
- package/web/app/immutable/nodes/{16.Cfgb0nOQ.js → 16.CbtJfPHZ.js} +2 -2
- package/web/app/immutable/nodes/17.CelzCwXF.js +1 -0
- package/web/app/immutable/nodes/{17.yV85i6g8.js → 18.fqvApY-g.js} +2 -2
- package/web/app/immutable/nodes/2.t-1b60vK.js +13 -0
- package/web/app/immutable/nodes/3.4L0YPvZL.js +2 -0
- package/web/app/immutable/nodes/4.BLQgcpcU.js +1 -0
- package/web/app/immutable/nodes/5.Bp_OiOTI.js +5 -0
- package/web/app/immutable/nodes/6.CcuwCBp4.js +1 -0
- package/web/app/immutable/nodes/7.B-TRUT7o.js +1 -0
- package/web/app/immutable/nodes/{8.omc6d3jg.js → 8.CaG5gby5.js} +9 -9
- package/web/app/immutable/nodes/{9._4FUjrca.js → 9.DosMxTmg.js} +17 -17
- package/web/app/version.json +1 -1
- package/web/index.html +28 -21
- package/web/app/immutable/chunks/-6JGlnE4.js +0 -1
- package/web/app/immutable/chunks/-SwunqO3.js +0 -1
- package/web/app/immutable/chunks/2xvAjJNs.js +0 -1
- package/web/app/immutable/chunks/5MLUIYhU.js +0 -1
- package/web/app/immutable/chunks/B3lXnLB8.js +0 -2
- package/web/app/immutable/chunks/BBL1FO1t.js +0 -1
- package/web/app/immutable/chunks/BCASO_bV.js +0 -1
- package/web/app/immutable/chunks/BF-IM3Qf.js +0 -1
- package/web/app/immutable/chunks/BKYCO_49.js +0 -4
- package/web/app/immutable/chunks/BMMoYJAn.js +0 -1
- package/web/app/immutable/chunks/BP5uyQTv.js +0 -18
- package/web/app/immutable/chunks/BVPvh88-.js +0 -1
- package/web/app/immutable/chunks/BX3QD7rd.js +0 -1
- package/web/app/immutable/chunks/BXeiKdwz.js +0 -1
- package/web/app/immutable/chunks/BYU1cTbO.js +0 -2
- package/web/app/immutable/chunks/BZcpShp8.js +0 -9
- package/web/app/immutable/chunks/BbNk8c_P.js +0 -1
- package/web/app/immutable/chunks/Bba6So1V.js +0 -1
- package/web/app/immutable/chunks/Bc5_gcpq.js +0 -1
- package/web/app/immutable/chunks/BdD2ADMz.js +0 -1
- package/web/app/immutable/chunks/BlZYlbA9.js +0 -1
- package/web/app/immutable/chunks/BoCZH6mk.js +0 -1
- package/web/app/immutable/chunks/Bs26_0Q5.js +0 -2
- package/web/app/immutable/chunks/ByuX26Ym.js +0 -6
- package/web/app/immutable/chunks/C-MmtmWQ.js +0 -1
- package/web/app/immutable/chunks/C52Qm4vO.js +0 -1
- package/web/app/immutable/chunks/C5AlgdZ0.js +0 -1
- package/web/app/immutable/chunks/C8AARFCw.js +0 -2
- package/web/app/immutable/chunks/CAOA5kev.js +0 -2
- package/web/app/immutable/chunks/CEQZVenN.js +0 -6
- package/web/app/immutable/chunks/CN-2rfdx.js +0 -1
- package/web/app/immutable/chunks/CRQGIXhv.js +0 -1
- package/web/app/immutable/chunks/CWT4x6lB.js +0 -2
- package/web/app/immutable/chunks/CbCgON3R.js +0 -1
- package/web/app/immutable/chunks/CeT1zT46.js +0 -1
- package/web/app/immutable/chunks/Cfj3Lc6y.js +0 -1
- package/web/app/immutable/chunks/Cjpu4SJA.js +0 -1
- package/web/app/immutable/chunks/Ck9ZyE1n.js +0 -2
- package/web/app/immutable/chunks/CkSjvO0_.js +0 -1
- package/web/app/immutable/chunks/CoLl8pQb.js +0 -1
- package/web/app/immutable/chunks/CpadbTI2.js +0 -408
- package/web/app/immutable/chunks/CsxVJm8Y.js +0 -1
- package/web/app/immutable/chunks/CteSc0c_.js +0 -1
- package/web/app/immutable/chunks/CuhrgDBI.js +0 -1
- package/web/app/immutable/chunks/CvWyDJGm.js +0 -1
- package/web/app/immutable/chunks/CzVyzyWv.js +0 -2
- package/web/app/immutable/chunks/D6Wx8h-l.js +0 -11
- package/web/app/immutable/chunks/D8Ohjkn4.js +0 -3
- package/web/app/immutable/chunks/DATvyyct.js +0 -1
- package/web/app/immutable/chunks/DAoagkbK.js +0 -2
- package/web/app/immutable/chunks/DEjP-x_s.js +0 -1
- package/web/app/immutable/chunks/DFF9daPQ.js +0 -13
- package/web/app/immutable/chunks/DIP3ex32.js +0 -1
- package/web/app/immutable/chunks/DPDCu-py.js +0 -1
- package/web/app/immutable/chunks/DPR3VaPZ.js +0 -2
- package/web/app/immutable/chunks/DTQYcznv.js +0 -1
- package/web/app/immutable/chunks/DU8kuP6M.js +0 -1
- package/web/app/immutable/chunks/DZmwTozc.js +0 -1
- package/web/app/immutable/chunks/Dc64E_SR.js +0 -1
- package/web/app/immutable/chunks/Ddw98WmY.js +0 -8
- package/web/app/immutable/chunks/De4z9gHo.js +0 -1
- package/web/app/immutable/chunks/Dk6iNNLu.js +0 -1
- package/web/app/immutable/chunks/DlHB0ULA.js +0 -2
- package/web/app/immutable/chunks/DpHl7r8K.js +0 -1
- package/web/app/immutable/chunks/Dq3RHtWu.js +0 -1
- package/web/app/immutable/chunks/Dq3leYTy.js +0 -19
- package/web/app/immutable/chunks/Dq6CuXZE.js +0 -1
- package/web/app/immutable/chunks/DqJ-M21G.js +0 -1
- package/web/app/immutable/chunks/Dwyq6WEC.js +0 -1
- package/web/app/immutable/chunks/DxNbgJ8X.js +0 -2
- package/web/app/immutable/chunks/DzHHkfB1.js +0 -1
- package/web/app/immutable/chunks/EbDWf2Y-.js +0 -1
- package/web/app/immutable/chunks/Ek5W6pp5.js +0 -1
- package/web/app/immutable/chunks/H60Tbroe.js +0 -1
- package/web/app/immutable/chunks/JzAjTSJP.js +0 -1
- package/web/app/immutable/chunks/PPmweWGv.js +0 -2
- package/web/app/immutable/chunks/UYKGMt9K.js +0 -1
- package/web/app/immutable/chunks/X_y6HQmR.js +0 -1
- package/web/app/immutable/chunks/YNoNxkXn.js +0 -4
- package/web/app/immutable/entry/app.Ci0fqF_i.js +0 -4
- package/web/app/immutable/entry/start.DzDtsQrC.js +0 -1
- package/web/app/immutable/nodes/0.BJcKF537.js +0 -1
- package/web/app/immutable/nodes/1.Dj_1C4wl.js +0 -1
- package/web/app/immutable/nodes/10.DTBkzFBQ.js +0 -41
- package/web/app/immutable/nodes/11.C9N9_Xb9.js +0 -1
- package/web/app/immutable/nodes/12.CqRfopX4.js +0 -1
- package/web/app/immutable/nodes/14.BDOAvRMB.js +0 -3
- package/web/app/immutable/nodes/15.BWtoiI44.js +0 -1
- package/web/app/immutable/nodes/2.B_fHdNW9.js +0 -13
- package/web/app/immutable/nodes/3.CzW2JK5A.js +0 -2
- package/web/app/immutable/nodes/4.DP65YvXF.js +0 -1
- package/web/app/immutable/nodes/5.ivE-5gZP.js +0 -5
- package/web/app/immutable/nodes/6.58wOdki0.js +0 -1
- package/web/app/immutable/nodes/7.9Khb1Buc.js +0 -1
- /package/web/app/immutable/assets/{17.Cznk2DRv.css → 18.Cznk2DRv.css} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var vo=Object.defineProperty;var bo=(e,t,i)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var v=(e,t,i)=>bo(e,typeof t!="symbol"?t+"":t,i);import{t as ir,
|
|
1
|
+
var vo=Object.defineProperty;var bo=(e,t,i)=>t in e?vo(e,t,{enumerable:!0,configurable:!0,writable:!0,value:i}):e[t]=i;var v=(e,t,i)=>bo(e,typeof t!="symbol"?t+"":t,i);import{t as ir,bq as M,by as nr,b as rr,bu as dn,bs as So,bo as $e}from"./D9jYN6_J.js";import{bs as or,a5 as De,ay as hn,bS as Xe,aD as C,bA as ke,b_ as Me,bO as rt,W as le,bl as Xt,be as Hi,bn as sr,c9 as ne,aA as I,b$ as ar,aB as ge,ai as yo,bV as Te,br as Co,ca as je,bH as Y,c5 as dt,bk as xo,bj as Lo,aj as wo,c0 as fn}from"./DYhIMPy1.js";import{i as we}from"./7eL9Pgig.js";import{f as un,g as pi,s as cn}from"./C_EpV6jU.js";import{b as ko}from"./p7znhYIU.js";import{b as pn}from"./BaIAhI85.js";import{h as Eo,c as Ye,w as lr,N as O,O as Jt,b2 as Qe,a as dr,j as hr,P as Je,H as fr,i as ur,ab as cr,U as Ro,f as Ao,e as pr,T as Ho,g as To,S as Do,a4 as Ze,a3 as Ve,C as Mo,G as gr,F as Io,I as Fo,A as At,ah as No,$ as Ht,ad as Tt,v as St,a1 as Ti,s as J,r as Ue,an as wt,D as Po,d as zo,aa as mr,b as gn,u as mn,aI as Uo,ap as ct,ac as _o,K as Le,M as Ut,L as Oo,a0 as Dt,E as Bo,al as vr,a6 as Vo,a2 as vn,t as br,af as ft,a5 as kt,ae as ot,ag as Sr,B as gi,a9 as mi,k as Wo,aH as bn}from"./DhHSeQsG.js";import{g as Go,i as $o}from"./Bgw3O9rE.js";import{F as vi,c4 as jo,be as qo,at as Ko,as as Xo}from"./CAUaU8Wh.js";import{f as Di}from"./0qEvU7Aj.js";import"./Dkva_evl.js";import{g as Yo}from"./DRZKWEq3.js";import{c as Qo}from"./CQbtnalz.js";import{P as Jo}from"./B79pUPc3.js";import{t as Sn}from"./B4gIvcP2.js";class Zo extends Eo{constructor(){super(...arguments),this.tokenize=ts}equals(t,i,n){return n.ignoreWhitespace?((!n.newlineIsToken||!t.includes(`
|
|
2
2
|
`))&&(t=t.trim()),(!n.newlineIsToken||!i.includes(`
|
|
3
3
|
`))&&(i=i.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(t.endsWith(`
|
|
4
4
|
`)&&(t=t.slice(0,-1)),i.endsWith(`
|
|
@@ -7,7 +7,7 @@ var vo=Object.defineProperty;var bo=(e,t,i)=>t in e?vo(e,t,{enumerable:!0,config
|
|
|
7
7
|
`)?y.lines[x]=y.lines[x].slice(0,-1):(y.lines.splice(x+1,0,"\"),x++);return{oldFileName:e,newFileName:t,oldHeader:r,newHeader:o,hunks:p}}}function Mi(e,t){var i,n,r,o,s,l;if(t||(t=Cn),Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(d=>d.isGit))throw new Error("Cannot omit file headers on a multi-file patch. (The result would be unparseable; how would a tool trying to apply the patch know which changes are to which file?)");return e.map(d=>Mi(d,t)).join(`
|
|
8
8
|
`)}const a=[];if(e.isGit){if(t=Cn,!e.oldFileName)throw new Error("oldFileName must be specified for Git patches");if(!e.newFileName)throw new Error("newFileName must be specified for Git patches");let d=e.oldFileName,f=e.newFileName;e.isCreate&&d==="/dev/null"?d=f.replace(/^b\//,"a/"):e.isDelete&&f==="/dev/null"&&(f=d.replace(/^a\//,"b/")),a.push("diff --git "+qe(d)+" "+qe(f)),e.isDelete&&a.push("deleted file mode "+((i=e.oldMode)!==null&&i!==void 0?i:"100644")),e.isCreate&&a.push("new file mode "+((n=e.newMode)!==null&&n!==void 0?n:"100644")),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(a.push("old mode "+e.oldMode),a.push("new mode "+e.newMode)),e.isRename&&(a.push("rename from "+qe(((r=e.oldFileName)!==null&&r!==void 0?r:"").replace(/^a\//,""))),a.push("rename to "+qe(((o=e.newFileName)!==null&&o!==void 0?o:"").replace(/^b\//,"")))),e.isCopy&&(a.push("copy from "+qe(((s=e.oldFileName)!==null&&s!==void 0?s:"").replace(/^a\//,""))),a.push("copy to "+qe(((l=e.newFileName)!==null&&l!==void 0?l:"").replace(/^b\//,""))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&a.push("Index: "+e.oldFileName),t.includeUnderline&&a.push("===================================================================");const h=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||h)&&(a.push("--- "+qe(e.oldFileName)+(e.oldHeader?" "+e.oldHeader:"")),a.push("+++ "+qe(e.newFileName)+(e.newHeader?" "+e.newHeader:"")));for(let d=0;d<e.hunks.length;d++){const f=e.hunks[d],p=f.oldLines===0?f.oldStart-1:f.oldStart,c=f.newLines===0?f.newStart-1:f.newStart;a.push("@@ -"+p+","+f.oldLines+" +"+c+","+f.newLines+" @@");for(const m of f.lines)a.push(m)}return a.join(`
|
|
9
9
|
`)+`
|
|
10
|
-
`}function yr(e,t,i,n,r,o,s){if(typeof s=="function"&&(s={callback:s}),s?.callback){const{callback:l}=s;xn(e,t,i,n,r,o,Object.assign(Object.assign({},s),{callback:a=>{l(a?Mi(a,s.headerOptions):void 0)}}))}else{const l=xn(e,t,i,n,r,o,s);return l?Mi(l,s?.headerOptions):void 0}}function
|
|
10
|
+
`}function yr(e,t,i,n,r,o,s){if(typeof s=="function"&&(s={callback:s}),s?.callback){const{callback:l}=s;xn(e,t,i,n,r,o,Object.assign(Object.assign({},s),{callback:a=>{l(a?Mi(a,s.headerOptions):void 0)}}))}else{const l=xn(e,t,i,n,r,o,s);return l?Mi(l,s?.headerOptions):void 0}}function Hd(e,t,i,n,r,o){return yr(e,e,t,i,n,r,o)}function ns(e){const t=e.endsWith(`
|
|
11
11
|
`),i=e.split(`
|
|
12
12
|
`).map(n=>n+`
|
|
13
13
|
`);return t?i.pop():i.push(i.pop().slice(0,-1)),i}const pt=new Set;let gt=null;function Cr(e){pt.add(e),gt??=requestAnimationFrame(xr)}function Ii(e){pt.delete(e)&&pt.size===0&>!=null&&(cancelAnimationFrame(gt),gt=null)}function xr(e){const t=new Set(pt);pt.clear();for(const i of t)try{i(e)}catch(n){console.error(n)}pt.size>0?gt=requestAnimationFrame(xr):gt=null}function Fi(e,t,i){if(e===t||e==null||t==null)return e===t;const n=new Set(i),r=Object.keys(e),o=new Set(Object.keys(t));for(const s of r)if(o.delete(s),!n.has(s)&&(!(s in t)||e[s]!==t[s]))return!1;for(const s of Array.from(o))if(!n.has(s))return!1;return!0}function rs(e,t){const i=e?.theme??Ye,n=t?.theme??Ye,r=Ln(e),o=Ln(t);return lr(i,n)&&Fi(e,t,["theme","parseDiffOptions"])&&Fi(r,o)}function Ln(e){if(e!=null&&"parseDiffOptions"in e)return e.parseDiffOptions}function Ni(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function os(){return O({tagName:"button",properties:{"data-utility-button":"",type:"button"},children:[Jt({name:"diffs-icon-plus",properties:{"data-icon":""}})]})}function ss(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function _t(e){for(const t of e)if(t instanceof HTMLElement&&(t.hasAttribute("data-utility-button")||t.hasAttribute("data-gutter-utility-slot")||t.getAttribute("slot")==="gutter-utility-slot"||t.getAttribute("name")==="gutter-utility-slot"))return!0;return!1}var as=class{constructor(e,t){v(this,"mode");v(this,"options");v(this,"hoveredLine");v(this,"hoveredToken");v(this,"pre");v(this,"gutterUtilityLine");v(this,"gutterUtilityContainer");v(this,"gutterUtilityButton");v(this,"gutterUtilitySlot");v(this,"interactiveLinesAttr",!1);v(this,"interactiveLineNumbersAttr",!1);v(this,"hasPointerListeners",!1);v(this,"hasDocumentPointerListeners",!1);v(this,"selectedRange",null);v(this,"selectedRangeHighlightSide");v(this,"selectedRangeLineNumberOnly",!1);v(this,"editorActiveLine",null);v(this,"editorActiveLineSide");v(this,"editorLineNumberOnly",!1);v(this,"proposedSelectedRange");v(this,"renderedSelectedLinesState");v(this,"renderedEditorActiveLineState");v(this,"selectionAnchor");v(this,"pointerSession",{mode:"idle"});v(this,"getHoveredLine",()=>{const e=this.gutterUtilityLine??this.hoveredLine;if(e!=null){if(this.mode==="diff"&&e.type==="diff-line")return{lineNumber:e.lineNumber,side:e.annotationSide};if(this.mode==="file"&&e.type==="line")return{lineNumber:e.lineNumber}}});v(this,"handlePointerClick",e=>{const{onHunkExpand:t,onLineClick:i,onLineNumberClick:n,onTokenClick:r,onMergeConflictActionClick:o}=this.options;t==null&&i==null&&n==null&&o==null&&r==null||this.options.onGutterUtilityClick!=null&&_t(e.composedPath())||(_e(this.options.__debugPointerEvents,"click","FileDiff.DEBUG.handlePointerClick:",e),this.handlePointerEvent({eventType:"click",event:e}))});v(this,"handlePointerMove",e=>{if(e.pointerType!=="mouse")return;const{lineHoverHighlight:t="disabled",onLineEnter:i,onLineLeave:n,onTokenEnter:r,onTokenLeave:o,enableGutterUtility:s=!1}=this.options;t==="disabled"&&!s&&i==null&&n==null&&r==null&&o==null||(_e(this.options.__debugPointerEvents,"move","FileDiff.DEBUG.handlePointerMove:",e),this.handlePointerEvent({eventType:"move",event:e}))});v(this,"handlePointerLeave",e=>{const{__debugPointerEvents:t}=this.options;if(_e(t,"move","FileDiff.DEBUG.handlePointerLeave: no event"),this.hoveredLine==null&&this.hoveredToken==null){_e(t,"move","FileDiff.DEBUG.handlePointerLeave: returned early, no hovered line or token");return}this.hoveredToken!=null&&(this.options.onTokenLeave?.(this.hoveredToken,e),this.clearHoveredToken()),this.hoveredLine!=null&&(this.options.onLineLeave?.({...this.hoveredLine,event:e}),this.clearHoveredLine()),this.placeUtility()});v(this,"handlePointerDown",e=>{if(e.pointerType==="mouse"&&e.button!==0||this.pre==null||this.pointerSession.mode!=="idle")return;const t=e.composedPath();_t(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!=="mouse"&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))});v(this,"handleDocumentPointerMove",e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionPoint(e,{source:"coordinates-first"});if(t==null)return;this.pointerSession.current=t,this.updateSelection(t.lineNumber,t.side);return}case"selecting":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;this.updateSelection(t.lineNumber,t.eventSide);return}case"pendingSingleLineUnselect":{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();const t=this.resolveSelectionInfo(e,{source:"coordinates-first",requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;const i={lineNumber:t.lineNumber,side:t.eventSide};if(ss(this.pointerSession.pending,i))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:"selecting",pointerId:e.pointerId};return}}});v(this,"handleDocumentPointerUp",e=>{const{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":{const{pointerSession:i}=this;if(e.pointerId!==i.pointerId)return;e.preventDefault();const n=this.resolveSelectionPoint(e,{source:"coordinates-first"});n!=null&&(i.current=n,this.updateSelection(n.lineNumber,n.side));const r=this.buildSelectedLineRange(i.anchor,i.current);t?.({...r}),this.selectionAnchor=void 0,this.notifySelectionEnd(r),this.notifySelectionCommitted(r),this.clearProposedSelection(),this.clearPointerSession(),this.detachDocumentPointerListeners();return}case"pendingSingleLineUnselect":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.updateSelection(null,void 0,!1),this.selectionAnchor=void 0,this.clearPendingSingleLineState(),this.detachDocumentPointerListeners(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection();return;case"selecting":if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault(),this.selectionAnchor=void 0,this.detachDocumentPointerListeners(),this.clearPointerSession(),this.notifySelectionEnd(this.getCurrentSelectionRange()),this.notifySelectionCommitted(this.getCurrentSelectionRange()),this.clearProposedSelection()}});v(this,"handleDocumentPointerCancel",e=>{switch(this.pointerSession.mode){case"idle":return;case"gutterSelecting":case"selecting":case"pendingSingleLineUnselect":if("pointerId"in this.pointerSession&&e.pointerId!==this.pointerSession.pointerId)return;this.selectionAnchor=void 0,this.clearProposedSelection(),this.clearPendingSingleLineState(),this.clearPointerSession(),this.detachDocumentPointerListeners()}});v(this,"renderSelection",()=>{Ii(this.renderSelection);const e=this.getSelectionRenderState();if(this.pre==null)return;const{editorActiveLine:t,selectedLines:i}=e,n=!Rn(this.renderedSelectedLinesState,i),r=!Rn(this.renderedEditorActiveLineState,t);if(!n&&!r)return;n&&(this.renderedSelectedLinesState=void 0),r&&(this.renderedEditorActiveLineState=void 0);const o=this.pre.getAttribute("data-diff-type")==="split",s=n?this.resolveLineRenderRange(i,o,"selected-lines"):void 0,l=r?this.resolveLineRenderRange(t,o,"editor-active-line"):void 0,a=this.getLineRenderColumns(n?i:void 0,s,r?t:void 0,l),h=i.range==null||a.some(g=>g.renderSelectedLines),d=t.range==null||a.some(g=>g.renderEditorActiveLine);if(n)for(const g of this.pre.querySelectorAll("[data-selected-line]"))g.removeAttribute("data-selected-line");if(r)for(const g of this.pre.querySelectorAll("[data-editor-active-line]"))g.removeAttribute("data-editor-active-line");const f=s==null?void 0:Math.min(s.start,s.end),p=s==null?void 0:Math.max(s.start,s.end),c=f===p,m=l?.start;for(const g of a){const{content:S,gutter:b,renderEditorActiveLine:y,renderSelectedLines:x}=g,R=Math.max(x?p??-1/0:-1/0,y?m??-1/0:-1/0),k=S.children.length;for(let w=0;w<k;w++){const E=S.children[w],D=b.children[w];if(!(E instanceof HTMLElement)||!(D instanceof HTMLElement))continue;const H=this.parseLineIndex(E,o);if((H??0)>R)break;if(H!=null){if(x&&f!=null&&p!=null&&H>=f&&H<=p){let T=c?"single":H===f?"first":H===p?"last":"";D.setAttribute("data-selected-line",T),i.lineNumberOnly||(E.setAttribute("data-selected-line",T),D.nextSibling instanceof HTMLElement&&E.nextSibling instanceof HTMLElement&&(E.nextSibling.hasAttribute("data-line-annotation")||E.nextSibling.hasAttribute("data-merge-conflict-actions"))&&(c?(T="last",E.setAttribute("data-selected-line","first")):H===f?T="":H===p&&E.setAttribute("data-selected-line",""),E.nextSibling.setAttribute("data-selected-line",T),D.nextSibling.setAttribute("data-selected-line",T)))}y&&H===m&&(D.setAttribute("data-editor-active-line",""),t.lineNumberOnly||E.setAttribute("data-editor-active-line",""))}}}n&&h&&(this.renderedSelectedLinesState=i),r&&d&&(this.renderedEditorActiveLineState=t)});this.mode=e,this.options=t}setOptions(e){this.options=e}cleanUp(){this.pre?.removeEventListener("click",this.handlePointerClick),this.pre?.removeEventListener("pointerdown",this.handlePointerDown),this.pre?.removeEventListener("pointermove",this.handlePointerMove),this.pre?.removeEventListener("pointerleave",this.handlePointerLeave),this.pre?.removeAttribute("data-interactive-lines"),this.pre?.removeAttribute("data-interactive-line-numbers"),this.pre=void 0,this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.clearHoveredLine(),this.clearHoveredToken(),this.detachDocumentPointerListeners(),this.clearPointerSession(),Ii(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();const{usesCustomGutterUtility:t=!1,enableGutterUtility:i=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),i?this.ensureGutterUtilityNode(t):this.gutterUtilityContainer!=null&&(this.gutterUtilityContainer.remove(),this.gutterUtilityLine=void 0,this.gutterUtilityContainer=void 0,this.gutterUtilityButton=void 0,this.gutterUtilitySlot=void 0,this.pointerSession.mode==="gutterSelecting"&&(this.clearPointerSession(),this.detachDocumentPointerListeners())),this.syncPointerListeners(e),this.updateInteractiveLineAttributes(),this.renderSelection(),this.placeUtility()}setSelectionDirty(){this.renderedSelectedLinesState=void 0,this.renderedEditorActiveLineState=void 0}isSelectionDirty(){return this.renderedSelectedLinesState===void 0||this.renderedEditorActiveLineState===void 0}setSelection(e,t){const i=!(e===this.selectedRange||Ni(e??void 0,this.selectedRange??void 0)),n=t?.lineNumberOnly??!1,r=t?.activeLineSide!==this.selectedRangeHighlightSide||n!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!i&&!r||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=n,this.renderSelection(),this.placeUtility(),i&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:i}={}){const n=e!==this.editorActiveLine,r=i!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!n&&!r||(this.editorActiveLine=e,this.editorActiveLineSide=i,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}handlePointerEvent({eventType:e,event:t}){const{__debugPointerEvents:i}=this.options,n=t.composedPath();_e(i,e,"FileDiff.DEBUG.handlePointerEvent:",{eventType:e,composedPath:n});const r=this.resolvePointerTarget(n);_e(i,e,"FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:",r);const{onLineClick:o,onLineNumberClick:s,onLineEnter:l,onLineLeave:a,onTokenClick:h,onTokenEnter:d,onTokenLeave:f,onHunkExpand:p,onMergeConflictActionClick:c}=this.options;switch(e){case"move":{const m=bi(r)&&this.hoveredLine?.lineElement===r.lineElement;Yt(r)&&this.hoveredToken?.tokenElement===r.tokenElement||(this.hoveredToken!=null&&(f?.(this.hoveredToken,t),this.clearHoveredToken()),Yt(r)&&(this.setHoveredToken(this.toTokenEventBaseProps(r)),d?.(this.hoveredToken,t))),m||(this.hoveredLine!=null&&(a?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),bi(r)?(this.setHoveredLine(this.toEventBaseProps(r)),this.placeUtility(),l?.({...this.hoveredLine,event:t})):this.placeUtility());break}case"click":{if(r==null)break;if(hs(r)&&c!=null){c(r);break}if(ds(r)&&p!=null){p(r.hunkIndex,r.all||t.shiftKey?"both":r.direction,r.all||t.shiftKey?Number.POSITIVE_INFINITY:void 0);break}if(!bi(r))break;Yt(r)&&h!=null&&h(this.toTokenEventBaseProps(r),t);const m=this.toEventBaseProps(r);s!=null&&r.numberColumn?s({...m,event:t}):o?.({...m,event:t});break}}}syncPointerListeners(e){const{__debugPointerEvents:t,lineHoverHighlight:i="disabled",onLineClick:n,onLineNumberClick:r,onLineEnter:o,onLineLeave:s,onTokenClick:l,onTokenEnter:a,onTokenLeave:h,onHunkExpand:d,onMergeConflictActionClick:f,enableGutterUtility:p=!1,enableLineSelection:c=!1,onGutterUtilityClick:m}=this.options,g=m!=null,S=i!=="disabled"||n!=null||r!=null||o!=null||s!=null||l!=null||a!=null||h!=null||d!=null||f!=null||p||c||g;S&&!this.hasPointerListeners?(e.addEventListener("click",this.handlePointerClick),e.addEventListener("pointerdown",this.handlePointerDown),e.addEventListener("pointermove",this.handlePointerMove),e.addEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!0,_e(t,"click","FileDiff.DEBUG.attachEventListeners: Attaching click events for:",(()=>{const x=[];return(t==="both"||t==="click")&&(n!=null&&x.push("onLineClick"),r!=null&&x.push("onLineNumberClick"),d!=null&&x.push("expandable hunk separators"),f!=null&&x.push("merge conflict actions")),x})()),_e(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer move event"),_e(t,"move","FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event")):!S&&this.hasPointerListeners&&(e.removeEventListener("click",this.handlePointerClick),e.removeEventListener("pointerdown",this.handlePointerDown),e.removeEventListener("pointermove",this.handlePointerMove),e.removeEventListener("pointerleave",this.handlePointerLeave),this.hasPointerListeners=!1);const b=this.pointerSession.mode==="selecting"||this.pointerSession.mode==="pendingSingleLineUnselect",y=this.pointerSession.mode==="gutterSelecting";(!c&&b||!g&&y)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;const{onLineClick:e,onLineNumberClick:t,enableLineSelection:i=!1}=this.options,n=e!=null,r=t!=null||i;n&&!this.interactiveLinesAttr?(this.pre.setAttribute("data-interactive-lines",""),this.interactiveLinesAttr=!0):!n&&this.interactiveLinesAttr&&(this.pre.removeAttribute("data-interactive-lines"),this.interactiveLinesAttr=!1),r&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute("data-interactive-line-numbers",""),this.interactiveLineNumbersAttr=!0):!r&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute("data-interactive-line-numbers"),this.interactiveLineNumbersAttr=!1)}startLineSelectionFromPointerDown(e){const{enableLineSelection:t=!1}=this.options;if(!t)return;const i=this.resolveSelectionInfo(e,{source:"event-path",requireNumberColumn:!0});if(i==null)return;const{pre:n}=this;if(n==null)return;const{lineNumber:r,eventSide:o,lineIndex:s}=i;if(e.shiftKey&&this.selectedRange!=null){const l=this.getIndexesFromSelection(this.selectedRange,n.getAttribute("data-diff-type")==="split");if(l==null)return;const a=l.start<=l.end?s>=l.start:s<=l.end;this.selectionAnchor={lineNumber:a?this.selectedRange.start:this.selectedRange.end,side:a?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===r&&this.selectedRange?.end===r){const l={lineNumber:r,side:o};this.selectionAnchor=l,this.pointerSession={mode:"pendingSingleLineUnselect",pointerId:e.pointerId,anchor:l,pending:l},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:r,side:o},this.updateSelection(r,o,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:"selecting",pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){const{onGutterUtilityClick:t}=this.options;if(t==null)return;const i=this.currentSelectionEnds(),n=i?.bottom??this.resolveSelectionPoint(e,{source:"event-path",excludeUtility:!1}),r=i?.top??n;n==null||r==null||(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:"gutterSelecting",pointerId:e.pointerId,anchor:r,current:n},this.selectionAnchor={lineNumber:r.lineNumber,side:r.side},this.updateSelection(n.lineNumber,n.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute("data-hovered"),this.hoveredLine.numberElement.removeAttribute("data-hovered"),this.hoveredLine=void 0)}setHoveredLine(e){const{lineHoverHighlight:t="disabled"}=this.options;this.hoveredLine!=null&&this.clearHoveredLine(),this.hoveredLine=e,t!=="disabled"&&((t==="both"||t==="line")&&this.hoveredLine.lineElement.setAttribute("data-hovered",""),(t==="both"||t==="number")&&this.hoveredLine.numberElement.setAttribute("data-hovered",""))}clearHoveredToken(){this.hoveredToken!=null&&(this.hoveredToken=void 0)}setHoveredToken(e){this.hoveredToken!=null&&this.clearHoveredToken(),this.hoveredToken=e}ensureGutterUtilityNode(e){if(this.gutterUtilityContainer==null&&(this.gutterUtilityContainer=document.createElement("div"),this.gutterUtilityContainer.setAttribute("data-gutter-utility-slot","")),e)this.gutterUtilityButton!=null&&(this.gutterUtilityButton.remove(),this.gutterUtilityButton=void 0),this.gutterUtilitySlot==null&&(this.gutterUtilitySlot=document.createElement("slot"),this.gutterUtilitySlot.name="gutter-utility-slot"),this.gutterUtilitySlot.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilitySlot);else{if(this.gutterUtilitySlot?.remove(),this.gutterUtilitySlot=void 0,this.gutterUtilityButton==null){const t=document.createElement("div");t.innerHTML=Qe(os());const i=t.firstElementChild;if(!(i instanceof HTMLButtonElement))throw new Error("InteractionManager.ensureGutterUtilityNode: Node element should be a button");i.remove(),this.gutterUtilityButton=i}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;const t=this.resolvePointerTarget(e);Et(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){const e=this.currentSelectionEnds();if(e==null)return!1;const t=this.targetForSelectionPoint(e.bottom);return t==null?this.hideUtility():this.showUtilityOnLine(this.toEventBaseProps(t)),!0}showUtilityOnLine(e){this.gutterUtilityContainer!=null&&(this.gutterUtilityLine=e,e.numberElement.appendChild(this.gutterUtilityContainer))}hideUtility(){this.gutterUtilityContainer?.remove(),this.gutterUtilityLine=void 0}currentSelectionEnds(){const e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){const t={lineNumber:e.start,side:e.side},i={lineNumber:e.end,side:e.endSide??e.side},n=this.selectionPointRowIndex(t),r=this.selectionPointRowIndex(i);if(!(n==null||r==null))return n>r?{top:i,bottom:t}:{top:t,bottom:i}}selectionPointRowIndex(e){const t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;const t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;const i=this.mode==="diff"?`${t[0]},${t[1]}`:`${t[0]}`,n=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${i}"]`);for(const r of n){if(!(r instanceof HTMLElement))continue;const o=this.resolvePointerTarget(yt(r));if(Et(o)&&!(this.mode==="diff"&&e.side!=null&&o.side!==e.side))return o}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||(document.addEventListener("pointermove",this.handleDocumentPointerMove),document.addEventListener("pointerup",this.handleDocumentPointerUp),document.addEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&(document.removeEventListener("pointermove",this.handleDocumentPointerMove),document.removeEventListener("pointerup",this.handleDocumentPointerUp),document.removeEventListener("pointercancel",this.handleDocumentPointerCancel),this.hasDocumentPointerListeners=!1)}clearPointerSession(){this.pointerSession={mode:"idle"}}clearPendingSingleLineState(){this.pointerSession.mode==="pendingSingleLineUnselect"&&(this.pointerSession={mode:"idle"})}selectionInfoFromPath(e,t){const i=this.resolvePointerTarget(e);if(Et(i)&&!(t&&!i.numberColumn)&&i.splitLineIndex!=null)return{lineIndex:i.splitLineIndex,lineNumber:i.lineNumber,eventSide:this.mode==="diff"?i.side:void 0}}resolveSelectionInfo(e,t){const i=this.resolveSelectionPath(e,t);return i!=null?this.selectionInfoFromPath(i,t.requireNumberColumn):void 0}selectionPointFromPath(e){const t=this.resolvePointerTarget(e);if(Et(t))return{lineNumber:t.lineNumber,side:this.mode==="diff"?t.side:void 0}}resolveSelectionPoint(e,t){const i=this.resolveSelectionPath(e,t);return i!=null?this.selectionPointFromPath(i):void 0}resolveSelectionPath(e,t){const i=t.excludeUtility!==!1;switch(t.source){case"event-path":return this.pathFromEventPath(e.composedPath(),i);case"coordinates-first":{const n=this.pathFromCoordinates(e,i);return n!==void 0?n??void 0:this.pathFromEventPath(e.composedPath(),i)}}}pathFromCoordinates(e,t){const i=this.hitTest(e);if(i!==void 0)return i===null?null:this.pathFromElement(i,t)??null}pathFromEventPath(e,t){if(!(t&&_t(e))){for(const i of e)if(i instanceof Element)return this.pathFromElement(i,t)}}pathFromElement(e,t){const i=yt(e);if(t&&_t(i))return;const n=us(e);return n!=null?yt(n):this.pathFromAnnotationSlot(e)}pathFromAnnotationSlot(e){const t=cs(e)?.previousElementSibling;if(t instanceof HTMLElement&&(t.hasAttribute("data-line")||t.hasAttribute("data-column-number")))return yt(t);const i=gs(ps(e));if(i==null)return;const n=this.targetForSelectionPoint(i);return n!=null?yt(n.lineElement):void 0}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;const t=this.pre?.getRootNode(),i=En(t)?t:En(document)?document:void 0;if(i!=null)return i.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){const{getLineIndex:i}=this.options;return i!=null?i(e,t):[e-1,e-1]}getCurrentSelectionRange(){return this.proposedSelectedRange!==void 0?this.proposedSelectedRange:this.selectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,i=!0){const n=this.getCurrentSelectionRange();let r;if(e==null)r=null;else{const o=this.selectionAnchor?.side??t,s=this.selectionAnchor?.lineNumber??e;r=this.buildSelectionRange(s,e,o,t)}Ni(n??void 0,r??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=r:(this.selectedRange=r,Cr(this.renderSelection)),this.placeUtility(),i&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;const i=this.getLineIndex(e.start,e.side),n=this.getLineIndex(e.end,e.endSide??e.side);return i!=null&&n!=null?{start:t?i[1]:i[0],end:t?n[1]:n[0]}:void 0}getSelectionRenderState(){return{selectedLines:{range:this.selectedRange,highlightSide:this.selectedRangeHighlightSide,lineNumberOnly:this.selectedRangeLineNumberOnly},editorActiveLine:{range:this.editorActiveLine==null?null:{start:this.editorActiveLine,end:this.editorActiveLine,side:this.editorActiveLineSide},highlightSide:this.editorActiveLineSide,lineNumberOnly:this.editorLineNumberOnly}}}resolveLineRenderRange(e,t,i){if(e.range==null)return;const n=this.getIndexesFromSelection(e.range,t);if(n==null)throw console.error({rowRange:n,range:e.range}),new Error(`InteractionManager.renderSelection: No valid ${i} rowRange`);return n}getLineRenderColumns(e,t,i,n){if(this.pre==null||t==null&&n==null)return[];const{children:r}=this.pre;if(r.length>2)throw console.error(r),new Error("InteractionManager.renderSelection: Somehow there are more than 2 code elements...");const o=[];for(const s of r){const l=s.hasAttribute("data-deletions")?"deletions":s.hasAttribute("data-additions")?"additions":void 0,a=e!=null&&t!=null&&(e.highlightSide==null||l==null||e.highlightSide===l),h=i!=null&&n!=null&&(i.highlightSide==null||l==null||i.highlightSide===l);if(!a&&!h)continue;const[d,f]=s.children;if(!(d instanceof HTMLElement)||!(f instanceof HTMLElement))throw new Error("InteractionManager.renderSelection: missing gutter or content element");if(f.children.length!==d.children.length)throw new Error("InteractionManager.renderSelection: gutter and content children dont match, something is wrong");o.push({content:f,gutter:d,renderEditorActiveLine:h,renderSelectedLines:a})}return o}notifySelectionCommitted(e){this.options.onLineSelected?.(e)}notifySelectionChangeDelta(){this.options.onLineSelectionChange?.(this.getCurrentSelectionRange()??null)}notifySelectionStart(e){this.options.onLineSelectionStart?.(e)}notifySelectionEnd(e){this.options.onLineSelectionEnd?.(e)}toEventBaseProps(e){return this.mode==="file"?{type:"line",lineElement:e.lineElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn,numberElement:e.numberElement}:{type:"diff-line",annotationSide:e.side,lineType:e.lineType,lineElement:e.lineElement,numberElement:e.numberElement,lineNumber:e.lineNumber,numberColumn:e.numberColumn}}toTokenEventBaseProps({lineCharEnd:e,lineCharStart:t,lineNumber:i,side:n,tokenElement:r,tokenText:o}){return this.mode==="file"?{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:i,tokenElement:r,tokenText:o}:{type:"token",lineCharEnd:e,lineCharStart:t,lineNumber:i,side:n,tokenElement:r,tokenText:o}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,i,n){return{start:e,end:t,...i!=null?{side:i}:{},...i!==n&&n!=null?{endSide:n}:{}}}resolvePointerTarget(e){let t=!1,i,n,r,o,s,l,a,h,d,f;for(const c of e){if(!(c instanceof HTMLElement))continue;if(f==null&&c.hasAttribute("data-merge-conflict-action")){const b=c.getAttribute("data-merge-conflict-action")??void 0,y=c.getAttribute("data-merge-conflict-conflict-index")??void 0,x=y!=null?Number.parseInt(y,10):NaN;fs(b)&&Number.isFinite(x)&&(f={kind:"merge-conflict-action",resolution:b,conflictIndex:x})}if(l==null&&c.hasAttribute("data-char")){l=c;const b=c.getAttribute("data-char");if(b!=null){const y=Number.parseInt(b,10);if(!Number.isNaN(y)){const x=c.textContent??"",R=y+x.length;(x.trim()!==""||this.options.enableTokenInteractionsOnWhitespace===!0)&&(a={tokenElement:l,lineCharStart:y,lineCharEnd:R,tokenText:x});continue}}}const m=s==null?c.getAttribute("data-column-number")??void 0:void 0;if(m!=null){s=c,d=Number.parseInt(m,10),t=!0,i=Hn(c),o=c.getAttribute("data-line-index")??void 0;continue}const g=r==null?c.getAttribute("data-line")??void 0:void 0;if(g!=null){r=c,d=Number.parseInt(g,10),i=Hn(c),o=c.getAttribute("data-line-index")??void 0;continue}if(h==null&&(c.hasAttribute("data-expand-button")||c.hasAttribute("data-unmodified-lines"))){h={hunkIndex:void 0,direction:c.hasAttribute("data-expand-up")?"up":c.hasAttribute("data-expand-down")?"down":"both",all:c.hasAttribute("data-expand-all-button")};continue}const S=h!=null?c.getAttribute("data-expand-index")??void 0:void 0;if(h!=null&&S!=null){const b=Number.parseInt(S,10);Number.isNaN(b)||(h.hunkIndex=b);continue}if(n==null&&c.hasAttribute("data-code")){n=c;break}}if(f!=null)return f;if(h?.hunkIndex!=null)return{type:"line-info",hunkIndex:h.hunkIndex,direction:h.direction,all:h.all};if(r??=o!=null?kn(n,`[data-line][data-line-index="${o}"]`):void 0,s??=o!=null?kn(n,`[data-column-number][data-line-index="${o}"]`):void 0,n==null||r==null||s==null||i==null||d==null||Number.isNaN(d))return;const p=this.parseLineIndex(r,this.isSplitDiff());return a!=null?this.mode==="file"?{kind:"token",lineType:i,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:p,...a}:{kind:"token",lineType:i,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:An(i,n),splitLineIndex:p,...a}:this.mode==="file"?{kind:"line",lineType:i,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:void 0,splitLineIndex:p}:{kind:"line",lineType:i,lineElement:r,lineNumber:d,numberColumn:t,numberElement:s,side:An(i,n),splitLineIndex:p}}isSplitDiff(){return this.pre?.getAttribute("data-diff-type")==="split"}parseLineIndex(e,t){const i=(e.getAttribute("data-line-index")??"").split(",").map(n=>Number.parseInt(n,10)).filter(n=>!Number.isNaN(n));if(t&&i.length===2)return i[1];if(!t)return i[0]}};function wn({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:i,onGutterUtilityClick:n,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,renderGutterUtility:f,__debugPointerEvents:p,enableLineSelection:c,controlledSelection:m,onLineSelected:g,onLineSelectionStart:S,onLineSelectionChange:b,onLineSelectionEnd:y},x,R,k){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:ls({enableGutterUtility:t,renderGutterUtility:f,onGutterUtilityClick:n}),usesCustomGutterUtility:f!=null,lineHoverHighlight:i,onGutterUtilityClick:n,onHunkExpand:x,onMergeConflictActionClick:k,onLineClick:r,onLineEnter:o,onLineLeave:s,onLineNumberClick:l,onTokenClick:a,onTokenEnter:h,onTokenLeave:d,__debugPointerEvents:p,enableLineSelection:c,controlledSelection:m,onLineSelected:g,onLineSelectionStart:S,onLineSelectionChange:b,onLineSelectionEnd:y,getLineIndex:R}}function ls({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:i}){if(i!=null&&t!=null)throw new Error("Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.");return e??!1}function Et(e){return e!=null&&"kind"in e&&e.kind==="line"}function Yt(e){return e!=null&&"kind"in e&&e.kind==="token"}function bi(e){return Et(e)||Yt(e)}function ds(e){return"type"in e&&e.type==="line-info"}function hs(e){return"kind"in e&&e.kind==="merge-conflict-action"}function fs(e){return e==="current"||e==="incoming"||e==="both"}function kn(e,t){const i=e?.querySelector(t);return i instanceof HTMLElement?i:void 0}function yt(e){const t=[];let i=e;for(;i!=null;)t.push(i),i=i.parentNode;return t}function us(e){const t=e.closest("[data-line], [data-column-number]");if(t instanceof HTMLElement)return t;const i=e.closest('[data-line-annotation], [data-gutter-buffer="annotation"]');if(!(i instanceof HTMLElement))return;const n=i.previousElementSibling;return n instanceof HTMLElement&&(n.hasAttribute("data-line")||n.hasAttribute("data-column-number"))?n:void 0}function cs(e){const t=e.closest('[slot^="annotation-"]'),i=(t instanceof HTMLElement&&t.assignedSlot!=null?t.assignedSlot:e.tagName==="SLOT"?e:void 0)?.closest("[data-line-annotation]");return i instanceof HTMLElement?i:void 0}function ps(e){const t=e.closest('[slot^="annotation-"]');if(t instanceof HTMLElement)return t.getAttribute("slot")??void 0;if(e instanceof HTMLElement){const i=e.getAttribute("name")??void 0;return i!=null&&i.startsWith("annotation-")?i:void 0}}function gs(e){if(e==null)return;const t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;const i=Number.parseInt(t[2],10);if(!(!Number.isFinite(i)||i<=0))return{lineNumber:i,side:t[1]}}function En(e){return e!=null&&typeof e.elementFromPoint=="function"}function ms(e,t){return e===t||Ni(e??void 0,t??void 0)}function Rn(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&ms(e?.range??null,t.range)}function An(e,t){switch(e){case"change-deletion":return"deletions";case"change-addition":return"additions";default:return t.hasAttribute("data-deletions")?"deletions":"additions"}}function Hn(e){const t=e.getAttribute("data-line-type");if(t!=null)switch(t){case"change-deletion":case"change-addition":case"context":case"context-expanded":return t;default:return}}function _e(e="none",t,...i){switch(e){case"none":return;case"both":break;case"click":if(t!=="click")return;break;case"move":if(t!=="move")return}console.log(...i)}var ue,vs=(ue=class{constructor(){v(this,"observedNodes",new Map);v(this,"applyColumnUpdates",t=>{for(const[i,n]of t){const r=n.codeInlineSize!=null?bs(n.codeInlineSize):i.codeWidth,o=n.numberInlineSize!=null?Ss(n.numberInlineSize):i.numberWidth,s=r!==i.codeWidth,l=o!==i.numberWidth;!s&&!l||(i.codeWidth=r,i.numberWidth=o,i.applyColumnVariables&&Lr(i,{codeWidthChanged:s,numberWidthChanged:l}))}})}static getResizeObserver(){const t=ue.resizeObserver??new ResizeObserver(ue.handleSharedResizeEntries);return ue.resizeObserver=t,t}static handleSharedResizeEntries(t){const i=new Map;for(const n of t){const r=ue.managersByElement.get(n.target);if(r==null)continue;const o=i.get(r);o==null?i.set(r,[n]):o.push(n)}for(const[n,r]of i)n.handleResizeEntries(r)}setup(t,{disableAnnotations:i,columnVariables:n="apply"}){const r=new Set,o=n==="apply";let s=0;const l=new Map(this.observedNodes);this.observedNodes.clear();for(const a of t.children){if(s===2)break;const h=(()=>{if(a instanceof HTMLElement&&a.tagName==="CODE")return a})();if(h==null)continue;s++;let d=l.get(h);if(d!=null&&d.type!=="code")throw new Error("ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible");let f=h.firstElementChild;f instanceof HTMLElement||(f=null),d!=null?(this.observedNodes.set(h,d),l.delete(h),d.numberElement!==f?(d.numberElement!=null&&(this.unobserve(d.numberElement),l.delete(d.numberElement)),f!=null&&(this.observe(f),l.delete(f),this.observedNodes.set(f,d)),d.numberElement=f,d.numberWidth=0):d.numberElement!=null?(l.delete(d.numberElement),this.observedNodes.set(d.numberElement,d)):d.numberWidth=0,ys(d,o)):(d={type:"code",codeElement:h,numberElement:f,codeWidth:"auto",numberWidth:0,applyColumnVariables:o},this.observedNodes.set(h,d),this.observe(h),f!=null&&(this.observedNodes.set(f,d),this.observe(f)))}if(s>1&&!i){const a=t.querySelectorAll('[data-line-annotation*=","]'),h=new Map;for(const d of a){if(!(d instanceof HTMLElement))continue;const f=d.getAttribute("data-line-annotation")??"";if(!/^-?\d+,-?\d+$/.test(f)){console.error("DiffFileRenderer.setupResizeObserver: Invalid element or annotation",{lineAnnotation:f,element:d});continue}let p=h.get(f);p==null&&(p=[],h.set(f,p)),p.push(d)}for(const[d,f]of h){if(f.length!==2){console.error("DiffFileRenderer.setupResizeObserver: Bad Pair",d,f);continue}const[p,c]=f,m=p.firstElementChild,g=c.firstElementChild;if(!(p instanceof HTMLElement)||!(c instanceof HTMLElement)||!(m instanceof HTMLElement)||!(g instanceof HTMLElement))continue;let S=l.get(m);if(S!=null){this.observedNodes.set(m,S),this.observedNodes.set(g,S),l.delete(m),l.delete(g);continue}const b=m.getBoundingClientRect().height,y=g.getBoundingClientRect().height;S={type:"annotations",column1:{container:p,child:m,childHeight:b},column2:{container:c,child:g,childHeight:y},currentHeight:"auto"},r.add({child1:m,child2:g,item:S,newHeight:Math.max(b,y)})}for(const d of r)this.applyNewHeight(d.item,d.newHeight),this.observedNodes.set(d.child1,d.item),this.observedNodes.set(d.child2,d.item),this.observe(d.child1),this.observe(d.child2);r.clear()}for(const[a,h]of l)this.unobserve(a),h.type==="code"?Cs(h):xs(h);l.clear()}cleanUp(){for(const t of this.observedNodes.keys())this.unobserve(t);this.observedNodes.clear()}observe(t){const{managersByElement:i}=ue,n=i.get(t);if(n!==this){if(n!=null&&n!==this)throw new Error("ResizeManager.observe: element is already owned by another ResizeManager");i.set(t,this),ue.getResizeObserver().observe(t)}}unobserve(t){const{managersByElement:i,resizeObserver:n}=ue,r=i.get(t);if(r!=null){if(r!==this)throw new Error("ResizeManager.unobserve: element is owned by another ResizeManager");i.delete(t),n?.unobserve(t),n!=null&&i.size===0&&(n.disconnect(),ue.resizeObserver=void 0)}}handleResizeEntries(t){const i=new Map,n=new Set;for(const r of t){const{target:o,borderBoxSize:s,contentBoxSize:l}=r;if(!(o instanceof HTMLElement)){console.error("ResizeManager.handleResizeEntries: Invalid element for ResizeObserver",r);continue}const a=this.observedNodes.get(o);if(a==null){console.error("ResizeManager.handleResizeEntries: Not a valid observed node",r);continue}if(a.type==="annotations"){const h=(()=>{if(o===a.column1.child)return a.column1;if(o===a.column2.child)return a.column2})();if(h==null){console.error("ResizeManager.handleResizeEntries: Couldn't find a column for",{item:a,target:o});continue}h.childHeight=s[0].blockSize,n.add(a)}else if(a.type==="code"){const h=i.get(a)??{},d=l[0].inlineSize;o===a.codeElement?h.codeInlineSize=d:o===a.numberElement&&(h.numberInlineSize=d),i.set(a,h)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(i),i.clear()}applyAnnotationUpdates(t){for(const i of t)this.applyNewHeight(i,Math.max(i.column1.childHeight,i.column2.childHeight))}applyNewHeight(t,i){i!==t.currentHeight&&(t.currentHeight=Math.max(i,0),t.column1.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`),t.column2.container.style.setProperty("--diffs-annotation-min-height",`${t.currentHeight}px`))}},v(ue,"resizeObserver"),v(ue,"managersByElement",new Map),ue);function bs(e){const t=Math.max(Math.floor(e),0);return t===0?"auto":t}function Ss(e){return Math.max(Math.ceil(e),0)}function ys(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?Lr(e,{codeWidthChanged:!0,numberWidthChanged:!0}):wr(e))}function Lr(e,{codeWidthChanged:t,numberWidthChanged:i}){const{codeElement:n,codeWidth:r,numberWidth:o}=e;if(t&&n.style.setProperty("--diffs-column-width",`${typeof r=="number"?`${r}px`:"auto"}`),i&&n.style.setProperty("--diffs-column-number-width",`${o===0?"auto":`${o}px`}`),t||i&&r!=="auto"){const s=typeof r=="number"?Math.max(r-o,0):0;n.style.setProperty("--diffs-column-content-width",`${s>0?`${s}px`:"auto"}`)}}function wr(e){e.codeElement.style.removeProperty("--diffs-column-content-width"),e.codeElement.style.removeProperty("--diffs-column-number-width"),e.codeElement.style.removeProperty("--diffs-column-width")}function Cs(e){e.codeElement.isConnected&&wr(e)}function xs(e){e.column1.container.isConnected&&e.column1.container.style.removeProperty("--diffs-annotation-min-height"),e.column2.container.isConnected&&e.column2.container.style.removeProperty("--diffs-annotation-min-height")}function kr(e,t){return e==null||t==null?e===t:e.startingLine===t.startingLine&&e.totalLines===t.totalLines&&e.bufferBefore===t.bufferBefore&&e.bufferAfter===t.bufferAfter}function Ls(e){return O({tagName:"div",children:[O({tagName:"div",children:e.annotations?.map(t=>O({tagName:"slot",properties:{name:t}})),properties:{"data-annotation-content":""}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function ws(e){switch(e){case"file":return"diffs-icon-file-code";case"change":return"diffs-icon-symbol-modified";case"new":return"diffs-icon-symbol-added";case"deleted":return"diffs-icon-symbol-deleted";case"rename-pure":case"rename-changed":return"diffs-icon-symbol-moved"}}function ks({fileOrDiff:e,mode:t,stickyHeader:i}){const n="type"in e?e:void 0,r={"data-diffs-header":t,"data-change-type":n?.type,"data-sticky":i?"":void 0};return O({tagName:"div",children:[t==="custom"?O({tagName:"slot",properties:{name:dr}}):Es({name:e.name,prevName:"prevName"in e?e.prevName:void 0,iconType:n?.type??"file"}),...t==="custom"?[]:[Rs(n)]],properties:r})}function Es({name:e,prevName:t,iconType:i}){const n=[O({tagName:"slot",properties:{name:hr}}),Jt({name:ws(i),properties:{"data-change-icon":i}})];return t!=null&&(n.push(O({tagName:"div",children:[O({tagName:"bdi",children:[Je(t)]})],properties:{"data-prev-name":""}})),n.push(Jt({name:"diffs-icon-arrow-right-short",properties:{"data-rename-icon":""}}))),n.push(O({tagName:"div",children:[O({tagName:"bdi",children:[Je(e)]})],properties:{"data-title":""}})),n.push(O({tagName:"slot",properties:{name:fr}})),O({tagName:"div",children:n,properties:{"data-header-content":""}})}function Rs(e){const t=[];if(e!=null){let i=0,n=0;for(const r of e.hunks)i+=r.additionLines,n+=r.deletionLines;(n>0||i===0)&&t.push(O({tagName:"span",children:[Je(`-${n}`)],properties:{"data-deletions-count":""}})),(i>0||n===0)&&t.push(O({tagName:"span",children:[Je(`+${i}`)],properties:{"data-additions-count":""}}))}return t.push(O({tagName:"slot",properties:{name:ur}})),O({tagName:"div",children:t,properties:{"data-metadata":""}})}function As(e){return O({tagName:"pre",properties:Hs(e)})}function Hs({diffIndicators:e,disableBackground:t,disableLineNumbers:i,overflow:n,split:r,totalLines:o,type:s,customProperties:l}){return{...l,"data-diff":s==="diff"?"":void 0,"data-file":s==="file"?"":void 0,"data-diff-type":s==="diff"?r?"split":"single":void 0,"data-overflow":n,"data-disable-line-numbers":i?"":void 0,"data-background":t?void 0:"","data-indicators":e==="bars"||e==="classic"?e:void 0,style:`--diffs-min-number-column-width-default:${`${o}`.length}ch;`}}function Ts(e,{theme:t,preferredHighlighter:i="shiki-js"}){return{langs:Array.isArray(e)?e:[e??"text"],themes:cr(t),preferredHighlighter:i}}function Rt(e){return`annotation-${"side"in e?`${e.side}-`:""}${e.lineNumber}`}function Pi(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}const Ds="-1,-1";function Ms(e){return e?.some(t=>t.lineNumber===0)??!1}function Tn(e){const t=e[0];return t!=null&&t.length>0?t:void 0}function Er(e){return e.startingLine===0&&e.totalLines>0}function Is(e,t){return e.endsWith(`\r
|
|
@@ -123,8 +123,8 @@ var vo=Object.defineProperty;var bo=(e,t,i)=>t in e?vo(e,t,{enumerable:!0,config
|
|
|
123
123
|
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
124
124
|
<path d="M1.5 8c0 1.613.088 2.806.288 3.704.196.88.478 1.381.802 1.706.286.286.71.54 1.41.73V1.86c-.7.19-1.124.444-1.41.73-.324.325-.606.826-.802 1.706C1.588 5.194 1.5 6.387 1.5 8m4 6.397c.697.07 1.522.103 2.5.103 1.613 0 2.806-.088 3.704-.288.88-.195 1.381-.478 1.706-.802s.607-.826.802-1.706c.2-.898.288-2.091.288-3.704s-.088-2.806-.288-3.704c-.195-.88-.478-1.381-.802-1.706s-.826-.606-1.706-.802C10.806 1.588 9.613 1.5 8 1.5c-.978 0-1.803.033-2.5.103zM0 8c0-6.588 1.412-8 8-8s8 1.412 8 8-1.412 8-8 8-8-1.412-8-8m7-2a1 1 0 0 1 1-1h3a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1H8a1 1 0 0 1-1-1z"/>
|
|
125
125
|
</symbol>
|
|
126
|
-
</svg>`;function Ps(e,t){return e==null||t==null?e===t:zs(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}const Dn={};function zs(e=Dn,t=Dn){if(e===t)return!0;const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(const r of i)if(e[r]!==t[r])return!1;return!0}function Us(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function _s(){const e=document.createElement("div");return e.slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e}function Os(){const e=document.createElement("style");return e.setAttribute(Ho,""),e}var Bs=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line-type=change-addition],& [data-line-type=change-deletion]{&[data-no-newline],&[data-line]{&:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [data-line-type=change-addition]{&[data-line],&[data-no-newline]{&:before{content:"+";color:var(--diffs-addition-base)}}}& [data-line-type=change-deletion]{&[data-line],&[data-no-newline]{&:before{content:"-";color:var(--diffs-deletion-base)}}}}[data-indicators=bars]{& [data-line-type=change-deletion],& [data-line-type=change-addition]{&[data-column-number]{&:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [data-line-type=change-deletion]{&[data-column-number]{&:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}}}& [data-line-type=change-addition]{&[data-column-number]{&:before{background-color:var(--diffs-addition-base)}}}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
|
|
127
|
-
`;let Ot;function zi(e){if(Ot!=null)return Ot;const t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;const i=document.createElement("div");i.setAttribute("data-code",""),i.setAttribute(
|
|
126
|
+
</svg>`;function Ps(e,t){return e==null||t==null?e===t:zs(e.customProperties,t.customProperties)&&e.type===t.type&&e.diffIndicators===t.diffIndicators&&e.disableBackground===t.disableBackground&&e.disableLineNumbers===t.disableLineNumbers&&e.overflow===t.overflow&&e.split===t.split&&e.totalLines===t.totalLines}const Dn={};function zs(e=Dn,t=Dn){if(e===t)return!0;const i=Object.keys(e),n=Object.keys(t);if(i.length!==n.length)return!1;for(const r of i)if(e[r]!==t[r])return!1;return!0}function Us(e){const t=document.createElement("div");return t.dataset.annotationSlot="",t.slot=e,t.style.whiteSpace="normal",t}function _s(){const e=document.createElement("div");return e.slot="gutter-utility-slot",e.style.position="absolute",e.style.top="0",e.style.bottom="0",e.style.textAlign="center",e.style.whiteSpace="normal",e.style.touchAction="none",e}function Os(){const e=document.createElement("style");return e.setAttribute(Ro,""),e}var Bs=`@layer base,theme,rendered,unsafe;@layer base{:host{--diffs-font-fallback:"SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono", "Courier New", monospace;--diffs-header-font-fallback:system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", "Noto Sans", "Liberation Sans", Arial, sans-serif;--diffs-mixer:light-dark(#000,#fff);--diffs-gap-fallback:8px;--diffs-scrollbar-gutter-fallback:6px;--diffs-scrollbar-gutter:var(--diffs-scrollbar-gutter-override,var(--diffs-scrollbar-gutter-measured,var(--diffs-scrollbar-gutter-fallback)));--diffs-added-light:#0dbe4e;--diffs-added-dark:#5ecc71;--diffs-modified-light:#009fff;--diffs-modified-dark:#69b1ff;--diffs-deleted-light:#ff2e3f;--diffs-deleted-dark:#ff6762;--diffs-warning-light:#d5a910;--diffs-warning-dark:#ffd452;color-scheme:light dark;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);font-feature-settings:var(--diffs-font-features);--diffs-bg:light-dark(var(--diffs-light-bg,#fff),var(--diffs-dark-bg,#000));--diffs-bg-buffer:var(--diffs-bg-buffer-override,light-dark(color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92%, var(--diffs-mixer))));--diffs-bg-context:var(--diffs-bg-context-override,light-dark(color-mix(in lab, var(--diffs-bg) 98.5%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 92.5%, var(--diffs-mixer))));--diffs-bg-context-gutter:var(--diffs-bg-context-gutter-override,light-dark(color-mix(in lab, var(--diffs-bg-context) 90%, var(--diffs-bg)),color-mix(in lab, var(--diffs-bg-context) 45%, var(--diffs-bg))));--diffs-bg-separator:var(--diffs-bg-separator-override,light-dark(color-mix(in lab, var(--diffs-bg) 96%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-bg) 85%, var(--diffs-mixer))));--diffs-fg:light-dark(var(--diffs-light,#000),var(--diffs-dark,#fff));--diffs-fg-number:var(--diffs-fg-number-override,light-dark(color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg)),color-mix(in lab, var(--diffs-fg) 65%, var(--diffs-bg))));--diffs-fg-conflict-marker:var(--diffs-fg-conflict-marker-override,var(--diffs-fg-number));--diffs-deletion-base:var(--diffs-deletion-color-override,light-dark(var(--diffs-light-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-light))),var(--diffs-dark-deletion-color,var(--diffs-deletion-color,var(--diffs-deleted-dark)))));--diffs-addition-base:var(--diffs-addition-color-override,light-dark(var(--diffs-light-addition-color,var(--diffs-addition-color,var(--diffs-added-light))),var(--diffs-dark-addition-color,var(--diffs-addition-color,var(--diffs-added-dark)))));--diffs-modified-base:var(--diffs-modified-color-override,light-dark(var(--diffs-light-modified-color,var(--diffs-modified-color,var(--diffs-modified-light))),var(--diffs-dark-modified-color,var(--diffs-modified-color,var(--diffs-modified-dark)))));--diffs-bg-deletion:var(--diffs-bg-deletion-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-deletion-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-deletion-base))));--diffs-bg-deletion-emphasis:var(--diffs-bg-deletion-emphasis-override,light-dark(rgb(from var(--diffs-deletion-base) r g b / .15),rgb(from var(--diffs-deletion-base) r g b / .2)));--diffs-bg-addition:var(--diffs-bg-addition-override,light-dark(color-mix(in lab, var(--diffs-bg) 88%, var(--diffs-addition-base)),color-mix(in lab, var(--diffs-bg) 80%, var(--diffs-addition-base))));--diffs-bg-addition-emphasis:var(--diffs-bg-addition-emphasis-override,light-dark(rgb(from var(--diffs-addition-base) r g b / .15),rgb(from var(--diffs-addition-base) r g b / .2)));--diffs-selection-base:var(--diffs-modified-base);--diffs-selection-number-fg:light-dark(color-mix(in lab, var(--diffs-selection-base) 65%, var(--diffs-mixer)),color-mix(in lab, var(--diffs-selection-base) 75%, var(--diffs-mixer)));background-color:var(--diffs-bg);color:var(--diffs-fg);display:block}pre,code,[data-error-wrapper]{isolation:isolate;font-family:var(--diffs-font-family,var(--diffs-font-fallback));outline:none;margin:0;padding:0;display:block}pre,code{background-color:var(--diffs-bg)}code{contain:content}input,button{font-family:inherit;font-size:inherit;line-height:inherit}*,:before,:after{box-sizing:border-box}[data-icon-sprite]{display:none}[data-diffs-header],[data-separator]{font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback))}[data-diffs-header][data-sticky]{z-index:1;background-color:var(--diffs-bg);position:sticky;top:0}[data-file-info]{color:var(--fg);background-color:color-mix(in lab, var(--bg) 98%, var(--fg));border-block:1px solid color-mix(in lab, var(--bg) 95%, var(--fg));padding:10px;font-weight:700}[data-diff],[data-file]{--diffs-grid-number-column-width:minmax(min-content, max-content);--diffs-code-grid:var(--diffs-grid-number-column-width) 1fr;&[data-dehydrated]{--diffs-code-grid:var(--diffs-grid-number-column-width) minmax(0, 1fr)}&:hover [data-code]::-webkit-scrollbar-thumb{background-color:var(--diffs-bg-context)}}@supports (-webkit-touch-callout:none){:host{--diffs-scrollbar-gutter-fallback:0px}}[data-line] span,[data-edit-prediction-suffix] span{color:light-dark(var(--diffs-token-light,var(--diffs-light)),var(--diffs-token-dark,var(--diffs-dark)));background-color:light-dark(var(--diffs-token-light-bg,inherit),var(--diffs-token-dark-bg,inherit));font-weight:light-dark(var(--diffs-token-light-font-weight,inherit),var(--diffs-token-dark-font-weight,inherit));font-style:light-dark(var(--diffs-token-light-font-style,inherit),var(--diffs-token-dark-font-style,inherit));text-decoration:light-dark(var(--diffs-token-light-text-decoration,inherit),var(--diffs-token-dark-text-decoration,inherit))}[data-line],[data-gutter-buffer],[data-column-number],[data-line-annotation],[data-no-newline],[data-merge-conflict],[data-merge-conflict-actions],[data-editor-overlay]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-computed-diff-line-bg:var(--diffs-computed-decoration-bg);--diffs-computed-selected-line-bg:var(--diffs-computed-diff-line-bg);--diffs-computed-editor-active-line-bg:var(--diffs-computed-selected-line-bg);--diffs-computed-hovered-line-bg:var(--diffs-computed-editor-active-line-bg);--diffs-hover-mix-target:var(--diffs-bg-hover-override,var(--diffs-mixer));--diffs-line-bg:var(--diffs-computed-hovered-line-bg);color:var(--diffs-fg);background-color:var(--diffs-line-bg,var(--diffs-bg))}[data-line],[data-no-newline]{&[data-decoration-bg]{--mix-deco-light:92%;--mix-deco-dark:85%;&[data-decoration-bg-depth="2"]{--mix-deco-light:88%;--mix-deco-dark:80%}&[data-decoration-bg-depth="3"]{--mix-deco-light:85%;--mix-deco-dark:78%}--diffs-hover-mix-target:var(--diffs-decoration-bg);--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) var(--mix-deco-light), var(--diffs-decoration-bg)),color-mix(in lab, var(--diffs-bg) var(--mix-deco-dark), var(--diffs-decoration-bg)))}}[data-line-annotation],[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context);--diffs-computed-decoration-bg:var(--diffs-annotation-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-merge-conflict-actions],[data-gutter-buffer=merge-conflict-action],[data-gutter-buffer=merge-conflict-marker-base],[data-gutter-buffer=merge-conflict-marker-separator],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator]{--diffs-computed-decoration-bg:var(--diffs-bg-context);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-start],[data-merge-conflict=marker-start]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-current-header-override,var(--diffs-addition-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-gutter-buffer=merge-conflict-marker-end],[data-merge-conflict=marker-end]{--diffs-computed-decoration-bg:light-dark(color-mix(in lab, var(--diffs-bg) 78%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))),color-mix(in lab, var(--diffs-bg) 68%, var(--conflict-bg-incoming-header-override,var(--diffs-modified-base))));--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}[data-has-merge-conflict] [data-line-annotation],[data-has-merge-conflict] [data-gutter-buffer=annotation]{--diffs-computed-decoration-bg:var(--diffs-bg);--diffs-hover-mix-target:var(--diffs-computed-editor-active-line-bg)}:where([data-background]){& [data-gutter-buffer],& [data-column-number]{--mix-light:91%;--mix-dark:85%}& [data-line],& [data-no-newline]{--mix-light:88%;--mix-dark:80%}& [data-gutter-buffer],& [data-column-number],& [data-line],& [data-no-newline]{--diffs-diff-line-mix-target:var(--diffs-bg);&[data-line-type=change-deletion]{--diffs-diff-line-mix-target:var(--diffs-bg-deletion-override,var(--diffs-deletion-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-deletion-override,var(--diffs-deletion-base));--diffs-diff-line-mix-target:var(--diffs-bg-deletion-number-override,var(--diffs-deletion-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-line-type=change-addition]{--diffs-diff-line-mix-target:var(--diffs-bg-addition-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--diffs-bg-addition-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=current]{--diffs-diff-line-mix-target:var(--conflict-bg-current-override,var(--diffs-addition-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-fg-number-addition-override,var(--diffs-addition-base));--diffs-diff-line-mix-target:var(--conflict-bg-current-number-override,var(--diffs-addition-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}&[data-merge-conflict=incoming]{--diffs-diff-line-mix-target:var(--conflict-bg-incoming-override,var(--diffs-modified-base));--diffs-hover-mix-target:var(--diffs-diff-line-mix-target);&:where([data-gutter-buffer],[data-column-number]){color:var(--diffs-modified-base);--diffs-diff-line-mix-target:var(--conflict-bg-incoming-number-override,var(--diffs-modified-base))}--diffs-computed-diff-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-light), var(--diffs-diff-line-mix-target)),color-mix(in lab, var(--diffs-computed-decoration-bg) var(--mix-dark), var(--diffs-diff-line-mix-target)))}}}[data-gutter-buffer],[data-column-number],[data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline],[data-editor-overlay]{--diffs-selection-mix-target:var(--diffs-bg-selection-override,var(--diffs-selection-base));--diffs-selection-emphasis-mix-target:var(--diffs-selection-mix-target);&:where([data-editor-overlay]),&:where([data-line],[data-line-annotation],[data-merge-conflict],[data-merge-conflict-actions],[data-no-newline])[data-selected-line]{--mix-selection-light:82%;--mix-selection-dark:75%;--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line])){--mix-selection-light:75%;--mix-selection-dark:60%;--diffs-selection-mix-target:var(--diffs-bg-selection-number-override,var(--diffs-selection-base));--diffs-hover-mix-target:var(--diffs-selection-mix-target)}&:where([data-line][data-selected-line]):is([data-line-type=change-addition],[data-line-type=change-deletion]){--diffs-selection-emphasis-mix-target:light-dark(color-mix(in lab, var(--diffs-diff-line-mix-target,var(--diffs-selection-mix-target)) var(--mix-selection-light), var(--diffs-selection-mix-target)),var(--diffs-selection-mix-target))}&:where([data-editor-overlay]),&[data-selected-line]{--diffs-computed-selected-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-light), var(--diffs-selection-mix-target)),color-mix(in lab, var(--diffs-computed-diff-line-bg) var(--mix-selection-dark), var(--diffs-selection-mix-target)))}}[data-line][data-editor-active-line],[data-column-number][data-editor-active-line]{--diffs-computed-editor-active-line-bg:color-mix(in lab, var(--diffs-computed-selected-line-bg) var(--diffs-editor-active-line-source-mix,100%), var(--diffs-selection-emphasis-mix-target))}@media (pointer:fine){[data-line][data-hovered],[data-gutter-buffer][data-hovered],[data-column-number][data-hovered],[data-line-annotation][data-hovered],[data-no-newline][data-hovered],[data-merge-conflict][data-hovered],[data-merge-conflict-actions][data-hovered],[data-editor-overlay][data-hovered]{--diffs-computed-hovered-line-bg:light-dark(color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 97%, var(--diffs-hover-mix-target)),color-mix(in lab, var(--diffs-computed-editor-active-line-bg) 91%, var(--diffs-hover-mix-target)))}}[data-gutter-buffer][data-selected-line],[data-column-number]:is([data-selected-line],[data-editor-active-line]){color:var(--diffs-selection-number-fg)}[data-no-newline]{user-select:none;& span{opacity:.6}}[data-diff-type=split][data-overflow=scroll]{grid-template-columns:1fr 1fr;display:grid;& [data-additions]{border-left:1px solid var(--diffs-bg)}& [data-deletions]{border-right:1px solid var(--diffs-bg)}}[data-code]{grid-auto-flow:dense;grid-template-columns:var(--diffs-code-grid);overflow:var(--diffs-overflow-override,scroll) clip;overscroll-behavior-x:none;tab-size:var(--diffs-tab-size,2);padding-top:var(--diffs-gap-block,var(--diffs-gap-fallback));padding-bottom:max(0px, calc(var(--diffs-gap-block,var(--diffs-gap-fallback)) - var(--diffs-scrollbar-gutter)));scrollbar-gutter:stable;align-self:flex-start;display:grid}[data-diffs-scrollbar-measure]{opacity:0;pointer-events:none;scrollbar-gutter:auto;grid-template-columns:none;width:100px;height:100px;padding:0;position:absolute;top:-200px;left:-200px}[data-container-size]{container-type:inline-size}[data-code]::-webkit-scrollbar{width:0;height:var(--diffs-scrollbar-gutter)}[data-code]::-webkit-scrollbar-track{background:0 0}[data-code]::-webkit-scrollbar-thumb{background-color:#0000;background-clip:content-box;border:1px solid #0000;border-radius:3px}[data-code]::-webkit-scrollbar-corner{background-color:#0000}@supports ((-moz-appearance:none)){[data-code]{scrollbar-width:thin;scrollbar-color:var(--diffs-bg-context) transparent;padding-bottom:var(--diffs-gap-block,var(--diffs-gap-fallback))}}[data-diffs-header]~[data-diff],[data-diffs-header]~[data-file]{& [data-code],&[data-overflow=wrap],&[data-dehydrated][data-diff-type=split][data-overflow=scroll]{padding-top:0}}[data-gutter]{grid-template-rows:subgrid;grid-template-columns:subgrid;z-index:3;background-color:var(--diffs-bg);grid-column:1;display:grid;position:relative;& [data-gutter-buffer],& [data-column-number]{border-right:var(--diffs-gap-style,2px solid var(--diffs-bg))}}[data-content]{grid-template-rows:subgrid;grid-template-columns:subgrid;background-color:var(--diffs-bg);grid-column:2;min-width:0;display:grid}[data-diff-type=split][data-overflow=wrap],[data-dehydrated][data-diff-type=split][data-overflow=scroll]{grid-auto-flow:dense;grid-template-columns:repeat(2, var(--diffs-code-grid));padding-block:var(--diffs-gap-block,var(--diffs-gap-fallback));display:grid;& [data-code]{display:contents}& [data-deletions]{& [data-gutter]{grid-column:1}& [data-content]{border-right:1px solid var(--diffs-bg);grid-column:2}}& [data-additions]{& [data-gutter]{border-left:1px solid var(--diffs-bg);grid-column:3}& [data-content]{grid-column:4}}}[data-dehydrated][data-diff-type=split][data-overflow=scroll] [data-content]{overflow:clip}[data-overflow=scroll] [data-gutter]{position:sticky;left:0}[data-interactive-lines] [data-line]{cursor:pointer}[data-interactive-line-numbers] [data-column-number]{cursor:pointer;touch-action:none}[data-content-buffer],[data-gutter-buffer]{user-select:none;min-height:1lh;position:relative}[data-gutter-buffer]{padding-left:2ch;padding-right:1ch;&:before{content:"";min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));display:block}}[data-gutter-buffer=annotation]{--diffs-annotation-bg:var(--diffs-bg-context-gutter);min-height:0}[data-gutter-buffer=buffer]{--diffs-line-bg:var(--diffs-bg-context-gutter)}[data-content-buffer]{background-position:5px 0;background-size:8px 8px;background-origin:border-box;background-image:repeating-linear-gradient(-45deg, transparent, transparent calc(3px * 1.414), var(--diffs-bg-buffer) calc(3px * 1.414), var(--diffs-bg-buffer) calc(4px * 1.414));grid-column:1}[data-separator]{box-sizing:content-box;background-color:var(--diffs-bg)}[data-separator=simple]{min-height:4px}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata],[data-separator=simple]{background-color:var(--diffs-bg-separator)}[data-separator=line-info],[data-separator=line-info-basic],[data-separator=metadata]{height:32px;position:relative}[data-separator-wrapper]{user-select:none;fill:currentColor;background-color:var(--diffs-bg);align-items:center;height:100%;display:flex;position:absolute;inset-inline:0}[data-content] [data-separator-wrapper]{display:none}[data-separator=metadata] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;color:var(--diffs-fg-number);white-space:nowrap;text-overflow:ellipsis;min-width:min-content;padding-inline:1ch;inset-inline:100% auto;overflow:hidden}[data-separator=line-info]{margin-block:var(--diffs-gap-block,var(--diffs-gap-fallback));& [data-separator-wrapper]{min-width:16px}}[data-separator=line-info-basic],[data-separator=metadata]{margin-block:0}[data-separator=line-info][data-separator-first]{margin-top:0}[data-separator=line-info][data-separator-last]{margin-bottom:0}[data-expand-index] [data-separator-wrapper]{grid-template-columns:32px auto;display:grid}[data-expand-index] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:32px 32px auto}[data-expand-button],[data-separator-content]{background-color:var(--diffs-bg-separator);flex:none;align-items:center;display:flex}[data-expand-index] [data-separator-content]:hover{cursor:pointer;text-decoration:underline}[data-expand-button]{cursor:pointer;min-width:32px;color:var(--diffs-fg-number);border-right:2px solid var(--diffs-bg);flex-shrink:0;justify-content:center;align-self:stretch;&:hover{color:var(--diffs-fg)}&[data-expand-all-button]{display:none}}[data-expand-down] [data-icon]{transform:scaleY(-1)}[data-separator-content]{height:100%;color:var(--diffs-fg-number);flex:auto;justify-content:flex-start;padding:0 1ch;overflow:hidden}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-content]{user-select:none;height:100%;overflow:clip}}[data-unmodified-lines]{text-overflow:ellipsis;white-space:nowrap;flex:0 auto;min-width:0;display:block;overflow:hidden}@supports (width:1cqi){[data-unified]{& [data-separator=line-info] [data-separator-wrapper]{padding-inline:var(--diffs-gap-inline,var(--diffs-gap-fallback));width:100cqi;& [data-separator-content]{border-radius:6px}}& [data-separator=line-info][data-expand-index] [data-separator-wrapper] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-gutter]{& [data-separator=line-info] [data-separator-wrapper]{padding-left:var(--diffs-gap-inline,var(--diffs-gap-fallback))}& [data-separator=line-info] [data-separator-content]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-separator=line-info][data-expand-index] [data-separator-content]{border-top-left-radius:unset;border-bottom-left-radius:unset}}[data-additions]{& [data-content] [data-separator=line-info]{background-color:var(--diffs-bg);& [data-separator-wrapper]{display:none}}& [data-gutter] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);border-top-right-radius:6px;border-bottom-right-radius:6px;height:100%;display:block;& [data-separator-content],& [data-expand-button]{display:none}}}[data-overflow=scroll] [data-additions] [data-gutter] [data-separator=line-info] [data-separator-wrapper]{width:calc(100cqi - var(--diffs-gap-inline,var(--diffs-gap-fallback)))}[data-overflow=wrap] [data-additions] [data-content] [data-separator=line-info] [data-separator-wrapper]{background-color:var(--diffs-bg-separator);height:100%;margin-right:var(--diffs-gap-inline,var(--diffs-gap-fallback));border-top-right-radius:6px;border-bottom-right-radius:6px;display:block;& [data-separator-content],& [data-expand-button]{display:none}}[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}}@media (pointer:fine){[data-separator=line-info] [data-separator-wrapper]{&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:unset}& [data-expand-down]{border-bottom-left-radius:6px;border-top-left-radius:unset}}}}}@media (pointer:coarse){[data-separator=line-info-basic] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px 34px auto;& [data-separator-content]{grid-column:unset;grid-row:unset}}@supports (width:1cqi){[data-separator=line-info] [data-separator-wrapper]{& [data-expand-both],& [data-expand-down],& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}&[data-separator-multi-button]{& [data-expand-up]{border-top-left-radius:6px;border-bottom-left-radius:6px}& [data-expand-down]{border-bottom-left-radius:unset;border-top-left-radius:unset}}}}}@media (pointer:fine){[data-separator-wrapper][data-separator-multi-button]{grid-template-rows:50% 50%;display:grid;& [data-separator-content]{grid-area:1/2/-1;min-width:min-content}& [data-expand-button]{grid-column:1}}[data-separator=line-info] [data-separator-wrapper],[data-separator=line-info] [data-separator-wrapper][data-separator-multi-button]{grid-template-columns:34px auto}[data-separator=line-info-basic][data-expand-index] [data-separator-wrapper]{grid-template-columns:100% auto}[data-separator=line-info],[data-separator=line-info-basic]{& [data-separator-multi-button]{& [data-expand-up]{border-bottom:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}& [data-expand-down]{border-top:1px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg)}}}}[data-additions] [data-gutter] [data-separator-wrapper],[data-additions] [data-separator=line-info-basic] [data-separator-wrapper],[data-content] [data-separator-wrapper]{display:none}[data-line-annotation]{min-height:var(--diffs-annotation-min-height,0);z-index:2}[data-merge-conflict-actions]{z-index:2}[data-separator=custom]{grid-template-columns:subgrid;display:grid}[data-line],[data-column-number],[data-no-newline]{padding-inline:1ch;position:relative}[data-indicators=classic] [data-line]{padding-inline-start:2ch}[data-indicators=classic]{& [data-line-type=change-addition],& [data-line-type=change-deletion]{&[data-no-newline],&[data-line]{&:before{user-select:none;width:1ch;height:1lh;display:inline-block;position:absolute;top:0;left:0}}}& [data-line-type=change-addition]{&[data-line],&[data-no-newline]{&:before{content:"+";color:var(--diffs-addition-base)}}}& [data-line-type=change-deletion]{&[data-line],&[data-no-newline]{&:before{content:"-";color:var(--diffs-deletion-base)}}}}[data-indicators=bars]{& [data-line-type=change-deletion],& [data-line-type=change-addition]{&[data-column-number]{&:before{content:"";user-select:none;contain:strict;width:4px;height:100%;display:block;position:absolute;top:0;left:0}}}& [data-line-type=change-deletion]{&[data-column-number]{&:before{background-image:linear-gradient(0deg, var(--diffs-bg-deletion) 50%, var(--diffs-deletion-base) 50%);background-repeat:repeat;background-size:2px 2px;background-size:calc(1lh / round(1lh / 2px)) calc(1lh / round(1lh / 2px))}}}& [data-line-type=change-addition]{&[data-column-number]{&:before{background-color:var(--diffs-addition-base)}}}}[data-overflow=wrap]{& [data-line]{white-space:pre-wrap;word-break:break-word}& [data-annotation-content]{word-break:break-word}}[data-overflow=scroll] [data-line]{white-space:pre;min-height:1lh}[data-column-number]{box-sizing:content-box;text-align:right;user-select:none;color:var(--diffs-fg-number);padding-left:2ch}[data-line-number-content]{min-width:var(--diffs-min-number-column-width,var(--diffs-min-number-column-width-default,3ch));z-index:1;display:inline-block;position:relative}[data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{min-width:4px;padding:0;&:before{min-width:0}}& [data-line-number-content]{display:none}& [data-gutter-utility-slot]{right:unset;justify-content:flex-start;left:0}&[data-indicators=bars] [data-gutter-utility-slot]{left:6px}}[data-file][data-disable-line-numbers]{& [data-gutter-buffer],& [data-column-number]{border-right:0;min-width:0}}[data-diff-span]{box-decoration-break:clone;border-radius:3px}[data-line-type=change-addition] [data-diff-span]{background-color:var(--diffs-bg-addition-emphasis)}[data-line-type=change-deletion] [data-diff-span]{background-color:var(--diffs-bg-deletion-emphasis)}[data-merge-conflict=marker-start],[data-merge-conflict=marker-base],[data-merge-conflict=marker-separator],[data-merge-conflict=marker-end]{color:var(--diffs-fg);padding-left:1ch}[data-merge-conflict=marker-start],[data-merge-conflict=marker-end]{align-items:center;display:flex;&:after{color:var(--diffs-fg-conflict-marker);font-size:.75rem;font-style:normal;line-height:1.25rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));padding-left:1ch}}[data-merge-conflict=marker-start]:after{content:"(Current Change)"}[data-merge-conflict=marker-end]:after{content:"(Incoming Change)"}[data-merge-conflict-actions-content]{min-height:1.75rem;font-family:var(--diffs-header-font-family,var(--diffs-header-font-fallback));color:var(--diffs-fg);align-items:center;gap:.25rem;padding-inline:.5rem;font-size:.75rem;line-height:1.2;display:flex}[data-merge-conflict-action]{appearance:none;color:var(--diffs-fg-number);font:inherit;cursor:pointer;background:0 0;border:0;padding:0;font-style:normal}[data-merge-conflict-action]:hover{color:var(--diffs-fg)}[data-merge-conflict-action=current]:hover{color:var(--diffs-addition-base)}[data-merge-conflict-action=incoming]:hover{color:var(--diffs-modified-base)}[data-merge-conflict-action-separator]{color:var(--diffs-fg-number);opacity:.6;user-select:none}[data-diffs-header=default]{background-color:var(--diffs-bg);justify-content:space-between;align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));min-height:calc(1lh + (var(--diffs-gap-block,var(--diffs-gap-fallback)) * 3));z-index:2;flex-direction:row;padding-inline:16px;display:flex;position:relative;top:0}[data-header-content]{align-items:center;gap:var(--diffs-gap-inline,var(--diffs-gap-fallback));white-space:nowrap;flex-direction:row;min-width:0;display:flex}[data-header-content] [data-prev-name],[data-header-content] [data-title]{text-overflow:ellipsis;white-space:nowrap;direction:rtl;min-width:0;overflow:hidden}[data-prev-name]{opacity:.7}[data-rename-icon]{fill:currentColor;flex-grow:0;flex-shrink:0}[data-diffs-header=default] [data-metadata]{white-space:nowrap;align-items:center;gap:1ch;display:flex}[data-diffs-header=default] [data-additions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-addition-base)}[data-diffs-header=default] [data-deletions-count]{font-family:var(--diffs-font-family,var(--diffs-font-fallback));color:var(--diffs-deletion-base)}[data-change-icon]{fill:currentColor;flex-shrink:0}[data-change-icon=change],[data-change-icon=rename-pure],[data-change-icon=rename-changed]{color:var(--diffs-modified-base)}[data-change-icon=new]{color:var(--diffs-addition-base)}[data-change-icon=deleted]{color:var(--diffs-deletion-base)}[data-change-icon=file]{opacity:.6}[data-annotation-content]{z-index:2;isolation:isolate;white-space:normal;align-self:flex-start;min-width:0;display:flow-root;position:relative}[data-overflow=scroll] [data-annotation-content],[data-overflow=scroll] [data-merge-conflict-actions-content]{width:var(--diffs-column-content-width,auto);left:var(--diffs-column-number-width,0);position:sticky}[data-annotation-slot]{text-wrap-mode:wrap;word-break:normal;white-space-collapse:collapse}[data-gutter-utility-slot]{touch-action:none;justify-content:flex-end;display:flex;position:absolute;top:0;bottom:0;right:0}[data-utility-button]{appearance:none;cursor:pointer;width:1lh;height:1lh;font-size:var(--diffs-font-size,13px);line-height:var(--diffs-line-height,20px);background-color:var(--diffs-modified-base);color:var(--diffs-bg);fill:currentColor;z-index:4;touch-action:none;border:none;border-radius:4px;justify-content:center;align-items:center;margin-right:calc(-1lh + 1ch);padding:0;display:flex;position:relative;&:before{content:"";display:block;position:absolute;inset:0 0 0 -4px}}[data-decoration-bar-stack]{pointer-events:none;isolation:isolate;z-index:1;background-color:var(--diffs-decoration-bar-color,transparent);box-sizing:content-box;border-left:2px solid var(--diffs-bg);border-right:2px solid var(--diffs-bg);width:6px;position:absolute;top:0;bottom:0;right:-2px;[data-decoration-bar-depth="1"] &{background-color:color-mix(in lab, var(--diffs-bg) 20%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="2"] &{background-color:color-mix(in lab, var(--diffs-bg) 45%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-depth="3"] &{background-color:color-mix(in lab, var(--diffs-bg) 65%, var(--diffs-decoration-bar-color,transparent))}[data-decoration-bar-start] &{border-top-left-radius:5px;border-top-right-radius:5px}[data-decoration-bar-end] &{z-index:3;border-bottom-right-radius:5px;border-bottom-left-radius:5px}}[data-placeholder]{contain:strict}[data-error-wrapper]{padding:var(--diffs-gap-block,var(--diffs-gap-fallback)) var(--diffs-gap-inline,var(--diffs-gap-fallback));scrollbar-width:none;max-height:400px;overflow:auto;& [data-error-message]{color:var(--diffs-deletion-base);font-size:18px;font-weight:700}& [data-error-stack]{color:var(--diffs-fg-number)}}}@layer theme,rendered,unsafe;
|
|
127
|
+
`;let Ot;function zi(e){if(Ot!=null)return Ot;const t=e.host;if(typeof HTMLElement<"u"&&t instanceof HTMLElement&&!t.isConnected)return;const i=document.createElement("div");i.setAttribute("data-code",""),i.setAttribute(Ao,"true");const n=document.createElement("div");return n.style.position="relative",n.style.width="200%",n.style.height="200%",i.appendChild(n),e.appendChild(i),Ot=Math.max(i.offsetHeight-i.clientHeight,0),i.remove(),Ot}function Rr(e){const t=e==null?"var(--diffs-scrollbar-gutter-fallback)":`${e}px`;return`${pr}: ${t};`}const Ar="@layer base, theme, rendered, unsafe;",Vs=new RegExp(`${js(pr)}\\s*:\\s*[^;]+;`);function Ws(e){return`${Ar}
|
|
128
128
|
@layer unsafe {
|
|
129
129
|
${e}
|
|
130
130
|
}`}function Gs(e,t="system",i){const n=t==="system"?"":`
|
|
@@ -134,10 +134,10 @@ var vo=Object.defineProperty;var bo=(e,t,i)=>t in e?vo(e,t,{enumerable:!0,config
|
|
|
134
134
|
${r}
|
|
135
135
|
${e}
|
|
136
136
|
}
|
|
137
|
-
}`}function $s(e,t){const i=Rr(t);return e.replace(Vs,i)}function js(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const qs=new WeakMap;function qi(e){const t=qs.get(e);return t??e}function Si({code:e,pre:t,columnType:i,rowSpan:n,containerSize:r=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),i!=null&&e.setAttribute(`data-${i}`,""),t?.appendChild(e)),n!=null?e.style.setProperty("grid-row",`span ${n}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function Ks(e,t){if(t==null)return;const i=e.shadowRoot??e.attachShadow({mode:"open"});i.innerHTML===""&&(i.innerHTML=t)}function Xs(e,{type:t,diffIndicators:i,disableBackground:n,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const h in a){const d=a[h];d!=null&&e.setAttribute(h,`${d}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),i){case"bars":case"classic":e.setAttribute("data-indicators",i);break;case"none":e.removeAttribute("data-indicators")}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),n?e.removeAttribute("data-background"):e.setAttribute("data-background",""),t==="diff"?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Mn(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}function In(e,t,i){const n=new Map;for(const r of e){const o=qi(r);n.set(o,i?.slotNames.get(o)??t(r))}return{provided:e,current:e,slotNames:n}}function Ys(e,t,i){for(const n of t){const r=qi(n);e.slotNames.has(r)||e.slotNames.set(r,i(n))}e.provided=t,e.current=t}function Qs(e,t,i){if(e==null)return i(t);const n=qi(t);let r=e.slotNames.get(n);return r==null&&(r=i(t),e.slotNames.set(n,r)),r}function Js(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Fn(e,t){const i=e?.offsetHeight??0;if(e==null||i===0){t();return}e.style.minHeight=`${i}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}function Zs({shadowRoot:e,currentNode:t,themeCSS:i}){if(i.trim()===""){t?.remove();return}return t??=ea(),t.textContent=i,t.parentNode!==e&&e.appendChild(t),t}function ea(){const e=document.createElement("style");return e.setAttribute(
|
|
138
|
-
`,v:"\v",f:"\f",r:"\r"};function ga(e){if(e[0]!=='"')return;let t="",i=1;for(;i<e.length;){const n=e[i];if(n==='"')return{fileName:t,rawLength:i+1};if(n!=="\\"){t+=n,i++;continue}const r=pa[e[i+1]];if(r!=null){t+=r,i+=2;continue}const o=[];do{const s=ma(e,i+1);if(s==null)return;o.push(s),i+=4}while(e[i]==="\\"&&e[i+1]>="0"&&e[i+1]<="7");t+=ca.decode(new Uint8Array(o))}}function ma(e,t){const i=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(i>=0&&i<=3&&n>=0&&n<=7&&r>=0&&r<=7)return i*64+n*8+r}const va=4096,ba=.5;function Sa(e){for(const t of e.hunks)for(let i=0;i<t.hunkContent.length;i++){const n=t.hunkContent[i];if(n.type!=="change")continue;const r=Ca(e,n);r!=null&&(t.hunkContent.splice(i,1,...r),i+=r.length-1)}}function ya(e,t,i){const{hunkContent:n}=e;for(let r=1;r<n.length;r++){const o=n[r],s=n[r-1];if(o.type!=="change"||o.additions>0&&o.deletions>0||s.type!=="context")continue;const l=o.additions>0,a=l?t.additionLines:t.deletionLines,h=l?o.additionLineIndex:o.deletionLineIndex,d=l?o.additions:o.deletions,f=a[h]??"";if(f.trim()!=="")continue;let p=!0;for(let b=1;b<d;b++)if(a[h+b]!==f){p=!1;break}if(!p)continue;let c=0;for(;c<s.lines&&t.additionLines[s.additionLineIndex+s.lines-1-c]===f;)c++;if(c===0||r===1&&c===s.lines||i!=null&&(c=i(o,c),c===0))continue;o.additionLineIndex-=c,o.deletionLineIndex-=c;const m=o.additionLineIndex+o.additions,g=o.deletionLineIndex+o.deletions,S=n[r+1];S?.type==="context"?(S.lines+=c,S.additionLineIndex=m,S.deletionLineIndex=g):n.splice(r+1,0,{type:"context",lines:c,additionLineIndex:m,deletionLineIndex:g}),s.lines-=c,s.lines===0&&(n.splice(r-1,1),r--)}}function Ca(e,t){const{deletions:i,additions:n,deletionLineIndex:r,additionLineIndex:o}=t,s=Math.min(i,n),l=Math.abs(n-i);if(s===0||l===0||s*(l+1)>va)return null;const a=[];for(let g=0;g<i;g++)a.push(Pn(e.deletionLines[r+g]??""));const h=[];for(let g=0;g<n;g++)h.push(Pn(e.additionLines[o+g]??""));const d=n>i;let f=0,p=-1;for(let g=0;g<=l;g++){let S=0;for(let b=0;b<s;b++)S+=La(a[b+(d?0:g)],h[b+(d?g:0)]);g===0?p=S+s*ba:S>p&&(p=S,f=g)}if(f===0)return null;const c=[],m=(g,S,b,y)=>{(g>0||S>0)&&c.push({type:"change",deletions:g,additions:S,deletionLineIndex:b,additionLineIndex:y})};return d?(m(0,f,r,o),m(s,s,r,o+f),m(0,n-s-f,r+s,o+f+s)):(m(f,0,r,o),m(s,s,r+f,o),m(i-s-f,0,r+f+s,o+s)),c}const xa=/\s+/g;function Pn(e){return e.replace(xa,"")}function La(e,t){if(e===t)return 1;const i=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let r=0;for(;r<n&&e[r]===t[r];)r++;let o=0;for(;o<n-r&&e[e.length-1-o]===t[t.length-1-o];)o++;return(r+o)/i}const wa=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function ka(e,t,i=!1,n){const r=Na(e),o=r?Ha(e):Ta(e);let s;const l=[];for(const a of o){if(r&&!gr.test(a)){if(s==null)s=te(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}else if(!r&&!Da(a)){if(s==null)s=te(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}const h=Ir(a,{cacheKey:t!=null?n==null?Zt("patch-file",t,String(l.length)):Zt("patch-file",t,String(n),String(l.length)):void 0,isGitDiff:r,throwOnError:i});h!=null&&l.push(h)}return{patchMetadata:s,files:l}}function Ea(e,t){try{return Ir(e,t)}finally{Mr()}}function Ir(e,{cacheKey:t,isGitDiff:i=gr.test(e),oldFile:n,newFile:r,throwOnError:o=!1}={}){let s=0;const l=zr(e,"@@ ");let a;const h=n==null||r==null;let d=0,f=0;for(const p of l){const c=Fr(p),m=c[0];if(m==null){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}const g=Pr(m);let S=0,b=0;if(g==null||a==null){if(a!=null){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:h,additionLines:!h&&n!=null&&r!=null?zn(r.contents):[],deletionLines:!h&&n!=null&&r!=null?zn(n.contents):[],cacheKey:On(t)},a.additionLines.length===1&&r?.contents===""&&(a.additionLines.length=0),a.deletionLines.length===1&&n?.contents===""&&(a.deletionLines.length=0);for(const H of c){if(H.startsWith("diff --git")){const F=H.trim().match(wa);if(F==null){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",H);continue}const j=Ct(F[1],!0),N=Ct(F[2],!0);a.name=te(N),j!==N&&(a.prevName=te(j));continue}const T=H.startsWith("---")||H.startsWith("+++")?H.match(
|
|
137
|
+
}`}function $s(e,t){const i=Rr(t);return e.replace(Vs,i)}function js(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}const qs=new WeakMap;function qi(e){const t=qs.get(e);return t??e}function Si({code:e,pre:t,columnType:i,rowSpan:n,containerSize:r=!1}={}){return e==null&&(e=document.createElement("code"),e.setAttribute("data-code",""),i!=null&&e.setAttribute(`data-${i}`,""),t?.appendChild(e)),n!=null?e.style.setProperty("grid-row",`span ${n}`):e.style.removeProperty("grid-row"),r?e.setAttribute("data-container-size",""):e.removeAttribute("data-container-size"),e}function Ks(e,t){if(t==null)return;const i=e.shadowRoot??e.attachShadow({mode:"open"});i.innerHTML===""&&(i.innerHTML=t)}function Xs(e,{type:t,diffIndicators:i,disableBackground:n,disableLineNumbers:r,overflow:o,split:s,totalLines:l,customProperties:a}){if(a!=null)for(const h in a){const d=a[h];d!=null&&e.setAttribute(h,`${d}`)}switch(t==="diff"?(e.setAttribute("data-diff",""),e.removeAttribute("data-file")):(e.setAttribute("data-file",""),e.removeAttribute("data-diff")),i){case"bars":case"classic":e.setAttribute("data-indicators",i);break;case"none":e.removeAttribute("data-indicators")}return r?e.setAttribute("data-disable-line-numbers",""):e.removeAttribute("data-disable-line-numbers"),n?e.removeAttribute("data-background"):e.setAttribute("data-background",""),t==="diff"?e.setAttribute("data-diff-type",s?"split":"single"):e.removeAttribute("data-diff-type"),e.setAttribute("data-overflow",o),e.style.setProperty("--diffs-min-number-column-width-default",`${`${l}`.length}ch`),e}function Mn(e){if(typeof HTMLStyleElement<"u"&&e instanceof HTMLStyleElement)return!0;const t=e.tagName??e.nodeName;return typeof t=="string"&&t.toLowerCase()==="style"}function In(e,t,i){const n=new Map;for(const r of e){const o=qi(r);n.set(o,i?.slotNames.get(o)??t(r))}return{provided:e,current:e,slotNames:n}}function Ys(e,t,i){for(const n of t){const r=qi(n);e.slotNames.has(r)||e.slotNames.set(r,i(n))}e.provided=t,e.current=t}function Qs(e,t,i){if(e==null)return i(t);const n=qi(t);let r=e.slotNames.get(n);return r==null&&(r=i(t),e.slotNames.set(n,r)),r}function Js(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function Fn(e,t){const i=e?.offsetHeight??0;if(e==null||i===0){t();return}e.style.minHeight=`${i}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=""}}function Zs({shadowRoot:e,currentNode:t,themeCSS:i}){if(i.trim()===""){t?.remove();return}return t??=ea(),t.textContent=i,t.parentNode!==e&&e.appendChild(t),t}function ea(){const e=document.createElement("style");return e.setAttribute(Ho,""),e}let ta;function ia(){return ta??="safari"in window&&"pushNotification"in window.safari||/^((?!chrome|android).)*safari/i.test(navigator.userAgent)}if(typeof HTMLElement<"u"&&customElements.get("diffs-container")==null){let e;class t extends HTMLElement{constructor(){if(super(),this.shadowRoot!=null)return;const n=this.attachShadow({mode:"open"});e==null&&(e=new CSSStyleSheet,e.replaceSync(Bs)),n.adoptedStyleSheets=[e]}connectedCallback(){const n=this.shadowRoot??this.attachShadow({mode:"open"});zi(n)}}customElements.define(To,t)}function Hr(e){return e.map(t=>({...t,hunkContent:t.hunkContent.map(i=>({...i}))}))}function Tr(e){return{...e,hunks:Hr(e.hunks),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}const na=1;function Zt(e,...t){return`ck${na}:${JSON.stringify([e,...t])}`}function ei(e){return e!==""?e.split(Do):[]}function Ui(e,t,i){const n=e==="clone"?Tr(t):t;if(!n.isPartial)throw new Error("hydratePartialDiff: fileDiff must be partial");switch(n.type){case"change":case"rename-changed":return ra(n,sa(n,i),Nn(n,i));case"rename-pure":{const r=Nn(n,i);aa(n,i);const o=ei(r.contents);return n.isPartial=!1,n.deletionLines=o,n.additionLines=o,Dr(n,null,r),n}}throw new Error(`hydratePartialDiff: ${n.type} diffs cannot be hydrated from loaded files`)}function ra(e,t,i){const n=ei(t.contents),r=ei(i.contents),{hunks:o,splitLineCount:s,unifiedLineCount:l}=oa(e.hunks,r.length);return e.hunks=o,e.splitLineCount=s,e.unifiedLineCount=l,e.isPartial=!1,e.deletionLines=n,e.additionLines=r,Dr(e,t,i),e}function oa(e,t){let i=0,n=0,r=0;const o=[];for(const s of e){const l=Math.max(s.additionStart-1,0),a=Math.max(s.deletionStart-1,0);let h=l,d=a,f=0,p=0,c=0,m=0;const g=[];for(const b of s.hunkContent){if(b.type==="context"){g.push({...b,additionLineIndex:h,deletionLineIndex:d}),h+=b.lines,d+=b.lines,c+=b.lines,m+=b.lines;continue}g.push({...b,additionLineIndex:h,deletionLineIndex:d}),h+=b.additions,d+=b.deletions,f+=b.additions,p+=b.deletions,c+=Math.max(b.additions,b.deletions),m+=b.additions+b.deletions}const S=Math.max(Ze(s.additionStart,s.additionCount)-r,0);o.push({...s,collapsedBefore:S,additionLineIndex:l,deletionLineIndex:a,additionLines:f,deletionLines:p,hunkContent:g,splitLineStart:i+S,unifiedLineStart:n+S,splitLineCount:c,unifiedLineCount:m}),i+=S+c,n+=S+m,r=Ve(s.additionStart,s.additionCount)}if(o.length>0){const s=o[o.length-1],l=Ve(s.additionStart,s.additionCount),a=Math.max(t-l,0);i+=a,n+=a}return{hunks:o,splitLineCount:i,unifiedLineCount:n}}function sa(e,t){if(t.oldFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function Nn(e,t){if(t.newFile==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function aa(e,t){if(t.oldFile!==null)throw new Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function la(e,t,i){return e.cacheKey!=null?`${e.cacheKey}:hydrated`:da(t,i)}function Dr(e,t,i){const n=la(e,t,i);if(n==null){delete e.cacheKey;return}e.cacheKey=n}function da(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?Zt("hydrated-files",e.cacheKey,t.cacheKey):void 0:e?.cacheKey??t?.cacheKey}const ha=new TextEncoder,fa=new TextDecoder("utf-8",{ignoreBOM:!0}),ua=/[\uD800-\uDFFF]/,_i=1024;let ut=new Uint8Array(_i);function Mr(){ut.length!==_i&&(ut=new Uint8Array(_i))}function te(e){if(e.length===0)return e;if(ua.test(e))return JSON.parse(JSON.stringify(e));const t=e.length*3;ut.length<t&&(ut=new Uint8Array(t));const{written:i}=ha.encodeInto(e,ut);return fa.decode(ut.subarray(0,i))}const ca=new TextDecoder("utf-8",{ignoreBOM:!0}),pa={'"':'"',"\\":"\\",a:"\x07",b:"\b",t:" ",n:`
|
|
138
|
+
`,v:"\v",f:"\f",r:"\r"};function ga(e){if(e[0]!=='"')return;let t="",i=1;for(;i<e.length;){const n=e[i];if(n==='"')return{fileName:t,rawLength:i+1};if(n!=="\\"){t+=n,i++;continue}const r=pa[e[i+1]];if(r!=null){t+=r,i+=2;continue}const o=[];do{const s=ma(e,i+1);if(s==null)return;o.push(s),i+=4}while(e[i]==="\\"&&e[i+1]>="0"&&e[i+1]<="7");t+=ca.decode(new Uint8Array(o))}}function ma(e,t){const i=e.charCodeAt(t)-48,n=e.charCodeAt(t+1)-48,r=e.charCodeAt(t+2)-48;if(i>=0&&i<=3&&n>=0&&n<=7&&r>=0&&r<=7)return i*64+n*8+r}const va=4096,ba=.5;function Sa(e){for(const t of e.hunks)for(let i=0;i<t.hunkContent.length;i++){const n=t.hunkContent[i];if(n.type!=="change")continue;const r=Ca(e,n);r!=null&&(t.hunkContent.splice(i,1,...r),i+=r.length-1)}}function ya(e,t,i){const{hunkContent:n}=e;for(let r=1;r<n.length;r++){const o=n[r],s=n[r-1];if(o.type!=="change"||o.additions>0&&o.deletions>0||s.type!=="context")continue;const l=o.additions>0,a=l?t.additionLines:t.deletionLines,h=l?o.additionLineIndex:o.deletionLineIndex,d=l?o.additions:o.deletions,f=a[h]??"";if(f.trim()!=="")continue;let p=!0;for(let b=1;b<d;b++)if(a[h+b]!==f){p=!1;break}if(!p)continue;let c=0;for(;c<s.lines&&t.additionLines[s.additionLineIndex+s.lines-1-c]===f;)c++;if(c===0||r===1&&c===s.lines||i!=null&&(c=i(o,c),c===0))continue;o.additionLineIndex-=c,o.deletionLineIndex-=c;const m=o.additionLineIndex+o.additions,g=o.deletionLineIndex+o.deletions,S=n[r+1];S?.type==="context"?(S.lines+=c,S.additionLineIndex=m,S.deletionLineIndex=g):n.splice(r+1,0,{type:"context",lines:c,additionLineIndex:m,deletionLineIndex:g}),s.lines-=c,s.lines===0&&(n.splice(r-1,1),r--)}}function Ca(e,t){const{deletions:i,additions:n,deletionLineIndex:r,additionLineIndex:o}=t,s=Math.min(i,n),l=Math.abs(n-i);if(s===0||l===0||s*(l+1)>va)return null;const a=[];for(let g=0;g<i;g++)a.push(Pn(e.deletionLines[r+g]??""));const h=[];for(let g=0;g<n;g++)h.push(Pn(e.additionLines[o+g]??""));const d=n>i;let f=0,p=-1;for(let g=0;g<=l;g++){let S=0;for(let b=0;b<s;b++)S+=La(a[b+(d?0:g)],h[b+(d?g:0)]);g===0?p=S+s*ba:S>p&&(p=S,f=g)}if(f===0)return null;const c=[],m=(g,S,b,y)=>{(g>0||S>0)&&c.push({type:"change",deletions:g,additions:S,deletionLineIndex:b,additionLineIndex:y})};return d?(m(0,f,r,o),m(s,s,r,o+f),m(0,n-s-f,r+s,o+f+s)):(m(f,0,r,o),m(s,s,r+f,o),m(i-s-f,0,r+f+s,o+s)),c}const xa=/\s+/g;function Pn(e){return e.replace(xa,"")}function La(e,t){if(e===t)return 1;const i=Math.max(e.length,t.length),n=Math.min(e.length,t.length);if(n===0)return 0;let r=0;for(;r<n&&e[r]===t[r];)r++;let o=0;for(;o<n-r&&e[e.length-1-o]===t[t.length-1-o];)o++;return(r+o)/i}const wa=/^diff --git ("a\/(?:[^"\\]|\\.)*"|a\/.+?) ("b\/(?:[^"\\]|\\.)*"|b\/.+?)$/;function ka(e,t,i=!1,n){const r=Na(e),o=r?Ha(e):Ta(e);let s;const l=[];for(const a of o){if(r&&!gr.test(a)){if(s==null)s=te(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}else if(!r&&!Da(a)){if(s==null)s=te(a);else{if(i)throw Error("parsePatchContent: unknown file blob");console.error("parsePatchContent: unknown file blob:",a)}continue}const h=Ir(a,{cacheKey:t!=null?n==null?Zt("patch-file",t,String(l.length)):Zt("patch-file",t,String(n),String(l.length)):void 0,isGitDiff:r,throwOnError:i});h!=null&&l.push(h)}return{patchMetadata:s,files:l}}function Ea(e,t){try{return Ir(e,t)}finally{Mr()}}function Ir(e,{cacheKey:t,isGitDiff:i=gr.test(e),oldFile:n,newFile:r,throwOnError:o=!1}={}){let s=0;const l=zr(e,"@@ ");let a;const h=n==null||r==null;let d=0,f=0;for(const p of l){const c=Fr(p),m=c[0];if(m==null){if(o)throw Error("parsePatchContent: invalid hunk");console.error("parsePatchContent: invalid hunk",p);continue}const g=Pr(m);let S=0,b=0;if(g==null||a==null){if(a!=null){if(o)throw Error("parsePatchContent: Invalid hunk");console.error("parsePatchContent: Invalid hunk",p);continue}a={name:"",type:"change",hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:h,additionLines:!h&&n!=null&&r!=null?zn(r.contents):[],deletionLines:!h&&n!=null&&r!=null?zn(n.contents):[],cacheKey:On(t)},a.additionLines.length===1&&r?.contents===""&&(a.additionLines.length=0),a.deletionLines.length===1&&n?.contents===""&&(a.deletionLines.length=0);for(const H of c){if(H.startsWith("diff --git")){const F=H.trim().match(wa);if(F==null){if(o)throw Error("parsePatchContent: invalid git diff header");console.error("parsePatchContent: invalid git diff header",H);continue}const j=Ct(F[1],!0),N=Ct(F[2],!0);a.name=te(N),j!==N&&(a.prevName=te(j));continue}const T=H.startsWith("---")||H.startsWith("+++")?H.match(Io):null;if(T!=null){const[,F,j]=T,N=Ct(j,i);if(F==="---"&&N!=="/dev/null"){const B=te(N);a.prevName=B,a.name=B}else F==="+++"&&N!=="/dev/null"&&(a.name=te(N))}else if(i){if(H.startsWith("new mode ")&&(a.mode=te(H.slice(8).trim())),H.startsWith("old mode ")&&(a.prevMode=te(H.slice(8).trim())),H.startsWith("new file mode")&&(a.type="new",a.mode=te(H.slice(13).trim())),H.startsWith("deleted file mode")&&(a.type="deleted",a.mode=te(H.slice(17).trim())),H.startsWith("similarity index")&&(H.startsWith("similarity index 100%")?a.type="rename-pure":a.type="rename-changed"),H.startsWith("index ")){const[,F,j,N]=H.trim().match(Fo)??[];F!=null&&(a.prevObjectId=te(F)),j!=null&&(a.newObjectId=te(j)),N!=null&&(a.mode=te(N))}(H.startsWith("rename from ")||H.startsWith("copy from "))&&(a.prevName=te(Ct(H.slice(H.startsWith("rename")?12:10)))),(H.startsWith("rename to ")||H.startsWith("copy to "))&&(a.name=te(Ct(H.slice(H.startsWith("rename")?10:8))))}}continue}let y,x;for(;c.length>0&&(c[c.length-1]===`
|
|
139
139
|
`||c[c.length-1]==="\r"||c[c.length-1]===`\r
|
|
140
|
-
`||c[c.length-1]==="");)c.pop();const{additionStart:R,deletionStart:k}=g;d=h?d:k-1,f=h?f:R-1;const w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:R,additionLines:S,deletionCount:g.deletionCount,deletionStart:k,deletionLines:b,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:On(g.hunkContext),hunkSpecs:te(m),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let E=0,D=0;for(let H=1;H<c.length;H++){const T=c[H];if(E>=w.additionCount&&D>=w.deletionCount&&!T.startsWith("\\")){if(!(Ma(T)&&!Ia(T)))break;if(o)throw Error("parsePatchContent: hunk has more lines than expected")}const F=T[0];if(F!=="+"&&F!=="-"&&F!==" "&&F!=="\\"){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${F}", full line: "${T}"`),console.error("processFile: invalid rawLine:",T);continue}const j=Pa(F);if(j==="addition"){if(o&&E>=w.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const N=yi(T);(y==null||y.type!=="change")&&(y=Ci("change",d,f),w.hunkContent.push(y)),f++,E++,h&&a.additionLines.push(N),y.additions++,S++,x="addition"}else if(j==="deletion"){if(o&&D>=w.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const N=yi(T);(y==null||y.type!=="change")&&(y=Ci("change",d,f),w.hunkContent.push(y)),d++,D++,h&&a.deletionLines.push(N),y.deletions++,b++,x="deletion"}else if(j==="context"){if(o&&(D>=w.deletionCount||E>=w.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const N=yi(T);(y==null||y.type!=="context")&&(y=Ci("context",d,f),w.hunkContent.push(y)),f++,d++,E++,D++,h&&(a.deletionLines.push(N),a.additionLines.push(N)),y.lines++,x="context"}else if(j==="metadata"&&y!=null){if(y.type==="context"?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):x==="deletion"?w.noEOFCRDeletions=!0:x==="addition"&&(w.noEOFCRAdditions=!0),h&&(x==="addition"||x==="context")){const N=a.additionLines.length-1;N>=0&&(a.additionLines[N]=At(a.additionLines[N]))}if(h&&(x==="deletion"||x==="context")){const N=a.deletionLines.length-1;N>=0&&(a.deletionLines[N]=At(a.deletionLines[N]))}}}if(E!==w.additionCount||D!==w.deletionCount){if(o)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${m.trimEnd()}", declared old/new ${w.deletionCount}/${w.additionCount}, parsed old/new ${D}/${E}`);const H=Ze(w.additionStart,w.additionCount)+(E===0?0:1),T=Ze(w.deletionStart,w.deletionCount)+(D===0?0:1);if(!h){const F=H-w.additionStart,j=T-w.deletionStart;w.additionLineIndex+=F,w.deletionLineIndex+=j;for(const N of w.hunkContent)N.additionLineIndex+=F,N.deletionLineIndex+=j}w.additionStart=H,w.deletionStart=T,w.additionCount=E,w.deletionCount=D}w.additionLines=S,w.deletionLines=b,w.collapsedBefore=Math.max(Ze(w.additionStart,w.additionCount)-s,0),a.hunks.push(w),s=Ve(w.additionStart,w.additionCount);for(const H of w.hunkContent)H.type==="context"?(w.splitLineCount+=H.lines,w.unifiedLineCount+=H.lines):(w.splitLineCount+=Math.max(H.additions,H.deletions),w.unifiedLineCount+=H.deletions+H.additions);w.splitLineStart=a.splitLineCount+w.collapsedBefore,w.unifiedLineStart=a.unifiedLineCount+w.collapsedBefore,a.splitLineCount+=w.collapsedBefore+w.splitLineCount,a.unifiedLineCount+=w.collapsedBefore+w.unifiedLineCount}if(a!=null){if(o&&h&&!i&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!h&&a.additionLines.length>0&&a.deletionLines.length>0){const p=a.hunks[a.hunks.length-1],c=Ve(p.additionStart,p.additionCount),m=a.additionLines.length,g=Math.max(m-c,0);a.splitLineCount+=g,a.unifiedLineCount+=g}return i||(a.prevName!=null&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(n==null||n.contents==="")&&r!=null&&r.contents!==""?a.type="new":n!=null&&n.contents!==""&&(r==null||r.contents==="")&&(a.type="deleted")),a.type!=="rename-pure"&&a.type!=="rename-changed"&&(a.prevName=void 0),Sa(a),a}}function Ra(e,t,i=!1){const n=[],r=Aa(e)?e.split(
|
|
140
|
+
`||c[c.length-1]==="");)c.pop();const{additionStart:R,deletionStart:k}=g;d=h?d:k-1,f=h?f:R-1;const w={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:g.additionCount,additionStart:R,additionLines:S,deletionCount:g.deletionCount,deletionStart:k,deletionLines:b,deletionLineIndex:d,additionLineIndex:f,hunkContent:[],hunkContext:On(g.hunkContext),hunkSpecs:te(m),noEOFCRAdditions:!1,noEOFCRDeletions:!1};let E=0,D=0;for(let H=1;H<c.length;H++){const T=c[H];if(E>=w.additionCount&&D>=w.deletionCount&&!T.startsWith("\\")){if(!(Ma(T)&&!Ia(T)))break;if(o)throw Error("parsePatchContent: hunk has more lines than expected")}const F=T[0];if(F!=="+"&&F!=="-"&&F!==" "&&F!=="\\"){if(o)throw Error("parsePatchContent: invalid hunk line");console.error(`parseLineType: Invalid firstChar: "${F}", full line: "${T}"`),console.error("processFile: invalid rawLine:",T);continue}const j=Pa(F);if(j==="addition"){if(o&&E>=w.additionCount)throw Error("parsePatchContent: hunk has too many addition lines");const N=yi(T);(y==null||y.type!=="change")&&(y=Ci("change",d,f),w.hunkContent.push(y)),f++,E++,h&&a.additionLines.push(N),y.additions++,S++,x="addition"}else if(j==="deletion"){if(o&&D>=w.deletionCount)throw Error("parsePatchContent: hunk has too many deletion lines");const N=yi(T);(y==null||y.type!=="change")&&(y=Ci("change",d,f),w.hunkContent.push(y)),d++,D++,h&&a.deletionLines.push(N),y.deletions++,b++,x="deletion"}else if(j==="context"){if(o&&(D>=w.deletionCount||E>=w.additionCount))throw Error("parsePatchContent: hunk has too many context lines");const N=yi(T);(y==null||y.type!=="context")&&(y=Ci("context",d,f),w.hunkContent.push(y)),f++,d++,E++,D++,h&&(a.deletionLines.push(N),a.additionLines.push(N)),y.lines++,x="context"}else if(j==="metadata"&&y!=null){if(y.type==="context"?(w.noEOFCRAdditions=!0,w.noEOFCRDeletions=!0):x==="deletion"?w.noEOFCRDeletions=!0:x==="addition"&&(w.noEOFCRAdditions=!0),h&&(x==="addition"||x==="context")){const N=a.additionLines.length-1;N>=0&&(a.additionLines[N]=At(a.additionLines[N]))}if(h&&(x==="deletion"||x==="context")){const N=a.deletionLines.length-1;N>=0&&(a.deletionLines[N]=At(a.deletionLines[N]))}}}if(E!==w.additionCount||D!==w.deletionCount){if(o)throw Error("parsePatchContent: hunk line count mismatch");console.error(`parsePatchContent: hunk line count mismatch: "${m.trimEnd()}", declared old/new ${w.deletionCount}/${w.additionCount}, parsed old/new ${D}/${E}`);const H=Ze(w.additionStart,w.additionCount)+(E===0?0:1),T=Ze(w.deletionStart,w.deletionCount)+(D===0?0:1);if(!h){const F=H-w.additionStart,j=T-w.deletionStart;w.additionLineIndex+=F,w.deletionLineIndex+=j;for(const N of w.hunkContent)N.additionLineIndex+=F,N.deletionLineIndex+=j}w.additionStart=H,w.deletionStart=T,w.additionCount=E,w.deletionCount=D}w.additionLines=S,w.deletionLines=b,w.collapsedBefore=Math.max(Ze(w.additionStart,w.additionCount)-s,0),a.hunks.push(w),s=Ve(w.additionStart,w.additionCount);for(const H of w.hunkContent)H.type==="context"?(w.splitLineCount+=H.lines,w.unifiedLineCount+=H.lines):(w.splitLineCount+=Math.max(H.additions,H.deletions),w.unifiedLineCount+=H.deletions+H.additions);w.splitLineStart=a.splitLineCount+w.collapsedBefore,w.unifiedLineStart=a.unifiedLineCount+w.collapsedBefore,a.splitLineCount+=w.collapsedBefore+w.splitLineCount,a.unifiedLineCount+=w.collapsedBefore+w.unifiedLineCount}if(a!=null){if(o&&h&&!i&&a.hunks.length===0)throw Error("parsePatchContent: unified file has no hunks");if(a.hunks.length>0&&!h&&a.additionLines.length>0&&a.deletionLines.length>0){const p=a.hunks[a.hunks.length-1],c=Ve(p.additionStart,p.additionCount),m=a.additionLines.length,g=Math.max(m-c,0);a.splitLineCount+=g,a.unifiedLineCount+=g}return i||(a.prevName!=null&&a.name!==a.prevName?a.hunks.length>0?a.type="rename-changed":a.type="rename-pure":(n==null||n.contents==="")&&r!=null&&r.contents!==""?a.type="new":n!=null&&n.contents!==""&&(r==null||r.contents==="")&&(a.type="deleted")),a.type!=="rename-pure"&&a.type!=="rename-changed"&&(a.prevName=void 0),Sa(a),a}}function Ra(e,t,i=!1){const n=[],r=Aa(e)?e.split(Mo):[e];for(const o of r)try{n.push(ka(o,t,i,t!=null?n.length:void 0))}catch(s){if(i)throw s;console.error(s)}finally{Mr()}return n}function Ct(e,t=!1){const i=e.trim(),n=i.startsWith('"')?ga(i)?.fileName??i:i;return t&&(n.startsWith("a/")||n.startsWith("b/"))?n.slice(2):n}function Aa(e){return e.startsWith("From ")||e.includes(`
|
|
141
141
|
From `)}function zn(e){const t=Fr(e);for(let i=0;i<t.length;i++)t[i]=te(t[i]);return t}function Fr(e){if(e.length===0)return[""];const t=[];let i=0;for(;;){const n=e.indexOf(`
|
|
142
142
|
`,i);if(n===-1)break;t.push(e.slice(i,n+1)),i=n+1}return i<e.length&&t.push(e.slice(i)),t}function Ha(e){return zr(e,"diff --git")}function Ta(e){if(e.length===0)return[""];const t=[];let i=0,n=0,r=0,o=0,s=!1;for(;n<e.length;){const l=Oi(e,n);if(r<=0&&o<=0){if(Nr(e,n)){n>i&&t.push(e.slice(i,n)),i=n,s=!0,n=Oi(e,l);continue}if(s&&e.startsWith("@@ -",n)){const h=Pr(e.slice(n,l));h!=null&&(r=h.deletionCount,o=h.additionCount)}n=l;continue}const a=e[n];if(a==="\\"){n=l;continue}a===" "?(r=Math.max(r-1,0),o=Math.max(o-1,0)):a==="-"?r=Math.max(r-1,0):a==="+"&&(o=Math.max(o-1,0)),n=l}return t.push(e.slice(i)),t}function Da(e){return Nr(e,0)}function Nr(e,t){const i=Oi(e,t);return Un(e,t,"---")&&Un(e,i,"+++")}function Un(e,t,i){if(!e.startsWith(i,t))return!1;const n=e[t+i.length];if(n!==" "&&n!==" ")return!1;for(let r=t+i.length+1;r<e.length;r++){const o=e[r];if(o===`
|
|
143
143
|
`||o==="\r")break;if(o!==" "&&o!==" ")return!0}return!1}function Oi(e,t){const i=e.indexOf(`
|
|
@@ -149,9 +149,9 @@ diff --git`)}function zr(e,t){if(e.length===0)return[""];const i=`
|
|
|
149
149
|
${t}`,n=e.startsWith(t)?0:_n(e,i,0);if(n===-1)return[e];const r=[];n>0&&r.push(e.slice(0,n));let o=n;for(;;){const s=_n(e,i,o+1);if(s===-1)break;r.push(e.slice(o,s)),o=s}return r.push(e.slice(o)),r}function _n(e,t,i){const n=e.indexOf(t,i);return n===-1?-1:n+1}function On(e){return e==null?e:te(e)}function Pa(e){return e===" "?"context":e==="\\"?"metadata":e==="+"?"addition":"deletion"}function yi(e){const t=e.slice(1);return te(t===""?`
|
|
150
150
|
`:t)}function Ci(e,t,i){return e==="change"?{type:"change",additions:0,deletions:0,additionLineIndex:i,deletionLineIndex:t}:{type:"context",lines:0,additionLineIndex:i,deletionLineIndex:t}}const za="/dev/null";function et(e,t,i,n=!1){if(e===null&&t===null)throw new Error("parseDiffFromFile: You must pass oldFile, newFile, or both");const r=e??Bn(),o=t??Bn(),s=yr(r.name,o.name,r.contents,o.contents,r.header,o.header,i),l=Ea(s,{cacheKey:(()=>{const h=e?.cacheKey,d=t?.cacheKey;return h!=null&&d!=null?Zt("diff",h,d):void 0})(),oldFile:r,newFile:o,throwOnError:n});if(l==null)throw new Error("parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?");e===null?(l.type="new",l.prevName=void 0):t===null&&(l.type="deleted",l.prevName=void 0);const a=t?.lang??(t===null?e?.lang:void 0);return a!=null&&(l.lang=a),l}function Bn(){return{name:za,contents:""}}var Ua=class{constructor(){v(this,"isDeletionsScrolling",!1);v(this,"isAdditionsScrolling",!1);v(this,"timeoutId",-1);v(this,"codeDeletions");v(this,"codeAdditions");v(this,"enabled",!1);v(this,"handleDeletionsScroll",()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))});v(this,"handleAdditionsScroll",()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))})}cleanUp(){this.enabled&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),clearTimeout(this.timeoutId),this.codeDeletions=void 0,this.codeAdditions=void 0,this.enabled=!1)}setup(e,t,i){if(t==null||i==null)for(const n of e.children??[])n instanceof HTMLElement&&("deletions"in n.dataset?t=n:"additions"in n.dataset&&(i=n));if(i==null||t==null){this.cleanUp();return}this.codeDeletions!==t&&(this.codeDeletions?.removeEventListener("scroll",this.handleDeletionsScroll),this.codeDeletions=t,t.addEventListener("scroll",this.handleDeletionsScroll,{passive:!0})),this.codeAdditions!==i&&(this.codeAdditions?.removeEventListener("scroll",this.handleAdditionsScroll),this.codeAdditions=i,i.addEventListener("scroll",this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}};function Vt(e){return O({tagName:"div",properties:{"data-content-buffer":"","data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function Wt(e){return O({tagName:"div",children:[O({tagName:"span",children:[Je("No newline at end of file")]})],properties:{"data-no-newline":"","data-line-type":e,"data-column-content":""}})}function xi(e){return O({tagName:"div",children:[Jt({name:e==="both"?"diffs-icon-expand-all":"diffs-icon-expand",properties:{"data-icon":""}})],properties:{role:"button","data-expand-button":"","data-expand-both":e==="both"?"":void 0,"data-expand-up":e==="up"?"":void 0,"data-expand-down":e==="down"?"":void 0}})}function ht({type:e,content:t,expandIndex:i,chunked:n=!1,slotName:r,isFirstHunk:o,isLastHunk:s}){let l=0;const a=[];if(e==="metadata"&&t!=null&&a.push(O({tagName:"div",children:[Je(t)],properties:{"data-separator-wrapper":""}})),(e==="line-info"||e==="line-info-basic")&&t!=null){const h=[];i!=null&&(n?(o||(h.push(xi("up")),l++),s||(h.push(xi("down")),l++)):(h.push(xi(!o&&!s?"both":o?"down":"up")),l++)),h.push(O({tagName:"div",children:[O({tagName:"span",children:[Je(t)],properties:{"data-unmodified-lines":""}})],properties:{"data-separator-content":""}})),n&&i!=null&&h.push(O({tagName:"div",children:[Je("Expand all")],properties:{role:"button","data-expand-button":"","data-expand-all-button":""}})),a.push(O({tagName:"div",children:h,properties:{"data-separator-wrapper":"","data-separator-multi-button":l>1?"":void 0}}))}return e==="custom"&&r!=null&&a.push(O({tagName:"slot",properties:{name:r}})),O({tagName:"div",children:a,properties:{"data-separator":a.length===0?"simple":e,"data-expand-index":i,"data-separator-first":o?"":void 0,"data-separator-last":s?"":void 0}})}function _a(e,t){return`hunk-separator-${e}-${t}`}function Oa(e){const t=e.at(-1);return t==null?0:Math.max(Ve(t.additionStart,t.additionCount),Ve(t.deletionStart,t.deletionCount))}function Be(e,t){const i=et({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);return{hunks:i.hunks,splitLineCount:i.splitLineCount,unifiedLineCount:i.unifiedLineCount,additionLines:i.additionLines,deletionLines:i.deletionLines,type:i.type}}function Ba(e,t){const i=Math.max(e,1);let n=Array.from({length:i},(r,o)=>`${" ".repeat(o+1)}
|
|
151
151
|
`).join("");return n===t&&(n=Array.from({length:i},(r,o)=>`\0${" ".repeat(o)}
|
|
152
|
-
`).join("")),n}function Va(e){for(const t of e)if(t.trim().length>0)return!1;return!0}function Bi(e,t){return t.length>0&&t.length<e.deletionLines.length&&Va(t)}function ti(e,t,i){const n=e.deletionLines.join(""),r=Ba(t.length,n),o=et({name:e.prevName??e.name,contents:n},{name:e.name,contents:r,lang:e.lang},i);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:o.deletionLines,type:o.type}}function Qt(e,t){return ti(e,[""],t)}function Ur(e,t){if(e.additionLines.length===0)return Qt(e,t);if(Bi(e,e.additionLines))return ti(e,e.additionLines,t);const i=e.additionLines,n=Be(e,t);return _r(n,i),n}function Wa(e){return e.length>1&&e.at(-1)===""}function _r(e,t){if(!Wa(t))return;const i=t.length-e.additionLines.length;if(i<=0)return;const n=e.additionLines.length,r=e.hunks.at(-1);if(r!=null&&Ve(r.additionStart,r.additionCount)===n){for(const o of r.hunkContent)if(o.type==="change"&&o.additions<o.deletions&&o.additionLineIndex+o.additions===n){e.additionLines=t,o.additions+=i,r.additionCount+=i,r.additionLines+=i,ni(e);return}}}function Ga(e,t,i){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Oe(e,Be(e,i));const n=Array.from(t);if(n.length===0)return Oe(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(const o of n){const s=e.additionLines[o],l=e.deletionLines[o];if(s==null||l==null||At(s)===At(l))return Oe(e,Be(e,i))}const r=$a(e,n);if(r.size===0)return Oe(e,Be(e,i));for(const o of r)if(!qa(e,o,i))return Oe(e,Be(e,i));return ni(e),
|
|
152
|
+
`).join("")),n}function Va(e){for(const t of e)if(t.trim().length>0)return!1;return!0}function Bi(e,t){return t.length>0&&t.length<e.deletionLines.length&&Va(t)}function ti(e,t,i){const n=e.deletionLines.join(""),r=Ba(t.length,n),o=et({name:e.prevName??e.name,contents:n},{name:e.name,contents:r,lang:e.lang},i);return{hunks:o.hunks,splitLineCount:o.splitLineCount,unifiedLineCount:o.unifiedLineCount,additionLines:t,deletionLines:o.deletionLines,type:o.type}}function Qt(e,t){return ti(e,[""],t)}function Ur(e,t){if(e.additionLines.length===0)return Qt(e,t);if(Bi(e,e.additionLines))return ti(e,e.additionLines,t);const i=e.additionLines,n=Be(e,t);return _r(n,i),n}function Wa(e){return e.length>1&&e.at(-1)===""}function _r(e,t){if(!Wa(t))return;const i=t.length-e.additionLines.length;if(i<=0)return;const n=e.additionLines.length,r=e.hunks.at(-1);if(r!=null&&Ve(r.additionStart,r.additionCount)===n){for(const o of r.hunkContent)if(o.type==="change"&&o.additions<o.deletions&&o.additionLineIndex+o.additions===n){e.additionLines=t,o.additions+=i,r.additionCount+=i,r.additionLines+=i,ni(e);return}}}function Ga(e,t,i){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return Oe(e,Be(e,i));const n=Array.from(t);if(n.length===0)return Oe(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(const o of n){const s=e.additionLines[o],l=e.deletionLines[o];if(s==null||l==null||At(s)===At(l))return Oe(e,Be(e,i))}const r=$a(e,n);if(r.size===0)return Oe(e,Be(e,i));for(const o of r)if(!qa(e,o,i))return Oe(e,Be(e,i));return ni(e),No(e)?Oe(e,Be(e,i)):Oe(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function Oe(e,t){return Object.assign(e,t),t}function $a(e,t){const i=new Set;for(const n of t){const r=ja(e,n);if(r==null)return new Set;i.add(r)}return i}function ja(e,t){for(const[i,n]of e.hunks.entries()){const r=n.additionLineIndex+n.additionCount;if(t>=n.additionLineIndex&&t<r)return i}}function qa(e,t,i){const n=e.hunks[t];if(n==null)return!1;const r=e.deletionLines.slice(n.deletionLineIndex,n.deletionLineIndex+n.deletionCount),o=e.additionLines.slice(n.additionLineIndex,n.additionLineIndex+n.additionCount),s=et({name:e.prevName??e.name,contents:r.join("")},{name:e.name,contents:o.join(""),lang:e.lang},{...i,context:0}),l=s.hunks[0];return l==null||s.hunks.length!==1?!1:(Ka(n,l),Or(e,t),!0)}function Or(e,t){const i=e.hunks[t];if(i==null)return;if(t!==e.hunks.length-1){i.noEOFCRAdditions=!1,i.noEOFCRDeletions=!1;return}const n=e.additionLines.at(-1),r=e.deletionLines.at(-1);i.noEOFCRAdditions=n!=null&&n!==""&&!n.endsWith(`
|
|
153
153
|
`),i.noEOFCRDeletions=r!=null&&r!==""&&!r.endsWith(`
|
|
154
|
-
`)}function Ka(e,t){const i=e.additionLineIndex,n=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(r=>Br(r,i,n)),e.additionLineIndex=i+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=n+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Ki(e)}function Br(e,t,i){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+i}}function Ki(e){let t=0,i=0;for(const n of e.hunkContent)n.type==="context"?(t+=n.lines,i+=n.lines):(t+=Math.max(n.additions,n.deletions),i+=n.additions+n.deletions);e.splitLineCount=t,e.unifiedLineCount=i}function ni(e){let t=0,i=0,n=0;for(const r of e.hunks)r.collapsedBefore=Math.max(Ze(r.additionStart,r.additionCount)-n,0),r.splitLineStart=t+r.collapsedBefore,r.unifiedLineStart=i+r.collapsedBefore,Ki(r),t+=r.collapsedBefore+r.splitLineCount,i+=r.collapsedBefore+r.unifiedLineCount,n=Ve(r.additionStart,r.additionCount);if(e.hunks.length>0){const r=e.hunks[e.hunks.length-1],o=Math.max(e.additionLines.length-Ve(r.additionStart,r.additionCount),0);t+=o,i+=o}e.splitLineCount=t,e.unifiedLineCount=i}const Vn=new WeakMap;function Xa(e){return e.length>1&&e[e.length-1]===""?e.slice(0,-1):e}function Ya(e,t){const i=Math.min(e.length,t.length);let n=0;for(;n<i&&e[n]===t[n];)n++;let r=e.length,o=t.length;for(;r>n&&o>n&&e[r-1]===t[o-1];)r--,o--;if(!(n===r&&n===o))return{start:n,deletionEnd:r,additionEnd:o}}function Vi(e,t,i){const n=e.hunks,r=e.additionLines,o=Xa(r),s=o===r?e:{...e,additionLines:o},l=sl(n,rl(s,t,i),e.deletionLines.length),a=dl(s,l);if(e.additionLines=o,e.hunks=a,e.editSessionDirty=!0,cl(e),_r(e,r),!!fl(n,e.hunks))return{regions:l.map(h=>h.previousSpan)}}function Qa(e,t,i,n){const r=new Set(t),o=Array.from(r).filter(d=>d>=0&&d<e.additionLines.length).sort((d,f)=>d-f);if(o.length===0)return;const s=d=>r.has(d)?n?.get(d):e.additionLines[d],{hunks:l}=e;let a,h=0;for(const d of o){for(;h<l.length;){const c=l[h];if(d<ii(c)+c.additionCount)break;h++}const f=l[h],p=f==null?void 0:ii(f);if(p==null||d<p||a!=null&&a!==h)return Vi(e,i,s);a=h}if(a!=null){if(Ja(e,o,a,n,i)){e.editSessionDirty=!0;return}return Vi(e,i,s)}}function Ja(e,t,i,n,r){if(n==null||r?.ignoreWhitespace===!0||r?.stripTrailingCr===!0)return!1;const o=Za(e),s=e.hunks[i];if(s.hunkContent.some(el))return!1;for(const l of t){const a=n.get(l),h=e.additionLines[l];if(a==null||h==null||o.has(a)||o.has(h))return!1;let d=!1;for(const f of s.hunkContent)if(f.type==="change"&&f.additions===f.deletions&&l>=f.additionLineIndex&&l<f.additionLineIndex+f.additions){d=!0;break}if(!d)return!1}return!0}function Za(e){const t=Vn.get(e);if(t?.lines===e.deletionLines)return t.set;const i=new Set(e.deletionLines);return Vn.set(e,{lines:e.deletionLines,set:i}),i}function el(e){return e?.type==="change"&&(e.additions===0||e.deletions===0)}function tl(e,t){const i=new Map,{regions:n}=t;for(let r=0;r<=n.length;r++){const o=n[r-1],s=n[r],l=r===0?e.get(0):o==null?void 0:e.get(o.lastIndex+1),a=s==null?void 0:e.get(s.firstIndex),h=l?.fromStart??0,d=a?.fromEnd??0;(h>0||d>0)&&i.set(r,{fromStart:h,fromEnd:d})}return i}function il(e,t,i){const n=[];if(e.isPartial)return n;for(const[o,s]of e.hunks.entries()){const l=Ht({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:o,collapsedContextThreshold:i});if(l.rangeSize<=i)continue;const a=st(s),h=a-l.rangeSize;l.fromStart>0&&n.push([h,h+l.fromStart]),l.fromEnd>0&&n.push([a-l.fromEnd,a])}const r=Tt({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:i,errorPrefix:"captureExpansionAnchors"});if(r!=null&&r.fromStart>0&&r.rangeSize>i){const o=e.hunks[e.hunks.length-1],s=st(o)+o.deletionCount;n.push([s,s+r.fromStart])}return n}function nl(e,t){const i=new Map;if(t.length===0)return i;const n=(o,s,l)=>{if(l<=s)return;let a=0,h=0;for(const[d,f]of t)f<=s||d>=l||(d<=s&&(a=Math.max(a,Math.min(f,l)-s)),f>=l&&(h=Math.max(h,l-Math.max(d,s))));(a>0||h>0)&&i.set(o,{fromStart:a,fromEnd:h})};for(const[o,s]of e.hunks.entries()){const l=st(s);n(o,l-Math.max(s.collapsedBefore,0),l)}const r=e.hunks[e.hunks.length-1];return r!=null&&!e.isPartial&&e.deletionLines.length>0&&n(e.hunks.length,st(r)+r.deletionCount,e.deletionLines.length),i}function Wn(e,t){return e.editSessionDirty!==!0?!1:(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join("")===""?Be(e,t):Ur(e,t)),!0)}function rl(e,t,i){if(Ya(e.deletionLines,e.additionLines)==null)return[];const n=et({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);let r;const o=(h,d)=>{r??=ol(e.hunks);for(let f=0;f<=d;f++){const p=r.get(h.deletionLineIndex-f);if(!(p==null||p.additions!==h.additions||p.deletions!==h.deletions)){if(h.additions>0&&i!=null){for(let c=0;c<h.additions;c++)if(i(p.additionLineIndex+c)!==n.additionLines[h.additionLineIndex+c])return d}return f}}return d},s=[];let l=0,a=0;for(const h of n.hunks){ya(h,n,o);const d=h.additionCount>0?h.additionLineIndex-l:h.deletionLineIndex-a;l+=d,a+=d;for(const f of h.hunkContent){if(f.type==="context"){l+=f.lines,a+=f.lines;continue}const p=Br(f,0,0);p.additions===0&&(p.additionLineIndex=l),p.deletions===0&&(p.deletionLineIndex=a),s.push(p),l+=p.additions,a+=p.deletions}}return s}function ol(e){const t=new Map;for(const i of e)for(const n of i.hunkContent)n.type==="change"&&(n.additions===0||n.deletions===0)&&t.set(n.deletionLineIndex,n);return t}function sl(e,t,i){const n=e.map((s,l)=>{const a=st(s);return{deletionStart:a,deletionEnd:a+s.deletionCount,blocks:[],previousSpan:{firstIndex:l,lastIndex:l}}}),r=[];let o=0;for(const s of t){const l=s.deletionLineIndex,a=l+s.deletions;for(;o<n.length&&n[o].deletionEnd<l;)r.push(n[o]),o++;let h=r.length>0&&al(l,a,r[r.length-1])?r.pop():void 0;for(;o<n.length&&n[o].deletionStart<=a;)h=ll(h,n[o]),o++;if(h==null){let d=l,f=a;if((s.deletions===0||s.additions===0)&&i>s.deletions){const p=r[r.length-1]?.deletionEnd??0,c=n[o]?.deletionStart??i;l>p?d--:a<c&&f++}h={deletionStart:d,deletionEnd:f,blocks:[],previousSpan:void 0}}h.deletionStart=Math.min(h.deletionStart,l),h.deletionEnd=Math.max(h.deletionEnd,a),h.blocks.push(s),r.push(h)}for(;o<n.length;)r.push(n[o]),o++;return r}function al(e,t,i){return e<=i.deletionEnd&&t>=i.deletionStart}function ll(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function dl(e,t){const i=[];let n=0,r=0;for(const o of t){const s=o.deletionStart-n;if(s<0)throw new Error("buildRegionHunks: overlapping old-side regions");n+=s,r+=s;const l=r,a=[];for(const d of o.blocks){const f=d.deletionLineIndex-n,p=d.additionLineIndex-r;if(f<0||f!==p)throw new Error("buildRegionHunks: canonical block context mismatch");Gn(a,f,r,n),n+=f,r+=p,a.push({...d}),n+=d.deletions,r+=d.additions}const h=o.deletionEnd-n;if(h<0)throw new Error("buildRegionHunks: block exceeds its old-side region");Gn(a,h,r,n),n+=h,r+=h,i.push(hl(e,{additionStart:l,additionEnd:r,deletionStart:o.deletionStart,deletionEnd:o.deletionEnd},a))}if(e.deletionLines.length-n!==e.additionLines.length-r)throw new Error("buildRegionHunks: trailing context mismatch");return i}function hl(e,t,i){const n=t.additionEnd-t.additionStart,r=t.deletionEnd-t.deletionStart;let o=0,s=0;for(const a of i)a.type==="change"&&(o+=a.additions,s+=a.deletions);const l={collapsedBefore:0,additionStart:Gt(t.additionStart,n),additionCount:n,additionLines:o,additionLineIndex:jn(t.additionStart,n),deletionStart:Gt(t.deletionStart,r),deletionCount:r,deletionLines:s,deletionLineIndex:jn(t.deletionStart,r),hunkContent:i,hunkSpecs:`@@ -${Gt(t.deletionStart,r)},${r} +${Gt(t.additionStart,n)},${n} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Ki(l),l}function Gn(e,t,i,n){t>0&&e.push({type:"context",lines:t,additionLineIndex:i,deletionLineIndex:n})}function fl(e,t){if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++){const n=e[i],r=t[i];if(st(n)!==st(r)||n.deletionCount!==r.deletionCount||ii(n)!==ii(r)||n.additionCount!==r.additionCount||n.splitLineCount!==r.splitLineCount||!ul(n,r))return!0}return!1}function ul(e,t){const i=$n(e),n=$n(t);for(;;){const r=i.next(),o=n.next();if(r.done===!0||o.done===!0)return r.done===o.done;if(r.value[0]!==o.value[0]||r.value[1]!==o.value[1])return!1}}function*$n(e){for(const t of e.hunkContent){if(t.type==="context"){for(let n=0;n<t.lines;n++)yield[t.deletionLineIndex+n,t.additionLineIndex+n];continue}const i=Math.max(t.deletions,t.additions);for(let n=0;n<i;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function ii(e){return Ze(e.additionStart,e.additionCount)}function st(e){return Ze(e.deletionStart,e.deletionCount)}function Gt(e,t){return t===0?e:e+1}function jn(e,t){return t===0?e-1:e}function cl(e){ni(e);for(let t=0;t<e.hunks.length;t++)Or(e,t)}let pl=-1;var gl=class{constructor(e={theme:Ye},t=Rt,i,n){v(this,"options");v(this,"annotationSlotName");v(this,"onRenderUpdate");v(this,"workerManager");v(this,"__id",`diff-hunks-renderer:${++pl}`);v(this,"highlighter");v(this,"diff");v(this,"expandedHunks",new Map);v(this,"deletionAnnotations",{});v(this,"additionAnnotations",{});v(this,"computedLangs",["text"]);v(this,"renderCache");v(this,"pendingHighlightResult");v(this,"pendingStructuralRows");v(this,"editSessionActive",!1);v(this,"createAnnotationElement",e=>Ls(e));this.options=e,this.annotationSlotName=t,this.onRenderUpdate=i,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=St(e.theme??Ye)?Ti():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){const{editSessionActive:i}=this;this.editSessionActive=!0,i||(this.pendingHighlightResult=void 0),this.diff=e,i&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();const{renderCache:n}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Qt(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(n==null||i&&n.diff===e)return;const{options:r}=this.getRenderOptions(e),o=n.diff===e,s=t!=null&&J(n.diff,t),{result:l}=n;if(!n.highlighted||l==null||!Ue(n.options,r)||!o&&!s){this.clearRenderCache();return}o||(this.renderCache={diff:e,options:r,highlighted:!0,result:{...l,code:{...l.code,additionLines:[...l.code.additionLines]}},renderRange:n.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null&&this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){const{diff:e,renderCache:t,workerManager:i}=this;return e==null||t==null||!J(t.diff,e)||wt(e)||xt(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&i?.isWorkingPool()===!0&&e.cacheKey!=null?(i.evictDiffFromCache(e.cacheKey),i.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,i.getDiffResultCache(e))}).catch(n=>this.onHighlightError(n))):this.asyncHighlight(e).then(n=>this.applyRefreshedResult(e,n)).catch(n=>this.onHighlightError(n))}applyRefreshedResult(e,t){const{diff:i,renderCache:n}=this;if(t==null||i==null||n==null||!J(i,e)||!J(n.diff,e)||this.editSessionActive)return;const{options:r}=this.getRenderOptions(i);Ue(r,t.options)&&(this.pendingHighlightResult={diff:i,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,i=this.getOptionsWithDefaults().expansionLineCount){const n={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(n.fromStart+=i),(t==="down"||t==="both")&&(n.fromEnd+=i),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,n)}getExpandedHunk(e){return this.expandedHunks.get(e)??Uo}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(const t of e){const i=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=i[t.lineNumber]??[];i[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,i=!1){this.pendingStructuralRows=void 0;const{renderCache:n}=this;if(n==null)return!1;const{result:r,diff:o}=n;if(r==null)return!1;if(o.isPartial)throw new Error("Could not update render cache for partial diff");const s=r.code.additionLines,l=this.pendingStructuralRows=i?new Map:void 0,a=[],h=new Map;for(const[f,p]of e){const c=s[f]?.properties??{},m=p.map(x=>x[2]).join(""),g=f<o.additionLines.length,S=g?o.additionLines[f]??"":"",b=At(S);l==null&&g&&(o.additionLines[f]=Is(S,m),b!==m&&(a.push(f),h.set(f,S)));const y={type:"element",tagName:"div",properties:{"data-line":c["data-line"]??f+1,"data-line-index":c["data-line-index"]??f,"data-line-type":c["data-line-type"]??"context"},children:p.map(([x,R,k])=>x===0&&R===""?k===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:k}:{type:"element",tagName:"span",properties:{"data-char":x,style:`color:${R};`},children:[{type:"text",value:k}]})};l!=null?l.set(f,y):s[f]=y}let d=!1;if(a.length>0)if(this.editSessionActive)if(o.additionLines.length<=1&&o.additionLines.join("")==="")this.applyRecomputePreservingSessionType(o,Qt(o,this.options.parseDiffOptions)),d=!0;else if(Bi(o,o.additionLines))this.applyRecomputePreservingSessionType(o,ti(o,o.additionLines,this.options.parseDiffOptions)),d=!0;else{const f=Qa(o,a,this.options.parseDiffOptions,h);this.applyExpansionRemap(f),d=f!=null}else Object.assign(o,Ga(o,a,this.options.parseDiffOptions));return r.baseThemeType=t,n.isDirty=!0,d}applyExpansionRemap(e){e!=null&&(this.expandedHunks=tl(this.expandedHunks,e))}applyDocumentChange(e){const{pendingStructuralRows:t,renderCache:i}=this;this.pendingStructuralRows=void 0;const n=this.diff??i?.diff;if(n==null)return;const r=i?.result;if(n.isPartial)throw new Error("Could not apply document change for partial diff");const{additionLines:o}=n;if(n.additionLines=Sl(e),r!=null&&(r.code.additionLines=bl(o,n.additionLines,r.code.additionLines,e)),n.additionLines.length<=1&&n.additionLines.join("")===""?(this.applyRecomputePreservingSessionType(n,Qt(n,this.options.parseDiffOptions)),r!=null&&(r.code.additionLines[0]=Wi(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(n,o):Object.assign(n,Ur(n,this.options.parseDiffOptions)),t!=null&&r!=null)for(const[s,l]of t)s<r.code.additionLines.length&&(r.code.additionLines[s]=l);i!=null&&(i.isDirty=!0)}applySessionDocumentChange(e,t){const{parseDiffOptions:i}=this.options,n=e.additionLines;if(Bi(e,n)){this.applyRecomputePreservingSessionType(e,ti(e,n,i));return}this.applyExpansionRemap(Vi(e,i,r=>t[r]))}applyRecomputePreservingSessionType(e,t){const i=this.editSessionActive?e.type:void 0;Object.assign(e,t),i!=null&&(e.type=i),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){const i=t==="change"?e==="deletions"?"change-deletion":"change-addition":t;return{gutterLineType:i,contentProperties:{"data-line-type":i}}}getOptionsWithDefaults(){const{diffIndicators:e="bars",diffStyle:t="split",disableBackground:i=!1,disableFileHeader:n=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:h=100,hunkSeparators:d="line-info",lineDiffType:f="word-alt",maxLineDiffLength:p=1e3,overflow:c="scroll",stickyHeader:m=!1,theme:g=Ye,headerRenderMode:S="default",tokenizeMaxLineLength:b=1e3,tokenizeMaxLength:y=_o,useTokenTransformer:x=!1,useCSSClasses:R=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:i,disableFileHeader:n,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:h,hunkSeparators:d,lineDiffType:f,maxLineDiffLength:p,overflow:c,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??g,headerRenderMode:S,tokenizeMaxLineLength:b,tokenizeMaxLength:y,useTokenTransformer:x,useCSSClasses:R}}async initializeHighlighter(){return this.highlighter=await mr(Ts(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),i=xt(e,this.getTokenizeMaxLength());let n=this.workerManager?.getDiffResultCache(e);n!=null&&!Ue(t,n.options)&&(n=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!i&&!wt(e),options:t,result:i?void 0:n?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!i&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLangs=wi(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ye}getEffectiveCodeOptions(){const e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0){const l=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&l.useTokenTransformer!==!0?{...l,useTokenTransformer:!0}:l}const{theme:n,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:n,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:i}=this;return i?.result==null?{options:t,forceHighlight:!0}:!J(e,i.diff)||!Ue(t,i.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){const{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(J(this.renderCache.diff,e))return this.renderCache.diff;const i=!(e.additionLines.length>0||e.deletionLines.length>0)||wt(e)||xt(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,i)?e:this.renderCache.diff}canRenderDiff(e,t,i){const{renderCache:n}=this;return n==null||J(n.diff,e)?!0:i?n.result==null&&n.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&St(t.theme):n.result==null&&n.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!n.highlighted:this.highlighter!=null&&St(t.theme)}renderDiff(e=this.diff,t=gn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}const{expandUnchanged:i,collapsedContextThreshold:n}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getReadyRenderResult(e,r);this.pendingHighlightResult=void 0,s!=null&&(this.renderCache={...s,diff:e,renderRange:void 0},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};const l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||wt(e)||xt(e,this.getTokenizeMaxLength()),h=this.canRenderDiff(e,r,a),d=!J(e,this.renderCache.diff),f=!kr(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){const p=this.renderCache.result==null&&this.renderCache.highlighted&&!a&&!d&&Pi(t);h&&!p&&(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||f))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||f||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Pi(t)||i?!0:this.expandedHunks,n)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=wi(e),this.highlighter??=Ti();const p=this.highlighter!=null&&St(r.theme),c=this.highlighter!=null&&mn(this.computedLangs),m=!a&&c;if(h&&this.highlighter!=null&&p&&(o||a||!this.renderCache.highlighted&&m||this.renderCache.result==null)){const{result:g,options:S}=this.renderDiffWithHighlighter(e,this.highlighter,a||!c);this.renderCache={diff:e,options:S,highlighted:m,result:g,renderRange:void 0}}(!p||!a&&!c)&&this.asyncHighlight(e).then(({result:g,options:S})=>{this.applyHighlightResult(e,g,S,!a)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=gn){this.diff=e;const{result:i}=await this.asyncHighlight(e);return this.processDiffResult(e,t,i)}createPreElement(e,t,i){const{diffIndicators:n,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return As({type:"diff",diffIndicators:n,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:i})}async asyncHighlight(e){const t=xt(e,this.getTokenizeMaxLength());this.computedLangs=t?["text"]:wi(e);const i=this.highlighter!=null&&St(this.getLocalHighlightTheme()),n=t||this.highlighter!=null&&mn(this.computedLangs);return(this.highlighter==null||!i||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,i=!1){const{options:n}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults(),o=Oo(e,t,n,{forcePlainText:i,expandedHunks:i?!0:void 0,collapsedContextThreshold:r});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===""&&o.code.additionLines[0]==null){let s;if(ct({diff:e,diffStyle:"both",expandedHunks:i?!0:void 0,collapsedContextThreshold:r,callback:({additionLine:l})=>{if(l?.lineIndex===0)return s=l,!0}}),s==null)throw new Error("DiffHunksRenderer: missing empty addition line");o.code.additionLines[0]=Wi(0,"",s.unifiedLineIndex,s.splitLineIndex)}return{result:o,options:n}}onHighlightSuccess(e,t,i,n=!0){this.editSessionActive||this.applyHighlightResult(e,t,i,n)}applyHighlightResult(e,t,i,n=!0){const{diff:r,renderCache:o}=this;r==null||o==null||!J(r,e)||!Ue(i,this.getRenderOptions(r).options)||(o.result==null||!o.highlighted||!Ue(o.options,i)||!J(o.diff,r))&&(this.pendingHighlightResult={diff:r,options:i,highlighted:n,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;const i=this.workerManager?.getDiffResultCache(e);if(!(i==null||!Ue(t,i.options)))return i}getReadyRenderResult(e,t){const{pendingHighlightResult:i}=this;if(i!=null&&J(i.diff,e)&&Ue(i.options,t))return i;const n=this.getMatchingWorkerResultCache(e,t);if(!(n==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...n}}hasHighlightedRenderCache(e,t){const{renderCache:i}=this;return i?.result!=null&&i.highlighted&&J(e,i.diff)&&Ue(t,i.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:i,themeStyles:n,baseThemeType:r}){const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:h,hunkSeparators:d}=this.getOptionsWithDefaults(),f=this.renderCache?.isDirty??!1,p=o==="unified",c=yl(e,this.options.loadDiffFiles!=null),m=!e.isPartial||c;let g=[],S=[],b=[];const y=[],{additionLines:x,deletionLines:R}=i,k={rowCount:0,hunkSeparators:d,additionsContentAST:g,deletionsContentAST:S,unifiedContentAST:b,unifiedGutterAST:Ut(),deletionsGutterAST:Ut(),additionsGutterAST:Ut(),expansionLineCount:a,hunkData:y,incrementRowCount($=1){k.rowCount+=$},pushToGutter($,V){switch($){case"unified":k.unifiedGutterAST.children.push(V);break;case"deletions":k.deletionsGutterAST.children.push(V);break;case"additions":k.additionsGutterAST.children.push(V)}}},w=Bo({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),E={size:0,side:void 0,increment(){this.size+=1},flush(){if(o!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(k.pushToGutter("additions",Le(void 0,"buffer",this.size)),g?.push(Vt(this.size))):(k.pushToGutter("deletions",Le(void 0,"buffer",this.size)),S?.push(Vt(this.size))),this.size=0,this.side=void 0}}},D=($,V,re,W,P)=>{k.pushToGutter($,Vo(V,re,W,P))};function H($){E.flush(),o==="unified"?Li("unified",$,k):(Li("deletions",$,k),Li("additions",$,k))}this.pushFileLevelAnnotations(e,o,t,k),ct({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:h,callback:({hunkIndex:$,hunk:V,collapsedBefore:re,collapsedAfter:W,additionLine:P,deletionLine:U,type:G})=>{const Q=U!=null?U.splitLineIndex:P.splitLineIndex,de=P!=null?P.unifiedLineIndex:U.unifiedLineIndex;o==="split"&&G!=="change"&&E.flush(),re>0&&H({hunkIndex:$,collapsedLines:re,rangeSize:Math.max(V?.collapsedBefore??0,0),hunkSpecs:V?.hunkSpecs,isFirstHunk:$===0,isLastHunk:!1,isExpandable:m});const Z=o==="unified"?de:Q,he={type:G,hunkIndex:$,lineIndex:Z,unifiedLineIndex:de,splitLineIndex:Q,deletionLine:U,additionLine:P};if(o==="unified"){const _=this.getUnifiedInjectedRowsForLine?.(he);_?.before!=null&&qn(_.before,k);let oe=U!=null?R[U.lineIndex]:void 0,se=P!=null?x[P.lineIndex]:void 0;if(oe==null&&se==null){const q="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(q,{file:e.name}),new Error(q)}const Fe=G==="change"?P!=null?"change-addition":"change-deletion":G,me=this.getUnifiedLineDecoration({type:G,lineType:Fe,additionLineIndex:P?.lineIndex,deletionLineIndex:U?.lineIndex});D("unified",me.gutterLineType,P!=null?P.lineNumber:U.lineNumber,`${de},${Q}`,me.gutterProperties),se!=null?se=jt(se,me.contentProperties,f&&P!=null?{"data-line":P.lineNumber,"data-line-index":`${de},${Q}`}:void 0):oe!=null&&(oe=jt(oe,me.contentProperties,f&&U!=null?{"data-line":U.lineNumber,"data-line-index":`${de},${Q}`}:void 0)),$t({diffStyle:"unified",type:G,deletionLine:oe,additionLine:se,unifiedSpan:this.getAnnotations("unified",U?.lineNumber,P?.lineNumber,$,Z),createAnnotationElement:q=>this.createAnnotationElement(q),context:k}),_?.after!=null&&qn(_.after,k)}else{const _=this.getSplitInjectedRowsForLine?.(he);_?.before!=null&&Kn(_.before,k,E);let oe=U!=null?R[U.lineIndex]:void 0,se=P!=null?x[P.lineIndex]:void 0;const Fe=this.getSplitLineDecoration({side:"deletions",type:G,lineIndex:U?.lineIndex}),me=this.getSplitLineDecoration({side:"additions",type:G,lineIndex:P?.lineIndex});if(oe==null&&se==null){const ee="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(ee,{file:e.name}),new Error(ee)}const q=(()=>{if(G==="change"){if(se==null)return"additions";if(oe==null)return"deletions"}})();q!=null?(E.side!=null&&E.side!==q&&E.flush(),E.side=q,E.increment()):G==="change"&&E.flush();const K=this.getAnnotations("split",U?.lineNumber,P?.lineNumber,$,Z);if(K!=null&&E.size>0&&E.flush(),U!=null){const ee=jt(oe,Fe.contentProperties,f?{"data-line":U.lineNumber,"data-line-index":`${U.unifiedLineIndex},${Q}`}:void 0);D("deletions",Fe.gutterLineType,U.lineNumber,`${U.unifiedLineIndex},${Q}`,Fe.gutterProperties),ee!=null&&(oe=ee)}if(P!=null){const ee=jt(se,me.contentProperties,f?{"data-line":P.lineNumber,"data-line-index":`${P.unifiedLineIndex},${Q}`}:void 0);D("additions",me.gutterLineType,P.lineNumber,`${P.unifiedLineIndex},${Q}`,me.gutterProperties),ee!=null&&(se=ee)}$t({diffStyle:"split",type:G,additionLine:se,deletionLine:oe,...K,createAnnotationElement:ee=>this.createAnnotationElement(ee),context:k}),_?.after!=null&&Kn(_.after,k,E)}const ve=o==="split"&&V!=null&&Q===V.splitLineStart+V.splitLineCount-1,Ee=$===e.hunks.length-1&&V!=null&&(o==="split"?Q===V.splitLineStart+V.splitLineCount-1:de===V.unifiedLineStart+V.unifiedLineCount-1),be=ve?V.noEOFCRDeletions:!1,tt=ve?V.noEOFCRAdditions:!1,Ie=(U?.noEOFCR??!1)||be,Se=(P?.noEOFCR??!1)||tt;if(Se||Ie){if(o==="split"&&E.flush(),Ie){const _=G==="context"||G==="context-expanded"?G:"change-deletion";o==="unified"?(k.unifiedContentAST.push(Wt(_)),k.pushToGutter("unified",Le(_,"metadata",1))):(k.deletionsContentAST.push(Wt(_)),k.pushToGutter("deletions",Le(_,"metadata",1)),Se||(k.pushToGutter("additions",Le(void 0,"buffer",1)),k.additionsContentAST.push(Vt(1))))}if(Se){const _=G==="context"||G==="context-expanded"?G:"change-addition";o==="unified"?(k.unifiedContentAST.push(Wt(_)),k.pushToGutter("unified",Le(_,"metadata",1))):(k.additionsContentAST.push(Wt(_)),k.pushToGutter("additions",Le(_,"metadata",1)),Ie||(k.pushToGutter("deletions",Le(void 0,"buffer",1)),k.deletionsContentAST.push(Vt(1))))}k.incrementRowCount(1)}d!=="simple"&&d!=="metadata"&&(W>0||Ee&&c)&&H({hunkIndex:G==="context-expanded"?$:$+1,collapsedLines:Ee&&c?"unknown":W,rangeSize:w,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),k.incrementRowCount(1)}}),o==="split"&&E.flush();const T=Math.max(Oa(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),F=t.bufferBefore>0||t.bufferAfter>0,j=!p&&e.type!=="deleted",N=!p&&e.type!=="new",B=k.rowCount>0||F;g=j&&B?g:void 0,S=N&&B?S:void 0,b=p&&B?b:void 0;const ce=this.createPreElement(S!=null&&g!=null,T);return{fileDiff:e,unifiedGutterAST:p&&B?k.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:N&&B?k.deletionsGutterAST.children:void 0,deletionsContentAST:S,additionsGutterAST:j&&B?k.additionsGutterAST.children:void 0,additionsContentAST:g,hunkData:y,preNode:ce,themeStyles:n,baseThemeType:r,headerElement:s?void 0:this.renderHeader(e),totalLines:T,rowCount:k.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const i=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,n=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(i==null||n==null)return;const r=Ut(i);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Fs(n,t.rowCount)]}renderFullAST(e,t=[]){const i=this.getOptionsWithDefaults().hunkSeparators==="line-info",n=this.renderCodeAST("unified",e);if(n!=null)return t.push(O({tagName:"code",children:n,properties:{"data-code":"","data-container-size":i?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);r!=null&&t.push(O({tagName:"code",children:r,properties:{"data-code":"","data-container-size":i?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return o!=null&&t.push(O({tagName:"code",children:o,properties:{"data-code":"","data-container-size":i?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Qe(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?Qe(e):Qe(O({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,i,n){if(!Er(i))return;const r=e.type!=="new"?this.getAnnotationNames(Tn(this.deletionAnnotations)):[],o=e.type!=="deleted"?this.getAnnotationNames(Tn(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){$t({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:n});return}$t({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},createAnnotationElement:a,context:n})}getAnnotations(e,t,i,n,r){const o={type:"annotation",hunkIndex:n,lineIndex:r,annotations:[]};if(t!=null)for(const l of this.deletionAnnotations[t]??[])o.annotations.push(this.annotationSlotName(l));const s={type:"annotation",hunkIndex:n,lineIndex:r,annotations:[]};if(i!=null)for(const l of this.additionAnnotations[i]??[])(e==="unified"?o:s).annotations.push(this.annotationSlotName(l));if(e==="unified")return o.annotations.length>0?o:void 0;if(!(s.annotations.length===0&&o.annotations.length===0))return{deletionSpan:o,additionSpan:s}}getAnnotationNames(e){return e?.map(t=>this.annotationSlotName(t))??[]}renderHeader(e){const{headerRenderMode:t,stickyHeader:i}=this.getOptionsWithDefaults();return ks({fileOrDiff:e,mode:t,stickyHeader:i})}};const ml=new Intl.PluralRules("en-US");function vl(e){return`${e} unmodified line${ml.select(e)==="one"?"":"s"}`}function qn(e,t){for(const i of e)t.unifiedContentAST.push(i.content),t.pushToGutter("unified",i.gutter),t.incrementRowCount(1)}function Kn(e,t,i){for(const{deletion:n,addition:r}of e){if(n==null&&r==null)continue;const o=n!=null&&r!=null?void 0:n==null?"deletions":"additions";(o==null||i.side!==o)&&i.flush(),n!=null&&(t.deletionsContentAST.push(n.content),t.pushToGutter("deletions",n.gutter)),r!=null&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),o!=null&&(i.side=o,i.increment()),t.incrementRowCount(1)}}function $t({diffStyle:e,type:t,deletionLine:i,additionLine:n,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let h=!1;if(e==="unified"){if(n!=null?a.unifiedContentAST.push(n):i!=null&&a.unifiedContentAST.push(i),r!=null){const d=t==="change"?i!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",Le(d,"annotation",1)),h=!0}}else if(e==="split"){if(i!=null&&a.deletionsContentAST.push(i),n!=null&&a.additionsContentAST.push(n),o!=null){const d=t==="change"?i!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",Le(d,"annotation",1)),h=!0}if(s!=null){const d=t==="change"?n!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",Le(d,"annotation",1)),h=!0}}h&&a.incrementRowCount(1)}function Li(e,{hunkIndex:t,collapsedLines:i,rangeSize:n,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(typeof i=="number"&&i<=0)return;const h=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,ht({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),h.push(ht({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,ht({type:"simple",isFirstHunk:o,isLastHunk:!1})),h.push(ht({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const d=_a(e,t),f=n>a.expansionLineCount,p=l?t:void 0,c=typeof i=="number"?vl(i):"More unchanged context may be available";a.pushToGutter(e,ht({type:a.hunkSeparators,content:c,expandIndex:p,chunked:f,slotName:d,isFirstHunk:o,isLastHunk:s})),h.push(ht({type:a.hunkSeparators,content:c,expandIndex:p,chunked:f,slotName:d,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:d,hunkIndex:t,lines:typeof i=="number"?i:0,lineCountKnown:typeof i=="number",type:e,expandable:l?{up:!o,down:!s,chunked:f}:void 0})}function jt(e,t,i){return e==null||e.type!=="element"||t==null&&i==null?e:{...e,properties:{...e.properties,...t,...i}}}function Xn(e){return e.length>0&&e[e.length-1]===""?e.length-1:e.length}function bl(e,t,i,n){const r=Xn(e),o=Xn(t),s=Math.min(r,o);let l=0;for(;l<s&&e[l]===t[l];)l++;let a=0;for(;a<s-l&&e[r-1-a]===t[o-1-a];)a++;const h=new Array(t.length);for(let d=0;d<l;d++)h[d]=i[d];for(let d=0;d<a;d++)h[o-1-d]=i[r-1-d];r<e.length&&o<t.length&&(h[t.length-1]=i[e.length-1]);for(let d=l;d<t.length;d++)h[d]??=Wi(d,n.getLineText(d));return h}function Wi(e,t,i=e,n=e){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${i},${n}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t}]}]}}function Sl(e){const t=[];for(let i=0;i<e.lineCount;i++)t.push(e.getLineText(i,!0));return t}function wi(e){if(e.lang!=null)return[e.lang];const t=Dt(e.prevName??e.name),i=Dt(e.name);return t===i?[i]:[t,i]}function xt(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function yl(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function Cl(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function xl(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Gi(e,t=300){let i;try{await Promise.race([e(),new Promise(n=>{i=setTimeout(n,t)})])}finally{i!=null&&clearTimeout(i)}}function $i({oldFile:e,newFile:t},i){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)throw new Error(`${i}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw new Error(`${i}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return t===null?{oldFile:e,newFile:t}:{oldFile:e,newFile:t}}}function Ll(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Js(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function ki(e){return e.isPartial&&(e.type==="change"||e.type==="rename-changed"||e.type==="rename-pure")}function wl(e){const t={...e};return delete t.cacheKey,t}function Yn(e,t){if(e.isPartial||t.isPartial)throw new Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");const i=e.lang??Dt(e.name),n=t.lang??Dt(t.name),r=e.type!=="new",o=t.type!=="new";return e.name!==t.name||i!==n||r!==o||e.deletionLines.length!==t.deletionLines.length?!0:e.deletionLines.some((s,l)=>s!==t.deletionLines[l])}function kl(e,t){return e.length===t.length&&e.every((i,n)=>i===t[n])}function El(e,t){const{oldFile:i}=e;return i==null?t.type==="new":t.type!=="new"&&i.name===(t.prevName??t.name)&&kl(i.lines,t.deletionLines)}let Rl=-1;var Ai,Vr=(Ai=class{constructor(e={theme:Ye},t,i=!1){v(this,"options");v(this,"workerManager");v(this,"isContainerManaged");v(this,"__id",`file-diff:${++Rl}`);v(this,"type","file-diff");v(this,"fileContainer");v(this,"spriteSVG");v(this,"pre");v(this,"codeUnified");v(this,"codeDeletions");v(this,"codeAdditions");v(this,"bufferBefore");v(this,"bufferAfter");v(this,"themeCSSStyle");v(this,"appliedThemeCSS");v(this,"hasAdoptedThemeCSS",!1);v(this,"unsafeCSSStyle");v(this,"appliedUnsafeCSS");v(this,"gutterUtilityContent");v(this,"headerElement");v(this,"headerPrefix");v(this,"headerFilenameSuffix");v(this,"headerMetadata");v(this,"headerCustom");v(this,"separatorCache",new Map);v(this,"errorWrapper");v(this,"placeHolder");v(this,"hunksRenderer");v(this,"resizeManager");v(this,"scrollSyncManager");v(this,"interactionManager");v(this,"annotationCache",new Map);v(this,"lineAnnotations",[]);v(this,"managersDirty",!1);v(this,"deletionFile");v(this,"additionFile");v(this,"fileDiff");v(this,"editSession");v(this,"renderedDiff");v(this,"renderRange");v(this,"pendingFiles");v(this,"appliedPreAttributes");v(this,"headerCache",{lastRenderedHTML:void 0,html:void 0,fileDiff:void 0});v(this,"lastRowCount");v(this,"mounted",!1);v(this,"enabled",!0);v(this,"editor");v(this,"refreshViewTimeout");v(this,"lineStateRefreshPending",!1);v(this,"deferredSelectedLines");v(this,"deferredEditorActiveLine");v(this,"handleHighlightRender",()=>{this.rerender()});v(this,"getLineIndex",(e,t="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t));v(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine());v(this,"getAnnotationSlotName",e=>Qs(this.editSession?.annotations,e,Rt));v(this,"handleExpandHunk",(e,t,i)=>{this.expandHunk(e,t,i)});v(this,"expandHunk",(e,t,i)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,i),this.rerender()});v(this,"handleEditSessionRender",()=>{this.rerender(),this.flushDeferredLineState()});this.options=e,this.workerManager=t,this.isContainerManaged=i,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new vs,this.scrollSyncManager=new Ua,this.interactionManager=new as("diff",wn(e,typeof e.hunkSeparators=="function"||(e.hunkSeparators??"line-info")==="line-info"||e.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ye}getHunksRendererOptions(e){return Ll(e)}createHunksRenderer(e){return new gl(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,i){if(e==null)return;const n=e.hunks.at(-1);let r,o;e:for(const s of e.hunks){const l=i==="deletions"?s.deletionStart:s.additionStart,a=i==="deletions"?s.deletionCount:s.additionCount;let h=Ze(l,a)+1,d=s.splitLineStart,f=s.unifiedLineStart;if(t<h){const p=h-t;r=Math.max(f-p,0),o=Math.max(d-p,0);break e}if(t>=h+a){if(s===n){const p=t-(h+a);r=f+s.unifiedLineCount+p,o=d+s.splitLineCount+p;break e}continue}for(const p of s.hunkContent)if(p.type==="context")if(t<h+p.lines){const c=t-h;o=d+c,r=f+c;break e}else h+=p.lines,d+=p.lines,f+=p.lines;else{const c=i==="deletions"?p.deletions:p.additions;if(t<h+c){const m=t-h;r=f+(i==="additions"?p.deletions:0)+m,o=d+m;break e}else h+=c,d+=Math.max(p.deletions,p.additions),f+=p.deletions+p.additions}break e}if(!(r==null||o==null))return[r,o]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(wn(this.options,typeof this.options.hunkSeparators=="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;const t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!lr(this.appliedThemeCSS.theme,this.getTheme())}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){const t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){const t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Ys(t,e,Rt))}syncEditSessionAnnotationsFromEditor(e){const t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,i){return!(e||t||i||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??"additions"})}flushDeferredLineState(){const{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators=="function"?!0:e==="scroll"&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){const{editor:t}=this;Ii(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?"recycle":"discard"),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:i=!1,lineAnnotations:n,fileDiff:r,...o}){if(!this.enabled)throw new Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");const s=$i(o,"FileDiff.hydrate"),l=s?.oldFile,a=s?.newFile;this.hydrateElements(e,t);const h=this.editor!=null;h||Dl(this.pre,Hl({fileDiff:r,oldFile:l,newFile:a}),this.options.collapsed)||Ml(this.headerElement,Tl({fileDiff:r,oldFile:l,newFile:a}),this.options.disableFileHeader)?this.render({...o,fileContainer:e,lineAnnotations:n,fileDiff:r,forceRender:h||o.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:r,lineAnnotations:n,...s}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ks(e,t);for(const i of e.shadowRoot?.children??[]){if(i instanceof SVGElement){this.spriteSVG=i;continue}if(i instanceof HTMLElement){if(i instanceof HTMLPreElement){this.pre=i;for(const n of i.children)!(n instanceof HTMLElement)||n.tagName.toLowerCase()!=="code"||("deletions"in n.dataset&&(this.codeDeletions=n),"additions"in n.dataset&&(this.codeAdditions=n),"unified"in n.dataset&&(this.codeUnified=n));continue}if("diffsHeader"in i.dataset){this.headerElement=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-theme-css")){this.themeCSSStyle=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=i,this.appliedUnsafeCSS=i.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:i,lineAnnotations:n}){this.lineAnnotations=n??this.lineAnnotations,this.additionFile=i,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&i!==void 0?et(t,i,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}loadFilesIfNecessary(){const{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!ki(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw new Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");const i=this.loadFilesForDiff(e,t),n=this.pendingFiles={fileDiff:e,promise:i},r=()=>{this.pendingFiles===n&&(this.pendingFiles=void 0)};n.promise=i.finally(r)}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;const e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!ki(this.fileDiff)?new Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff"):new Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles");if(await e,!this.__canAttachEditor())throw new Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!ki(this.fileDiff))throw new Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{const i=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,i)}catch(i){if(this.options.disableErrorHandling===!0)throw i;console.error(i)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(Ui("merge",e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await Gi(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw new Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");return this.fileDiff!==e?!1:this.editSession?.outgoingDiff!=null?(this.installEditSession(e),!0):!1}updateExternalDiff(e,t){if(J(this.fileDiff,e))return!1;const i=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,i!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=i)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=In(t,Rt,this.editSession.annotations)),!0}installEditSession(e,t,i){const n=e.additionLines.join(""),r=t!=null?ei(t.contents):void 0,o=i!=null&&El(i,e);if(i!=null&&!o)throw new Error("FileDiff: retained session cannot resume against a different old file");if(t!=null&&t.contents!==n&&!o)throw new Error("FileDiff: retained edits are missing their diff session state");const s=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===n,l=wl(e);t!=null&&r!=null&&!s&&(l.name=t.name,l.lang=t.lang),o&&i!=null&&r!=null&&(l.additionLines=r,l.type=i.type,l.hunks=i.hunks,l.editSessionDirty=!0,ni(l)),this.editSession={diff:l,annotations:this.editSession?.annotations??In(this.lineAnnotations,Rt),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(l,s&&!o?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:i=!1,preventEmit:n=!1,lineAnnotations:r,fileContainer:o,containerWrapper:s,renderRange:l,...a}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const h=$i(a,"FileDiff.render"),d=h?.oldFile,f=h?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();const{collapsed:p=!1,themeType:c="system",expandUnchanged:m=!1}=this.options,g=p?void 0:l,S=this.hasThemeChanged(),b=h!=null,y=b&&(!Qn(d,this.deletionFile)||!Qn(f,this.additionFile));let x=e!=null&&!J(e,this.fileDiff);const R=r!=null&&(r.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(r):!1;if(!p&&kr(g,this.renderRange)&&!i&&!R&&!S&&(e!=null&&!x||e==null&&!y)){const T=this.applyCachedThemeState(c);return T&&this.finalizeRender(),T}let k;e==null&&b&&(y||this.fileDiff==null)&&(k=et(h.oldFile,h.newFile,this.options.parseDiffOptions));const{renderRange:w}=this;this.renderRange=g,b?(this.deletionFile=d,this.additionFile=f):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&x?this.updateExternalDiff(e,r):k!=null&&(x=!0,this.updateExternalDiff(k,r)),x&&this.clearReusableHeader(),r!=null&&this.setLineAnnotations(r);const E=this.getLatestDiff();if(E==null)return!1;E.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Wn(E,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());const{disableErrorHandling:D=!1,disableFileHeader:H=!1}=this.options;if(H&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,s),this.applyCachedThemeState(c),p){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const T=this.hunksRenderer.renderDiff(E,Wo);T!=null&&this.applyThemeState(o,T.themeStyles,c,T.baseThemeType),T?.headerElement!=null&&this.applyHeaderToDOM(T.headerElement,o,T.fileDiff),this.renderSeparators([]),this.renderedDiff=T?.fileDiff??E,this.injectUnsafeCSS()}catch(T){if(D)throw T;console.error(T),T instanceof Error&&this.applyErrorToDOM(T,o)}return this.finalizeRender(),n||this.emitPostRender(),!0}try{const T=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(i,R,y||x||S||!J(this.renderedDiff,E))&&this.applyPartialRender({fileDiff:E,previousRenderRange:w,renderRange:g}))){const F=this.hunksRenderer.renderDiff(E,g);if(F==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(o,F.themeStyles,c,F.baseThemeType),F.headerElement!=null&&this.applyHeaderToDOM(F.headerElement,o,F.fileDiff),F.additionsContentAST!=null||F.deletionsContentAST!=null||F.unifiedContentAST!=null?this.applyHunksToDOM(T,F):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(F.hunkData),this.renderedDiff=F.fileDiff}this.applyBuffers(T,g),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(T){if(D)throw T;console.error(T),T instanceof Error&&this.applyErrorToDOM(T,o)}return n||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:i}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;const n=this.mounted?"update":"mount";this.mounted=!0,i?.(t,this,n)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){const{editor:e,fileContainer:t}=this,i=this.getLatestAnnotations(),n=this.computeEditorRenderRange(this.renderRange),r=this.getLatestDiff();if(e==null||t==null||r==null||r.isPartial)return;const o=h=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==r)return;const d=this.editSession?.outgoingDiff,{fileDiff:f}=this,p=d!=null&&f!=null&&d!==r,c=p&&d!=null&&f!=null?Yn(d,f):!1;e.__syncRenderView({highlighter:h,fileContainer:t,fileDiff:r,lineAnnotations:i,renderRange:n,externalDocument:p,resetHistory:c})},s=this.getTheme(),l=r.lang??Dt(r.name),a=Ti({theme:s,lang:l});a!=null?o(a):mr({themes:cr(s),langs:["text",l],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(o)}computeEditorRenderRange(e){const t=this.getLatestDiff();if(e==null||t==null||Pi(e))return e;const{diffStyle:i="split",expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;let o,s;return ct({diff:t,diffStyle:i,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({additionLine:l})=>{l!=null&&(o??=l.lineNumber,s=l.lineNumber)}}),o==null||s==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:o-1,totalLines:s-o+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){const{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){const{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:i,outgoingDiff:n}={}}=this;if(n!=null&&t!=null){if(!t.isPartial&&Yn(n,t))return;i=n}if(!(i==null||i.isPartial))return{diffSession:{oldFile:i.type!=="new"?{name:i.prevName??i.name,lines:e?[...i.deletionLines]:i.deletionLines}:null,type:i.type,hunks:e?Hr(i.hunks):i.hunks},hasChanges:i.editSessionDirty===!0}}__attachEditor(e){if(this.type!=="file-diff")throw new Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw new Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw new Error("FileDiff.__attachEditor: a complete diff is required before editing");const t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(i){throw t(),i}}__resumeEditor(e){if(this.editor!==e)throw new Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(e)}resumeEditorRendering(e){const{fileDiff:t}=this,i=this.editSession?.outgoingDiff;i!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===i&&this.installEditSession(t);const n=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;n!=null?this.installEditSession(n,e.__getDocumentContents(Al(n)),e.__getDocumentSessionState()):this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();const r=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(r!=null&&this.hunksRenderer.diffCache===r&&(this.renderedDiff=r),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t==="install",e)}settleEditSession(e,t){const{editSession:i,fileDiff:n,lineAnnotations:r}=this;if(i==null||n==null)return;const{diff:o,annotations:s}=i;if(this.editor!=null)throw new Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();const l=s?.current;let a,h=null,d=null,f=!1,p;if(t==null)throw new Error("FileDiff.__completeEditSession: editor is required for completion");const c=Tr(o),m={name:c.name,contents:c.additionLines.join("")};c.lang!=null&&(m.lang=c.lang);const g={fileDiff:c,editor:t,originalFileDiff:n,oldFile:c.type==="new"?null:{name:c.prevName??c.name,contents:c.deletionLines.join("")},newFile:m,lineAnnotations:l,originalLineAnnotations:r};Object.freeze(g);try{if(t.__emitEditComplete(g),this.options.onEditComplete?.(g)==="accept"){if(c.cacheKey!=null&&c.cacheKey===n.cacheKey)throw new Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");a=c,h=g.oldFile,d=g.newFile}}catch(S){f=!0,p=S}if(e&&a!=null&&(this.fileDiff=a,this.additionFile!=null&&(this.deletionFile=h,this.additionFile=d),l!=null&&(this.lineAnnotations=l)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),f)throw p}finalizeEditSessionHunks(){const e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;const{collapsedContextThreshold:t=1}=this.options,i=il(e,this.hunksRenderer.getExpandedHunksMap(),t);return Wn(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(nl(e,i)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){const i=this.editSession?.diff;if(i==null)throw new Error("FileDiff.applyDocumentChange: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(i),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,i={}){const n=this.editSession?.diff;if(n==null)throw new Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n);const{shouldRefreshDiffsView:r,lineCountChangeInFlight:o}=i;if(this.hunksRenderer.updateRenderCache(e,t,o)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle==="split"?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){const e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){const t=this.getRenderedDiff();if(t==null)return!0;const{expandUnchanged:i=!1,collapsedContextThreshold:n=1}=this.options;return vr({fileDiff:t,lineNumber:e,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n})}getNearestRenderableLine(e,t){const i=this.getRenderedDiff();if(i==null)return e;const{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Go({fileDiff:i,lineNumber:e,direction:t,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}revealLine(e){const t=this.getRenderedDiff(),{expandUnchanged:i=!1,collapsedContextThreshold:n=1,expansionLineCount:r=100}=this.options;if(t==null||t.isPartial||i)return!1;const o=this.hunksRenderer.getExpandedHunksMap();for(const[h,d]of t.hunks.entries()){const[f,p]=vn(d);if(e<f){const c=Ht({isPartial:t.isPartial,rangeSize:d.collapsedBefore,expandedHunks:o,hunkIndex:h,collapsedContextThreshold:n}),m=f-c.rangeSize;if(c.renderAll||e<m+c.fromStart||e>=f-c.fromEnd)return!1;const g=e-(m+c.fromStart)+1,S=f-c.fromEnd-e;return g<=S?this.expandHunk(h,"up",g+r):this.expandHunk(h,"down",S+r),!0}if(e<p)return!1}const s=Tt({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:"FileDiff.revealLine"});if(s==null||s.renderAll)return!1;const l=t.hunks[t.hunks.length-1],[,a]=vn(l);return e<a+s.fromStart||e>=a+s.rangeSize?!1:(this.expandHunk(t.hunks.length,"up",e-(a+s.fromStart)+1+r),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Cr(this.handleEditSessionRender)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(const{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(const{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder==null?!1:(this.placeHolder.style.setProperty("height",`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){const{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||wt(e))return;const i=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>i||await t.primeDiffHighlightCache(e).catch(n=>{console.error(n)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(const{element:n}of this.separatorCache.values())n.remove();this.separatorCache.clear();return}const i=new Map(this.separatorCache);for(const n of e){const r=n.slotName;let o=this.separatorCache.get(r);if(o==null||!xl(n,o.hunkData)){o?.element.remove();const s=document.createElement("div");s.style.display="contents",s.slot=n.slotName;const l=t(n,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),o={element:s,hunkData:n},this.separatorCache.set(r,o)}i.delete(r)}for(const[n,{element:r}]of i.entries())this.separatorCache.delete(n),r.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,i=this.getLatestAnnotations();if(t!=null&&i.length>0)for(const[n,r]of i.entries()){const o=this.getAnnotationSlotName(r),s=`${n}-${o}`;let l=this.annotationCache.get(s);if(l==null||!Cl(r,l.annotation)){l?.element.remove();const a=t(r);if(a==null)continue;l={element:Us(o),annotation:r},l.element.appendChild(a),this.fileContainer.appendChild(l.element),this.annotationCache.set(s,l)}e.delete(s)}for(const[n,{element:r}]of e.entries())this.annotationCache.delete(n),r.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const i=_s();i.appendChild(t),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}getOrCreateFileContainer(e,t){const{fileContainer:i}=this,n=e??i??document.createElement("diffs-container"),r=i!==n;return i!=null&&r&&this.editor?.__captureFocusForDOMReplacement(),r&&this.emitPostRender(!0),this.fileContainer=n,i!=null&&r&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const i of t.children)i instanceof SVGElement?this.spriteSVG??=i:Mn(i)&&i.hasAttribute("data-theme-css")?(this.themeCSSStyle??=i,this.hasAdoptedThemeCSS=!0):Mn(i)&&i.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=i,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const i=document.createElement("div");i.innerHTML=Ns;const n=i.firstChild;n instanceof SVGElement&&(this.spriteSVG=n)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,i){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const{headerCache:{fileDiff:n,html:r,lastRenderedHTML:o}}=this,s=(i!==this.editSession?.diff&&J(n,i)?r:void 0)??Qe(e);if(this.headerCache.html=s,this.headerCache.fileDiff=i,s!==o){const m=document.createElement("div");m.innerHTML=s;const g=m.firstElementChild;if(!(g instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(g,this.headerElement):t.shadowRoot?.prepend(g),this.headerElement=g,this.headerCache.lastRenderedHTML=s}if(this.isContainerManaged)return;const{renderCustomHeader:l,renderHeaderPrefix:a,renderHeaderFilenameSuffix:h,renderHeaderMetadata:d}=this.options;if(l!=null){const m=l(i)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,dr,m),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}const f=a?.(i)??void 0,p=h?.(i)??void 0,c=d?.(i)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,hr,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,fr,p),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ur,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,i,n){if(n==null){t?.remove();return}const r=t??this.createHeaderSlotElement(i);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,n),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){const{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Os(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ws(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,i,n){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=n??i,s=this.getTheme(),l=typeof s=="string"?s:{...s},a=zi(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:n,scrollbarGutter:a};return}this.themeCSSStyle=Zs({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:Gs(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:n,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=$s(this.themeCSSStyle.textContent??"",zi(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ia()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Fn(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,i){const n=this.getColumnPair(e);if(n==null)return!1;const r=Ke(t[0]),o=Ke(t[1]);return r==null||o==null?!1:(n.gutter.innerHTML=Qe(r),n.content.innerHTML=Qe(o),i!==this.lastRowCount&&(n.gutter.style.setProperty("grid-row",`span ${i}`),n.content.style.setProperty("grid-row",`span ${i}`)),!0)}replaceCodeColumns(e,t){const{overflow:i="scroll"}=this.options,n=(this.options.hunkSeparators??"line-info")==="line-info",r=i==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1;const s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),h=this.hunksRenderer.renderCodeAST("additions",t);this.editor?.__captureFocusForDOMReplacement(),l!=null?(o=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Si({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeUnified,l,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l)),s.push(this.codeUnified)):a!=null||h!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Si({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeDeletions,a,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a)),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),h!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Si({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeAdditions,h,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(h)),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),s.length===0?e.textContent="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:i}){const{pre:n,codeUnified:r,codeAdditions:o,codeDeletions:s,options:{diffStyle:l="split"}}=this;if(n==null||t==null||i==null||!Number.isFinite(t.totalLines)||!Number.isFinite(i.totalLines)||this.lastRowCount==null)return!1;const a=this.getCodeColumns(l,r,s,o);if(a==null)return!1;const h=t.startingLine,d=i.startingLine,f=h+t.totalLines,p=d+i.totalLines,c=Math.max(h,d),m=Math.min(f,p);if(m<=c)return!1;const g=Math.max(0,c-h),S=Math.max(0,f-m),b=this.trimColumns({columns:a,trimStart:g,trimEnd:S,previousStart:h,overlapStart:c,overlapEnd:m,diffStyle:l});if(b<0)throw new Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<b)throw new Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let y=this.lastRowCount-b;const x=(E,D)=>{if(!(D<=0))return this.hunksRenderer.renderDiff(e,{startingLine:E,totalLines:D,bufferBefore:0,bufferAfter:0})},R=x(d,Math.max(c-d,0));if(R==null&&d<c)return!1;const k=x(m,Math.max(p-m,0));if(k==null&&p>m)return!1;const w=(E,D)=>{if(E!=null){if(l==="unified"&&!Array.isArray(a))this.insertPartialHTML(l,a,E,D);else if(l==="split"&&Array.isArray(a))this.insertPartialHTML(l,a,E,D);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");y+=E.rowCount,this.renderedDiff=E.fileDiff}};return this.cleanupErrorWrapper(),w(R,"afterbegin"),w(k,"beforeend"),this.lastRowCount!==y&&(this.applyRowSpan(l,a,y),this.lastRowCount=y),!0}insertPartialHTML(e,t,i,n){if(e==="unified"&&!Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("unified",i);this.renderPartialColumn(t,r,n)}else if(e==="split"&&Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("deletions",i),o=this.hunksRenderer.renderCodeAST("additions",i);this.renderPartialColumn(t[0],r,n),this.renderPartialColumn(t[1],o,n)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){const e=this.getLatestDiff();if(this.options.diffStyle!=="split"||e==null)return;const t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;const i=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(i))return;const n=(r,o)=>{if(o==null)return;const s=this.hunksRenderer.renderCodeAST(r,t),l=Ke(s?.[0]),a=Ke(s?.[1]);for(const[h,d]of[[o.gutter,l],[o.content,a]])if(d!=null&&h.childElementCount===d.length)for(let f=0;f<d.length;f++){const p=h.children[f],c=d[f].properties["data-line-type"];c!=null&&p.dataset.lineType!==c&&(p.dataset.lineType=c)}};n("deletions",i[0]),n("additions",i[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){const e=this.getLatestDiff();if(this.options.diffStyle!=="unified"||e==null)return;const t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;const i=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(i==null||Array.isArray(i))return;const n=this.hunksRenderer.renderCodeAST("unified",t),r=Ke(n?.[0]),o=Ke(n?.[1]),s=()=>{for(const[l,a]of[[i.gutter,r],[i.content,o]])a!=null&&(l.innerHTML=Qe(a));t.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",i,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Fn(this.pre,s):s(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,i){if(e==null||t==null)return;const n=Ke(t[0]),r=Ke(t[1]);if(n==null||r==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);i==="beforeend"&&o?.type==="element"&&typeof o.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],n,r,!0);const s=r.at(-1);i==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],n,r,!1),e.gutter.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(n)),e.content.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,i,n,r,o){if(!(t instanceof HTMLElement)||!(i instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);s!=null&&(o?(n.shift(),r.shift()):(n.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(i,s+e))}applyRowSpan(e,t,i){const n=r=>{r!=null&&(r.gutter.style.setProperty("grid-row",`span ${i}`),r.content.style.setProperty("grid-row",`span ${i}`))};if(e==="unified"&&!Array.isArray(t))n(t);else if(e==="split"&&Array.isArray(t))n(t[0]),n(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,i){let n=0,r=0,o=0,s=!1;const l=i>=0;if(e==null)return 0;const a=Array.from(e.content.children),h=Array.from(e.gutter.children);if(a.length!==h.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<a.length&&!(t<=0&&!l&&!s);){const d=h[o],f=a[o];if(o++,!(d instanceof HTMLElement)||!(f instanceof HTMLElement))throw console.error({gutterElement:d,contentElement:f}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset||d.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset)){d.remove(),f.remove(),r++;continue}if("lineIndex"in d.dataset&&"lineIndex"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),t>0&&(t--,t===0&&(s=!0)),r++),n++;continue}if("separator"in d.dataset&&"separator"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="buffer"&&"contentBuffer"in f.dataset){const p=this.getBufferSize(f.dataset);if(p==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const c=Math.min(t,p),m=p-c;m>0?(this.updateBufferSize(d,m),this.updateBufferSize(f,m),r+=c):(d.remove(),f.remove(),r+=p),t-=c,t===0&&m===0&&(s=!0)}else if(l){const c=n,m=n+p-1;if(i<=c)d.remove(),f.remove(),r+=p;else if(i<=m){const g=m-i+1,S=p-g;this.updateBufferSize(d,S),this.updateBufferSize(f,S),r+=g}}n+=p;continue}throw console.error({gutterElement:d,contentElement:f}),new Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:i,overlapStart:n,previousStart:r,trimEnd:o,trimStart:s}){const l=Math.max(0,n-r),a=i-r;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const h=s>0,d=o>0;if(!h&&!d)return 0;const f=h?l:0,p=d?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,f,p);if(t==="split"&&Array.isArray(e)){const c=this.trimColumnRows(e[0],f,p),m=this.trimColumnRows(e[1],f,p);if(e[0]!=null&&e[1]!=null&&c!==m)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?c:m}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){const t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;const t=e.children[0],i=e.children[1];if(!(!(t instanceof HTMLElement)||!(i instanceof HTMLElement)||t.dataset.gutter==null||i.dataset.content==null))return{gutter:t,content:i}}getCodeColumns(e,t,i,n){if(e==="unified")return this.getColumnPair(t);{const r=this.getColumnPair(i),o=this.getColumnPair(n);return r!=null||o!=null?[r,o]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:i,totalLines:n},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:h="split"}=this.options,d={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:l,overflow:a,split:h==="unified"?!1:t!=null&&i!=null,totalLines:n,customProperties:r};Ps(d,this.appliedPreAttributes)||(Xs(e,d),this.appliedPreAttributes=d)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const i=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",i.appendChild(this.errorWrapper);const n=document.createElement("div");n.dataset.errorMessage="",n.innerText=e.message,this.errorWrapper.appendChild(n);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}},v(Ai,"LoadedCustomComponent",!0),Ai);function Al(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join("")}}function Qn(e,t){return e==null||t==null?e==null&&t==null:br(e,t)}function Hl({fileDiff:e,oldFile:t,newFile:i}){return e!=null&&e.hunks.length>0||t!=null||i!=null}function Tl({fileDiff:e,oldFile:t,newFile:i}){return e!=null||t!=null||i!=null}function Dl(e,t,i=!1){return!i&&e==null&&t}function Ml(e,t,i=!1){return e==null&&t&&!i}function Ke(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Il({fileDiff:e,metrics:t,disableFileHeader:i,hunkSeparators:n,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s,canHydratePartialDiff:l}){let a=ft(t,i),h=a;const d=r?!0:o,f=e.hunks.length-1;for(let p=0;p<e.hunks.length;p++){const c=e.hunks[p];if(c==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const m=Ht({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:d,hunkIndex:p,collapsedContextThreshold:s}),g=(m.fromStart+m.fromEnd)*t.lineHeight;if(a+=g,h+=g,m.collapsedLines>0){const y=kt({type:n,metrics:t,hunkIndex:p,hunkSpecs:c.hunkSpecs})?.totalHeight??0;a+=y,h+=y}a+=c.splitLineCount*t.lineHeight,h+=c.unifiedLineCount*t.lineHeight;const S=Fl(c);a+=S.split*t.lineHeight,h+=S.unified*t.lineHeight;const b=p===f?Tt({fileDiff:e,hunkIndex:p,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(b!=null){const y=(b.fromStart+b.fromEnd)*t.lineHeight;if(a+=y,h+=y,b.collapsedLines>0){const x=ot({type:n,metrics:t})?.totalHeight??0;a+=x,h+=x}}else if(p===f&&e.isPartial&&l){const y=ot({type:n,metrics:t})?.totalHeight??0;a+=y,h+=y}}if(e.hunks.length>0){const p=Sr(t);a+=p,h+=p}return{splitHeight:a,unifiedHeight:h}}function Fl(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){const i=t.lines>0?1:0;return{split:i,unified:i}}return Nl(e,t)}function Nl(e,t){const i=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),n=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:n||r?1:0,unified:i}}const ji=3e3,qt=new Map;let Pl=-1;var zl=class extends Vr{constructor(t,i,n,r,o=!1){super(t,r,o);v(this,"__id",`little-virtualized-file-diff:${++Pl}`);v(this,"renderType","virtualized");v(this,"top");v(this,"height",0);v(this,"metrics");v(this,"cache",{heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:qt,ghostTextRowsByIndex:new Map});v(this,"isVisible",!1);v(this,"isSetup",!1);v(this,"virtualizer");v(this,"layoutDirty",!0);v(this,"forceRenderOverride");v(this,"currentCollapsed");v(this,"pendingHydratedDiff");v(this,"pendingExpansions");v(this,"pendingRender");v(this,"onRender",t=>this.fileContainer==null?!1:(t&&(this.top=this.getVirtualizedTop()),this.render()));v(this,"expandHunk",(t,i,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:t,direction:i,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(t,i,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))});this.virtualizer=i,this.metrics=gi(n)}setMetrics(t,i=!1){const n=gi(t);!i&&Fi(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(t){this.syncLineAnnotations(t)&&(this.forceRenderOverride=!0)}syncLineAnnotations(t){return t==null||!this.isNewAnnotations(t)||t.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(t),!0)}syncEditSessionAnnotationsFromEditor(t){return super.syncEditSessionAnnotationsFromEditor(t)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(t){const i=this.cache.fileAnnotationHeight;return t===i?!1:(this.cache.fileAnnotationHeight=t,this.cache.measuredHeightDeltaTotal+=t-i,!0)}hasFileAnnotations(t){const i=this.getLatestAnnotations();return Ms(i)?i.some(n=>n.lineNumber!==0?!1:t.type==="new"?n.side==="additions":t.type==="deleted"?n.side==="deletions":!0):!1}getLineHeight(t,i=!1){return this.getEstimatedLineHeight(i)+(this.cache.heightDeltas.get(t)??0)}getEstimatedLineHeight(t=!1){const i=t?2:1;return this.metrics.lineHeight*i}setOptions(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;const{options:i}=this,n=!rs(i,t),r=n&&Wl(i,t);super.setOptions(t),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Gl(i,t)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache({forceSimpleRecompute:t=!1,includeEstimatedHeights:i=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=qt,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(i,n),t&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(t,i=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&i&&(this.renderRange=void 0)}applyGhostTextRows(t,i){const{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:o},metrics:{lineHeight:s}}=this;if(r===i)return!1;const l=this.getDiffStyle(),a=new Map;for(const[d,f]of i){const p=this.getLineIndexForDiff(t,d+1,"additions");p!=null&&a.set(l==="split"?p[1]:p[0],f)}let h=!1;for(const d of new Set([...o.keys(),...a.keys()])){const f=((a.get(d)??0)-(o.get(d)??0))*s;if(f===0)continue;const p=(n.get(d)??0)+f;p===0?n.delete(d):n.set(d,p),this.cache.measuredHeightDeltaTotal+=f,h=!0}return this.cache.ghostTextRows=i,this.cache.ghostTextRowsByIndex=a,h}reconcileHeights(){let t=!1;const{options:{overflow:i="scroll"},metrics:{lineHeight:n}}=this,r=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(t=!0),this.height=0,t;this.top=this.getVirtualizedTop(),t=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??qt);const{ghostTextRowsByIndex:o}=this.cache,s=i!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!s&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return t&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),t;const l=this.getDiffStyle(),a=l==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Er(this.renderRange)){const h=Ul(a)??0;this.setFileAnnotationHeight(h)&&(t=!0)}for(const h of a){if(h==null)continue;const d=h.children[1];if(!(d instanceof HTMLElement))continue;const f=l==="split"&&h===this.codeDeletions;for(const p of d.children){if(!(p instanceof HTMLElement))continue;const c=p.dataset.lineIndex;if(c==null)continue;const m=jl(c,l),g=o.get(m)??0;if(f&&g>0)continue;const S=this.cache.heightDeltas.get(m)??0;if(!s&&S===g*n)continue;let b=p.getBoundingClientRect().height+g*n,y=!1;p.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in p.nextElementSibling.dataset||"noNewline"in p.nextElementSibling.dataset)&&("noNewline"in p.nextElementSibling.dataset&&(y=!0),b+=p.nextElementSibling.getBoundingClientRect().height);const x=this.getEstimatedLineHeight(y),R=b-x;R!==S&&(t=!0,this.cache.measuredHeightDeltaTotal+=R-S,R===0?this.cache.heightDeltas.delete(m):this.cache.heightDeltas.set(m,R))}}return(t||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),t}flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(t,i,n,r){let o=!1,s=!1;const{pendingExpansions:l,pendingHydratedDiff:a,options:{collapsed:h=!1}}=this;if(a!=null&&(this.pendingHydratedDiff=void 0,a.expectedDiff===t&&(Object.assign(t,a.nextDiff),this.setHydratedState(a.files),this.installHydratedSessionDiff(t),this.forceRenderOverride=!0,o=!0,s=!0)),l!=null){this.pendingExpansions=void 0;for(const{hunkIndex:g,direction:S,expansionLineCountOverride:b}of l)this.hunksRenderer.expandHunk(g,S,b),this.forceRenderOverride=!0,s=!0}const d=this.updateExternalDiff(t,r),{pendingRenderDiff:f,layoutDiffChanged:p,renderedDiffChanged:c,annotationsChanged:m}=this.updatePendingRender(t,r);return!this.forceRenderOverride&&(d||c||m)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||p)&&(o=!0),(p||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(s=!0),n?.metrics!=null&&(this.metrics=gi(n.metrics),o=!0,s=!0),this.currentCollapsed!==h&&(this.currentCollapsed=h,o=!0),o?this.resetLayoutCache({includeEstimatedHeights:s}):s&&this.invalidateDerivedLayoutCache(!0),this.top=i,this.computeApproximateSize(!1,f),this.height}getLinePosition(t,i="additions"){const n=this.getLayoutDiff();if(n==null||t<1)return;const r=this.getLineIndexForDiff(n,t,i);if(r==null)return;const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsed:l=!1,collapsedContextThreshold:a=1}=this.options,h=this.getDiffStyle(),d=this.getHunkSeparatorType(),f=h==="split"?r[1]:r[0];this.approximateLayoutCheckpoints(n);const p=ft(this.metrics,o),c=this.getLayoutCheckpointBeforeLineIndex(f);let m=c?.top??p+this.cache.fileAnnotationHeight;if(l)return{top:p,height:0};let g;return ct({diff:n,diffStyle:h,startingLine:c?.renderedLineIndex??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:S,hunk:b,collapsedBefore:y,collapsedAfter:x,deletionLine:R,additionLine:k})=>{const w=h==="split"?k?.splitLineIndex??R?.splitLineIndex:k?.unifiedLineIndex??R?.unifiedLineIndex;if(w==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(y>0){const D=kt({type:d,metrics:this.metrics,hunkIndex:S,hunkSpecs:b?.hunkSpecs});if(D!=null){if(m+=D.gapBefore,f>=w-y&&f<w)return g={top:m,height:D.height},!0;m+=D.height+D.gapAfter}}const E=this.getLineHeight(w,(k?.noEOFCR??!1)||(R?.noEOFCR??!1));if(w===f)return g={top:m,height:E},!0;if(m+=E,x>0){const D=ot({type:d,metrics:this.metrics});if(D!=null){if(f>w&&f<=w+x)return g={top:m+D.gapBefore,height:D.height},!0;m+=D.totalHeight}}return!1}}),g}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){const i=this.getLayoutDiff();if(i==null)return;const{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options;if(o)return;const l=this.getDiffStyle(),a=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(i);const h=this.getLayoutCheckpointBeforeTop(t);let d=h?.top??ft(this.metrics,n)+this.cache.fileAnnotationHeight,f;return ct({diff:i,diffStyle:l,startingLine:h?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:p,hunk:c,collapsedBefore:m,collapsedAfter:g,deletionLine:S,additionLine:b})=>{const y=l==="split"?b?.splitLineIndex??S?.splitLineIndex:b?.unifiedLineIndex??S?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(m>0){const R=kt({type:a,metrics:this.metrics,hunkIndex:p,hunkSpecs:c?.hunkSpecs});R!=null&&(d+=R.totalHeight)}if(d>=t&&(S!=null?f={lineNumber:S.lineNumber,side:"deletions",top:d}:b!=null&&(f={lineNumber:b.lineNumber,side:"additions",top:d}),f!=null))return!0;const x=this.getLineHeight(y,(b?.noEOFCR??!1)||(S?.noEOFCR??!1));if(d+=x,g>0){const R=ot({type:a,metrics:this.metrics});R!=null&&(d+=R.totalHeight)}return!1}}),f}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){const i=this.getLayoutDiff();if(this.top==null||i==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const n=t!=null?this.computeRenderRangeFromWindow(i,this.top,t):this.renderRange;if(n==null)return;const{bufferBefore:r,bufferAfter:o,totalLines:s}=n;let l=0;if(s===0){const a=t??this.virtualizer.getWindowSpecs();this.top<a.top&&(l=o)}return{topOffset:this.top+r+l,height:this.height-(r+o)}}cleanUp(t=!1){const i=this.cache.ghostTextRows.size>0;i&&(this.layoutDirty=!0);const n=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(i||!J(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),t||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),n&&this.virtualizer.instanceChanged(this,!0)}async handleFilesLoaded(t,i){if(!(this.fileDiff!==t||!t.isPartial)){if(this.isAdvancedMode()){const n=Ui("clone",t,i);if(await Gi(()=>this.primeHighlightCache(n)),this.fileDiff!==t)return;this.pendingHydratedDiff={expectedDiff:t,nextDiff:n,files:i}}else{if(Ui("merge",t,i),this.setHydratedState(i),!this.installHydratedSessionDiff(t)&&(await Gi(()=>this.primeHighlightCache(t)),this.fileDiff!==t))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(t){if(super.isLineRenderable(t))return!0;const{pendingExpansions:i}=this,n=this.getRenderedDiff();if(i==null||i.length===0||n==null)return!1;const{expansionLineCount:r=100,collapsedContextThreshold:o=1}=this.options,s=new Map(this.hunksRenderer.getExpandedHunksMap());for(const l of i){const a={...s.get(l.hunkIndex)??{fromStart:0,fromEnd:0}},h=l.expansionLineCountOverride??r;(l.direction==="up"||l.direction==="both")&&(a.fromStart+=h),(l.direction==="down"||l.direction==="both")&&(a.fromEnd+=h),s.set(l.hunkIndex,a)}return vr({fileDiff:n,lineNumber:t,expandedHunks:s,collapsedContextThreshold:o})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(t){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,t&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!t&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;const t=this.getLatestDiff(),i=t==null?void 0:this.hunksRenderer.getDiffForNextRender(t);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!J(this.getRenderedDiff(),i))}syncGhostTextRows(){const t=this.getAdvancedVirtualizer();t!=null?(t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0)):this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,i,n=!1){const{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,i),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});const o=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&o!=null){const s=this.virtualizer.getWindowSpecs(),l=this.computeRenderRangeFromWindow(o,this.top??0,s);l.bufferAfter!==r.bufferAfter&&this.updateBuffers(l)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,i=this.getLayoutDiff()){const n=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!n)return;const r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,i==null){this.layoutDirty=!1;return}this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??qt);const{disableFileHeader:o=!1,collapsed:s=!1}=this.options,l=ft(this.metrics,o);if(this.height+=l,s){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(i)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(i),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(t=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(t);const i=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(i==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return i}ensureEstimatedDiffHeights(t=this.getLayoutDiff()){if(t==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;const{disableFileHeader:i=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:o,unifiedHeight:s}=Il({fileDiff:t,metrics:this.metrics,disableFileHeader:i,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Ei(t,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=o,this.cache.estimatedUnifiedHeight=s}validateComputedHeight(t=this.getLayoutDiff()){if(this.fileContainer==null||t==null)return;const i=this.fileContainer.getBoundingClientRect();i.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:i.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:t,fileDiff:i,forceRender:n=!1,lineAnnotations:r,...o}={}){const s=$i(o,"VirtualizedFileDiff.render"),l=s!=null,a=s?.oldFile,h=s?.newFile,d=l&&(!er(a,this.deletionFile)||!er(h,this.additionFile));let f=i??this.fileDiff;i==null&&l&&(d||this.fileDiff==null)&&(f=et(s.oldFile,s.newFile,this.options.parseDiffOptions));const{forceRenderOverride:p,isSetup:c}=this;this.forceRenderOverride=void 0;const m=f!=null&&!J(this.fileDiff,f),g=m||d;if(t=this.getOrCreateFileContainer(t),f==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;m&&this.updateExternalDiff(f,r);const{pendingRenderDiff:S,layoutDiffChanged:b,renderedDiffChanged:y,annotationsChanged:x}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(f)??f)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(f,r);if(b&&this.resetLayoutCache({includeEstimatedHeights:!0}),c)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,S));else{this.computeApproximateSize(!1,S);const E=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(E==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");E.connect(t,this),this.isVisible=E.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!c))return s!=null&&(this.deletionFile=a,this.additionFile=h),m&&this.clearReusableHeader(),this.renderPlaceholder(this.height);const R=this.virtualizer.getWindowSpecs(),k=this.top??0,w=this.computeRenderRangeFromWindow(S,k,R);return super.render({fileDiff:f,fileContainer:t,renderRange:w,lineAnnotations:r,forceRender:(p??n)||x||y||m,...s,...o})}finalizeRender(){if(!J(this.getRenderedDiff(),this.pendingRender?.diff))throw new Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,i){const n=this.getLatestDiff(t)??t,r=this.getRenderedDiff(),{pendingRender:o}=this,s=o?.diff??r,l=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:l},{pendingRenderDiff:l,annotationsChanged:this.syncLineAnnotations(i),layoutDiffChanged:!J(s,l),renderedDiffChanged:!J(r,l)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return $l(this.options.hunkSeparators)}approximateLayoutCheckpoints(t){if(!this.layoutDirty&&this.cache.checkpoints.length>0||t.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:i=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,o=t.hunks.length-1,s=Ei(t,this.options.loadDiffFiles!=null),l=this.getDiffStyle(),a=this.getHunkSeparatorType(),h=n?!0:this.hunksRenderer.getExpandedHunksMap(),d=_l(this.cache.heightDeltas);let f=ft(this.metrics,i)+this.cache.fileAnnotationHeight,p=0;const c=({rowCount:m,startLineIndex:g,preSeparatorHeight:S=0,postSeparatorHeight:b=0,metadataOffsets:y=[]})=>{if(m<=0)return;const x=p,R=p+m;let k=Ol(x);for(;k<R;){const w=k-x,E=f+(w>0?S:0)+w*this.metrics.lineHeight+Bl(y,w)*this.metrics.lineHeight+Jn(d,g,g+w);this.cache.checkpoints.push({renderedLineIndex:k,lineIndex:g+w,top:E}),k+=ji}f+=S+m*this.metrics.lineHeight+y.length*this.metrics.lineHeight+Jn(d,g,g+m)+b,p=R};for(let m=0;m<t.hunks.length;m++){const g=t.hunks[m];if(g==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const S=Ht({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:h,hunkIndex:m,collapsedContextThreshold:r}),b=S.collapsedLines>0?kt({type:a,metrics:this.metrics,hunkIndex:m,hunkSpecs:g.hunkSpecs})?.totalHeight??0:0;c({rowCount:S.fromStart,startLineIndex:(l==="split"?g.splitLineStart:g.unifiedLineStart)-S.rangeSize});let y=b;c({rowCount:S.fromEnd,startLineIndex:(l==="split"?g.splitLineStart:g.unifiedLineStart)-S.fromEnd,preSeparatorHeight:y}),S.fromEnd>0&&(y=0);const x=m===o?Tt({fileDiff:t,hunkIndex:m,expandedHunks:h,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"}):void 0,R=x!=null&&x.collapsedLines>0?ot({type:a,metrics:this.metrics})?.totalHeight??0:m===o&&s?ot({type:a,metrics:this.metrics})?.totalHeight??0:0,k=x!=null?x.fromStart+x.fromEnd:0,w=l==="split"?g.splitLineCount:g.unifiedLineCount,E=l==="split"?g.splitLineStart:g.unifiedLineStart;c({rowCount:w,startLineIndex:E,preSeparatorHeight:y,postSeparatorHeight:k===0?R:0,metadataOffsets:Vl({diffStyle:l,hunk:g,rowCount:w})}),x!=null&&k>0&&c({rowCount:k,startLineIndex:E+w,postSeparatorHeight:R})}this.cache.totalLines=p}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let i=0,n=this.cache.checkpoints.length-1,r;for(;i<=n;){const o=i+n>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.lineIndex<=t?(r=s,i=o+1):n=o-1}return r}getLayoutCheckpointBeforeTop(t,i){let n=0,r=this.cache.checkpoints.length-1,o=-1;for(;n<=r;){const s=n+r>>1,l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");l.top<=t?(o=s,n=s+1):r=s-1}if(i==null)return o>=0?this.cache.checkpoints[o]:void 0;for(let s=o;s>=0;s--){const l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(l.renderedLineIndex%i===0)return l}}getExpandedLineCount(t,i){let n=0;if(t.isPartial){for(const a of t.hunks)n+=i==="split"?a.splitLineCount:a.unifiedLineCount;return n}const{expandUnchanged:r=!1,collapsedContextThreshold:o=1}=this.options,s=r?!0:this.hunksRenderer.getExpandedHunksMap();for(const[a,h]of t.hunks.entries()){const d=i==="split"?h.splitLineCount:h.unifiedLineCount;n+=d;const f=Math.max(h.collapsedBefore,0),{fromStart:p,fromEnd:c,renderAll:m}=Ht({isPartial:t.isPartial,rangeSize:f,expandedHunks:s,hunkIndex:a,collapsedContextThreshold:o});f>0&&(n+=m?f:p+c)}const l=Tt({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"VirtualizedFileDiff"});return l!=null&&(n+=l.fromStart+l.fromEnd),n}getLayoutLineCount(t,i){const n=this.getExpandedLineCount(t,i),r=i==="split"?t.splitLineCount:t.unifiedLineCount;return Math.max(n,r,t.additionLines.length,t.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(t,i,{top:n,bottom:r}){const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:l=1}=this.options,{hunkLineCount:a,lineHeight:h}=this.metrics,d=this.getDiffStyle(),f=this.getHunkSeparatorType(),p=Ei(t,this.options.loadDiffFiles!=null),c=this.height;let m=this.getLayoutLineCount(t,d);const g=ft(this.metrics,o),S=t.hunks.length>0?Sr(this.metrics):0,{fileAnnotationHeight:b}=this.cache,y=g+b,x=Math.max(0,c-g-b-S),R=this.hasFileAnnotations(t),k=i+g,w=b>0&&R&&k<r&&k+b>n;if(i<n-c||i>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-g-S};if(m<=a||t.hunks.length===0)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(t),m=this.getLayoutLineCount(t,d);const E=Math.ceil(Math.max(r-n,0)/h),D=Math.ceil(E/a)*a+a,H=D/a,T=H,F=[],j=(n+r)/2,N=this.getLayoutCheckpointBeforeTop(Math.max(0,n-i-D*h*2),a);let B=i+(N?.top??y),ce=N?.renderedLineIndex??0,$,V,re;if(ct({diff:t,diffStyle:d,startingLine:N?.renderedLineIndex??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:Ee,hunk:be,collapsedBefore:tt,collapsedAfter:Ie,deletionLine:Se,additionLine:_})=>{const oe=_!=null?_.splitLineIndex:Se.splitLineIndex,se=_!=null?_.unifiedLineIndex:Se.unifiedLineIndex,Fe=(_?.noEOFCR??!1)||(Se?.noEOFCR??!1),me=Ee===t.hunks.length-1&&be!=null&&(d==="split"?oe===be.splitLineStart+be.splitLineCount-1:se===be.unifiedLineStart+be.unifiedLineCount-1),q=(tt>0?kt({type:f,metrics:this.metrics,hunkIndex:Ee,hunkSpecs:be?.hunkSpecs}):void 0)?.totalHeight??0;B+=q;const K=ce%a===0,ee=Math.floor(ce/a);if(K&&(F[ee]=B-(i+y+q),re!=null)){if(re<=0)return!0;re--}const ye=this.getLineHeight(d==="split"?oe:se,Fe);if(B>n-ye&&B<r&&($??=ee),V==null&&B+ye>j&&(V=ee),re==null&&B>=r&&K&&(re=T),ce++,B+=ye,Ie>0||me&&p){const at=ot({type:f,metrics:this.metrics});at!=null&&(B<r&&B+at.totalHeight>n&&($??=ee),V==null&&B+at.totalHeight>j&&(V=ee),B+=at.totalHeight)}return!1}}),$==null)if(w)$=0,V=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-g-S};V??=$;const W=Math.round(V-H/2),P=Math.max(0,Math.ceil(m/a)-H),U=Math.max(0,Math.min(W,P)),G=U*a,Q=W<0?D+W*a:D,de=F[U]??0,Z=G===0?0:b+de,he=U+Q/a,ve=he<F.length?x-F[he]:x-(B-i-y);return{startingLine:G,totalLines:Q,bufferBefore:Z,bufferAfter:Math.max(0,ve)}}};function Ul(e){let t;for(const i of e){if(i==null)continue;const n=i.children[1];if(n instanceof HTMLElement)for(const r of n.children)r instanceof HTMLElement&&r.dataset.lineAnnotation===Ds&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function _l(e){const t=Array.from(e).sort((o,s)=>o[0]-s[0]),i=[],n=[0];let r=0;for(const[o,s]of t)i.push(o),r+=s,n.push(r);return{lineIndexes:i,prefixTotals:n}}function Jn({lineIndexes:e,prefixTotals:t},i,n){if(i>=n||e.length===0)return 0;const r=Zn(e,i);return(t[Zn(e,n)]??0)-(t[r]??0)}function Zn(e,t){let i=0,n=e.length;for(;i<n;){const r=i+n>>1,o=e[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?i=r+1:n=r}return i}function Ol(e){return Math.ceil(e/ji)*ji}function Bl(e,t){let i=0;for(const n of e)n<t&&i++;return i}function Vl({diffStyle:e,hunk:t,rowCount:i}){if(i<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const n=t.hunkContent.at(-1);if(n==null)return[];if(n.type==="context")return[i-1];const r=Math.max(n.deletions,n.additions),o=n.deletions+n.additions;if(e==="split")return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[i-1]:[];const s=[],l=i-o;return n.deletions>0&&t.noEOFCRDeletions&&s.push(l+n.deletions-1),n.additions>0&&t.noEOFCRAdditions&&s.push(i-1),s}function Wl(e,t){return(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Gl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Ei(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function $l(e){return typeof e=="function"?"custom":e??"line-info"}function er(e,t){return e==null||t==null?e==null&&t==null:br(e,t)}function jl(e,t){const[i,n]=e.split(",").map(Number);return t==="split"?n:i}var ql=ge('<span class="diff-header-chevron svelte-1janpwr"><!></span>'),Kl=ge('<span class="diff-header-old-name svelte-1janpwr"> </span> <span class="diff-header-arrow svelte-1janpwr">→</span>',1),Xl=ge('<span class="diff-stat-additions svelte-1janpwr"> </span>'),Yl=ge('<span class="diff-stat-deletions svelte-1janpwr"> </span>'),Ql=ge('<span class="diff-header-stats svelte-1janpwr"><!> <!></span>'),Jl=ge('<!> <span class="diff-header-icon svelte-1janpwr"><!></span> <span class="diff-header-filename svelte-1janpwr"><!> </span> <!>',1),Zl=ge('<div class="diff-header-actions svelte-1janpwr"></div>'),ed=ge('<div class="diff-header svelte-1janpwr"><!> <!></div>');function Wr(e,t){if(new.target)return ir({component:Wr,...e});or(t,!0);let i=M(t,"fileName",7),n=M(t,"oldFileName",7),r=M(t,"additions",7),o=M(t,"deletions",7),s=M(t,"collapsible",7,!1),l=M(t,"collapsed",7,!1),a=M(t,"actions",23,()=>[]),h=M(t,"onToggle",7);const d=ne(()=>n()&&n()!==i()),f=ne(()=>{if(r()===void 0&&o()===void 0)return null;const b=[];return r()!==void 0&&r()>0&&b.push(`+${r()}`),o()!==void 0&&o()>0&&b.push(`-${o()}`),b.length>0?b.join(" "):null});var p={get fileName(){return i()},set fileName(b){i(b),I()},get oldFileName(){return n()},set oldFileName(b){n(b),I()},get additions(){return r()},set additions(b){r(b),I()},get deletions(){return o()},set deletions(b){o(b),I()},get collapsible(){return s()},set collapsible(b=!1){s(b),I()},get collapsed(){return l()},set collapsed(b=!1){l(b),I()},get actions(){return a()},set actions(b=[]){a(b),I()},get onToggle(){return h()},set onToggle(b){h(b),I()},$set:nr,$on:(b,y)=>rr(t,b,y)},c=ed(),m=De(c);{let b=ne(()=>s()?"clickable":""),y=ne(()=>s()?h():void 0),x=ne(()=>!s());Di(m,{variant:"plain",size:"compact",get class(){return`diff-header-content ${C(b)??""}`},truncateLabel:!1,labelClass:"flex min-w-0 flex-1 items-center gap-2",get onclick(){return C(y)},get disabled(){return C(x)},children:(R,k)=>{var w=Jl(),E=hn(w);{var D=W=>{var P=ql(),U=De(P);{let G=ne(()=>l()?Ko:Xo);vi(U,{get icon(){return C(G)}})}ke(P),le(W,P)};we(E,W=>{s()&&W(D)})}var H=Xe(E,2),T=De(H);{var F=W=>{vi(W,{get icon(){return jo}})},j=W=>{vi(W,{get icon(){return qo}})};we(T,W=>{C(d)?W(F):W(j,-1)})}ke(H);var N=Xe(H,2),B=De(N);{var ce=W=>{var P=Kl(),U=hn(P),G=Xt(U,!0);Hi(2),Me(()=>rt(G,n())),le(W,P)};we(B,W=>{C(d)&&W(ce)})}var $=Xe(B);ke(N);var V=Xe(N,2);{var re=W=>{var P=Ql(),U=De(P);{var G=Z=>{var he=Xl(),ve=Xt(he);Me(()=>rt(ve,`+${r()??""}`)),le(Z,he)};we(U,Z=>{r()!==void 0&&r()>0&&Z(G)})}var Q=Xe(U,2);{var de=Z=>{var he=Yl(),ve=Xt(he);Me(()=>rt(ve,`-${o()??""}`)),le(Z,he)};we(Q,Z=>{o()!==void 0&&o()>0&&Z(de)})}ke(P),le(W,P)};we(V,W=>{C(f)&&W(re)})}Me(()=>rt($,` ${i()??""}`)),le(R,w)},$$slots:{default:!0}})}var g=Xe(m,2);{var S=b=>{var y=Zl();ko(y,21,a,Eo,(x,R)=>{{let k=ne(()=>C(R).variant==="primary"?"primary":C(R).variant==="danger"?"destructive":C(R).variant==="success"?"plain":"outline"),w=ne(()=>C(R).variant==="primary"?"primary":C(R).variant==="success"?"success":C(R).variant==="danger"?"danger":"");Di(x,{get variant(){return C(k)},size:"compact",get class(){return`diff-action-button ${C(w)??""}`},get disabled(){return C(R).disabled},get onclick(){return C(R).onClick},children:(E,D)=>{Hi();var H=ar();Me(()=>rt(H,C(R).label)),le(E,H)},$$slots:{default:!0}})}}),ke(y),le(b,y)};we(g,b=>{a().length>0&&b(S)})}return ke(c),le(e,c),sr(p)}const td=500;function id(e,t){const i=e.replace(/\u00a0/g," ").replace(/[\t\r\n]+/g," ").trim();return i?i.slice(0,t):null}function Kt(e,t){if(!t)return!1;if(e instanceof ShadowRoot)return t.getRootNode()===e;const i=e;if(i.contains(t))return!0;const n=t.getRootNode();return n instanceof ShadowRoot&&i.contains(n.host)}function nd(e,t){if(!Kt(t,e.anchorNode)||!Kt(t,e.focusNode))return!1;for(let i=0;i<e.rangeCount;i++){const n=e.getRangeAt(i);if(!Kt(t,n.startContainer)||!Kt(t,n.endContainer))return!1}return!0}function tr(e,t,i){return!e||e.isCollapsed||e.rangeCount===0||!t.some(n=>nd(e,n))?null:id(e.toString(),i)}function rd(e,{extraRoots:t=[],maxLength:i=td}={}){const n=[e,...t].filter(o=>o!=null);if(n.length===0||typeof document>"u")return null;const r=tr(document.getSelection?.(),n,i);if(r)return r;for(const o of n)if(o instanceof ShadowRoot){const s=tr(o.getSelection?.(),[o],i);if(s)return s}return null}function od(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}const Lt=new Map;function Ri(e){if(e.length===0)return"0";const t=Lt.get(e);if(t!==void 0)return t;const i=od(e);if(Lt.size>512){const n=Array.from(Lt.keys());for(let r=0;r<n.length>>1;r++)Lt.delete(n[r])}return Lt.set(e,i),i}var sd=ge('<div class="diff-search-bar svelte-htizai"><!></div>'),ad=ge('<div class="pure-diff-container svelte-htizai"></div>'),ld=ge('<div class="pure-diff-empty svelte-htizai"><p class="text-subtle text-sm"> </p></div>'),dd=ge("<div><!> <!></div>"),hd=ge('<div class="pure-diff-preview svelte-htizai"><!></div>'),fd=ge('<div tabindex="-1"><!> <!></div>');function ud(e,t){if(new.target)return ir({component:ud,...e});or(t,!0);const i=()=>dn(se,"$isDarkTheme",r),n=()=>dn(oe,"$codeFontFamilyCSS",r),[r,o]=So(),s=2*1024*1024;let l=M(t,"patch",7),a=M(t,"oldContent",7),h=M(t,"newContent",7),d=M(t,"fileName",7,"file"),f=M(t,"oldFileName",7),p=M(t,"language",7),c=M(t,"viewMode",7,"unified"),m=M(t,"showHeader",7,!0),g=M(t,"showStats",7,!0),S=M(t,"showLineNumbers",7,!0),b=M(t,"diffIndicators",7,"bars"),y=M(t,"overflow",7,"scroll"),x=M(t,"maxHeight",7),R=M(t,"hunkSeparators",7,"line-info"),k=M(t,"expandUnchanged",7,!1),w=M(t,"expansionLineCount",7,20),E=M(t,"lineDiffType",7,"word-alt"),D=M(t,"maxLineDiffLength",7,500),H=M(t,"collapsible",7,!1),T=M(t,"initialCollapsed",7,!1),F=M(t,"previewLines",7,5),j=M(t,"annotations",23,()=>[]),N=M(t,"renderAnnotation",7),B=M(t,"enableLineSelection",7,!1),ce=M(t,"selectedLines",7,null),$=M(t,"onLineSelected",7),V=M(t,"onLineClick",7),re=M(t,"onLineNumberClick",7),W=M(t,"onLineEnter",7),P=M(t,"onLineLeave",7),U=M(t,"onToggleCollapse",7),G=M(t,"actions",23,()=>[]),Q=M(t,"enableHoverUtility",7,!1),de=M(t,"renderHoverUtility",7),Z=M(t,"renderHunkSeparator",7),he=M(t,"class",7,""),ve=M(t,"style",7,""),Ee=M(t,"unsafeCSS",7),be=M(t,"oldCacheKey",7),tt=M(t,"newCacheKey",7),Ie=M(t,"maxHighlightLines",7,5e3),Se=M(t,"disableHighlighting",7,!1),_=M(t,"virtualizer",7);const oe=Yo(),se=Qo(),Fe=ne(()=>{const u=a()?.length??0,L=h()?.length??0,A=l()?.length??0;return u+L+A>s}),me=ne(()=>{if(Se())return!0;const u=a()?.split(`
|
|
154
|
+
`)}function Ka(e,t){const i=e.additionLineIndex,n=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(r=>Br(r,i,n)),e.additionLineIndex=i+t.additionLineIndex,e.additionStart=e.additionStart+t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=n+t.deletionLineIndex,e.deletionStart=e.deletionStart+t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,Ki(e)}function Br(e,t,i){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+i}}function Ki(e){let t=0,i=0;for(const n of e.hunkContent)n.type==="context"?(t+=n.lines,i+=n.lines):(t+=Math.max(n.additions,n.deletions),i+=n.additions+n.deletions);e.splitLineCount=t,e.unifiedLineCount=i}function ni(e){let t=0,i=0,n=0;for(const r of e.hunks)r.collapsedBefore=Math.max(Ze(r.additionStart,r.additionCount)-n,0),r.splitLineStart=t+r.collapsedBefore,r.unifiedLineStart=i+r.collapsedBefore,Ki(r),t+=r.collapsedBefore+r.splitLineCount,i+=r.collapsedBefore+r.unifiedLineCount,n=Ve(r.additionStart,r.additionCount);if(e.hunks.length>0){const r=e.hunks[e.hunks.length-1],o=Math.max(e.additionLines.length-Ve(r.additionStart,r.additionCount),0);t+=o,i+=o}e.splitLineCount=t,e.unifiedLineCount=i}const Vn=new WeakMap;function Xa(e){return e.length>1&&e[e.length-1]===""?e.slice(0,-1):e}function Ya(e,t){const i=Math.min(e.length,t.length);let n=0;for(;n<i&&e[n]===t[n];)n++;let r=e.length,o=t.length;for(;r>n&&o>n&&e[r-1]===t[o-1];)r--,o--;if(!(n===r&&n===o))return{start:n,deletionEnd:r,additionEnd:o}}function Vi(e,t,i){const n=e.hunks,r=e.additionLines,o=Xa(r),s=o===r?e:{...e,additionLines:o},l=sl(n,rl(s,t,i),e.deletionLines.length),a=dl(s,l);if(e.additionLines=o,e.hunks=a,e.editSessionDirty=!0,cl(e),_r(e,r),!!fl(n,e.hunks))return{regions:l.map(h=>h.previousSpan)}}function Qa(e,t,i,n){const r=new Set(t),o=Array.from(r).filter(d=>d>=0&&d<e.additionLines.length).sort((d,f)=>d-f);if(o.length===0)return;const s=d=>r.has(d)?n?.get(d):e.additionLines[d],{hunks:l}=e;let a,h=0;for(const d of o){for(;h<l.length;){const c=l[h];if(d<ii(c)+c.additionCount)break;h++}const f=l[h],p=f==null?void 0:ii(f);if(p==null||d<p||a!=null&&a!==h)return Vi(e,i,s);a=h}if(a!=null){if(Ja(e,o,a,n,i)){e.editSessionDirty=!0;return}return Vi(e,i,s)}}function Ja(e,t,i,n,r){if(n==null||r?.ignoreWhitespace===!0||r?.stripTrailingCr===!0)return!1;const o=Za(e),s=e.hunks[i];if(s.hunkContent.some(el))return!1;for(const l of t){const a=n.get(l),h=e.additionLines[l];if(a==null||h==null||o.has(a)||o.has(h))return!1;let d=!1;for(const f of s.hunkContent)if(f.type==="change"&&f.additions===f.deletions&&l>=f.additionLineIndex&&l<f.additionLineIndex+f.additions){d=!0;break}if(!d)return!1}return!0}function Za(e){const t=Vn.get(e);if(t?.lines===e.deletionLines)return t.set;const i=new Set(e.deletionLines);return Vn.set(e,{lines:e.deletionLines,set:i}),i}function el(e){return e?.type==="change"&&(e.additions===0||e.deletions===0)}function tl(e,t){const i=new Map,{regions:n}=t;for(let r=0;r<=n.length;r++){const o=n[r-1],s=n[r],l=r===0?e.get(0):o==null?void 0:e.get(o.lastIndex+1),a=s==null?void 0:e.get(s.firstIndex),h=l?.fromStart??0,d=a?.fromEnd??0;(h>0||d>0)&&i.set(r,{fromStart:h,fromEnd:d})}return i}function il(e,t,i){const n=[];if(e.isPartial)return n;for(const[o,s]of e.hunks.entries()){const l=Ht({isPartial:e.isPartial,rangeSize:s.collapsedBefore,expandedHunks:t,hunkIndex:o,collapsedContextThreshold:i});if(l.rangeSize<=i)continue;const a=st(s),h=a-l.rangeSize;l.fromStart>0&&n.push([h,h+l.fromStart]),l.fromEnd>0&&n.push([a-l.fromEnd,a])}const r=Tt({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:i,errorPrefix:"captureExpansionAnchors"});if(r!=null&&r.fromStart>0&&r.rangeSize>i){const o=e.hunks[e.hunks.length-1],s=st(o)+o.deletionCount;n.push([s,s+r.fromStart])}return n}function nl(e,t){const i=new Map;if(t.length===0)return i;const n=(o,s,l)=>{if(l<=s)return;let a=0,h=0;for(const[d,f]of t)f<=s||d>=l||(d<=s&&(a=Math.max(a,Math.min(f,l)-s)),f>=l&&(h=Math.max(h,l-Math.max(d,s))));(a>0||h>0)&&i.set(o,{fromStart:a,fromEnd:h})};for(const[o,s]of e.hunks.entries()){const l=st(s);n(o,l-Math.max(s.collapsedBefore,0),l)}const r=e.hunks[e.hunks.length-1];return r!=null&&!e.isPartial&&e.deletionLines.length>0&&n(e.hunks.length,st(r)+r.deletionCount,e.deletionLines.length),i}function Wn(e,t){return e.editSessionDirty!==!0?!1:(delete e.editSessionDirty,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join("")===""?Be(e,t):Ur(e,t)),!0)}function rl(e,t,i){if(Ya(e.deletionLines,e.additionLines)==null)return[];const n=et({name:e.prevName??e.name,contents:e.deletionLines.join("")},{name:e.name,contents:e.additionLines.join(""),lang:e.lang},t);let r;const o=(h,d)=>{r??=ol(e.hunks);for(let f=0;f<=d;f++){const p=r.get(h.deletionLineIndex-f);if(!(p==null||p.additions!==h.additions||p.deletions!==h.deletions)){if(h.additions>0&&i!=null){for(let c=0;c<h.additions;c++)if(i(p.additionLineIndex+c)!==n.additionLines[h.additionLineIndex+c])return d}return f}}return d},s=[];let l=0,a=0;for(const h of n.hunks){ya(h,n,o);const d=h.additionCount>0?h.additionLineIndex-l:h.deletionLineIndex-a;l+=d,a+=d;for(const f of h.hunkContent){if(f.type==="context"){l+=f.lines,a+=f.lines;continue}const p=Br(f,0,0);p.additions===0&&(p.additionLineIndex=l),p.deletions===0&&(p.deletionLineIndex=a),s.push(p),l+=p.additions,a+=p.deletions}}return s}function ol(e){const t=new Map;for(const i of e)for(const n of i.hunkContent)n.type==="change"&&(n.additions===0||n.deletions===0)&&t.set(n.deletionLineIndex,n);return t}function sl(e,t,i){const n=e.map((s,l)=>{const a=st(s);return{deletionStart:a,deletionEnd:a+s.deletionCount,blocks:[],previousSpan:{firstIndex:l,lastIndex:l}}}),r=[];let o=0;for(const s of t){const l=s.deletionLineIndex,a=l+s.deletions;for(;o<n.length&&n[o].deletionEnd<l;)r.push(n[o]),o++;let h=r.length>0&&al(l,a,r[r.length-1])?r.pop():void 0;for(;o<n.length&&n[o].deletionStart<=a;)h=ll(h,n[o]),o++;if(h==null){let d=l,f=a;if((s.deletions===0||s.additions===0)&&i>s.deletions){const p=r[r.length-1]?.deletionEnd??0,c=n[o]?.deletionStart??i;l>p?d--:a<c&&f++}h={deletionStart:d,deletionEnd:f,blocks:[],previousSpan:void 0}}h.deletionStart=Math.min(h.deletionStart,l),h.deletionEnd=Math.max(h.deletionEnd,a),h.blocks.push(s),r.push(h)}for(;o<n.length;)r.push(n[o]),o++;return r}function al(e,t,i){return e<=i.deletionEnd&&t>=i.deletionStart}function ll(e,t){return e==null?t:(e.deletionStart=Math.min(e.deletionStart,t.deletionStart),e.deletionEnd=Math.max(e.deletionEnd,t.deletionEnd),e.blocks.push(...t.blocks),t.previousSpan!=null&&(e.previousSpan??={...t.previousSpan},e.previousSpan.firstIndex=Math.min(e.previousSpan.firstIndex,t.previousSpan.firstIndex),e.previousSpan.lastIndex=Math.max(e.previousSpan.lastIndex,t.previousSpan.lastIndex)),e)}function dl(e,t){const i=[];let n=0,r=0;for(const o of t){const s=o.deletionStart-n;if(s<0)throw new Error("buildRegionHunks: overlapping old-side regions");n+=s,r+=s;const l=r,a=[];for(const d of o.blocks){const f=d.deletionLineIndex-n,p=d.additionLineIndex-r;if(f<0||f!==p)throw new Error("buildRegionHunks: canonical block context mismatch");Gn(a,f,r,n),n+=f,r+=p,a.push({...d}),n+=d.deletions,r+=d.additions}const h=o.deletionEnd-n;if(h<0)throw new Error("buildRegionHunks: block exceeds its old-side region");Gn(a,h,r,n),n+=h,r+=h,i.push(hl(e,{additionStart:l,additionEnd:r,deletionStart:o.deletionStart,deletionEnd:o.deletionEnd},a))}if(e.deletionLines.length-n!==e.additionLines.length-r)throw new Error("buildRegionHunks: trailing context mismatch");return i}function hl(e,t,i){const n=t.additionEnd-t.additionStart,r=t.deletionEnd-t.deletionStart;let o=0,s=0;for(const a of i)a.type==="change"&&(o+=a.additions,s+=a.deletions);const l={collapsedBefore:0,additionStart:Gt(t.additionStart,n),additionCount:n,additionLines:o,additionLineIndex:jn(t.additionStart,n),deletionStart:Gt(t.deletionStart,r),deletionCount:r,deletionLines:s,deletionLineIndex:jn(t.deletionStart,r),hunkContent:i,hunkSpecs:`@@ -${Gt(t.deletionStart,r)},${r} +${Gt(t.additionStart,n)},${n} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return Ki(l),l}function Gn(e,t,i,n){t>0&&e.push({type:"context",lines:t,additionLineIndex:i,deletionLineIndex:n})}function fl(e,t){if(e.length!==t.length)return!0;for(let i=0;i<e.length;i++){const n=e[i],r=t[i];if(st(n)!==st(r)||n.deletionCount!==r.deletionCount||ii(n)!==ii(r)||n.additionCount!==r.additionCount||n.splitLineCount!==r.splitLineCount||!ul(n,r))return!0}return!1}function ul(e,t){const i=$n(e),n=$n(t);for(;;){const r=i.next(),o=n.next();if(r.done===!0||o.done===!0)return r.done===o.done;if(r.value[0]!==o.value[0]||r.value[1]!==o.value[1])return!1}}function*$n(e){for(const t of e.hunkContent){if(t.type==="context"){for(let n=0;n<t.lines;n++)yield[t.deletionLineIndex+n,t.additionLineIndex+n];continue}const i=Math.max(t.deletions,t.additions);for(let n=0;n<i;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function ii(e){return Ze(e.additionStart,e.additionCount)}function st(e){return Ze(e.deletionStart,e.deletionCount)}function Gt(e,t){return t===0?e:e+1}function jn(e,t){return t===0?e-1:e}function cl(e){ni(e);for(let t=0;t<e.hunks.length;t++)Or(e,t)}let pl=-1;var gl=class{constructor(e={theme:Ye},t=Rt,i,n){v(this,"options");v(this,"annotationSlotName");v(this,"onRenderUpdate");v(this,"workerManager");v(this,"__id",`diff-hunks-renderer:${++pl}`);v(this,"highlighter");v(this,"diff");v(this,"expandedHunks",new Map);v(this,"deletionAnnotations",{});v(this,"additionAnnotations",{});v(this,"computedLangs",["text"]);v(this,"renderCache");v(this,"pendingHighlightResult");v(this,"pendingStructuralRows");v(this,"editSessionActive",!1);v(this,"createAnnotationElement",e=>Ls(e));this.options=e,this.annotationSlotName=t,this.onRenderUpdate=i,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=St(e.theme??Ye)?Ti():void 0)}cleanUp(){this.endEditSession(),this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.editSessionActive?(this.renderCache!=null&&(this.renderCache.renderRange=void 0),this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0):this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this)}beginEditSession(e,t){const{editSessionActive:i}=this;this.editSessionActive=!0,i||(this.pendingHighlightResult=void 0),this.diff=e,i&&this.renderCache!=null&&this.renderCache.diff!==e&&this.clearRenderCache();const{renderCache:n}=this;if(!e.isPartial&&e.additionLines.length===0){Object.assign(e,Qt(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache();return}if(n==null||i&&n.diff===e)return;const{options:r}=this.getRenderOptions(e),o=n.diff===e,s=t!=null&&J(n.diff,t),{result:l}=n;if(!n.highlighted||l==null||!Ue(n.options,r)||!o&&!s){this.clearRenderCache();return}o||(this.renderCache={diff:e,options:r,highlighted:!0,result:{...l,code:{...l.code,additionLines:[...l.code.additionLines]}},renderRange:n.renderRange})}endEditSession(){this.editSessionActive=!1,this.pendingHighlightResult=void 0,this.diff==null&&this.clearRenderCache()}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){const{diff:e,renderCache:t,workerManager:i}=this;return e==null||t==null||!J(t.diff,e)||wt(e)||xt(e,this.getTokenizeMaxLength())?Promise.resolve():!this.editSessionActive&&i?.isWorkingPool()===!0&&e.cacheKey!=null?(i.evictDiffFromCache(e.cacheKey),i.primeDiffHighlightCache(e).then(()=>{this.applyRefreshedResult(e,i.getDiffResultCache(e))}).catch(n=>this.onHighlightError(n))):this.asyncHighlight(e).then(n=>this.applyRefreshedResult(e,n)).catch(n=>this.onHighlightError(n))}applyRefreshedResult(e,t){const{diff:i,renderCache:n}=this;if(t==null||i==null||n==null||!J(i,e)||!J(n.diff,e)||this.editSessionActive)return;const{options:r}=this.getRenderOptions(i);Ue(r,t.options)&&(this.pendingHighlightResult={diff:i,options:t.options,highlighted:!0,result:t.result},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){this.renderCache=void 0,this.pendingHighlightResult=void 0,this.pendingStructuralRows=void 0}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,i=this.getOptionsWithDefaults().expansionLineCount){const n={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t==="up"||t==="both")&&(n.fromStart+=i),(t==="down"||t==="both")&&(n.fromEnd+=i),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,n)}getExpandedHunk(e){return this.expandedHunks.get(e)??Po}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(const t of e){const i=(()=>{switch(t.side){case"deletions":return this.deletionAnnotations;case"additions":return this.additionAnnotations}})(),n=i[t.lineNumber]??[];i[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,i=!1){this.pendingStructuralRows=void 0;const{renderCache:n}=this;if(n==null)return!1;const{result:r,diff:o}=n;if(r==null)return!1;if(o.isPartial)throw new Error("Could not update render cache for partial diff");const s=r.code.additionLines,l=this.pendingStructuralRows=i?new Map:void 0,a=[],h=new Map;for(const[f,p]of e){const c=s[f]?.properties??{},m=p.map(x=>x[2]).join(""),g=f<o.additionLines.length,S=g?o.additionLines[f]??"":"",b=At(S);l==null&&g&&(o.additionLines[f]=Is(S,m),b!==m&&(a.push(f),h.set(f,S)));const y={type:"element",tagName:"div",properties:{"data-line":c["data-line"]??f+1,"data-line-index":c["data-line-index"]??f,"data-line-type":c["data-line-type"]??"context"},children:p.map(([x,R,k])=>x===0&&R===""?k===""?{type:"element",tagName:"br",properties:{},children:[]}:{type:"text",value:k}:{type:"element",tagName:"span",properties:{"data-char":x,style:`color:${R};`},children:[{type:"text",value:k}]})};l!=null?l.set(f,y):s[f]=y}let d=!1;if(a.length>0)if(this.editSessionActive)if(o.additionLines.length<=1&&o.additionLines.join("")==="")this.applyRecomputePreservingSessionType(o,Qt(o,this.options.parseDiffOptions)),d=!0;else if(Bi(o,o.additionLines))this.applyRecomputePreservingSessionType(o,ti(o,o.additionLines,this.options.parseDiffOptions)),d=!0;else{const f=Qa(o,a,this.options.parseDiffOptions,h);this.applyExpansionRemap(f),d=f!=null}else Object.assign(o,Ga(o,a,this.options.parseDiffOptions));return r.baseThemeType=t,n.isDirty=!0,d}applyExpansionRemap(e){e!=null&&(this.expandedHunks=tl(this.expandedHunks,e))}applyDocumentChange(e){const{pendingStructuralRows:t,renderCache:i}=this;this.pendingStructuralRows=void 0;const n=this.diff??i?.diff;if(n==null)return;const r=i?.result;if(n.isPartial)throw new Error("Could not apply document change for partial diff");const{additionLines:o}=n;if(n.additionLines=Sl(e),r!=null&&(r.code.additionLines=bl(o,n.additionLines,r.code.additionLines,e)),n.additionLines.length<=1&&n.additionLines.join("")===""?(this.applyRecomputePreservingSessionType(n,Qt(n,this.options.parseDiffOptions)),r!=null&&(r.code.additionLines[0]=Wi(0,e.getLineText(0)))):this.editSessionActive?this.applySessionDocumentChange(n,o):Object.assign(n,Ur(n,this.options.parseDiffOptions)),t!=null&&r!=null)for(const[s,l]of t)s<r.code.additionLines.length&&(r.code.additionLines[s]=l);i!=null&&(i.isDirty=!0)}applySessionDocumentChange(e,t){const{parseDiffOptions:i}=this.options,n=e.additionLines;if(Bi(e,n)){this.applyRecomputePreservingSessionType(e,ti(e,n,i));return}this.applyExpansionRemap(Vi(e,i,r=>t[r]))}applyRecomputePreservingSessionType(e,t){const i=this.editSessionActive?e.type:void 0;Object.assign(e,t),i!=null&&(e.type=i),this.markEditSessionPass(e)}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){const i=t==="change"?e==="deletions"?"change-deletion":"change-addition":t;return{gutterLineType:i,contentProperties:{"data-line-type":i}}}getOptionsWithDefaults(){const{diffIndicators:e="bars",diffStyle:t="split",disableBackground:i=!1,disableFileHeader:n=!1,disableLineNumbers:r=!1,disableVirtualizationBuffers:o=!1,collapsed:s=!1,expandUnchanged:l=!1,collapsedContextThreshold:a=1,expansionLineCount:h=100,hunkSeparators:d="line-info",lineDiffType:f="word-alt",maxLineDiffLength:p=1e3,overflow:c="scroll",stickyHeader:m=!1,theme:g=Ye,headerRenderMode:S="default",tokenizeMaxLineLength:b=1e3,tokenizeMaxLength:y=zo,useTokenTransformer:x=!1,useCSSClasses:R=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:i,disableFileHeader:n,disableLineNumbers:r,disableVirtualizationBuffers:o,collapsed:s,expandUnchanged:l,collapsedContextThreshold:a,expansionLineCount:h,hunkSeparators:d,lineDiffType:f,maxLineDiffLength:p,overflow:c,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??g,headerRenderMode:S,tokenizeMaxLineLength:b,tokenizeMaxLength:y,useTokenTransformer:x,useCSSClasses:R}}async initializeHighlighter(){return this.highlighter=await mr(Ts(this.computedLangs,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;const{options:t}=this.getRenderOptions(e),i=xt(e,this.getTokenizeMaxLength());let n=this.workerManager?.getDiffResultCache(e);n!=null&&!Ue(t,n.options)&&(n=void 0),this.renderCache??={diff:e,hydrated:!0,highlighted:!i&&!wt(e),options:t,result:i?void 0:n?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!i&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter==null&&(this.computedLangs=wi(e),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ye}getEffectiveCodeOptions(){const e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){const t=(()=>{if(this.workerManager?.isWorkingPool()===!0){const l=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&l.useTokenTransformer!==!0?{...l,useTokenTransformer:!0}:l}const{theme:n,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}=this.getOptionsWithDefaults();return{theme:n,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:r,lineDiffType:o,maxLineDiffLength:s}})();this.getOptionsWithDefaults();const{renderCache:i}=this;return i?.result==null?{options:t,forceHighlight:!0}:!J(e,i.diff)||!Ue(t,i.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}getDiffForNextRender(e){const{options:t}=this.getRenderOptions(e);if(this.getReadyRenderResult(e,t)!=null||this.renderCache==null)return e;if(J(this.renderCache.diff,e))return this.renderCache.diff;const i=!(e.additionLines.length>0||e.deletionLines.length>0)||wt(e)||xt(e,this.getTokenizeMaxLength());return this.canRenderDiff(e,t,i)?e:this.renderCache.diff}canRenderDiff(e,t,i){const{renderCache:n}=this;return n==null||J(n.diff,e)?!0:i?n.result==null&&n.hydrated!==!0||this.workerManager?.isWorkingPool()===!0||this.highlighter!=null&&St(t.theme):n.result==null&&n.hydrated!==!0?!0:!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?!n.highlighted:this.highlighter!=null&&St(t.theme)}renderDiff(e=this.diff,t=gn){if(this.diff=e,e==null){this.pendingHighlightResult=void 0;return}const{expandUnchanged:i,collapsedContextThreshold:n}=this.getOptionsWithDefaults();let{options:r,forceHighlight:o}=this.getRenderOptions(e);const s=this.getReadyRenderResult(e,r);this.pendingHighlightResult=void 0,s!=null&&(this.renderCache={...s,diff:e,renderRange:void 0},o=!1),this.renderCache??={diff:e,highlighted:!1,options:r,result:void 0,renderRange:void 0};const l=e.additionLines.length>0||e.deletionLines.length>0,a=!l||wt(e)||xt(e,this.getTokenizeMaxLength()),h=this.canRenderDiff(e,r,a),d=!J(e,this.renderCache.diff),f=!kr(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){const p=this.renderCache.result==null&&this.renderCache.highlighted&&!a&&!d&&Pi(t);h&&!p&&(a||this.renderCache.result==null||!this.renderCache.highlighted&&(d||f))&&(this.renderCache.diff=e,this.renderCache.options=r,this.renderCache.highlighted=!1,(this.renderCache.result==null||d||f||o)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,Pi(t)||i?!0:this.expandedHunks,n)),this.renderCache.renderRange=t),!a&&l&&(!this.renderCache.highlighted||o)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLangs=wi(e),this.highlighter??=Ti();const p=this.highlighter!=null&&St(r.theme),c=this.highlighter!=null&&mn(this.computedLangs),m=!a&&c;if(h&&this.highlighter!=null&&p&&(o||a||!this.renderCache.highlighted&&m||this.renderCache.result==null)){const{result:g,options:S}=this.renderDiffWithHighlighter(e,this.highlighter,a||!c);this.renderCache={diff:e,options:S,highlighted:m,result:g,renderRange:void 0}}(!p||!a&&!c)&&this.asyncHighlight(e).then(({result:g,options:S})=>{this.applyHighlightResult(e,g,S,!a)})}return this.renderCache.result!=null?this.processDiffResult(this.renderCache.diff,t,this.renderCache.result):void 0}async asyncRender(e,t=gn){this.diff=e;const{result:i}=await this.asyncHighlight(e);return this.processDiffResult(e,t,i)}createPreElement(e,t,i){const{diffIndicators:n,disableBackground:r,disableLineNumbers:o,overflow:s}=this.getOptionsWithDefaults();return As({type:"diff",diffIndicators:n,disableBackground:r,disableLineNumbers:o,overflow:s,split:e,totalLines:t,customProperties:i})}async asyncHighlight(e){const t=xt(e,this.getTokenizeMaxLength());this.computedLangs=t?["text"]:wi(e);const i=this.highlighter!=null&&St(this.getLocalHighlightTheme()),n=t||this.highlighter!=null&&mn(this.computedLangs);return(this.highlighter==null||!i||!n)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,i=!1){const{options:n}=this.getRenderOptions(e),{collapsedContextThreshold:r}=this.getOptionsWithDefaults(),o=Uo(e,t,n,{forcePlainText:i,expandedHunks:i?!0:void 0,collapsedContextThreshold:r});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===""&&o.code.additionLines[0]==null){let s;if(ct({diff:e,diffStyle:"both",expandedHunks:i?!0:void 0,collapsedContextThreshold:r,callback:({additionLine:l})=>{if(l?.lineIndex===0)return s=l,!0}}),s==null)throw new Error("DiffHunksRenderer: missing empty addition line");o.code.additionLines[0]=Wi(0,"",s.unifiedLineIndex,s.splitLineIndex)}return{result:o,options:n}}onHighlightSuccess(e,t,i,n=!0){this.editSessionActive||this.applyHighlightResult(e,t,i,n)}applyHighlightResult(e,t,i,n=!0){const{diff:r,renderCache:o}=this;r==null||o==null||!J(r,e)||!Ue(i,this.getRenderOptions(r).options)||(o.result==null||!o.highlighted||!Ue(o.options,i)||!J(o.diff,r))&&(this.pendingHighlightResult={diff:r,options:i,highlighted:n,result:t},this.onRenderUpdate?.())}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;const i=this.workerManager?.getDiffResultCache(e);if(!(i==null||!Ue(t,i.options)))return i}getReadyRenderResult(e,t){const{pendingHighlightResult:i}=this;if(i!=null&&J(i.diff,e)&&Ue(i.options,t))return i;const n=this.getMatchingWorkerResultCache(e,t);if(!(n==null||this.hasHighlightedRenderCache(e,t)))return{diff:e,highlighted:!0,...n}}hasHighlightedRenderCache(e,t){const{renderCache:i}=this;return i?.result!=null&&i.highlighted&&J(e,i.diff)&&Ue(t,i.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:i,themeStyles:n,baseThemeType:r}){const{diffStyle:o,disableFileHeader:s,expandUnchanged:l,expansionLineCount:a,collapsedContextThreshold:h,hunkSeparators:d}=this.getOptionsWithDefaults(),f=this.renderCache?.isDirty??!1,p=o==="unified",c=yl(e,this.options.loadDiffFiles!=null),m=!e.isPartial||c;let g=[],S=[],b=[];const y=[],{additionLines:x,deletionLines:R}=i,k={rowCount:0,hunkSeparators:d,additionsContentAST:g,deletionsContentAST:S,unifiedContentAST:b,unifiedGutterAST:Ut(),deletionsGutterAST:Ut(),additionsGutterAST:Ut(),expansionLineCount:a,hunkData:y,incrementRowCount($=1){k.rowCount+=$},pushToGutter($,V){switch($){case"unified":k.unifiedGutterAST.children.push(V);break;case"deletions":k.deletionsGutterAST.children.push(V);break;case"additions":k.additionsGutterAST.children.push(V)}}},w=_o({fileDiff:e,errorPrefix:"DiffHunksRenderer.processDiffResult"}),E={size:0,side:void 0,increment(){this.size+=1},flush(){if(o!=="unified"){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side==="additions"?(k.pushToGutter("additions",Le(void 0,"buffer",this.size)),g?.push(Vt(this.size))):(k.pushToGutter("deletions",Le(void 0,"buffer",this.size)),S?.push(Vt(this.size))),this.size=0,this.side=void 0}}},D=($,V,re,W,P)=>{k.pushToGutter($,Oo(V,re,W,P))};function H($){E.flush(),o==="unified"?Li("unified",$,k):(Li("deletions",$,k),Li("additions",$,k))}this.pushFileLevelAnnotations(e,o,t,k),ct({diff:e,diffStyle:o,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:l?!0:this.expandedHunks,collapsedContextThreshold:h,callback:({hunkIndex:$,hunk:V,collapsedBefore:re,collapsedAfter:W,additionLine:P,deletionLine:U,type:G})=>{const Q=U!=null?U.splitLineIndex:P.splitLineIndex,de=P!=null?P.unifiedLineIndex:U.unifiedLineIndex;o==="split"&&G!=="change"&&E.flush(),re>0&&H({hunkIndex:$,collapsedLines:re,rangeSize:Math.max(V?.collapsedBefore??0,0),hunkSpecs:V?.hunkSpecs,isFirstHunk:$===0,isLastHunk:!1,isExpandable:m});const Z=o==="unified"?de:Q,he={type:G,hunkIndex:$,lineIndex:Z,unifiedLineIndex:de,splitLineIndex:Q,deletionLine:U,additionLine:P};if(o==="unified"){const _=this.getUnifiedInjectedRowsForLine?.(he);_?.before!=null&&qn(_.before,k);let oe=U!=null?R[U.lineIndex]:void 0,se=P!=null?x[P.lineIndex]:void 0;if(oe==null&&se==null){const q="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(q,{file:e.name}),new Error(q)}const Fe=G==="change"?P!=null?"change-addition":"change-deletion":G,me=this.getUnifiedLineDecoration({type:G,lineType:Fe,additionLineIndex:P?.lineIndex,deletionLineIndex:U?.lineIndex});D("unified",me.gutterLineType,P!=null?P.lineNumber:U.lineNumber,`${de},${Q}`,me.gutterProperties),se!=null?se=jt(se,me.contentProperties,f&&P!=null?{"data-line":P.lineNumber,"data-line-index":`${de},${Q}`}:void 0):oe!=null&&(oe=jt(oe,me.contentProperties,f&&U!=null?{"data-line":U.lineNumber,"data-line-index":`${de},${Q}`}:void 0)),$t({diffStyle:"unified",type:G,deletionLine:oe,additionLine:se,unifiedSpan:this.getAnnotations("unified",U?.lineNumber,P?.lineNumber,$,Z),createAnnotationElement:q=>this.createAnnotationElement(q),context:k}),_?.after!=null&&qn(_.after,k)}else{const _=this.getSplitInjectedRowsForLine?.(he);_?.before!=null&&Kn(_.before,k,E);let oe=U!=null?R[U.lineIndex]:void 0,se=P!=null?x[P.lineIndex]:void 0;const Fe=this.getSplitLineDecoration({side:"deletions",type:G,lineIndex:U?.lineIndex}),me=this.getSplitLineDecoration({side:"additions",type:G,lineIndex:P?.lineIndex});if(oe==null&&se==null){const ee="DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong";throw console.error(ee,{file:e.name}),new Error(ee)}const q=(()=>{if(G==="change"){if(se==null)return"additions";if(oe==null)return"deletions"}})();q!=null?(E.side!=null&&E.side!==q&&E.flush(),E.side=q,E.increment()):G==="change"&&E.flush();const K=this.getAnnotations("split",U?.lineNumber,P?.lineNumber,$,Z);if(K!=null&&E.size>0&&E.flush(),U!=null){const ee=jt(oe,Fe.contentProperties,f?{"data-line":U.lineNumber,"data-line-index":`${U.unifiedLineIndex},${Q}`}:void 0);D("deletions",Fe.gutterLineType,U.lineNumber,`${U.unifiedLineIndex},${Q}`,Fe.gutterProperties),ee!=null&&(oe=ee)}if(P!=null){const ee=jt(se,me.contentProperties,f?{"data-line":P.lineNumber,"data-line-index":`${P.unifiedLineIndex},${Q}`}:void 0);D("additions",me.gutterLineType,P.lineNumber,`${P.unifiedLineIndex},${Q}`,me.gutterProperties),ee!=null&&(se=ee)}$t({diffStyle:"split",type:G,additionLine:se,deletionLine:oe,...K,createAnnotationElement:ee=>this.createAnnotationElement(ee),context:k}),_?.after!=null&&Kn(_.after,k,E)}const ve=o==="split"&&V!=null&&Q===V.splitLineStart+V.splitLineCount-1,Ee=$===e.hunks.length-1&&V!=null&&(o==="split"?Q===V.splitLineStart+V.splitLineCount-1:de===V.unifiedLineStart+V.unifiedLineCount-1),be=ve?V.noEOFCRDeletions:!1,tt=ve?V.noEOFCRAdditions:!1,Ie=(U?.noEOFCR??!1)||be,Se=(P?.noEOFCR??!1)||tt;if(Se||Ie){if(o==="split"&&E.flush(),Ie){const _=G==="context"||G==="context-expanded"?G:"change-deletion";o==="unified"?(k.unifiedContentAST.push(Wt(_)),k.pushToGutter("unified",Le(_,"metadata",1))):(k.deletionsContentAST.push(Wt(_)),k.pushToGutter("deletions",Le(_,"metadata",1)),Se||(k.pushToGutter("additions",Le(void 0,"buffer",1)),k.additionsContentAST.push(Vt(1))))}if(Se){const _=G==="context"||G==="context-expanded"?G:"change-addition";o==="unified"?(k.unifiedContentAST.push(Wt(_)),k.pushToGutter("unified",Le(_,"metadata",1))):(k.additionsContentAST.push(Wt(_)),k.pushToGutter("additions",Le(_,"metadata",1)),Ie||(k.pushToGutter("deletions",Le(void 0,"buffer",1)),k.deletionsContentAST.push(Vt(1))))}k.incrementRowCount(1)}d!=="simple"&&d!=="metadata"&&(W>0||Ee&&c)&&H({hunkIndex:G==="context-expanded"?$:$+1,collapsedLines:Ee&&c?"unknown":W,rangeSize:w,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),k.incrementRowCount(1)}}),o==="split"&&E.flush();const T=Math.max(Oa(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),F=t.bufferBefore>0||t.bufferAfter>0,j=!p&&e.type!=="deleted",N=!p&&e.type!=="new",B=k.rowCount>0||F;g=j&&B?g:void 0,S=N&&B?S:void 0,b=p&&B?b:void 0;const ce=this.createPreElement(S!=null&&g!=null,T);return{fileDiff:e,unifiedGutterAST:p&&B?k.unifiedGutterAST.children:void 0,unifiedContentAST:b,deletionsGutterAST:N&&B?k.deletionsGutterAST.children:void 0,deletionsContentAST:S,additionsGutterAST:j&&B?k.additionsGutterAST.children:void 0,additionsContentAST:g,hunkData:y,preNode:ce,themeStyles:n,baseThemeType:r,headerElement:s?void 0:this.renderHeader(e),totalLines:T,rowCount:k.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:""}}renderCodeAST(e,t){const i=e==="unified"?t.unifiedGutterAST:e==="deletions"?t.deletionsGutterAST:t.additionsGutterAST,n=e==="unified"?t.unifiedContentAST:e==="deletions"?t.deletionsContentAST:t.additionsContentAST;if(i==null||n==null)return;const r=Ut(i);return r.properties.style=`grid-row: span ${t.rowCount}`,[r,Fs(n,t.rowCount)]}renderFullAST(e,t=[]){const i=this.getOptionsWithDefaults().hunkSeparators==="line-info",n=this.renderCodeAST("unified",e);if(n!=null)return t.push(O({tagName:"code",children:n,properties:{"data-code":"","data-container-size":i?"":void 0,"data-unified":""}})),{...e.preNode,children:t};const r=this.renderCodeAST("deletions",e);r!=null&&t.push(O({tagName:"code",children:r,properties:{"data-code":"","data-container-size":i?"":void 0,"data-deletions":""}}));const o=this.renderCodeAST("additions",e);return o!=null&&t.push(O({tagName:"code",children:o,properties:{"data-code":"","data-container-size":i?"":void 0,"data-additions":""}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return Qe(this.renderFullAST(e,t))}renderPartialHTML(e,t){return t==null?Qe(e):Qe(O({tagName:"code",children:e,properties:{"data-code":"","data-container-size":this.getOptionsWithDefaults().hunkSeparators==="line-info"?"":void 0,[`data-${t}`]:""}}))}pushFileLevelAnnotations(e,t,i,n){if(!Er(i))return;const r=e.type!=="new"?this.getAnnotationNames(Tn(this.deletionAnnotations)):[],o=e.type!=="deleted"?this.getAnnotationNames(Tn(this.additionAnnotations)):[];if(r.length===0&&o.length===0)return;const s=-1,l=-1,{createAnnotationElement:a}=this;if(t==="unified"){$t({diffStyle:t,type:"context",unifiedSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r.concat(o)},createAnnotationElement:a,context:n});return}$t({diffStyle:t,type:"context",deletionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:r},additionSpan:{type:"annotation",hunkIndex:s,lineIndex:l,annotations:o},createAnnotationElement:a,context:n})}getAnnotations(e,t,i,n,r){const o={type:"annotation",hunkIndex:n,lineIndex:r,annotations:[]};if(t!=null)for(const l of this.deletionAnnotations[t]??[])o.annotations.push(this.annotationSlotName(l));const s={type:"annotation",hunkIndex:n,lineIndex:r,annotations:[]};if(i!=null)for(const l of this.additionAnnotations[i]??[])(e==="unified"?o:s).annotations.push(this.annotationSlotName(l));if(e==="unified")return o.annotations.length>0?o:void 0;if(!(s.annotations.length===0&&o.annotations.length===0))return{deletionSpan:o,additionSpan:s}}getAnnotationNames(e){return e?.map(t=>this.annotationSlotName(t))??[]}renderHeader(e){const{headerRenderMode:t,stickyHeader:i}=this.getOptionsWithDefaults();return ks({fileOrDiff:e,mode:t,stickyHeader:i})}};const ml=new Intl.PluralRules("en-US");function vl(e){return`${e} unmodified line${ml.select(e)==="one"?"":"s"}`}function qn(e,t){for(const i of e)t.unifiedContentAST.push(i.content),t.pushToGutter("unified",i.gutter),t.incrementRowCount(1)}function Kn(e,t,i){for(const{deletion:n,addition:r}of e){if(n==null&&r==null)continue;const o=n!=null&&r!=null?void 0:n==null?"deletions":"additions";(o==null||i.side!==o)&&i.flush(),n!=null&&(t.deletionsContentAST.push(n.content),t.pushToGutter("deletions",n.gutter)),r!=null&&(t.additionsContentAST.push(r.content),t.pushToGutter("additions",r.gutter)),o!=null&&(i.side=o,i.increment()),t.incrementRowCount(1)}}function $t({diffStyle:e,type:t,deletionLine:i,additionLine:n,unifiedSpan:r,deletionSpan:o,additionSpan:s,createAnnotationElement:l,context:a}){let h=!1;if(e==="unified"){if(n!=null?a.unifiedContentAST.push(n):i!=null&&a.unifiedContentAST.push(i),r!=null){const d=t==="change"?i!=null?"change-deletion":"change-addition":t;a.unifiedContentAST.push(l(r)),a.pushToGutter("unified",Le(d,"annotation",1)),h=!0}}else if(e==="split"){if(i!=null&&a.deletionsContentAST.push(i),n!=null&&a.additionsContentAST.push(n),o!=null){const d=t==="change"?i!=null?"change-deletion":"context":t;a.deletionsContentAST.push(l(o)),a.pushToGutter("deletions",Le(d,"annotation",1)),h=!0}if(s!=null){const d=t==="change"?n!=null?"change-addition":"context":t;a.additionsContentAST.push(l(s)),a.pushToGutter("additions",Le(d,"annotation",1)),h=!0}}h&&a.incrementRowCount(1)}function Li(e,{hunkIndex:t,collapsedLines:i,rangeSize:n,hunkSpecs:r,isFirstHunk:o,isLastHunk:s,isExpandable:l},a){if(typeof i=="number"&&i<=0)return;const h=e==="unified"?a.unifiedContentAST:e==="deletions"?a.deletionsContentAST:a.additionsContentAST;if(a.hunkSeparators==="metadata"){r!=null&&(a.pushToGutter(e,ht({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),h.push(ht({type:"metadata",content:r,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1));return}if(a.hunkSeparators==="simple"){t>0&&(a.pushToGutter(e,ht({type:"simple",isFirstHunk:o,isLastHunk:!1})),h.push(ht({type:"simple",isFirstHunk:o,isLastHunk:!1})),e!=="additions"&&a.incrementRowCount(1));return}const d=_a(e,t),f=n>a.expansionLineCount,p=l?t:void 0,c=typeof i=="number"?vl(i):"More unchanged context may be available";a.pushToGutter(e,ht({type:a.hunkSeparators,content:c,expandIndex:p,chunked:f,slotName:d,isFirstHunk:o,isLastHunk:s})),h.push(ht({type:a.hunkSeparators,content:c,expandIndex:p,chunked:f,slotName:d,isFirstHunk:o,isLastHunk:s})),e!=="additions"&&a.incrementRowCount(1),a.hunkData.push({slotName:d,hunkIndex:t,lines:typeof i=="number"?i:0,lineCountKnown:typeof i=="number",type:e,expandable:l?{up:!o,down:!s,chunked:f}:void 0})}function jt(e,t,i){return e==null||e.type!=="element"||t==null&&i==null?e:{...e,properties:{...e.properties,...t,...i}}}function Xn(e){return e.length>0&&e[e.length-1]===""?e.length-1:e.length}function bl(e,t,i,n){const r=Xn(e),o=Xn(t),s=Math.min(r,o);let l=0;for(;l<s&&e[l]===t[l];)l++;let a=0;for(;a<s-l&&e[r-1-a]===t[o-1-a];)a++;const h=new Array(t.length);for(let d=0;d<l;d++)h[d]=i[d];for(let d=0;d<a;d++)h[o-1-d]=i[r-1-d];r<e.length&&o<t.length&&(h[t.length-1]=i[e.length-1]);for(let d=l;d<t.length;d++)h[d]??=Wi(d,n.getLineText(d));return h}function Wi(e,t,i=e,n=e){return{type:"element",tagName:"div",properties:{"data-line":e+1,"data-line-index":`${i},${n}`,"data-line-type":"context"},children:[{type:"element",tagName:"span",properties:{"data-char":0},children:[{type:"text",value:t}]}]}}function Sl(e){const t=[];for(let i=0;i<e.lineCount;i++)t.push(e.getLineText(i,!0));return t}function wi(e){if(e.lang!=null)return[e.lang];const t=Dt(e.prevName??e.name),i=Dt(e.name);return t===i?[i]:[t,i]}function xt(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function yl(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function Cl(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function xl(e,t){return e.slotName===t.slotName&&e.hunkIndex===t.hunkIndex&&e.lines===t.lines&&e.lineCountKnown===t.lineCountKnown&&e.type===t.type&&e.expandable?.chunked===t.expandable?.chunked&&e.expandable?.up===t.expandable?.up&&e.expandable?.down===t.expandable?.down}async function Gi(e,t=300){let i;try{await Promise.race([e(),new Promise(n=>{i=setTimeout(n,t)})])}finally{i!=null&&clearTimeout(i)}}function $i({oldFile:e,newFile:t},i){if(!(e===void 0&&t===void 0)){if(e===void 0||t===void 0)throw new Error(`${i}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw new Error(`${i}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return t===null?{oldFile:e,newFile:t}:{oldFile:e,newFile:t}}}function Ll(e){return{theme:e?.theme,disableLineNumbers:e?.disableLineNumbers,overflow:e?.overflow,collapsed:e?.collapsed,disableFileHeader:e?.disableFileHeader,disableVirtualizationBuffers:e?.disableVirtualizationBuffers,stickyHeader:e?.stickyHeader,preferredHighlighter:e?.preferredHighlighter,useCSSClasses:e?.useCSSClasses,useTokenTransformer:Js(e),tokenizeMaxLineLength:e?.tokenizeMaxLineLength,tokenizeMaxLength:e?.tokenizeMaxLength,diffStyle:e?.diffStyle,diffIndicators:e?.diffIndicators,disableBackground:e?.disableBackground,hunkSeparators:typeof e?.hunkSeparators=="function"?"custom":e?.hunkSeparators,expandUnchanged:e?.expandUnchanged,loadDiffFiles:e?.loadDiffFiles,collapsedContextThreshold:e?.collapsedContextThreshold,lineDiffType:e?.lineDiffType,maxLineDiffLength:e?.maxLineDiffLength,expansionLineCount:e?.expansionLineCount,headerRenderMode:e?.renderCustomHeader!=null?"custom":"default"}}function ki(e){return e.isPartial&&(e.type==="change"||e.type==="rename-changed"||e.type==="rename-pure")}function wl(e){const t={...e};return delete t.cacheKey,t}function Yn(e,t){if(e.isPartial||t.isPartial)throw new Error("FileDiff.shouldResetEditorForExternalDiff: diffs must be fully hydrated");const i=e.lang??Dt(e.name),n=t.lang??Dt(t.name),r=e.type!=="new",o=t.type!=="new";return e.name!==t.name||i!==n||r!==o||e.deletionLines.length!==t.deletionLines.length?!0:e.deletionLines.some((s,l)=>s!==t.deletionLines[l])}function kl(e,t){return e.length===t.length&&e.every((i,n)=>i===t[n])}function El(e,t){const{oldFile:i}=e;return i==null?t.type==="new":t.type!=="new"&&i.name===(t.prevName??t.name)&&kl(i.lines,t.deletionLines)}let Rl=-1;var Ai,Vr=(Ai=class{constructor(e={theme:Ye},t,i=!1){v(this,"options");v(this,"workerManager");v(this,"isContainerManaged");v(this,"__id",`file-diff:${++Rl}`);v(this,"type","file-diff");v(this,"fileContainer");v(this,"spriteSVG");v(this,"pre");v(this,"codeUnified");v(this,"codeDeletions");v(this,"codeAdditions");v(this,"bufferBefore");v(this,"bufferAfter");v(this,"themeCSSStyle");v(this,"appliedThemeCSS");v(this,"hasAdoptedThemeCSS",!1);v(this,"unsafeCSSStyle");v(this,"appliedUnsafeCSS");v(this,"gutterUtilityContent");v(this,"headerElement");v(this,"headerPrefix");v(this,"headerFilenameSuffix");v(this,"headerMetadata");v(this,"headerCustom");v(this,"separatorCache",new Map);v(this,"errorWrapper");v(this,"placeHolder");v(this,"hunksRenderer");v(this,"resizeManager");v(this,"scrollSyncManager");v(this,"interactionManager");v(this,"annotationCache",new Map);v(this,"lineAnnotations",[]);v(this,"managersDirty",!1);v(this,"deletionFile");v(this,"additionFile");v(this,"fileDiff");v(this,"editSession");v(this,"renderedDiff");v(this,"renderRange");v(this,"pendingFiles");v(this,"appliedPreAttributes");v(this,"headerCache",{lastRenderedHTML:void 0,html:void 0,fileDiff:void 0});v(this,"lastRowCount");v(this,"mounted",!1);v(this,"enabled",!0);v(this,"editor");v(this,"refreshViewTimeout");v(this,"lineStateRefreshPending",!1);v(this,"deferredSelectedLines");v(this,"deferredEditorActiveLine");v(this,"handleHighlightRender",()=>{this.rerender()});v(this,"getLineIndex",(e,t="additions")=>this.getLineIndexForDiff(this.getDiffForLineIndex(),e,t));v(this,"getHoveredLine",()=>this.interactionManager.getHoveredLine());v(this,"getAnnotationSlotName",e=>Qs(this.editSession?.annotations,e,Rt));v(this,"handleExpandHunk",(e,t,i)=>{this.expandHunk(e,t,i)});v(this,"expandHunk",(e,t,i)=>{this.loadFilesIfNecessary(),this.hunksRenderer.expandHunk(e,t,i),this.rerender()});v(this,"handleEditSessionRender",()=>{this.rerender(),this.flushDeferredLineState()});this.options=e,this.workerManager=t,this.isContainerManaged=i,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new vs,this.scrollSyncManager=new Ua,this.interactionManager=new as("diff",wn(e,typeof e.hunkSeparators=="function"||(e.hunkSeparators??"line-info")==="line-info"||e.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex)),this.workerManager?.subscribeToThemeChanges(this),this.enabled=!0}getTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ye}getHunksRendererOptions(e){return Ll(e)}createHunksRenderer(e){return new gl(this.getHunksRendererOptions(e),this.getAnnotationSlotName,this.handleHighlightRender,this.workerManager)}getDiffForLineIndex(){return this.getRenderedDiff()}getLineIndexForDiff(e,t,i){if(e==null)return;const n=e.hunks.at(-1);let r,o;e:for(const s of e.hunks){const l=i==="deletions"?s.deletionStart:s.additionStart,a=i==="deletions"?s.deletionCount:s.additionCount;let h=Ze(l,a)+1,d=s.splitLineStart,f=s.unifiedLineStart;if(t<h){const p=h-t;r=Math.max(f-p,0),o=Math.max(d-p,0);break e}if(t>=h+a){if(s===n){const p=t-(h+a);r=f+s.unifiedLineCount+p,o=d+s.splitLineCount+p;break e}continue}for(const p of s.hunkContent)if(p.type==="context")if(t<h+p.lines){const c=t-h;o=d+c,r=f+c;break e}else h+=p.lines,d+=p.lines,f+=p.lines;else{const c=i==="deletions"?p.deletions:p.additions;if(t<h+c){const m=t-h;r=f+(i==="additions"?p.deletions:0)+m,o=d+m;break e}else h+=c,d+=Math.max(p.deletions,p.additions),f+=p.deletions+p.additions}break e}if(!(r==null||o==null))return[r,o]}setOptions(e){e!=null&&(this.options=e,this.clearReusableHeader(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(wn(this.options,typeof this.options.hunkSeparators=="function"||(this.options.hunkSeparators??"line-info")==="line-info"||this.options.hunkSeparators==="line-info-basic"?this.handleExpandHunk:void 0,this.getLineIndex))}mergeOptions(e){this.options={...this.options,...e}}setThemeType(e){(this.options.themeType??"system")!==e&&(this.mergeOptions({themeType:e}),this.applyCachedThemeState(e))}applyCachedThemeState(e){if(typeof this.options.theme=="string"||this.fileContainer==null||this.appliedThemeCSS==null)return!1;const t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType===t?!1:(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!lr(this.appliedThemeCSS.theme,this.getTheme())}getLatestAnnotations(){return this.editSession?.annotations?.current??this.lineAnnotations}isNewAnnotations(e){const t=this.editSession?.annotations;return e===this.lineAnnotations?!1:t==null||e!==t.provided&&e!==t.current}setLineAnnotations(e){const t=this.editSession?.annotations;if(t==null){this.lineAnnotations=e;return}this.isNewAnnotations(e)&&(this.lineAnnotations=e,Ys(t,e,Rt))}syncEditSessionAnnotationsFromEditor(e){const t=this.editSession?.annotations;return t==null||e===t.current?!1:(t.current=e,this.hunksRenderer.setLineAnnotations(e),this.renderAnnotations(),!0)}canPartiallyRender(e,t,i){return!(e||t||i||typeof this.options.hunkSeparators=="function")}setSelectedLines(e,t){this.lineStateRefreshPending?this.deferredSelectedLines=[e,t]:this.interactionManager.setSelection(e,t)}setEditorActiveLine(e,t){this.lineStateRefreshPending?this.deferredEditorActiveLine=[e,t]:this.interactionManager.setEditorActiveLine(e,{lineNumberOnly:t?.lineNumberOnly,side:t?.side??"additions"})}flushDeferredLineState(){const{deferredEditorActiveLine:e,deferredSelectedLines:t}=this;this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,e!=null&&this.setEditorActiveLine(...e),t!=null&&this.interactionManager.setSelection(...t)}flushManagers(){if(!this.managersDirty||this.pre==null){this.managersDirty=!1;return}const{diffStyle:e="split",overflow:t="scroll"}=this.options;this.interactionManager.setup(this.pre),this.resizeManager.setup(this.pre,{disableAnnotations:t==="wrap",columnVariables:this.shouldApplyColumnVariables(t)?"apply":"measure"}),t==="scroll"&&e==="split"?this.scrollSyncManager.setup(this.pre,this.codeDeletions,this.codeAdditions):this.scrollSyncManager.cleanUp(),this.managersDirty=!1}shouldApplyColumnVariables(e){return typeof this.options.hunkSeparators=="function"?!0:e==="scroll"&&(this.getLatestAnnotations().length>0||this.pre?.hasAttribute("data-has-merge-conflict")===!0)}getCodeScrollLeft(){return Math.max(this.codeUnified?.scrollLeft??0,this.codeDeletions?.scrollLeft??0,this.codeAdditions?.scrollLeft??0)}setCodeScrollLeft(e){this.codeUnified!=null&&(this.codeUnified.scrollLeft=e),this.codeAdditions!=null&&(this.codeAdditions.scrollLeft=e),this.codeDeletions!=null&&(this.codeDeletions.scrollLeft=e)}__getEffectiveCodeOptions(){return{...this.options,...this.hunksRenderer.getEffectiveCodeOptions()}}cleanUp(e=!1){const{editor:t}=this;Ii(this.handleEditSessionRender),this.emitPostRender(!0),t?.cleanUp(e?"recycle":"discard"),e||(this.editor=void 0),this.resizeManager.cleanUp(),this.interactionManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.managersDirty=!1,this.workerManager?.unsubscribeToThemeChanges(this),this.renderRange=void 0,e||(this.pendingFiles=void 0),this.isContainerManaged||this.fileContainer?.remove(),this.fileContainer=void 0,this.mounted=!1,e||(this.lineAnnotations=[]),this.clearAuxiliaryNodes(),this.annotationCache.clear(),this.pre=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.appliedPreAttributes=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.placeHolder?.remove(),this.placeHolder=void 0,this.headerCache.lastRenderedHTML=void 0,e||this.clearReusableHeader(),this.errorWrapper?.remove(),this.errorWrapper=void 0,this.spriteSVG=void 0,this.lastRowCount=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,e?this.hunksRenderer.recycle():(this.hunksRenderer.cleanUp(),this.workerManager=void 0,this.fileDiff=void 0,this.editSession=void 0,this.renderedDiff=void 0,this.deletionFile=void 0,this.additionFile=void 0),this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!1,this.deferredEditorActiveLine=void 0,this.deferredSelectedLines=void 0,this.enabled=!1}virtualizedSetup(){this.enabled=!0,this.workerManager?.subscribeToThemeChanges(this)}hydrate({fileContainer:e,prerenderedHTML:t,preventEmit:i=!1,lineAnnotations:n,fileDiff:r,...o}){if(!this.enabled)throw new Error("FileDiff.hydrate: attempting to call hydrate after cleaned up");if(this.fileContainer!=null)throw new Error("FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated");const s=$i(o,"FileDiff.hydrate"),l=s?.oldFile,a=s?.newFile;this.hydrateElements(e,t);const h=this.editor!=null;h||Dl(this.pre,Hl({fileDiff:r,oldFile:l,newFile:a}),this.options.collapsed)||Ml(this.headerElement,Tl({fileDiff:r,oldFile:l,newFile:a}),this.options.disableFileHeader)?this.render({...o,fileContainer:e,lineAnnotations:n,fileDiff:r,forceRender:h||o.forceRender,preventEmit:!0}):this.hydrationSetup({fileDiff:r,lineAnnotations:n,...s}),i||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),Ks(e,t);for(const i of e.shadowRoot?.children??[]){if(i instanceof SVGElement){this.spriteSVG=i;continue}if(i instanceof HTMLElement){if(i instanceof HTMLPreElement){this.pre=i;for(const n of i.children)!(n instanceof HTMLElement)||n.tagName.toLowerCase()!=="code"||("deletions"in n.dataset&&(this.codeDeletions=n),"additions"in n.dataset&&(this.codeAdditions=n),"unified"in n.dataset&&(this.codeUnified=n));continue}if("diffsHeader"in i.dataset){this.headerElement=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-theme-css")){this.themeCSSStyle=i;continue}if(i instanceof HTMLStyleElement&&i.hasAttribute("data-unsafe-css")){this.unsafeCSSStyle=i,this.appliedUnsafeCSS=i.textContent;continue}}}this.pre!=null&&(this.syncCodeNodesFromPre(this.pre),this.pre.removeAttribute("data-dehydrated")),this.fileContainer=e,this.hydrateMeasuredScrollbar()}hydrationSetup({fileDiff:e,oldFile:t,newFile:i,lineAnnotations:n}){this.lineAnnotations=n??this.lineAnnotations,this.additionFile=i,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&i!==void 0?et(t,i,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(this.fileDiff),this.renderedDiff=this.fileDiff,this.renderAnnotations(),this.renderGutterUtility(),this.injectUnsafeCSS(),this.managersDirty=!0,this.flushManagers())}rerender(){!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null||this.render({forceRender:!0,renderRange:this.renderRange})}onThemeChange(){this.hunksRenderer.clearRenderCache(),this.rerender()}loadFilesIfNecessary(){const{fileDiff:e,options:{loadDiffFiles:t}}=this;if(e==null||!ki(e)||this.pendingFiles?.fileDiff===e)return;if(t==null)throw new Error("FileDiff: loadDiffFiles is required to load full files for a partial diff");const i=this.loadFilesForDiff(e,t),n=this.pendingFiles={fileDiff:e,promise:i},r=()=>{this.pendingFiles===n&&(this.pendingFiles=void 0)};n.promise=i.finally(r)}__canAttachEditor(){return this.fileDiff!=null&&!this.fileDiff.isPartial}async prepareForEditing(){if(this.__canAttachEditor())return;const e=this.__prepareForEditing();if(e==null)throw this.fileDiff?.isPartial===!0&&!ki(this.fileDiff)?new Error("FileDiff.prepareForEditing: this partial diff cannot be hydrated; provide a complete diff"):new Error("FileDiff.prepareForEditing: a partial diff requires loadDiffFiles");if(await e,!this.__canAttachEditor())throw new Error("FileDiff.prepareForEditing: the diff did not finish loading")}__prepareForEditing(){if(!this.__canAttachEditor()){if(this.fileDiff?.isPartial===!0&&!ki(this.fileDiff))throw new Error("FileDiff: this partial diff cannot be hydrated; provide a complete diff to edit");return this.loadFilesIfNecessary(),this.pendingFiles?.promise}}async loadFilesForDiff(e,t){try{const i=await t(e);if(this.fileDiff!==e)return;await this.handleFilesLoaded(e,i)}catch(i){if(this.options.disableErrorHandling===!0)throw i;console.error(i)}}async handleFilesLoaded(e,t){if(!(this.fileDiff!==e||!e.isPartial)){if(Ui("merge",e,t),this.setHydratedState(t),this.installHydratedSessionDiff(e)){this.rerender();return}await Gi(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender()}}installHydratedSessionDiff(e){if(e.isPartial)throw new Error("FileDiff.installHydratedSessionDiff: diffs cannot be partial for editing");return this.fileDiff!==e?!1:this.editSession?.outgoingDiff!=null?(this.installEditSession(e),!0):!1}updateExternalDiff(e,t){if(J(this.fileDiff,e))return!1;const i=this.editSession?.outgoingDiff??this.editSession?.diff;return this.fileDiff=e,i!=null&&(e.isPartial?this.loadFilesIfNecessary():this.installEditSession(e),this.editSession!=null&&(this.editSession.outgoingDiff=i)),this.editSession?.annotations!=null&&t!=null&&(this.lineAnnotations=t,this.editSession.annotations=In(t,Rt,this.editSession.annotations)),!0}installEditSession(e,t,i){const n=e.additionLines.join(""),r=t!=null?ei(t.contents):void 0,o=i!=null&&El(i,e);if(i!=null&&!o)throw new Error("FileDiff: retained session cannot resume against a different old file");if(t!=null&&t.contents!==n&&!o)throw new Error("FileDiff: retained edits are missing their diff session state");const s=t==null||t.name===e.name&&t.lang===e.lang&&t.contents===n,l=wl(e);t!=null&&r!=null&&!s&&(l.name=t.name,l.lang=t.lang),o&&i!=null&&r!=null&&(l.additionLines=r,l.type=i.type,l.hunks=i.hunks,l.editSessionDirty=!0,ni(l)),this.editSession={diff:l,annotations:this.editSession?.annotations??In(this.lineAnnotations,Rt),outgoingDiff:this.editSession?.outgoingDiff},this.hunksRenderer.beginEditSession(l,s&&!o?e:void 0)}setHydratedState(e){this.deletionFile=e.oldFile,this.additionFile=e.newFile,this.workerManager?.cleanUpTasks(this.hunksRenderer),this.hunksRenderer.clearRenderCache()}render({fileDiff:e,deferManagers:t=!1,forceRender:i=!1,preventEmit:n=!1,lineAnnotations:r,fileContainer:o,containerWrapper:s,renderRange:l,...a}){if(!this.enabled)throw new Error("FileDiff.render: attempting to call render after cleaned up");const h=$i(a,"FileDiff.render"),d=h?.oldFile,f=h?.newFile;this.editor?.__postponeBgTokenizeToNextFrame();const{collapsed:p=!1,themeType:c="system",expandUnchanged:m=!1}=this.options,g=p?void 0:l,S=this.hasThemeChanged(),b=h!=null,y=b&&(!Qn(d,this.deletionFile)||!Qn(f,this.additionFile));let x=e!=null&&!J(e,this.fileDiff);const R=r!=null&&(r.length>0||this.getLatestAnnotations().length>0)?this.isNewAnnotations(r):!1;if(!p&&kr(g,this.renderRange)&&!i&&!R&&!S&&(e!=null&&!x||e==null&&!y)){const T=this.applyCachedThemeState(c);return T&&this.finalizeRender(),T}let k;e==null&&b&&(y||this.fileDiff==null)&&(k=et(h.oldFile,h.newFile,this.options.parseDiffOptions));const{renderRange:w}=this;this.renderRange=g,b?(this.deletionFile=d,this.additionFile=f):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e!=null&&x?this.updateExternalDiff(e,r):k!=null&&(x=!0,this.updateExternalDiff(k,r)),x&&this.clearReusableHeader(),r!=null&&this.setLineAnnotations(r);const E=this.getLatestDiff();if(E==null)return!1;E.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(Wn(E,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.getLatestAnnotations());const{disableErrorHandling:D=!1,disableFileHeader:H=!1}=this.options;if(H&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.headerCache.lastRenderedHTML=void 0),this.clearHeaderSlots()),o=this.getOrCreateFileContainer(o,s),this.applyCachedThemeState(c),p){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{const T=this.hunksRenderer.renderDiff(E,Bo);T!=null&&this.applyThemeState(o,T.themeStyles,c,T.baseThemeType),T?.headerElement!=null&&this.applyHeaderToDOM(T.headerElement,o,T.fileDiff),this.renderSeparators([]),this.renderedDiff=T?.fileDiff??E,this.injectUnsafeCSS()}catch(T){if(D)throw T;console.error(T),T instanceof Error&&this.applyErrorToDOM(T,o)}return this.finalizeRender(),n||this.emitPostRender(),!0}try{const T=this.getOrCreatePreNode(o);if(!(this.canPartiallyRender(i,R,y||x||S||!J(this.renderedDiff,E))&&this.applyPartialRender({fileDiff:E,previousRenderRange:w,renderRange:g}))){const F=this.hunksRenderer.renderDiff(E,g);if(F==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.isWorkingPool()&&this.workerManager.initialize().catch(()=>{}).then(()=>this.rerender()),!1;this.applyThemeState(o,F.themeStyles,c,F.baseThemeType),F.headerElement!=null&&this.applyHeaderToDOM(F.headerElement,o,F.fileDiff),F.additionsContentAST!=null||F.deletionsContentAST!=null||F.unifiedContentAST!=null?this.applyHunksToDOM(T,F):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(F.hunkData),this.renderedDiff=F.fileDiff}this.applyBuffers(T,g),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.finalizeRender(),this.editor!=null&&this.syncRenderViewToEditor()}catch(T){if(D)throw T;console.error(T),T instanceof Error&&this.applyErrorToDOM(T,o)}return n||this.emitPostRender(),!0}finalizeRender(){}emitPostRender(e=!1){const{fileContainer:t,options:{onPostRender:i}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,"unmount");return}if(t==null)return;const n=this.mounted?"update":"mount";this.mounted=!0,i?.(t,this,n)}getLatestDiff(e=this.fileDiff){return this.editSession?.diff??e}getRenderedDiff(){return this.renderedDiff}syncRenderViewToEditor(){const{editor:e,fileContainer:t}=this,i=this.getLatestAnnotations(),n=this.computeEditorRenderRange(this.renderRange),r=this.getLatestDiff();if(e==null||t==null||r==null||r.isPartial)return;const o=h=>{if(!this.enabled||this.editor!==e||this.fileContainer!==t||this.getLatestDiff()!==r)return;const d=this.editSession?.outgoingDiff,{fileDiff:f}=this,p=d!=null&&f!=null&&d!==r,c=p&&d!=null&&f!=null?Yn(d,f):!1;e.__syncRenderView({highlighter:h,fileContainer:t,fileDiff:r,lineAnnotations:i,renderRange:n,externalDocument:p,resetHistory:c})},s=this.getTheme(),l=r.lang??Dt(r.name),a=Ti({theme:s,lang:l});a!=null?o(a):mr({themes:cr(s),langs:["text",l],preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter}).then(o)}computeEditorRenderRange(e){const t=this.getLatestDiff();if(e==null||t==null||Pi(e))return e;const{diffStyle:i="split",expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;let o,s;return ct({diff:t,diffStyle:i,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,callback:({additionLine:l})=>{l!=null&&(o??=l.lineNumber,s=l.lineNumber)}}),o==null||s==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:o-1,totalLines:s-o+1}}__acknowledgeDocumentUpdate(){this.editSession!=null&&(this.editSession.outgoingDiff=void 0)}__acceptEditorChange(e){const{lineAnnotations:t}=e;t!=null&&this.syncEditSessionAnnotationsFromEditor(t)}emitEditChange(e){const{onEditChange:t}=this.options;t?.(e)}__captureDocumentSessionState(e=!0){let{fileDiff:t,editSession:{diff:i,outgoingDiff:n}={}}=this;if(n!=null&&t!=null){if(!t.isPartial&&Yn(n,t))return;i=n}if(!(i==null||i.isPartial))return{diffSession:{oldFile:i.type!=="new"?{name:i.prevName??i.name,lines:e?[...i.deletionLines]:i.deletionLines}:null,type:i.type,hunks:e?Hr(i.hunks):i.hunks},hasChanges:i.editSessionDirty===!0}}__attachEditor(e){if(this.type!=="file-diff")throw new Error(`FileDiff.__attachEditor: cannot attach an editor to a "${this.type}" diff`);if(this.editor!=null)throw new Error("FileDiff.__attachEditor: an editor is already attached");if(!this.__canAttachEditor())throw new Error("FileDiff.__attachEditor: a complete diff is required before editing");const t=()=>{this.editor=void 0,this.finishEditSession()};try{return this.resumeEditorRendering(e),t}catch(i){throw t(),i}}__resumeEditor(e){if(this.editor!==e)throw new Error("FileDiff.__resumeEditor: editor association changed");this.resumeEditorRendering(e)}resumeEditorRendering(e){const{fileDiff:t}=this,i=this.editSession?.outgoingDiff;i!=null&&t!=null&&!t.isPartial&&this.editSession?.diff===i&&this.installEditSession(t);const n=this.editSession==null&&t!=null&&!t.isPartial?t:void 0;n!=null?this.installEditSession(n,e.__getDocumentContents(Al(n)),e.__getDocumentSessionState()):this.editSession!=null&&this.hunksRenderer.beginEditSession(this.editSession.diff),this.editor=e,this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary();const r=this.editSession?.diff;this.hunksRenderer.editorRenderReady()?(r!=null&&this.hunksRenderer.diffCache===r&&(this.renderedDiff=r),this.syncRenderViewToEditor()):this.rerender()}finishEditSession(){this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks()}__completeEditSession(e,t){this.settleEditSession(t==="install",e)}settleEditSession(e,t){const{editSession:i,fileDiff:n,lineAnnotations:r}=this;if(i==null||n==null)return;const{diff:o,annotations:s}=i;if(this.editor!=null)throw new Error("FileDiff.__completeEditSession: detach the editor before completing the session");this.hunksRenderer.endEditSession(),this.finalizeEditSessionHunks();const l=s?.current;let a,h=null,d=null,f=!1,p;if(t==null)throw new Error("FileDiff.__completeEditSession: editor is required for completion");const c=Tr(o),m={name:c.name,contents:c.additionLines.join("")};c.lang!=null&&(m.lang=c.lang);const g={fileDiff:c,editor:t,originalFileDiff:n,oldFile:c.type==="new"?null:{name:c.prevName??c.name,contents:c.deletionLines.join("")},newFile:m,lineAnnotations:l,originalLineAnnotations:r};Object.freeze(g);try{if(t.__emitEditComplete(g),this.options.onEditComplete?.(g)==="accept"){if(c.cacheKey!=null&&c.cacheKey===n.cacheKey)throw new Error("FileDiff.__completeEditSession: an accepted diff must not reuse the replaced diff cacheKey");a=c,h=g.oldFile,d=g.newFile}}catch(S){f=!0,p=S}if(e&&a!=null&&(this.fileDiff=a,this.additionFile!=null&&(this.deletionFile=h,this.additionFile=d),l!=null&&(this.lineAnnotations=l)),this.editSession=void 0,e&&this.fileContainer!=null&&this.rerender(),f)throw p}finalizeEditSessionHunks(){const e=this.getLatestDiff();if(e==null||e.editSessionDirty!==!0)return!1;const{collapsedContextThreshold:t=1}=this.options,i=il(e,this.hunksRenderer.getExpandedHunksMap(),t);return Wn(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(nl(e,i)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){const i=this.editSession?.diff;if(i==null)throw new Error("FileDiff.applyDocumentChange: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(i),this.hunksRenderer.applyDocumentChange(e),t!=null&&this.syncEditSessionAnnotationsFromEditor(t),this.rerender(),this.interactionManager.setSelectionDirty()}applySuspendedDocumentChange(e,t){this.applyDocumentChange(e,t),this.hunksRenderer.clearRenderCache()}updateRenderCache(e,t,i={}){const n=this.editSession?.diff;if(n==null)throw new Error("FileDiff.updateRenderCache: requires an active edit session");this.detachAdditionLines(),this.hunksRenderer.beginEditSession(n);const{shouldRefreshDiffsView:r,lineCountChangeInFlight:o}=i;if(this.hunksRenderer.updateRenderCache(e,t,o)){this.refreshViewTimeout!=null&&(clearTimeout(this.refreshViewTimeout),this.refreshViewTimeout=void 0),this.lineStateRefreshPending=!0,this.escalateEditSessionRender();return}r===!0&&(this.refreshViewTimeout!=null&&clearTimeout(this.refreshViewTimeout),this.lineStateRefreshPending=!0,this.refreshViewTimeout=setTimeout(()=>{this.refreshViewTimeout=void 0,this.options.diffStyle==="split"?this.refreshSplitDiffView():this.refreshUnifiedDiffView(),this.flushDeferredLineState()},150))}detachAdditionLines(){const e=this.editSession?.diff,{fileDiff:t}=this;e!=null&&(e.additionLines===t?.additionLines||e.additionLines===e.deletionLines)&&(e.additionLines=[...e.additionLines])}isLineRenderable(e){const t=this.getRenderedDiff();if(t==null)return!0;const{expandUnchanged:i=!1,collapsedContextThreshold:n=1}=this.options;return vr({fileDiff:t,lineNumber:e,expandedHunks:i?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:n})}getNearestRenderableLine(e,t){const i=this.getRenderedDiff();if(i==null)return e;const{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return Vo({fileDiff:i,lineNumber:e,direction:t,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}revealLine(e){const t=this.getRenderedDiff(),{expandUnchanged:i=!1,collapsedContextThreshold:n=1,expansionLineCount:r=100}=this.options;if(t==null||t.isPartial||i)return!1;const o=this.hunksRenderer.getExpandedHunksMap();for(const[h,d]of t.hunks.entries()){const[f,p]=vn(d);if(e<f){const c=Ht({isPartial:t.isPartial,rangeSize:d.collapsedBefore,expandedHunks:o,hunkIndex:h,collapsedContextThreshold:n}),m=f-c.rangeSize;if(c.renderAll||e<m+c.fromStart||e>=f-c.fromEnd)return!1;const g=e-(m+c.fromStart)+1,S=f-c.fromEnd-e;return g<=S?this.expandHunk(h,"up",g+r):this.expandHunk(h,"down",S+r),!0}if(e<p)return!1}const s=Tt({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:o,collapsedContextThreshold:n,errorPrefix:"FileDiff.revealLine"});if(s==null||s.renderAll)return!1;const l=t.hunks[t.hunks.length-1],[,a]=vn(l);return e<a+s.fromStart||e>=a+s.rangeSize?!1:(this.expandHunk(t.hunks.length,"up",e-(a+s.fromStart)+1+r),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Cr(this.handleEditSessionRender)}removeRenderedCode(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.bufferBefore?.remove(),this.bufferBefore=void 0,this.bufferAfter?.remove(),this.bufferAfter=void 0,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0,this.lastRowCount=void 0}clearAuxiliaryNodes(){for(const{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(const{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear(),this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0}renderPlaceholder(e){if(this.fileContainer==null)return!1;if(this.emitPostRender(!0),this.cleanChildNodes(),this.placeHolder==null){const t=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:"open"});this.placeHolder=document.createElement("div"),this.placeHolder.dataset.placeholder="",t.appendChild(this.placeHolder)}return this.setPlaceholderHeight(e)}setPlaceholderHeight(e){return this.placeHolder==null?!1:(this.placeHolder.style.setProperty("height",`${e}px`),!0)}async primeHighlightCache(e=this.fileDiff){const{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||wt(e))return;const i=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>i||await t.primeDiffHighlightCache(e).catch(n=>{console.error(n)})}cleanChildNodes(){this.resizeManager.cleanUp(),this.scrollSyncManager.cleanUp(),this.interactionManager.cleanUp(),this.clearAuxiliaryNodes(),this.bufferAfter?.remove(),this.bufferBefore?.remove(),this.codeAdditions?.remove(),this.codeDeletions?.remove(),this.codeUnified?.remove(),this.errorWrapper?.remove(),this.headerElement?.remove(),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.pre?.remove(),this.spriteSVG?.remove(),this.themeCSSStyle?.remove(),this.unsafeCSSStyle?.remove(),this.bufferAfter=void 0,this.bufferBefore=void 0,this.codeAdditions=void 0,this.codeDeletions=void 0,this.codeUnified=void 0,this.errorWrapper=void 0,this.headerElement=void 0,this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0,this.pre=void 0,this.spriteSVG=void 0,this.themeCSSStyle=void 0,this.appliedThemeCSS=void 0,this.hasAdoptedThemeCSS=!1,this.unsafeCSSStyle=void 0,this.appliedUnsafeCSS=void 0,this.headerCache.lastRenderedHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){const{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!="function"){for(const{element:n}of this.separatorCache.values())n.remove();this.separatorCache.clear();return}const i=new Map(this.separatorCache);for(const n of e){const r=n.slotName;let o=this.separatorCache.get(r);if(o==null||!xl(n,o.hunkData)){o?.element.remove();const s=document.createElement("div");s.style.display="contents",s.slot=n.slotName;const l=t(n,this);l!=null&&s.appendChild(l),this.fileContainer.appendChild(s),o={element:s,hunkData:n},this.separatorCache.set(r,o)}i.delete(r)}for(const[n,{element:r}]of i.entries())this.separatorCache.delete(n),r.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(const{element:n}of this.annotationCache.values())n.remove();this.annotationCache.clear();return}const e=new Map(this.annotationCache),{renderAnnotation:t}=this.options,i=this.getLatestAnnotations();if(t!=null&&i.length>0)for(const[n,r]of i.entries()){const o=this.getAnnotationSlotName(r),s=`${n}-${o}`;let l=this.annotationCache.get(s);if(l==null||!Cl(r,l.annotation)){l?.element.remove();const a=t(r);if(a==null)continue;l={element:Us(o),annotation:r},l.element.appendChild(a),this.fileContainer.appendChild(l.element),this.annotationCache.set(s,l)}e.delete(s)}for(const[n,{element:r}]of e.entries())this.annotationCache.delete(n),r.remove()}renderGutterUtility(){const{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}const i=_s();i.appendChild(t),this.fileContainer.appendChild(i),this.gutterUtilityContent=i}getOrCreateFileContainer(e,t){const{fileContainer:i}=this,n=e??i??document.createElement("diffs-container"),r=i!==n;return i!=null&&r&&this.editor?.__captureFocusForDOMReplacement(),r&&this.emitPostRender(!0),this.fileContainer=n,i!=null&&r&&(this.headerCache.lastRenderedHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),r&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){const{shadowRoot:t}=e;if(t!=null)for(const i of t.children)i instanceof SVGElement?this.spriteSVG??=i:Mn(i)&&i.hasAttribute("data-theme-css")?(this.themeCSSStyle??=i,this.hasAdoptedThemeCSS=!0):Mn(i)&&i.hasAttribute("data-unsafe-css")&&(this.unsafeCSSStyle??=i,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});if(this.spriteSVG==null){const i=document.createElement("div");i.innerHTML=Ns;const n=i.firstChild;n instanceof SVGElement&&(this.spriteSVG=n)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){const t=e.shadowRoot??e.attachShadow({mode:"open"});return this.pre==null?(this.pre=document.createElement("pre"),this.appliedPreAttributes=void 0,this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0,t.appendChild(this.pre)):this.pre.parentNode!==t&&(this.editor?.__captureFocusForDOMReplacement(),t.appendChild(this.pre),this.appliedPreAttributes=void 0),this.placeHolder?.remove(),this.placeHolder=void 0,this.pre}syncCodeNodesFromPre(e){this.codeUnified=void 0,this.codeDeletions=void 0,this.codeAdditions=void 0;for(const t of Array.from(e.children))t instanceof HTMLElement&&(t.hasAttribute("data-unified")?this.codeUnified=t:t.hasAttribute("data-deletions")?this.codeDeletions=t:t.hasAttribute("data-additions")&&(this.codeAdditions=t))}applyHeaderToDOM(e,t,i){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;const{headerCache:{fileDiff:n,html:r,lastRenderedHTML:o}}=this,s=(i!==this.editSession?.diff&&J(n,i)?r:void 0)??Qe(e);if(this.headerCache.html=s,this.headerCache.fileDiff=i,s!==o){const m=document.createElement("div");m.innerHTML=s;const g=m.firstElementChild;if(!(g instanceof HTMLElement))return;this.headerElement!=null?t.shadowRoot?.replaceChild(g,this.headerElement):t.shadowRoot?.prepend(g),this.headerElement=g,this.headerCache.lastRenderedHTML=s}if(this.isContainerManaged)return;const{renderCustomHeader:l,renderHeaderPrefix:a,renderHeaderFilenameSuffix:h,renderHeaderMetadata:d}=this.options;if(l!=null){const m=l(i)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,dr,m),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}const f=a?.(i)??void 0,p=h?.(i)??void 0,c=d?.(i)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,hr,f),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,fr,p),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,ur,c),this.headerCustom?.remove(),this.headerCustom=void 0}clearReusableHeader(){this.headerCache.html=void 0,this.headerCache.fileDiff=void 0}clearHeaderSlots(){this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerCustom?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0,this.headerCustom=void 0}upsertHeaderSlotElement(e,t,i,n){if(n==null){t?.remove();return}const r=t??this.createHeaderSlotElement(i);return t==null&&e.appendChild(r),this.replaceHeaderSlotContent(r,n),r}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){const t=document.createElement("div");return t.slot=e,t}injectUnsafeCSS(){const{unsafeCSS:e}=this.options,t=this.fileContainer?.shadowRoot;if(t!=null){if(e==null||e===""){this.unsafeCSSStyle!=null&&(this.unsafeCSSStyle.remove(),this.unsafeCSSStyle=void 0),this.appliedUnsafeCSS=void 0;return}this.unsafeCSSStyle?.parentNode===t&&this.appliedUnsafeCSS===e||(this.unsafeCSSStyle??=Os(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=Ws(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,i,n){const r=e.shadowRoot??e.attachShadow({mode:"open"}),o=n??i,s=this.getTheme(),l=typeof s=="string"?s:{...s},a=zi(r);if(this.themeCSSStyle?.parentNode===r&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===o&&this.appliedThemeCSS.scrollbarGutter===a){this.appliedThemeCSS.theme=l;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===r){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:l,themeStyles:t,themeType:o,baseThemeType:n,scrollbarGutter:a};return}this.themeCSSStyle=Zs({shadowRoot:r,currentNode:this.themeCSSStyle,themeCSS:Gs(t,o,a)}),this.appliedThemeCSS=this.themeCSSStyle!=null?{theme:l,themeStyles:t,themeType:o,baseThemeType:n,scrollbarGutter:a}:void 0}hydrateMeasuredScrollbar(){const e=this.fileContainer?.shadowRoot;e==null||this.themeCSSStyle==null||(this.themeCSSStyle.textContent=$s(this.themeCSSStyle.textContent??"",zi(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&ia()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?Fn(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,i){const n=this.getColumnPair(e);if(n==null)return!1;const r=Ke(t[0]),o=Ke(t[1]);return r==null||o==null?!1:(n.gutter.innerHTML=Qe(r),n.content.innerHTML=Qe(o),i!==this.lastRowCount&&(n.gutter.style.setProperty("grid-row",`span ${i}`),n.content.style.setProperty("grid-row",`span ${i}`)),!0)}replaceCodeColumns(e,t){const{overflow:i="scroll"}=this.options,n=(this.options.hunkSeparators??"line-info")==="line-info",r=i==="wrap"?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let o=!1;const s=[],l=this.hunksRenderer.renderCodeAST("unified",t),a=this.hunksRenderer.renderCodeAST("deletions",t),h=this.hunksRenderer.renderCodeAST("additions",t);this.editor?.__captureFocusForDOMReplacement(),l!=null?(o=this.codeUnified==null||this.codeAdditions!=null||this.codeDeletions!=null,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0,this.codeUnified=Si({code:this.codeUnified,columnType:"unified",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeUnified,l,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(l)),s.push(this.codeUnified)):a!=null||h!=null?(a!=null?(o=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=Si({code:this.codeDeletions,columnType:"deletions",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeDeletions,a,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(a)),s.push(this.codeDeletions)):(this.codeDeletions?.remove(),this.codeDeletions=void 0),h!=null?(o=o||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=Si({code:this.codeAdditions,columnType:"additions",rowSpan:r,containerSize:n}),this.applyCodeColumnsInPlace(this.codeAdditions,h,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(h)),s.push(this.codeAdditions)):(this.codeAdditions?.remove(),this.codeAdditions=void 0)):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0),s.length===0?e.textContent="":o&&e.replaceChildren(...s),this.lastRowCount=t.rowCount}applyPartialRender({fileDiff:e,previousRenderRange:t,renderRange:i}){const{pre:n,codeUnified:r,codeAdditions:o,codeDeletions:s,options:{diffStyle:l="split"}}=this;if(n==null||t==null||i==null||!Number.isFinite(t.totalLines)||!Number.isFinite(i.totalLines)||this.lastRowCount==null)return!1;const a=this.getCodeColumns(l,r,s,o);if(a==null)return!1;const h=t.startingLine,d=i.startingLine,f=h+t.totalLines,p=d+i.totalLines,c=Math.max(h,d),m=Math.min(f,p);if(m<=c)return!1;const g=Math.max(0,c-h),S=Math.max(0,f-m),b=this.trimColumns({columns:a,trimStart:g,trimEnd:S,previousStart:h,overlapStart:c,overlapEnd:m,diffStyle:l});if(b<0)throw new Error("FileDiff.applyPartialRender: failed to trim to overlap");if(this.lastRowCount<b)throw new Error("FileDiff.applyPartialRender: trimmed beyond DOM row count");let y=this.lastRowCount-b;const x=(E,D)=>{if(!(D<=0))return this.hunksRenderer.renderDiff(e,{startingLine:E,totalLines:D,bufferBefore:0,bufferAfter:0})},R=x(d,Math.max(c-d,0));if(R==null&&d<c)return!1;const k=x(m,Math.max(p-m,0));if(k==null&&p>m)return!1;const w=(E,D)=>{if(E!=null){if(l==="unified"&&!Array.isArray(a))this.insertPartialHTML(l,a,E,D);else if(l==="split"&&Array.isArray(a))this.insertPartialHTML(l,a,E,D);else throw new Error("FileDiff.applyPartialRender.applyChunk: invalid chunk application");y+=E.rowCount,this.renderedDiff=E.fileDiff}};return this.cleanupErrorWrapper(),w(R,"afterbegin"),w(k,"beforeend"),this.lastRowCount!==y&&(this.applyRowSpan(l,a,y),this.lastRowCount=y),!0}insertPartialHTML(e,t,i,n){if(e==="unified"&&!Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("unified",i);this.renderPartialColumn(t,r,n)}else if(e==="split"&&Array.isArray(t)){const r=this.hunksRenderer.renderCodeAST("deletions",i),o=this.hunksRenderer.renderCodeAST("additions",i);this.renderPartialColumn(t[0],r,n),this.renderPartialColumn(t[1],o,n)}else throw new Error("FileDiff.insertPartialHTML: Invalid argument composition")}refreshSplitDiffView(){const e=this.getLatestDiff();if(this.options.diffStyle!=="split"||e==null)return;const t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;const i=this.getCodeColumns("split",this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(i))return;const n=(r,o)=>{if(o==null)return;const s=this.hunksRenderer.renderCodeAST(r,t),l=Ke(s?.[0]),a=Ke(s?.[1]);for(const[h,d]of[[o.gutter,l],[o.content,a]])if(d!=null&&h.childElementCount===d.length)for(let f=0;f<d.length;f++){const p=h.children[f],c=d[f].properties["data-line-type"];c!=null&&p.dataset.lineType!==c&&(p.dataset.lineType=c)}};n("deletions",i[0]),n("additions",i[1]),this.renderedDiff=t.fileDiff}refreshUnifiedDiffView(){const e=this.getLatestDiff();if(this.options.diffStyle!=="unified"||e==null)return;const t=this.hunksRenderer.renderDiff(e,this.renderRange);if(t==null)return;const i=this.getCodeColumns("unified",this.codeUnified,this.codeDeletions,this.codeAdditions);if(i==null||Array.isArray(i))return;const n=this.hunksRenderer.renderCodeAST("unified",t),r=Ke(n?.[0]),o=Ke(n?.[1]),s=()=>{for(const[l,a]of[[i.gutter,r],[i.content,o]])a!=null&&(l.innerHTML=Qe(a));t.rowCount!==this.lastRowCount&&(this.applyRowSpan("unified",i,t.rowCount),this.lastRowCount=t.rowCount),this.renderedDiff=t.fileDiff};this.shouldGuardRebuildScroll()?Fn(this.pre,s):s(),this.renderSeparators(t.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,i){if(e==null||t==null)return;const n=Ke(t[0]),r=Ke(t[1]);if(n==null||r==null)throw new Error("FileDiff.insertPartialHTML: Unexpected AST structure");const o=r.at(0);i==="beforeend"&&o?.type==="element"&&typeof o.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(o.properties["data-buffer-size"],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],n,r,!0);const s=r.at(-1);i==="afterbegin"&&s?.type==="element"&&typeof s.properties["data-buffer-size"]=="number"&&this.mergeBuffersIfNecessary(s.properties["data-buffer-size"],e.content.children[0],e.gutter.children[0],n,r,!1),e.gutter.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(n)),e.content.insertAdjacentHTML(i,this.hunksRenderer.renderPartialHTML(r))}mergeBuffersIfNecessary(e,t,i,n,r,o){if(!(t instanceof HTMLElement)||!(i instanceof HTMLElement))return;const s=this.getBufferSize(t.dataset);s!=null&&(o?(n.shift(),r.shift()):(n.pop(),r.pop()),this.updateBufferSize(t,s+e),this.updateBufferSize(i,s+e))}applyRowSpan(e,t,i){const n=r=>{r!=null&&(r.gutter.style.setProperty("grid-row",`span ${i}`),r.content.style.setProperty("grid-row",`span ${i}`))};if(e==="unified"&&!Array.isArray(t))n(t);else if(e==="split"&&Array.isArray(t))n(t[0]),n(t[1]);else throw new Error("dun fuuuuked up")}trimColumnRows(e,t,i){let n=0,r=0,o=0,s=!1;const l=i>=0;if(e==null)return 0;const a=Array.from(e.content.children),h=Array.from(e.gutter.children);if(a.length!==h.length)throw new Error("FileDiff.trimColumnRows: columns do not match");for(;o<a.length&&!(t<=0&&!l&&!s);){const d=h[o],f=a[o];if(o++,!(d instanceof HTMLElement)||!(f instanceof HTMLElement))throw console.error({gutterElement:d,contentElement:f}),new Error("FileDiff.trimColumnRows: invalid row elements");if(s&&(s=!1,d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset||d.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset)){d.remove(),f.remove(),r++;continue}if("lineIndex"in d.dataset&&"lineIndex"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),t>0&&(t--,t===0&&(s=!0)),r++),n++;continue}if("separator"in d.dataset&&"separator"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="annotation"&&"lineAnnotation"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="metadata"&&"noNewline"in f.dataset){(t>0||l&&n>=i)&&(d.remove(),f.remove(),r++);continue}if(d.dataset.gutterBuffer==="buffer"&&"contentBuffer"in f.dataset){const p=this.getBufferSize(f.dataset);if(p==null)throw new Error("FileDiff.trimColumnRows: invalid element");if(t>0){const c=Math.min(t,p),m=p-c;m>0?(this.updateBufferSize(d,m),this.updateBufferSize(f,m),r+=c):(d.remove(),f.remove(),r+=p),t-=c,t===0&&m===0&&(s=!0)}else if(l){const c=n,m=n+p-1;if(i<=c)d.remove(),f.remove(),r+=p;else if(i<=m){const g=m-i+1,S=p-g;this.updateBufferSize(d,S),this.updateBufferSize(f,S),r+=g}}n+=p;continue}throw console.error({gutterElement:d,contentElement:f}),new Error("FileDiff.trimColumnRows: unknown row elements")}return r}trimColumns({columns:e,diffStyle:t,overlapEnd:i,overlapStart:n,previousStart:r,trimEnd:o,trimStart:s}){const l=Math.max(0,n-r),a=i-r;if(a<0)throw new Error("FileDiff.trimColumns: overlap ends before previous");const h=s>0,d=o>0;if(!h&&!d)return 0;const f=h?l:0,p=d?a:-1;if(t==="unified"&&!Array.isArray(e))return this.trimColumnRows(e,f,p);if(t==="split"&&Array.isArray(e)){const c=this.trimColumnRows(e[0],f,p),m=this.trimColumnRows(e[1],f,p);if(e[0]!=null&&e[1]!=null&&c!==m)throw new Error("FileDiff.trimColumns: split columns out of sync");return e[0]!=null?c:m}else throw console.error({diffStyle:t,columns:e}),new Error("FileDiff.trimColumns: Invalid columns for diffType")}getBufferSize(e){const t=Number.parseInt(e?.bufferSize??"",10);return Number.isNaN(t)?void 0:t}updateBufferSize(e,t){e.dataset.bufferSize=`${t}`,e.style.setProperty("grid-row",`span ${t}`),e.style.setProperty("min-height",`calc(${t} * 1lh)`)}getColumnPair(e){if(e==null)return;const t=e.children[0],i=e.children[1];if(!(!(t instanceof HTMLElement)||!(i instanceof HTMLElement)||t.dataset.gutter==null||i.dataset.content==null))return{gutter:t,content:i}}getCodeColumns(e,t,i,n){if(e==="unified")return this.getColumnPair(t);{const r=this.getColumnPair(i),o=this.getColumnPair(n);return r!=null||o!=null?[r,o]:void 0}}updateBuffers(e){this.pre!=null&&this.applyBuffers(this.pre,e)}applyBuffers(e,t){if(t==null||this.shouldDisableVirtualizationBuffers()){this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0);return}t.bufferBefore>0?(this.bufferBefore==null&&(this.bufferBefore=document.createElement("div"),this.bufferBefore.dataset.virtualizerBuffer="before",e.before(this.bufferBefore)),this.bufferBefore.style.setProperty("height",`${t.bufferBefore}px`),this.bufferBefore.style.setProperty("contain","strict")):this.bufferBefore!=null&&(this.bufferBefore.remove(),this.bufferBefore=void 0),t.bufferAfter>0?(this.bufferAfter==null&&(this.bufferAfter=document.createElement("div"),this.bufferAfter.dataset.virtualizerBuffer="after",e.after(this.bufferAfter)),this.bufferAfter.style.setProperty("height",`${t.bufferAfter}px`),this.bufferAfter.style.setProperty("contain","strict")):this.bufferAfter!=null&&(this.bufferAfter.remove(),this.bufferAfter=void 0)}shouldDisableVirtualizationBuffers(){return this.options.disableVirtualizationBuffers??!1}applyPreNodeAttributes(e,{additionsContentAST:t,deletionsContentAST:i,totalLines:n},r){const{diffIndicators:o="bars",disableBackground:s=!1,disableLineNumbers:l=!1,overflow:a="scroll",diffStyle:h="split"}=this.options,d={type:"diff",diffIndicators:o,disableBackground:s,disableLineNumbers:l,overflow:a,split:h==="unified"?!1:t!=null&&i!=null,totalLines:n,customProperties:r};Ps(d,this.appliedPreAttributes)||(Xs(e,d),this.appliedPreAttributes=d)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;const i=t.shadowRoot??t.attachShadow({mode:"open"});this.errorWrapper??=document.createElement("div"),this.errorWrapper.dataset.errorWrapper="",this.errorWrapper.textContent="",i.appendChild(this.errorWrapper);const n=document.createElement("div");n.dataset.errorMessage="",n.innerText=e.message,this.errorWrapper.appendChild(n);const r=document.createElement("pre");r.dataset.errorStack="",r.innerText=e.stack??"No Error Stack",this.errorWrapper.appendChild(r)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}},v(Ai,"LoadedCustomComponent",!0),Ai);function Al(e){return{name:e.name,lang:e.lang,contents:e.additionLines.join("")}}function Qn(e,t){return e==null||t==null?e==null&&t==null:br(e,t)}function Hl({fileDiff:e,oldFile:t,newFile:i}){return e!=null&&e.hunks.length>0||t!=null||i!=null}function Tl({fileDiff:e,oldFile:t,newFile:i}){return e!=null||t!=null||i!=null}function Dl(e,t,i=!1){return!i&&e==null&&t}function Ml(e,t,i=!1){return e==null&&t&&!i}function Ke(e){if(!(e==null||e.type!=="element"))return e.children??[]}function Il({fileDiff:e,metrics:t,disableFileHeader:i,hunkSeparators:n,expandUnchanged:r,expandedHunks:o,collapsedContextThreshold:s,canHydratePartialDiff:l}){let a=ft(t,i),h=a;const d=r?!0:o,f=e.hunks.length-1;for(let p=0;p<e.hunks.length;p++){const c=e.hunks[p];if(c==null)throw new Error("computeEstimatedDiffHeights: invalid hunk index");const m=Ht({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:d,hunkIndex:p,collapsedContextThreshold:s}),g=(m.fromStart+m.fromEnd)*t.lineHeight;if(a+=g,h+=g,m.collapsedLines>0){const y=kt({type:n,metrics:t,hunkIndex:p,hunkSpecs:c.hunkSpecs})?.totalHeight??0;a+=y,h+=y}a+=c.splitLineCount*t.lineHeight,h+=c.unifiedLineCount*t.lineHeight;const S=Fl(c);a+=S.split*t.lineHeight,h+=S.unified*t.lineHeight;const b=p===f?Tt({fileDiff:e,hunkIndex:p,expandedHunks:d,collapsedContextThreshold:s,errorPrefix:"computeEstimatedDiffHeights"}):void 0;if(b!=null){const y=(b.fromStart+b.fromEnd)*t.lineHeight;if(a+=y,h+=y,b.collapsedLines>0){const x=ot({type:n,metrics:t})?.totalHeight??0;a+=x,h+=x}}else if(p===f&&e.isPartial&&l){const y=ot({type:n,metrics:t})?.totalHeight??0;a+=y,h+=y}}if(e.hunks.length>0){const p=Sr(t);a+=p,h+=p}return{splitHeight:a,unifiedHeight:h}}function Fl(e){if(!e.noEOFCRAdditions&&!e.noEOFCRDeletions)return{split:0,unified:0};const t=e.hunkContent.at(-1);if(t==null)return{split:0,unified:0};if(t.type==="context"){const i=t.lines>0?1:0;return{split:i,unified:i}}return Nl(e,t)}function Nl(e,t){const i=(t.deletions>0&&e.noEOFCRDeletions?1:0)+(t.additions>0&&e.noEOFCRAdditions?1:0),n=t.deletions>0&&e.noEOFCRDeletions,r=t.additions>0&&e.noEOFCRAdditions;return{split:n||r?1:0,unified:i}}const ji=3e3,qt=new Map;let Pl=-1;var zl=class extends Vr{constructor(t,i,n,r,o=!1){super(t,r,o);v(this,"__id",`little-virtualized-file-diff:${++Pl}`);v(this,"renderType","virtualized");v(this,"top");v(this,"height",0);v(this,"metrics");v(this,"cache",{heightDeltas:new Map,measuredHeightDeltaTotal:0,estimatedSplitHeight:void 0,estimatedUnifiedHeight:void 0,checkpoints:[],totalLines:0,fileAnnotationHeight:0,ghostTextRows:qt,ghostTextRowsByIndex:new Map});v(this,"isVisible",!1);v(this,"isSetup",!1);v(this,"virtualizer");v(this,"layoutDirty",!0);v(this,"forceRenderOverride");v(this,"currentCollapsed");v(this,"pendingHydratedDiff");v(this,"pendingExpansions");v(this,"pendingRender");v(this,"onRender",t=>this.fileContainer==null?!1:(t&&(this.top=this.getVirtualizedTop()),this.render()));v(this,"expandHunk",(t,i,n)=>{this.fileDiff!=null&&(this.loadFilesIfNecessary(),this.isAdvancedMode()?(this.pendingExpansions??=[],this.pendingExpansions.push({hunkIndex:t,direction:i,expansionLineCountOverride:n})):(this.hunksRenderer.expandHunk(t,i,n),this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))});this.virtualizer=i,this.metrics=gi(n)}setMetrics(t,i=!1){const n=gi(t);!i&&Fi(this.metrics,n)||(this.metrics=n,this.resetLayoutCache({includeEstimatedHeights:!0}))}setLineAnnotations(t){this.syncLineAnnotations(t)&&(this.forceRenderOverride=!0)}syncLineAnnotations(t){return t==null||!this.isNewAnnotations(t)||t.length===0&&this.getLatestAnnotations().length===0?!1:(super.setLineAnnotations(t),!0)}syncEditSessionAnnotationsFromEditor(t){return super.syncEditSessionAnnotationsFromEditor(t)?(this.forceRenderOverride=!0,!0):!1}setFileAnnotationHeight(t){const i=this.cache.fileAnnotationHeight;return t===i?!1:(this.cache.fileAnnotationHeight=t,this.cache.measuredHeightDeltaTotal+=t-i,!0)}hasFileAnnotations(t){const i=this.getLatestAnnotations();return Ms(i)?i.some(n=>n.lineNumber!==0?!1:t.type==="new"?n.side==="additions":t.type==="deleted"?n.side==="deletions":!0):!1}getLineHeight(t,i=!1){return this.getEstimatedLineHeight(i)+(this.cache.heightDeltas.get(t)??0)}getEstimatedLineHeight(t=!1){const i=t?2:1;return this.metrics.lineHeight*i}setOptions(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setOptions cannot be used inside CodeView. Update CodeView options instead.");if(t==null)return;const{options:i}=this,n=!rs(i,t),r=n&&Wl(i,t);super.setOptions(t),r&&this.resetLayoutCache({forceSimpleRecompute:!0,includeEstimatedHeights:Gl(i,t)}),n&&(this.forceRenderOverride=!0),n&&this.isSimpleMode()&&this.virtualizer.instanceChanged(this,r)}setThemeType(t){if(this.isAdvancedMode())throw new Error("VirtualizedFileDiff.setThemeType cannot be used inside CodeView. Update CodeView options instead.");super.setThemeType(t)}resetLayoutCache({forceSimpleRecompute:t=!1,includeEstimatedHeights:i=!1,resetRenderRange:n=!0}={}){this.layoutDirty=!0,this.cache.fileAnnotationHeight=0,this.cache.heightDeltas.clear(),this.cache.measuredHeightDeltaTotal=0,this.cache.ghostTextRows=qt,this.cache.ghostTextRowsByIndex.size>0&&this.cache.ghostTextRowsByIndex.clear(),this.invalidateDerivedLayoutCache(i,n),t&&this.isSimpleMode()&&this.computeApproximateSize()}invalidateDerivedLayoutCache(t,i=!0){this.layoutDirty=!0,this.cache.checkpoints.length>0&&(this.cache.checkpoints.length=0),this.cache.totalLines!==0&&(this.cache.totalLines=0),t&&(this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0),this.renderRange!=null&&i&&(this.renderRange=void 0)}applyGhostTextRows(t,i){const{cache:{heightDeltas:n,ghostTextRows:r,ghostTextRowsByIndex:o},metrics:{lineHeight:s}}=this;if(r===i)return!1;const l=this.getDiffStyle(),a=new Map;for(const[d,f]of i){const p=this.getLineIndexForDiff(t,d+1,"additions");p!=null&&a.set(l==="split"?p[1]:p[0],f)}let h=!1;for(const d of new Set([...o.keys(),...a.keys()])){const f=((a.get(d)??0)-(o.get(d)??0))*s;if(f===0)continue;const p=(n.get(d)??0)+f;p===0?n.delete(d):n.set(d,p),this.cache.measuredHeightDeltaTotal+=f,h=!0}return this.cache.ghostTextRows=i,this.cache.ghostTextRowsByIndex=a,h}reconcileHeights(){let t=!1;const{options:{overflow:i="scroll"},metrics:{lineHeight:n}}=this,r=this.placeHolder!=null?this.getLayoutDiff():this.getRenderedDiff();if(this.fileContainer==null||r==null)return this.height!==0&&(t=!0),this.height=0,t;this.top=this.getVirtualizedTop(),t=this.applyGhostTextRows(r,this.editor?.__getGhostTextRows()??qt);const{ghostTextRowsByIndex:o}=this.cache,s=i!=="scroll"||this.getLatestAnnotations().length>0||this.isResizeDebuggingEnabled();if(this.placeHolder!=null||!s&&this.cache.heightDeltas.size===0&&this.cache.fileAnnotationHeight===0)return t&&(this.computeApproximateSize(!0),this.setPlaceholderHeight(this.height)),t;const l=this.getDiffStyle(),a=l==="split"?[this.codeDeletions,this.codeAdditions]:[this.codeUnified];if(this.renderRange!=null&&Er(this.renderRange)){const h=Ul(a)??0;this.setFileAnnotationHeight(h)&&(t=!0)}for(const h of a){if(h==null)continue;const d=h.children[1];if(!(d instanceof HTMLElement))continue;const f=l==="split"&&h===this.codeDeletions;for(const p of d.children){if(!(p instanceof HTMLElement))continue;const c=p.dataset.lineIndex;if(c==null)continue;const m=jl(c,l),g=o.get(m)??0;if(f&&g>0)continue;const S=this.cache.heightDeltas.get(m)??0;if(!s&&S===g*n)continue;let b=p.getBoundingClientRect().height+g*n,y=!1;p.nextElementSibling instanceof HTMLElement&&("lineAnnotation"in p.nextElementSibling.dataset||"noNewline"in p.nextElementSibling.dataset)&&("noNewline"in p.nextElementSibling.dataset&&(y=!0),b+=p.nextElementSibling.getBoundingClientRect().height);const x=this.getEstimatedLineHeight(y),R=b-x;R!==S&&(t=!0,this.cache.measuredHeightDeltaTotal+=R-S,R===0?this.cache.heightDeltas.delete(m):this.cache.heightDeltas.set(m,R))}}return(t||this.isResizeDebuggingEnabled())&&this.computeApproximateSize(!0),t}flushManagers(){super.flushManagers(),this.lineStateRefreshPending&&this.flushDeferredLineState()}updateCodeViewLayout(t,i,n,r){let o=!1,s=!1;const{pendingExpansions:l,pendingHydratedDiff:a,options:{collapsed:h=!1}}=this;if(a!=null&&(this.pendingHydratedDiff=void 0,a.expectedDiff===t&&(Object.assign(t,a.nextDiff),this.setHydratedState(a.files),this.installHydratedSessionDiff(t),this.forceRenderOverride=!0,o=!0,s=!0)),l!=null){this.pendingExpansions=void 0;for(const{hunkIndex:g,direction:S,expansionLineCountOverride:b}of l)this.hunksRenderer.expandHunk(g,S,b),this.forceRenderOverride=!0,s=!0}const d=this.updateExternalDiff(t,r),{pendingRenderDiff:f,layoutDiffChanged:p,renderedDiffChanged:c,annotationsChanged:m}=this.updatePendingRender(t,r);return!this.forceRenderOverride&&(d||c||m)&&(this.forceRenderOverride=!0),(n?.resetDiffLayoutCache===!0||p)&&(o=!0),(p||n?.resetDiffLayoutCache===!0&&n.includeEstimatedDiffHeights)&&(s=!0),n?.metrics!=null&&(this.metrics=gi(n.metrics),o=!0,s=!0),this.currentCollapsed!==h&&(this.currentCollapsed=h,o=!0),o?this.resetLayoutCache({includeEstimatedHeights:s}):s&&this.invalidateDerivedLayoutCache(!0),this.top=i,this.computeApproximateSize(!1,f),this.height}getLinePosition(t,i="additions"){const n=this.getLayoutDiff();if(n==null||t<1)return;const r=this.getLineIndexForDiff(n,t,i);if(r==null)return;const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsed:l=!1,collapsedContextThreshold:a=1}=this.options,h=this.getDiffStyle(),d=this.getHunkSeparatorType(),f=h==="split"?r[1]:r[0];this.approximateLayoutCheckpoints(n);const p=ft(this.metrics,o),c=this.getLayoutCheckpointBeforeLineIndex(f);let m=c?.top??p+this.cache.fileAnnotationHeight;if(l)return{top:p,height:0};let g;return ct({diff:n,diffStyle:h,startingLine:c?.renderedLineIndex??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:a,callback:({hunkIndex:S,hunk:b,collapsedBefore:y,collapsedAfter:x,deletionLine:R,additionLine:k})=>{const w=h==="split"?k?.splitLineIndex??R?.splitLineIndex:k?.unifiedLineIndex??R?.unifiedLineIndex;if(w==null)throw new Error("VirtualizedFileDiff.getLinePosition: missing line index data");if(y>0){const D=kt({type:d,metrics:this.metrics,hunkIndex:S,hunkSpecs:b?.hunkSpecs});if(D!=null){if(m+=D.gapBefore,f>=w-y&&f<w)return g={top:m,height:D.height},!0;m+=D.height+D.gapAfter}}const E=this.getLineHeight(w,(k?.noEOFCR??!1)||(R?.noEOFCR??!1));if(w===f)return g={top:m,height:E},!0;if(m+=E,x>0){const D=ot({type:d,metrics:this.metrics});if(D!=null){if(f>w&&f<=w+x)return g={top:m+D.gapBefore,height:D.height},!0;m+=D.totalHeight}}return!1}}),g}getEditorViewport(){return this.virtualizer.type==="simple"?this.virtualizer.getRoot():this.virtualizer.getContainerElement()}getNumericScrollAnchor(t){const i=this.getLayoutDiff();if(i==null)return;const{disableFileHeader:n=!1,expandUnchanged:r=!1,collapsed:o=!1,collapsedContextThreshold:s=1}=this.options;if(o)return;const l=this.getDiffStyle(),a=this.getHunkSeparatorType();this.approximateLayoutCheckpoints(i);const h=this.getLayoutCheckpointBeforeTop(t);let d=h?.top??ft(this.metrics,n)+this.cache.fileAnnotationHeight,f;return ct({diff:i,diffStyle:l,startingLine:h?.renderedLineIndex??0,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:s,callback:({hunkIndex:p,hunk:c,collapsedBefore:m,collapsedAfter:g,deletionLine:S,additionLine:b})=>{const y=l==="split"?b?.splitLineIndex??S?.splitLineIndex:b?.unifiedLineIndex??S?.unifiedLineIndex;if(y==null)throw new Error("VirtualizedFileDiff.getNumericScrollAnchor: missing line index data");if(m>0){const R=kt({type:a,metrics:this.metrics,hunkIndex:p,hunkSpecs:c?.hunkSpecs});R!=null&&(d+=R.totalHeight)}if(d>=t&&(S!=null?f={lineNumber:S.lineNumber,side:"deletions",top:d}:b!=null&&(f={lineNumber:b.lineNumber,side:"additions",top:d}),f!=null))return!0;const x=this.getLineHeight(y,(b?.noEOFCR??!1)||(S?.noEOFCR??!1));if(d+=x,g>0){const R=ot({type:a,metrics:this.metrics});R!=null&&(d+=R.totalHeight)}return!1}}),f}getVirtualizedHeight(){return this.height}getAdvancedStickySpecs(t){const i=this.getLayoutDiff();if(this.top==null||i==null)return;if(this.options.collapsed===!0)return{topOffset:this.top,height:this.height};const n=t!=null?this.computeRenderRangeFromWindow(i,this.top,t):this.renderRange;if(n==null)return;const{bufferBefore:r,bufferAfter:o,totalLines:s}=n;let l=0;if(s===0){const a=t??this.virtualizer.getWindowSpecs();this.top<a.top&&(l=o)}return{topOffset:this.top+r+l,height:this.height-(r+o)}}cleanUp(t=!1){const i=this.cache.ghostTextRows.size>0;i&&(this.layoutDirty=!0);const n=t&&this.isAdvancedMode()&&this.fileContainer!=null&&(i||!J(this.getRenderedDiff(),this.getLatestDiff()));this.fileContainer!=null&&this.isSimpleMode()&&this.getSimpleVirtualizer()?.disconnect(this.fileContainer),t||(this.resetLayoutCache({includeEstimatedHeights:!0}),this.pendingExpansions=void 0,this.pendingHydratedDiff=void 0),this.pendingRender=void 0,this.isSetup=!1,super.cleanUp(t),n&&this.virtualizer.instanceChanged(this,!0)}async handleFilesLoaded(t,i){if(!(this.fileDiff!==t||!t.isPartial)){if(this.isAdvancedMode()){const n=Ui("clone",t,i);if(await Gi(()=>this.primeHighlightCache(n)),this.fileDiff!==t)return;this.pendingHydratedDiff={expectedDiff:t,nextDiff:n,files:i}}else{if(Ui("merge",t,i),this.setHydratedState(i),!this.installHydratedSessionDiff(t)&&(await Gi(()=>this.primeHighlightCache(t)),this.fileDiff!==t))return;this.resetLayoutCache({includeEstimatedHeights:!0}),this.computeApproximateSize()}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}}loadFilesIfNecessary(){if(this.pendingHydratedDiff!=null){if(this.pendingHydratedDiff.expectedDiff===this.fileDiff)return;this.pendingHydratedDiff=void 0}super.loadFilesIfNecessary()}isLineRenderable(t){if(super.isLineRenderable(t))return!0;const{pendingExpansions:i}=this,n=this.getRenderedDiff();if(i==null||i.length===0||n==null)return!1;const{expansionLineCount:r=100,collapsedContextThreshold:o=1}=this.options,s=new Map(this.hunksRenderer.getExpandedHunksMap());for(const l of i){const a={...s.get(l.hunkIndex)??{fromStart:0,fromEnd:0}},h=l.expansionLineCountOverride??r;(l.direction==="up"||l.direction==="both")&&(a.fromStart+=h),(l.direction==="down"||l.direction==="both")&&(a.fromEnd+=h),s.set(l.hunkIndex,a)}return vr({fileDiff:n,lineNumber:t,expandedHunks:s,collapsedContextThreshold:o})}invalidateEditSessionLayout(){this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1}),this.isSimpleMode()||this.computeApproximateSize(!0),this.getSimpleVirtualizer()?.requestHeightReconcile(this)}escalateEditSessionRender(){this.invalidateEditSessionLayout(),!(!this.enabled||this.fileDiff==null)&&(this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0))}shouldSelfHealEditSession(){return!this.isAdvancedMode()&&super.shouldSelfHealEditSession()}setVisibility(t){this.isAdvancedMode()||this.fileContainer==null||(this.renderRange=void 0,t&&!this.isVisible?(this.top=this.getVirtualizedTop(),this.isVisible=!0):!t&&this.isVisible&&(this.isVisible=!1,this.rerender()))}rerender(){if(!this.enabled||this.fileDiff==null&&this.additionFile==null&&this.deletionFile==null)return;const t=this.getLatestDiff(),i=t==null?void 0:this.hunksRenderer.getDiffForNextRender(t);this.isSimpleMode()&&(this.pendingRender=void 0),this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!J(this.getRenderedDiff(),i))}syncGhostTextRows(){const t=this.getAdvancedVirtualizer();t!=null?(t.capturePendingLayoutAnchor(),this.layoutDirty=!0,t.instanceChanged(this,!0)):this.getSimpleVirtualizer()?.requestHeightReconcile(this)}applyDocumentChange(t,i,n=!1){const{renderRange:r}=this;this.getAdvancedVirtualizer()?.capturePendingLayoutAnchor(),super.applyDocumentChange(t,i),this.getSimpleVirtualizer()?.markDOMDirty(),this.resetLayoutCache({forceSimpleRecompute:this.isSimpleMode(),includeEstimatedHeights:!0,resetRenderRange:!1});const o=this.getRenderedDiff();if(!this.isSimpleMode())this.computeApproximateSize(!0);else if(n&&r!=null&&o!=null){const s=this.virtualizer.getWindowSpecs(),l=this.computeRenderRangeFromWindow(o,this.top??0,s);l.bufferAfter!==r.bufferAfter&&this.updateBuffers(l)}this.forceRenderOverride=!0,this.virtualizer.instanceChanged(this,!0)}computeApproximateSize(t=!1,i=this.getLayoutDiff()){const n=this.isResizeDebuggingEnabled();if(!t&&!this.layoutDirty&&!n)return;const r=this.height===0;if(this.height=0,this.cache.checkpoints=[],this.cache.totalLines=0,i==null){this.layoutDirty=!1;return}this.applyGhostTextRows(i,this.editor?.__getGhostTextRows()??qt);const{disableFileHeader:o=!1,collapsed:s=!1}=this.options,l=ft(this.metrics,o);if(this.height+=l,s){this.layoutDirty=!1;return}this.height=this.getActiveEstimatedHeight(i)+this.cache.measuredHeightDeltaTotal,n&&!r&&this.validateComputedHeight(i),this.layoutDirty=!1}getLayoutDiff(){return this.pendingRender?.diff??this.getRenderedDiff()}getActiveEstimatedHeight(t=this.getLayoutDiff()){this.ensureEstimatedDiffHeights(t);const i=this.getDiffStyle()==="split"?this.cache.estimatedSplitHeight:this.cache.estimatedUnifiedHeight;if(i==null)throw new Error("VirtualizedFileDiff.getActiveEstimatedHeight: missing estimated height");return i}ensureEstimatedDiffHeights(t=this.getLayoutDiff()){if(t==null){this.cache.estimatedSplitHeight=void 0,this.cache.estimatedUnifiedHeight=void 0;return}if(this.cache.estimatedSplitHeight!=null&&this.cache.estimatedUnifiedHeight!=null)return;const{disableFileHeader:i=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,{splitHeight:o,unifiedHeight:s}=Il({fileDiff:t,metrics:this.metrics,disableFileHeader:i,hunkSeparators:this.getHunkSeparatorType(),expandUnchanged:n,expandedHunks:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r,canHydratePartialDiff:Ei(t,this.options.loadDiffFiles!=null)});this.cache.estimatedSplitHeight=o,this.cache.estimatedUnifiedHeight=s}validateComputedHeight(t=this.getLayoutDiff()){if(this.fileContainer==null||t==null)return;const i=this.fileContainer.getBoundingClientRect();i.height!==this.height?console.log("VirtualizedFileDiff.computeApproximateSize: computed height doesnt match",{name:t.name,elementHeight:i.height,computedHeight:this.height}):console.log("VirtualizedFileDiff.computeApproximateSize: computed height IS CORRECT")}render({fileContainer:t,fileDiff:i,forceRender:n=!1,lineAnnotations:r,...o}={}){const s=$i(o,"VirtualizedFileDiff.render"),l=s!=null,a=s?.oldFile,h=s?.newFile,d=l&&(!er(a,this.deletionFile)||!er(h,this.additionFile));let f=i??this.fileDiff;i==null&&l&&(d||this.fileDiff==null)&&(f=et(s.oldFile,s.newFile,this.options.parseDiffOptions));const{forceRenderOverride:p,isSetup:c}=this;this.forceRenderOverride=void 0;const m=f!=null&&!J(this.fileDiff,f),g=m||d;if(t=this.getOrCreateFileContainer(t),f==null)return console.error("VirtualizedFileDiff.render: attempting to virtually render when we dont have the correct data"),!1;m&&this.updateExternalDiff(f,r);const{pendingRenderDiff:S,layoutDiffChanged:b,renderedDiffChanged:y,annotationsChanged:x}=this.pendingRender!=null&&this.pendingRender.latestDiff===(this.getLatestDiff(f)??f)?{pendingRenderDiff:this.pendingRender.diff,layoutDiffChanged:!1,renderedDiffChanged:!1,annotationsChanged:this.syncLineAnnotations(r)}:this.updatePendingRender(f,r);if(b&&this.resetLayoutCache({includeEstimatedHeights:!0}),c)this.top??=this.getVirtualizedTop(),this.layoutDirty&&this.isSimpleMode()&&(this.getSimpleVirtualizer()?.markDOMDirty(),this.computeApproximateSize(!1,S));else{this.computeApproximateSize(!1,S);const E=this.getSimpleVirtualizer();if(this.top??=this.getVirtualizedTop(),this.isAdvancedMode())this.isVisible=!0;else{if(E==null)throw new Error("VirtualizedFileDiff.render: simple virtualizer is not available");E.connect(t,this),this.isVisible=E.isInstanceVisible(this.top??0,this.height)}this.isSetup=!0}if(!this.isVisible&&this.isSimpleMode()&&(!g||!c))return s!=null&&(this.deletionFile=a,this.additionFile=h),m&&this.clearReusableHeader(),this.renderPlaceholder(this.height);const R=this.virtualizer.getWindowSpecs(),k=this.top??0,w=this.computeRenderRangeFromWindow(S,k,R);return super.render({fileDiff:f,fileContainer:t,renderRange:w,lineAnnotations:r,forceRender:(p??n)||x||y||m,...s,...o})}finalizeRender(){if(!J(this.getRenderedDiff(),this.pendingRender?.diff))throw new Error("VirtualizedFileDiff.render: rendered a different diff than its prepared layout");this.pendingRender=void 0,this.isSimpleMode()&&this.getSimpleVirtualizer()?.requestHeightReconcile(this)}updatePendingRender(t,i){const n=this.getLatestDiff(t)??t,r=this.getRenderedDiff(),{pendingRender:o}=this,s=o?.diff??r,l=this.hunksRenderer.getDiffForNextRender(n);return this.pendingRender={latestDiff:n,diff:l},{pendingRenderDiff:l,annotationsChanged:this.syncLineAnnotations(i),layoutDiffChanged:!J(s,l),renderedDiffChanged:!J(r,l)}}syncVirtualizedTop(){this.top=this.getVirtualizedTop()}shouldDisableVirtualizationBuffers(){return this.isAdvancedMode()||super.shouldDisableVirtualizationBuffers()}shouldGuardRebuildScroll(){return!1}isSimpleMode(){return this.virtualizer.type==="simple"}isAdvancedMode(){return this.virtualizer.type==="advanced"}getVirtualizedTop(){return this.virtualizer.type==="advanced"?this.virtualizer.getLocalTopForInstance(this):this.fileContainer!=null?this.virtualizer.getOffsetInScrollContainer(this.fileContainer):0}getSimpleVirtualizer(){return this.virtualizer.type==="simple"?this.virtualizer:void 0}getAdvancedVirtualizer(){return this.virtualizer.type==="advanced"?this.virtualizer:void 0}isResizeDebuggingEnabled(){return this.getSimpleVirtualizer()?.config.resizeDebugging??!1}getDiffStyle(){return this.options.diffStyle??"split"}getHunkSeparatorType(){return $l(this.options.hunkSeparators)}approximateLayoutCheckpoints(t){if(!this.layoutDirty&&this.cache.checkpoints.length>0||t.hunks.length===0||this.options.collapsed===!0)return;const{disableFileHeader:i=!1,expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options,o=t.hunks.length-1,s=Ei(t,this.options.loadDiffFiles!=null),l=this.getDiffStyle(),a=this.getHunkSeparatorType(),h=n?!0:this.hunksRenderer.getExpandedHunksMap(),d=_l(this.cache.heightDeltas);let f=ft(this.metrics,i)+this.cache.fileAnnotationHeight,p=0;const c=({rowCount:m,startLineIndex:g,preSeparatorHeight:S=0,postSeparatorHeight:b=0,metadataOffsets:y=[]})=>{if(m<=0)return;const x=p,R=p+m;let k=Ol(x);for(;k<R;){const w=k-x,E=f+(w>0?S:0)+w*this.metrics.lineHeight+Bl(y,w)*this.metrics.lineHeight+Jn(d,g,g+w);this.cache.checkpoints.push({renderedLineIndex:k,lineIndex:g+w,top:E}),k+=ji}f+=S+m*this.metrics.lineHeight+y.length*this.metrics.lineHeight+Jn(d,g,g+m)+b,p=R};for(let m=0;m<t.hunks.length;m++){const g=t.hunks[m];if(g==null)throw new Error("VirtualizedFileDiff.approximateLayoutCheckpoints: invalid hunk index");const S=Ht({isPartial:t.isPartial,rangeSize:g.collapsedBefore,expandedHunks:h,hunkIndex:m,collapsedContextThreshold:r}),b=S.collapsedLines>0?kt({type:a,metrics:this.metrics,hunkIndex:m,hunkSpecs:g.hunkSpecs})?.totalHeight??0:0;c({rowCount:S.fromStart,startLineIndex:(l==="split"?g.splitLineStart:g.unifiedLineStart)-S.rangeSize});let y=b;c({rowCount:S.fromEnd,startLineIndex:(l==="split"?g.splitLineStart:g.unifiedLineStart)-S.fromEnd,preSeparatorHeight:y}),S.fromEnd>0&&(y=0);const x=m===o?Tt({fileDiff:t,hunkIndex:m,expandedHunks:h,collapsedContextThreshold:r,errorPrefix:"VirtualizedFileDiff"}):void 0,R=x!=null&&x.collapsedLines>0?ot({type:a,metrics:this.metrics})?.totalHeight??0:m===o&&s?ot({type:a,metrics:this.metrics})?.totalHeight??0:0,k=x!=null?x.fromStart+x.fromEnd:0,w=l==="split"?g.splitLineCount:g.unifiedLineCount,E=l==="split"?g.splitLineStart:g.unifiedLineStart;c({rowCount:w,startLineIndex:E,preSeparatorHeight:y,postSeparatorHeight:k===0?R:0,metadataOffsets:Vl({diffStyle:l,hunk:g,rowCount:w})}),x!=null&&k>0&&c({rowCount:k,startLineIndex:E+w,postSeparatorHeight:R})}this.cache.totalLines=p}getLayoutCheckpointBeforeLineIndex(t){if(t<=0||this.cache.checkpoints.length===0)return;let i=0,n=this.cache.checkpoints.length-1,r;for(;i<=n;){const o=i+n>>1,s=this.cache.checkpoints[o];if(s==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");s.lineIndex<=t?(r=s,i=o+1):n=o-1}return r}getLayoutCheckpointBeforeTop(t,i){let n=0,r=this.cache.checkpoints.length-1,o=-1;for(;n<=r;){const s=n+r>>1,l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");l.top<=t?(o=s,n=s+1):r=s-1}if(i==null)return o>=0?this.cache.checkpoints[o]:void 0;for(let s=o;s>=0;s--){const l=this.cache.checkpoints[s];if(l==null)throw new Error("VirtualizedFileDiff: invalid checkpoint index");if(l.renderedLineIndex%i===0)return l}}getExpandedLineCount(t,i){let n=0;if(t.isPartial){for(const a of t.hunks)n+=i==="split"?a.splitLineCount:a.unifiedLineCount;return n}const{expandUnchanged:r=!1,collapsedContextThreshold:o=1}=this.options,s=r?!0:this.hunksRenderer.getExpandedHunksMap();for(const[a,h]of t.hunks.entries()){const d=i==="split"?h.splitLineCount:h.unifiedLineCount;n+=d;const f=Math.max(h.collapsedBefore,0),{fromStart:p,fromEnd:c,renderAll:m}=Ht({isPartial:t.isPartial,rangeSize:f,expandedHunks:s,hunkIndex:a,collapsedContextThreshold:o});f>0&&(n+=m?f:p+c)}const l=Tt({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:s,collapsedContextThreshold:o,errorPrefix:"VirtualizedFileDiff"});return l!=null&&(n+=l.fromStart+l.fromEnd),n}getLayoutLineCount(t,i){const n=this.getExpandedLineCount(t,i),r=i==="split"?t.splitLineCount:t.unifiedLineCount;return Math.max(n,r,t.additionLines.length,t.deletionLines.length,this.cache.totalLines)}computeRenderRangeFromWindow(t,i,{top:n,bottom:r}){const{disableFileHeader:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:l=1}=this.options,{hunkLineCount:a,lineHeight:h}=this.metrics,d=this.getDiffStyle(),f=this.getHunkSeparatorType(),p=Ei(t,this.options.loadDiffFiles!=null),c=this.height;let m=this.getLayoutLineCount(t,d);const g=ft(this.metrics,o),S=t.hunks.length>0?Sr(this.metrics):0,{fileAnnotationHeight:b}=this.cache,y=g+b,x=Math.max(0,c-g-b-S),R=this.hasFileAnnotations(t),k=i+g,w=b>0&&R&&k<r&&k+b>n;if(i<n-c||i>r)return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-g-S};if(m<=a||t.hunks.length===0)return{startingLine:0,totalLines:a,bufferBefore:0,bufferAfter:0};this.approximateLayoutCheckpoints(t),m=this.getLayoutLineCount(t,d);const E=Math.ceil(Math.max(r-n,0)/h),D=Math.ceil(E/a)*a+a,H=D/a,T=H,F=[],j=(n+r)/2,N=this.getLayoutCheckpointBeforeTop(Math.max(0,n-i-D*h*2),a);let B=i+(N?.top??y),ce=N?.renderedLineIndex??0,$,V,re;if(ct({diff:t,diffStyle:d,startingLine:N?.renderedLineIndex??0,expandedHunks:s?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:l,callback:({hunkIndex:Ee,hunk:be,collapsedBefore:tt,collapsedAfter:Ie,deletionLine:Se,additionLine:_})=>{const oe=_!=null?_.splitLineIndex:Se.splitLineIndex,se=_!=null?_.unifiedLineIndex:Se.unifiedLineIndex,Fe=(_?.noEOFCR??!1)||(Se?.noEOFCR??!1),me=Ee===t.hunks.length-1&&be!=null&&(d==="split"?oe===be.splitLineStart+be.splitLineCount-1:se===be.unifiedLineStart+be.unifiedLineCount-1),q=(tt>0?kt({type:f,metrics:this.metrics,hunkIndex:Ee,hunkSpecs:be?.hunkSpecs}):void 0)?.totalHeight??0;B+=q;const K=ce%a===0,ee=Math.floor(ce/a);if(K&&(F[ee]=B-(i+y+q),re!=null)){if(re<=0)return!0;re--}const ye=this.getLineHeight(d==="split"?oe:se,Fe);if(B>n-ye&&B<r&&($??=ee),V==null&&B+ye>j&&(V=ee),re==null&&B>=r&&K&&(re=T),ce++,B+=ye,Ie>0||me&&p){const at=ot({type:f,metrics:this.metrics});at!=null&&(B<r&&B+at.totalHeight>n&&($??=ee),V==null&&B+at.totalHeight>j&&(V=ee),B+=at.totalHeight)}return!1}}),$==null)if(w)$=0,V=0;else return{startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:c-g-S};V??=$;const W=Math.round(V-H/2),P=Math.max(0,Math.ceil(m/a)-H),U=Math.max(0,Math.min(W,P)),G=U*a,Q=W<0?D+W*a:D,de=F[U]??0,Z=G===0?0:b+de,he=U+Q/a,ve=he<F.length?x-F[he]:x-(B-i-y);return{startingLine:G,totalLines:Q,bufferBefore:Z,bufferAfter:Math.max(0,ve)}}};function Ul(e){let t;for(const i of e){if(i==null)continue;const n=i.children[1];if(n instanceof HTMLElement)for(const r of n.children)r instanceof HTMLElement&&r.dataset.lineAnnotation===Ds&&(t=Math.max(t??0,r.getBoundingClientRect().height))}return t}function _l(e){const t=Array.from(e).sort((o,s)=>o[0]-s[0]),i=[],n=[0];let r=0;for(const[o,s]of t)i.push(o),r+=s,n.push(r);return{lineIndexes:i,prefixTotals:n}}function Jn({lineIndexes:e,prefixTotals:t},i,n){if(i>=n||e.length===0)return 0;const r=Zn(e,i);return(t[Zn(e,n)]??0)-(t[r]??0)}function Zn(e,t){let i=0,n=e.length;for(;i<n;){const r=i+n>>1,o=e[r];if(o==null)throw new Error("VirtualizedFileDiff: invalid prefix index");o<t?i=r+1:n=r}return i}function Ol(e){return Math.ceil(e/ji)*ji}function Bl(e,t){let i=0;for(const n of e)n<t&&i++;return i}function Vl({diffStyle:e,hunk:t,rowCount:i}){if(i<=0||!t.noEOFCRAdditions&&!t.noEOFCRDeletions)return[];const n=t.hunkContent.at(-1);if(n==null)return[];if(n.type==="context")return[i-1];const r=Math.max(n.deletions,n.additions),o=n.deletions+n.additions;if(e==="split")return r>0&&(t.noEOFCRAdditions||t.noEOFCRDeletions)?[i-1]:[];const s=[],l=i-o;return n.deletions>0&&t.noEOFCRDeletions&&s.push(l+n.deletions-1),n.additions>0&&t.noEOFCRAdditions&&s.push(i-1),s}function Wl(e,t){return(e.diffStyle??"split")!==(t.diffStyle??"split")||(e.overflow??"scroll")!==(t.overflow??"scroll")||(e.collapsed??!1)!==(t.collapsed??!1)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.diffIndicators??"bars")!==(t.diffIndicators??"bars")||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)||e.unsafeCSS!==t.unsafeCSS}function Gl(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??"line-info")!==(t.hunkSeparators??"line-info")||!!e.loadDiffFiles!=!!t.loadDiffFiles||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function Ei(e,t){return e.isPartial&&t&&(e.type==="change"||e.type==="rename-changed")}function $l(e){return typeof e=="function"?"custom":e??"line-info"}function er(e,t){return e==null||t==null?e==null&&t==null:br(e,t)}function jl(e,t){const[i,n]=e.split(",").map(Number);return t==="split"?n:i}var ql=ge('<span class="diff-header-chevron svelte-1janpwr"><!></span>'),Kl=ge('<span class="diff-header-old-name svelte-1janpwr"> </span> <span class="diff-header-arrow svelte-1janpwr">→</span>',1),Xl=ge('<span class="diff-stat-additions svelte-1janpwr"> </span>'),Yl=ge('<span class="diff-stat-deletions svelte-1janpwr"> </span>'),Ql=ge('<span class="diff-header-stats svelte-1janpwr"><!> <!></span>'),Jl=ge('<!> <span class="diff-header-icon svelte-1janpwr"><!></span> <span class="diff-header-filename svelte-1janpwr"><!> </span> <!>',1),Zl=ge('<div class="diff-header-actions svelte-1janpwr"></div>'),ed=ge('<div class="diff-header svelte-1janpwr"><!> <!></div>');function Wr(e,t){if(new.target)return ir({component:Wr,...e});or(t,!0);let i=M(t,"fileName",7),n=M(t,"oldFileName",7),r=M(t,"additions",7),o=M(t,"deletions",7),s=M(t,"collapsible",7,!1),l=M(t,"collapsed",7,!1),a=M(t,"actions",23,()=>[]),h=M(t,"onToggle",7);const d=ne(()=>n()&&n()!==i()),f=ne(()=>{if(r()===void 0&&o()===void 0)return null;const b=[];return r()!==void 0&&r()>0&&b.push(`+${r()}`),o()!==void 0&&o()>0&&b.push(`-${o()}`),b.length>0?b.join(" "):null});var p={get fileName(){return i()},set fileName(b){i(b),I()},get oldFileName(){return n()},set oldFileName(b){n(b),I()},get additions(){return r()},set additions(b){r(b),I()},get deletions(){return o()},set deletions(b){o(b),I()},get collapsible(){return s()},set collapsible(b=!1){s(b),I()},get collapsed(){return l()},set collapsed(b=!1){l(b),I()},get actions(){return a()},set actions(b=[]){a(b),I()},get onToggle(){return h()},set onToggle(b){h(b),I()},$set:nr,$on:(b,y)=>rr(t,b,y)},c=ed(),m=De(c);{let b=ne(()=>s()?"clickable":""),y=ne(()=>s()?h():void 0),x=ne(()=>!s());Di(m,{variant:"plain",size:"compact",get class(){return`diff-header-content ${C(b)??""}`},truncateLabel:!1,labelClass:"flex min-w-0 flex-1 items-center gap-2",get onclick(){return C(y)},get disabled(){return C(x)},children:(R,k)=>{var w=Jl(),E=hn(w);{var D=W=>{var P=ql(),U=De(P);{let G=ne(()=>l()?Ko:Xo);vi(U,{get icon(){return C(G)}})}ke(P),le(W,P)};we(E,W=>{s()&&W(D)})}var H=Xe(E,2),T=De(H);{var F=W=>{vi(W,{get icon(){return jo}})},j=W=>{vi(W,{get icon(){return qo}})};we(T,W=>{C(d)?W(F):W(j,-1)})}ke(H);var N=Xe(H,2),B=De(N);{var ce=W=>{var P=Kl(),U=hn(P),G=Xt(U,!0);Hi(2),Me(()=>rt(G,n())),le(W,P)};we(B,W=>{C(d)&&W(ce)})}var $=Xe(B);ke(N);var V=Xe(N,2);{var re=W=>{var P=Ql(),U=De(P);{var G=Z=>{var he=Xl(),ve=Xt(he);Me(()=>rt(ve,`+${r()??""}`)),le(Z,he)};we(U,Z=>{r()!==void 0&&r()>0&&Z(G)})}var Q=Xe(U,2);{var de=Z=>{var he=Yl(),ve=Xt(he);Me(()=>rt(ve,`-${o()??""}`)),le(Z,he)};we(Q,Z=>{o()!==void 0&&o()>0&&Z(de)})}ke(P),le(W,P)};we(V,W=>{C(f)&&W(re)})}Me(()=>rt($,` ${i()??""}`)),le(R,w)},$$slots:{default:!0}})}var g=Xe(m,2);{var S=b=>{var y=Zl();Go(y,21,a,$o,(x,R)=>{{let k=ne(()=>C(R).variant==="primary"?"primary":C(R).variant==="danger"?"destructive":C(R).variant==="success"?"plain":"outline"),w=ne(()=>C(R).variant==="primary"?"primary":C(R).variant==="success"?"success":C(R).variant==="danger"?"danger":"");Di(x,{get variant(){return C(k)},size:"compact",get class(){return`diff-action-button ${C(w)??""}`},get disabled(){return C(R).disabled},get onclick(){return C(R).onClick},children:(E,D)=>{Hi();var H=ar();Me(()=>rt(H,C(R).label)),le(E,H)},$$slots:{default:!0}})}}),ke(y),le(b,y)};we(g,b=>{a().length>0&&b(S)})}return ke(c),le(e,c),sr(p)}const td=500;function id(e,t){const i=e.replace(/\u00a0/g," ").replace(/[\t\r\n]+/g," ").trim();return i?i.slice(0,t):null}function Kt(e,t){if(!t)return!1;if(e instanceof ShadowRoot)return t.getRootNode()===e;const i=e;if(i.contains(t))return!0;const n=t.getRootNode();return n instanceof ShadowRoot&&i.contains(n.host)}function nd(e,t){if(!Kt(t,e.anchorNode)||!Kt(t,e.focusNode))return!1;for(let i=0;i<e.rangeCount;i++){const n=e.getRangeAt(i);if(!Kt(t,n.startContainer)||!Kt(t,n.endContainer))return!1}return!0}function tr(e,t,i){return!e||e.isCollapsed||e.rangeCount===0||!t.some(n=>nd(e,n))?null:id(e.toString(),i)}function rd(e,{extraRoots:t=[],maxLength:i=td}={}){const n=[e,...t].filter(o=>o!=null);if(n.length===0||typeof document>"u")return null;const r=tr(document.getSelection?.(),n,i);if(r)return r;for(const o of n)if(o instanceof ShadowRoot){const s=tr(o.getSelection?.(),[o],i);if(s)return s}return null}function od(e){let t=2166136261;for(let i=0;i<e.length;i++)t^=e.charCodeAt(i),t=t+((t<<1)+(t<<4)+(t<<7)+(t<<8)+(t<<24))>>>0;return t.toString(36)}const Lt=new Map;function Ri(e){if(e.length===0)return"0";const t=Lt.get(e);if(t!==void 0)return t;const i=od(e);if(Lt.size>512){const n=Array.from(Lt.keys());for(let r=0;r<n.length>>1;r++)Lt.delete(n[r])}return Lt.set(e,i),i}var sd=ge('<div class="diff-search-bar svelte-htizai"><!></div>'),ad=ge('<div class="pure-diff-container svelte-htizai"></div>'),ld=ge('<div class="pure-diff-empty svelte-htizai"><p class="text-subtle text-sm"> </p></div>'),dd=ge("<div><!> <!></div>"),hd=ge('<div class="pure-diff-preview svelte-htizai"><!></div>'),fd=ge('<div tabindex="-1"><!> <!></div>');function ud(e,t){if(new.target)return ir({component:ud,...e});or(t,!0);const i=()=>dn(se,"$isDarkTheme",r),n=()=>dn(oe,"$codeFontFamilyCSS",r),[r,o]=So(),s=2*1024*1024;let l=M(t,"patch",7),a=M(t,"oldContent",7),h=M(t,"newContent",7),d=M(t,"fileName",7,"file"),f=M(t,"oldFileName",7),p=M(t,"language",7),c=M(t,"viewMode",7,"unified"),m=M(t,"showHeader",7,!0),g=M(t,"showStats",7,!0),S=M(t,"showLineNumbers",7,!0),b=M(t,"diffIndicators",7,"bars"),y=M(t,"overflow",7,"scroll"),x=M(t,"maxHeight",7),R=M(t,"hunkSeparators",7,"line-info"),k=M(t,"expandUnchanged",7,!1),w=M(t,"expansionLineCount",7,20),E=M(t,"lineDiffType",7,"word-alt"),D=M(t,"maxLineDiffLength",7,500),H=M(t,"collapsible",7,!1),T=M(t,"initialCollapsed",7,!1),F=M(t,"previewLines",7,5),j=M(t,"annotations",23,()=>[]),N=M(t,"renderAnnotation",7),B=M(t,"enableLineSelection",7,!1),ce=M(t,"selectedLines",7,null),$=M(t,"onLineSelected",7),V=M(t,"onLineClick",7),re=M(t,"onLineNumberClick",7),W=M(t,"onLineEnter",7),P=M(t,"onLineLeave",7),U=M(t,"onToggleCollapse",7),G=M(t,"actions",23,()=>[]),Q=M(t,"enableHoverUtility",7,!1),de=M(t,"renderHoverUtility",7),Z=M(t,"renderHunkSeparator",7),he=M(t,"class",7,""),ve=M(t,"style",7,""),Ee=M(t,"unsafeCSS",7),be=M(t,"oldCacheKey",7),tt=M(t,"newCacheKey",7),Ie=M(t,"maxHighlightLines",7,5e3),Se=M(t,"disableHighlighting",7,!1),_=M(t,"virtualizer",7);const oe=Yo(),se=Qo(),Fe=ne(()=>{const u=a()?.length??0,L=h()?.length??0,A=l()?.length??0;return u+L+A>s}),me=ne(()=>{if(Se())return!0;const u=a()?.split(`
|
|
155
155
|
`).length??0,L=h()?.split(`
|
|
156
156
|
`).length??0;return u+L>Ie()});let q=Te(void 0),K=Te(void 0),ee=!1,ye=Te(!1);const at="[data-separator='line-info'], [data-separator='line-info-basic']",Gr="[data-expand-button], [data-unmodified-lines]",$r="[data-expand-button]:not([data-expand-all-button])",jr=["[data-column-content]","[data-content] [data-line]","[data-content] [data-no-newline]","pre [data-line]"].join(","),Xi="rgba(255, 213, 0, 0.4)",qr="rgba(59, 130, 246, 0.5)",Mt=16,Kr=150;let Ne=Te(!1),Ce=Te(""),Re=Te(Co([])),xe=Te(0),It=Te(null),mt=Te(void 0),Yi=Te(0);const Ft=ne(()=>C(Yi)<640?"unified":c());let it=null,ri=!1;je(()=>{Y(ye,T())});const Pe=ne(()=>{if(C(Fe))return null;if(l()){const u=`${d()}:${Ri(l())}`,L=Ra(l(),u);if(L.length>0&&L[0].files.length>0){const A=L[0].files[0];if(A.lang&&(A.lang=mi(A.lang)),p()){const z=mi(p());z&&(A.lang=z)}return{fileDiff:A,oldFile:void 0,newFile:void 0}}return null}else if(a()!==void 0&&h()!==void 0){const u=mi(p()),L=be()??`${f()||d()}:${Ri(a())}`,A=tt()??`${d()}:${Ri(h())}`,z={name:f()||d(),contents:a(),lang:u,cacheKey:L},X={name:d(),contents:h(),lang:u,cacheKey:A};return{fileDiff:et(z,X),oldFile:z,newFile:X}}return null}),lt=ne(()=>{if(!C(Pe)?.fileDiff)return{additions:0,deletions:0};let u=0,L=0;for(const A of C(Pe).fileDiff.hunks)u+=A.additionCount,L+=A.deletionCount;return{additions:u,deletions:L}}),oi=`
|
|
157
157
|
pre[data-diffs] {
|
|
@@ -301,4 +301,4 @@ ${t}`,n=e.startsWith(t)?0:_n(e,i,0);if(n===-1)return[e];const r=[];n>0&&r.push(e
|
|
|
301
301
|
[data-expand-index] [data-unmodified-lines]:hover {
|
|
302
302
|
text-decoration: none;
|
|
303
303
|
}
|
|
304
|
-
`;let Qi,si=oi;function Xr(u){return u===Qi||(Qi=u,si=u?`${oi}${u}`:oi),si}function Ji(){return{diffStyle:C(Ft),diffIndicators:b(),disableLineNumbers:!S(),overflow:y(),hunkSeparators:Z()?(u,L)=>Z()(u,A=>L.expandHunk(u.hunkIndex,A)):R(),expandUnchanged:k(),expansionLineCount:w(),lineDiffType:E(),maxLineDiffLength:D(),disableFileHeader:!0,enableLineSelection:B(),onLineSelected:$(),onLineClick:V(),onLineNumberClick:re(),onLineEnter:W(),onLineLeave:P(),enableHoverUtility:Q(),renderHoverUtility:de(),renderAnnotation:N(),disableHighlighting:C(me),theme:{dark:"github-dark",light:"github-light"},themeType:i()?"dark":"light",unsafeCSS:Xr(Ee())}}function Zi(){Y(ye,!C(ye)),U()?.(C(ye))}function Yr(){const u=rd(C(mt),{extraRoots:di()});u&&(Y(Ce,u,!0),Y(xe,0)),Y(Ne,!0),fn().then(()=>{C(It)?.focus(),C(It)?.select()})}function Qr(){vt(),Y(Ne,!1),Y(Ce,""),li(),Y(Re,[],!0),Y(xe,0)}function ai(){li(),Y(Re,[],!0),Y(xe,0)}function vt(){it!==null&&(clearTimeout(it),it=null)}function Jr(){it!==null&&(vt(),C(Ne)&&C(Ce).trim()&&hi(C(Ce)))}function Zr(u){if(vt(),Y(xe,0),!C(Ne)||!u.trim()){ai();return}it=setTimeout(()=>{it=null,C(Ne)&&C(Ce).trim()&&hi(C(Ce))},Kr)}async function Nt(){ri||(ri=!0,await fn(),ri=!1,it===null&&(C(Ne)&&C(Ce).trim()?hi(C(Ce)):C(Ne)&&ai()))}function li(){C(q)&&di().forEach(u=>{u.querySelectorAll(".diff-search-highlight").forEach(A=>{const z=A.parentNode;if(z){for(;A.firstChild;)z.insertBefore(A.firstChild,A);z.removeChild(A),z.normalize()}})})}function di(){if(!C(q))return[];const u=Array.from(C(q).querySelectorAll("diffs-container")).map(L=>L.shadowRoot).filter(L=>L!=null);return u.length>0?u:[C(q)]}function eo(u){const L=Array.from(u.querySelectorAll(jr)),A=[];for(const z of L)A.some(X=>X.contains(z))||A.push(z);return A}function hi(u){if(li(),Y(Re,[],!0),Y(xe,0),!u||!C(q))return;const L=[];di().forEach(A=>{eo(A).forEach(X=>{to(X,u)}),A.querySelectorAll(".diff-search-highlight").forEach(X=>{io(X)&&L.push({element:X,text:X.textContent||""})})}),Y(Re,L,!0),L.length>0&&bt(0)}function to(u,L){const A=document.createTreeWalker(u,NodeFilter.SHOW_TEXT,{acceptNode(ae){return ae.textContent?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),z=[],X=L.toLowerCase();let pe="",He;for(;He=A.nextNode();){const ae=He.textContent||"";z.push({node:He,start:pe.length,end:pe.length+ae.length}),pe+=ae}const We=pe.toLowerCase(),fe=[];let ie=0;for(;(ie=We.indexOf(X,ie))!==-1;)fe.push({start:ie,end:ie+L.length}),ie+=L.length;for(let ae=fe.length-1;ae>=0;ae--){const ze=en(z,fe[ae].start,!1),nt=en(z,fe[ae].end,!0);if(!ze||!nt)continue;const Ge=document.createRange();Ge.setStart(ze.node,ze.offset),Ge.setEnd(nt.node,nt.offset);const zt=document.createElement("span");zt.className="diff-search-highlight",zt.style.backgroundColor=Xi,zt.appendChild(Ge.extractContents()),Ge.insertNode(zt)}}function en(u,L,A){const z=A?[...u].reverse():u;for(const X of z)if(A?L>X.start&&L<=X.end:L>=X.start&&L<X.end)return{node:X.node,offset:L-X.start};return null}function io(u){return Array.from(u.getClientRects()).some(L=>L.width>0&&L.height>0)}function bt(u){if(Jr(),C(Re).length===0)return;C(Re).forEach(A=>{A.element.classList.remove("diff-search-current"),A.element.style.backgroundColor=Xi}),u<0&&(u=C(Re).length-1),u>=C(Re).length&&(u=0),Y(xe,u,!0);const L=C(Re)[u];L.element.classList.add("diff-search-current"),L.element.style.backgroundColor=qr,no(L.element)}function no(u){const L=ro(u);if(L.length===0){u.scrollIntoView?.({behavior:"smooth",block:"center",inline:"nearest"});return}L.forEach(A=>so(u,A))}function ro(u){const L=[];let A=tn(u);for(;A&&A!==document.body&&A!==document.documentElement;)oo(A)&&L.push(A),A=tn(A);return L}function tn(u){if(u.parentElement)return u.parentElement;const L=u.getRootNode();return L instanceof ShadowRoot&&L.host instanceof HTMLElement?L.host:null}function oo(u){const L=window.getComputedStyle(u),A=/(auto|scroll|overlay)/.test(L.overflowY)&&u.scrollHeight>u.clientHeight,z=/(auto|scroll|overlay)/.test(L.overflowX)&&u.scrollWidth>u.clientWidth;return A||z}function so(u,L){const A=u.getBoundingClientRect(),z=L.getBoundingClientRect(),X=A.top-z.top+L.scrollTop,pe=A.left-z.left+L.scrollLeft,He=Math.max(0,X-L.clientHeight/2+A.height/2);let We=L.scrollLeft;A.left<z.left+Mt?We=Math.max(0,pe-Mt):A.right>z.right-Mt&&(We=Math.max(0,pe-L.clientWidth+A.width+Mt)),typeof L.scrollTo=="function"?L.scrollTo({top:He,left:We,behavior:"smooth"}):(L.scrollTop=He,L.scrollLeft=We)}function ao(u){(u.key==="F3"||u.key==="g"&&(u.ctrlKey||u.metaKey))&&(u.preventDefault(),u.shiftKey?bt(C(xe)-1):bt(C(xe)+1))}je(()=>{const u=C(Ne),L=C(Ce);dt(()=>{u&&L?Zr(L):L||(vt(),ai())})});function fi(u){(u.metaKey||u.ctrlKey)&&u.key==="f"&&(u.preventDefault(),u.stopPropagation(),Yr())}function lo(u){return u.composedPath().filter(L=>L instanceof Element)}function nn(u,L){for(const A of u){const z=A.closest(L);if(z)return z}return null}function rn(u){if(u.defaultPrevented||u.button!==0)return;const L=lo(u);if(!C(q)||!L.includes(C(q))||nn(L,Gr))return;const A=nn(L,at);if(!A)return;const z=A.querySelector($r);z&&(u.preventDefault(),z.click())}xo(()=>(C(mt)?.addEventListener("keydown",fi),()=>{C(mt)?.removeEventListener("keydown",fi)})),je(()=>{const u=C(q);if(u)return u.addEventListener("click",rn),()=>{u.removeEventListener("click",rn)}});let ui=null,ci=null,on,Pt;function ho(u){const L=$o();try{const A=_()?new zl(u,_(),void 0,L):new Vr(u,L);return ee=!0,A}catch(A){throw bn(),A}}function sn(){const u=C(K);if(u){Y(K,void 0);try{u.cleanUp()}finally{ee&&(ee=!1,bn())}}}je(()=>{if(!C(q)||!C(Pe)||C(Pe)===ci&&C(q)===on&&_()===Pt&&C(K))return;const L=Ji();ui=an(),C(K)&&_()!==Pt&&sn(),C(K)?C(K).setOptions(L):(Y(K,ho(L),!0),Pt=_());const A=dt(()=>j());C(K).render({fileDiff:C(Pe).fileDiff,oldFile:C(Pe).oldFile,newFile:C(Pe).newFile,containerWrapper:C(q),lineAnnotations:A}),ci=C(Pe),on=C(q),Pt=_(),dt(()=>{Nt()})}),je(()=>{const u=j();!C(K)||!ci||dt(()=>{C(K).setLineAnnotations(u??[]),Nt()})});function an(){return[C(Ft),b(),S(),y(),typeof Z()=="function"?"custom":R(),k(),w(),E(),D(),B(),Q(),C(me),i(),Ee()??""].join("|")}je(()=>{if(C(Ft),b(),S(),y(),R(),k(),w(),E(),D(),B(),Q(),Z(),de(),N(),!C(K))return;const u=an(),L=Ji();C(K).setOptions(L),u!==ui&&(ui=u,C(K).rerender(),dt(()=>{Nt()}))}),je(()=>{C(K)&&B()&&(ce()&&ce().start&&ce().end?C(K).setSelectedLines(ce()):C(K).setSelectedLines(null))}),je(()=>{const u=i();C(K)&&(C(K).setThemeType(u?"dark":"light"),dt(()=>{Nt()}))}),Lo(()=>{vt(),sn()});var fo={get patch(){return l()},set patch(u){l(u),I()},get oldContent(){return a()},set oldContent(u){a(u),I()},get newContent(){return h()},set newContent(u){h(u),I()},get fileName(){return d()},set fileName(u="file"){d(u),I()},get oldFileName(){return f()},set oldFileName(u){f(u),I()},get language(){return p()},set language(u){p(u),I()},get viewMode(){return c()},set viewMode(u="unified"){c(u),I()},get showHeader(){return m()},set showHeader(u=!0){m(u),I()},get showStats(){return g()},set showStats(u=!0){g(u),I()},get showLineNumbers(){return S()},set showLineNumbers(u=!0){S(u),I()},get diffIndicators(){return b()},set diffIndicators(u="bars"){b(u),I()},get overflow(){return y()},set overflow(u="scroll"){y(u),I()},get maxHeight(){return x()},set maxHeight(u){x(u),I()},get hunkSeparators(){return R()},set hunkSeparators(u="line-info"){R(u),I()},get expandUnchanged(){return k()},set expandUnchanged(u=!1){k(u),I()},get expansionLineCount(){return w()},set expansionLineCount(u=20){w(u),I()},get lineDiffType(){return E()},set lineDiffType(u="word-alt"){E(u),I()},get maxLineDiffLength(){return D()},set maxLineDiffLength(u=500){D(u),I()},get collapsible(){return H()},set collapsible(u=!1){H(u),I()},get initialCollapsed(){return T()},set initialCollapsed(u=!1){T(u),I()},get previewLines(){return F()},set previewLines(u=5){F(u),I()},get annotations(){return j()},set annotations(u=[]){j(u),I()},get renderAnnotation(){return N()},set renderAnnotation(u){N(u),I()},get enableLineSelection(){return B()},set enableLineSelection(u=!1){B(u),I()},get selectedLines(){return ce()},set selectedLines(u=null){ce(u),I()},get onLineSelected(){return $()},set onLineSelected(u){$(u),I()},get onLineClick(){return V()},set onLineClick(u){V(u),I()},get onLineNumberClick(){return re()},set onLineNumberClick(u){re(u),I()},get onLineEnter(){return W()},set onLineEnter(u){W(u),I()},get onLineLeave(){return P()},set onLineLeave(u){P(u),I()},get onToggleCollapse(){return U()},set onToggleCollapse(u){U(u),I()},get actions(){return G()},set actions(u=[]){G(u),I()},get enableHoverUtility(){return Q()},set enableHoverUtility(u=!1){Q(u),I()},get renderHoverUtility(){return de()},set renderHoverUtility(u){de(u),I()},get renderHunkSeparator(){return Z()},set renderHunkSeparator(u){Z(u),I()},get class(){return he()},set class(u=""){he(u),I()},get style(){return ve()},set style(u=""){ve(u),I()},get unsafeCSS(){return Ee()},set unsafeCSS(u){Ee(u),I()},get oldCacheKey(){return be()},set oldCacheKey(u){be(u),I()},get newCacheKey(){return tt()},set newCacheKey(u){tt(u),I()},get maxHighlightLines(){return Ie()},set maxHighlightLines(u=5e3){Ie(u),I()},get disableHighlighting(){return Se()},set disableHighlighting(u=!1){Se(u),I()},get virtualizer(){return _()},set virtualizer(u){_(u),I()},$set:nr,$on:(u,L)=>rr(t,u,L)},Ae=fd(),ln=De(Ae);{var uo=u=>{{let L=ne(()=>g()?C(lt).additions:void 0),A=ne(()=>g()?C(lt).deletions:void 0);Wr(u,{get fileName(){return d()},get oldFileName(){return f()},get additions(){return C(L)},get deletions(){return C(A)},get collapsible(){return H()},get collapsed(){return C(ye)},get actions(){return G()},onToggle:Zi})}};we(ln,u=>{m()&&u(uo)})}var co=Xe(ln,2);{var po=u=>{var L=dd();let A;var z=De(L);{var X=fe=>{var ie=sd(),ae=De(ie);{let ze=ne(()=>$e.ui_diffViewer_find_placeholder()),nt=ne(()=>$e.ui_diffViewer_noResults_label());Jo(ae,{layout:"inline",get placeholder(){return C(ze)},get currentMatchIndex(){return C(xe)},get totalMatches(){return C(Re).length},get emptyResultText(){return C(nt)},onKeydown:ao,onPrevious:()=>bt(C(xe)-1),onNext:()=>bt(C(xe)+1),onClose:Qr,get query(){return C(Ce)},set query(Ge){Y(Ce,Ge,!0)},get inputRef(){return C(It)},set inputRef(Ge){Y(It,Ge,!0)}})}ke(ie),le(fe,ie)};we(z,fe=>{C(Ne)&&fe(X)})}var pe=Xe(z,2);{var He=fe=>{var ie=ad();let ae;pn(ie,ze=>Y(q,ze),()=>C(q)),Me(()=>ae=pi(ie,"",ae,{"--diffs-font-family":n()})),le(fe,ie)},We=fe=>{var ie=ld(),ae=De(ie),ze=Xt(ae,!0);ke(ie),Me(nt=>rt(ze,nt),[()=>$e.ui_diffViewer_empty_label()]),le(fe,ie)};we(pe,fe=>{C(Pe)?fe(He):fe(We,-1)})}ke(L),Me(()=>{A=un(L,1,"pure-diff-content svelte-htizai",null,A,{"overflow-auto":y()==="scroll"}),pi(L,x()?`max-height: calc(${x()} - 40px);`:"")}),le(u,L)},go=u=>{var L=hd(),A=De(L);Di(A,{variant:"ghost-light",size:"compact",class:"pure-diff-preview-button h-auto!",onclick:Zi,children:(z,X)=>{Hi();var pe=ar();Me(He=>rt(pe,He),[()=>$e.ui_diffViewer_expand_label({additions:C(lt).additions===1?$e.ui_diffViewer_additions_one():$e.ui_diffViewer_additions_many({count:Sn(C(lt).additions)}),deletions:C(lt).deletions===1?$e.ui_diffViewer_deletions_one():$e.ui_diffViewer_deletions_many({count:Sn(C(lt).deletions)})})]),le(z,pe)},$$slots:{default:!0}}),ke(L),le(u,L)};we(co,u=>{C(ye)?H()&&F()>0&&u(go,1):u(po)})}ke(Ae),pn(Ae,u=>Y(mt,u),()=>C(mt)),Me(()=>{un(Ae,1,`pure-diff ${he()??""}`,"svelte-htizai"),pi(Ae,`${x()?`max-height: ${x()};`:""} ${ve()??""}`),cn(Ae,"data-view-mode",C(Ft)),cn(Ae,"data-collapsed",C(ye))}),wo("keydown",Ae,fi),Ro(Ae,"clientWidth",u=>Y(Yi,u)),le(e,Ae);var mo=sr(fo);return o(),mo}yo(["keydown"]);export{ud as D,Ed as c,Ii as d,rd as g,Ri as h,Cr as q};
|
|
304
|
+
`;let Qi,si=oi;function Xr(u){return u===Qi||(Qi=u,si=u?`${oi}${u}`:oi),si}function Ji(){return{diffStyle:C(Ft),diffIndicators:b(),disableLineNumbers:!S(),overflow:y(),hunkSeparators:Z()?(u,L)=>Z()(u,A=>L.expandHunk(u.hunkIndex,A)):R(),expandUnchanged:k(),expansionLineCount:w(),lineDiffType:E(),maxLineDiffLength:D(),disableFileHeader:!0,enableLineSelection:B(),onLineSelected:$(),onLineClick:V(),onLineNumberClick:re(),onLineEnter:W(),onLineLeave:P(),enableHoverUtility:Q(),renderHoverUtility:de(),renderAnnotation:N(),disableHighlighting:C(me),theme:{dark:"github-dark",light:"github-light"},themeType:i()?"dark":"light",unsafeCSS:Xr(Ee())}}function Zi(){Y(ye,!C(ye)),U()?.(C(ye))}function Yr(){const u=rd(C(mt),{extraRoots:di()});u&&(Y(Ce,u,!0),Y(xe,0)),Y(Ne,!0),fn().then(()=>{C(It)?.focus(),C(It)?.select()})}function Qr(){vt(),Y(Ne,!1),Y(Ce,""),li(),Y(Re,[],!0),Y(xe,0)}function ai(){li(),Y(Re,[],!0),Y(xe,0)}function vt(){it!==null&&(clearTimeout(it),it=null)}function Jr(){it!==null&&(vt(),C(Ne)&&C(Ce).trim()&&hi(C(Ce)))}function Zr(u){if(vt(),Y(xe,0),!C(Ne)||!u.trim()){ai();return}it=setTimeout(()=>{it=null,C(Ne)&&C(Ce).trim()&&hi(C(Ce))},Kr)}async function Nt(){ri||(ri=!0,await fn(),ri=!1,it===null&&(C(Ne)&&C(Ce).trim()?hi(C(Ce)):C(Ne)&&ai()))}function li(){C(q)&&di().forEach(u=>{u.querySelectorAll(".diff-search-highlight").forEach(A=>{const z=A.parentNode;if(z){for(;A.firstChild;)z.insertBefore(A.firstChild,A);z.removeChild(A),z.normalize()}})})}function di(){if(!C(q))return[];const u=Array.from(C(q).querySelectorAll("diffs-container")).map(L=>L.shadowRoot).filter(L=>L!=null);return u.length>0?u:[C(q)]}function eo(u){const L=Array.from(u.querySelectorAll(jr)),A=[];for(const z of L)A.some(X=>X.contains(z))||A.push(z);return A}function hi(u){if(li(),Y(Re,[],!0),Y(xe,0),!u||!C(q))return;const L=[];di().forEach(A=>{eo(A).forEach(X=>{to(X,u)}),A.querySelectorAll(".diff-search-highlight").forEach(X=>{io(X)&&L.push({element:X,text:X.textContent||""})})}),Y(Re,L,!0),L.length>0&&bt(0)}function to(u,L){const A=document.createTreeWalker(u,NodeFilter.SHOW_TEXT,{acceptNode(ae){return ae.textContent?NodeFilter.FILTER_ACCEPT:NodeFilter.FILTER_REJECT}}),z=[],X=L.toLowerCase();let pe="",He;for(;He=A.nextNode();){const ae=He.textContent||"";z.push({node:He,start:pe.length,end:pe.length+ae.length}),pe+=ae}const We=pe.toLowerCase(),fe=[];let ie=0;for(;(ie=We.indexOf(X,ie))!==-1;)fe.push({start:ie,end:ie+L.length}),ie+=L.length;for(let ae=fe.length-1;ae>=0;ae--){const ze=en(z,fe[ae].start,!1),nt=en(z,fe[ae].end,!0);if(!ze||!nt)continue;const Ge=document.createRange();Ge.setStart(ze.node,ze.offset),Ge.setEnd(nt.node,nt.offset);const zt=document.createElement("span");zt.className="diff-search-highlight",zt.style.backgroundColor=Xi,zt.appendChild(Ge.extractContents()),Ge.insertNode(zt)}}function en(u,L,A){const z=A?[...u].reverse():u;for(const X of z)if(A?L>X.start&&L<=X.end:L>=X.start&&L<X.end)return{node:X.node,offset:L-X.start};return null}function io(u){return Array.from(u.getClientRects()).some(L=>L.width>0&&L.height>0)}function bt(u){if(Jr(),C(Re).length===0)return;C(Re).forEach(A=>{A.element.classList.remove("diff-search-current"),A.element.style.backgroundColor=Xi}),u<0&&(u=C(Re).length-1),u>=C(Re).length&&(u=0),Y(xe,u,!0);const L=C(Re)[u];L.element.classList.add("diff-search-current"),L.element.style.backgroundColor=qr,no(L.element)}function no(u){const L=ro(u);if(L.length===0){u.scrollIntoView?.({behavior:"smooth",block:"center",inline:"nearest"});return}L.forEach(A=>so(u,A))}function ro(u){const L=[];let A=tn(u);for(;A&&A!==document.body&&A!==document.documentElement;)oo(A)&&L.push(A),A=tn(A);return L}function tn(u){if(u.parentElement)return u.parentElement;const L=u.getRootNode();return L instanceof ShadowRoot&&L.host instanceof HTMLElement?L.host:null}function oo(u){const L=window.getComputedStyle(u),A=/(auto|scroll|overlay)/.test(L.overflowY)&&u.scrollHeight>u.clientHeight,z=/(auto|scroll|overlay)/.test(L.overflowX)&&u.scrollWidth>u.clientWidth;return A||z}function so(u,L){const A=u.getBoundingClientRect(),z=L.getBoundingClientRect(),X=A.top-z.top+L.scrollTop,pe=A.left-z.left+L.scrollLeft,He=Math.max(0,X-L.clientHeight/2+A.height/2);let We=L.scrollLeft;A.left<z.left+Mt?We=Math.max(0,pe-Mt):A.right>z.right-Mt&&(We=Math.max(0,pe-L.clientWidth+A.width+Mt)),typeof L.scrollTo=="function"?L.scrollTo({top:He,left:We,behavior:"smooth"}):(L.scrollTop=He,L.scrollLeft=We)}function ao(u){(u.key==="F3"||u.key==="g"&&(u.ctrlKey||u.metaKey))&&(u.preventDefault(),u.shiftKey?bt(C(xe)-1):bt(C(xe)+1))}je(()=>{const u=C(Ne),L=C(Ce);dt(()=>{u&&L?Zr(L):L||(vt(),ai())})});function fi(u){(u.metaKey||u.ctrlKey)&&u.key==="f"&&(u.preventDefault(),u.stopPropagation(),Yr())}function lo(u){return u.composedPath().filter(L=>L instanceof Element)}function nn(u,L){for(const A of u){const z=A.closest(L);if(z)return z}return null}function rn(u){if(u.defaultPrevented||u.button!==0)return;const L=lo(u);if(!C(q)||!L.includes(C(q))||nn(L,Gr))return;const A=nn(L,at);if(!A)return;const z=A.querySelector($r);z&&(u.preventDefault(),z.click())}xo(()=>(C(mt)?.addEventListener("keydown",fi),()=>{C(mt)?.removeEventListener("keydown",fi)})),je(()=>{const u=C(q);if(u)return u.addEventListener("click",rn),()=>{u.removeEventListener("click",rn)}});let ui=null,ci=null,on,Pt;function ho(u){const L=Wo();try{const A=_()?new zl(u,_(),void 0,L):new Vr(u,L);return ee=!0,A}catch(A){throw bn(),A}}function sn(){const u=C(K);if(u){Y(K,void 0);try{u.cleanUp()}finally{ee&&(ee=!1,bn())}}}je(()=>{if(!C(q)||!C(Pe)||C(Pe)===ci&&C(q)===on&&_()===Pt&&C(K))return;const L=Ji();ui=an(),C(K)&&_()!==Pt&&sn(),C(K)?C(K).setOptions(L):(Y(K,ho(L),!0),Pt=_());const A=dt(()=>j());C(K).render({fileDiff:C(Pe).fileDiff,oldFile:C(Pe).oldFile,newFile:C(Pe).newFile,containerWrapper:C(q),lineAnnotations:A}),ci=C(Pe),on=C(q),Pt=_(),dt(()=>{Nt()})}),je(()=>{const u=j();!C(K)||!ci||dt(()=>{C(K).setLineAnnotations(u??[]),Nt()})});function an(){return[C(Ft),b(),S(),y(),typeof Z()=="function"?"custom":R(),k(),w(),E(),D(),B(),Q(),C(me),i(),Ee()??""].join("|")}je(()=>{if(C(Ft),b(),S(),y(),R(),k(),w(),E(),D(),B(),Q(),Z(),de(),N(),!C(K))return;const u=an(),L=Ji();C(K).setOptions(L),u!==ui&&(ui=u,C(K).rerender(),dt(()=>{Nt()}))}),je(()=>{C(K)&&B()&&(ce()&&ce().start&&ce().end?C(K).setSelectedLines(ce()):C(K).setSelectedLines(null))}),je(()=>{const u=i();C(K)&&(C(K).setThemeType(u?"dark":"light"),dt(()=>{Nt()}))}),Lo(()=>{vt(),sn()});var fo={get patch(){return l()},set patch(u){l(u),I()},get oldContent(){return a()},set oldContent(u){a(u),I()},get newContent(){return h()},set newContent(u){h(u),I()},get fileName(){return d()},set fileName(u="file"){d(u),I()},get oldFileName(){return f()},set oldFileName(u){f(u),I()},get language(){return p()},set language(u){p(u),I()},get viewMode(){return c()},set viewMode(u="unified"){c(u),I()},get showHeader(){return m()},set showHeader(u=!0){m(u),I()},get showStats(){return g()},set showStats(u=!0){g(u),I()},get showLineNumbers(){return S()},set showLineNumbers(u=!0){S(u),I()},get diffIndicators(){return b()},set diffIndicators(u="bars"){b(u),I()},get overflow(){return y()},set overflow(u="scroll"){y(u),I()},get maxHeight(){return x()},set maxHeight(u){x(u),I()},get hunkSeparators(){return R()},set hunkSeparators(u="line-info"){R(u),I()},get expandUnchanged(){return k()},set expandUnchanged(u=!1){k(u),I()},get expansionLineCount(){return w()},set expansionLineCount(u=20){w(u),I()},get lineDiffType(){return E()},set lineDiffType(u="word-alt"){E(u),I()},get maxLineDiffLength(){return D()},set maxLineDiffLength(u=500){D(u),I()},get collapsible(){return H()},set collapsible(u=!1){H(u),I()},get initialCollapsed(){return T()},set initialCollapsed(u=!1){T(u),I()},get previewLines(){return F()},set previewLines(u=5){F(u),I()},get annotations(){return j()},set annotations(u=[]){j(u),I()},get renderAnnotation(){return N()},set renderAnnotation(u){N(u),I()},get enableLineSelection(){return B()},set enableLineSelection(u=!1){B(u),I()},get selectedLines(){return ce()},set selectedLines(u=null){ce(u),I()},get onLineSelected(){return $()},set onLineSelected(u){$(u),I()},get onLineClick(){return V()},set onLineClick(u){V(u),I()},get onLineNumberClick(){return re()},set onLineNumberClick(u){re(u),I()},get onLineEnter(){return W()},set onLineEnter(u){W(u),I()},get onLineLeave(){return P()},set onLineLeave(u){P(u),I()},get onToggleCollapse(){return U()},set onToggleCollapse(u){U(u),I()},get actions(){return G()},set actions(u=[]){G(u),I()},get enableHoverUtility(){return Q()},set enableHoverUtility(u=!1){Q(u),I()},get renderHoverUtility(){return de()},set renderHoverUtility(u){de(u),I()},get renderHunkSeparator(){return Z()},set renderHunkSeparator(u){Z(u),I()},get class(){return he()},set class(u=""){he(u),I()},get style(){return ve()},set style(u=""){ve(u),I()},get unsafeCSS(){return Ee()},set unsafeCSS(u){Ee(u),I()},get oldCacheKey(){return be()},set oldCacheKey(u){be(u),I()},get newCacheKey(){return tt()},set newCacheKey(u){tt(u),I()},get maxHighlightLines(){return Ie()},set maxHighlightLines(u=5e3){Ie(u),I()},get disableHighlighting(){return Se()},set disableHighlighting(u=!1){Se(u),I()},get virtualizer(){return _()},set virtualizer(u){_(u),I()},$set:nr,$on:(u,L)=>rr(t,u,L)},Ae=fd(),ln=De(Ae);{var uo=u=>{{let L=ne(()=>g()?C(lt).additions:void 0),A=ne(()=>g()?C(lt).deletions:void 0);Wr(u,{get fileName(){return d()},get oldFileName(){return f()},get additions(){return C(L)},get deletions(){return C(A)},get collapsible(){return H()},get collapsed(){return C(ye)},get actions(){return G()},onToggle:Zi})}};we(ln,u=>{m()&&u(uo)})}var co=Xe(ln,2);{var po=u=>{var L=dd();let A;var z=De(L);{var X=fe=>{var ie=sd(),ae=De(ie);{let ze=ne(()=>$e.ui_diffViewer_find_placeholder()),nt=ne(()=>$e.ui_diffViewer_noResults_label());Jo(ae,{layout:"inline",get placeholder(){return C(ze)},get currentMatchIndex(){return C(xe)},get totalMatches(){return C(Re).length},get emptyResultText(){return C(nt)},onKeydown:ao,onPrevious:()=>bt(C(xe)-1),onNext:()=>bt(C(xe)+1),onClose:Qr,get query(){return C(Ce)},set query(Ge){Y(Ce,Ge,!0)},get inputRef(){return C(It)},set inputRef(Ge){Y(It,Ge,!0)}})}ke(ie),le(fe,ie)};we(z,fe=>{C(Ne)&&fe(X)})}var pe=Xe(z,2);{var He=fe=>{var ie=ad();let ae;pn(ie,ze=>Y(q,ze),()=>C(q)),Me(()=>ae=pi(ie,"",ae,{"--diffs-font-family":n()})),le(fe,ie)},We=fe=>{var ie=ld(),ae=De(ie),ze=Xt(ae,!0);ke(ie),Me(nt=>rt(ze,nt),[()=>$e.ui_diffViewer_empty_label()]),le(fe,ie)};we(pe,fe=>{C(Pe)?fe(He):fe(We,-1)})}ke(L),Me(()=>{A=un(L,1,"pure-diff-content svelte-htizai",null,A,{"overflow-auto":y()==="scroll"}),pi(L,x()?`max-height: calc(${x()} - 40px);`:"")}),le(u,L)},go=u=>{var L=hd(),A=De(L);Di(A,{variant:"ghost-light",size:"compact",class:"pure-diff-preview-button h-auto!",onclick:Zi,children:(z,X)=>{Hi();var pe=ar();Me(He=>rt(pe,He),[()=>$e.ui_diffViewer_expand_label({additions:C(lt).additions===1?$e.ui_diffViewer_additions_one():$e.ui_diffViewer_additions_many({count:Sn(C(lt).additions)}),deletions:C(lt).deletions===1?$e.ui_diffViewer_deletions_one():$e.ui_diffViewer_deletions_many({count:Sn(C(lt).deletions)})})]),le(z,pe)},$$slots:{default:!0}}),ke(L),le(u,L)};we(co,u=>{C(ye)?H()&&F()>0&&u(go,1):u(po)})}ke(Ae),pn(Ae,u=>Y(mt,u),()=>C(mt)),Me(()=>{un(Ae,1,`pure-diff ${he()??""}`,"svelte-htizai"),pi(Ae,`${x()?`max-height: ${x()};`:""} ${ve()??""}`),cn(Ae,"data-view-mode",C(Ft)),cn(Ae,"data-collapsed",C(ye))}),wo("keydown",Ae,fi),ko(Ae,"clientWidth",u=>Y(Yi,u)),le(e,Ae);var mo=sr(fo);return o(),mo}yo(["keydown"]);export{ud as D,Hd as c,Ii as d,rd as g,Ri as h,Cr as q};
|