@dylanpiercey/work 0.0.20 → 0.0.21
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/dist/index.mjs +137 -153
- package/dist/public/assets/{_DRazGDj4.js → _-3M9WuU4.js} +2 -2
- package/dist/public/assets/{_DRazGDj4.js.map → _-3M9WuU4.js.map} +1 -1
- package/dist/public/assets/{_CekmLjtJ2.js → _3ZKZeEN32.js} +2 -2
- package/dist/public/assets/{_CekmLjtJ2.js.map → _3ZKZeEN32.js.map} +1 -1
- package/dist/public/assets/{_DNygB11b.js → _753RhcUs.js} +2 -2
- package/dist/public/assets/{_DNygB11b.js.map → _753RhcUs.js.map} +1 -1
- package/dist/public/assets/{_D6GBnH1C.js → _B1Ress7e.js} +2 -2
- package/dist/public/assets/{_D6GBnH1C.js.map → _B1Ress7e.js.map} +1 -1
- package/dist/public/assets/{_BZzhWd3g.js → _B49wgrKW.js} +2 -2
- package/dist/public/assets/{_BZzhWd3g.js.map → _B49wgrKW.js.map} +1 -1
- package/dist/public/assets/{_g8IPJgde.js → _B7ZTox7L.js} +2 -2
- package/dist/public/assets/{_g8IPJgde.js.map → _B7ZTox7L.js.map} +1 -1
- package/dist/public/assets/{_1vY8pby1.js → _BBCthCRB.js} +2 -2
- package/dist/public/assets/{_1vY8pby1.js.map → _BBCthCRB.js.map} +1 -1
- package/dist/public/assets/{_T_Eme7qq.js → _BFnmKuGb.js} +2 -2
- package/dist/public/assets/{_T_Eme7qq.js.map → _BFnmKuGb.js.map} +1 -1
- package/dist/public/assets/{_wSQWJJZf2.js → _BG21uqHk2.js} +2 -2
- package/dist/public/assets/{_wSQWJJZf2.js.map → _BG21uqHk2.js.map} +1 -1
- package/dist/public/assets/{_Dge-k2OK.js → _BGO4yXnZ.js} +2 -2
- package/dist/public/assets/{_Dge-k2OK.js.map → _BGO4yXnZ.js.map} +1 -1
- package/dist/public/assets/{_DDQcSiNZ.js → _BRfYhRDN.js} +2 -2
- package/dist/public/assets/{_DDQcSiNZ.js.map → _BRfYhRDN.js.map} +1 -1
- package/dist/public/assets/{_C6_Bkr9e.js → _BVimx11r.js} +2 -2
- package/dist/public/assets/{_C6_Bkr9e.js.map → _BVimx11r.js.map} +1 -1
- package/dist/public/assets/{_DGb5RYdw2.js → _BWIzVLMa2.js} +2 -2
- package/dist/public/assets/{_DGb5RYdw2.js.map → _BWIzVLMa2.js.map} +1 -1
- package/dist/public/assets/{_CcQeIXwg.js → _BchSFDSU.js} +2 -2
- package/dist/public/assets/{_CcQeIXwg.js.map → _BchSFDSU.js.map} +1 -1
- package/dist/public/assets/{_BTQOUkJH2.js → _BeCpXzaO2.js} +2 -2
- package/dist/public/assets/{_BTQOUkJH2.js.map → _BeCpXzaO2.js.map} +1 -1
- package/dist/public/assets/{_c4JkcQT9.js → _BfCF5T_K.js} +2 -2
- package/dist/public/assets/{_c4JkcQT9.js.map → _BfCF5T_K.js.map} +1 -1
- package/dist/public/assets/{_CONbe6YE.js → _Bo2t_uNU.js} +2 -2
- package/dist/public/assets/{_CONbe6YE.js.map → _Bo2t_uNU.js.map} +1 -1
- package/dist/public/assets/{_CSdPg73e.js → _BooCIZFD.js} +2 -2
- package/dist/public/assets/{_CSdPg73e.js.map → _BooCIZFD.js.map} +1 -1
- package/dist/public/assets/{_VrKcP-IA.js → _BpB-O0HN.js} +2 -2
- package/dist/public/assets/{_VrKcP-IA.js.map → _BpB-O0HN.js.map} +1 -1
- package/dist/public/assets/{_Bg0vcVNm.js → _BpIotmis.js} +2 -2
- package/dist/public/assets/{_Bg0vcVNm.js.map → _BpIotmis.js.map} +1 -1
- package/dist/public/assets/{_CY51jVa3.js → _BpxV-2f3.js} +2 -2
- package/dist/public/assets/{_CY51jVa3.js.map → _BpxV-2f3.js.map} +1 -1
- package/dist/public/assets/{_DHU3s4L8.js → _Bv61tUGo.js} +2 -2
- package/dist/public/assets/{_DHU3s4L8.js.map → _Bv61tUGo.js.map} +1 -1
- package/dist/public/assets/{_Dia6fhph2.js → _BwnkAzDN2.js} +2 -2
- package/dist/public/assets/{_Dia6fhph2.js.map → _BwnkAzDN2.js.map} +1 -1
- package/dist/public/assets/{_CSCYugS_.js → _ByaF5Ym8.js} +2 -2
- package/dist/public/assets/{_CSCYugS_.js.map → _ByaF5Ym8.js.map} +1 -1
- package/dist/public/assets/{_DUKDYAof.js → _C3OrD7LT.js} +2 -2
- package/dist/public/assets/{_DUKDYAof.js.map → _C3OrD7LT.js.map} +1 -1
- package/dist/public/assets/{_BpQoL5sK.js → _C480-4NE.js} +2 -2
- package/dist/public/assets/{_BpQoL5sK.js.map → _C480-4NE.js.map} +1 -1
- package/dist/public/assets/{_DPQpBMwo.js → _C4JQ0avI.js} +2 -2
- package/dist/public/assets/{_DPQpBMwo.js.map → _C4JQ0avI.js.map} +1 -1
- package/dist/public/assets/{_D4YgBy102.js → _C5tw5jaH2.js} +2 -2
- package/dist/public/assets/{_D4YgBy102.js.map → _C5tw5jaH2.js.map} +1 -1
- package/dist/public/assets/{_Dh0ojLY7.js → _CFwjuNga.js} +2 -2
- package/dist/public/assets/{_Dh0ojLY7.js.map → _CFwjuNga.js.map} +1 -1
- package/dist/public/assets/{_DQm9_WBm2.js → _CG65evuJ2.js} +2 -2
- package/dist/public/assets/{_DQm9_WBm2.js.map → _CG65evuJ2.js.map} +1 -1
- package/dist/public/assets/{_8HSgn8Ae2.js → _COiINYul2.js} +2 -2
- package/dist/public/assets/{_8HSgn8Ae2.js.map → _COiINYul2.js.map} +1 -1
- package/dist/public/assets/{_9e0FE9jl.js → _CRMMWY-q.js} +2 -2
- package/dist/public/assets/{_9e0FE9jl.js.map → _CRMMWY-q.js.map} +1 -1
- package/dist/public/assets/{_CTmSJ3aE2.js → _CXLqhKMK2.js} +2 -2
- package/dist/public/assets/{_CTmSJ3aE2.js.map → _CXLqhKMK2.js.map} +1 -1
- package/dist/public/assets/{_C96rg9Cn.js → _CZtA_-Ie.js} +2 -2
- package/dist/public/assets/{_C96rg9Cn.js.map → _CZtA_-Ie.js.map} +1 -1
- package/dist/public/assets/{_aiX4inqS2.js → _Cbg9-SI_2.js} +2 -2
- package/dist/public/assets/{_aiX4inqS2.js.map → _Cbg9-SI_2.js.map} +1 -1
- package/dist/public/assets/{_DyzfV4EQ.js → _CeybDOH3.js} +2 -2
- package/dist/public/assets/{_DyzfV4EQ.js.map → _CeybDOH3.js.map} +1 -1
- package/dist/public/assets/{_sq9fDeBh.js → _CgX5-PN8.js} +2 -2
- package/dist/public/assets/{_sq9fDeBh.js.map → _CgX5-PN8.js.map} +1 -1
- package/dist/public/assets/{_D1QJFY1d.js → _ChXwBYfg.js} +2 -2
- package/dist/public/assets/{_D1QJFY1d.js.map → _ChXwBYfg.js.map} +1 -1
- package/dist/public/assets/{_CsU7IfeP.js → _CjAjLYnS.js} +2 -2
- package/dist/public/assets/{_CsU7IfeP.js.map → _CjAjLYnS.js.map} +1 -1
- package/dist/public/assets/{_C0Aq200h.js → _CjNZdOEs.js} +2 -2
- package/dist/public/assets/{_C0Aq200h.js.map → _CjNZdOEs.js.map} +1 -1
- package/dist/public/assets/{_Bc6gDxIN.js → _CkT411UL.js} +2 -2
- package/dist/public/assets/{_Bc6gDxIN.js.map → _CkT411UL.js.map} +1 -1
- package/dist/public/assets/{_BdrBTnQV2.js → _Cm-mKxlV2.js} +2 -2
- package/dist/public/assets/{_BdrBTnQV2.js.map → _Cm-mKxlV2.js.map} +1 -1
- package/dist/public/assets/{_BC-q6DS6.js → _Cww6wLe3.js} +2 -2
- package/dist/public/assets/{_BC-q6DS6.js.map → _Cww6wLe3.js.map} +1 -1
- package/dist/public/assets/{_BoyRXB0-2.js → _D0-uwMfH2.js} +2 -2
- package/dist/public/assets/{_BoyRXB0-2.js.map → _D0-uwMfH2.js.map} +1 -1
- package/dist/public/assets/{_U_zJ788O.js → _D32jCBoK.js} +2 -2
- package/dist/public/assets/{_U_zJ788O.js.map → _D32jCBoK.js.map} +1 -1
- package/dist/public/assets/{_Dc3dYVuw2.js → _D8RqMrGW2.js} +2 -2
- package/dist/public/assets/{_Dc3dYVuw2.js.map → _D8RqMrGW2.js.map} +1 -1
- package/dist/public/assets/{_CBgFzcoa.js → _DDpdWlxA.js} +2 -2
- package/dist/public/assets/{_CBgFzcoa.js.map → _DDpdWlxA.js.map} +1 -1
- package/dist/public/assets/{_Bexv6Y9B.js → _DGZCHdAh.js} +2 -2
- package/dist/public/assets/{_Bexv6Y9B.js.map → _DGZCHdAh.js.map} +1 -1
- package/dist/public/assets/{_D5E_RD5H2.js → _DInIL5iq2.js} +2 -2
- package/dist/public/assets/{_D5E_RD5H2.js.map → _DInIL5iq2.js.map} +1 -1
- package/dist/public/assets/{_Dgh3CpAc.js → _DK5es8xg.js} +2 -2
- package/dist/public/assets/{_Dgh3CpAc.js.map → _DK5es8xg.js.map} +1 -1
- package/dist/public/assets/{_WdzvtYc4.js → _DLg1-IRM.js} +2 -2
- package/dist/public/assets/{_WdzvtYc4.js.map → _DLg1-IRM.js.map} +1 -1
- package/dist/public/assets/{_D6mf7azh2.js → _DT71qSJE2.js} +2 -2
- package/dist/public/assets/{_D6mf7azh2.js.map → _DT71qSJE2.js.map} +1 -1
- package/dist/public/assets/{_B-3tfKTw2.js → _DVIw_RgW2.js} +2 -2
- package/dist/public/assets/{_B-3tfKTw2.js.map → _DVIw_RgW2.js.map} +1 -1
- package/dist/public/assets/{_DxQA8DF72.js → _D_8pG7bS2.js} +2 -2
- package/dist/public/assets/{_DxQA8DF72.js.map → _D_8pG7bS2.js.map} +1 -1
- package/dist/public/assets/{_Cqdz3hZN2.js → _DkpMMWAt2.js} +2 -2
- package/dist/public/assets/{_Cqdz3hZN2.js.map → _DkpMMWAt2.js.map} +1 -1
- package/dist/public/assets/{_C9vwBOMi2.js → _DncMx76o2.js} +2 -2
- package/dist/public/assets/{_C9vwBOMi2.js.map → _DncMx76o2.js.map} +1 -1
- package/dist/public/assets/{_CzS0SrVK2.js → _Do3Q5gXZ2.js} +2 -2
- package/dist/public/assets/{_CzS0SrVK2.js.map → _Do3Q5gXZ2.js.map} +1 -1
- package/dist/public/assets/{_CwXWcR4L.js → _DpLjBHyL.js} +2 -2
- package/dist/public/assets/{_CwXWcR4L.js.map → _DpLjBHyL.js.map} +1 -1
- package/dist/public/assets/{_CtMaZFiS.js → _DqqLoHco.js} +2 -2
- package/dist/public/assets/{_CtMaZFiS.js.map → _DqqLoHco.js.map} +1 -1
- package/dist/public/assets/{_cy1N2YQO.js → _DtmS6252.js} +2 -2
- package/dist/public/assets/{_cy1N2YQO.js.map → _DtmS6252.js.map} +1 -1
- package/dist/public/assets/{_CvQo4_H-2.js → _E5dbeZEm2.js} +2 -2
- package/dist/public/assets/{_CvQo4_H-2.js.map → _E5dbeZEm2.js.map} +1 -1
- package/dist/public/assets/{_CWiaS9tN.js → _H-G61tx0.js} +2 -2
- package/dist/public/assets/{_CWiaS9tN.js.map → _H-G61tx0.js.map} +1 -1
- package/dist/public/assets/{_ephmTnv12.js → _JmyDHQ3S2.js} +2 -2
- package/dist/public/assets/{_ephmTnv12.js.map → _JmyDHQ3S2.js.map} +1 -1
- package/dist/public/assets/{_BhcFcxh_.js → _O3QIPxoe.js} +2 -2
- package/dist/public/assets/{_BhcFcxh_.js.map → _O3QIPxoe.js.map} +1 -1
- package/dist/public/assets/{_CVYrmNa5.js → _RgPZr-u4.js} +2 -2
- package/dist/public/assets/{_CVYrmNa5.js.map → _RgPZr-u4.js.map} +1 -1
- package/dist/public/assets/{_n3dr6s1l.js → _ZSGrflxk.js} +2 -2
- package/dist/public/assets/{_n3dr6s1l.js.map → _ZSGrflxk.js.map} +1 -1
- package/dist/public/assets/{_GnVvdLnS.js → _aXYWp2ZC.js} +2 -2
- package/dist/public/assets/{_GnVvdLnS.js.map → _aXYWp2ZC.js.map} +1 -1
- package/dist/public/assets/{_BiAQN2ar.js → _anllqmOe.js} +2 -2
- package/dist/public/assets/{_BiAQN2ar.js.map → _anllqmOe.js.map} +1 -1
- package/dist/public/assets/{_BMXWQXeX.js → _cZMSm0LN.js} +2 -2
- package/dist/public/assets/{_BMXWQXeX.js.map → _cZMSm0LN.js.map} +1 -1
- package/dist/public/assets/{_BTrOYuEk2.js → _dkeDDehz2.js} +2 -2
- package/dist/public/assets/{_BTrOYuEk2.js.map → _dkeDDehz2.js.map} +1 -1
- package/dist/public/assets/{_BrtaMKSf.js → _g7Q1ADd0.js} +2 -2
- package/dist/public/assets/{_BrtaMKSf.js.map → _g7Q1ADd0.js.map} +1 -1
- package/dist/public/assets/{_CexcTijs.js → _m1KNq0Gx.js} +2 -2
- package/dist/public/assets/{_CexcTijs.js.map → _m1KNq0Gx.js.map} +1 -1
- package/dist/public/assets/{_hecKvkGK.js → _q9TSOuKE.js} +2 -2
- package/dist/public/assets/{_hecKvkGK.js.map → _q9TSOuKE.js.map} +1 -1
- package/dist/public/assets/{_C_N5lXIT2.js → _xuVEda462.js} +2 -2
- package/dist/public/assets/{_C_N5lXIT2.js.map → _xuVEda462.js.map} +1 -1
- package/dist/public/assets/{index-CxxdFG3E.css → index-BxVK_c-q.css} +1 -1
- package/dist/public/assets/{index-CxXU95sL.js → index-DJu3fA99.js} +43 -43
- package/dist/public/assets/index-DJu3fA99.js.map +1 -0
- package/package.json +1 -1
- package/dist/public/assets/index-CxXU95sL.js.map +0 -1
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/_DqqLoHco.js","assets/_BGO4yXnZ.js","assets/_B7ZTox7L.js","assets/_C480-4NE.js","assets/_aXYWp2ZC.js","assets/_Cww6wLe3.js","assets/_C4JQ0avI.js","assets/_753RhcUs.js","assets/_CgX5-PN8.js","assets/_cZMSm0LN.js","assets/_BchSFDSU.js","assets/_CjAjLYnS.js","assets/_BXeXVLqQ.js","assets/_DGZCHdAh.js","assets/_BwnkAzDN2.js","assets/_C5tw5jaH2.js","assets/_Cm-mKxlV2.js","assets/_CpYNKFv52.js","assets/_bTVj8UrX2.js","assets/_kIpfj7zU2.js","assets/_gzcpVVnB2.js","assets/_Do3Q5gXZ2.js","assets/_DInIL5iq2.js","assets/_CG65evuJ2.js","assets/_COiINYul2.js","assets/_BpIotmis.js","assets/_DLg1-IRM.js","assets/_ChXwBYfg.js","assets/_BRfYhRDN.js","assets/_CjNZdOEs.js","assets/_Bo2t_uNU.js","assets/_CRMMWY-q.js","assets/_B1Ress7e.js","assets/_DtmS6252.js","assets/_BVimx11r.js","assets/_CeybDOH3.js","assets/_CZtA_-Ie.js","assets/_CFwjuNga.js","assets/_BFnmKuGb.js","assets/_RgPZr-u4.js","assets/_BaHq4SXp.js","assets/_BYOwaDjH.js","assets/_CQJs3lWb.js","assets/_CYNrtFtB.js","assets/_DmIc4jLQ.js","assets/_CY8IvGdO2.js","assets/_CBce3t8t2.js","assets/_DYvRD3hg2.js","assets/_Dl-2e7rI2.js","assets/_woXpYk--.js","assets/_JmyDHQ3S2.js","assets/_CXLqhKMK2.js","assets/_xuVEda462.js","assets/_DncMx76o2.js","assets/_D0-uwMfH2.js","assets/_E5dbeZEm2.js","assets/_DT71qSJE2.js","assets/_Dx-8-gkx.js","assets/_DLbMbJfH2.js","assets/_C8oCnwJJ2.js","assets/_g7Q1ADd0.js","assets/_Bv61tUGo.js","assets/_DpLjBHyL.js","assets/_C3OrD7LT.js","assets/_BBCthCRB.js","assets/_BpxV-2f3.js","assets/_D32jCBoK.js","assets/_q9TSOuKE.js","assets/_ZSGrflxk.js","assets/_anllqmOe.js","assets/_DVTAwKKz.js","assets/_m1KNq0Gx.js","assets/_DWQbgPoS.js","assets/_DJMQeKeT.js","assets/_-3M9WuU4.js","assets/_Cbg9-SI_2.js","assets/_BG21uqHk2.js","assets/_DqKBuwfJ2.js","assets/_oqKa8noW.js","assets/_CnvKMtbv.js","assets/_IyjqRm3v.js","assets/_rLFTqkRN2.js","assets/_CacY0gHj2.js","assets/_B5eOa1yu.js","assets/_Dixweg8N.js","assets/_D1A_Heim2.js","assets/_O90oeIOV2.js","assets/_dkeDDehz2.js","assets/_DOwzaHZ02.js","assets/_B3gFvitq2.js","assets/_Cfkwpbl82.js","assets/_BiFt_7mu2.js","assets/_CMLA9XwU2.js","assets/_DVIw_RgW2.js","assets/_BooCIZFD.js","assets/_CkT411UL.js","assets/_BfCF5T_K.js","assets/_B49wgrKW.js","assets/_Bj61d0ZC2.js","assets/_DK5es8xg.js","assets/_BM315xPC.js","assets/_Cvrh5tZx2.js","assets/_DDpdWlxA.js","assets/_BpB-O0HN.js","assets/_L8AbGenz.js","assets/_ByJddavk.js","assets/_O3QIPxoe.js","assets/_ByaF5Ym8.js","assets/_H-G61tx0.js","assets/_BWIzVLMa2.js","assets/_DkpMMWAt2.js","assets/_3ZKZeEN32.js","assets/_BeCpXzaO2.js","assets/_D_8pG7bS2.js","assets/_D8RqMrGW2.js","assets/_B6D30XZt.js"])))=>i.map(i=>d[i]);
|
|
2
2
|
var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],enumerable:!0});return n||e(r,Symbol.toStringTag,{value:`Module`}),r},n=/[\\;]/g,r=e=>e===`;`?`\\3B `:`\\\\`,i=function e(t,n,r){let i=``,a=``,o;if(t){if(typeof t!=`object`)i+=t;else if(Array.isArray(t))for(let s of t)o=e(s,n,r),o&&(i+=a+o,a=n);else for(let e in t)o=r(e,t[e]),o&&(i+=a+o,a=n)}return i},a=e=>(e+(e<26?10:e<962?334:11998)).toString(36),o,s,c=2,l=[],u=[],d=(e=>{for(let t=0;t<e.length;)e[t++](e[t++])}),f=e=>{(!o||e.b.F?.H!==0)&&e.c(e.b,e.d)},p,m=(e,t)=>t[1+e]||=(document.addEventListener(e,t,!0),1),h={},g=1e6,_,v=function e(t){t.H=0,t.D?.forEach(e),t.B?.forEach(Le)},y,b,x=(e,t)=>e.T?.(t),S=new WeakMap,C,ee=function e(t,n,r){let i,o,s=0,c=0;for(;t<n.length;)if(i=n.charCodeAt(t++),o=s,s=0,i===32)r[a(c++)]=C;else if(i===37||i===49)C.replaceWith(C=r[a(c++)]=new Text),i===49&&(r[a(c++)]=Fe());else if(i===38)return t;else if(i===47||i===48)t=e(t,n,r[a(c++)]=Pe(r.$,r.F)),i===48&&(r[a(c++)]=Fe());else if(i<92)for(i=25*o+i-67;i--;)te();else if(i<107)for(i=10*o+i-97;i--;)ne();else if(i<117){for(i=10*o+i-107;i--;)C=C.parentNode||C;ne()}else s=o*10+i-117},te=()=>{if(C.firstChild)return C=C.firstChild;for(;!C.nextSibling&&C.parentNode;)C=C.parentNode;ne()},ne=()=>C=C.nextSibling||C,w={},re,ie,ae,oe,se={},T=/[\p{L}\p{N}]/gu,E=``,D={},ce={},O=ye((e,...t)=>{e=a(e);let n=`D`+e,r=[],i=0;for(;i<t.length;)r.push(ut(``,t[i++],t[i++],t[i++])());return(t,i)=>{i!==(t[n]??(t[`A`+e]&&0))&&Xt(t,e,r[t[n]=i],ct)}}),le=ye((e,t,n)=>{e=a(e),t!==void 0&&(t=a(t)),n!==void 0&&(n=a(n));let r=`A`+e;return(i,a)=>{let o=i[e],s=o.nodeType===1,c=s?o:o.parentNode,l=i[r];l||(l=i[r]={},l.S=s?c.firstChild:i[t],l.K=s?c.lastChild:n===void 0?o.previousSibling:i[n]);let u=l.S;if(l.L&&u===l.K&&u.tagName===`T`){let e=u;e.firstChild||e.appendChild(new Text),l=i[r]={},l.S=u=e.firstChild,l.K=e.lastChild,e.replaceWith(...e.childNodes)}let d=s?!!c.firstChild:u.parentNode===c;a?d||Be(l,c,s?null:o):d&&(s&&(l.S=c.firstChild,l.K=c.lastChild),Ve(l))}}),ue=ye((e,t,n,r)=>{e=a(e);let i=`A`+e,o=`D`+e;return(a,s,c)=>{let l=ve(s);if(a[o]!==(a[o]=l?.a||l)||t&&!(l||a[i])){if(Xt(a,e,l||(t?t(a):void 0),Zt),n&&(a[i].T=e=>n()(a,e)),typeof l==`string`){if(t){let e=t(a);Xt(a[i],`a`,e,ct),e.f&&Xe(e.e,e.f,a[i].Aa)}}else l?.f&&Xe(l.e,l.f,a[i])}if(l){let e=a[i],n=c?.();if(typeof l==`string`)(t?vt:yt)(e,`a`,(r?n[0]:n)||{},ce[e.a.tagName]),(e.Ia||e.Ea)&&Ce(e,Yt);else{for(let t in l.g)l.g[t](e,l.h[t]);if(l.d){if(r)l.d(e,l._?n[0]:n);else{let r=t?{...n,content:t(a)}:n||{};l.d(e,l._?r:[r])}}}}}}),de=ye(e=>{e=a(e);let t=`A`+e,n=`D`+e;return(r,i)=>{if(r[n]!==(r[n]=i?.a||i)&&(Xt(r,e,i,ct),i?.f&&Xe(i.e,i.f,r[t])),i)for(let e in i.g)i.g[e](r[t],i.h[e])}}),k=ye(e=>(t,n,r,i,o)=>{t=a(t);let s=`A`+t,c=`O`+t,l=ut(``,n,r,i)();return(n,r)=>{let i=n[t],a=ke(n[s]),u=n[s]=[];n[c]=null;let d=a.length,f=i.nodeType>1?i.parentNode||a[0]?.S.parentNode:i,p,m,h=0;e(r,(e,t)=>{let r=u.length,i=a[r],s=d&&(p||e!==(i?.M??r)?(p||=a.reduce((e,t,n)=>n<r?e:(t.I=n,e.set(t.M??n,t)),new Map)).get(e):i&&(h++,i));s?(m=!0,p?.delete(e)):s=ct(n.$,l,n,f),s.M=e,u.push(s),o?.(s,t)});let g=u.length,_=i!==f,v=null,y=d-1,b=g-1;if(_&&(d?(v=a[y].K.nextSibling,g||f.insertBefore(i,v)):g&&(v=i.nextSibling,i.remove())),!m){d&&(a.forEach(_?ze:Ie),_||(f.textContent=``));for(let e of u)Be(e,f,v);return}if(p)p.forEach(ze);else for(let e=g;e<d;e++)ze(a[e]);for(;y>=h&&b>=h&&a[y]===u[b];)y--,b--;if(y+1<d&&(v=a[y+1].S),h>y||h>b){for(let e=h;e<=b;e++)Be(u[e],f,v);return}let x=b-h+1,S=Array(x),C=Array(x),ee=[],te=-1,ne,w,re;for(let e=x;e--;)S[e]=u[h+e].I??-1;for(let e=0;e<x;e++)if(~S[e]){if(te<0||S[ee[te]]<S[e])~te&&(C[e]=ee[te]),ee[++te]=e;else{for(ne=0,w=te;ne<w;)re=(ne+w)/2|0,S[ee[re]]<S[e]?ne=re+1:w=re;S[e]<S[ee[ne]]&&(ne>0&&(C[e]=ee[ne-1]),ee[ne]=e)}}for(w=ee[te],ne=te+1;ne-->0;)ee[ne]=w,w=C[w];for(let e=x;e--;)~te&&e===ee[te]?te--:Be(u[h+e],f,v),v=u[h+e].S}})(([e,t],n)=>{t||=Qt,typeof t==`string`?be(e,(e,r)=>n(e[t],[e,r])):be(e,(e,r)=>n(t(e,r),[e,r]))});function fe(e,t){return t?e:``}function pe(e,t){return t||t===0?me(e)+`:`+me(t+``):``}function me(e){return n.test(e)?e.replace(n,r):e}function he(e){return/^on[A-Z-]/.test(e)}function ge(e){return e[2]===`-`?e.slice(3):e.slice(2).toLowerCase()}function _e(e){return e!=null&&e!==!1}function ve(e){if(e){if(typeof e==`string`)return e;let t=e.content||e.default||e;if(`a`in t)return t}}function ye(e){return o=1,e}function be(e,t){if(e){let n=0;for(let r of e)t(r,n++)}}function xe(e,t,n,r,i=e.L){let a;if(n>=0&&(a=e[n])){if(a.d=r,a.e===c||p&&a.f)return;a.e=c}else a={a:i*1e6+n,b:e,c:t,d:r,e:c},n>=0&&(e[n]=a);Se(a)}function Se(e){let t=u.push(e)-1;for(;t;){let n=t-1>>1,r=u[n];if(e.a-r.a>=0)break;u[t]=r,t=n}u[t]=e}function Ce(e,t){l.push(t,e)}function we(){let e=l;try{s=1,eee()}finally{c++,s=0,u=[],l=[]}d(e)}function eee(){for(;u.length;){let e=u[0],t=u.pop();if(e!==t){let e=0,n=u.length>>1,r=(u[0]=t).a;for(;e<n;){let t=(e<<1)+1,n=t+1;if(n<u.length&&u[n].a-u[t].a<0&&(t=n),u[t].a-r>=0)break;u[e]=u[t],e=t}u[e]=t}f(e)}}function Te(e,t){let n=e.A?.[t];n&&(e.A[t]=void 0,s?Ce(n,Oe):Oe(n))}function Ee(e,t){return De(e),((e.A||={})[t]||=new AbortController).signal}function De(e,t){let n=e.F;n&&(n.B||=new Set).add(e),t&&(e.Z||=[]).push(t)}function Oe(e){e.abort()}function ke(e){return e?Array.isArray(e)?e:[e]:[]}function Ae(e,t){if(e){if(Array.isArray(e))for(let n of e)t(n);else t(e)}}function je(e,t){return e?Array.isArray(e)?(e.push(t),e):[e,t]:t}function A(e,t,n){e[1+t]===void 0&&m(t,Me),e[1+t]=n||null}function Me(e){let t=!s&&e.target;for(;t;)t[1+e.type]?.(e,t),t=e.bubbles&&!e.cancelBubble&&t.parentNode}function Ne(e,t){let n=h[t]||=document.createElementNS(t,`template`);return n.innerHTML=e,n.content||n}function Pe(e,t){let n={L:g++,H:c,F:t,$:e};return _?.push(n),n}function Fe(){return g++}function Ie(e){e.N?.D?.delete(e),v(e)}function Le(e){e.Z?.forEach(Re,e);for(let t in e.A)Te(e,t)}function Re(e){e.delete(this)}function ze(e){Ie(e),Dt(e.S,e.K)}function Be(e,t,n){Ot(t,n,e.S,e.K)}function Ve(e){let t=new DocumentFragment;t.namespaceURI=e.S.parentNode.namespaceURI,Ot(t,null,e.S,e.K)}function He(){y||(y=1,queueMicrotask(Ue))}function Ue(){requestAnimationFrame(We),we()}function We(){b||(b=new MessageChannel,b.port1.onmessage=()=>{y=0,we()}),b.port2.postMessage(0)}function j(e,t){let n=a(e);return(r,i)=>(s?r.H===c&&(r[n]=i,t?.(r)):(r[n]!==i||!(n in r))&&(r[n]=i,t)&&(He(),xe(r,t,e)),i)}function Ge(e,t){let n=a(e),r=a(e+1),i=j(e,t);return(e,a,o)=>(s?(e[r]=o)&&(e[n]!==a||!(n in e))?(e[n]=a,t?.(e)):i(e,a):e[r]?e[r](a):i(e,a),a)}function M(e,t){return e=a(e),((n,r)=>{(n[e]!==r||!(e in n))&&(n[e]=r,t?.(n))})}function N(e,t,n=1,r=`L`){return r!==`L`&&(r=a(r)),i=>{i.H===c?~e in i?--i[~e]||t(i):i[~e]=n:xe(i,t,e,0,i[r])}}function Ke(e,t){e=a(e);let n=`A`+e,r=e=>{let r=ke(e[n]);r.length&&xe(e,()=>{for(let e of r)e.H>0&&e.H<c&&t(e)},-1,0,r[0].L)};return r._=t,r}function qe(e,t,n,r){e=a(e),t=a(t),n!==`M`&&(n=a(n));let i=`A`+e,o=`O`+e,s=`_${t}`,l=e=>{let a=ke(e[i]);if(e.H<c&&a.length){let c=e[t];xe(e,()=>{let t=Je(e,i,o,n);if(t&&s in t){let e=t.get(t[s]),n=t.get(c);e!==n&&(Ye(e,r),Ye(n,r))}else for(let t of ke(e[i]))Ye(t,r);t&&(t[s]=c)},-1,0,a[0].L)}};return l._=r,l}function Je(e,t,n,r){let i=e[n]||=new Map;if(!i.size)for(let a of ke(e[t])){let t=a.M??a[r];if(t===void 0)return e[n]=null;a.M=t,i.set(t,a)}return i}function Ye(e,t){e&&e.H>0&&e.H<c&&t(e)}function P(e,t,n){e=a(e);let r=`A`+e,i=`D`+e,o=e=>{let a=e[r];a&&a.H>0&&a.H<c&&(e[i]||0)===t&&xe(a,n,-1)};return o._=n,o}function Xe(e,t,n){let r=e[t]||=new Set,{size:i}=r;r.add(n).size!==i&&De(n,r)}function F(...e){let[t]=e,n=t.a,r=t.b;for(let t=e.length;t--;)e[t].c=t;return t=>{if(t[n])for(let i of t[n])i.H>0&&i.H<c&&xe(i,e[i[r]||0],-1)}}function I(e,t,n,r){e=a(e);let i=(e=>{e[i.b]=i.c,t(e),Xe(n?n(e):e._,i.a,e)});return i.a=e,i.b=`C`+e,r&&R(r,i),i}function Ze(e,t,n){e[a(t)].T=t=>n(e,t)}function Qe({$:e}){let t=S.get(e)||0;return S.set(e,t+1),`c`+e.runtimeId+e.renderId+t.toString(36)}function L(e,t){return R(e,t),e=>{Ce(e,t)}}function*$e(e,t,n=t.length-1){if(e){if(Symbol.iterator in e)for(let r of e.values())yield*$e(r,t,n);else{let r=e[t[n]];n?yield*$e(r,t,n-1):yield typeof r==`function`?r():r}}}function et(...e){return e=e.map(e=>typeof e==`string`?e:a(e)),t=>{let n=()=>$e(t,e).next().value;return n[Symbol.iterator]=()=>$e(t,e),n}}function tt(e,...t){return R(e,et(...t))}function nt(e,t,n){C=e,ee(0,t,n)}function tee(e=`M`){if(re)return;let t=self[e],n=t=>Object.defineProperty(self,e,t),r=t=>{n({value:re=(n=>{let r=re[n]=t[n]||t(n),i=r.w,a={},s=e=>a[e]||(+e?l(a[e]={L:+e}):c()),c=()=>a[0]||={runtimeId:e,renderId:n},l=e=>(e.H=1,e.$=c(),o&&e.G&&(e.F=s(e.G)),e),u=e=>{let t=e[0];for(let n=1;n<e.length;n++){let r=e[n];typeof r==`number`?t+=r:(t?l(Object.assign(a[t]||=(r.L=t,r),r)):Object.assign(c(),r),t++)}},d=((e,t)=>typeof e==`number`?t?w[t](s(e)):s(e):u(e)),f=(e=[],t=[],n=[],i=[],a)=>(o,c,l,u,d,f=_.parentNode,m=_,h=n.length,v=i.length)=>{for(y!==`[`&&(b[p()]=y===`)`||y===`}`?f:_,u=`A`+x,d=y!==`]`&&y!==`)`,p());o=+x;){if((l||=[]).push(c=s(o)),st(c,c.F),(c.O=r.p?.[o])&&(c.O.m=r.m),d){for(;m.previousSibling&&~g.indexOf(m=m.previousSibling););c._??=b,c.K=c.S=m,y===`'`&&(c.a=m)}else a=je(a,c),u&&(b[u]=a,Ae(a,e=>e._??=b),a=e.pop()),m=t.pop(),f!==m.parentNode&&f.prepend(m),c.S=m,c.K=_.previousSibling===m?m:f.insertBefore(new Text,_);for(;h&&n[h-1].L>o;)h--,st(n.pop(),c);for(;v&&i[v-1].L>o;){v--;let e=i.pop();e.F!==e&&(e.F=c)}p()}if(l){for(let e of l)n.push(e);d&&(b[u]=l.length>1?l.reverse():l[0])}y===`[`?(l||(e.push(a),a=void 0),t.push(_)):i.push(b)},p=()=>x=v.slice(S,(S=v.indexOf(` `,S)+1||v.length+1)-1),m=(e=[],t)=>{let n=0;for(;n<e.length;n++){let i=e[n];if(typeof i==`string`)for(S=0,v=i;p();)/\D/.test(x)?h=w[x]:t.push(h,s(x));else if(Array.isArray(i)){if(!(ae&&i.every(e=>ae.has(e)&&!r.b[e].length)))break}else if(ae&&typeof i==`number`)break;else{let e=i(d);Array.isArray(e)&&u(e)}}return e.splice(0,n),n},h,g,_,v,y,b,x,S,C,ee;return d._=w,r.m=e=>{if(m(r.r,e),ae&&r.b)for(let t=1;t;){t=0;for(let n of ae){let i=r.b[n];i&&m(i,e)&&(t=1)}}let t=0;for(_ of g=r.v)if(S=r.i.length,v=_.data,y=v[S++],b=s(p()),y===`*`){let e=_.previousSibling;b[p()]=e&&(e.nodeType<8||e.data)?e:_.parentNode.insertBefore(new Text,_)}else o?(C||=f())():r.b&&(g[t++]=_);return ie&&!ee&&_&&ie.set(ee=_.parentNode.insertBefore(new Text,_.nextSibling),[n,a]),g.length=t,e},r.w=()=>{i(),rt(r)},r})})};if(t){r(t);for(let e in t)rt(re(e))}else n({configurable:!0,set:r})}function rt(e){try{oe=1,d(e.m([]),1)}finally{oe=0}}function R(e,t){return w[e]=t}function it(e,t){return R(e,e=>n=>t(e,n)),t}function at(e,t){return t=a(t),R(e,e=>()=>e[t])}function ot(e,t,n,r){let i=Pe(e);return i._=t.e||n,st(i,n?.F),t.b?.(i,r.namespaceURI),i}function st(e,t){t&&(e.N=t,(t.D||=new Set).add(e)),e.F=e}function ct(e,t,n,r){return lt(t,ot(e,t,n,r))}function lt(e,t){return e.c&&xe(t,e.c,-1),t}function ut(e,t,n,r,i,a){n=n?n.replace(/[^\0-1]+$/,``):``,r=r?r._||r:void 0,i||=void 0;let o=t?(e,r)=>{((se[r]||={})[1+t]||=ft(t,r))(e,n)}:e=>{nt(e.S=e.K=new Text,n,e)};return t=>({a:e,b:o,e:t,c:r,d:i,f:a})}function dt(e,t,n,r,i,a){return R(e,ut(e,t,n,r,i,a))}function ft(e,t){let{firstChild:n,lastChild:r}=Ne(e,t),i=document.createElementNS(t,`t`);return Ot(i,null,n,r),n===r&&n.nodeType<8?(e,t)=>{nt(e.S=e.K=n.cloneNode(!0),t,e)}:(e,t)=>{let n=i.cloneNode(!0);nt(n.firstChild,t,e),e.S=n.firstChild,e.K=n.lastChild}}function pt(e){return e||e===0?e+``:``}function z(e,t,n){mt(e,t,Tt(n))}function mt(e,t,n){e.getAttribute(t)!=n&&(n===void 0?e.removeAttribute(t):e.setAttribute(t,n))}function ht(e,t){mt(e,`class`,i(t,` `,fe)||void 0)}function gt(e,t){for(let n in t)B(e,n,t[n])}function B(e,t,n){e.classList.toggle(t,!!n)}function _t(e,t){mt(e,`style`,i(t,`;`,pe)||void 0)}function V(e,t){let n=pt(t);e.data!==n&&(e.data=n)}function vt(e,t,n,r){let i=e[t];for(let e=i.attributes.length;e--;){let{name:t}=i.attributes.item(e);n&&(t in n||bt(i,t,n))||i.removeAttribute(t)}xt(e,t,n,r)}function yt(e,t,n,r){vt(e,t,n,r),St(e,t,n?.content)}function bt(e,t,n){return t===`checked`&&e.tagName===`INPUT`&&`checkedValue`in n}function xt(e,t,n,r){let i=e[t],a=e[`I`+t],o;for(let e in a)a[e]=0;r&&(e[`F`+t]=5,e[`E`+t]=0,n&&(o=r(e,t,n)));for(let r in n){let s=n[r];switch(r){case`class`:ht(i,s);break;case`style`:_t(i,s);break;default:he(r)?(a||=e[`I`+t]={})[ge(r)]=s:o?.test(r)||r===`content`&&i.tagName!==`META`||z(i,r,s)}}}function St(e,t,n){let r=wt(n);e[`D`+t]!==(e[`D`+t]=r?.a)&&(Xt(e,t,r,ct),r?.f&&Xe(r.e,r.f,e[`A`+t]));for(let n in r?.g)r.g[n](e[`A`+t],r.h[n])}function Ct(e,t){let n=e[t],r=e[`I`+t];D[e[`F`+t]]?.(e,t);for(let e in r)A(n,e,r[e])}function wt(e){let t=ve(e);if(t&&t.a)return t}function Tt(e){if(_e(e))return e===!0?``:e+``}function Et(e,t,n=0){let r=`K`+n,i=e[r];i?(Object.assign(i,t),i.onUpdate?.()):(e[r]=t,Object.assign(t,t.onMount?.()),Ee(e,r).onabort=()=>t.onDestroy?.())}function Dt(e,t){let n=t.nextSibling;for(;e!==n;){let t=e.nextSibling;e.remove(),e=t}}function Ot(e,t,n,r){if(e.isConnected)e.insertBefore(nee(n,r),t);else{let i=r.nextSibling;for(;n!==i;){let r=n.nextSibling;e.insertBefore(n,t),n=r}}return e}function nee(e,t){return e===t?e:Ot(new DocumentFragment,null,e,t)}function ree(e,t,n,r){if((t||t===0)&&(t!==n.length||/kw/.test(e))){let e=n.slice(0,t),i=n.slice(t);if(r.startsWith(e))return t;if(r.endsWith(i))return r.length-i.length;let a=e.match(T)?.length;for(;a&&T.test(r);)a--;return a?r.length:T.lastIndex}return-1}function kt(e,t,n){let r=e[t],i=_e(n);if(r.defaultChecked!==i){let t=e.H<c?r.checked:i;r.defaultChecked=i,t!==i&&(r.checked=t)}}function iee(e,t,n,r){let i=e[t],a=_e(n);e[`E`+t]=r,e[`F`+t]=r?0:5,r&&e.H<c?i.checked=a:kt(e,t,a)}function aee(e,t){let n=e[t];Vt(n,Gt,()=>{let r=e[`E`+t];if(r){let e=n.checked;n.checked=!e,r(e),we()}})}function At(e,t,n){let r=e[t],i=Tt(n)||``;if(r.defaultValue!==i){let t=e.H<c?r.value:i;r.defaultValue=i,Nt(r,t)}}function jt(e,t,n,r,i=At){let a=e[t],o=Tt(n)||``;e[`E`+t]=r,e[`G`+t]=o,e[`F`+t]=r?2:5,r&&e.H<c?Nt(a,o):i(e,t,o)}function Mt(e,t){let n=e[t];oe&&(e[`G`+t]=n.defaultValue),Vt(n,Wt,r=>{let i=e[`E`+t];i&&(E=r?.inputType,i(n.value),we(),Nt(n,e[`G`+t]),E=``)})}function Nt(e,t){if(e.value!==t){let n=ree(E,document.activeElement===e&&e.selectionStart,e.value,e.value=t);~n&&e.setSelectionRange(n,n)}}function Pt(e,t,n){let r,i=e[t],a=e.H<c,o=Array.isArray(n),s=o?n.map(Jt):Jt(n);l.unshift(()=>{for(let e of i.options){let t=o?s.includes(e.value):e.value===s;e.defaultSelected!==t&&(a&&(r??=Rt(i,o)),e.defaultSelected=t)}r!==void 0&&Lt(i,r,o)},e)}function Ft(e,t,n,r){let i=e[t],a=e.H<c,o=Array.isArray(n),s=e[`G`+t]=o?n.map(Jt):Jt(n);e[`E`+t]=r,e[`F`+t]=r?3:5,r&&a?l.unshift(()=>Lt(i,s,o),e):Pt(e,t,s)}function It(e,t){let n=e[t],r=()=>{let r=e[`E`+t];if(r){let i=e[`G`+t],a=Array.isArray(i),o=Rt(n,a);Lt(n,i,a),r(o),we()}};if(oe){if(n.multiple){e[`G`+t]=[];for(let r of n.options)r.defaultSelected&&e[`G`+t].push(r.value)}else{e[`G`+t]=``;for(let r of n.options)if(r.defaultSelected){e[`G`+t]=r.value;break}}}Vt(n,Kt,r),Bt(e,t,{childList:!0,subtree:!0},()=>{let i=e[`G`+t];(Array.isArray(i)?i.length!==n.selectedOptions.length||i.some((e,t)=>!i.includes(n.selectedOptions[t].value)):n.value!==i)&&r()})}function Lt(e,t,n){if(n)for(let n of e.options)n.selected=t.includes(n.value);else e.value=t}function Rt(e,t){return t?Array.from(e.selectedOptions,e=>e.value):e.value}function zt(e,t,n){e.H===c&&(e[t].open=_e(n))}function Bt(e,t,n,r){(e[`N`+t]||=new MutationObserver(r)).observe(e[t],n)}function Vt(e,t,n){e._=n,m(`input`,Ht),e.form&&m(`reset`,Ut),oe&&t(e)&&queueMicrotask(n)}function Ht(e){e.target._?.(e)}function Ut(e){let t=[];for(let n of e.target.elements)n._&&qt(n)&&t.push(n._);requestAnimationFrame(()=>{if(!e.defaultPrevented)for(let e of t)e()})}function Wt(e){return e.value!==e.defaultValue}function Gt(e){return e.checked!==e.defaultChecked}function Kt(e){for(let t of e.options)if(t.selected!==t.defaultSelected)return!0}function qt(e){return e.options?Kt(e):Wt(e)||Gt(e)}function Jt(e){return Tt(e)||``}function Yt(e){Ct(e,`a`)}function Xt(e,t,n,r){let i=e[t],a=e[`A`+t],o=i.nodeType>1?(a?.S||i).parentNode:i,s=e[`A`+t]=n&&r(e.$,n,e,o);i===o?(a&&(Ie(a),i.textContent=``),s&&Be(s,o,null)):a?(s?Be(s,o,a.S):o.insertBefore(i,a.S),ze(a)):s&&(Be(s,o,i),i.remove())}function Zt(e,t,n,r){let i=ot(e,t,n,r);return typeof t==`string`?i.a=i.S=i.K=document.createElementNS(t===`svg`?`http://www.w3.org/2000/svg`:t===`math`?`http://www.w3.org/1998/Math/MathML`:r.namespaceURI,t):lt(t,i),i}function Qt(e,t){return t}var $t=[],en=Symbol();function tn(e){return e[Symbol.iterator]=oee,e[en]=$t,e}function*oee(){yield this,yield*this[en]}async function H(e,t){let n=await fetch(e,t),r;try{r=await n.json()}catch{throw Error(n.ok?`invalid response`:`HTTP ${n.status}`)}if(r&&typeof r==`object`&&r.error)throw Error(r.error);if(!n.ok)throw Error(`HTTP ${n.status}`);return r}var see=[`workspaces.changed`,`sessions.changed`,`workspace.progress`,`review.changed`,`status.changed`],nn=1e4,rn=4e4,an=8e3,on=5e3,sn=6e4,cn,ln,un=null,dn,fn,pn,mn,hn=0;function gn(e){ln&&e!==ln&&location.reload(),ln=e}async function _n(){try{gn((await H(`/api/boot`)).boot)}catch{}}function vn(){clearTimeout(fn),clearTimeout(pn),pn=setTimeout(yn,rn),hn&&(hn=0,clearInterval(mn),mn=void 0)}function yn(){bn(),!hn&&(hn=Date.now(),mn=setInterval(()=>{document.visibilityState===`visible`&&(Date.now()-hn>sn&&(hn=Date.now(),Sn()),xn(),H(`/api/status`).then(e=>{cn.dispatchEvent(new MessageEvent(`status.changed`,{data:e}))}).catch(()=>{}))},on))}function bn(){clearTimeout(fn),clearTimeout(pn),un?.close(),un=null}function xn(){for(let e of[`workspaces.changed`,`sessions.changed`])cn.dispatchEvent(new MessageEvent(e,{data:null}))}function Sn(){if(un)return;let e=un=new EventSource(`/api/events`);clearTimeout(fn),fn=setTimeout(yn,an),e.addEventListener(`hello`,e=>{vn(),gn(JSON.parse(e.data||`{}`).boot)}),e.addEventListener(`ping`,vn);for(let t of see)e.addEventListener(t,e=>{vn(),cn.dispatchEvent(new MessageEvent(t,{data:JSON.parse(e.data||`null`)}))})}function Cn(){return cn||(cn=new EventTarget,Sn(),_n(),document.addEventListener(`visibilitychange`,()=>{document.visibilityState===`visible`?(clearTimeout(dn),Sn(),_n(),xn()):(clearTimeout(dn),dn=setTimeout(()=>{hn||bn()},nn))})),cn}var wn=null,Tn=null,En=new EventTarget;function Dn(e,t){En.addEventListener(`intent`,e,{signal:t})}function On(e,t){wn={workspaceId:e,pr:t},En.dispatchEvent(new Event(`intent`))}function kn(e){if(wn?.workspaceId!==e)return!1;let t=wn.pr;return wn=null,{pr:t}}function An(e,t){Tn=[e,t],En.dispatchEvent(new Event(`intent`))}function jn(e){if(Tn?.[0]!==e)return null;let t=Tn[1];return Tn=null,t}function Mn(e){let t=!1,n=!1;return async()=>{if(t){n=!0;return}t=!0;try{do n=!1,await e();while(n)}finally{t=!1}}}var Nn=new Map,Pn=new Set,Fn;function In(){return typeof window>`u`?Promise.resolve():Fn??=(async()=>{try{let e=await(await fetch(`/api/prefs`)).json();for(let[t,n]of Object.entries(e))Pn.has(t)||Nn.set(t,n)}catch{}})()}function Ln(e){return Nn.get(e)??null}function Rn(e,t){Pn.add(e),t===null?Nn.delete(e):Nn.set(e,t),zn(e,t)}function zn(e,t){return fetch(`/api/prefs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({key:e,value:t})}).catch(()=>{})}function Bn(){return Ln(`last-workspace`)}function Vn(e){Rn(`last-workspace`,e)}function Hn(){return Ln(`side-nav`)!==`0`}function Un(e){Rn(`side-nav`,e?`1`:`0`)}function Wn(e){return Ln(`tab:${e}`)}function Gn(e,t){Rn(`tab:${e}`,t)}function Kn(){return Ln(`diff-tree`)!==`0`}function qn(e){Rn(`diff-tree`,e?`1`:`0`)}function Jn(){return Ln(`diff-uncommitted`)===`1`}function Yn(e){Rn(`diff-uncommitted`,e?`1`:`0`)}function Xn(){return typeof window<`u`&&`serviceWorker`in navigator&&`PushManager`in window}async function Zn(){return Xn()?(await tr()).pushManager.getSubscription():null}async function Qn(){if(await Notification.requestPermission()!==`granted`)return!1;let e=await tr(),t=await e.pushManager.getSubscription();if(!t){let{publicKey:n}=await H(`/api/push`);t=await e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:nr(n)})}return await H(`/api/push`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify(t.toJSON())}),!0}async function $n(){let e=await Zn();e&&(await H(`/api/push?endpoint=${encodeURIComponent(e.endpoint)}`,{method:`DELETE`}).catch(()=>{}),await e.unsubscribe())}function er(e){let t=()=>{document.visibilityState===`visible`&&navigator.clearAppBadge?.().catch(()=>{})};t(),document.addEventListener(`visibilitychange`,t,{signal:e})}async function tr(){return await navigator.serviceWorker.getRegistration()??navigator.serviceWorker.register(`/sw.js`)}function nr(e){let t=e.padEnd(e.length+(4-e.length%4)%4,`=`),n=atob(t.replace(/-/g,`+`).replace(/_/g,`/`));return Uint8Array.from(n,e=>e.charCodeAt(0))}function rr(){return typeof window<`u`&&window.matchMedia(`(pointer: coarse)`).matches}function ir(){return typeof window<`u`&&window.matchMedia(`(max-width: 899px)`).matches}function ar(){return typeof navigator<`u`&&navigator.standalone===!0}function or(e){if(!ar()||!/^https?:\/\//.test(e)){window.open(e,`_blank`,`noopener`);return}if(localStorage.getItem(`xSafariOk`)){location.href=`x-safari-${e}`;return}if(localStorage.getItem(`xSafariNo`)){window.open(e,`_blank`,`noopener`);return}let t=!1,n=()=>{document.visibilityState===`hidden`&&(t=!0,localStorage.setItem(`xSafariOk`,`1`))};document.addEventListener(`visibilitychange`,n),window.addEventListener(`pagehide`,n),setTimeout(()=>{document.removeEventListener(`visibilitychange`,n),window.removeEventListener(`pagehide`,n),!(t||document.visibilityState===`hidden`)&&(localStorage.setItem(`xSafariNo`,`1`),window.open(e,`_blank`,`noopener`))},1500),location.href=`x-safari-${e}`}var sr=`<div><div class=toast-body><!><!></div><!></div>`,cr=` E%b%l%l`,lr=L(`p0`,e=>A(e.a,`click`,function(){e._._.l?.()})),ur=ue(0),dr=I(22,e=>ur(e,e._._.n),e=>e._._),fr=O(0,`<!><!><!>`,`b%`,dr),pr=P(3,0,e=>fr(e,+!e._.k)),cee=e=>{pr._(e),hr._(e)},mr=O(1,`<button class="icon-btn toast-dismiss" title=Dismiss>×</button>`,` `,lr),hr=P(3,0,e=>mr(e,+!e._.l)),gr=ue(0),_r=P(2,0,e=>gr(e,e._.j)),vr=_r,yr=P(1,0,e=>V(e.a,e._.i)),br=yr,xr=N(17,e=>ht(e.a,[`toast`,`toast-${e.o}`,`toast-${e.p}`])),Sr=M(14,e=>{z(e.a,`role`,e.o===`error`?`alert`:`status`),xr(e)}),Cr=(e,t)=>Sr(e,t||`error`),wr=N(16,L(`p1`,e=>Et(e,{onDismiss:e.l,placement:e.p,onMount:function(){let e=new AbortController;return this.placement===`float`&&this.onDismiss&&window.addEventListener(`keydown`,e=>{e.key===`Escape`&&(e.target instanceof HTMLInputElement&&e.target.value||e.target instanceof Element&&e.target.closest(`.palette, [role=dialog]`)||(e.stopPropagation(),this.onDismiss?.()))},{capture:!0,signal:e.signal}),{abort:e}},onDestroy:function(){this.abort.abort()}}))),Tr=M(15,e=>{xr(e),wr(e)}),Er=(e,t)=>Tr(e,t||`float`),Dr=O(1,`<strong class=toast-title> </strong>`,`D `,br),Or=M(8,e=>{Dr(e,+!e.i),yr(e)}),kr=O(2,`<div class=toast-content><!></div>`,`D%`,vr),Ar=M(9,e=>{kr(e,+!e.j),_r(e)}),jr=O(3,`<div class=toast-actions><!><!></div>`,`D%b%`,cee),Mr=N(12,e=>jr(e,e.k||e.l?0:1)),Nr=M(10,e=>{lee(e,e.k?.content),Mr(e),pr(e)}),Pr=M(11,e=>{Mr(e),wr(e),hr(e)}),lee=M(13,F(dr));function uee(e,t){if(!e)return-1;let n=e.toLowerCase(),r=t.toLowerCase(),i=r.lastIndexOf(`/`),a=r.slice(i+1),o=r.slice(0,Math.max(0,i)).includes(n)?5:0;return a===n?1e3+o:a.startsWith(n)?800+o:a.includes(n)?600+o:Fr(n,a)?400+o:r.includes(n)?300:Fr(n,r)?100:-1}function dee(e,t,n){return e?t.map(t=>({repo:t,score:uee(e,t.nameWithOwner)})).filter(({repo:e,score:t})=>!e.isArchived&&t>=0&&!n(e.nameWithOwner)).sort((e,t)=>t.score-e.score||e.repo.nameWithOwner.length-t.repo.nameWithOwner.length||e.repo.nameWithOwner.localeCompare(t.repo.nameWithOwner)).slice(0,8).map(({repo:e})=>e):[]}function Fr(e,t){if(!e)return!0;let n=0,r=t.toLowerCase();for(let t of e.toLowerCase()){if(n=r.indexOf(t,n),n===-1)return!1;n++}return!0}function Ir(e){return e?.working?`working`:e?.waiting?`waiting`:e?.agents?`idle`:`off`}function Lr(e){return e?.phase===`working`?`working`:e?.phase===`waiting`?`waiting`:e?.alive?`idle`:`off`}var Rr=`<svg viewBox="0 0 24 24" fill=none stroke=currentColor stroke-width=1.5 stroke-linecap=round stroke-linejoin=round aria-hidden=true><path></path></svg>`,zr=` D l`,Br=(e,t)=>{z(e.a,`width`,t),z(e.a,`height`,t)},Vr=(e,t)=>Br(e,t??15),Hr=(e,t)=>ht(e.a,[`icon`,t]),Ur=(e,t)=>z(e.b,`d`,t),Wr=Rr,Gr=(e=>`/${e}&`)(zr);function Kr(e){Ur(e.a,`M18 21C19.1046 21 20 20.1046 20 19C20 17.8954 19.1046 17 18 17C16.8954 17 16 17.8954 16 19C16 20.1046 16.8954 21 18 21Z M6 7C7.10457 7 8 6.10457 8 5C8 3.89543 7.10457 3 6 3C4.89543 3 4 3.89543 4 5C4 6.10457 4.89543 7 6 7Z M18 17V7C18 7 18 5 16 5H13 M6 7V17C6 17 6 19 8 19H11 M15.0005 7.50012L12.5005 5.00012L15.0005 2.50012 M8.5 16.5L11 19L8.5 21.5`)}var qr=(e,t)=>Vr(e.a,t),Jr=(e,t)=>Hr(e.a,t),Yr=Rr,Xr=(e=>`/${e}&`)(zr);function Zr(e){Ur(e.a,`M12 15C13.6569 15 15 13.6569 15 12C15 10.3431 13.6569 9 12 9C10.3431 9 9 10.3431 9 12C9 13.6569 10.3431 15 12 15Z M19.6224 10.3954L18.5247 7.7448L20 6L18 4L16.2647 5.48295L13.5578 4.36974L12.9353 2H10.981L10.3491 4.40113L7.70441 5.51596L6 4L4 6L5.45337 7.78885L4.3725 10.4463L2 11V13L4.40111 13.6555L5.51575 16.2997L4 18L6 20L7.79116 18.5403L10.397 19.6123L11 22H13L13.6045 19.6132L16.2551 18.5155C16.6969 18.8313 18 20 18 20L20 18L18.5159 16.2494L19.6139 13.598L21.9999 12.9772L22 11L19.6224 10.3954Z`)}var Qr=(e,t)=>Vr(e.a,t),$r=(e,t)=>Hr(e.a,t),ei=Rr,ti=(e=>`/${e}&`)(zr);function ni(e){Ur(e.a,`M6 12H12M18 12H12M12 12V6M12 12V18`)}var ri=(e,t)=>Vr(e.a,t),ii=(e,t)=>Hr(e.a,t),ai=`<!><!><!>`,oi={claude:`M4.709 15.955l4.72-2.647.08-.23-.08-.128H9.2l-.79-.048-2.698-.073-2.339-.097-2.266-.122-.571-.121L0 11.784l.055-.352.48-.321.686.06 1.52.103 2.278.158 1.652.097 2.449.255h.389l.055-.157-.134-.098-.103-.097-2.358-1.596-2.552-1.688-1.336-.972-.724-.491-.364-.462-.158-1.008.656-.722.881.06.225.061.893.686 1.908 1.476 2.491 1.833.365.304.145-.103.019-.073-.164-.274-1.355-2.446-1.446-2.49-.644-1.032-.17-.619a2.97 2.97 0 01-.104-.729L6.283.134 6.696 0l.996.134.42.364.62 1.414 1.002 2.229 1.555 3.03.456.898.243.832.091.255h.158V9.01l.128-1.706.237-2.095.23-2.695.08-.76.376-.91.747-.492.584.28.48.685-.067.444-.286 1.851-.559 2.903-.364 1.942h.212l.243-.242.985-1.306 1.652-2.064.73-.82.85-.904.547-.431h1.033l.76 1.129-.34 1.166-1.064 1.347-.881 1.142-1.264 1.7-.79 1.36.073.11.188-.02 2.856-.606 1.543-.28 1.841-.315.833.388.091.395-.328.807-1.969.486-2.309.462-3.439.813-.042.03.049.061 1.549.146.662.036h1.622l3.02.225.79.522.474.638-.079.485-1.215.62-1.64-.389-3.829-.91-1.312-.329h-.182v.11l1.093 1.068 2.006 1.81 2.509 2.33.127.578-.322.455-.34-.049-2.205-1.657-.851-.747-1.926-1.62h-.128v.17l.444.649 2.345 3.521.122 1.08-.17.353-.608.213-.668-.122-1.374-1.925-1.415-2.167-1.143-1.943-.14.08-.674 7.254-.316.37-.729.28-.607-.461-.322-.747.322-1.476.389-1.924.315-1.53.286-1.9.17-.632-.012-.042-.14.018-1.434 1.967-2.18 2.945-1.726 1.845-.414.164-.717-.37.067-.662.401-.589 2.388-3.036 1.44-1.882.93-1.086-.006-.158h-.055L4.132 18.56l-1.13.146-.487-.456.061-.746.231-.243 1.908-1.312-.006.006z`,codex:`M9.205 8.658v-2.26c0-.19.072-.333.238-.428l4.543-2.616c.619-.357 1.356-.523 2.117-.523 2.854 0 4.662 2.212 4.662 4.566 0 .167 0 .357-.024.547l-4.71-2.759a.797.797 0 00-.856 0l-5.97 3.473zm10.609 8.8V12.06c0-.333-.143-.57-.429-.737l-5.97-3.473 1.95-1.118a.433.433 0 01.476 0l4.543 2.617c1.309.76 2.189 2.378 2.189 3.948 0 1.808-1.07 3.473-2.76 4.163zM7.802 12.703l-1.95-1.142c-.167-.095-.239-.238-.239-.428V5.899c0-2.545 1.95-4.472 4.591-4.472 1 0 1.927.333 2.712.928L8.23 5.067c-.285.166-.428.404-.428.737v6.898zM12 15.128l-2.795-1.57v-3.33L12 8.658l2.795 1.57v3.33L12 15.128zm1.796 7.23c-1 0-1.927-.332-2.712-.927l4.686-2.712c.285-.166.428-.404.428-.737v-6.898l1.974 1.142c.167.095.238.238.238.428v5.233c0 2.545-1.974 4.472-4.614 4.472zm-5.637-5.303l-4.544-2.617c-1.308-.761-2.188-2.378-2.188-3.948A4.482 4.482 0 014.21 6.327v5.423c0 .333.143.571.428.738l5.947 3.449-1.95 1.118a.432.432 0 01-.476 0zm-.262 3.9c-2.688 0-4.662-2.021-4.662-4.519 0-.19.024-.38.047-.57l4.686 2.71c.286.167.571.167.856 0l5.97-3.448v2.26c0 .19-.07.333-.237.428l-4.543 2.616c-.619.357-1.356.523-2.117.523zm5.899 2.83a5.947 5.947 0 005.827-4.756C22.287 18.339 24 15.84 24 13.296c0-1.665-.713-3.282-1.998-4.448.119-.5.19-.999.19-1.498 0-3.401-2.759-5.947-5.946-5.947-.642 0-1.26.095-1.88.31A5.962 5.962 0 0010.205 0a5.947 5.947 0 00-5.827 4.757C1.713 5.447 0 7.945 0 10.49c0 1.666.713 3.283 1.998 4.448-.119.5-.19 1-.19 1.499 0 3.401 2.759 5.946 5.946 5.946.642 0 1.26-.095 1.88-.309a5.96 5.96 0 004.162 1.713z`,grok:`M9.27 15.29l7.978-5.897c.391-.29.95-.177 1.137.272.98 2.369.542 5.215-1.41 7.169-1.951 1.954-4.667 2.382-7.149 1.406l-2.711 1.257c3.889 2.661 8.611 2.003 11.562-.953 2.341-2.344 3.066-5.539 2.388-8.42l.006.007c-.983-4.232.242-5.924 2.75-9.383.06-.082.12-.164.179-.248l-3.301 3.305v-.01L9.267 15.292M7.623 16.723c-2.792-2.67-2.31-6.801.071-9.184 1.761-1.763 4.647-2.483 7.166-1.425l2.705-1.25a7.808 7.808 0 00-1.829-1A8.975 8.975 0 005.984 5.83c-2.533 2.536-3.33 6.436-1.962 9.764 1.022 2.487-.653 4.246-2.34 6.022-.599.63-1.199 1.259-1.682 1.925l7.62-6.815`,copilot:`M19.245 5.364c1.322 1.36 1.877 3.216 2.11 5.817.622 0 1.2.135 1.592.654l.73.964c.21.278.323.61.323.955v2.62c0 .339-.173.669-.453.868C20.239 19.602 16.157 21.5 12 21.5c-4.6 0-9.205-2.583-11.547-4.258-.28-.2-.452-.53-.453-.868v-2.62c0-.345.113-.679.321-.956l.73-.963c.392-.517.974-.654 1.593-.654l.029-.297c.25-2.446.81-4.213 2.082-5.52 2.461-2.54 5.71-2.851 7.146-2.864h.198c1.436.013 4.685.323 7.146 2.864zm-7.244 4.328c-.284 0-.613.016-.962.05-.123.447-.305.85-.57 1.108-1.05 1.023-2.316 1.18-2.994 1.18-.638 0-1.306-.13-1.851-.464-.516.165-1.012.403-1.044.996a65.882 65.882 0 00-.063 2.884l-.002.48c-.002.563-.005 1.126-.013 1.69.002.326.204.63.51.765 2.482 1.102 4.83 1.657 6.99 1.657 2.156 0 4.504-.555 6.985-1.657a.854.854 0 00.51-.766c.03-1.682.006-3.372-.076-5.053-.031-.596-.528-.83-1.046-.996-.546.333-1.212.464-1.85.464-.677 0-1.942-.157-2.993-1.18-.266-.258-.447-.661-.57-1.108-.32-.032-.64-.049-.96-.05zm-2.525 4.013c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zm5 0c.539 0 .976.426.976.95v1.753c0 .525-.437.95-.976.95a.964.964 0 01-.976-.95v-1.752c0-.525.437-.951.976-.951zM7.635 5.087c-1.05.102-1.935.438-2.385.906-.975 1.037-.765 3.668-.21 4.224.405.394 1.17.657 1.995.657h.09c.649-.013 1.785-.176 2.73-1.11.435-.41.705-1.433.675-2.47-.03-.834-.27-1.52-.63-1.813-.39-.336-1.275-.482-2.265-.394zm6.465.394c-.36.292-.6.98-.63 1.813-.03 1.037.24 2.06.675 2.47.968.957 2.136 1.104 2.776 1.11h.044c.825 0 1.59-.263 1.995-.657.555-.556.765-3.187-.21-4.224-.45-.468-1.335-.804-2.385-.906-.99-.088-1.875.058-2.265.394zM12 7.615c-.24 0-.525.015-.84.044.03.16.045.336.06.526l-.001.159a2.94 2.94 0 01-.014.25c.225-.022.425-.027.612-.028h.366c.187 0 .387.006.612.028-.015-.146-.015-.277-.015-.409.015-.19.03-.365.06-.526a9.29 9.29 0 00-.84-.044z`,cursor:`M22.106 5.68L12.5.135a.998.998 0 00-.998 0L1.893 5.68a.84.84 0 00-.419.726v11.186c0 .3.16.577.42.727l9.607 5.547a.999.999 0 00.998 0l9.608-5.547a.84.84 0 00.42-.727V6.407a.84.84 0 00-.42-.726zm-.603 1.176L12.228 22.92c-.063.108-.228.064-.228-.061V12.34a.59.59 0 00-.295-.51l-9.11-5.26c-.107-.062-.063-.228.062-.228h18.55c.264 0 .428.286.296.514z`},si=P(0,1,e=>Vr(e.a,e._.d)),ci=e=>{si._(e),li._(e),Ur(e.a,`M5 7L10 12L5 17 M13 17H20`)},li=P(0,1,e=>Hr(e.a,e._.f)),ui=P(0,0,e=>ht(e.a,[`icon`,e._.f])),di=e=>{ui._(e),fi._(e),pi._(e)},fi=P(0,0,e=>{z(e.a,`width`,e._.g),z(e.a,`height`,e._.g)}),pi=P(0,0,e=>z(e.b,`d`,e._.h)),mi=M(6,fi),hi=M(3,e=>{mi(e,e.d??15),si(e)}),gi=O(0,`<svg viewBox="0 0 24 24" fill=currentColor fill-rule=evenodd aria-hidden=true><path></path></svg>`,` D `,di,Rr,(e=>`/${e}&`)(zr),ci),_i=M(7,e=>{gi(e,+!e.h),pi(e)}),vi=(e,t)=>_i(e,oi[t]),yi=M(5,e=>{ui(e),li(e)}),bi=`<!><!><div class=palette role=dialog aria-label=Workspaces><!><input autofocus placeholder="Jump to workspace…" aria-label="Filter workspaces"><ul class=rows></ul><!><div class=palette-foot><span></span><span class="dim hint">↑↓ navigate · ↵ open · ⌘1–9 switch · esc close</span><!></div></div>`,xi=`b%b D%b b b%bDc%m`,Si=(e,t)=>{z(e.a,`value`,t),V(e.b,t)},Ci=(e,t)=>Si(e,t[0]),wi=(e,t)=>V(e.a,t),Ti=(e,t)=>wi(e,t[0]?.worktree),Ei=P(5,0,e=>{z(e.a,`title`,`${e._.r} open PR${e._.r===1?``:`s`}`),V(e.b,e._.r),V(e.c,e._.r===1?``:`s`)}),Di=Ei,Oi=P(6,0,e=>z(e.a,`title`,e._.o.map(e=>`:${e.port} ${e.cmd}`).join(`
|
|
3
|
-
`))),ki=e=>{Oi._(e),Ai._(e)},Ai=P(6,0,e=>V(e.b,e._.p)),ji=N(2,e=>z(e.a,`title`,`${e._.l} running session${e._.l===1?``:`s`}${e._.m?` — ${e._.m} working`:``}${e._.n?` — ${e._.n} waiting on you`:``}`),2),Mi=P(4,0,e=>{V(e.b,e._.l),ji(e)}),Ni=e=>{Mi._(e),Pi._(e),Fi._(e)},Pi=P(4,0,ji),Fi=P(4,0,ji),Ii=P(0,1,e=>V(e.a,e._.g)),Li=Ii,Ri=N(2,e=>V(e.b,e._.a3?`hide archived`:`archived (${e._.a6})`)),zi=P(5,0,Ri),Bi=L(`j8`,e=>A(e.a,`click`,function(){oo(e._,!e._.a3)})),Vi=e=>{zi._(e),Hi._(e),Bi(e)},Hi=P(5,0,Ri),Ui=N(1,e=>Ft(e,`a`,e._.o.preferredAgent,_o(e))),Wi=P(6,0,Ui),Gi=L(`j9`,e=>It(e,`a`)),Ki=e=>{Wi._(e),Ji._(e),Yi._(e),Gi(e)},qi=k(0,`<option> </option>`,` D `,0,Ci),Ji=P(6,0,e=>qi(e,[e._.z,e=>e])),Yi=P(6,0,Ui),Xi=L(`j5`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.q(e._._.h,e.e)})),Zi=e=>{e.b,hi(e.b,14),yi(e.b),Xi(e)},Qi=M(4,e=>{vi(e.b,e.e),V(e.c,e.e)}),$i=k(6,(e=>`<button>${e}<!></button>`)(ai),(e=>` D/${e}&%l`)(`b%c`),Zi,(e,t)=>Qi(e,t[0])),ea=I(48,e=>$i(e,[[...e._._.z||[],`shell`],e=>e]),e=>e._._),ta=(e,t)=>{z(e.e,`popovertarget`,t),z(e.g,`id`,t)},na=L(`j6`,e=>{A(e.a,`click`,function(t){t.stopPropagation(),e._._.m(e._.h)}),A(e.c,`click`,function(t){t.stopPropagation(),e._._.n(e._.h)}),A(e.e,`click`,function(e){e.stopPropagation()}),A(e.g,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,t.right-n.offsetWidth)}px`}})}),ra=e=>{ea(e),Kr(e.b),qr(e.b,13),Jr(e.b),Zr(e.d),Qr(e.d,13),$r(e.d),ni(e.f),ri(e.f,13),ii(e.f),ta(e,Qe(e)),na(e)},ia=O(2,`<span class="chip open">open</span>`),aa=N(18,e=>ia(e,e._.i===e._._.k?0:1)),oa=I(45,aa,e=>e._._),sa=e=>{oa(e),ua(e),fa._(e),pa._(e),ma._(e),_a._(e)},ca=(e,t)=>{ht(e.a,[`dot`,Ir(t)]),ya(e,t?.repos),xa(e,t?.agents),Sa(e,t?.working),Ca(e,t?.waiting),Ta(e,t?.ports)},la=N(19,e=>ca(e,e._._.y[e._.i])),ua=I(47,la,e=>e._._),da=O(3,`<span class=chip>archived</span>`),fa=P(0,2,e=>da(e,+!e._.f)),pa=P(0,2,e=>{la(e),aa(e)}),ma=P(0,2,e=>V(e.b,e._.j)),ha=k(7,`<span class=mono> </span>`,`D `,0,Ti),ga=N(10,e=>ha(e,[e.j||e._.k,`full_name`])),_a=P(0,2,ga),va=(e,t)=>Oa(e,t?.length),ya=M(9,e=>{va(e,(e.j||[]).flatMap(e=>e.prs||[])),ga(e)}),ba=O(4,`<span class="chip stat"> </span>`,` D `,Ni),xa=M(11,e=>{ba(e,+!e.l),Mi(e)}),Sa=M(12,Pi),Ca=M(13,Fi),wa=O(6,`<span class="chip stat">:<!></span>`,` Db%`,ki),Ta=M(14,e=>{Ea(e,e.o?.length),wa(e,+!(e.o||[]).length),Oi(e)}),Ea=M(15,Ai),Da=O(5,`<span class="chip stat"><!> PR<!></span>`,` D%c%`,Di),Oa=M(17,e=>{Da(e,+!e.r),Ei(e)}),ka=N(12,e=>gt(e.a,{hi:e.l===e._.ah,archived:e.e===`ws`&&e.f}),3),Aa=Ke(4,ka),ja=L(`j7`,e=>{A(e.a,`click`,function(){e._.ai(e.d)}),A(e.a,`mouseenter`,function(){ao(e._,e.l)})}),Ma=e=>{Aa._(e),ja(e)},Na=O(0,`<span class=row-name>+ New workspace</span>`,0,0,`<span class="row-name cmd-row">▸ <!></span>`,`Db%`,Li,`<span class=row-name><span></span><span class=row-name-text> </span><!><!><span class=row-stats><!><!><!></span></span><span class=row-repos></span>`,`D bD l%b%bD%b%b%m `,sa),Pa=O(1,((e,t,n)=>`<button class=row-more title="Review changes">${e}</button><button class=row-more title="Manage workspace">${t}</button><button class=row-more title="New session">${n}</button><div popover=auto class=new-session-pop></div>`)(Wr,Yr,ei),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l b`)(Gr,Xr,ti),ra),Fa=M(4,e=>{Na(e,e.e===`new`?0:e.e===`cmd`?1:2),Pa(e,e.e===`ws`?0:1),ka(e)}),Ia=M(5,e=>{ka(e),fa(e)}),La=M(11,ka),Ra=(e,t)=>{za(e,t[0]),La(e,t[1])},za=M(3,e=>{Fa(e,e.d?.kind),Ia(e,e.d?.archived),Ba(e,e.d?.label),Va(e,e.d?.ws)}),Ba=M(6,Ii),Va=M(7,e=>{Ha(e,e.h?.id),Ua(e,e.h?.name),Wa(e,e.h?.repos)}),Ha=M(8,pa),Ua=M(9,ma),Wa=M(10,_a),Ga=L(`j4`,e=>A(e.a,`click`,function(){e._.v?.()})),Ka=k(4,`<li><div class=row-wrap><button class=row></button><!></div></li>`,`E b%`,Ma,Ra),qa=N(40,L(`j12`,e=>Et(e,{onMount:function(){let t=new AbortController,n=e.ad.findIndex(t=>t.kind===`ws`&&t.ws.id===e.k);n>=0&&ao(e,n),setTimeout(()=>e.d?.focus(),0);let r=t.signal;return document.addEventListener(`keydown`,t=>{document.querySelector(`:popover-open`)||t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())},{capture:!0,signal:r}),{abort:t}},onDestroy:function(){this.abort.abort()}})),3),Ja=M(39,e=>{yee(e,e.ad.length),Ka(e,[e.ad,e=>e.kind===`new`?`new`:e.kind===`cmd`?`cmd:${e.label}`:e.ws.id]),qa(e)}),Ya=N(38,e=>Ja(e,[...e.a8(e.a4).map(e=>({kind:`ws`,ws:e})),...e.a3||e.a1?e.a8(e.a5).map(e=>({kind:`ws`,ws:e,archived:!0})):[],...e.ab,{kind:`new`}]),5),Xa=M(34,Ya),Za=M(37,Ya),Qa=N(36,e=>Za(e,!e.a1||!e.a9?[]:[{kind:`cmd`,label:`Review changes — ${e.a9?.name}`,run:()=>e.m(e.a9)},{kind:`cmd`,label:`Manage workspace — ${e.a9?.name}`,run:()=>e.n(e.a9)},{kind:`cmd`,label:`New ${e.p||`agent`} session — ${e.a9?.name}`,run:()=>e.q(e.a9,e.p||`claude`)}].filter(t=>t.kind===`cmd`&&Fr(e.a1,t.label))),5),$a=O(5,`<button class="archived-link dim"> </button>`,` D `,Vi),eo=N(33,e=>$a(e,e.a6&&!e.a1?0:1)),to=j(27,e=>{jt(e,`d`,e.a1,yo(e)),Xa(e,vo(e)),Qa(e),Ya(e),eo(e)}),no=L(`j11`,e=>e.e.children[e.ah]?.scrollIntoView({block:`nearest`})),ro=M(43,e=>{Aa(e),no(e)}),io=N(42,e=>ro(e,Math.min(e.a2,e.af-1))),ao=j(28,io),oo=j(29,e=>{Ya(e),zi(e)}),so=L(`j10`,e=>{Mt(e,`d`),A(e.d,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),ao(e,Math.min(e.ah+1,e.ad.length-1))):t.key===`ArrowUp`?(t.preventDefault(),ao(e,Math.max(e.ah-1,0))):t.key===`Enter`?(t.preventDefault(),e.ai(e.ad[e.ah])):t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())})});function co(e){to(e,``),ao(e,0),oo(e,!1),so(e)}var lo=M(30,Ya),uo=M(31,e=>{fee(e,e.a5?.length),Ya(e)}),fo=M(35,Qa),po=N(11,e=>fo(e,e.j.find(t=>t.id===e.k))),mo=M(9,e=>{Dee(e,e.j?.length),lo(e,e.j.filter(e=>e.status===`active`)),uo(e,e.j.filter(e=>e.status===`archived`)),po(e)}),fee=M(32,e=>{eo(e),Hi(e)}),pee=F(oa),mee=M(10,e=>{po(e),qa(e),pee(e)}),hee=M(12,Qa),gee=M(13,Qa),_ee=M(15,Qa),vee=M(16,Qa),yee=M(41,io),bee=M(44),ho=N(19,e=>bee(e,bo(e))),xee=M(17,ho),See=M(18,ho),Cee=O(0,`<div class=palette-backdrop></div>`,` `,Ga),wee=O(2,`<div class="onboard dim"><p>A <strong>workspace</strong> checks out one or more repos as git worktrees on a shared branch and gives each agent session its own terminal. Create one to get started.</p><p>Pick your preferred agent below — new sessions and the quick-create button use it. GitHub access uses your <code>gh</code> login.</p></div>`),go=N(23,e=>wee(e,e.u&&!e.w?0:1)),Tee=M(20,e=>{B(e.b,`inline`,e.u),Cee(e,+!!e.u),qa(e),go(e)}),Eee=M(21,qa),Dee=M(22,go),Oee=O(6,`<label class=dim><select aria-label="Preferred agent"></select></label>`,`D `,Ki),kee=M(14,e=>{_ee(e,e.o?.preferredAgent),jee(e,e.o?.agents),Oee(e,+!e.o),Wi(e)}),Aee=F(ea),jee=M(25,e=>{Aee(e),Ji(e)}),Mee=M(24,F(ua)),Nee=M(26,Yi);function _o(e){return function(t){e._.a0({...e._.o,preferredAgent:t}),H(`/api/settings`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({preferredAgent:t})}).catch(()=>{})}}function vo(e){return t=>t.filter(t=>Fr(e.a1,t.name))}function yo(e){return function(t){to(e,t),ao(e,0)}}function bo(e){return t=>{t&&(t.kind===`new`?e.r():t.kind===`cmd`?t.run():e.s(t.ws))}}R(`j1`,_o),R(`j2`,vo),R(`j0`,yo),R(`j3`,bo);var xo=Rr,So=(e=>`/${e}&`)(zr);function Co(e){Ur(e.a,`M21.8883 13.5C21.1645 18.3113 17.013 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C16.1006 2 19.6248 4.46819 21.1679 8 M17 8H21.4C21.7314 8 22 7.73137 22 7.4V3`)}var wo=(e,t)=>Vr(e.a,t),To=(e,t)=>Hr(e.a,t),Eo=`<div class=add-repo><input placeholder="Add a repo…" aria-label="Add a repo"><!><!></div>`,Do=`D b%b%l`,Oo=null,ko=L(`l7`,e=>A(e.a,`click`,function(){e._._._._._.z(e._._._.i,e.d)})),Ao=M(3,e=>V(e.b,e.d)),jo=(e,t)=>Ao(e,t[0]),Mo=I(33,e=>jt(e,`a`,e._._._._._.y,Ls(e)),e=>e._._._._._),No=L(`l6`,e=>Mt(e,`a`)),Po=e=>{Mo(e),No(e)},Fo=k(1,`<li><button class=result-row><span class="repo-name mono"> </span></button></li>`,`D E `,ko,jo),Io=(e,t)=>{Wo(e,t?.length),Fo(e,[t,e=>e])},Lo=N(5,e=>Io(e,(e._._._._.y?e._._._._.w.filter(t=>t.toLowerCase().includes(e._._._._.y.toLowerCase())):e._._._._.w).slice(0,12))),Ro=I(31,Lo,e=>e._._._._),zo=e=>{Ro(e),Vo(e),Ho(e)},Bo=O(0,`<input placeholder="Filter branches…" aria-label="Filter branches" autofocus>`,` `,Po),Vo=I(32,e=>Bo(e,e._._._._.x>8?0:1),e=>e._._._._),Ho=I(33,Lo,e=>e._._._._),Uo=O(2,`<li><p class="dim empty-note">No branches match.</p></li>`),Wo=(e,t)=>Uo(e,+!!t),Go=O(0,`<p class="dim empty-note"><span class=spin></span> Loading branches…</p>`,0,0,`<!><!><ul class=branch-list><!><!></ul>`,`b%bD%b%`,zo),Ko=I(31,e=>Go(e,+!!e._._._.w),e=>e._._._),qo=Ko,Jo=N(11,e=>B(e.a,`hi`,e.k===e._._.p)),Yo=I(28,Jo,e=>e._._),Xo=L(`l8`,e=>{A(e.a,`mouseenter`,function(){gs(e._._,e.k)}),A(e.b,`click`,function(){e._._.z(e.i)}),A(e.e,`click`,function(){e._._.a0(e.i)})}),Zo=e=>{Yo(e),es(e),ni(e.c),ri(e.c,12),ii(e.c,`result-plus`),Xo(e)},Qo=O(5,`<div class=branch-pick></div>`,` `,qo),$o=N(9,e=>{B(e.e,`on`,e._._.u===e.i),Qo(e,e._._.u===e.i?0:1)}),es=I(30,$o,e=>e._._),ts=M(10,Jo),ns=M(8,e=>{V(e.d,e.i),z(e.e,`title`,`Pick a base branch for ${e.i}`),z(e.e,`aria-label`,`Pick a base branch for ${e.i}`),$o(e)}),rs=k(0,(e=>`<li><div class=result-wrap><button class=result-row>${e}<span class=repo-name> </span></button><button class=result-branch>⎇</button></div><!></li>`)(ei),(e=>`D D D/${e}&D m l%l`)(ti),Zo,(e,t)=>{ns(e,t[0]?.nameWithOwner),ts(e,t[1])}),is=P(2,0,e=>rs(e,[e._.r,`nameWithOwner`])),as=is,os=P(2,1,e=>V(e.a,e._.m)),ss=os,cs=M(17,e=>{js(e,e.r?.length),is(e)}),ls=N(14,e=>cs(e,e.l&&e.m?dee(e.m,e.l?.repos,t=>e.i.has(t)):[]),2),us=O(1,`<p class="dim empty-note">Loading repos…</p>`),ds=N(13,e=>us(e,e.m&&!e.l?0:1)),fs=O(2,`<ul class=repo-results></ul>`,` `,as,`<p class="dim empty-note">No repos match "<!>".</p>`,`Db%`,ss),ps=N(19,e=>fs(e,e.s?0:e.m&&e.l?1:2),2),ms=j(11,e=>{ls(e),ds(e),ps(e)}),hs=j(12,e=>{jt(e,`a`,e.m,Rs(e)),ls(e),ds(e),ps(e),os(e)}),gs=j(15,F(Yo)),_s=M(26),vs=N(21,e=>_s(e,zs(e))),ys=F(es),bs=j(20,e=>{vs(e),ys(e)}),xs=F(Ko,Ro),Ss=j(22,e=>{Ns(e,e.w?.length),xs(e)}),Cs=j(24,F(Ho,Mo)),ws=L(`l9`,e=>{Mt(e,`a`),A(e.a,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),gs(e,Math.min(e.p+1,e.r?.length-1))):t.key===`ArrowUp`?(t.preventDefault(),gs(e,Math.max(e.p-1,0))):t.key===`Enter`?(t.preventDefault(),e.r[e.p]&&e.z(e.r[e.p].nameWithOwner)):t.key===`Escape`&&e.m&&(t.preventDefault(),hs(e,``))})});function Ts(e){ms(e,null),hs(e,``),gs(e,0),bs(e,null),Ss(e,null),Cs(e,``),ws(e)}var Es=L(`l10`,e=>Et(e,{onMount:function(){Oo&&ms(e,Oo),e.q(!1)}})),Ds=M(16,e=>{x(e,Bs(e)),Es(e)}),Os=N(7,e=>Ds(e,Vs(e))),ks=M(5,Os),As=M(6,e=>{Os(e),vs(e)}),js=M(18,ps),Ms=M(8,ls),Ns=M(23,F(Vo)),Ps=M(25),Fs=M(9,e=>Ps(e,Hs(e))),Is=(e,t)=>z(e.a,`disabled`,t);function Ls(e){return t=>{Cs(e._._._._._,t)}}function Rs(e){return function(t){hs(e,t),gs(e,0)}}function zs(e){return async t=>{if(e.u===t){bs(e,null);return}bs(e,t),Ss(e,null),Cs(e,``);try{let n=await H(`/api/repos/branches?repo=${encodeURIComponent(t)}`);e.u===t&&Ss(e,n.branches)}catch(t){bs(e,null),e.g?.(String(t.message||t))}}}function Bs(e){return()=>e.q(!0)}function Vs(e){return async t=>{t&&e.f?.(!0);try{let n=await H(`/api/repos${t?`?refresh`:``}`);Oo=n,ms(e,n)}catch(t){e.g?.(String(t.message||t))}t&&e.f?.(!1)}}function Hs(e){return(t,n)=>{hs(e,``),bs(e,null),e.j(t,n)}}R(`l1`,Ls),R(`l0`,Rs),R(`l5`,zs),R(`l2`,Bs),R(`l3`,Vs),R(`l4`,Hs);var Us=`<div class=manage-backdrop></div><div role=dialog><div class=manage><!></div><!></div>`,Ws=` b E%l%l`,Gs=de(2),Ks=L(`h0`,e=>A(e.a,`click`,function(){e._.h?.()})),qs=ue(0),Js=P(3,0,e=>qs(e,e._.n)),Ys=Js,Xs=N(15,L(`h1`,e=>Et(e,{dismissable:e.o,onMount:function(){let t=new AbortController;return window.addEventListener(`keydown`,t=>{t.key!==`Escape`||!this.dismissable||t.target instanceof Element&&t.target.closest(`.palette:not(.inline)`)||t.target instanceof HTMLInputElement&&t.target.value||e.h?.()},{capture:!0,signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),Zs=M(14,Xs),Qs=(e,t)=>Zs(e,t!==!1),$s=L(`h2`,e=>A(e.a,`click`,function(){e.o&&e.h?.()})),ec=(e,t)=>ht(e.b,[`manage-view`,t]),tc=(e,t)=>z(e.b,`aria-label`,t),nc=O(3,`<div class=manage-bar><!></div>`,`D%`,Ys,`<div class=manage-bar><button class="btn primary">Done</button></div>`,`D `,Ks),rc=N(12,e=>nc(e,e.l?0:e.h?1:2)),ic=M(7,e=>{rc(e),Xs(e)}),ac=M(11,e=>{oc(e,e.l?.content),rc(e)}),oc=M(13,Js),sc=Us,cc=(e=>`/${e}&`)(Ws),lc=new Map,uc=M(3,e=>{z(e.a,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.d}`),V(e.b,e.d)}),dc=L(`g24`,e=>A(e.a,`click`,function(){window.open(`http://${location.hostname}:${e.d}`,`_blank`,`noopener`)})),fc=(e,t)=>uc(e,t[0]),pc=(e,t)=>V(e.a,t),mc=(e,t)=>pc(e,t[0]),hc=P(2,0,e=>V(e.a,e._.j)),gc=hc,_c=P(0,0,e=>V(e.a,e._.e)),vc=_c,yc=(e,t)=>z(e.a,`title`,t),bc=(e,t)=>V(e.b,t),xc=k(2,`<button class="chip port-link">:<!></button>`,` Db%`,dc,fc),Sc=(e,t)=>xc(e,[t,e=>String(e)]),Cc=M(9,e=>z(e.d,`title`,`Kill ${e.j}`)),wc=L(`g25`,e=>A(e.d,`click`,function(){e._._._.ag(e.j)})),Tc=(e,t)=>{yc(e,t[0]?.args),bc(e,t[0]?.cmd),Sc(e,t[0]?.ports),Cc(e,t[0]?.pid)},Ec=P(6,0,e=>z(e.a,`title`,`Confirm #${e._.p} is done — remove from this list`)),Dc=L(`g20`,e=>A(e.a,`click`,function(){e._._._._._.a8(e._._.g,e._.p)})),Oc=O(6,`<button class=pr-dismiss>✓</button>`,` `,e=>{Ec._(e),Dc(e)}),kc=N(11,e=>V(e.b,e.j===`OPEN`&&e.k?`draft`:e.j.toLowerCase())),Ac=O(2,`<span class="pr-state open" title=Approved>✓</span>`,0,0,`<span class="pr-state closed" title="Changes requested">✗</span>`),jc=N(13,e=>Ac(e,e.j===`OPEN`&&e.m===`APPROVED`?0:e.j===`OPEN`&&e.m===`CHANGES_REQUESTED`?1:2)),Mc=M(9,e=>{ht(e.a,[`pr-state`,e.j.toLowerCase()]),Oc(e,+(e.j===`OPEN`)),kc(e),jc(e)}),Nc=M(10,kc),Pc=M(12,jc),Fc=(e,t)=>z(e.d,`href`,t),Ic=M(15,e=>{V(e.e,e.p),Ec(e)}),Lc=(e,t)=>V(e.f,t),Rc=(e,t)=>{Mc(e,t[0]?.state),Nc(e,t[0]?.isDraft),Pc(e,t[0]?.reviewDecision),Fc(e,t[0]?.url),Ic(e,t[0]?.number),Lc(e,t[0]?.title)},zc=P(0,0,e=>V(e.b,e._.e)),Bc=L(`g19`,e=>A(e.a,`click`,function(){e._._._.a7()})),Vc=e=>{zc._(e),Bc(e)},Hc=I(54,e=>V(e.a,e._._.s),e=>e._._),Uc=Hc,Wc=N(2,e=>{B(e.a,`armed`,e._._._.r===e._.h),V(e.b,e._._._.r===e._.h?`remove?`:`×`)}),Gc=N(3,e=>z(e.a,`title`,e._._._.r===e._.h?`Really remove ${e._.g}/? Uncommitted changes are lost.`:`Remove ${e._.g}/`),2),Kc=I(53,e=>{Wc(e),Gc(e)},e=>e._._._),qc=L(`g22`,e=>A(e.a,`click`,function(){e._._._.r===e._.f?.full_name?(Pu(e._._._,null),e._._._.ae(e._.f)):(Pu(e._._._,e._.f?.full_name),setTimeout(()=>{Pu(e._._._,null)},4e3))})),Jc=e=>{Kc(e),Yc._(e),Xc._(e),qc(e)},Yc=P(3,1,Gc),Xc=P(3,1,e=>{Wc(e),Gc(e)}),Zc=I(51,e=>z(e.a,`disabled`,!!e._._.p),e=>e._._),Qc=L(`g16`,e=>A(e.a,`click`,function(){e._._.af(`restore`)})),$c=e=>{Zc(e),Qc(e)},el=I(51,e=>{z(e.a,`disabled`,!!e._._.p),V(e.b,e._._.p===`archive`?`Archiving…`:`Archive`)},e=>e._._),tl=L(`g15`,e=>A(e.a,`click`,function(){e._._.af(`archive`)})),nl=e=>{el(e),tl(e)},rl=I(50,e=>V(e.a,e._._._.o),e=>e._._._),il=dt(`g18`,` `,` `,rl),al=e=>{Ar(e.a,il(e)),Er(e.a,`inline`),Pr(e.a,fd(e)),Cr(e.a),Or(e.a),Nr(e.a)},ol=O(3,`<span class=spin></span>`,0,0,`<button class=cur-remove> </button>`,` D `,Jc),sl=N(8,e=>ol(e,+!e._._.m.has(e.h))),cl=I(48,sl,e=>e._._),ll=cl,ul=M(6,e=>{V(e.a,e.g),Yc(e)}),dl=M(7,e=>{V(e.b,e.h),sl(e),Xc(e)}),fl=O(2,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,gc),pl=N(11,e=>fl(e,+(e.j===e.k))),ml=M(9,e=>{pl(e),hc(e)}),hl=M(10,pl),gl=(e,t)=>_l(e,t[0]),_l=M(5,e=>{ul(e,e.f?.worktree),dl(e,e.f?.full_name),ml(e,e.f?.base_branch),hl(e,e.f?.default_branch)}),vl=O(0,`<div class="pr-repo-name mono dim"> </div>`,`D `,vc),yl=I(46,e=>vl(e,e._._._.k>1?0:1),e=>e._._._),bl=yl,xl=k(1,`<li><span> </span><!><a class=pr-link target=_blank rel=noopener><span class="dim mono">#<!></span> </a><span class=pr-spacer></span><!></li>`,`D D l%b Eb%l lb%`,0,Rc),Sl=(e,t)=>xl(e,[t,`number`]),Cl=(e,t)=>{wl(e,t[0]?.worktree),Sl(e,t[0]?.prs),Tl(e,t[0]?.full_name)},wl=M(4,_c),Tl=M(6),El=O(0,`<button class=btn title="Confirm every merged/closed PR is done — remove them from this list">Clear <!> finished</button>`,` Db%`,Vc),Dl=M(4,e=>{El(e,+!e.e),zc(e)}),Ol=k(3,`<div class=pr-repo><!><ul class=pr-list></ul></div>`,`D%b `,bl,Cl),kl=I(45,e=>{Dl(e,(e._._.j||[]).reduce((e,t)=>e+t.prs.filter(e=>e.state!==`OPEN`).length,0)),Ol(e,[e._._.j.filter(e=>e.prs.length),`full_name`])},e=>e._._),Al=L(`g21`,e=>A(e.b,`click`,function(){e._._.a6()})),jl=e=>{kl(e),Ml(e),Co(e.c),wo(e.c,13),To(e.c),Al(e)},Ml=I(47,e=>{B(e.b,`spinning`,e._._.l),z(e.b,`disabled`,e._._.l)},e=>e._._),Nl=k(0,`<li><span class="mono proc-cmd"><!><!></span><button class=proc-kill>×</button></li>`,`D D%b%l `,wc,Tc),Pl=I(44,e=>Nl(e,[e._._.i,`pid`]),e=>e._._),Fl=Pl,Il=et(12),Ll=I(43,e=>{B(e.e,`spinning`,e._.h),z(e.e,`disabled`,e._.h)}),Rl=L(`g26`,e=>A(e.e,`click`,function(){Il(e)()})),zl=e=>{Ll(e),Vl(e),Ul(e),Kl(e),Yl(e),Zl(e),$l(e),eu(e),nu(e),ru(e),iu(e),au(e),ou(e),Co(e.f),wo(e.f,13),To(e.f),Ze(e,9,su),Ts(e.j),As(e.j,md(e)),ks(e.j,pd(e)),Is(e.j),Rl(e)},Bl=O(11,`<section><h3>Processes</h3><ul class=procs></ul></section>`,`Db `,Fl),Vl=I(44,e=>Bl(e,e._.i&&e._.i?.length?0:1)),Hl=O(3,(e=>`<section><div class=repos-head><h3>Pull requests</h3><!><button class=icon-btn title="Refresh PRs">${e}</button></div><!></section>`)(xo),(e=>`Eb%b D/${e}&m%l`)(So),jl),Ul=I(45,e=>Hl(e,e._.j&&e._.j.some(e=>e.prs.length)?0:1)),Wl=k(7,`<li class="cur-repo pending"><span class=spin></span><span class="dim cur-full"> </span></li>`,`DbD `,0,mc),Gl=N(13,e=>Wl(e,[[...e._.m].filter(t=>!e._.a9.has(t)),e=>e])),Kl=I(48,Gl),ql=O(8,`<li class="dim empty-note">No repos yet — search below to add one.</li>`),Jl=N(14,e=>ql(e,!e._.a1&&!e._.n?0:1)),Yl=I(49,Jl),Xl=O(2,sr,(e=>`/${e}&`)(cr),al),Zl=I(50,e=>Xl(e,+!e._.o)),Ql=k(6,`<li class=cur-repo><span class="mono cur-worktree"><!>/</span><span class="dim cur-full"> </span><!><!></li>`,`E%lD l%b%`,ll,gl),$l=I(55,e=>Ql(e,[e._.w,`full_name`])),eu=I(56,e=>V(e.a,e._.x)),tu=N(15,e=>V(e.b,e._.z||e._.a0)),nu=I(58,tu),ru=I(59,tu),iu=I(60,Jl),au=I(61,e=>{Ms(e.j,e._.a9),Gl(e)}),ou=I(62,e=>Fs(e.j,hd(e))),su=it(`g23`,M(12)),cu=ut(`g28`,((e,t)=>`<header class=manage-head><div><h2> </h2><p class="dim mono"> </p></div></header><!><!><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!><!></ul>${t}</section><!><!>`)(xo,Eo),((e,t)=>`F lD n%b%bEb D/${e}&mD%b%b%l0${t}&l%c`)(So,Do),zl,0,`B2`),lu=O(1,`<span class="act-step dim"><span class=spin></span> </span>`,`Db `,Uc),uu=N(6,e=>lu(e,e._.p&&e._.s?0:1)),du=N(5,e=>V(e.e,e._.p===`delete`?`Deleting…`:e._.q?`Really delete?`:`Delete`)),fu=I(51,e=>{z(e.a,`disabled`,!!e._.p),z(e.d,`disabled`,!!e._.p),uu(e),du(e)}),pu=L(`g17`,e=>{A(e.a,`click`,function(){e._.g?.()}),A(e.d,`click`,function(){e._.q?(Nu(e._,!1),e._.af(`delete`)):(Nu(e._,!0),setTimeout(()=>{Nu(e._,!1)},4e3))})}),mu=e=>{fu(e),hu(e),gu(e),vu(e),pu(e)},hu=I(52,e=>{B(e.d,`armed`,e._.q),du(e)}),gu=I(54,uu),_u=O(2,`<button class=btn> </button>`,` D `,nl,`<button class=btn>Restore</button>`,` `,$c),vu=I(57,e=>_u(e,e._.y===`active`?0:1)),yu=dt(`g27`,`<button class="btn primary">Done</button><!><div class=spacer></div><!><button class="btn danger"> </button>`,` b%c%b D `,mu),bu=j(7,F(Ll)),xu=j(11,F(Ml)),Su=M(39,F(ou)),Cu=N(38,e=>Su(e,gd(e)),3),wu=M(40),Tu=N(37,e=>wu(e,_d(e)),3),Eu=M(36,e=>{Cu(e),Tu(e)}),Du=F(Kl,cl),Ou=j(12,e=>{Gu(e,e.m?.size),Eu(e,vd(e)),Cu(e),Tu(e),Du(e)}),ku=j(14,F(Zl,rl)),Au=N(31,L(`g29`,e=>Et(e,{busyCount:e.n,pendingAction:e.p,onMount:function(){let t=new AbortController,n=t.signal;return Cn().addEventListener(`workspace.progress`,t=>{(this.pendingAction||this.busyCount)&&t.data?.message&&t.data.op===e.u&&Fu(e,t.data.message)},{signal:n}),e.a2(n),e.a3(n,!1).then(()=>e.a3(n,!0)),{abort:t}},onDestroy:function(){this.abort.abort()}})),4),ju=F(fu,el,Zc),Mu=j(15,e=>{Au(e),ju(e)}),Nu=j(16,F(hu)),Pu=j(17,F(Kc)),Fu=j(18,F(gu,Hc));function Iu(e){$s(e.a),ac(e.a,tn({content:yu(e)})),Gs(e.a,cu(e)),Qs(e.a),ec(e.a),bu(e,!1),xu(e,!1),Ou(e,new Set),ku(e,null),Mu(e,null),Nu(e,!1),Pu(e,null),Fu(e,null)}var Lu=j(8,F(Vl,Pl)),Ru=M(33),zu=N(30,e=>Ru(e,yd(e)),2),Bu=F(Ul,kl),Vu=j(9,e=>{Uu(e,e.j?.length),zu(e),Bu(e)}),Hu=(e,t)=>{Lu(e,lc.get(`procs:${t}`)||null),Vu(e,lc.get(`prs:${t}`)||null)},Uu=M(10,F(yl)),Wu=F(Yl),Gu=M(13,e=>{Au(e),Wu(e)}),Ku=M(19,e=>{$u(e,e.t?.id),nd(e,e.t?.repos),ad(e,e.t?.name),od(e,e.t?.status),sd(e,e.t?.display_path),cd(e,e.t?.path),Tu(e)}),qu=M(42),Ju=M(28,e=>{qu(e,bd(e)),Au(e)}),Yu=M(32),Pee=M(29,e=>{Yu(e,Sd(e)),Au(e),zu(e)}),Xu=M(34),Zu=M(41),Qu=N(21,e=>Zu(e,Td(e))),$u=M(20,e=>{Ju(e,xd(e)),Pee(e,Cd(e)),Xu(e,wd(e)),Au(e),zu(e),Cu(e),Qu(e)}),ed=M(35,F(au)),td=F($l),nd=M(22,e=>{rd(e,e.w?.length),ed(e,new Set(e.w.map(e=>e.full_name))),td(e)}),rd=M(27,F(iu)),id=F(eu),ad=M(23,e=>{tc(e.a,`Manage ${e.x}`),id(e)}),od=M(24,F(vu)),sd=M(25,F(nu)),cd=M(26,F(ru)),ld=(e,t)=>{Hu(e,t?.id),Ku(e,t)},ud=M(5,e=>{Cu(e),Tu(e)}),dd=M(6,e=>{ic(e.a,Ed(e)),Qu(e)});function fd(e){return function(){ku(e._._,null)}}function pd(e){return function(t){bu(e._,t)}}function md(e){return function(t){ku(e._,t)}}function hd(e){return function(t,n){e._.ad(t,n)}}function gd(e){return async(t,n)=>{if(!(!t||e.m.has(t))){ku(e,null),e.aa(t,!0);try{let r=await H(`/api/workspaces/${e.u}/repos`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,baseBranch:n})});e.f?.(r)}catch(t){ku(e,String(t.message||t))}e.aa(t,!1)}}}function _d(e){return async t=>{if(!e.m.has(t.full_name)){ku(e,null),e.aa(t.full_name,!0);try{await H(`/api/workspaces/${e.t?.id}/repos/${encodeURIComponent(t.worktree)}`,{method:`DELETE`}),e.f?.({...e.t,repos:(e.t?.repos).filter(e=>e.full_name!==t.full_name)})}catch(t){ku(e,String(t.message||t))}e.aa(t.full_name,!1)}}}function vd(e){return(t,n)=>{let r=new Set(e.m);n?r.add(t):r.delete(t),Ou(e,r)}}function yd(e){return async()=>{for(let t of e.j||[])for(let n of t.prs)n.state!==`OPEN`&&await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t.full_name,number:n.number})}).catch(()=>{});await e.a3(void 0,!1)}}function bd(e){return async t=>{await fetch(`/api/procs/${t}`,{method:`DELETE`}),setTimeout(()=>e.a2(void 0),500)}}function xd(e){return async t=>{try{let n=await H(`/api/workspaces/${e.u}/procs`,{signal:t});Lu(e,n),lc.set(`procs:${e.u}`,n)}catch{}}}function Sd(e){return async()=>{xu(e,!0),await e.a3(void 0,!0),xu(e,!1)}}function Cd(e){return async(t,n)=>{try{let r=await H(`/api/workspaces/${e.u}/prs${n?`?refresh`:``}`,{signal:t});Vu(e,r),lc.set(`prs:${e.u}`,r)}catch{}}}function wd(e){return async(t,n)=>{ku(e,null);try{let r=await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,number:n})});Vu(e,r),lc.set(`prs:${e.u}`,r)}catch(t){ku(e,String(t.message||t))}}}function Td(e){return async t=>{ku(e,null),Mu(e,t),Fu(e,null);try{await H(`/api/workspaces/${e.u}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:t})}),t===`delete`&&e.g?.()}catch(t){ku(e,String(t.message||t))}finally{Mu(e,null),Fu(e,null)}}}function Ed(e){return function(){e.g?.()}}R(`g11`,fd),R(`g14`,pd),R(`g13`,md),R(`g12`,hd),R(`g6`,gd),R(`g7`,_d),R(`g5`,vd),R(`g3`,yd),R(`g9`,bd),R(`g0`,xd),R(`g2`,Sd),R(`g1`,Cd),R(`g4`,wd),R(`g8`,Td),R(`g10`,Ed);var Dd=Us,Od=(e=>`/${e}&`)(Ws),kd=P(1,0,e=>V(e.a,e._.g)),Ad=kd,jd=O(1,`<span class=spin></span>`,0,0,`<span class=step-done>✓</span>`),Md=I(30,e=>{B(e.a,`active`,e.M===e._._._.m-1),jd(e,e.M===e._._._.m-1?0:1)},e=>e._._._),Nd=Md,Pd=(e,t)=>V(e.c,t),Fd=k(0,`<li><!><!></li>`,` D%b%`,Nd,(e,t)=>Pd(e,t[0])),Id=I(29,e=>Fd(e,[e._._.l]),e=>e._._),Ld=Id,Rd=I(28,e=>V(e.a,e._._._.k),e=>e._._._),zd=dt(`i11`,` `,` `,Rd),Bd=e=>{Ar(e.a,zd(e)),Er(e.a,`inline`),Pr(e.a,Wf(e)),Cr(e.a),Or(e.a),Nr(e.a)},Vd=I(27,e=>z(e.c,`disabled`,e._._.j),e=>e._._),Hd=L(`i12`,e=>A(e.c,`click`,function(){e._._.v(e.f)})),Ud=e=>{Vd(e),Hd(e)},Wd=M(5,e=>{V(e.a,e.f),z(e.c,`title`,`Remove ${e.f}`)}),Gd=O(1,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,Ad),Kd=M(6,e=>{Gd(e,+!e.g),kd(e)}),qd=(e,t)=>{Wd(e,t[0]?.fullName),Kd(e,t[0]?.baseBranch)},Jd=et(9),Yd=I(23,e=>jt(e,`b`,e._.f,Gf(e))),Xd=L(`i14`,e=>{Mt(e,`b`),A(e.c,`click`,function(){Jd(e)()})}),Zd=e=>{Yd(e),Qd(e),ef(e),nf(e),of(e),cf(e),lf(e),uf(e),Co(e.d),wo(e.d,13),To(e.d),Ze(e,6,df),Ts(e.g),As(e.g,qf(e)),ks(e.g,Kf(e)),Xd(e)},Qd=I(24,e=>{B(e.c,`spinning`,e._.g),z(e.c,`disabled`,e._.g)}),$d=k(4,`<li class=cur-repo><span class=cur-full> </span><!><button class=cur-remove>×</button></li>`,`E l%b `,Ud,qd),ef=I(25,e=>{Ms(e.g,new Set(e._.h.map(e=>e.fullName))),$d(e,[e._.h,`fullName`])}),tf=O(5,`<li class="dim empty-note">No repos yet — search below to add one (or create empty).</li>`),nf=I(26,e=>tf(e,+!!e._.i)),rf=O(8,`<ul class=steps></ul>`,` `,Ld),af=N(10,e=>rf(e,e._.j&&e._.m?0:1)),of=I(27,e=>{z(e.b,`disabled`,e._.j),Is(e.g,e._.j),af(e)}),sf=O(0,sr,(e=>`/${e}&`)(cr),Bd),cf=I(28,e=>sf(e,+!e._.k)),lf=I(30,af),uf=I(31,e=>Fs(e.g,Jf(e))),df=it(`i13`,M(9)),ff=ut(`i16`,((e,t)=>`<header class=manage-head><div><h2>New workspace</h2></div></header><!><label class=field><span>Name</span><input placeholder=my-feature autofocus></label><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!></ul>${t}</section><!><!>`)(xo,Eo),((e,t)=>`b%bDb lEb D/${e}&mD%b%l0${t}&l%c`)(So,Do),Zd,0,`B2`),pf=N(3,e=>z(e.a,`disabled`,e._.j||!e._.f.trim())),mf=I(23,pf),hf=L(`i10`,e=>{A(e.a,`click`,function(){e._.w()}),A(e.c,`click`,function(){e._.e?.()})}),gf=e=>{mf(e),_f(e),hf(e)},_f=I(27,e=>{V(e.b,e._.j?`Creating…`:`Create workspace`),z(e.c,`disabled`,e._.j),pf(e)}),vf=dt(`i15`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,gf),yf=M(22),bf=N(19,e=>yf(e,Yf(e)),5),xf=F(mf,Yd),Sf=j(5,e=>{bf(e),xf(e)}),Cf=j(6,F(Qd)),wf=M(20,F(uf)),Tf=M(21),Ef=F(ef),Df=j(7,e=>{Rf(e,e.h?.length),wf(e,Xf(e)),Tf(e,Zf(e)),bf(e),Ef(e)}),Of=N(18,L(`i17`,e=>Et(e,{busy:e.j,onMount:function(){let t=new AbortController;return Cn().addEventListener(`workspace.progress`,t=>{this.busy&&t.data?.message&&e.r([t.data])},{signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),kf=F(_f,of,Vd),Af=j(9,e=>{Qs(e.a,!e.j),Of(e),kf(e)}),jf=j(10,F(cf,Rd)),Mf=M(17,e=>{Of(e),bf(e)}),Nf=N(16,e=>Mf(e,Qf(e)),2),Pf=F(Id),Ff=j(11,e=>{zf(e,e.l?.length),Nf(e),Pf(e)}),If=(e,t)=>{Bf(e,t.op),Vf(e,t.last)};function Lf(e){$s(e.a),ac(e.a,tn({content:vf(e)})),Gs(e.a,ff(e)),tc(e.a,`New workspace`),ec(e.a,`new-ws`),Sf(e,``),Cf(e,!1),Df(e,[]),Af(e,!1),jf(e,null),Ff(e,[]),If(e,{last:0,op:``})}var Rf=M(8,F(nf)),zf=M(12,F(lf,Md)),Bf=M(14,e=>{Nf(e),bf(e)}),Vf=M(15,e=>{Nf(e),bf(e)}),Hf=M(3,bf),Uf=M(4,e=>ic(e.a,$f(e)));function Wf(e){return function(){jf(e._._,null)}}function Gf(e){return t=>{Sf(e._,t)}}function Kf(e){return function(t){Cf(e._,t)}}function qf(e){return function(t){jf(e._,t)}}function Jf(e){return function(t,n){e._.u(t,n)}}function Yf(e){return async()=>{Af(e,!0),jf(e,null),Ff(e,[]),e.o=Math.random().toString(36).slice(2,10);try{e.p=(await H(`/api/progress`)).seq}catch{}let t=setInterval(async()=>{try{let t=await H(`/api/progress?since=${e.p}&op=${e.o}`);e.r(t.messages)}catch{}},800);try{let t=await H(`/api/workspaces`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:e.f,repos:e.h,opId:e.o})});Af(e,!1),e.d?.(t)}catch(t){Af(e,!1),jf(e,String(t.message||t))}finally{clearInterval(t)}}}function Xf(e){return(t,n)=>{!t||e.h.some(e=>e.fullName===t)||Df(e,e.h.concat({fullName:t,baseBranch:n}))}}function Zf(e){return t=>{Df(e,e.h.filter(e=>e.fullName!==t))}}function Qf(e){return t=>{for(let n of t)n.op===e.o&&(n.seq&&n.seq<=e.p||(n.seq&&(e.p=n.seq),Ff(e,e.l.concat(n.message))))}}function $f(e){return function(){e.e?.()}}R(`i6`,Wf),R(`i0`,Gf),R(`i9`,Kf),R(`i8`,qf),R(`i7`,Jf),R(`i4`,Yf),R(`i2`,Xf),R(`i3`,Zf),R(`i1`,Qf),R(`i5`,$f);var ep=Rr,tp=(e=>`/${e}&`)(zr);function np(e){Ur(e.a,`M14.3632 5.65156L15.8431 4.17157C16.6242 3.39052 17.8905 3.39052 18.6716 4.17157L20.0858 5.58579C20.8668 6.36683 20.8668 7.63316 20.0858 8.41421L18.6058 9.8942M14.3632 5.65156L4.74749 15.2672C4.41542 15.5993 4.21079 16.0376 4.16947 16.5054L3.92738 19.2459C3.87261 19.8659 4.39148 20.3848 5.0115 20.33L7.75191 20.0879C8.21972 20.0466 8.65806 19.8419 8.99013 19.5099L18.6058 9.8942M14.3632 5.65156L18.6058 9.8942`)}var rp=(e,t)=>Vr(e.a,t),ip=(e,t)=>Hr(e.a,t),ap=`<!><!><!>`,op=N(9,e=>B(e.d,`armed`,e._._._._.w===e.i)),sp=N(10,e=>z(e.d,`title`,e._._._._.w===e.i?`Really kill ${e.g}?`:`Kill ${e.g} (pid ${e.i})`),2),cp=I(39,e=>{op(e),sp(e)},e=>e._._._._),Fee=L(`m8`,e=>{A(e.b,`click`,function(){window.open(`http://${location.hostname}:${e.h}`,`_blank`,`noopener`)}),A(e.d,`click`,function(){e._._._._.w===e.i?(vm(e._._._._,null),fetch(`/api/procs/${e.i}`,{method:`DELETE`}).catch(()=>{})):e._._._._.z(()=>{vm(e._._._._,e.i)})})}),Iee=e=>{cp(e),Fee(e)},Lee=M(6,e=>{z(e.a,`title`,e.g),sp(e)}),Ree=M(7,e=>{z(e.b,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.h}`),V(e.c,e.h)}),zee=M(8,e=>{op(e),sp(e)}),Bee=(e,t)=>{Lee(e,t[0]?.cmd),Ree(e,t[0]?.port),zee(e,t[0]?.pid)},lp=N(12,e=>V(e.b,e._._.c(e._.c))),up=I(3,lp,e=>e._._),Vee=L(`m7`,e=>A(e.a,`click`,function(){e._._._._._.u?.(e._.e,e.l)})),Hee=e=>{up(e),dp._(e),pp._(e),Vee(e)},dp=Ke(0,lp),fp=N(10,e=>z(e.a,`title`,`${e._.e} — ${e.j}${e.h===`APPROVED`?` (approved)`:e.h===`CHANGES_REQUESTED`?` (changes requested)`:``}`),2),pp=Ke(0,fp),mp=N(8,e=>gt(e.a,{draft:e.g,rejected:e.h===`CHANGES_REQUESTED`})),Uee=M(6,mp),Wee=M(7,e=>{V(e.d,e.h===`APPROVED`?` ✓`:e.h===`CHANGES_REQUESTED`?` ✗`:``),mp(e),fp(e)}),Gee=M(9,fp),Kee=M(11,e=>V(e.c,e.l)),qee=k(0,`<button class="chip pr"><!>#<!><!></button>`,` D%c%b%`,Hee,(e,t)=>{Uee(e,t[0]?.isDraft),Wee(e,t[0]?.reviewDecision),Gee(e,t[0]?.title),Kee(e,t[0]?.number)}),Jee=(e,t)=>qee(e,[t||[],`number`]),Yee=(e,t)=>Xee(e,t[0]),Xee=M(2,e=>{Jee(e,e.c?.prs),Zee(e,e.c?.worktree),dp(e)}),Zee=M(4,pp),Qee=M(2,F(up)),$ee=k(0,`<!><!><!>`,`b%`,0,Yee),hp=I(6,e=>{Qee(e,Wm(e)),$ee(e,[e._._.c||[],`full_name`])},e=>e._._),ete=e=>{hp(e),_p(e)},gp=k(1,`<span class="chip port-chip"><button class=port-open>:<!></button><button class=port-kill>×</button></span>`,` D Db%l `,Iee,Bee),_p=I(7,e=>gp(e,[e._._.d||[],`port`]),e=>e._._),vp=N(11,e=>B(e.a,`current`,e.k===e._._._.q)),yp=I(37,vp,e=>e._._._),bp=L(`m6`,e=>{A(e.b,`click`,function(){e._._._.r?.(e.k)}),A(e.f,`click`,function(){e._._._.s?.(e.j)}),A(e.h,`click`,function(){e._._._.v===e.k?(_m(e._._._,null),e._._._.t?.(e.k)):e._._._.z(()=>{_m(e._._._,e.k)})})}),xp=e=>{yp(e),Cp(e),e.d,hi(e.d,13),yi(e.d,`sess-icon`),np(e.g),rp(e.g,12),ip(e.g),bp(e)},Sp=N(12,e=>{B(e.h,`armed`,e._._._.v===e.k),z(e.h,`title`,e._._._.v===e.k?`Really kill this session?`:`Kill session`)}),Cp=I(38,Sp,e=>e._._._),wp=M(10,e=>{vp(e),Sp(e)}),Tp=(e,t)=>ht(e.c,[`dot`,Lr(t)]),Ep=N(16,e=>V(e.e,e.p||e.o)),Dp=M(14,e=>{vi(e.d,e.o),Ep(e)}),tte=M(15,Ep),nte=(e,t)=>rte(e,t[0]),rte=M(9,e=>{wp(e,e.j?.id),Tp(e,e.j?.state),Dp(e,e.j?.agent),tte(e,e.j?.title)}),Op=L(`m4`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._.n?.(e.e)})),kp=e=>{e.b,hi(e.b,14),yi(e.b),Op(e)},Ap=M(4,e=>{vi(e.b,e.e),V(e.c,e.e)}),jp=k(2,(e=>`<button>${e}<!></button>`)(ai),(e=>` D/${e}&%l`)(`b%c`),kp,(e,t)=>Ap(e,t[0])),Mp=I(35,e=>jp(e,[[...e._._._.o||[],`shell`],e=>e]),e=>e._._._),Np=(e,t)=>{z(e.a,`popovertarget`,t),z(e.c,`id`,t)},Pp=L(`m5`,e=>A(e.c,`toggle`,function(t,n){if(t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-n.offsetWidth-8))}px`}})),Fp=e=>{Mp(e),e.b,vi(e.b,`shell`),hi(e.b,12),yi(e.b),Np(e,Qe(e)),Pp(e)},Ip=L(`m3`,e=>A(e.a,`click`,function(){e._._._.l?.()})),Lp=e=>{Kr(e.b),qr(e.b,12),Jr(e.b),Ip(e)},Rp=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),zp=L(`m9`,e=>{A(e.b,`click`,function(){e._._.j()}),A(e.f,`click`,function(){e._._.m?.()})}),Bp=e=>{Rp(e),Hp(e),Wp(e),qp(e),Jp(e),Xp._(e),Zp._(e),Qp._(e),Zr(e.g),Qr(e.g,12),$r(e.g),zp(e)},Vp=O(4,(e=>`<button class="row-icon new-sess" title="Review changes">${e}</button>`)(Wr),(e=>` D/${e}&l`)(Gr),Lp),Hp=I(33,e=>Vp(e,+!e._._.l),e=>e._._),Up=O(7,(e=>`<button class="row-icon new-sess" title="New session">${e}</button><div popover=auto class=new-session-pop></div>`)(ai),(e=>` D/${e}&l b`)(`b%c`),Fp),Wp=I(34,e=>Up(e,+!e._._.n),e=>e._._),Gp=k(8,((e,t)=>`<div class=side-sess><button class=side-sess-btn><span></span>${e}<!></button><button class=row-icon title="Rename session">${t}</button><button class=close>×</button></div>`)(ai,ep),((e,t)=>` D D b/${e}&%l D/${t}&l l`)(`b%c`,tp),xp,nte),Kp=(e,t)=>Gp(e,[t.length>1?t:[],`id`]),qp=I(36,e=>Kp(e,e._._.p||[]),e=>e._._),Jp=I(40,e=>V(e.d,e._._.a1),e=>e._._),ite=O(9,`<div class=side-chips><!><!></div>`,`D%b%`,ete),Yp=N(11,e=>ite(e,(e._.c||[]).some(e=>(e.prs||[]).length)||(e._.d||[]).length?0:1)),Xp=P(0,1,Yp),Zp=P(0,1,Yp),Qp=P(0,1,e=>ht(e.c,[`dot`,e._.e])),$p=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),em=L(`m2`,e=>A(e.a,`click`,function(){e._._.j()})),tm=e=>{$p(e),nm(e),rm(e),im._(e),em(e)},nm=I(32,e=>V(e.b,(e._._.k??0)+1),e=>e._._),rm=I(40,e=>z(e.a,`title`,e._._.a1),e=>e._._),im=P(0,0,e=>ht(e.c,[`dot`,e._.e])),am=M(4,e=>{im(e),Qp(e)}),om=(e,t)=>{mm(e,t?.repos),gm(e,t?.ports),am(e,Ir(t))},sm=N(5,e=>om(e,e._.g[e._.e])),cm=P(0,0,sm),lm=e=>{cm._(e),um._(e),fm._(e)},um=P(0,0,sm),dm=O(0,`<button class="icon-btn rail-btn"> <span></span></button>`,` D b `,tm,(e=>`<section class=side-ws><div class=side-ws-row><button class=side-ws-btn><span></span><span class=side-ws-name> </span></button><!><button class=row-icon title="Manage workspace">${e}</button><!></div><div class=side-sessions><!><!></div></section>`)(Yr),(e=>` E D bD m%b D/${e}&l%lD%b%m`)(Xr),Bp),fm=P(0,0,e=>dm(e,+!e._.h)),pm=F(hp),mm=M(2,e=>{Xp(e),pm(e)}),hm=F(_p),gm=M(3,e=>{Zp(e),hm(e)}),_m=j(21,F(Cp)),vm=j(22,F(cp)),ym=(e,t)=>Sm(e,t.timer);function bm(e){_m(e,null),vm(e,null),ym(e,{timer:0})}var xm=M(25),Sm=M(24,e=>xm(e,Gm(e))),Cm=O(0,`<!><!><!>`,`b%`,lm),wm=(e,t)=>{Tm(e,t?.name),Cm(e,+!t)},Tm=M(27,F(rm,Jp)),Em=N(5,e=>wm(e,e.d.find(t=>t.id===e.e))),Dm=M(3,Em),Om=M(4,e=>{Em(e),cm(e)}),km=M(6,um),Am=M(7,fm),jm=M(8,F($p,Rp)),Mm=M(9),Nm=M(10,F(nm)),Pm=M(11,F(Hp)),Fm=M(12),Im=M(13,F(Wp)),Lm=M(14,F(Mp)),Rm=M(15,F(qp)),zm=M(16,F(yp)),Bm=M(17),Vm=M(18),Hm=M(19),Um=M(20);function Wm(e){return t=>{let n=e._._.c||[];if(n.length<2)return``;let r=t.full_name.split(`/`)[1];return n.some(e=>e.full_name!==t.full_name&&e.full_name.split(`/`)[1]===r)?t.full_name:r}}function Gm(e){return t=>{clearTimeout(e.y),t(),e.y=setTimeout(()=>{_m(e,null),vm(e,null)},3500)}}R(`m1`,Wm),R(`m0`,Gm);var Km=Rr,qm=(e=>`/${e}&`)(zr);function Jm(e){Ur(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M7.25 10L5.5 12L7.25 14 M9.5 21V3`)}var Ym=(e,t)=>Vr(e.a,t),Xm=(e,t)=>Hr(e.a,t),Zm=Rr,Qm=(e=>`/${e}&`)(zr);function $m(e){Ur(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M9.5 21V3 M5.5 10L7.25 12L5.5 14`)}var eh=(e,t)=>Vr(e.a,t),th=(e,t)=>Hr(e.a,t),nh=Rr,rh=(e=>`/${e}&`)(zr);function ih(e){Ur(e.a,`M18 8.4C18 6.70261 17.3679 5.07475 16.2426 3.87452C15.1174 2.67428 13.5913 2 12 2C10.4087 2 8.88258 2.67428 7.75736 3.87452C6.63214 5.07475 6 6.70261 6 8.4C6 15.8667 3 18 3 18H21C21 18 18 15.8667 18 8.4Z M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21`)}var ah=(e,t)=>Vr(e.a,t),oh=(e,t)=>Hr(e.a,t),sh=Rr,ch=(e=>`/${e}&`)(zr);function lh(e){Ur(e.a,`M3 12H6L9 3L15 21L18 12H21`)}var uh=(e,t)=>Vr(e.a,t),dh=(e,t)=>Hr(e.a,t),fh=Rr,ph=(e=>`/${e}&`)(zr);function mh(e){Ur(e.a,`M18 6H20M22 6H20M20 6V4M20 6V8 M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14`)}var hh=(e,t)=>Vr(e.a,t),gh=(e,t)=>Hr(e.a,t),_h=((e,t)=>`<!><!><aside class=side-nav><div class=side-list></div><!><div class=side-foot><button class="icon-btn nav-toggle"></button><div class=spacer></div><!><button class=icon-btn title=Usage>${e}</button><button class=icon-btn title="New workspace">${t}</button></div></aside>`)(sh,fh),vh=((e,t)=>`b%b D b%bD c%b D/${e}&l D/${t}&n`)(ch,ph),yh=e=>{$m(e.a),eh(e.a,15),th(e.a)},ate=e=>{Jm(e.a),Ym(e.a,15),Xm(e.a)},bh=P(5,0,e=>{B(e.a,`on`,e._.an),z(e.a,`title`,e._.an?`Disable agent-waiting notifications`:`Notify when an agent is waiting`)}),ote=L(`n19`,e=>A(e.a,`click`,function(){e._.ap()})),ste=e=>{bh._(e),ih(e.b),ah(e.b,15),oh(e.b),ote(e)},cte=L(`n16`,e=>A(e.a,`click`,function(){Zg(e._,!1)})),xh=N(7,e=>Pm(e.b,P_(e)),4),Sh=I(56,xh,e=>e._._),lte=L(`n18`,e=>{A(e.a,`mouseenter`,function(){e._.i()}),A(e.a,`mouseleave`,function(){e._.j()})}),ute=e=>{Sh(e),Ch(e),Th(e),Eh(e),Oh(e),kh(e),Ah(e),Nh(e),Ph(e),Fh(e),Ih(e),Lh(e),zh._(e),Vh._(e),Hh._(e),bm(e.b),Fm(e.b,F_(e)),Am(e.b),Nm(e.b),lte(e)},Ch=I(57,e=>Lm(e.b,e._._.a2),e=>e._._),wh=N(3,e=>Im(e.b,I_(e))),Th=I(58,wh,e=>e._._),Eh=I(59,xh,e=>e._._),Dh=N(5,e=>Rm(e.b,e.c===e._._.ad&&e._._.a5?e._._.a5:e._._.as[e.c]?.sessions||[]),3),Oh=I(60,Dh,e=>e._._),kh=I(61,e=>Vm(e.b,e._._.a7),e=>e._._),Ah=I(62,e=>Hm(e.b,e._._.a8),e=>e._._),jh=N(4,e=>jm(e.b,e.c===e._._.ad)),Mh=N(6,e=>zm(e.b,e.c===e._._.ad&&e._._.ah===`term`?e._._.af:null),3),Nh=I(63,e=>{Mm(e.b,z_(e)),Um(e.b,R_(e)),Bm(e.b,L_(e)),jh(e),xh(e),Dh(e),Mh(e)},e=>e._._),Ph=I(64,Mh,e=>e._._),Fh=I(65,e=>{xh(e),Mh(e)},e=>e._._),Ih=I(68,e=>Dm(e.b,e._._.ar),e=>e._._),Lh=I(69,e=>{km(e.b,e._._.as),Dh(e)},e=>e._._),Rh=M(2,e=>{Om(e.b,e.c),jh(e),wh(e),xh(e),Dh(e),Mh(e)}),zh=P(1,0,e=>Rh(e,e._.d)),Bh=N(8,e=>_t(e.a,`top:${e._.e}px;left:${e._.f}px`)),Vh=P(1,0,Bh),Hh=P(1,0,Bh),Uh=N(4,e=>jm(e.b,e.d===e._._.ad)),Wh=I(63,e=>{Mm(e.b,B_(e)),Uh(e)},e=>e._._),Gh=L(`n17`,e=>{A(e.a,`mouseenter`,function(t,n){e._.i();let r=n.getBoundingClientRect();eg(e._,{id:e.d,top:r.top,left:r.right+8})}),A(e.a,`mouseleave`,function(){e._.j()})}),Kh=e=>{Wh(e),qh(e),Jh(e),bm(e.b),Am(e.b,!0),Pm(e.b),Fm(e.b),Im(e.b),Lm(e.b),Rm(e.b),zm(e.b),Bm(e.b),Vm(e.b),Hm(e.b),Um(e.b),Gh(e)},qh=I(68,e=>Dm(e.b,e._._.ar),e=>e._._),Jh=I(69,e=>km(e.b,e._._.as),e=>e._._),Yh=(e,t)=>Nm(e.b,t),Xh=M(3,e=>{Om(e.b,e.d),Uh(e)}),Zh=k(0,(e=>`<span>${e}</span>`)(ap),(e=>` D/${e}&l`)(`b%c`),Kh,(e,t)=>{Xh(e,t[0]),Yh(e,t[1])}),Qh=P(3,0,e=>Zh(e,[e._.aq,e=>e])),$h=O(1,(e=>`<div class=rail-pop>${e}</div>`)(ap),(e=>` D/${e}&l`)(`b%c`),ute),eg=j(2,e=>{rg(e,e.c?.id),ig(e,e.c?.top),ag(e,e.c?.left),$h(e,+!e.c)}),tg=(e,t)=>cg(e,t.timer),ng=e=>{Qh._(e),eg(e,null),tg(e,{timer:0})},rg=M(3,zh),ig=M(4,Vh),ag=M(5,Hh),og=M(8),sg=M(9),cg=M(7,e=>{og(e,V_(e)),sg(e,H_(e))}),lg=N(7,e=>Pm(e.a,U_(e)),4),ug=Ke(2,lg),dg=e=>{ug._(e),fg._(e),mg._(e),hg._(e),_g._(e),vg._(e),yg._(e),xg._(e),Sg._(e),Cg._(e),wg._(e),Tg._(e),bm(e.a),Fm(e.a,W_(e)),Am(e.a),Nm(e.a)},fg=Ke(2,e=>Lm(e.a,e._.a2)),pg=N(3,e=>Im(e.a,G_(e))),mg=Ke(2,pg),hg=Ke(2,lg),gg=N(5,e=>Rm(e.a,e.c===e._.ad&&e._.a5?e._.a5:e._.as[e.c]?.sessions||[]),3),_g=Ke(2,gg),vg=Ke(2,e=>Vm(e.a,e._.a7)),yg=Ke(2,e=>Hm(e.a,e._.a8)),bg=N(6,e=>zm(e.a,e.c===e._.ad&&e._.ah===`term`?e._.af:null),3),xg=qe(2,39,2,e=>{jm(e.a,e.c===e._.ad),Mm(e.a,J_(e)),Um(e.a,q_(e)),Bm(e.a,K_(e)),lg(e),gg(e),bg(e)}),Sg=Ke(2,bg),Cg=Ke(2,e=>{lg(e),bg(e)}),wg=Ke(2,e=>Dm(e.a,e._.ar)),Tg=Ke(2,e=>{km(e.a,e._.as),gg(e)}),Eg=M(2,e=>{Om(e.a,e.c),pg(e),lg(e),gg(e),bg(e)}),Dg=(e,t)=>Eg(e,t[0]),Og=F(qh,Ih),kg=M(53,e=>{wg(e),Og(e)}),Ag=N(38,e=>kg(e,e.y||[e.ab])),jg=M(37,e=>{Lg(e,e.ab?.id),Ag(e)}),Mg=k(2,(e=>`<!>${e}<!>`)(ap),(e=>`b/${e}&b`)(`b%c`),dg,Dg),Ng=M(52,e=>{Mg(e,[e.aq,e=>e]),Qh(e)}),Pg=N(40,e=>Ng(e,e.y?.length?e.y.filter(e=>e.status===`active`).map(e=>e.id):[e.ad])),Fg=N(55,e=>e.as[e.ad]),Ig=F(Wh,Nh),Lg=M(39,e=>{Pg(e),Fg(e),xg(e),Ig(e)}),Rg=jg,zg=F(Ph),Bg=Ge(41,e=>{Sg(e),zg(e)}),Vg=N(15,e=>Bg(e,e.n,e.o)),Hg=M(13,Vg),Ug=M(14,Vg),Wg=F(Fh),Gg=Ge(43,e=>{z(e.b,`hidden`,e.ah===`diff`),Cg(e),Wg(e)}),Kg=N(18,e=>Gg(e,e.q,e.r)),qg=M(16,Kg),Jg=M(17,Kg),Yg=O(0,`<div class=drawer-backdrop></div>`,` `,cte),Xg=N(48,e=>gt(e.b,{closed:!e.al,open:e.aj})),Zg=Ge(45,e=>{Yg(e,+!e.aj),Xg(e)}),Qg=N(21,e=>Zg(e,e.t,e.u)),$g=M(19,Qg),e_=M(20,Qg),t_=O(3,`<div class=side-rail></div><!><!>`,` b%`,ng),n_=O(4,Km,(e=>`/${e}&`)(qm),ate,Zm,(e=>`/${e}&`)(Qm),yh),r_=j(47,e=>{z(e.e,`title`,e.al?`Collapse sidebar`:`Expand sidebar`),t_(e,+!!e.al),n_(e,+!e.al),Xg(e)}),i_=M(51),a_=N(50,e=>i_(e,Y_(e))),o_=j(49,e=>{a_(e),bh(e)}),s_=O(5,(e=>`<button class="icon-btn notify-btn">${e}</button>`)(nh),(e=>` D/${e}&l`)(rh),ste),c_=L(`n21`,e=>{Et(e,{onMount:function(){Xn()&&Zn().then(t=>{o_(e,!!t)})}}),A(e.e,`click`,function(){r_(e,!e.al),Un(e.al)}),A(e.g,`click`,function(){Zg(e,!1),e.a9?.()}),A(e.i,`click`,function(){Zg(e,!1),e.aa?.()})});function l_(e){lh(e.h),uh(e.h,15),dh(e.h),mh(e.j),hh(e.j,16),gh(e.j),r_(e,Hn()),o_(e,!1),s_(e,+!Xn()),c_(e)}var u_=M(22,a_),d_=M(23,L(`n20`,e=>{e.x&&r_(e,Hn())})),f_=M(24,e=>{Pg(e),Ag(e)}),p_=F(Jh,Lh),m_=M(54,e=>{Fg(e),Tg(e),p_(e)}),h_=(e,t)=>m_(e,t||{}),g_=F(Sh),__=M(26,e=>{ug(e),g_(e)}),v_=M(27),y_=F(Ch),b_=M(28,e=>{fg(e),y_(e)}),x_=F(Th),S_=M(29,e=>{mg(e),x_(e)}),C_=F(Eh),w_=M(30,e=>{hg(e),C_(e)}),T_=F(Oh),E_=M(31,e=>{_g(e),T_(e)}),D_=M(32),O_=F(kh),k_=M(33,e=>{vg(e),O_(e)}),A_=F(Ah),j_=M(34,e=>{yg(e),A_(e)}),M_=M(35),N_=M(36);function P_(e){return function(){eg(e._,null),e.c===e._._.ad?(Gg(e._._,e._._.ah===`diff`?`term`:`diff`),e._._.ah===`diff`&&e._._.a4?.()):(On(e.c),e._._.a0?.(e.c))}}function F_(e){return function(){eg(e._,null),e._._.a1?.(e.c)}}function I_(e){return function(t){eg(e._,null),e._._.a3(e.c,t)}}function L_(e){return function(t){eg(e._,null),e.c===e._._.ad?(Bg(e._._,t),Gg(e._._,`term`)):e._._.a6?.(e.c,t)}}function R_(e){return function(t,n){eg(e._,null);let r=`${t}/${n}`;e.c===e._._.ad?(Gg(e._._,`diff`),e._._.a4?.(r)):(On(e.c,r),e._._.a0?.(e.c))}}function z_(e){return function(){eg(e._,null),e.c!==e._._.ad&&e._._.a0?.(e.c)}}function B_(e){return function(){e.d!==e._._.ad&&e._._.a0?.(e.d)}}function V_(e){return()=>clearTimeout(e.h)}function H_(e){return()=>{clearTimeout(e.h),e.h=setTimeout(()=>{eg(e,null)},150)}}function U_(e){return function(){Zg(e._,!1),e.c===e._.ad?(Gg(e._,e._.ah===`diff`?`term`:`diff`),e._.ah===`diff`&&e._.a4?.()):(On(e.c),e._.a0?.(e.c))}}function W_(e){return function(){Zg(e._,!1),e._.a1?.(e.c)}}function G_(e){return function(t){Zg(e._,!1),e._.a3(e.c,t)}}function K_(e){return function(t){Zg(e._,!1),e.c===e._.ad?(Bg(e._,t),Gg(e._,`term`)):e._.a6?.(e.c,t)}}function q_(e){return function(t,n){Zg(e._,!1);let r=`${t}/${n}`;e.c===e._.ad?(Gg(e._,`diff`),e._.a4?.(r)):(On(e.c,r),e._.a0?.(e.c))}}function J_(e){return function(){e.c!==e._.ad&&(Zg(e._,!1),e._.a0?.(e.c))}}function Y_(e){return async()=>{try{e.an?(await $n(),o_(e,!1)):(o_(e,await Qn()),e.an||e.w?.(`Notifications blocked — allow them for this site in browser/system settings.`))}catch(t){o_(e,!1),e.w?.(`Notifications failed: ${String(t.message||t)}`)}}}R(`n13`,P_),R(`n11`,F_),R(`n12`,I_),R(`n15`,L_),R(`n14`,R_),R(`n10`,z_),R(`n9`,B_),R(`n7`,V_),R(`n8`,H_),R(`n4`,U_),R(`n2`,W_),R(`n3`,G_),R(`n6`,K_),R(`n5`,q_),R(`n1`,J_),R(`n0`,Y_);async function X_(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-100px;opacity:0;`,document.body.append(t),t.focus(),t.select();let n=document.execCommand(`copy`);return t.remove(),n}}var Z_=null;function Q_(){return Z_}function $_(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(ev(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function ev(e){if(!/[*?]/.test(e))return t=>Fr(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>Fr(e,t)}}var tv=3;function nv(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(rv(e,n));for(let e of a){i++;let t=n?.files.find(t=>t.path===e.path),a=e.side===`deletions`?t?.old:t?.new,o=e.side===`deletions`?`Old`:`New`,s=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;if(r.push(``),r.push(`${i}. **${e.path}** (${o} ${s})`),a!=null){let t=av(a,e.line_start,e.line_end,e.side),n=ov(t);r.push(``),r.push(sv(`${n}diff\n${t}\n${n}`))}r.push(``),r.push(sv(e.text))}}return r.join(`
|
|
3
|
+
`))),ki=e=>{Oi._(e),Ai._(e)},Ai=P(6,0,e=>V(e.b,e._.p)),ji=N(2,e=>z(e.a,`title`,`${e._.l} running session${e._.l===1?``:`s`}${e._.m?` — ${e._.m} working`:``}${e._.n?` — ${e._.n} waiting on you`:``}`),2),Mi=P(4,0,e=>{V(e.b,e._.l),ji(e)}),Ni=e=>{Mi._(e),Pi._(e),Fi._(e)},Pi=P(4,0,ji),Fi=P(4,0,ji),Ii=P(0,1,e=>V(e.a,e._.g)),Li=Ii,Ri=N(2,e=>V(e.b,e._.a3?`hide archived`:`archived (${e._.a6})`)),zi=P(5,0,Ri),Bi=L(`j8`,e=>A(e.a,`click`,function(){oo(e._,!e._.a3)})),Vi=e=>{zi._(e),Hi._(e),Bi(e)},Hi=P(5,0,Ri),Ui=N(1,e=>Ft(e,`a`,e._.o.preferredAgent,_o(e))),Wi=P(6,0,Ui),Gi=L(`j9`,e=>It(e,`a`)),Ki=e=>{Wi._(e),Ji._(e),Yi._(e),Gi(e)},qi=k(0,`<option> </option>`,` D `,0,Ci),Ji=P(6,0,e=>qi(e,[e._.z,e=>e])),Yi=P(6,0,Ui),Xi=L(`j5`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.q(e._._.h,e.e)})),Zi=e=>{e.b,hi(e.b,14),yi(e.b),Xi(e)},Qi=M(4,e=>{vi(e.b,e.e),V(e.c,e.e)}),$i=k(6,(e=>`<button>${e}<!></button>`)(ai),(e=>` D/${e}&%l`)(`b%c`),Zi,(e,t)=>Qi(e,t[0])),ea=I(48,e=>$i(e,[[...e._._.z||[],`shell`],e=>e]),e=>e._._),ta=(e,t)=>{z(e.e,`popovertarget`,t),z(e.g,`id`,t)},na=L(`j6`,e=>{A(e.a,`click`,function(t){t.stopPropagation(),e._._.m(e._.h)}),A(e.c,`click`,function(t){t.stopPropagation(),e._._.n(e._.h)}),A(e.e,`click`,function(e){e.stopPropagation()}),A(e.g,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,t.right-n.offsetWidth)}px`}})}),ra=e=>{ea(e),Kr(e.b),qr(e.b,13),Jr(e.b),Zr(e.d),Qr(e.d,13),$r(e.d),ni(e.f),ri(e.f,13),ii(e.f),ta(e,Qe(e)),na(e)},ia=O(2,`<span class="chip open">open</span>`),aa=N(18,e=>ia(e,e._.i===e._._.k?0:1)),oa=I(45,aa,e=>e._._),sa=e=>{oa(e),ua(e),fa._(e),pa._(e),ma._(e),_a._(e)},ca=(e,t)=>{ht(e.a,[`dot`,Ir(t)]),ya(e,t?.repos),xa(e,t?.agents),Sa(e,t?.working),Ca(e,t?.waiting),Ta(e,t?.ports)},la=N(19,e=>ca(e,e._._.y[e._.i])),ua=I(47,la,e=>e._._),da=O(3,`<span class=chip>archived</span>`),fa=P(0,2,e=>da(e,+!e._.f)),pa=P(0,2,e=>{la(e),aa(e)}),ma=P(0,2,e=>V(e.b,e._.j)),ha=k(7,`<span class=mono> </span>`,`D `,0,Ti),ga=N(10,e=>ha(e,[e.j||e._.k,`full_name`])),_a=P(0,2,ga),va=(e,t)=>Oa(e,t?.length),ya=M(9,e=>{va(e,(e.j||[]).flatMap(e=>e.prs||[])),ga(e)}),ba=O(4,`<span class="chip stat"> </span>`,` D `,Ni),xa=M(11,e=>{ba(e,+!e.l),Mi(e)}),Sa=M(12,Pi),Ca=M(13,Fi),wa=O(6,`<span class="chip stat">:<!></span>`,` Db%`,ki),Ta=M(14,e=>{Ea(e,e.o?.length),wa(e,+!(e.o||[]).length),Oi(e)}),Ea=M(15,Ai),Da=O(5,`<span class="chip stat"><!> PR<!></span>`,` D%c%`,Di),Oa=M(17,e=>{Da(e,+!e.r),Ei(e)}),ka=N(12,e=>gt(e.a,{hi:e.l===e._.ah,archived:e.e===`ws`&&e.f}),3),Aa=Ke(4,ka),ja=L(`j7`,e=>{A(e.a,`click`,function(){e._.ai(e.d)}),A(e.a,`mouseenter`,function(){ao(e._,e.l)})}),Ma=e=>{Aa._(e),ja(e)},Na=O(0,`<span class=row-name>+ New workspace</span>`,0,0,`<span class="row-name cmd-row">▸ <!></span>`,`Db%`,Li,`<span class=row-name><span></span><span class=row-name-text> </span><!><!><span class=row-stats><!><!><!></span></span><span class=row-repos></span>`,`D bD l%b%bD%b%b%m `,sa),Pa=O(1,((e,t,n)=>`<button class=row-more title="Review changes">${e}</button><button class=row-more title="Manage workspace">${t}</button><button class=row-more title="New session">${n}</button><div popover=auto class=new-session-pop></div>`)(Wr,Yr,ei),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l b`)(Gr,Xr,ti),ra),Fa=M(4,e=>{Na(e,e.e===`new`?0:e.e===`cmd`?1:2),Pa(e,e.e===`ws`?0:1),ka(e)}),Ia=M(5,e=>{ka(e),fa(e)}),La=M(11,ka),Ra=(e,t)=>{za(e,t[0]),La(e,t[1])},za=M(3,e=>{Fa(e,e.d?.kind),Ia(e,e.d?.archived),Ba(e,e.d?.label),Va(e,e.d?.ws)}),Ba=M(6,Ii),Va=M(7,e=>{Ha(e,e.h?.id),Ua(e,e.h?.name),Wa(e,e.h?.repos)}),Ha=M(8,pa),Ua=M(9,ma),Wa=M(10,_a),Ga=L(`j4`,e=>A(e.a,`click`,function(){e._.v?.()})),Ka=k(4,`<li><div class=row-wrap><button class=row></button><!></div></li>`,`E b%`,Ma,Ra),qa=N(40,L(`j12`,e=>Et(e,{onMount:function(){let t=new AbortController,n=e.ad.findIndex(t=>t.kind===`ws`&&t.ws.id===e.k);n>=0&&ao(e,n),setTimeout(()=>e.d?.focus(),0);let r=t.signal;return document.addEventListener(`keydown`,t=>{document.querySelector(`:popover-open`)||t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())},{capture:!0,signal:r}),{abort:t}},onDestroy:function(){this.abort.abort()}})),3),Ja=M(39,e=>{yee(e,e.ad.length),Ka(e,[e.ad,e=>e.kind===`new`?`new`:e.kind===`cmd`?`cmd:${e.label}`:e.ws.id]),qa(e)}),Ya=N(38,e=>Ja(e,[...e.a8(e.a4).map(e=>({kind:`ws`,ws:e})),...e.a3||e.a1?e.a8(e.a5).map(e=>({kind:`ws`,ws:e,archived:!0})):[],...e.ab,{kind:`new`}]),5),Xa=M(34,Ya),Za=M(37,Ya),Qa=N(36,e=>Za(e,!e.a1||!e.a9?[]:[{kind:`cmd`,label:`Review changes — ${e.a9?.name}`,run:()=>e.m(e.a9)},{kind:`cmd`,label:`Manage workspace — ${e.a9?.name}`,run:()=>e.n(e.a9)},{kind:`cmd`,label:`New ${e.p||`agent`} session — ${e.a9?.name}`,run:()=>e.q(e.a9,e.p||`claude`)}].filter(t=>t.kind===`cmd`&&Fr(e.a1,t.label))),5),$a=O(5,`<button class="archived-link dim"> </button>`,` D `,Vi),eo=N(33,e=>$a(e,e.a6&&!e.a1?0:1)),to=j(27,e=>{jt(e,`d`,e.a1,yo(e)),Xa(e,vo(e)),Qa(e),Ya(e),eo(e)}),no=L(`j11`,e=>e.e.children[e.ah]?.scrollIntoView({block:`nearest`})),ro=M(43,e=>{Aa(e),no(e)}),io=N(42,e=>ro(e,Math.min(e.a2,e.af-1))),ao=j(28,io),oo=j(29,e=>{Ya(e),zi(e)}),so=L(`j10`,e=>{Mt(e,`d`),A(e.d,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),ao(e,Math.min(e.ah+1,e.ad.length-1))):t.key===`ArrowUp`?(t.preventDefault(),ao(e,Math.max(e.ah-1,0))):t.key===`Enter`?(t.preventDefault(),e.ai(e.ad[e.ah])):t.key===`Escape`&&!e.u&&(t.preventDefault(),e.v?.())})});function co(e){to(e,``),ao(e,0),oo(e,!1),so(e)}var lo=M(30,Ya),uo=M(31,e=>{fee(e,e.a5?.length),Ya(e)}),fo=M(35,Qa),po=N(11,e=>fo(e,e.j.find(t=>t.id===e.k))),mo=M(9,e=>{Dee(e,e.j?.length),lo(e,e.j.filter(e=>e.status===`active`)),uo(e,e.j.filter(e=>e.status===`archived`)),po(e)}),fee=M(32,e=>{eo(e),Hi(e)}),pee=F(oa),mee=M(10,e=>{po(e),qa(e),pee(e)}),hee=M(12,Qa),gee=M(13,Qa),_ee=M(15,Qa),vee=M(16,Qa),yee=M(41,io),bee=M(44),ho=N(19,e=>bee(e,bo(e))),xee=M(17,ho),See=M(18,ho),Cee=O(0,`<div class=palette-backdrop></div>`,` `,Ga),wee=O(2,`<div class="onboard dim"><p>A <strong>workspace</strong> checks out one or more repos as git worktrees on a shared branch and gives each agent session its own terminal. Create one to get started.</p><p>Pick your preferred agent below — new sessions and the quick-create button use it. GitHub access uses your <code>gh</code> login.</p></div>`),go=N(23,e=>wee(e,e.u&&!e.w?0:1)),Tee=M(20,e=>{B(e.b,`inline`,e.u),Cee(e,+!!e.u),qa(e),go(e)}),Eee=M(21,qa),Dee=M(22,go),Oee=O(6,`<label class=dim><select aria-label="Preferred agent"></select></label>`,`D `,Ki),kee=M(14,e=>{_ee(e,e.o?.preferredAgent),jee(e,e.o?.agents),Oee(e,+!e.o),Wi(e)}),Aee=F(ea),jee=M(25,e=>{Aee(e),Ji(e)}),Mee=M(24,F(ua)),Nee=M(26,Yi);function _o(e){return function(t){e._.a0({...e._.o,preferredAgent:t}),H(`/api/settings`,{method:`PUT`,headers:{"content-type":`application/json`},body:JSON.stringify({preferredAgent:t})}).catch(()=>{})}}function vo(e){return t=>t.filter(t=>Fr(e.a1,t.name))}function yo(e){return function(t){to(e,t),ao(e,0)}}function bo(e){return t=>{t&&(t.kind===`new`?e.r():t.kind===`cmd`?t.run():e.s(t.ws))}}R(`j1`,_o),R(`j2`,vo),R(`j0`,yo),R(`j3`,bo);var xo=Rr,So=(e=>`/${e}&`)(zr);function Co(e){Ur(e.a,`M21.8883 13.5C21.1645 18.3113 17.013 22 12 22C6.47715 22 2 17.5228 2 12C2 6.47715 6.47715 2 12 2C16.1006 2 19.6248 4.46819 21.1679 8 M17 8H21.4C21.7314 8 22 7.73137 22 7.4V3`)}var wo=(e,t)=>Vr(e.a,t),To=(e,t)=>Hr(e.a,t),Eo=`<div class=add-repo><input placeholder="Add a repo…" aria-label="Add a repo"><!><!></div>`,Do=`D b%b%l`,Oo=null,ko=L(`l7`,e=>A(e.a,`click`,function(){e._._._._._.z(e._._._.i,e.d)})),Ao=M(3,e=>V(e.b,e.d)),jo=(e,t)=>Ao(e,t[0]),Mo=I(33,e=>jt(e,`a`,e._._._._._.y,Ls(e)),e=>e._._._._._),No=L(`l6`,e=>Mt(e,`a`)),Po=e=>{Mo(e),No(e)},Fo=k(1,`<li><button class=result-row><span class="repo-name mono"> </span></button></li>`,`D E `,ko,jo),Io=(e,t)=>{Wo(e,t?.length),Fo(e,[t,e=>e])},Lo=N(5,e=>Io(e,(e._._._._.y?e._._._._.w.filter(t=>t.toLowerCase().includes(e._._._._.y.toLowerCase())):e._._._._.w).slice(0,12))),Ro=I(31,Lo,e=>e._._._._),zo=e=>{Ro(e),Vo(e),Ho(e)},Bo=O(0,`<input placeholder="Filter branches…" aria-label="Filter branches" autofocus>`,` `,Po),Vo=I(32,e=>Bo(e,e._._._._.x>8?0:1),e=>e._._._._),Ho=I(33,Lo,e=>e._._._._),Uo=O(2,`<li><p class="dim empty-note">No branches match.</p></li>`),Wo=(e,t)=>Uo(e,+!!t),Go=O(0,`<p class="dim empty-note"><span class=spin></span> Loading branches…</p>`,0,0,`<!><!><ul class=branch-list><!><!></ul>`,`b%bD%b%`,zo),Ko=I(31,e=>Go(e,+!!e._._._.w),e=>e._._._),qo=Ko,Jo=N(11,e=>B(e.a,`hi`,e.k===e._._.p)),Yo=I(28,Jo,e=>e._._),Xo=L(`l8`,e=>{A(e.a,`mouseenter`,function(){gs(e._._,e.k)}),A(e.b,`click`,function(){e._._.z(e.i)}),A(e.e,`click`,function(){e._._.a0(e.i)})}),Zo=e=>{Yo(e),es(e),ni(e.c),ri(e.c,12),ii(e.c,`result-plus`),Xo(e)},Qo=O(5,`<div class=branch-pick></div>`,` `,qo),$o=N(9,e=>{B(e.e,`on`,e._._.u===e.i),Qo(e,e._._.u===e.i?0:1)}),es=I(30,$o,e=>e._._),ts=M(10,Jo),ns=M(8,e=>{V(e.d,e.i),z(e.e,`title`,`Pick a base branch for ${e.i}`),z(e.e,`aria-label`,`Pick a base branch for ${e.i}`),$o(e)}),rs=k(0,(e=>`<li><div class=result-wrap><button class=result-row>${e}<span class=repo-name> </span></button><button class=result-branch>⎇</button></div><!></li>`)(ei),(e=>`D D D/${e}&D m l%l`)(ti),Zo,(e,t)=>{ns(e,t[0]?.nameWithOwner),ts(e,t[1])}),is=P(2,0,e=>rs(e,[e._.r,`nameWithOwner`])),as=is,os=P(2,1,e=>V(e.a,e._.m)),ss=os,cs=M(17,e=>{js(e,e.r?.length),is(e)}),ls=N(14,e=>cs(e,e.l&&e.m?dee(e.m,e.l?.repos,t=>e.i.has(t)):[]),2),us=O(1,`<p class="dim empty-note">Loading repos…</p>`),ds=N(13,e=>us(e,e.m&&!e.l?0:1)),fs=O(2,`<ul class=repo-results></ul>`,` `,as,`<p class="dim empty-note">No repos match "<!>".</p>`,`Db%`,ss),ps=N(19,e=>fs(e,e.s?0:e.m&&e.l?1:2),2),ms=j(11,e=>{ls(e),ds(e),ps(e)}),hs=j(12,e=>{jt(e,`a`,e.m,Rs(e)),ls(e),ds(e),ps(e),os(e)}),gs=j(15,F(Yo)),_s=M(26),vs=N(21,e=>_s(e,zs(e))),ys=F(es),bs=j(20,e=>{vs(e),ys(e)}),xs=F(Ko,Ro),Ss=j(22,e=>{Ns(e,e.w?.length),xs(e)}),Cs=j(24,F(Ho,Mo)),ws=L(`l9`,e=>{Mt(e,`a`),A(e.a,`keydown`,function(t){t.key===`ArrowDown`?(t.preventDefault(),gs(e,Math.min(e.p+1,e.r?.length-1))):t.key===`ArrowUp`?(t.preventDefault(),gs(e,Math.max(e.p-1,0))):t.key===`Enter`?(t.preventDefault(),e.r[e.p]&&e.z(e.r[e.p].nameWithOwner)):t.key===`Escape`&&e.m&&(t.preventDefault(),hs(e,``))})});function Ts(e){ms(e,null),hs(e,``),gs(e,0),bs(e,null),Ss(e,null),Cs(e,``),ws(e)}var Es=L(`l10`,e=>Et(e,{onMount:function(){Oo&&ms(e,Oo),e.q(!1)}})),Ds=M(16,e=>{x(e,Bs(e)),Es(e)}),Os=N(7,e=>Ds(e,Vs(e))),ks=M(5,Os),As=M(6,e=>{Os(e),vs(e)}),js=M(18,ps),Ms=M(8,ls),Ns=M(23,F(Vo)),Ps=M(25),Fs=M(9,e=>Ps(e,Hs(e))),Is=(e,t)=>z(e.a,`disabled`,t);function Ls(e){return t=>{Cs(e._._._._._,t)}}function Rs(e){return function(t){hs(e,t),gs(e,0)}}function zs(e){return async t=>{if(e.u===t){bs(e,null);return}bs(e,t),Ss(e,null),Cs(e,``);try{let n=await H(`/api/repos/branches?repo=${encodeURIComponent(t)}`);e.u===t&&Ss(e,n.branches)}catch(t){bs(e,null),e.g?.(String(t.message||t))}}}function Bs(e){return()=>e.q(!0)}function Vs(e){return async t=>{t&&e.f?.(!0);try{let n=await H(`/api/repos${t?`?refresh`:``}`);Oo=n,ms(e,n)}catch(t){e.g?.(String(t.message||t))}t&&e.f?.(!1)}}function Hs(e){return(t,n)=>{hs(e,``),bs(e,null),e.j(t,n)}}R(`l1`,Ls),R(`l0`,Rs),R(`l5`,zs),R(`l2`,Bs),R(`l3`,Vs),R(`l4`,Hs);var Us=`<div class=manage-backdrop></div><div role=dialog><div class=manage><!></div><!></div>`,Ws=` b E%l%l`,Gs=de(2),Ks=L(`h0`,e=>A(e.a,`click`,function(){e._.h?.()})),qs=ue(0),Js=P(3,0,e=>qs(e,e._.n)),Ys=Js,Xs=N(15,L(`h1`,e=>Et(e,{dismissable:e.o,onMount:function(){let t=new AbortController;return window.addEventListener(`keydown`,t=>{t.key!==`Escape`||!this.dismissable||t.target instanceof Element&&t.target.closest(`.palette:not(.inline)`)||t.target instanceof HTMLInputElement&&t.target.value||e.h?.()},{capture:!0,signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),Zs=M(14,Xs),Qs=(e,t)=>Zs(e,t!==!1),$s=L(`h2`,e=>A(e.a,`click`,function(){e.o&&e.h?.()})),ec=(e,t)=>ht(e.b,[`manage-view`,t]),tc=(e,t)=>z(e.b,`aria-label`,t),nc=O(3,`<div class=manage-bar><!></div>`,`D%`,Ys,`<div class=manage-bar><button class="btn primary">Done</button></div>`,`D `,Ks),rc=N(12,e=>nc(e,e.l?0:e.h?1:2)),ic=M(7,e=>{rc(e),Xs(e)}),ac=M(11,e=>{oc(e,e.l?.content),rc(e)}),oc=M(13,Js),sc=Us,cc=(e=>`/${e}&`)(Ws),lc=new Map,uc=M(3,e=>{z(e.a,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.d}`),V(e.b,e.d)}),dc=L(`g24`,e=>A(e.a,`click`,function(){window.open(`http://${location.hostname}:${e.d}`,`_blank`,`noopener`)})),fc=(e,t)=>uc(e,t[0]),pc=(e,t)=>V(e.a,t),mc=(e,t)=>pc(e,t[0]),hc=P(2,0,e=>V(e.a,e._.j)),gc=hc,_c=P(0,0,e=>V(e.a,e._.e)),vc=_c,yc=(e,t)=>z(e.a,`title`,t),bc=(e,t)=>V(e.b,t),xc=k(2,`<button class="chip port-link">:<!></button>`,` Db%`,dc,fc),Sc=(e,t)=>xc(e,[t,e=>String(e)]),Cc=M(9,e=>z(e.d,`title`,`Kill ${e.j}`)),wc=L(`g25`,e=>A(e.d,`click`,function(){e._._._.ag(e.j)})),Tc=(e,t)=>{yc(e,t[0]?.args),bc(e,t[0]?.cmd),Sc(e,t[0]?.ports),Cc(e,t[0]?.pid)},Ec=P(6,0,e=>z(e.a,`title`,`Confirm #${e._.p} is done — remove from this list`)),Dc=L(`g20`,e=>A(e.a,`click`,function(){e._._._._._.a8(e._._.g,e._.p)})),Oc=O(6,`<button class=pr-dismiss>✓</button>`,` `,e=>{Ec._(e),Dc(e)}),kc=N(11,e=>V(e.b,e.j===`OPEN`&&e.k?`draft`:e.j.toLowerCase())),Ac=O(2,`<span class="pr-state open" title=Approved>✓</span>`,0,0,`<span class="pr-state closed" title="Changes requested">✗</span>`),jc=N(13,e=>Ac(e,e.j===`OPEN`&&e.m===`APPROVED`?0:e.j===`OPEN`&&e.m===`CHANGES_REQUESTED`?1:2)),Mc=M(9,e=>{ht(e.a,[`pr-state`,e.j.toLowerCase()]),Oc(e,+(e.j===`OPEN`)),kc(e),jc(e)}),Nc=M(10,kc),Pc=M(12,jc),Fc=(e,t)=>z(e.d,`href`,t),Ic=M(15,e=>{V(e.e,e.p),Ec(e)}),Lc=(e,t)=>V(e.f,t),Rc=(e,t)=>{Mc(e,t[0]?.state),Nc(e,t[0]?.isDraft),Pc(e,t[0]?.reviewDecision),Fc(e,t[0]?.url),Ic(e,t[0]?.number),Lc(e,t[0]?.title)},zc=P(0,0,e=>V(e.b,e._.e)),Bc=L(`g19`,e=>A(e.a,`click`,function(){e._._._.a7()})),Vc=e=>{zc._(e),Bc(e)},Hc=I(54,e=>V(e.a,e._._.s),e=>e._._),Uc=Hc,Wc=N(2,e=>{B(e.a,`armed`,e._._._.r===e._.h),V(e.b,e._._._.r===e._.h?`remove?`:`×`)}),Gc=N(3,e=>z(e.a,`title`,e._._._.r===e._.h?`Really remove ${e._.g}/? Uncommitted changes are lost.`:`Remove ${e._.g}/`),2),Kc=I(53,e=>{Wc(e),Gc(e)},e=>e._._._),qc=L(`g22`,e=>A(e.a,`click`,function(){e._._._.r===e._.f?.full_name?(Pu(e._._._,null),e._._._.ae(e._.f)):(Pu(e._._._,e._.f?.full_name),setTimeout(()=>{Pu(e._._._,null)},4e3))})),Jc=e=>{Kc(e),Yc._(e),Xc._(e),qc(e)},Yc=P(3,1,Gc),Xc=P(3,1,e=>{Wc(e),Gc(e)}),Zc=I(51,e=>z(e.a,`disabled`,!!e._._.p),e=>e._._),Qc=L(`g16`,e=>A(e.a,`click`,function(){e._._.af(`restore`)})),$c=e=>{Zc(e),Qc(e)},el=I(51,e=>{z(e.a,`disabled`,!!e._._.p),V(e.b,e._._.p===`archive`?`Archiving…`:`Archive`)},e=>e._._),tl=L(`g15`,e=>A(e.a,`click`,function(){e._._.af(`archive`)})),nl=e=>{el(e),tl(e)},rl=I(50,e=>V(e.a,e._._._.o),e=>e._._._),il=dt(`g18`,` `,` `,rl),al=e=>{Ar(e.a,il(e)),Er(e.a,`inline`),Pr(e.a,fd(e)),Cr(e.a),Or(e.a),Nr(e.a)},ol=O(3,`<span class=spin></span>`,0,0,`<button class=cur-remove> </button>`,` D `,Jc),sl=N(8,e=>ol(e,+!e._._.m.has(e.h))),cl=I(48,sl,e=>e._._),ll=cl,ul=M(6,e=>{V(e.a,e.g),Yc(e)}),dl=M(7,e=>{V(e.b,e.h),sl(e),Xc(e)}),fl=O(2,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,gc),pl=N(11,e=>fl(e,+(e.j===e.k))),ml=M(9,e=>{pl(e),hc(e)}),hl=M(10,pl),gl=(e,t)=>_l(e,t[0]),_l=M(5,e=>{ul(e,e.f?.worktree),dl(e,e.f?.full_name),ml(e,e.f?.base_branch),hl(e,e.f?.default_branch)}),vl=O(0,`<div class="pr-repo-name mono dim"> </div>`,`D `,vc),yl=I(46,e=>vl(e,e._._._.k>1?0:1),e=>e._._._),bl=yl,xl=k(1,`<li><span> </span><!><a class=pr-link target=_blank rel=noopener><span class="dim mono">#<!></span> </a><span class=pr-spacer></span><!></li>`,`D D l%b Eb%l lb%`,0,Rc),Sl=(e,t)=>xl(e,[t,`number`]),Cl=(e,t)=>{wl(e,t[0]?.worktree),Sl(e,t[0]?.prs),Tl(e,t[0]?.full_name)},wl=M(4,_c),Tl=M(6),El=O(0,`<button class=btn title="Confirm every merged/closed PR is done — remove them from this list">Clear <!> finished</button>`,` Db%`,Vc),Dl=M(4,e=>{El(e,+!e.e),zc(e)}),Ol=k(3,`<div class=pr-repo><!><ul class=pr-list></ul></div>`,`D%b `,bl,Cl),kl=I(45,e=>{Dl(e,(e._._.j||[]).reduce((e,t)=>e+t.prs.filter(e=>e.state!==`OPEN`).length,0)),Ol(e,[e._._.j.filter(e=>e.prs.length),`full_name`])},e=>e._._),Al=L(`g21`,e=>A(e.b,`click`,function(){e._._.a6()})),jl=e=>{kl(e),Ml(e),Co(e.c),wo(e.c,13),To(e.c),Al(e)},Ml=I(47,e=>{B(e.b,`spinning`,e._._.l),z(e.b,`disabled`,e._._.l)},e=>e._._),Nl=k(0,`<li><span class="mono proc-cmd"><!><!></span><button class=proc-kill>×</button></li>`,`D D%b%l `,wc,Tc),Pl=I(44,e=>Nl(e,[e._._.i,`pid`]),e=>e._._),Fl=Pl,Il=et(12),Ll=I(43,e=>{B(e.e,`spinning`,e._.h),z(e.e,`disabled`,e._.h)}),Rl=L(`g26`,e=>A(e.e,`click`,function(){Il(e)()})),zl=e=>{Ll(e),Vl(e),Ul(e),Kl(e),Yl(e),Zl(e),$l(e),eu(e),nu(e),ru(e),iu(e),au(e),ou(e),Co(e.f),wo(e.f,13),To(e.f),Ze(e,9,su),Ts(e.j),As(e.j,md(e)),ks(e.j,pd(e)),Is(e.j),Rl(e)},Bl=O(11,`<section><h3>Processes</h3><ul class=procs></ul></section>`,`Db `,Fl),Vl=I(44,e=>Bl(e,e._.i&&e._.i?.length?0:1)),Hl=O(3,(e=>`<section><div class=repos-head><h3>Pull requests</h3><!><button class=icon-btn title="Refresh PRs">${e}</button></div><!></section>`)(xo),(e=>`Eb%b D/${e}&m%l`)(So),jl),Ul=I(45,e=>Hl(e,e._.j&&e._.j.some(e=>e.prs.length)?0:1)),Wl=k(7,`<li class="cur-repo pending"><span class=spin></span><span class="dim cur-full"> </span></li>`,`DbD `,0,mc),Gl=N(13,e=>Wl(e,[[...e._.m].filter(t=>!e._.a9.has(t)),e=>e])),Kl=I(48,Gl),ql=O(8,`<li class="dim empty-note">No repos yet — search below to add one.</li>`),Jl=N(14,e=>ql(e,!e._.a1&&!e._.n?0:1)),Yl=I(49,Jl),Xl=O(2,sr,(e=>`/${e}&`)(cr),al),Zl=I(50,e=>Xl(e,+!e._.o)),Ql=k(6,`<li class=cur-repo><span class="mono cur-worktree"><!>/</span><span class="dim cur-full"> </span><!><!></li>`,`E%lD l%b%`,ll,gl),$l=I(55,e=>Ql(e,[e._.w,`full_name`])),eu=I(56,e=>V(e.a,e._.x)),tu=N(15,e=>V(e.b,e._.z||e._.a0)),nu=I(58,tu),ru=I(59,tu),iu=I(60,Jl),au=I(61,e=>{Ms(e.j,e._.a9),Gl(e)}),ou=I(62,e=>Fs(e.j,hd(e))),su=it(`g23`,M(12)),cu=ut(`g28`,((e,t)=>`<header class=manage-head><div><h2> </h2><p class="dim mono"> </p></div></header><!><!><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!><!></ul>${t}</section><!><!>`)(xo,Eo),((e,t)=>`F lD n%b%bEb D/${e}&mD%b%b%l0${t}&l%c`)(So,Do),zl,0,`B2`),lu=O(1,`<span class="act-step dim"><span class=spin></span> </span>`,`Db `,Uc),uu=N(6,e=>lu(e,e._.p&&e._.s?0:1)),du=N(5,e=>V(e.e,e._.p===`delete`?`Deleting…`:e._.q?`Really delete?`:`Delete`)),fu=I(51,e=>{z(e.a,`disabled`,!!e._.p),z(e.d,`disabled`,!!e._.p),uu(e),du(e)}),pu=L(`g17`,e=>{A(e.a,`click`,function(){e._.g?.()}),A(e.d,`click`,function(){e._.q?(Nu(e._,!1),e._.af(`delete`)):(Nu(e._,!0),setTimeout(()=>{Nu(e._,!1)},4e3))})}),mu=e=>{fu(e),hu(e),gu(e),vu(e),pu(e)},hu=I(52,e=>{B(e.d,`armed`,e._.q),du(e)}),gu=I(54,uu),_u=O(2,`<button class=btn> </button>`,` D `,nl,`<button class=btn>Restore</button>`,` `,$c),vu=I(57,e=>_u(e,e._.y===`active`?0:1)),yu=dt(`g27`,`<button class="btn primary">Done</button><!><div class=spacer></div><!><button class="btn danger"> </button>`,` b%c%b D `,mu),bu=j(7,F(Ll)),xu=j(11,F(Ml)),Su=M(39,F(ou)),Cu=N(38,e=>Su(e,gd(e)),3),wu=M(40),Tu=N(37,e=>wu(e,_d(e)),3),Eu=M(36,e=>{Cu(e),Tu(e)}),Du=F(Kl,cl),Ou=j(12,e=>{Gu(e,e.m?.size),Eu(e,vd(e)),Cu(e),Tu(e),Du(e)}),ku=j(14,F(Zl,rl)),Au=N(31,L(`g29`,e=>Et(e,{busyCount:e.n,pendingAction:e.p,onMount:function(){let t=new AbortController,n=t.signal;return Cn().addEventListener(`workspace.progress`,t=>{(this.pendingAction||this.busyCount)&&t.data?.message&&t.data.op===e.u&&Fu(e,t.data.message)},{signal:n}),e.a2(n),e.a3(n,!1).then(()=>e.a3(n,!0)),{abort:t}},onDestroy:function(){this.abort.abort()}})),4),ju=F(fu,el,Zc),Mu=j(15,e=>{Au(e),ju(e)}),Nu=j(16,F(hu)),Pu=j(17,F(Kc)),Fu=j(18,F(gu,Hc));function Iu(e){$s(e.a),ac(e.a,tn({content:yu(e)})),Gs(e.a,cu(e)),Qs(e.a),ec(e.a),bu(e,!1),xu(e,!1),Ou(e,new Set),ku(e,null),Mu(e,null),Nu(e,!1),Pu(e,null),Fu(e,null)}var Lu=j(8,F(Vl,Pl)),Ru=M(33),zu=N(30,e=>Ru(e,yd(e)),2),Bu=F(Ul,kl),Vu=j(9,e=>{Uu(e,e.j?.length),zu(e),Bu(e)}),Hu=(e,t)=>{Lu(e,lc.get(`procs:${t}`)||null),Vu(e,lc.get(`prs:${t}`)||null)},Uu=M(10,F(yl)),Wu=F(Yl),Gu=M(13,e=>{Au(e),Wu(e)}),Ku=M(19,e=>{$u(e,e.t?.id),nd(e,e.t?.repos),ad(e,e.t?.name),od(e,e.t?.status),sd(e,e.t?.display_path),cd(e,e.t?.path),Tu(e)}),qu=M(42),Ju=M(28,e=>{qu(e,bd(e)),Au(e)}),Yu=M(32),Xu=M(29,e=>{Yu(e,Sd(e)),Au(e),zu(e)}),Pee=M(34),Zu=M(41),Qu=N(21,e=>Zu(e,Td(e))),$u=M(20,e=>{Ju(e,xd(e)),Xu(e,Cd(e)),Pee(e,wd(e)),Au(e),zu(e),Cu(e),Qu(e)}),ed=M(35,F(au)),td=F($l),nd=M(22,e=>{rd(e,e.w?.length),ed(e,new Set(e.w.map(e=>e.full_name))),td(e)}),rd=M(27,F(iu)),id=F(eu),ad=M(23,e=>{tc(e.a,`Manage ${e.x}`),id(e)}),od=M(24,F(vu)),sd=M(25,F(nu)),cd=M(26,F(ru)),ld=(e,t)=>{Hu(e,t?.id),Ku(e,t)},ud=M(5,e=>{Cu(e),Tu(e)}),dd=M(6,e=>{ic(e.a,Ed(e)),Qu(e)});function fd(e){return function(){ku(e._._,null)}}function pd(e){return function(t){bu(e._,t)}}function md(e){return function(t){ku(e._,t)}}function hd(e){return function(t,n){e._.ad(t,n)}}function gd(e){return async(t,n)=>{if(!(!t||e.m.has(t))){ku(e,null),e.aa(t,!0);try{let r=await H(`/api/workspaces/${e.u}/repos`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,baseBranch:n})});e.f?.(r)}catch(t){ku(e,String(t.message||t))}e.aa(t,!1)}}}function _d(e){return async t=>{if(!e.m.has(t.full_name)){ku(e,null),e.aa(t.full_name,!0);try{await H(`/api/workspaces/${e.t?.id}/repos/${encodeURIComponent(t.worktree)}`,{method:`DELETE`}),e.f?.({...e.t,repos:(e.t?.repos).filter(e=>e.full_name!==t.full_name)})}catch(t){ku(e,String(t.message||t))}e.aa(t.full_name,!1)}}}function vd(e){return(t,n)=>{let r=new Set(e.m);n?r.add(t):r.delete(t),Ou(e,r)}}function yd(e){return async()=>{for(let t of e.j||[])for(let n of t.prs)n.state!==`OPEN`&&await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t.full_name,number:n.number})}).catch(()=>{});await e.a3(void 0,!1)}}function bd(e){return async t=>{await fetch(`/api/procs/${t}`,{method:`DELETE`}),setTimeout(()=>e.a2(void 0),500)}}function xd(e){return async t=>{try{let n=await H(`/api/workspaces/${e.u}/procs`,{signal:t});Lu(e,n),lc.set(`procs:${e.u}`,n)}catch{}}}function Sd(e){return async()=>{xu(e,!0),await e.a3(void 0,!0),xu(e,!1)}}function Cd(e){return async(t,n)=>{try{let r=await H(`/api/workspaces/${e.u}/prs${n?`?refresh`:``}`,{signal:t});Vu(e,r),lc.set(`prs:${e.u}`,r)}catch{}}}function wd(e){return async(t,n)=>{ku(e,null);try{let r=await H(`/api/workspaces/${e.u}/prs`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({fullName:t,number:n})});Vu(e,r),lc.set(`prs:${e.u}`,r)}catch(t){ku(e,String(t.message||t))}}}function Td(e){return async t=>{ku(e,null),Mu(e,t),Fu(e,null);try{await H(`/api/workspaces/${e.u}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:t})}),t===`delete`&&e.g?.()}catch(t){ku(e,String(t.message||t))}finally{Mu(e,null),Fu(e,null)}}}function Ed(e){return function(){e.g?.()}}R(`g11`,fd),R(`g14`,pd),R(`g13`,md),R(`g12`,hd),R(`g6`,gd),R(`g7`,_d),R(`g5`,vd),R(`g3`,yd),R(`g9`,bd),R(`g0`,xd),R(`g2`,Sd),R(`g1`,Cd),R(`g4`,wd),R(`g8`,Td),R(`g10`,Ed);var Dd=Us,Od=(e=>`/${e}&`)(Ws),kd=P(1,0,e=>V(e.a,e._.g)),Ad=kd,jd=O(1,`<span class=spin></span>`,0,0,`<span class=step-done>✓</span>`),Md=I(30,e=>{B(e.a,`active`,e.M===e._._._.m-1),jd(e,e.M===e._._._.m-1?0:1)},e=>e._._._),Nd=Md,Pd=(e,t)=>V(e.c,t),Fd=k(0,`<li><!><!></li>`,` D%b%`,Nd,(e,t)=>Pd(e,t[0])),Id=I(29,e=>Fd(e,[e._._.l]),e=>e._._),Ld=Id,Rd=I(28,e=>V(e.a,e._._._.k),e=>e._._._),zd=dt(`i11`,` `,` `,Rd),Bd=e=>{Ar(e.a,zd(e)),Er(e.a,`inline`),Pr(e.a,Wf(e)),Cr(e.a),Or(e.a),Nr(e.a)},Vd=I(27,e=>z(e.c,`disabled`,e._._.j),e=>e._._),Hd=L(`i12`,e=>A(e.c,`click`,function(){e._._.v(e.f)})),Ud=e=>{Vd(e),Hd(e)},Wd=M(5,e=>{V(e.a,e.f),z(e.c,`title`,`Remove ${e.f}`)}),Gd=O(1,`<span class="cur-base mono" title="Base branch">⎇ <!></span>`,`Db%`,Ad),Kd=M(6,e=>{Gd(e,+!e.g),kd(e)}),qd=(e,t)=>{Wd(e,t[0]?.fullName),Kd(e,t[0]?.baseBranch)},Jd=et(9),Yd=I(23,e=>jt(e,`b`,e._.f,Gf(e))),Xd=L(`i14`,e=>{Mt(e,`b`),A(e.c,`click`,function(){Jd(e)()})}),Zd=e=>{Yd(e),Qd(e),ef(e),nf(e),of(e),cf(e),lf(e),uf(e),Co(e.d),wo(e.d,13),To(e.d),Ze(e,6,df),Ts(e.g),As(e.g,qf(e)),ks(e.g,Kf(e)),Xd(e)},Qd=I(24,e=>{B(e.c,`spinning`,e._.g),z(e.c,`disabled`,e._.g)}),$d=k(4,`<li class=cur-repo><span class=cur-full> </span><!><button class=cur-remove>×</button></li>`,`E l%b `,Ud,qd),ef=I(25,e=>{Ms(e.g,new Set(e._.h.map(e=>e.fullName))),$d(e,[e._.h,`fullName`])}),tf=O(5,`<li class="dim empty-note">No repos yet — search below to add one (or create empty).</li>`),nf=I(26,e=>tf(e,+!!e._.i)),rf=O(8,`<ul class=steps></ul>`,` `,Ld),af=N(10,e=>rf(e,e._.j&&e._.m?0:1)),of=I(27,e=>{z(e.b,`disabled`,e._.j),Is(e.g,e._.j),af(e)}),sf=O(0,sr,(e=>`/${e}&`)(cr),Bd),cf=I(28,e=>sf(e,+!e._.k)),lf=I(30,af),uf=I(31,e=>Fs(e.g,Jf(e))),df=it(`i13`,M(9)),ff=ut(`i16`,((e,t)=>`<header class=manage-head><div><h2>New workspace</h2></div></header><!><label class=field><span>Name</span><input placeholder=my-feature autofocus></label><section><div class=repos-head><h3>Repos</h3><button class=icon-btn title="Refresh repo list">${e}</button></div><ul class=cur-repos><!><!></ul>${t}</section><!><!>`)(xo,Eo),((e,t)=>`b%bDb lEb D/${e}&mD%b%l0${t}&l%c`)(So,Do),Zd,0,`B2`),pf=N(3,e=>z(e.a,`disabled`,e._.j||!e._.f.trim())),mf=I(23,pf),hf=L(`i10`,e=>{A(e.a,`click`,function(){e._.w()}),A(e.c,`click`,function(){e._.e?.()})}),gf=e=>{mf(e),_f(e),hf(e)},_f=I(27,e=>{V(e.b,e._.j?`Creating…`:`Create workspace`),z(e.c,`disabled`,e._.j),pf(e)}),vf=dt(`i15`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,gf),yf=M(22),bf=N(19,e=>yf(e,Yf(e)),5),xf=F(mf,Yd),Sf=j(5,e=>{bf(e),xf(e)}),Cf=j(6,F(Qd)),wf=M(20,F(uf)),Tf=M(21),Ef=F(ef),Df=j(7,e=>{Rf(e,e.h?.length),wf(e,Xf(e)),Tf(e,Zf(e)),bf(e),Ef(e)}),Of=N(18,L(`i17`,e=>Et(e,{busy:e.j,onMount:function(){let t=new AbortController;return Cn().addEventListener(`workspace.progress`,t=>{this.busy&&t.data?.message&&e.r([t.data])},{signal:t.signal}),{abort:t}},onDestroy:function(){this.abort.abort()}}))),kf=F(_f,of,Vd),Af=j(9,e=>{Qs(e.a,!e.j),Of(e),kf(e)}),jf=j(10,F(cf,Rd)),Mf=M(17,e=>{Of(e),bf(e)}),Nf=N(16,e=>Mf(e,Qf(e)),2),Pf=F(Id),Ff=j(11,e=>{zf(e,e.l?.length),Nf(e),Pf(e)}),If=(e,t)=>{Bf(e,t.op),Vf(e,t.last)};function Lf(e){$s(e.a),ac(e.a,tn({content:vf(e)})),Gs(e.a,ff(e)),tc(e.a,`New workspace`),ec(e.a,`new-ws`),Sf(e,``),Cf(e,!1),Df(e,[]),Af(e,!1),jf(e,null),Ff(e,[]),If(e,{last:0,op:``})}var Rf=M(8,F(nf)),zf=M(12,F(lf,Md)),Bf=M(14,e=>{Nf(e),bf(e)}),Vf=M(15,e=>{Nf(e),bf(e)}),Hf=M(3,bf),Uf=M(4,e=>ic(e.a,$f(e)));function Wf(e){return function(){jf(e._._,null)}}function Gf(e){return t=>{Sf(e._,t)}}function Kf(e){return function(t){Cf(e._,t)}}function qf(e){return function(t){jf(e._,t)}}function Jf(e){return function(t,n){e._.u(t,n)}}function Yf(e){return async()=>{Af(e,!0),jf(e,null),Ff(e,[]),e.o=Math.random().toString(36).slice(2,10);try{e.p=(await H(`/api/progress`)).seq}catch{}let t=setInterval(async()=>{try{let t=await H(`/api/progress?since=${e.p}&op=${e.o}`);e.r(t.messages)}catch{}},800);try{let t=await H(`/api/workspaces`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({name:e.f,repos:e.h,opId:e.o})});Af(e,!1),e.d?.(t)}catch(t){Af(e,!1),jf(e,String(t.message||t))}finally{clearInterval(t)}}}function Xf(e){return(t,n)=>{!t||e.h.some(e=>e.fullName===t)||Df(e,e.h.concat({fullName:t,baseBranch:n}))}}function Zf(e){return t=>{Df(e,e.h.filter(e=>e.fullName!==t))}}function Qf(e){return t=>{for(let n of t)n.op===e.o&&(n.seq&&n.seq<=e.p||(n.seq&&(e.p=n.seq),Ff(e,e.l.concat(n.message))))}}function $f(e){return function(){e.e?.()}}R(`i6`,Wf),R(`i0`,Gf),R(`i9`,Kf),R(`i8`,qf),R(`i7`,Jf),R(`i4`,Yf),R(`i2`,Xf),R(`i3`,Zf),R(`i1`,Qf),R(`i5`,$f);var ep=Rr,tp=(e=>`/${e}&`)(zr);function np(e){Ur(e.a,`M14.3632 5.65156L15.8431 4.17157C16.6242 3.39052 17.8905 3.39052 18.6716 4.17157L20.0858 5.58579C20.8668 6.36683 20.8668 7.63316 20.0858 8.41421L18.6058 9.8942M14.3632 5.65156L4.74749 15.2672C4.41542 15.5993 4.21079 16.0376 4.16947 16.5054L3.92738 19.2459C3.87261 19.8659 4.39148 20.3848 5.0115 20.33L7.75191 20.0879C8.21972 20.0466 8.65806 19.8419 8.99013 19.5099L18.6058 9.8942M14.3632 5.65156L18.6058 9.8942`)}var rp=(e,t)=>Vr(e.a,t),ip=(e,t)=>Hr(e.a,t),ap=`<!><!><!>`,op=N(9,e=>B(e.d,`armed`,e._._._._.w===e.i)),sp=N(10,e=>z(e.d,`title`,e._._._._.w===e.i?`Really kill ${e.g}?`:`Kill ${e.g} (pid ${e.i})`),2),cp=I(39,e=>{op(e),sp(e)},e=>e._._._._),Fee=L(`m8`,e=>{A(e.b,`click`,function(){window.open(`http://${location.hostname}:${e.h}`,`_blank`,`noopener`)}),A(e.d,`click`,function(){e._._._._.w===e.i?(vm(e._._._._,null),fetch(`/api/procs/${e.i}`,{method:`DELETE`}).catch(()=>{})):e._._._._.z(()=>{vm(e._._._._,e.i)})})}),Iee=e=>{cp(e),Fee(e)},Lee=M(6,e=>{z(e.a,`title`,e.g),sp(e)}),Ree=M(7,e=>{z(e.b,`title`,`Open http://${typeof location>`u`?`localhost`:location.hostname}:${e.h}`),V(e.c,e.h)}),zee=M(8,e=>{op(e),sp(e)}),Bee=(e,t)=>{Lee(e,t[0]?.cmd),Ree(e,t[0]?.port),zee(e,t[0]?.pid)},lp=N(12,e=>V(e.b,e._._.c(e._.c))),up=I(3,lp,e=>e._._),Vee=L(`m7`,e=>A(e.a,`click`,function(){e._._._._._.u?.(e._.e,e.l)})),Hee=e=>{up(e),dp._(e),pp._(e),Vee(e)},dp=Ke(0,lp),fp=N(10,e=>z(e.a,`title`,`${e._.e} — ${e.j}${e.h===`APPROVED`?` (approved)`:e.h===`CHANGES_REQUESTED`?` (changes requested)`:``}`),2),pp=Ke(0,fp),mp=N(8,e=>gt(e.a,{draft:e.g,rejected:e.h===`CHANGES_REQUESTED`})),Uee=M(6,mp),Wee=M(7,e=>{V(e.d,e.h===`APPROVED`?` ✓`:e.h===`CHANGES_REQUESTED`?` ✗`:``),mp(e),fp(e)}),Gee=M(9,fp),Kee=M(11,e=>V(e.c,e.l)),qee=k(0,`<button class="chip pr"><!>#<!><!></button>`,` D%c%b%`,Hee,(e,t)=>{Uee(e,t[0]?.isDraft),Wee(e,t[0]?.reviewDecision),Gee(e,t[0]?.title),Kee(e,t[0]?.number)}),Jee=(e,t)=>qee(e,[t||[],`number`]),Yee=(e,t)=>Xee(e,t[0]),Xee=M(2,e=>{Jee(e,e.c?.prs),Zee(e,e.c?.worktree),dp(e)}),Zee=M(4,pp),Qee=M(2,F(up)),$ee=k(0,`<!><!><!>`,`b%`,0,Yee),hp=I(6,e=>{Qee(e,Wm(e)),$ee(e,[e._._.c||[],`full_name`])},e=>e._._),ete=e=>{hp(e),_p(e)},gp=k(1,`<span class="chip port-chip"><button class=port-open>:<!></button><button class=port-kill>×</button></span>`,` D Db%l `,Iee,Bee),_p=I(7,e=>gp(e,[e._._.d||[],`port`]),e=>e._._),vp=N(11,e=>B(e.a,`current`,e.k===e._._._.q)),yp=I(37,vp,e=>e._._._),bp=L(`m6`,e=>{A(e.b,`click`,function(){e._._._.r?.(e.k)}),A(e.f,`click`,function(){e._._._.s?.(e.j)}),A(e.h,`click`,function(){e._._._.v===e.k?(_m(e._._._,null),e._._._.t?.(e.k)):e._._._.z(()=>{_m(e._._._,e.k)})})}),xp=e=>{yp(e),Cp(e),e.d,hi(e.d,13),yi(e.d,`sess-icon`),np(e.g),rp(e.g,12),ip(e.g),bp(e)},Sp=N(12,e=>{B(e.h,`armed`,e._._._.v===e.k),z(e.h,`title`,e._._._.v===e.k?`Really kill this session?`:`Kill session`)}),Cp=I(38,Sp,e=>e._._._),wp=M(10,e=>{vp(e),Sp(e)}),Tp=(e,t)=>ht(e.c,[`dot`,Lr(t)]),Ep=N(16,e=>V(e.e,e.p||e.o)),Dp=M(14,e=>{vi(e.d,e.o),Ep(e)}),tte=M(15,Ep),nte=(e,t)=>rte(e,t[0]),rte=M(9,e=>{wp(e,e.j?.id),Tp(e,e.j?.state),Dp(e,e.j?.agent),tte(e,e.j?.title)}),Op=L(`m4`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._.n?.(e.e)})),kp=e=>{e.b,hi(e.b,14),yi(e.b),Op(e)},Ap=M(4,e=>{vi(e.b,e.e),V(e.c,e.e)}),jp=k(2,(e=>`<button>${e}<!></button>`)(ai),(e=>` D/${e}&%l`)(`b%c`),kp,(e,t)=>Ap(e,t[0])),Mp=I(35,e=>jp(e,[[...e._._._.o||[],`shell`],e=>e]),e=>e._._._),Np=(e,t)=>{z(e.a,`popovertarget`,t),z(e.c,`id`,t)},Pp=L(`m5`,e=>A(e.c,`toggle`,function(t,n){if(t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${t.bottom+4}px`,n.style.left=`${Math.max(8,Math.min(t.left,window.innerWidth-n.offsetWidth-8))}px`}})),Fp=e=>{Mp(e),e.b,vi(e.b,`shell`),hi(e.b,12),yi(e.b),Np(e,Qe(e)),Pp(e)},Ip=L(`m3`,e=>A(e.a,`click`,function(){e._._._.l?.()})),Lp=e=>{Kr(e.b),qr(e.b,12),Jr(e.b),Ip(e)},Rp=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),zp=L(`m9`,e=>{A(e.b,`click`,function(){e._._.j()}),A(e.f,`click`,function(){e._._.m?.()})}),Bp=e=>{Rp(e),Hp(e),Wp(e),qp(e),Jp(e),Xp._(e),Zp._(e),Qp._(e),Zr(e.g),Qr(e.g,12),$r(e.g),zp(e)},Vp=O(4,(e=>`<button class="row-icon new-sess" title="Review changes">${e}</button>`)(Wr),(e=>` D/${e}&l`)(Gr),Lp),Hp=I(33,e=>Vp(e,+!e._._.l),e=>e._._),Up=O(7,(e=>`<button class="row-icon new-sess" title="New session">${e}</button><div popover=auto class=new-session-pop></div>`)(ai),(e=>` D/${e}&l b`)(`b%c`),Fp),Wp=I(34,e=>Up(e,+!e._._.n),e=>e._._),Gp=k(8,((e,t)=>`<div class=side-sess><button class=side-sess-btn><span></span>${e}<!></button><button class=row-icon title="Rename session">${t}</button><button class=close>×</button></div>`)(ai,ep),((e,t)=>` D D b/${e}&%l D/${t}&l l`)(`b%c`,tp),xp,nte),Kp=(e,t)=>Gp(e,[t.length>1?t:[],`id`]),qp=I(36,e=>Kp(e,e._._.p||[]),e=>e._._),Jp=I(40,e=>V(e.d,e._._.a1),e=>e._._),ite=O(9,`<div class=side-chips><!><!></div>`,`D%b%`,ete),Yp=N(11,e=>ite(e,(e._.c||[]).some(e=>(e.prs||[]).length)||(e._.d||[]).length?0:1)),Xp=P(0,1,Yp),Zp=P(0,1,Yp),Qp=P(0,1,e=>ht(e.c,[`dot`,e._.e])),$p=I(31,e=>B(e.a,`current`,e._._.i),e=>e._._),em=L(`m2`,e=>A(e.a,`click`,function(){e._._.j()})),tm=e=>{$p(e),nm(e),rm(e),im._(e),em(e)},nm=I(32,e=>V(e.b,(e._._.k??0)+1),e=>e._._),rm=I(40,e=>z(e.a,`title`,e._._.a1),e=>e._._),im=P(0,0,e=>ht(e.c,[`dot`,e._.e])),am=M(4,e=>{im(e),Qp(e)}),om=(e,t)=>{mm(e,t?.repos),gm(e,t?.ports),am(e,Ir(t))},sm=N(5,e=>om(e,e._.g[e._.e])),cm=P(0,0,sm),lm=e=>{cm._(e),um._(e),fm._(e)},um=P(0,0,sm),dm=O(0,`<button class="icon-btn rail-btn"> <span></span></button>`,` D b `,tm,(e=>`<section class=side-ws><div class=side-ws-row><button class=side-ws-btn><span></span><span class=side-ws-name> </span></button><!><button class=row-icon title="Manage workspace">${e}</button><!></div><div class=side-sessions><!><!></div></section>`)(Yr),(e=>` E D bD m%b D/${e}&l%lD%b%m`)(Xr),Bp),fm=P(0,0,e=>dm(e,+!e._.h)),pm=F(hp),mm=M(2,e=>{Xp(e),pm(e)}),hm=F(_p),gm=M(3,e=>{Zp(e),hm(e)}),_m=j(21,F(Cp)),vm=j(22,F(cp)),ym=(e,t)=>Sm(e,t.timer);function bm(e){_m(e,null),vm(e,null),ym(e,{timer:0})}var xm=M(25),Sm=M(24,e=>xm(e,Gm(e))),Cm=O(0,`<!><!><!>`,`b%`,lm),wm=(e,t)=>{Tm(e,t?.name),Cm(e,+!t)},Tm=M(27,F(rm,Jp)),Em=N(5,e=>wm(e,e.d.find(t=>t.id===e.e))),Dm=M(3,Em),Om=M(4,e=>{Em(e),cm(e)}),km=M(6,um),Am=M(7,fm),jm=M(8,F($p,Rp)),Mm=M(9),Nm=M(10,F(nm)),Pm=M(11,F(Hp)),Fm=M(12),Im=M(13,F(Wp)),Lm=M(14,F(Mp)),Rm=M(15,F(qp)),zm=M(16,F(yp)),Bm=M(17),Vm=M(18),Hm=M(19),Um=M(20);function Wm(e){return t=>{let n=e._._.c||[];if(n.length<2)return``;let r=t.full_name.split(`/`)[1];return n.some(e=>e.full_name!==t.full_name&&e.full_name.split(`/`)[1]===r)?t.full_name:r}}function Gm(e){return t=>{clearTimeout(e.y),t(),e.y=setTimeout(()=>{_m(e,null),vm(e,null)},3500)}}R(`m1`,Wm),R(`m0`,Gm);var Km=Rr,qm=(e=>`/${e}&`)(zr);function Jm(e){Ur(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M7.25 10L5.5 12L7.25 14 M9.5 21V3`)}var Ym=(e,t)=>Vr(e.a,t),Xm=(e,t)=>Hr(e.a,t),Zm=Rr,Qm=(e=>`/${e}&`)(zr);function $m(e){Ur(e.a,`M19 21L5 21C3.89543 21 3 20.1046 3 19L3 5C3 3.89543 3.89543 3 5 3L19 3C20.1046 3 21 3.89543 21 5L21 19C21 20.1046 20.1046 21 19 21Z M9.5 21V3 M5.5 10L7.25 12L5.5 14`)}var eh=(e,t)=>Vr(e.a,t),th=(e,t)=>Hr(e.a,t),nh=Rr,rh=(e=>`/${e}&`)(zr);function ih(e){Ur(e.a,`M18 8.4C18 6.70261 17.3679 5.07475 16.2426 3.87452C15.1174 2.67428 13.5913 2 12 2C10.4087 2 8.88258 2.67428 7.75736 3.87452C6.63214 5.07475 6 6.70261 6 8.4C6 15.8667 3 18 3 18H21C21 18 18 15.8667 18 8.4Z M13.73 21C13.5542 21.3031 13.3019 21.5547 12.9982 21.7295C12.6946 21.9044 12.3504 21.9965 12 21.9965C11.6496 21.9965 11.3054 21.9044 11.0018 21.7295C10.6982 21.5547 10.4458 21.3031 10.27 21`)}var ah=(e,t)=>Vr(e.a,t),oh=(e,t)=>Hr(e.a,t),sh=Rr,ch=(e=>`/${e}&`)(zr);function lh(e){Ur(e.a,`M3 12H6L9 3L15 21L18 12H21`)}var uh=(e,t)=>Vr(e.a,t),dh=(e,t)=>Hr(e.a,t),fh=Rr,ph=(e=>`/${e}&`)(zr);function mh(e){Ur(e.a,`M18 6H20M22 6H20M20 6V4M20 6V8 M21.4 20H2.6C2.26863 20 2 19.7314 2 19.4V11H21.4C21.7314 11 22 11.2686 22 11.6V19.4C22 19.7314 21.7314 20 21.4 20Z M2 11V4.6C2 4.26863 2.26863 4 2.6 4H8.77805C8.92127 4 9.05977 4.05124 9.16852 4.14445L12.3315 6.85555C12.4402 6.94876 12.5787 7 12.722 7H14`)}var hh=(e,t)=>Vr(e.a,t),gh=(e,t)=>Hr(e.a,t),_h=((e,t)=>`<!><!><aside class=side-nav><div class=side-list></div><!><div class=side-foot><button class="icon-btn nav-toggle"></button><div class=spacer></div><!><button class=icon-btn title=Usage>${e}</button><button class=icon-btn title="New workspace">${t}</button></div></aside>`)(sh,fh),vh=((e,t)=>`b%b D b%bD c%b D/${e}&l D/${t}&n`)(ch,ph),yh=e=>{$m(e.a),eh(e.a,15),th(e.a)},ate=e=>{Jm(e.a),Ym(e.a,15),Xm(e.a)},bh=P(5,0,e=>{B(e.a,`on`,e._.an),z(e.a,`title`,e._.an?`Disable agent-waiting notifications`:`Notify when an agent is waiting`)}),ote=L(`n19`,e=>A(e.a,`click`,function(){e._.ap()})),ste=e=>{bh._(e),ih(e.b),ah(e.b,15),oh(e.b),ote(e)},cte=L(`n16`,e=>A(e.a,`click`,function(){Zg(e._,!1)})),xh=N(7,e=>Pm(e.b,P_(e)),4),Sh=I(56,xh,e=>e._._),lte=L(`n18`,e=>{A(e.a,`mouseenter`,function(){e._.i()}),A(e.a,`mouseleave`,function(){e._.j()})}),ute=e=>{Sh(e),Ch(e),Th(e),Eh(e),Oh(e),kh(e),Ah(e),Nh(e),Ph(e),Fh(e),Ih(e),Lh(e),zh._(e),Vh._(e),Hh._(e),bm(e.b),Fm(e.b,F_(e)),Am(e.b),Nm(e.b),lte(e)},Ch=I(57,e=>Lm(e.b,e._._.a2),e=>e._._),wh=N(3,e=>Im(e.b,I_(e))),Th=I(58,wh,e=>e._._),Eh=I(59,xh,e=>e._._),Dh=N(5,e=>Rm(e.b,e.c===e._._.ad&&e._._.a5?e._._.a5:e._._.as[e.c]?.sessions||[]),3),Oh=I(60,Dh,e=>e._._),kh=I(61,e=>Vm(e.b,e._._.a7),e=>e._._),Ah=I(62,e=>Hm(e.b,e._._.a8),e=>e._._),jh=N(4,e=>jm(e.b,e.c===e._._.ad)),Mh=N(6,e=>zm(e.b,e.c===e._._.ad&&e._._.ah===`term`?e._._.af:null),3),Nh=I(63,e=>{Mm(e.b,z_(e)),Um(e.b,R_(e)),Bm(e.b,L_(e)),jh(e),xh(e),Dh(e),Mh(e)},e=>e._._),Ph=I(64,Mh,e=>e._._),Fh=I(65,e=>{xh(e),Mh(e)},e=>e._._),Ih=I(68,e=>Dm(e.b,e._._.ar),e=>e._._),Lh=I(69,e=>{km(e.b,e._._.as),Dh(e)},e=>e._._),Rh=M(2,e=>{Om(e.b,e.c),jh(e),wh(e),xh(e),Dh(e),Mh(e)}),zh=P(1,0,e=>Rh(e,e._.d)),Bh=N(8,e=>_t(e.a,`top:${e._.e}px;left:${e._.f}px`)),Vh=P(1,0,Bh),Hh=P(1,0,Bh),Uh=N(4,e=>jm(e.b,e.d===e._._.ad)),Wh=I(63,e=>{Mm(e.b,B_(e)),Uh(e)},e=>e._._),Gh=L(`n17`,e=>{A(e.a,`mouseenter`,function(t,n){e._.i();let r=n.getBoundingClientRect();eg(e._,{id:e.d,top:r.top,left:r.right+8})}),A(e.a,`mouseleave`,function(){e._.j()})}),Kh=e=>{Wh(e),qh(e),Jh(e),bm(e.b),Am(e.b,!0),Pm(e.b),Fm(e.b),Im(e.b),Lm(e.b),Rm(e.b),zm(e.b),Bm(e.b),Vm(e.b),Hm(e.b),Um(e.b),Gh(e)},qh=I(68,e=>Dm(e.b,e._._.ar),e=>e._._),Jh=I(69,e=>km(e.b,e._._.as),e=>e._._),Yh=(e,t)=>Nm(e.b,t),Xh=M(3,e=>{Om(e.b,e.d),Uh(e)}),Zh=k(0,(e=>`<span>${e}</span>`)(ap),(e=>` D/${e}&l`)(`b%c`),Kh,(e,t)=>{Xh(e,t[0]),Yh(e,t[1])}),Qh=P(3,0,e=>Zh(e,[e._.aq,e=>e])),$h=O(1,(e=>`<div class=rail-pop>${e}</div>`)(ap),(e=>` D/${e}&l`)(`b%c`),ute),eg=j(2,e=>{rg(e,e.c?.id),ig(e,e.c?.top),ag(e,e.c?.left),$h(e,+!e.c)}),tg=(e,t)=>cg(e,t.timer),ng=e=>{Qh._(e),eg(e,null),tg(e,{timer:0})},rg=M(3,zh),ig=M(4,Vh),ag=M(5,Hh),og=M(8),sg=M(9),cg=M(7,e=>{og(e,V_(e)),sg(e,H_(e))}),lg=N(7,e=>Pm(e.a,U_(e)),4),ug=Ke(2,lg),dg=e=>{ug._(e),fg._(e),mg._(e),hg._(e),_g._(e),vg._(e),yg._(e),xg._(e),Sg._(e),Cg._(e),wg._(e),Tg._(e),bm(e.a),Fm(e.a,W_(e)),Am(e.a),Nm(e.a)},fg=Ke(2,e=>Lm(e.a,e._.a2)),pg=N(3,e=>Im(e.a,G_(e))),mg=Ke(2,pg),hg=Ke(2,lg),gg=N(5,e=>Rm(e.a,e.c===e._.ad&&e._.a5?e._.a5:e._.as[e.c]?.sessions||[]),3),_g=Ke(2,gg),vg=Ke(2,e=>Vm(e.a,e._.a7)),yg=Ke(2,e=>Hm(e.a,e._.a8)),bg=N(6,e=>zm(e.a,e.c===e._.ad&&e._.ah===`term`?e._.af:null),3),xg=qe(2,39,2,e=>{jm(e.a,e.c===e._.ad),Mm(e.a,J_(e)),Um(e.a,q_(e)),Bm(e.a,K_(e)),lg(e),gg(e),bg(e)}),Sg=Ke(2,bg),Cg=Ke(2,e=>{lg(e),bg(e)}),wg=Ke(2,e=>Dm(e.a,e._.ar)),Tg=Ke(2,e=>{km(e.a,e._.as),gg(e)}),Eg=M(2,e=>{Om(e.a,e.c),pg(e),lg(e),gg(e),bg(e)}),Dg=(e,t)=>Eg(e,t[0]),Og=F(qh,Ih),kg=M(53,e=>{wg(e),Og(e)}),Ag=N(38,e=>kg(e,e.y||[e.ab])),jg=M(37,e=>{Lg(e,e.ab?.id),Ag(e)}),Mg=k(2,(e=>`<!>${e}<!>`)(ap),(e=>`b/${e}&b`)(`b%c`),dg,Dg),Ng=M(52,e=>{Mg(e,[e.aq,e=>e]),Qh(e)}),Pg=N(40,e=>Ng(e,e.y?.length?e.y.filter(e=>e.status===`active`).map(e=>e.id):[e.ad])),Fg=N(55,e=>e.as[e.ad]),Ig=F(Wh,Nh),Lg=M(39,e=>{Pg(e),Fg(e),xg(e),Ig(e)}),Rg=jg,zg=F(Ph),Bg=Ge(41,e=>{Sg(e),zg(e)}),Vg=N(15,e=>Bg(e,e.n,e.o)),Hg=M(13,Vg),Ug=M(14,Vg),Wg=F(Fh),Gg=Ge(43,e=>{z(e.b,`hidden`,e.ah===`diff`),Cg(e),Wg(e)}),Kg=N(18,e=>Gg(e,e.q,e.r)),qg=M(16,Kg),Jg=M(17,Kg),Yg=O(0,`<div class=drawer-backdrop></div>`,` `,cte),Xg=N(48,e=>gt(e.b,{closed:!e.al,open:e.aj})),Zg=Ge(45,e=>{Yg(e,+!e.aj),Xg(e)}),Qg=N(21,e=>Zg(e,e.t,e.u)),$g=M(19,Qg),e_=M(20,Qg),t_=O(3,`<div class=side-rail></div><!><!>`,` b%`,ng),n_=O(4,Km,(e=>`/${e}&`)(qm),ate,Zm,(e=>`/${e}&`)(Qm),yh),r_=j(47,e=>{z(e.e,`title`,e.al?`Collapse sidebar`:`Expand sidebar`),t_(e,+!!e.al),n_(e,+!e.al),Xg(e)}),i_=M(51),a_=N(50,e=>i_(e,Y_(e))),o_=j(49,e=>{a_(e),bh(e)}),s_=O(5,(e=>`<button class="icon-btn notify-btn">${e}</button>`)(nh),(e=>` D/${e}&l`)(rh),ste),c_=L(`n21`,e=>{Et(e,{onMount:function(){Xn()&&Zn().then(t=>{o_(e,!!t)})}}),A(e.e,`click`,function(){r_(e,!e.al),Un(e.al)}),A(e.g,`click`,function(){Zg(e,!1),e.a9?.()}),A(e.i,`click`,function(){Zg(e,!1),e.aa?.()})});function l_(e){lh(e.h),uh(e.h,15),dh(e.h),mh(e.j),hh(e.j,16),gh(e.j),r_(e,Hn()),o_(e,!1),s_(e,+!Xn()),c_(e)}var u_=M(22,a_),d_=M(23,L(`n20`,e=>{e.x&&r_(e,Hn())})),f_=M(24,e=>{Pg(e),Ag(e)}),p_=F(Jh,Lh),m_=M(54,e=>{Fg(e),Tg(e),p_(e)}),h_=(e,t)=>m_(e,t||{}),g_=F(Sh),__=M(26,e=>{ug(e),g_(e)}),v_=M(27),y_=F(Ch),b_=M(28,e=>{fg(e),y_(e)}),x_=F(Th),S_=M(29,e=>{mg(e),x_(e)}),C_=F(Eh),w_=M(30,e=>{hg(e),C_(e)}),T_=F(Oh),E_=M(31,e=>{_g(e),T_(e)}),D_=M(32),O_=F(kh),k_=M(33,e=>{vg(e),O_(e)}),A_=F(Ah),j_=M(34,e=>{yg(e),A_(e)}),M_=M(35),N_=M(36);function P_(e){return function(){eg(e._,null),e.c===e._._.ad?(Gg(e._._,e._._.ah===`diff`?`term`:`diff`),e._._.ah===`diff`&&e._._.a4?.()):(On(e.c),e._._.a0?.(e.c))}}function F_(e){return function(){eg(e._,null),e._._.a1?.(e.c)}}function I_(e){return function(t){eg(e._,null),e._._.a3(e.c,t)}}function L_(e){return function(t){eg(e._,null),e.c===e._._.ad?(Bg(e._._,t),Gg(e._._,`term`)):e._._.a6?.(e.c,t)}}function R_(e){return function(t,n){eg(e._,null);let r=`${t}/${n}`;e.c===e._._.ad?(Gg(e._._,`diff`),e._._.a4?.(r)):(On(e.c,r),e._._.a0?.(e.c))}}function z_(e){return function(){eg(e._,null),e.c!==e._._.ad&&e._._.a0?.(e.c)}}function B_(e){return function(){e.d!==e._._.ad&&e._._.a0?.(e.d)}}function V_(e){return()=>clearTimeout(e.h)}function H_(e){return()=>{clearTimeout(e.h),e.h=setTimeout(()=>{eg(e,null)},150)}}function U_(e){return function(){Zg(e._,!1),e.c===e._.ad?(Gg(e._,e._.ah===`diff`?`term`:`diff`),e._.ah===`diff`&&e._.a4?.()):(On(e.c),e._.a0?.(e.c))}}function W_(e){return function(){Zg(e._,!1),e._.a1?.(e.c)}}function G_(e){return function(t){Zg(e._,!1),e._.a3(e.c,t)}}function K_(e){return function(t){Zg(e._,!1),e.c===e._.ad?(Bg(e._,t),Gg(e._,`term`)):e._.a6?.(e.c,t)}}function q_(e){return function(t,n){Zg(e._,!1);let r=`${t}/${n}`;e.c===e._.ad?(Gg(e._,`diff`),e._.a4?.(r)):(On(e.c,r),e._.a0?.(e.c))}}function J_(e){return function(){e.c!==e._.ad&&(Zg(e._,!1),e._.a0?.(e.c))}}function Y_(e){return async()=>{try{e.an?(await $n(),o_(e,!1)):(o_(e,await Qn()),e.an||e.w?.(`Notifications blocked — allow them for this site in browser/system settings.`))}catch(t){o_(e,!1),e.w?.(`Notifications failed: ${String(t.message||t)}`)}}}R(`n13`,P_),R(`n11`,F_),R(`n12`,I_),R(`n15`,L_),R(`n14`,R_),R(`n10`,z_),R(`n9`,B_),R(`n7`,V_),R(`n8`,H_),R(`n4`,U_),R(`n2`,W_),R(`n3`,G_),R(`n6`,K_),R(`n5`,q_),R(`n1`,J_),R(`n0`,Y_);async function X_(e){try{return await navigator.clipboard.writeText(e),!0}catch{let t=document.createElement(`textarea`);t.value=e,t.style.cssText=`position:fixed;top:-100px;opacity:0;`,document.body.append(t),t.focus(),t.select();let n=document.execCommand(`copy`);return t.remove(),n}}var Z_=null;function Q_(){return Z_}function $_(e){let t=[],n=[];for(let r of e.trim().split(/\s+/).filter(Boolean)){let e=r.startsWith(`!`),i=e?r.slice(1):r;i&&(e?n:t).push(ev(i))}return e=>!n.some(t=>t(e))&&t.every(t=>t(e))}function ev(e){if(!/[*?]/.test(e))return t=>Fr(e,t);let t=``;for(let n=0;n<e.length;n++){let r=e[n];r===`*`?e[n+1]===`*`?(t+=`.*`,n++):t+=`[^/]*`:t+=r===`?`?`[^/]`:r.replace(/[.+^${}()|[\]\\]/,`\\$&`)}try{let e=new RegExp(t,`i`);return t=>e.test(t)}catch{return t=>Fr(e,t)}}var tv=3;function nv(e,t){let n=new Map;for(let t of e)n.set(t.worktree,[...n.get(t.worktree)||[],t]);let r=[`Review feedback:`],i=0;for(let[e,a]of n){let n=(t||[]).find(t=>t.worktree===e);r.push(``),r.push(rv(e,n));for(let e of a){i++;let t=n?.files.find(t=>t.path===e.path),a=e.side===`deletions`?t?.old:t?.new,o=e.side===`deletions`?`Old`:`New`,s=e.line_start===e.line_end?`line ${e.line_start}`:`lines ${e.line_start}-${e.line_end}`;if(r.push(``),r.push(`${i}. **${e.path}** (${o} ${s})`),a!=null){let t=av(a,e.line_start,e.line_end,e.side),n=ov(t);r.push(``),r.push(sv(`${n}diff\n${t}\n${n}`))}r.push(``),r.push(sv(e.text))}}return r.join(`
|
|
4
4
|
`)}function rv(e,t){if(!t?.head)return`${e}/`;let n=iv(t.head),r=iv(t.baseSha),i=t.pr?.headRefName||t.branch||`HEAD`;return`${e}/${t.pr?` #${t.pr.number}`:``} — \`${i}\` ${n} vs \`${t.base}\` ${r}`}function iv(e,t=12){return e.slice(0,t)}function av(e,t,n,r){let i=e.split(`
|
|
5
5
|
`),a=Math.max(1,t-tv),o=Math.min(i.length,n+tv),s=r===`deletions`?`-`:`+`,c=[];for(let e=a;e<=o;e++){let r=e>=t&&e<=n?s:` `;c.push(`${r}${String(e).padStart(4)} | ${i[e-1]??``}`)}return c.join(`
|
|
6
6
|
`)}function ov(e){let t=3,n=/`+/g,r;for(;r=n.exec(e);)t=Math.max(t,r[0].length+1);return"`".repeat(t)}function sv(e){return e.split(`
|
|
7
7
|
`).map(e=>e&&` ${e}`).join(`
|
|
8
8
|
`)}function cv(e){let t={dirs:new Map,files:[]};for(let n of e){let e=n.path.split(`/`),r=e.pop(),i=t;for(let t of e){let e=i.dirs.get(t);e||(e={dirs:new Map,files:[]},i.dirs.set(t,e)),i=e}i.files.push({file:n,name:r})}let n=[],r=(e,t,i)=>{for(let[a,o]of[...e.dirs].sort(([e],[t])=>e.localeCompare(t))){let e=a,s=o;for(;s.dirs.size===1&&!s.files.length;){let[[t,n]]=s.dirs;e+=`/${t}`,s=n}let c=i?`${i}/${e}`:e;n.push({kind:`dir`,label:e,path:c,depth:t}),r(s,t+1,c)}for(let{file:r,name:i}of e.files)n.push({kind:`file`,file:r,name:i,depth:t})};return r(t,0,``),n}var lv=Rr,uv=(e=>`/${e}&`)(zr);function dv(e){Ur(e.a,`M15 6L9 12L15 18`)}var fv=(e,t)=>Vr(e.a,t),pv=(e,t)=>Hr(e.a,t),mv=Rr,hv=(e=>`/${e}&`)(zr);function gv(e){Ur(e.a,`M17 17L21 21 M3 11C3 15.4183 6.58172 19 11 19C13.213 19 15.2161 18.1015 16.6644 16.6493C18.1077 15.2022 19 13.2053 19 11C19 6.58172 15.4183 3 11 3C6.58172 3 3 6.58172 3 11Z`)}var _v=(e,t)=>Vr(e.a,t),vv=(e,t)=>Hr(e.a,t),yv=`<div class=wrap><input class=file-filter type=search placeholder="Filter files… (globs, !excludes)" aria-label="Filter files"></div>`,bv=N(12,e=>jt(e,`a`,e.f,Nv(e))),xv=M(11,bv),Sv=N(10,e=>xv(e,Pv(e)),2),Cv=M(9,Sv),wv=N(8,e=>Cv(e,Fv(e)),2),Tv=j(5,e=>{wv(e),bv(e)}),Ev=(e,t)=>Tv(e,t||``),Dv=(e,t)=>kv(e,t.timer),Ov=L(`f4`,e=>Et(e,{onDestroy:function(){e.h&&clearTimeout(e.h)}})),kv=M(7,e=>{wv(e),Sv(e),Ov(e)}),Av=L(`f3`,e=>{Mt(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&e.j(),t.key===`Escape`&&e.f&&(t.preventDefault(),Tv(e,``),e.l(``))})});function jv(e){Dv(e,{timer:0}),Av(e)}var Mv=M(4,e=>{wv(e),Sv(e)});function Nv(e){return function(t){e.l(t)}}function Pv(e){return t=>{if(Tv(e,t),e.h&&clearTimeout(e.h),!t){e.h=0,e.e(``);return}e.h=setTimeout(e.j,150)}}function Fv(e){return()=>{e.h&&=(clearTimeout(e.h),0),e.e(e.f)}}R(`f0`,Nv),R(`f2`,Pv),R(`f1`,Fv);var Iv=200,Lv=40;function Rv(e,t){let n=t.trim();if(!n)return[];let r=/[A-Z]/.test(n),i=r?n:n.toLowerCase(),a=[];for(let t of e){if(a.length>=Iv)break;(r?t.path:t.path.toLowerCase()).includes(i)&&a.push({key:t.key,path:t.path,repo:t.repo,line:0,side:null,preview:t.path});let e=new Set;zv(t,t.new,`additions`,i,r,e,a),zv(t,t.old,`deletions`,i,r,e,a)}return a}function zv(e,t,n,r,i,a,o){if(!t||o.length>=Iv)return;let s=0,c=t.split(`
|
|
9
|
-
`);for(let t=0;t<c.length;t++){if(o.length>=Iv||s>=Lv)return;let l=c[t],u=(i?l:l.toLowerCase()).indexOf(r);u<0||n===`deletions`&&a.has(l)||(n===`additions`&&a.add(l),s++,o.push({key:e.key,path:e.path,repo:e.repo,line:t+1,side:n,preview:Bv(l,u,r.length)}))}}function Bv(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var Vv=`search-mark`,Hv=`mark.${Vv}`,dte=`mark.${Vv}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Vv} *,mark.${Vv} *::before,mark.${Vv} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Vv}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,Uv={query:``,hit:null},Wv=new Map;function Gv(e,t){Uv.query=e,Uv.hit=t;for(let[e,t]of Wv)Xv(e,Uv.query,Uv.hit?.key===t?Uv.hit:null);t&&requestAnimationFrame(()=>{for(let[e,n]of Wv)n===t.key&&Kv(e,t)})}function Kv(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return;let r=n.querySelector(`mark.search-mark.active`);if(r){r.scrollIntoView({block:`center`});return}if(t.line<1)return;let i=[...n.querySelectorAll(`[data-line="${t.line}"]`)],a=t.side||`additions`;(i.find(e=>Jv(e)===a)??i[0])?.scrollIntoView({block:`center`})}function qv(e,t){let n=t&&Uv.hit?.key===t?Uv.hit:null;Xv(e,Uv.query,n),n&&requestAnimationFrame(()=>Kv(e,n))}function fte(e,t){return Wv.set(e,t),qv(e,t),()=>{Wv.delete(e)}}function pte(e){qv(e,Wv.get(e))}function mte(e){for(let t of[...e.querySelectorAll(Hv)]){let e=t.parentElement;t.replaceWith(...t.childNodes),e?.normalize()}}function Jv(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function hte(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Hv)||n.push(e);return n}function Yv(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function gte(e,t,n,r,i){let a=Yv(e,t,n),o=Yv(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function _te(e,t,n,r){let i=hte(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=Jv(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${Vv} active`:Vv;for(let e=c.length-1;e>=0;e--)gte(i,a,c[e][0],c[e][1],d)}function Xv(e,t,n){let r=[e],i=e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(mte(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`))_te(t,s,o,n)}var vte=`<div class=find-bar><input class=find-input type=search placeholder="Find in diffs" aria-label="Find in diffs"><span class=count> </span><button class=icon-btn title="Previous match">↑</button><button class=icon-btn title="Next match">↓</button><button class=icon-btn title="Close find">×</button></div>`,yte=`D bD l b b l`,bte=(e,t)=>Ote(e,t?.length),Zv=N(12,e=>bte(e,Rv(e.h,e.l))),Qv=N(29,L(`d5`,e=>Et(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(t.key===`Escape`){if(t.target instanceof HTMLTextAreaElement)return;t.preventDefault(),e.j();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))},{signal:t.signal}),e.w=e.k,setTimeout(()=>e.a?.focus(),0),{abort:t}},onUpdate:function(){if(e.k!==e.w){e.w=e.k;let t=e.a;t?.focus(),t?.select()}},onDestroy:function(){e.v&&clearTimeout(e.v),this.abort.abort(),Gv(``,null),e.i({query:``,hit:null,keys:[]})}})),5),xte=M(28,Qv),$v=N(25,e=>xte(e,py(e)),3),ey=N(27,e=>jt(e,`a`,e.l,my(e))),ty=N(19,e=>V(e.b,e.l.trim()?e.q?`${e.s+1}/${e.q}`:`0/0`:``),2),ny=j(11,e=>{Zv(e),$v(e),ey(e),ty(e)}),Ste=M(18,e=>{$v(e),ty(e)}),ry=N(17,e=>Ste(e,e.q?Math.min(e.n,e.q-1):-1)),Cte=M(26,ey),iy=N(24,e=>Cte(e,hy(e)),2),wte=M(23,e=>{iy(e),$v(e)}),ay=N(14,e=>wte(e,gy(e)),2),oy=j(13,e=>{ry(e),ay(e)}),Tte=(e,t)=>{cy(e,t.timer),ly(e,t.tick)},Ete=L(`d4`,e=>{Mt(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))}),A(e.c,`click`,function(){e.a2(-1)}),A(e.d,`click`,function(){e.a2(1)}),A(e.e,`click`,function(){e.j()})});function Dte(e){ny(e,``),oy(e,0),Tte(e,{timer:0,tick:0}),Ete(e)}var Ote=M(16,e=>{z(e.c,`disabled`,!e.q),z(e.d,`disabled`,!e.q),ry(e),ty(e)}),sy=M(7,e=>{Zv(e),ay(e),iy(e)}),cy=M(21,e=>{iy(e),$v(e),Qv(e)}),ly=M(22,Qv),uy=M(8,e=>{ay(e),Qv(e)}),dy=M(9,Qv),fy=M(10,Qv);function py(e){return t=>{e.v&&=(clearTimeout(e.v),0),e.x(e.l,(e.s<0?0:e.s)+t)}}function my(e){return function(t){e.a0(t)}}function hy(e){return t=>{ny(e,t),oy(e,0),Gv(t,Rv(e.h,t)[0]??null),e.v&&clearTimeout(e.v),e.v=setTimeout(()=>{e.v=0,e.x(t,0)},80)}}function gy(e){return(t,n)=>{let r=Rv(e.h,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){oy(e,0),Gv(t,null),e.i({query:t,hit:null,keys:i});return}oy(e,(n%r.length+r.length)%r.length);let a=r[e.n];Gv(t,a),e.i({query:t,hit:a,keys:i})}}R(`d3`,py),R(`d0`,my),R(`d2`,hy),R(`d1`,gy);var _y=`diffs-container`,vy=/(?=^diff --git)/gm,yy=/(?<=\n)/,by=/^(---|\+\+\+)\s+([^\t\r\n]+)/,xy=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,Sy=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Cy=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,wy=`header-prefix`,Ty=`header-filename-suffix`,Ey=`header-metadata`,Dy=`header-custom`,Oy={dark:`pierre-dark`,light:`pierre-light`},ky=`data-theme-css`,Ay=`data-unsafe-css`,jy=`data-diffs-scrollbar-measure`,My=`--diffs-scrollbar-gutter-measured`,Ny=1e5,Py=Object.freeze({fromStart:0,fromEnd:0}),Fy={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Iy={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},Ly=new Set,Ry=null;function zy(e){Ly.add(e),Ry??=requestAnimationFrame(Vy)}function By(e){Ly.delete(e)&&Ly.size===0&&Ry!=null&&(cancelAnimationFrame(Ry),Ry=null)}function Vy(e){let t=new Set(Ly);Ly.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}Ry=Ly.size>0?requestAnimationFrame(Vy):null}function Hy(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Uy(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Wy(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var Gy=new TextEncoder,Ky=new TextDecoder(`utf-8`,{ignoreBOM:!0}),qy=/[\uD800-\uDFFF]/,Jy=1024,Yy=new Uint8Array(Jy);function Xy(){Yy.length!==Jy&&(Yy=new Uint8Array(Jy))}function Zy(e){if(e.length===0)return e;if(qy.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Yy.length<t&&(Yy=new Uint8Array(t));let{written:n}=Gy.encodeInto(e,Yy);return Ky.decode(Yy.subarray(0,n))}function Qy(e,t){return e-(t===0?0:1)}function $y(e,t){return Qy(e,t)+t}var eb=4096,tb=.5;function nb(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ib(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}rb(t,e)}}function rb(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function ib(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>eb)return null;let c=[];for(let t=0;t<n;t++)c.push(ob(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(ob(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=sb(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*tb:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var ab=/\s+/g;function ob(e){return e.replace(ab,``)}function sb(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function cb(e,t){try{return lb(e,t)}finally{Xy()}}function lb(e,{cacheKey:t,isGitDiff:n=vy.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=_b(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=db(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=mb(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?ub(i.contents):[],deletionLines:!l&&r!=null&&i!=null?ub(r.contents):[],cacheKey:yb(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(Sy),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=Zy(r.trim()),n!==r&&(c.prevName=Zy(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?xy:by):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=Zy(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=Zy(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=Zy(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=Zy(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=Zy(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=Zy(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Cy)??[];t!=null&&(c.prevObjectId=Zy(t)),n!=null&&(c.newObjectId=Zy(n)),r!=null&&(c.mode=Zy(r))}e.startsWith(`rename from `)&&(c.prevName=Zy(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=Zy(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
9
|
+
`);for(let t=0;t<c.length;t++){if(o.length>=Iv||s>=Lv)return;let l=c[t],u=(i?l:l.toLowerCase()).indexOf(r);u<0||n===`deletions`&&a.has(l)||(n===`additions`&&a.add(l),s++,o.push({key:e.key,path:e.path,repo:e.repo,line:t+1,side:n,preview:Bv(l,u,r.length)}))}}function Bv(e,t,n){let r=Math.max(0,t-36),i=Math.min(e.length,t+n+36);return(r>0?`…`:``)+e.slice(r,i)+(i<e.length?`…`:``)}var Vv=`search-mark`,Hv=`mark.${Vv}`,Uv=`mark.${Vv}{display:inline;background:#ffd24a;color:#1a1408;-webkit-text-fill-color:#1a1408;border-radius:3px;padding:0 2px}mark.${Vv} *,mark.${Vv} *::before,mark.${Vv} *::after{color:inherit!important;-webkit-text-fill-color:inherit!important;background:transparent!important}mark.${Vv}.active{background:#ffb000;box-shadow:0 0 0 1px #c98400}`,Wv={query:``,hit:null},Gv=new Map;function Kv(e,t){Wv.query=e,Wv.hit=t;for(let[e,t]of Gv)Zv(e,Wv.query,Wv.hit?.key===t?Wv.hit:null);t&&requestAnimationFrame(()=>{for(let[e,n]of Gv)n===t.key&&qv(e,t)})}function qv(e,t){let n=e.querySelector(`diffs-container`)?.shadowRoot;if(!n)return;let r=n.querySelector(`mark.search-mark.active`);if(r){r.scrollIntoView({block:`center`});return}if(t.line<1)return;let i=[...n.querySelectorAll(`[data-line="${t.line}"]`)],a=t.side||`additions`;(i.find(e=>Yv(e)===a)??i[0])?.scrollIntoView({block:`center`})}function Jv(e,t){let n=t&&Wv.hit?.key===t?Wv.hit:null;Zv(e,Wv.query,n),n&&requestAnimationFrame(()=>qv(e,n))}function dte(e,t){return Gv.set(e,t),Jv(e,t),()=>{Gv.delete(e)}}function fte(e){Jv(e,Gv.get(e))}function pte(e){for(let t of[...e.querySelectorAll(Hv)]){let e=t.parentElement;t.replaceWith(...t.childNodes),e?.normalize()}}function Yv(e){let t=e.closest(`[data-code]`);return t?.hasAttribute(`data-deletions`)?`deletions`:t?.hasAttribute(`data-additions`)?`additions`:(e.getAttribute(`data-line-type`)||``).includes(`deletion`)?`deletions`:`additions`}function mte(e){let t=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),n=[];for(let e=t.nextNode();e;e=t.nextNode())e.parentElement?.closest(Hv)||n.push(e);return n}function Xv(e,t,n){let r=0;for(let i=0;i<e.length;i++){let a=t[i].length;if(n<=r+a)return{node:e[i],offset:Math.min(a,Math.max(0,n-r))};r+=a}let i=e.at(-1);return i?{node:i,offset:t.at(-1)?.length??0}:null}function hte(e,t,n,r,i){let a=Xv(e,t,n),o=Xv(e,t,r);if(!a||!o)return;let s=document.createRange();s.setStart(a.node,a.offset),s.setEnd(o.node,o.offset);let c=document.createElement(`mark`);c.className=i;try{c.append(s.extractContents()),s.insertNode(c)}catch{}}function gte(e,t,n,r){let i=mte(e);if(!i.length)return;let a=i.map(e=>e.textContent??``),o=a.join(``),s=n?o:o.toLowerCase(),c=[];for(let e=s.indexOf(t);e!==-1;e=s.indexOf(t,e+t.length))c.push([e,e+t.length]);if(!c.length)return;let l=Yv(e),u=Number(e.getAttribute(`data-line`)),d=r&&r.line===u&&(r.side||`additions`)===l?`${Vv} active`:Vv;for(let e=c.length-1;e>=0;e--)hte(i,a,c[e][0],c[e][1],d)}function Zv(e,t,n){let r=[e],i=e.querySelector(`diffs-container`)?.shadowRoot;i&&r.push(i);let a=t.trim(),o=/[A-Z]/.test(a),s=a&&!o?a.toLowerCase():a;for(let e of r)if(pte(e),s)for(let t of e.querySelectorAll(`[data-code] [data-line]`))gte(t,s,o,n)}var _te=`<div class=find-bar><input class=find-input type=search placeholder="Find in diffs" aria-label="Find in diffs"><span class=count> </span><button class=icon-btn title="Previous match">↑</button><button class=icon-btn title="Next match">↓</button><button class=icon-btn title="Close find">×</button></div>`,vte=`D bD l b b l`,yte=(e,t)=>cy(e,t?.length),Qv=N(12,e=>yte(e,Rv(e.h,e.l))),$v=N(29,L(`d5`,e=>Et(e,{onMount:function(){let t=new AbortController;return document.addEventListener(`keydown`,t=>{if(t.key===`Escape`){if(t.target instanceof HTMLTextAreaElement)return;t.preventDefault(),e.j();return}let n=t.metaKey||t.ctrlKey;(t.key===`F3`||n&&t.key.toLowerCase()===`g`)&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))},{signal:t.signal}),e.w=e.k,setTimeout(()=>e.a?.focus(),0),{abort:t}},onUpdate:function(){if(e.k!==e.w){e.w=e.k;let t=e.a;t?.focus(),t?.select()}},onDestroy:function(){e.v&&clearTimeout(e.v),this.abort.abort(),Kv(``,null),e.i({query:``,hit:null,keys:[]})}})),5),bte=M(28,$v),ey=N(25,e=>bte(e,hy(e)),3),ty=N(27,e=>jt(e,`a`,e.l,gy(e))),ny=N(19,e=>V(e.b,e.l.trim()?e.q?`${e.s+1}/${e.q}`:`0/0`:``),2),ry=j(11,e=>{Qv(e),ey(e),ty(e),ny(e)}),xte=M(18,e=>{ey(e),ny(e)}),iy=N(17,e=>xte(e,e.q?Math.min(e.n,e.q-1):-1)),Ste=M(26,ty),ay=N(24,e=>Ste(e,_y(e)),2),Cte=M(23,e=>{ay(e),ey(e)}),oy=N(14,e=>Cte(e,vy(e)),2),sy=j(13,e=>{iy(e),oy(e)}),wte=(e,t)=>{uy(e,t.timer),dy(e,t.tick)},Tte=L(`d4`,e=>{Mt(e,`a`),A(e.a,`keydown`,function(t){t.key===`Enter`&&(t.preventDefault(),e.a2(t.shiftKey?-1:1))}),A(e.c,`click`,function(){e.a2(-1)}),A(e.d,`click`,function(){e.a2(1)}),A(e.e,`click`,function(){e.j()})});function Ete(e){ry(e,``),sy(e,0),wte(e,{timer:0,tick:0}),Tte(e)}var cy=M(16,e=>{z(e.c,`disabled`,!e.q),z(e.d,`disabled`,!e.q),iy(e),ny(e)}),ly=M(7,e=>{Qv(e),oy(e),ay(e)}),uy=M(21,e=>{ay(e),ey(e),$v(e)}),dy=M(22,$v),fy=M(8,e=>{oy(e),$v(e)}),py=M(9,$v),my=M(10,$v);function hy(e){return t=>{e.v&&=(clearTimeout(e.v),0),e.x(e.l,(e.s<0?0:e.s)+t)}}function gy(e){return function(t){e.a0(t)}}function _y(e){return t=>{ry(e,t),sy(e,0),Kv(t,Rv(e.h,t)[0]??null),e.v&&clearTimeout(e.v),e.v=setTimeout(()=>{e.v=0,e.x(t,0)},80)}}function vy(e){return(t,n)=>{let r=Rv(e.h,t),i=[...new Set(r.map(e=>e.key))];if(!r.length){sy(e,0),Kv(t,null),e.i({query:t,hit:null,keys:i});return}sy(e,(n%r.length+r.length)%r.length);let a=r[e.n];Kv(t,a),e.i({query:t,hit:a,keys:i})}}R(`d3`,hy),R(`d0`,gy),R(`d2`,_y),R(`d1`,vy);var yy=`diffs-container`,by=/(?=^diff --git)/gm,xy=/(?<=\n)/,Sy=/^(---|\+\+\+)\s+([^\t\r\n]+)/,Cy=/^(---|\+\+\+)\s+[ab]\/([^\t\r\n]+)/,wy=/^diff --git (?:"a\/(.+?)"|a\/(.+?)) (?:"b\/(.+?)"|b\/(.+?))$/,Ty=/^index ([0-9a-f]+)\.\.([0-9a-f]+)(?: (\d+))?$/i,Ey=`header-prefix`,Dy=`header-filename-suffix`,Oy=`header-metadata`,ky=`header-custom`,Ay={dark:`pierre-dark`,light:`pierre-light`},jy=`data-theme-css`,My=`data-unsafe-css`,Ny=`data-diffs-scrollbar-measure`,Py=`--diffs-scrollbar-gutter-measured`,Fy=1e5,Iy=Object.freeze({fromStart:0,fromEnd:0}),Ly={startingLine:0,totalLines:1/0,bufferBefore:0,bufferAfter:0},Ry={startingLine:0,totalLines:0,bufferBefore:0,bufferAfter:0},zy=new Set,By=null;function Vy(e){zy.add(e),By??=requestAnimationFrame(Uy)}function Hy(e){zy.delete(e)&&zy.size===0&&By!=null&&(cancelAnimationFrame(By),By=null)}function Uy(e){let t=new Set(zy);zy.clear();for(let n of t)try{n(e)}catch(e){console.error(e)}By=zy.size>0?requestAnimationFrame(Uy):null}function Wy(e,t){return e==null||t==null||typeof e==`string`||typeof t==`string`?e===t:e.dark===t.dark&&e.light===t.light}function Gy(e,t){return e?.start===t?.start&&e?.end===t?.end&&e?.side===t?.side&&e?.endSide===t?.endSide}function Ky(e){let t=e.length;return e.charCodeAt(t-1)===10&&(t--,e.charCodeAt(t-1)===13&&t--),e.slice(0,t)}var qy=new TextEncoder,Jy=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Yy=/[\uD800-\uDFFF]/,Xy=1024,Zy=new Uint8Array(Xy);function Qy(){Zy.length!==Xy&&(Zy=new Uint8Array(Xy))}function $y(e){if(e.length===0)return e;if(Yy.test(e))return JSON.parse(JSON.stringify(e));let t=e.length*3;Zy.length<t&&(Zy=new Uint8Array(t));let{written:n}=qy.encodeInto(e,Zy);return Jy.decode(Zy.subarray(0,n))}function eb(e,t){return e-(t===0?0:1)}function tb(e,t){return eb(e,t)+t}var nb=4096,rb=.5;function ib(e){for(let t of e.hunks){for(let n=0;n<t.hunkContent.length;n++){let r=t.hunkContent[n];if(r.type!==`change`)continue;let i=ob(e,r);i!=null&&(t.hunkContent.splice(n,1,...i),n+=i.length-1)}ab(t,e)}}function ab(e,t){let{hunkContent:n}=e;for(let e=1;e<n.length;e++){let r=n[e],i=n[e-1];if(r.type!==`change`||r.additions>0&&r.deletions>0||i.type!==`context`)continue;let a=r.additions>0,o=a?t.additionLines:t.deletionLines,s=a?r.additionLineIndex:r.deletionLineIndex,c=a?r.additions:r.deletions,l=o[s]??``;if(l.trim()!==``)continue;let u=!0;for(let e=1;e<c;e++)if(o[s+e]!==l){u=!1;break}if(!u)continue;let d=0;for(;d<i.lines&&t.additionLines[i.additionLineIndex+i.lines-1-d]===l;)d++;if(d===0||e===1&&d===i.lines)continue;r.additionLineIndex-=d,r.deletionLineIndex-=d;let f=r.additionLineIndex+r.additions,p=r.deletionLineIndex+r.deletions,m=n[e+1];m?.type===`context`?(m.lines+=d,m.additionLineIndex=f,m.deletionLineIndex=p):n.splice(e+1,0,{type:`context`,lines:d,additionLineIndex:f,deletionLineIndex:p}),i.lines-=d,i.lines===0&&(n.splice(e-1,1),e--)}}function ob(e,t){let{deletions:n,additions:r,deletionLineIndex:i,additionLineIndex:a}=t,o=Math.min(n,r),s=Math.abs(r-n);if(o===0||s===0||o*(s+1)>nb)return null;let c=[];for(let t=0;t<n;t++)c.push(cb(e.deletionLines[i+t]??``));let l=[];for(let t=0;t<r;t++)l.push(cb(e.additionLines[a+t]??``));let u=r>n,d=0,f=-1;for(let e=0;e<=s;e++){let t=0;for(let n=0;n<o;n++)t+=lb(c[n+(u?0:e)],l[n+(u?e:0)]);e===0?f=t+o*rb:t>f&&(f=t,d=e)}if(d===0)return null;let p=[],m=(e,t,n,r)=>{(e>0||t>0)&&p.push({type:`change`,deletions:e,additions:t,deletionLineIndex:n,additionLineIndex:r})};return u?(m(0,d,i,a),m(o,o,i,a+d),m(0,r-o-d,i+o,a+d+o)):(m(d,0,i,a),m(o,o,i+d,a),m(n-o-d,0,i+d+o,a+o)),p}var sb=/\s+/g;function cb(e){return e.replace(sb,``)}function lb(e,t){if(e===t)return 1;let n=Math.max(e.length,t.length),r=Math.min(e.length,t.length);if(r===0)return 0;let i=0;for(;i<r&&e[i]===t[i];)i++;let a=0;for(;a<r-i&&e[e.length-1-a]===t[t.length-1-a];)a++;return(i+a)/n}function ub(e,t){try{return db(e,t)}finally{Qy()}}function db(e,{cacheKey:t,isGitDiff:n=by.test(e),oldFile:r,newFile:i,throwOnError:a=!1}={}){let o=0,s=yb(e,`@@ `),c,l=r==null||i==null,u=0,d=0;for(let e of s){let s=pb(e),f=s[0];if(f==null){if(a)throw Error(`parsePatchContent: invalid hunk`);console.error(`parsePatchContent: invalid hunk`,e);continue}let p=gb(f),m=0,h=0;if(p==null||c==null){if(c!=null){if(a)throw Error(`parsePatchContent: Invalid hunk`);console.error(`parsePatchContent: Invalid hunk`,e);continue}c={name:``,type:`change`,hunks:[],splitLineCount:0,unifiedLineCount:0,isPartial:l,additionLines:!l&&r!=null&&i!=null?fb(i.contents):[],deletionLines:!l&&r!=null&&i!=null?fb(r.contents):[],cacheKey:xb(t)},c.additionLines.length===1&&i?.contents===``&&(c.additionLines.length=0),c.deletionLines.length===1&&r?.contents===``&&(c.deletionLines.length=0);for(let e of s){if(e.startsWith(`diff --git`)){let t=e.trim().match(wy),n=t?.[1]??t?.[2],r=t?.[3]??t?.[4];if(n==null||r==null){if(a)throw Error(`parsePatchContent: invalid git diff header`);console.error(`parsePatchContent: invalid git diff header`,e);continue}c.name=$y(r.trim()),n!==r&&(c.prevName=$y(n.trim()));continue}let t=e.startsWith(`---`)||e.startsWith(`+++`)?e.match(n?Cy:Sy):null;if(t!=null){let[,e,n]=t;if(e===`---`&&n!==`/dev/null`){let e=$y(n.trim());c.prevName=e,c.name=e}else e===`+++`&&n!==`/dev/null`&&(c.name=$y(n.trim()))}else if(n){if(e.startsWith(`new mode `)&&(c.mode=$y(e.slice(8).trim())),e.startsWith(`old mode `)&&(c.prevMode=$y(e.slice(8).trim())),e.startsWith(`new file mode`)&&(c.type=`new`,c.mode=$y(e.slice(13).trim())),e.startsWith(`deleted file mode`)&&(c.type=`deleted`,c.mode=$y(e.slice(17).trim())),e.startsWith(`similarity index`)&&(e.startsWith(`similarity index 100%`)?c.type=`rename-pure`:c.type=`rename-changed`),e.startsWith(`index `)){let[,t,n,r]=e.trim().match(Ty)??[];t!=null&&(c.prevObjectId=$y(t)),n!=null&&(c.newObjectId=$y(n)),r!=null&&(c.mode=$y(r))}e.startsWith(`rename from `)&&(c.prevName=$y(e.slice(12).trim())),e.startsWith(`rename to `)&&(c.name=$y(e.slice(10).trim()))}}continue}let g,_;for(;s.length>0&&(s[s.length-1]===`
|
|
10
10
|
`||s[s.length-1]===`\r`||s[s.length-1]===`\r
|
|
11
|
-
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:
|
|
12
|
-
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function
|
|
13
|
-
`&&n!==`\r`)return!1}return!0}function
|
|
11
|
+
`||s[s.length-1]===``);)s.pop();let{additionStart:v,deletionStart:y}=p;u=l?u:y-1,d=l?d:v-1;let b={collapsedBefore:0,splitLineCount:0,splitLineStart:0,unifiedLineCount:0,unifiedLineStart:0,additionCount:p.additionCount,additionStart:v,additionLines:m,deletionCount:p.deletionCount,deletionStart:y,deletionLines:h,deletionLineIndex:u,additionLineIndex:d,hunkContent:[],hunkContext:xb(p.hunkContext),hunkSpecs:$y(f),noEOFCRAdditions:!1,noEOFCRDeletions:!1},x=0,S=0;for(let e=1;e<s.length;e++){let t=s[e];if(x>=b.additionCount&&S>=b.deletionCount&&!t.startsWith(`\\`)){if(a&&mb(t)&&!hb(t))throw Error(`parsePatchContent: hunk has more lines than expected`);break}let n=t[0];if(n!==`+`&&n!==`-`&&n!==` `&&n!==`\\`){if(a)throw Error(`parsePatchContent: invalid hunk line`);console.error(`parseLineType: Invalid firstChar: "${n}", full line: "${t}"`),console.error(`processFile: invalid rawLine:`,t);continue}let r=Sb(n);if(r===`addition`){if(a&&x>=b.additionCount)throw Error(`parsePatchContent: hunk has too many addition lines`);let e=Cb(t);(g==null||g.type!==`change`)&&(g=wb(`change`,u,d),b.hunkContent.push(g)),d++,x++,l&&c.additionLines.push(e),g.additions++,m++,_=`addition`}else if(r===`deletion`){if(a&&S>=b.deletionCount)throw Error(`parsePatchContent: hunk has too many deletion lines`);let e=Cb(t);(g==null||g.type!==`change`)&&(g=wb(`change`,u,d),b.hunkContent.push(g)),u++,S++,l&&c.deletionLines.push(e),g.deletions++,h++,_=`deletion`}else if(r===`context`){if(a&&(S>=b.deletionCount||x>=b.additionCount))throw Error(`parsePatchContent: hunk has too many context lines`);let e=Cb(t);(g==null||g.type!==`context`)&&(g=wb(`context`,u,d),b.hunkContent.push(g)),d++,u++,x++,S++,l&&(c.deletionLines.push(e),c.additionLines.push(e)),g.lines++,_=`context`}else if(r===`metadata`&&g!=null){if(g.type===`context`?(b.noEOFCRAdditions=!0,b.noEOFCRDeletions=!0):_===`deletion`?b.noEOFCRDeletions=!0:_===`addition`&&(b.noEOFCRAdditions=!0),l&&(_===`addition`||_===`context`)){let e=c.additionLines.length-1;e>=0&&(c.additionLines[e]=Ky(c.additionLines[e]))}if(l&&(_===`deletion`||_===`context`)){let e=c.deletionLines.length-1;e>=0&&(c.deletionLines[e]=Ky(c.deletionLines[e]))}}}if(a&&(x!==b.additionCount||S!==b.deletionCount))throw Error(`parsePatchContent: hunk line count mismatch`);b.additionLines=m,b.deletionLines=h,b.collapsedBefore=Math.max(eb(b.additionStart,b.additionCount)-o,0),c.hunks.push(b),o=tb(b.additionStart,b.additionCount);for(let e of b.hunkContent)e.type===`context`?(b.splitLineCount+=e.lines,b.unifiedLineCount+=e.lines):(b.splitLineCount+=Math.max(e.additions,e.deletions),b.unifiedLineCount+=e.deletions+e.additions);b.splitLineStart=c.splitLineCount+b.collapsedBefore,b.unifiedLineStart=c.unifiedLineCount+b.collapsedBefore,c.splitLineCount+=b.collapsedBefore+b.splitLineCount,c.unifiedLineCount+=b.collapsedBefore+b.unifiedLineCount}if(c!=null){if(a&&l&&!n&&c.hunks.length===0)throw Error(`parsePatchContent: unified file has no hunks`);if(c.hunks.length>0&&!l&&c.additionLines.length>0&&c.deletionLines.length>0){let e=c.hunks[c.hunks.length-1],t=tb(e.additionStart,e.additionCount),n=c.additionLines.length,r=Math.max(n-t,0);c.splitLineCount+=r,c.unifiedLineCount+=r}return n||(c.prevName!=null&&c.name!==c.prevName?c.hunks.length>0?c.type=`rename-changed`:c.type=`rename-pure`:(r==null||r.contents===``)&&i!=null&&i.contents!==``?c.type=`new`:r!=null&&r.contents!==``&&(i==null||i.contents===``)&&(c.type=`deleted`)),c.type!==`rename-pure`&&c.type!==`rename-changed`&&(c.prevName=void 0),ib(c),c}}function fb(e){let t=pb(e);for(let e=0;e<t.length;e++)t[e]=$y(t[e]);return t}function pb(e){if(e.length===0)return[``];let t=[],n=0;for(;;){let r=e.indexOf(`
|
|
12
|
+
`,n);if(r===-1)break;t.push(e.slice(n,r+1)),n=r+1}return n<e.length&&t.push(e.slice(n)),t}function mb(e){let t=e[0];return t===`+`||t===`-`||t===` `}function hb(e){if(!e.startsWith(`--`))return!1;for(let t=2;t<e.length;t++){let n=e[t];if(n!==` `&&n!==` `&&n!==`
|
|
13
|
+
`&&n!==`\r`)return!1}return!0}function gb(e){if(!e.startsWith(`@@ -`))return;let t=4,n=_b(e,t);if(n==null)return;let r=n.value;t=n.endIndex;let i=1;if(e[t]===`,`){let n=_b(e,t+1);if(n==null)return;i=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`+`)return;t+=2;let a=_b(e,t);if(a==null)return;let o=a.value;t=a.endIndex;let s=1;if(e[t]===`,`){let n=_b(e,t+1);if(n==null)return;s=n.value,t=n.endIndex}if(e[t]!==` `||e[t+1]!==`@`||e[t+2]!==`@`)return;let c,l=t+3;return e[l]===` `&&(c=vb(e.slice(l+1))),{additionCount:s,additionStart:o,deletionCount:i,deletionStart:r,hunkContext:c}}function _b(e,t){let n=t,r=0;for(;n<e.length;n++){let t=e.charCodeAt(n)-48;if(t<0||t>9)break;r=r*10+t}if(n!==t)return{value:r,endIndex:n}}function vb(e){return e.endsWith(`\r
|
|
14
14
|
`)?e.slice(0,-2):e.endsWith(`
|
|
15
|
-
`)?e.slice(0,-1):e}function
|
|
16
|
-
`:t)}function
|
|
15
|
+
`)?e.slice(0,-1):e}function yb(e,t){if(e.length===0)return[``];let n=`\n${t}`,r=e.startsWith(t)?0:bb(e,n,0);if(r===-1)return[e];let i=[];r>0&&i.push(e.slice(0,r));let a=r;for(;;){let t=bb(e,n,a+1);if(t===-1)break;i.push(e.slice(a,t)),a=t}return i.push(e.slice(a)),i}function bb(e,t,n){let r=e.indexOf(t,n);return r===-1?-1:r+1}function xb(e){return e==null?e:$y(e)}function Sb(e){return e===` `?`context`:e===`\\`?`metadata`:e===`+`?`addition`:`deletion`}function Cb(e){let t=e.slice(1);return $y(t===``?`
|
|
16
|
+
`:t)}function wb(e,t,n){return e===`change`?{type:`change`,additions:0,deletions:0,additionLineIndex:n,deletionLineIndex:t}:{type:`context`,lines:0,additionLineIndex:n,deletionLineIndex:t}}var Tb=class{diff(e,t,n={}){let r;typeof n==`function`?(r=n,n={}):`callback`in n&&(r=n.callback);let i=this.castInput(e,n),a=this.castInput(t,n),o=this.removeEmpty(this.tokenize(i,n)),s=this.removeEmpty(this.tokenize(a,n));return this.diffWithOptionsObj(o,s,n,r)}diffWithOptionsObj(e,t,n,r){let i=e=>{if(e=this.postProcess(e,n),r){setTimeout(function(){r(e)},0);return}return e},a=t.length,o=e.length,s=1,c=a+o;n.maxEditLength!=null&&(c=Math.min(c,n.maxEditLength));let l=n.timeout??1/0,u=Date.now()+l,d=[{oldPos:-1,lastComponent:void 0}],f=this.extractCommon(d[0],t,e,0,n);if(d[0].oldPos+1>=o&&f+1>=a)return i(this.buildValues(d[0].lastComponent,t,e));let p=-1/0,m=1/0,h=()=>{for(let r=Math.max(p,-s);r<=Math.min(m,s);r+=2){let s,c=d[r-1],l=d[r+1];c&&(d[r-1]=void 0);let u=!1;if(l){let e=l.oldPos-r;u=l&&0<=e&&e<a}let h=c&&c.oldPos+1<o;if(!u&&!h){d[r]=void 0;continue}if(s=!h||u&&c.oldPos<l.oldPos?this.addToPath(l,!0,!1,0,n):this.addToPath(c,!1,!0,1,n),f=this.extractCommon(s,t,e,r,n),s.oldPos+1>=o&&f+1>=a)return i(this.buildValues(s.lastComponent,t,e))||!0;d[r]=s,s.oldPos+1>=o&&(m=Math.min(m,r-1)),f+1>=a&&(p=Math.max(p,r+1))}s++};if(r)(function e(){setTimeout(function(){if(s>c||Date.now()>u)return r(void 0);h()||e()},0)})();else for(;s<=c&&Date.now()<=u;){let e=h();if(e)return e}}addToPath(e,t,n,r,i){let a=e.lastComponent;return a&&!i.oneChangePerToken&&a.added===t&&a.removed===n?{oldPos:e.oldPos+r,lastComponent:{count:a.count+1,added:t,removed:n,previousComponent:a.previousComponent}}:{oldPos:e.oldPos+r,lastComponent:{count:1,added:t,removed:n,previousComponent:a}}}extractCommon(e,t,n,r,i){let a=t.length,o=n.length,s=e.oldPos,c=s-r,l=0;for(;c+1<a&&s+1<o&&this.equals(n[s+1],t[c+1],i);)c++,s++,l++,i.oneChangePerToken&&(e.lastComponent={count:1,previousComponent:e.lastComponent,added:!1,removed:!1});return l&&!i.oneChangePerToken&&(e.lastComponent={count:l,previousComponent:e.lastComponent,added:!1,removed:!1}),e.oldPos=s,c}equals(e,t,n){return n.comparator?n.comparator(e,t):e===t||!!n.ignoreCase&&e.toLowerCase()===t.toLowerCase()}removeEmpty(e){let t=[];for(let n=0;n<e.length;n++)e[n]&&t.push(e[n]);return t}castInput(e,t){return e}tokenize(e,t){return Array.from(e)}join(e){return e.join(``)}postProcess(e,t){return e}get useLongestToken(){return!1}buildValues(e,t,n){let r=[],i;for(;e;)r.push(e),i=e.previousComponent,delete e.previousComponent,e=i;r.reverse();let a=r.length,o=0,s=0,c=0;for(;o<a;o++){let e=r[o];if(e.removed)e.value=this.join(n.slice(c,c+e.count)),c+=e.count;else{if(!e.added&&this.useLongestToken){let r=t.slice(s,s+e.count);r=r.map(function(e,t){let r=n[c+t];return r.length>e.length?r:e}),e.value=this.join(r)}else e.value=this.join(t.slice(s,s+e.count));s+=e.count,e.added||(c+=e.count)}}return r}},Eb=new class extends Tb{};function Db(e,t,n){return Eb.diff(e,t,n)}function Ob(e,t){let n;for(n=0;n<e.length&&n<t.length;n++)if(e[n]!=t[n])return e.slice(0,n);return e.slice(0,n)}function kb(e,t){let n;if(!e||!t||e[e.length-1]!=t[t.length-1])return``;for(n=0;n<e.length&&n<t.length;n++)if(e[e.length-(n+1)]!=t[t.length-(n+1)])return e.slice(-n);return e.slice(-n)}function Ab(e,t,n){if(e.slice(0,t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't start with prefix ${JSON.stringify(t)}; this is a bug`);return n+e.slice(t.length)}function jb(e,t,n){if(!t)return e+n;if(e.slice(-t.length)!=t)throw Error(`string ${JSON.stringify(e)} doesn't end with suffix ${JSON.stringify(t)}; this is a bug`);return e.slice(0,-t.length)+n}function Mb(e,t){return Ab(e,t,``)}function Nb(e,t){return jb(e,t,``)}function Pb(e,t){return t.slice(0,Fb(e,t))}function Fb(e,t){let n=0;e.length>t.length&&(n=e.length-t.length);let r=t.length;e.length<t.length&&(r=e.length);let i=Array(r),a=0;i[0]=0;for(let e=1;e<r;e++){for(t[e]==t[a]?i[e]=i[a]:i[e]=a;a>0&&t[e]!=t[a];)a=i[a];t[e]==t[a]&&a++}a=0;for(let r=n;r<e.length;r++){for(;a>0&&e[r]!=t[a];)a=i[a];e[r]==t[a]&&a++}return a}function Ib(e,t){let n=[];for(let r of Array.from(t.segment(e))){let e=r.segment;n.length&&/\s/.test(n[n.length-1])&&/\s/.test(e)?n[n.length-1]+=e:n.push(e)}return n}function Lb(e,t){if(t)return zb(e,t)[1];let n;for(n=e.length-1;n>=0&&e[n].match(/\s/);n--);return e.substring(n+1)}function Rb(e,t){if(t)return zb(e,t)[0];let n=e.match(/^\s*/);return n?n[0]:``}function zb(e,t){if(!t)return[Rb(e),Lb(e)];if(t.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);let n=Ib(e,t),r=n[0],i=n[n.length-1];return[/\s/.test(r)?r:``,/\s/.test(i)?i:``]}var Bb=`a-zA-Z0-9_\\u{AD}\\u{C0}-\\u{D6}\\u{D8}-\\u{F6}\\u{F8}-\\u{2C6}\\u{2C8}-\\u{2D7}\\u{2DE}-\\u{2FF}\\u{1E00}-\\u{1EFF}`,Vb=RegExp(`[${Bb}]+|\\s+|[^${Bb}]`,`ug`);new class extends Tb{equals(e,t,n){return n.ignoreCase&&(e=e.toLowerCase(),t=t.toLowerCase()),e.trim()===t.trim()}tokenize(e,t={}){let n;if(t.intlSegmenter){let r=t.intlSegmenter;if(r.resolvedOptions().granularity!=`word`)throw Error(`The segmenter passed must have a granularity of "word"`);n=Ib(e,r)}else n=e.match(Vb)||[];let r=[],i=null;return n.forEach(e=>{/\s/.test(e)?i==null?r.push(e):r.push(r.pop()+e):i!=null&&/\s/.test(i)?r[r.length-1]==i?r.push(r.pop()+e):r.push(i+e):r.push(e),i=e}),r}join(e){return e.map((e,t)=>t==0?e:e.replace(/^\s+/,``)).join(``)}postProcess(e,t){if(!e||t.oneChangePerToken)return e;let n=null,r=null,i=null;return e.forEach(e=>{e.added?r=e:e.removed?i=e:((r||i)&&Hb(n,i,r,e,t.intlSegmenter),n=e,r=null,i=null)}),(r||i)&&Hb(n,i,r,null,t.intlSegmenter),e}};function Hb(e,t,n,r,i){if(t&&n){let[a,o]=zb(t.value,i),[s,c]=zb(n.value,i);if(e){let r=Ob(a,s);e.value=jb(e.value,s,r),t.value=Mb(t.value,r),n.value=Mb(n.value,r)}if(r){let e=kb(o,c);r.value=Ab(r.value,c,e),t.value=Nb(t.value,e),n.value=Nb(n.value,e)}}else if(n){if(e){let e=Rb(n.value,i);n.value=n.value.substring(e.length)}if(r){let e=Rb(r.value,i);r.value=r.value.substring(e.length)}}else if(e&&r){let n=Rb(r.value,i),[a,o]=zb(t.value,i),s=Ob(n,a);t.value=Mb(t.value,s);let c=kb(Mb(n,s),o);t.value=Nb(t.value,c),r.value=Ab(r.value,n,c),e.value=jb(e.value,n,n.slice(0,n.length-c.length))}else if(r){let e=Rb(r.value,i),n=Pb(Lb(t.value,i),e);t.value=Nb(t.value,n)}else if(e){let n=Pb(Lb(e.value,i),Rb(t.value,i));t.value=Mb(t.value,n)}}var Ub=new class extends Tb{tokenize(e){let t=RegExp(`(\\r?\\n)|[${Bb}]+|[^\\S\\n\\r]+|[^${Bb}]`,`ug`);return e.match(t)||[]}};function Wb(e,t,n){return Ub.diff(e,t,n)}var Gb=new class extends Tb{constructor(){super(...arguments),this.tokenize=qb}equals(e,t,n){return n.ignoreWhitespace?((!n.newlineIsToken||!e.includes(`
|
|
17
17
|
`))&&(e=e.trim()),(!n.newlineIsToken||!t.includes(`
|
|
18
18
|
`))&&(t=t.trim())):n.ignoreNewlineAtEof&&!n.newlineIsToken&&(e.endsWith(`
|
|
19
19
|
`)&&(e=e.slice(0,-1)),t.endsWith(`
|
|
20
|
-
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function
|
|
21
|
-
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function
|
|
22
|
-
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function
|
|
23
|
-
`)}let n=[];if(e.isGit){if(t=
|
|
20
|
+
`)&&(t=t.slice(0,-1))),super.equals(e,t,n)}};function Kb(e,t,n){return Gb.diff(e,t,n)}function qb(e,t){t.stripTrailingCr&&(e=e.replace(/\r\n/g,`
|
|
21
|
+
`));let n=[],r=e.split(/(\n|\r\n)/);r[r.length-1]||r.pop();for(let e=0;e<r.length;e++){let i=r[e];e%2&&!t.newlineIsToken?n[n.length-1]+=i:n.push(i)}return n}function Jb(e){for(let t=0;t<e.length;t++)if(e[t]<` `||e[t]>`~`||e[t]===`"`||e[t]===`\\`)return!0;return!1}function Yb(e){if(!Jb(e))return e;let t=`"`,n=new TextEncoder().encode(e),r=0;for(;r<n.length;){let e=n[r];t+=e===7?`\\a`:e===8?`\\b`:e===9?`\\t`:e===10?`\\n`:e===11?`\\v`:e===12?`\\f`:e===13?`\\r`:e===34?`\\"`:e===92?`\\\\`:e>=32&&e<=126?String.fromCharCode(e):`\\`+e.toString(8).padStart(3,`0`),r++}return t+=`"`,t}var Xb={includeIndex:!0,includeUnderline:!0,includeFileHeaders:!0};function Zb(e,t,n,r,i,a,o){let s;s=o?typeof o==`function`?{callback:o}:o:{},s.context===void 0&&(s.context=4);let c=s.context;if(s.newlineIsToken)throw Error(`newlineIsToken may not be used with patch-generation functions, only with diffing functions`);if(s.callback){let{callback:e}=s;Kb(n,r,Object.assign(Object.assign({},s),{callback:t=>{let n=l(t);e(n)}}))}else return l(Kb(n,r,s));function l(n){if(!n)return;n.push({value:``,lines:[]});function r(e){return e.map(function(e){return` `+e})}let o=[],s=0,l=0,u=[],d=1,f=1;for(let e=0;e<n.length;e++){let t=n[e],i=t.lines||ex(t.value);if(t.lines=i,t.added||t.removed){if(!s){let t=n[e-1];s=d,l=f,t&&(u=c>0?r(t.lines.slice(-c)):[],s-=u.length,l-=u.length)}for(let e of i)u.push((t.added?`+`:`-`)+e);t.added?f+=i.length:d+=i.length}else{if(s){if(i.length<=c*2&&e<n.length-2)for(let e of r(i))u.push(e);else{let e=Math.min(i.length,c);for(let t of r(i.slice(0,e)))u.push(t);let t={oldStart:s,oldLines:d-s+e,newStart:l,newLines:f-l+e,lines:u};o.push(t),s=0,l=0,u=[]}}d+=i.length,f+=i.length}}for(let e of o)for(let t=0;t<e.lines.length;t++)e.lines[t].endsWith(`
|
|
22
|
+
`)?e.lines[t]=e.lines[t].slice(0,-1):(e.lines.splice(t+1,0,`\`),t++);return{oldFileName:e,newFileName:t,oldHeader:i,newHeader:a,hunks:o}}}function Qb(e,t){if(t||=Xb,Array.isArray(e)){if(e.length>1&&!t.includeFileHeaders&&!e.every(e=>e.isGit))throw 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(e=>Qb(e,t)).join(`
|
|
23
|
+
`)}let n=[];if(e.isGit){if(t=Xb,!e.oldFileName)throw Error(`oldFileName must be specified for Git patches`);if(!e.newFileName)throw Error(`newFileName must be specified for Git patches`);let r=e.oldFileName,i=e.newFileName;e.isCreate&&r===`/dev/null`?r=i.replace(/^b\//,`a/`):e.isDelete&&i===`/dev/null`&&(i=r.replace(/^a\//,`b/`)),n.push(`diff --git `+Yb(r)+` `+Yb(i)),e.isDelete&&n.push(`deleted file mode `+(e.oldMode??`100644`)),e.isCreate&&n.push(`new file mode `+(e.newMode??`100644`)),e.oldMode&&e.newMode&&!e.isDelete&&!e.isCreate&&(n.push(`old mode `+e.oldMode),n.push(`new mode `+e.newMode)),e.isRename&&(n.push(`rename from `+Yb((e.oldFileName??``).replace(/^a\//,``))),n.push(`rename to `+Yb((e.newFileName??``).replace(/^b\//,``)))),e.isCopy&&(n.push(`copy from `+Yb((e.oldFileName??``).replace(/^a\//,``))),n.push(`copy to `+Yb((e.newFileName??``).replace(/^b\//,``))))}else t.includeIndex&&e.oldFileName==e.newFileName&&e.oldFileName!==void 0&&n.push(`Index: `+e.oldFileName),t.includeUnderline&&n.push(`===================================================================`);let r=e.hunks.length>0;t.includeFileHeaders&&e.oldFileName!==void 0&&e.newFileName!==void 0&&(!e.isGit||r)&&(n.push(`--- `+Yb(e.oldFileName)+(e.oldHeader?` `+e.oldHeader:``)),n.push(`+++ `+Yb(e.newFileName)+(e.newHeader?` `+e.newHeader:``)));for(let t=0;t<e.hunks.length;t++){let r=e.hunks[t],i=r.oldLines===0?r.oldStart-1:r.oldStart,a=r.newLines===0?r.newStart-1:r.newStart;n.push(`@@ -`+i+`,`+r.oldLines+` +`+a+`,`+r.newLines+` @@`);for(let e of r.lines)n.push(e)}return n.join(`
|
|
24
24
|
`)+`
|
|
25
|
-
`}function
|
|
25
|
+
`}function $b(e,t,n,r,i,a,o){if(typeof o==`function`&&(o={callback:o}),o?.callback){let{callback:s}=o;Zb(e,t,n,r,i,a,Object.assign(Object.assign({},o),{callback:e=>{s(e?Qb(e,o.headerOptions):void 0)}}))}else{let s=Zb(e,t,n,r,i,a,o);return s?Qb(s,o?.headerOptions):void 0}}function ex(e){let t=e.endsWith(`
|
|
26
26
|
`),n=e.split(`
|
|
27
27
|
`).map(e=>e+`
|
|
28
|
-
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var $b=`/dev/null`;function ex(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??tx(),a=t??tx(),o=cb(Zb(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function tx(){return{name:$b,contents:``}}function nx(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function rx(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function ix({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function ax(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function ox(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function sx(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[rx(`${t}`)]})]})}function cx(e,t,n){return U({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function lx(){return U({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[ix({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function ux(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function dx(e){for(let 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 fx=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],px=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};px.prototype.normal={},px.prototype.property={},px.prototype.space=void 0;function mx(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new px(n,r,t)}function hx(e){return e.toLowerCase()}var gx=class{constructor(e,t){this.attribute=t,this.property=e}};gx.prototype.attribute=``,gx.prototype.booleanish=!1,gx.prototype.boolean=!1,gx.prototype.commaOrSpaceSeparated=!1,gx.prototype.commaSeparated=!1,gx.prototype.defined=!1,gx.prototype.mustUseProperty=!1,gx.prototype.number=!1,gx.prototype.overloadedBoolean=!1,gx.prototype.property=``,gx.prototype.spaceSeparated=!1,gx.prototype.space=void 0;var _x=t({boolean:()=>W,booleanish:()=>yx,commaOrSpaceSeparated:()=>Cx,commaSeparated:()=>Sx,number:()=>G,overloadedBoolean:()=>bx,spaceSeparated:()=>xx}),vx=0,W=wx(),yx=wx(),bx=wx(),G=wx(),xx=wx(),Sx=wx(),Cx=wx();function wx(){return 2**++vx}var Tx=Object.keys(_x),Ex=class extends gx{constructor(e,t,n,r){let i=-1;if(super(e,t),Dx(this,`space`,r),typeof n==`number`)for(;++i<Tx.length;){let e=Tx[i];Dx(this,Tx[i],(n&_x[e])===_x[e])}}};Ex.prototype.defined=!0;function Dx(e,t,n){n&&(e[t]=n)}function Ox(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ex(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[hx(r)]=r,n[hx(a.attribute)]=r}return new px(t,n,e.space)}var kx=Ox({properties:{ariaActiveDescendant:null,ariaAtomic:yx,ariaAutoComplete:null,ariaBusy:yx,ariaChecked:yx,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:xx,ariaCurrent:null,ariaDescribedBy:xx,ariaDetails:null,ariaDisabled:yx,ariaDropEffect:xx,ariaErrorMessage:null,ariaExpanded:yx,ariaFlowTo:xx,ariaGrabbed:yx,ariaHasPopup:null,ariaHidden:yx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:xx,ariaLevel:G,ariaLive:null,ariaModal:yx,ariaMultiLine:yx,ariaMultiSelectable:yx,ariaOrientation:null,ariaOwns:xx,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:yx,ariaReadOnly:yx,ariaRelevant:null,ariaRequired:yx,ariaRoleDescription:xx,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:yx,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Ax(e,t){return t in e?e[t]:t}function jx(e,t){return Ax(e,t.toLowerCase())}var Mx=Ox({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:Sx,acceptCharset:xx,accessKey:xx,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:xx,autoFocus:W,autoPlay:W,blocking:xx,capture:null,charSet:null,checked:W,cite:null,className:xx,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:yx,controls:W,controlsList:xx,coords:G|Sx,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:bx,draggable:yx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:xx,height:G,hidden:bx,high:G,href:null,hrefLang:null,htmlFor:xx,httpEquiv:xx,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:xx,itemRef:xx,itemScope:W,itemType:xx,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:G,pattern:null,ping:xx,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:xx,required:W,reversed:W,rows:G,rowSpan:G,sandbox:xx,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:yx,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:yx,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:xx,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:yx,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:Sx,part:xx,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:jx}),Nx=Ox({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Cx,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:xx,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:Sx,g2:Sx,glyphName:Sx,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Cx,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:xx,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Cx,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Cx,rev:Cx,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Cx,requiredFeatures:Cx,requiredFonts:Cx,requiredFormats:Cx,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Cx,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Cx,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Cx,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Ax}),Px=Ox({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Fx=Ox({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:jx}),Ix=Ox({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),Lx=/[A-Z]/g,Rx=/-[a-z]/g,zx=/^data[-\w.:]+$/i;function Bx(e,t){let n=hx(t),r=t,i=gx;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&zx.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Rx,Hx);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Rx.test(e)){let n=e.replace(Lx,Vx);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ex}return new i(r,t)}function Vx(e){return`-`+e.toLowerCase()}function Hx(e){return e.charAt(1).toUpperCase()}var Ux=mx([kx,Mx,Px,Fx,Ix],`html`),Wx=mx([kx,Nx,Px,Fx,Ix],`svg`),Gx={}.hasOwnProperty;function Kx(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&Gx.call(t,e)){let n=String(t[e]);i=Gx.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var qx=/["&'<>`]/g,Jx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Yx=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Xx=/[|\\{}()[\]^$+*?.]/g,Zx=new WeakMap;function Qx(e,t){if(e=e.replace(t.subset?$x(t.subset):qx,r),t.subset||t.escapeOnly)return e;return e.replace(Jx,n).replace(Yx,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function $x(e){let t=Zx.get(e);return t||(t=eS(e),Zx.set(e,t)),t}function eS(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Xx,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var tS=/[\dA-Fa-f]/;function nS(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!tS.test(String.fromCharCode(t))?r:r+`;`}var rS=/\d/;function iS(e,t,n){let r=`&#`+String(e);return n&&t&&!rS.test(String.fromCharCode(t))?r:r+`;`}var aS=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),oS={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},sS=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],cS={}.hasOwnProperty,lS={},uS;for(uS in oS)cS.call(oS,uS)&&(lS[oS[uS]]=uS);var dS=/[^\dA-Za-z]/;function fS(e,t,n,r){let i=String.fromCharCode(e);if(cS.call(lS,i)){let e=lS[i],a=`&`+e;return n&&aS.includes(e)&&!sS.includes(e)&&(!r||t&&t!==61&&dS.test(String.fromCharCode(t)))?a:a+`;`}return``}function pS(e,t,n){let r=nS(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=fS(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=iS(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function mS(e,t){return Qx(e,Object.assign({format:pS},t))}var hS=/^>|^->|<!--|-->|--!>|<!-$/g,gS=[`>`],_S=[`<`,`>`];function vS(e,t,n,r){return r.settings.bogusComments?`<?`+mS(e.value,Object.assign({},r.settings.characterReferences,{subset:gS}))+`>`:`<!--`+e.value.replace(hS,i)+`-->`;function i(e){return mS(e,Object.assign({},r.settings.characterReferences,{subset:_S}))}}function yS(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function bS(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function xS(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function SS(e){return e.join(` `).trim()}var CS=/[ \t\n\f\r]/g;function wS(e){return typeof e==`object`?e.type===`text`&&TS(e.value):TS(e)}function TS(e){return e.replace(CS,``)===``}var ES=kS(1),DS=kS(-1),OS=[];function kS(e){return t;function t(t,n,r){let i=t?t.children:OS,a=(n||0)+e,o=i[a];if(!r)for(;o&&wS(o);)a+=e,o=i[a];return o}}var AS={}.hasOwnProperty;function jS(e){return t;function t(t,n,r){return AS.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var MS=jS({body:FS,caption:NS,colgroup:NS,dd:zS,dt:RS,head:NS,html:PS,li:LS,optgroup:VS,option:HS,p:IS,rp:BS,rt:BS,tbody:WS,td:qS,tfoot:GS,th:qS,thead:US,tr:KS});function NS(e,t,n){let r=ES(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&wS(r.value.charAt(0)))}function PS(e,t,n){let r=ES(n,t);return!r||r.type!==`comment`}function FS(e,t,n){let r=ES(n,t);return!r||r.type!==`comment`}function IS(e,t,n){let r=ES(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function LS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&r.tagName===`li`}function RS(e,t,n){let r=ES(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function zS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function BS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function VS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function HS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function US(e,t,n){let r=ES(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function WS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function GS(e,t,n){return!ES(n,t)}function KS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function qS(e,t,n){let r=ES(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var JS=jS({body:ZS,colgroup:QS,head:XS,html:YS,tbody:$S});function YS(e){let t=ES(e,-1);return!t||t.type!==`comment`}function XS(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function ZS(e){let t=ES(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&wS(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function QS(e,t,n){let r=DS(n,t),i=ES(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&MS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function $S(e,t,n){let r=DS(n,t),i=ES(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&MS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var eC={name:[[`
|
|
28
|
+
`);return t?n.pop():n.push(n.pop().slice(0,-1)),n}var tx=`/dev/null`;function nx(e,t,n,r=!1){if(e===null&&t===null)throw Error(`parseDiffFromFile: You must pass oldFile, newFile, or both`);let i=e??rx(),a=t??rx(),o=ub($b(i.name,a.name,i.contents,a.contents,i.header,a.header,n),{cacheKey:(()=>{let n=e?.cacheKey??e?.name,r=t?.cacheKey??t?.name;return n!=null&&r!=null?n+`:`+r:n??r})(),oldFile:i,newFile:a,throwOnError:r});if(o==null)throw Error(`parseDiffFrom: FileInvalid diff -- probably need to fix something -- if the files are the same maybe?`);e===null?(o.type=`new`,o.prevName=void 0):t===null&&(o.type=`deleted`,o.prevName=void 0);let s=t?.lang??(t===null?e?.lang:void 0);return s!=null&&(o.lang=s),o}function rx(){return{name:tx,contents:``}}function ix(e,t){return e?.cacheKey===t?.cacheKey&&e?.contents===t?.contents&&e?.name===t?.name&&e?.lang===t?.lang}function ax(e){return{type:`text`,value:e}}function U({tagName:e,children:t=[],properties:n={}}){return{type:`element`,tagName:e,properties:n,children:t}}function ox({name:e,width:t=16,height:n=16,properties:r}){return U({tagName:`svg`,properties:{width:t,height:n,viewBox:`0 0 16 16`,...r},children:[U({tagName:`use`,properties:{href:`#${e.replace(/^#/,``)}`}})]})}function sx(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t;t=`children`in t?t.children[0]:null}}function cx(e){return U({tagName:`div`,properties:{"data-gutter":``},children:e})}function lx(e,t,n,r={}){return U({tagName:`div`,properties:{"data-line-type":e,"data-column-number":t,"data-line-index":n,...r},children:t==null?void 0:[U({tagName:`span`,properties:{"data-line-number-content":``},children:[ax(`${t}`)]})]})}function ux(e,t,n){return U({tagName:`div`,properties:{"data-gutter-buffer":t,"data-buffer-size":n,"data-line-type":t===`annotation`?void 0:e,style:t===`annotation`?`grid-row: span ${n};`:`grid-row: span ${n};min-height:calc(${n} * 1lh);`}})}function dx(){return U({tagName:`button`,properties:{"data-utility-button":``,type:`button`},children:[ox({name:`diffs-icon-plus`,properties:{"data-icon":``}})]})}function fx(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side}function px(e){for(let 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 mx=[`area`,`base`,`basefont`,`bgsound`,`br`,`col`,`command`,`embed`,`frame`,`hr`,`image`,`img`,`input`,`keygen`,`link`,`meta`,`param`,`source`,`track`,`wbr`],hx=class{constructor(e,t,n){this.normal=t,this.property=e,n&&(this.space=n)}};hx.prototype.normal={},hx.prototype.property={},hx.prototype.space=void 0;function gx(e,t){let n={},r={};for(let t of e)Object.assign(n,t.property),Object.assign(r,t.normal);return new hx(n,r,t)}function _x(e){return e.toLowerCase()}var vx=class{constructor(e,t){this.attribute=t,this.property=e}};vx.prototype.attribute=``,vx.prototype.booleanish=!1,vx.prototype.boolean=!1,vx.prototype.commaOrSpaceSeparated=!1,vx.prototype.commaSeparated=!1,vx.prototype.defined=!1,vx.prototype.mustUseProperty=!1,vx.prototype.number=!1,vx.prototype.overloadedBoolean=!1,vx.prototype.property=``,vx.prototype.spaceSeparated=!1,vx.prototype.space=void 0;var yx=t({boolean:()=>W,booleanish:()=>xx,commaOrSpaceSeparated:()=>Tx,commaSeparated:()=>wx,number:()=>G,overloadedBoolean:()=>Sx,spaceSeparated:()=>Cx}),bx=0,W=Ex(),xx=Ex(),Sx=Ex(),G=Ex(),Cx=Ex(),wx=Ex(),Tx=Ex();function Ex(){return 2**++bx}var Dx=Object.keys(yx),Ox=class extends vx{constructor(e,t,n,r){let i=-1;if(super(e,t),kx(this,`space`,r),typeof n==`number`)for(;++i<Dx.length;){let e=Dx[i];kx(this,Dx[i],(n&yx[e])===yx[e])}}};Ox.prototype.defined=!0;function kx(e,t,n){n&&(e[t]=n)}function Ax(e){let t={},n={};for(let[r,i]of Object.entries(e.properties)){let a=new Ox(r,e.transform(e.attributes||{},r),i,e.space);e.mustUseProperty&&e.mustUseProperty.includes(r)&&(a.mustUseProperty=!0),t[r]=a,n[_x(r)]=r,n[_x(a.attribute)]=r}return new hx(t,n,e.space)}var jx=Ax({properties:{ariaActiveDescendant:null,ariaAtomic:xx,ariaAutoComplete:null,ariaBusy:xx,ariaChecked:xx,ariaColCount:G,ariaColIndex:G,ariaColSpan:G,ariaControls:Cx,ariaCurrent:null,ariaDescribedBy:Cx,ariaDetails:null,ariaDisabled:xx,ariaDropEffect:Cx,ariaErrorMessage:null,ariaExpanded:xx,ariaFlowTo:Cx,ariaGrabbed:xx,ariaHasPopup:null,ariaHidden:xx,ariaInvalid:null,ariaKeyShortcuts:null,ariaLabel:null,ariaLabelledBy:Cx,ariaLevel:G,ariaLive:null,ariaModal:xx,ariaMultiLine:xx,ariaMultiSelectable:xx,ariaOrientation:null,ariaOwns:Cx,ariaPlaceholder:null,ariaPosInSet:G,ariaPressed:xx,ariaReadOnly:xx,ariaRelevant:null,ariaRequired:xx,ariaRoleDescription:Cx,ariaRowCount:G,ariaRowIndex:G,ariaRowSpan:G,ariaSelected:xx,ariaSetSize:G,ariaSort:null,ariaValueMax:G,ariaValueMin:G,ariaValueNow:G,ariaValueText:null,role:null},transform(e,t){return t===`role`?t:`aria-`+t.slice(4).toLowerCase()}});function Mx(e,t){return t in e?e[t]:t}function Nx(e,t){return Mx(e,t.toLowerCase())}var Px=Ax({attributes:{acceptcharset:`accept-charset`,classname:`class`,htmlfor:`for`,httpequiv:`http-equiv`},mustUseProperty:[`checked`,`multiple`,`muted`,`selected`],properties:{abbr:null,accept:wx,acceptCharset:Cx,accessKey:Cx,action:null,allow:null,allowFullScreen:W,allowPaymentRequest:W,allowUserMedia:W,alpha:W,alt:null,as:null,async:W,autoCapitalize:null,autoComplete:Cx,autoFocus:W,autoPlay:W,blocking:Cx,capture:null,charSet:null,checked:W,cite:null,className:Cx,closedBy:null,colorSpace:null,cols:G,colSpan:G,command:null,commandFor:null,content:null,contentEditable:xx,controls:W,controlsList:Cx,coords:G|wx,crossOrigin:null,data:null,dateTime:null,decoding:null,default:W,defer:W,dir:null,dirName:null,disabled:W,download:Sx,draggable:xx,encType:null,enterKeyHint:null,fetchPriority:null,form:null,formAction:null,formEncType:null,formMethod:null,formNoValidate:W,formTarget:null,headers:Cx,height:G,hidden:Sx,high:G,href:null,hrefLang:null,htmlFor:Cx,httpEquiv:Cx,id:null,imageSizes:null,imageSrcSet:null,inert:W,inputMode:null,integrity:null,is:null,isMap:W,itemId:null,itemProp:Cx,itemRef:Cx,itemScope:W,itemType:Cx,kind:null,label:null,lang:null,language:null,list:null,loading:null,loop:W,low:G,manifest:null,max:null,maxLength:G,media:null,method:null,min:null,minLength:G,multiple:W,muted:W,name:null,nonce:null,noModule:W,noValidate:W,onAbort:null,onAfterPrint:null,onAuxClick:null,onBeforeMatch:null,onBeforePrint:null,onBeforeToggle:null,onBeforeUnload:null,onBlur:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onContextLost:null,onContextMenu:null,onContextRestored:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnded:null,onError:null,onFocus:null,onFormData:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLanguageChange:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadEnd:null,onLoadStart:null,onMessage:null,onMessageError:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRejectionHandled:null,onReset:null,onResize:null,onScroll:null,onScrollEnd:null,onSecurityPolicyViolation:null,onSeeked:null,onSeeking:null,onSelect:null,onSlotChange:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnhandledRejection:null,onUnload:null,onVolumeChange:null,onWaiting:null,onWheel:null,open:W,optimum:G,pattern:null,ping:Cx,placeholder:null,playsInline:W,popover:null,popoverTarget:null,popoverTargetAction:null,poster:null,preload:null,readOnly:W,referrerPolicy:null,rel:Cx,required:W,reversed:W,rows:G,rowSpan:G,sandbox:Cx,scope:null,scoped:W,seamless:W,selected:W,shadowRootClonable:W,shadowRootCustomElementRegistry:W,shadowRootDelegatesFocus:W,shadowRootMode:null,shadowRootSerializable:W,shape:null,size:G,sizes:null,slot:null,span:G,spellCheck:xx,src:null,srcDoc:null,srcLang:null,srcSet:null,start:G,step:null,style:null,tabIndex:G,target:null,title:null,translate:null,type:null,typeMustMatch:W,useMap:null,value:xx,width:G,wrap:null,writingSuggestions:null,align:null,aLink:null,archive:Cx,axis:null,background:null,bgColor:null,border:G,borderColor:null,bottomMargin:G,cellPadding:null,cellSpacing:null,char:null,charOff:null,classId:null,clear:null,code:null,codeBase:null,codeType:null,color:null,compact:W,declare:W,event:null,face:null,frame:null,frameBorder:null,hSpace:G,leftMargin:G,link:null,longDesc:null,lowSrc:null,marginHeight:G,marginWidth:G,noResize:W,noHref:W,noShade:W,noWrap:W,object:null,profile:null,prompt:null,rev:null,rightMargin:G,rules:null,scheme:null,scrolling:xx,standby:null,summary:null,text:null,topMargin:G,valueType:null,version:null,vAlign:null,vLink:null,vSpace:G,allowTransparency:null,autoCorrect:null,autoSave:null,credentialless:W,disablePictureInPicture:W,disableRemotePlayback:W,exportParts:wx,part:Cx,prefix:null,property:null,results:G,security:null,unselectable:null},space:`html`,transform:Nx}),Fx=Ax({attributes:{accentHeight:`accent-height`,alignmentBaseline:`alignment-baseline`,arabicForm:`arabic-form`,baselineShift:`baseline-shift`,capHeight:`cap-height`,className:`class`,clipPath:`clip-path`,clipRule:`clip-rule`,colorInterpolation:`color-interpolation`,colorInterpolationFilters:`color-interpolation-filters`,colorProfile:`color-profile`,colorRendering:`color-rendering`,crossOrigin:`crossorigin`,dataType:`datatype`,dominantBaseline:`dominant-baseline`,enableBackground:`enable-background`,fillOpacity:`fill-opacity`,fillRule:`fill-rule`,floodColor:`flood-color`,floodOpacity:`flood-opacity`,fontFamily:`font-family`,fontSize:`font-size`,fontSizeAdjust:`font-size-adjust`,fontStretch:`font-stretch`,fontStyle:`font-style`,fontVariant:`font-variant`,fontWeight:`font-weight`,glyphName:`glyph-name`,glyphOrientationHorizontal:`glyph-orientation-horizontal`,glyphOrientationVertical:`glyph-orientation-vertical`,hrefLang:`hreflang`,horizAdvX:`horiz-adv-x`,horizOriginX:`horiz-origin-x`,horizOriginY:`horiz-origin-y`,imageRendering:`image-rendering`,letterSpacing:`letter-spacing`,lightingColor:`lighting-color`,markerEnd:`marker-end`,markerMid:`marker-mid`,markerStart:`marker-start`,maskType:`mask-type`,navDown:`nav-down`,navDownLeft:`nav-down-left`,navDownRight:`nav-down-right`,navLeft:`nav-left`,navNext:`nav-next`,navPrev:`nav-prev`,navRight:`nav-right`,navUp:`nav-up`,navUpLeft:`nav-up-left`,navUpRight:`nav-up-right`,onAbort:`onabort`,onActivate:`onactivate`,onAfterPrint:`onafterprint`,onBeforePrint:`onbeforeprint`,onBegin:`onbegin`,onCancel:`oncancel`,onCanPlay:`oncanplay`,onCanPlayThrough:`oncanplaythrough`,onChange:`onchange`,onClick:`onclick`,onClose:`onclose`,onCopy:`oncopy`,onCueChange:`oncuechange`,onCut:`oncut`,onDblClick:`ondblclick`,onDrag:`ondrag`,onDragEnd:`ondragend`,onDragEnter:`ondragenter`,onDragExit:`ondragexit`,onDragLeave:`ondragleave`,onDragOver:`ondragover`,onDragStart:`ondragstart`,onDrop:`ondrop`,onDurationChange:`ondurationchange`,onEmptied:`onemptied`,onEnd:`onend`,onEnded:`onended`,onError:`onerror`,onFocus:`onfocus`,onFocusIn:`onfocusin`,onFocusOut:`onfocusout`,onHashChange:`onhashchange`,onInput:`oninput`,onInvalid:`oninvalid`,onKeyDown:`onkeydown`,onKeyPress:`onkeypress`,onKeyUp:`onkeyup`,onLoad:`onload`,onLoadedData:`onloadeddata`,onLoadedMetadata:`onloadedmetadata`,onLoadStart:`onloadstart`,onMessage:`onmessage`,onMouseDown:`onmousedown`,onMouseEnter:`onmouseenter`,onMouseLeave:`onmouseleave`,onMouseMove:`onmousemove`,onMouseOut:`onmouseout`,onMouseOver:`onmouseover`,onMouseUp:`onmouseup`,onMouseWheel:`onmousewheel`,onOffline:`onoffline`,onOnline:`ononline`,onPageHide:`onpagehide`,onPageShow:`onpageshow`,onPaste:`onpaste`,onPause:`onpause`,onPlay:`onplay`,onPlaying:`onplaying`,onPopState:`onpopstate`,onProgress:`onprogress`,onRateChange:`onratechange`,onRepeat:`onrepeat`,onReset:`onreset`,onResize:`onresize`,onScroll:`onscroll`,onSeeked:`onseeked`,onSeeking:`onseeking`,onSelect:`onselect`,onShow:`onshow`,onStalled:`onstalled`,onStorage:`onstorage`,onSubmit:`onsubmit`,onSuspend:`onsuspend`,onTimeUpdate:`ontimeupdate`,onToggle:`ontoggle`,onUnload:`onunload`,onVolumeChange:`onvolumechange`,onWaiting:`onwaiting`,onZoom:`onzoom`,overlinePosition:`overline-position`,overlineThickness:`overline-thickness`,paintOrder:`paint-order`,panose1:`panose-1`,pointerEvents:`pointer-events`,referrerPolicy:`referrerpolicy`,renderingIntent:`rendering-intent`,shapeRendering:`shape-rendering`,stopColor:`stop-color`,stopOpacity:`stop-opacity`,strikethroughPosition:`strikethrough-position`,strikethroughThickness:`strikethrough-thickness`,strokeDashArray:`stroke-dasharray`,strokeDashOffset:`stroke-dashoffset`,strokeLineCap:`stroke-linecap`,strokeLineJoin:`stroke-linejoin`,strokeMiterLimit:`stroke-miterlimit`,strokeOpacity:`stroke-opacity`,strokeWidth:`stroke-width`,tabIndex:`tabindex`,textAnchor:`text-anchor`,textDecoration:`text-decoration`,textRendering:`text-rendering`,transformOrigin:`transform-origin`,typeOf:`typeof`,underlinePosition:`underline-position`,underlineThickness:`underline-thickness`,unicodeBidi:`unicode-bidi`,unicodeRange:`unicode-range`,unitsPerEm:`units-per-em`,vAlphabetic:`v-alphabetic`,vHanging:`v-hanging`,vIdeographic:`v-ideographic`,vMathematical:`v-mathematical`,vectorEffect:`vector-effect`,vertAdvY:`vert-adv-y`,vertOriginX:`vert-origin-x`,vertOriginY:`vert-origin-y`,wordSpacing:`word-spacing`,writingMode:`writing-mode`,xHeight:`x-height`,playbackOrder:`playbackorder`,timelineBegin:`timelinebegin`},properties:{about:Tx,accentHeight:G,accumulate:null,additive:null,alignmentBaseline:null,alphabetic:G,amplitude:G,arabicForm:null,ascent:G,attributeName:null,attributeType:null,azimuth:G,bandwidth:null,baselineShift:null,baseFrequency:null,baseProfile:null,bbox:null,begin:null,bias:G,by:null,calcMode:null,capHeight:G,className:Cx,clip:null,clipPath:null,clipPathUnits:null,clipRule:null,color:null,colorInterpolation:null,colorInterpolationFilters:null,colorProfile:null,colorRendering:null,content:null,contentScriptType:null,contentStyleType:null,crossOrigin:null,cursor:null,cx:null,cy:null,d:null,dataType:null,defaultAction:null,descent:G,diffuseConstant:G,direction:null,display:null,dur:null,divisor:G,dominantBaseline:null,download:W,dx:null,dy:null,edgeMode:null,editable:null,elevation:G,enableBackground:null,end:null,event:null,exponent:G,externalResourcesRequired:null,fill:null,fillOpacity:G,fillRule:null,filter:null,filterRes:null,filterUnits:null,floodColor:null,floodOpacity:null,focusable:null,focusHighlight:null,fontFamily:null,fontSize:null,fontSizeAdjust:null,fontStretch:null,fontStyle:null,fontVariant:null,fontWeight:null,format:null,fr:null,from:null,fx:null,fy:null,g1:wx,g2:wx,glyphName:wx,glyphOrientationHorizontal:null,glyphOrientationVertical:null,glyphRef:null,gradientTransform:null,gradientUnits:null,handler:null,hanging:G,hatchContentUnits:null,hatchUnits:null,height:null,href:null,hrefLang:null,horizAdvX:G,horizOriginX:G,horizOriginY:G,id:null,ideographic:G,imageRendering:null,initialVisibility:null,in:null,in2:null,intercept:G,k:G,k1:G,k2:G,k3:G,k4:G,kernelMatrix:Tx,kernelUnitLength:null,keyPoints:null,keySplines:null,keyTimes:null,kerning:null,lang:null,lengthAdjust:null,letterSpacing:null,lightingColor:null,limitingConeAngle:G,local:null,markerEnd:null,markerMid:null,markerStart:null,markerHeight:null,markerUnits:null,markerWidth:null,mask:null,maskContentUnits:null,maskType:null,maskUnits:null,mathematical:null,max:null,media:null,mediaCharacterEncoding:null,mediaContentEncodings:null,mediaSize:G,mediaTime:null,method:null,min:null,mode:null,name:null,navDown:null,navDownLeft:null,navDownRight:null,navLeft:null,navNext:null,navPrev:null,navRight:null,navUp:null,navUpLeft:null,navUpRight:null,numOctaves:null,observer:null,offset:null,onAbort:null,onActivate:null,onAfterPrint:null,onBeforePrint:null,onBegin:null,onCancel:null,onCanPlay:null,onCanPlayThrough:null,onChange:null,onClick:null,onClose:null,onCopy:null,onCueChange:null,onCut:null,onDblClick:null,onDrag:null,onDragEnd:null,onDragEnter:null,onDragExit:null,onDragLeave:null,onDragOver:null,onDragStart:null,onDrop:null,onDurationChange:null,onEmptied:null,onEnd:null,onEnded:null,onError:null,onFocus:null,onFocusIn:null,onFocusOut:null,onHashChange:null,onInput:null,onInvalid:null,onKeyDown:null,onKeyPress:null,onKeyUp:null,onLoad:null,onLoadedData:null,onLoadedMetadata:null,onLoadStart:null,onMessage:null,onMouseDown:null,onMouseEnter:null,onMouseLeave:null,onMouseMove:null,onMouseOut:null,onMouseOver:null,onMouseUp:null,onMouseWheel:null,onOffline:null,onOnline:null,onPageHide:null,onPageShow:null,onPaste:null,onPause:null,onPlay:null,onPlaying:null,onPopState:null,onProgress:null,onRateChange:null,onRepeat:null,onReset:null,onResize:null,onScroll:null,onSeeked:null,onSeeking:null,onSelect:null,onShow:null,onStalled:null,onStorage:null,onSubmit:null,onSuspend:null,onTimeUpdate:null,onToggle:null,onUnload:null,onVolumeChange:null,onWaiting:null,onZoom:null,opacity:null,operator:null,order:null,orient:null,orientation:null,origin:null,overflow:null,overlay:null,overlinePosition:G,overlineThickness:G,paintOrder:null,panose1:null,path:null,pathLength:G,patternContentUnits:null,patternTransform:null,patternUnits:null,phase:null,ping:Cx,pitch:null,playbackOrder:null,pointerEvents:null,points:null,pointsAtX:G,pointsAtY:G,pointsAtZ:G,preserveAlpha:null,preserveAspectRatio:null,primitiveUnits:null,propagate:null,property:Tx,r:null,radius:null,referrerPolicy:null,refX:null,refY:null,rel:Tx,rev:Tx,renderingIntent:null,repeatCount:null,repeatDur:null,requiredExtensions:Tx,requiredFeatures:Tx,requiredFonts:Tx,requiredFormats:Tx,resource:null,restart:null,result:null,rotate:null,rx:null,ry:null,scale:null,seed:null,shapeRendering:null,side:null,slope:null,snapshotTime:null,specularConstant:G,specularExponent:G,spreadMethod:null,spacing:null,startOffset:null,stdDeviation:null,stemh:null,stemv:null,stitchTiles:null,stopColor:null,stopOpacity:null,strikethroughPosition:G,strikethroughThickness:G,string:null,stroke:null,strokeDashArray:Tx,strokeDashOffset:null,strokeLineCap:null,strokeLineJoin:null,strokeMiterLimit:G,strokeOpacity:G,strokeWidth:null,style:null,surfaceScale:G,syncBehavior:null,syncBehaviorDefault:null,syncMaster:null,syncTolerance:null,syncToleranceDefault:null,systemLanguage:Tx,tabIndex:G,tableValues:null,target:null,targetX:G,targetY:G,textAnchor:null,textDecoration:null,textRendering:null,textLength:null,timelineBegin:null,title:null,transformBehavior:null,type:null,typeOf:Tx,to:null,transform:null,transformOrigin:null,u1:null,u2:null,underlinePosition:G,underlineThickness:G,unicode:null,unicodeBidi:null,unicodeRange:null,unitsPerEm:G,values:null,vAlphabetic:G,vMathematical:G,vectorEffect:null,vHanging:G,vIdeographic:G,version:null,vertAdvY:G,vertOriginX:G,vertOriginY:G,viewBox:null,viewTarget:null,visibility:null,width:null,widths:null,wordSpacing:null,writingMode:null,x:null,x1:null,x2:null,xChannelSelector:null,xHeight:G,y:null,y1:null,y2:null,yChannelSelector:null,z:null,zoomAndPan:null},space:`svg`,transform:Mx}),Ix=Ax({properties:{xLinkActuate:null,xLinkArcRole:null,xLinkHref:null,xLinkRole:null,xLinkShow:null,xLinkTitle:null,xLinkType:null},space:`xlink`,transform(e,t){return`xlink:`+t.slice(5).toLowerCase()}}),Lx=Ax({attributes:{xmlnsxlink:`xmlns:xlink`},properties:{xmlnsXLink:null,xmlns:null},space:`xmlns`,transform:Nx}),Rx=Ax({properties:{xmlBase:null,xmlLang:null,xmlSpace:null},space:`xml`,transform(e,t){return`xml:`+t.slice(3).toLowerCase()}}),zx=/[A-Z]/g,Bx=/-[a-z]/g,Vx=/^data[-\w.:]+$/i;function Hx(e,t){let n=_x(t),r=t,i=vx;if(n in e.normal)return e.property[e.normal[n]];if(n.length>4&&n.slice(0,4)===`data`&&Vx.test(t)){if(t.charAt(4)===`-`){let e=t.slice(5).replace(Bx,Wx);r=`data`+e.charAt(0).toUpperCase()+e.slice(1)}else{let e=t.slice(4);if(!Bx.test(e)){let n=e.replace(zx,Ux);n.charAt(0)!==`-`&&(n=`-`+n),t=`data`+n}}i=Ox}return new i(r,t)}function Ux(e){return`-`+e.toLowerCase()}function Wx(e){return e.charAt(1).toUpperCase()}var Gx=gx([jx,Px,Ix,Lx,Rx],`html`),Kx=gx([jx,Fx,Ix,Lx,Rx],`svg`),qx={}.hasOwnProperty;function Jx(e,t){let n=t||{};function r(t,...n){let i=r.invalid,a=r.handlers;if(t&&qx.call(t,e)){let n=String(t[e]);i=qx.call(a,n)?a[n]:r.unknown}if(i)return i.call(this,t,...n)}return r.handlers=n.handlers||{},r.invalid=n.invalid,r.unknown=n.unknown,r}var Yx=/["&'<>`]/g,Xx=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g,Zx=/[\x01-\t\v\f\x0E-\x1F\x7F\x81\x8D\x8F\x90\x9D\xA0-\uFFFF]/g,Qx=/[|\\{}()[\]^$+*?.]/g,$x=new WeakMap;function eS(e,t){if(e=e.replace(t.subset?tS(t.subset):Yx,r),t.subset||t.escapeOnly)return e;return e.replace(Xx,n).replace(Zx,r);function n(e,n,r){return t.format((e.charCodeAt(0)-55296)*1024+e.charCodeAt(1)-56320+65536,r.charCodeAt(n+2),t)}function r(e,n,r){return t.format(e.charCodeAt(0),r.charCodeAt(n+1),t)}}function tS(e){let t=$x.get(e);return t||(t=nS(e),$x.set(e,t)),t}function nS(e){let t=[],n=-1;for(;++n<e.length;)t.push(e[n].replace(Qx,`\\$&`));return RegExp(`(?:`+t.join(`|`)+`)`,`g`)}var rS=/[\dA-Fa-f]/;function iS(e,t,n){let r=`&#x`+e.toString(16).toUpperCase();return n&&t&&!rS.test(String.fromCharCode(t))?r:r+`;`}var aS=/\d/;function oS(e,t,n){let r=`&#`+String(e);return n&&t&&!aS.test(String.fromCharCode(t))?r:r+`;`}var sS=`AElig.AMP.Aacute.Acirc.Agrave.Aring.Atilde.Auml.COPY.Ccedil.ETH.Eacute.Ecirc.Egrave.Euml.GT.Iacute.Icirc.Igrave.Iuml.LT.Ntilde.Oacute.Ocirc.Ograve.Oslash.Otilde.Ouml.QUOT.REG.THORN.Uacute.Ucirc.Ugrave.Uuml.Yacute.aacute.acirc.acute.aelig.agrave.amp.aring.atilde.auml.brvbar.ccedil.cedil.cent.copy.curren.deg.divide.eacute.ecirc.egrave.eth.euml.frac12.frac14.frac34.gt.iacute.icirc.iexcl.igrave.iquest.iuml.laquo.lt.macr.micro.middot.nbsp.not.ntilde.oacute.ocirc.ograve.ordf.ordm.oslash.otilde.ouml.para.plusmn.pound.quot.raquo.reg.sect.shy.sup1.sup2.sup3.szlig.thorn.times.uacute.ucirc.ugrave.uml.uuml.yacute.yen.yuml`.split(`.`),cS={nbsp:`\xA0`,iexcl:`¡`,cent:`¢`,pound:`£`,curren:`¤`,yen:`¥`,brvbar:`¦`,sect:`§`,uml:`¨`,copy:`©`,ordf:`ª`,laquo:`«`,not:`¬`,shy:``,reg:`®`,macr:`¯`,deg:`°`,plusmn:`±`,sup2:`²`,sup3:`³`,acute:`´`,micro:`µ`,para:`¶`,middot:`·`,cedil:`¸`,sup1:`¹`,ordm:`º`,raquo:`»`,frac14:`¼`,frac12:`½`,frac34:`¾`,iquest:`¿`,Agrave:`À`,Aacute:`Á`,Acirc:`Â`,Atilde:`Ã`,Auml:`Ä`,Aring:`Å`,AElig:`Æ`,Ccedil:`Ç`,Egrave:`È`,Eacute:`É`,Ecirc:`Ê`,Euml:`Ë`,Igrave:`Ì`,Iacute:`Í`,Icirc:`Î`,Iuml:`Ï`,ETH:`Ð`,Ntilde:`Ñ`,Ograve:`Ò`,Oacute:`Ó`,Ocirc:`Ô`,Otilde:`Õ`,Ouml:`Ö`,times:`×`,Oslash:`Ø`,Ugrave:`Ù`,Uacute:`Ú`,Ucirc:`Û`,Uuml:`Ü`,Yacute:`Ý`,THORN:`Þ`,szlig:`ß`,agrave:`à`,aacute:`á`,acirc:`â`,atilde:`ã`,auml:`ä`,aring:`å`,aelig:`æ`,ccedil:`ç`,egrave:`è`,eacute:`é`,ecirc:`ê`,euml:`ë`,igrave:`ì`,iacute:`í`,icirc:`î`,iuml:`ï`,eth:`ð`,ntilde:`ñ`,ograve:`ò`,oacute:`ó`,ocirc:`ô`,otilde:`õ`,ouml:`ö`,divide:`÷`,oslash:`ø`,ugrave:`ù`,uacute:`ú`,ucirc:`û`,uuml:`ü`,yacute:`ý`,thorn:`þ`,yuml:`ÿ`,fnof:`ƒ`,Alpha:`Α`,Beta:`Β`,Gamma:`Γ`,Delta:`Δ`,Epsilon:`Ε`,Zeta:`Ζ`,Eta:`Η`,Theta:`Θ`,Iota:`Ι`,Kappa:`Κ`,Lambda:`Λ`,Mu:`Μ`,Nu:`Ν`,Xi:`Ξ`,Omicron:`Ο`,Pi:`Π`,Rho:`Ρ`,Sigma:`Σ`,Tau:`Τ`,Upsilon:`Υ`,Phi:`Φ`,Chi:`Χ`,Psi:`Ψ`,Omega:`Ω`,alpha:`α`,beta:`β`,gamma:`γ`,delta:`δ`,epsilon:`ε`,zeta:`ζ`,eta:`η`,theta:`θ`,iota:`ι`,kappa:`κ`,lambda:`λ`,mu:`μ`,nu:`ν`,xi:`ξ`,omicron:`ο`,pi:`π`,rho:`ρ`,sigmaf:`ς`,sigma:`σ`,tau:`τ`,upsilon:`υ`,phi:`φ`,chi:`χ`,psi:`ψ`,omega:`ω`,thetasym:`ϑ`,upsih:`ϒ`,piv:`ϖ`,bull:`•`,hellip:`…`,prime:`′`,Prime:`″`,oline:`‾`,frasl:`⁄`,weierp:`℘`,image:`ℑ`,real:`ℜ`,trade:`™`,alefsym:`ℵ`,larr:`←`,uarr:`↑`,rarr:`→`,darr:`↓`,harr:`↔`,crarr:`↵`,lArr:`⇐`,uArr:`⇑`,rArr:`⇒`,dArr:`⇓`,hArr:`⇔`,forall:`∀`,part:`∂`,exist:`∃`,empty:`∅`,nabla:`∇`,isin:`∈`,notin:`∉`,ni:`∋`,prod:`∏`,sum:`∑`,minus:`−`,lowast:`∗`,radic:`√`,prop:`∝`,infin:`∞`,ang:`∠`,and:`∧`,or:`∨`,cap:`∩`,cup:`∪`,int:`∫`,there4:`∴`,sim:`∼`,cong:`≅`,asymp:`≈`,ne:`≠`,equiv:`≡`,le:`≤`,ge:`≥`,sub:`⊂`,sup:`⊃`,nsub:`⊄`,sube:`⊆`,supe:`⊇`,oplus:`⊕`,otimes:`⊗`,perp:`⊥`,sdot:`⋅`,lceil:`⌈`,rceil:`⌉`,lfloor:`⌊`,rfloor:`⌋`,lang:`〈`,rang:`〉`,loz:`◊`,spades:`♠`,clubs:`♣`,hearts:`♥`,diams:`♦`,quot:`"`,amp:`&`,lt:`<`,gt:`>`,OElig:`Œ`,oelig:`œ`,Scaron:`Š`,scaron:`š`,Yuml:`Ÿ`,circ:`ˆ`,tilde:`˜`,ensp:` `,emsp:` `,thinsp:` `,zwnj:``,zwj:``,lrm:``,rlm:``,ndash:`–`,mdash:`—`,lsquo:`‘`,rsquo:`’`,sbquo:`‚`,ldquo:`“`,rdquo:`”`,bdquo:`„`,dagger:`†`,Dagger:`‡`,permil:`‰`,lsaquo:`‹`,rsaquo:`›`,euro:`€`},lS=[`cent`,`copy`,`divide`,`gt`,`lt`,`not`,`para`,`times`],uS={}.hasOwnProperty,dS={},fS;for(fS in cS)uS.call(cS,fS)&&(dS[cS[fS]]=fS);var pS=/[^\dA-Za-z]/;function mS(e,t,n,r){let i=String.fromCharCode(e);if(uS.call(dS,i)){let e=dS[i],a=`&`+e;return n&&sS.includes(e)&&!lS.includes(e)&&(!r||t&&t!==61&&pS.test(String.fromCharCode(t)))?a:a+`;`}return``}function hS(e,t,n){let r=iS(e,t,n.omitOptionalSemicolons),i;if((n.useNamedReferences||n.useShortestReferences)&&(i=mS(e,t,n.omitOptionalSemicolons,n.attribute)),(n.useShortestReferences||!i)&&n.useShortestReferences){let i=oS(e,t,n.omitOptionalSemicolons);i.length<r.length&&(r=i)}return i&&(!n.useShortestReferences||i.length<r.length)?i:r}function gS(e,t){return eS(e,Object.assign({format:hS},t))}var _S=/^>|^->|<!--|-->|--!>|<!-$/g,vS=[`>`],yS=[`<`,`>`];function bS(e,t,n,r){return r.settings.bogusComments?`<?`+gS(e.value,Object.assign({},r.settings.characterReferences,{subset:vS}))+`>`:`<!--`+e.value.replace(_S,i)+`-->`;function i(e){return gS(e,Object.assign({},r.settings.characterReferences,{subset:yS}))}}function xS(e,t,n,r){return`<!`+(r.settings.upperDoctype?`DOCTYPE`:`doctype`)+(r.settings.tightDoctype?``:` `)+`html>`}function SS(e,t){let n=String(e);if(typeof t!=`string`)throw TypeError(`Expected character`);let r=0,i=n.indexOf(t);for(;i!==-1;)r++,i=n.indexOf(t,i+t.length);return r}function CS(e,t){let n=t||{};return(e[e.length-1]===``?[...e,``]:e).join((n.padRight?` `:``)+`,`+(n.padLeft===!1?``:` `)).trim()}function wS(e){return e.join(` `).trim()}var TS=/[ \t\n\f\r]/g;function ES(e){return typeof e==`object`?e.type===`text`&&DS(e.value):DS(e)}function DS(e){return e.replace(TS,``)===``}var OS=jS(1),kS=jS(-1),AS=[];function jS(e){return t;function t(t,n,r){let i=t?t.children:AS,a=(n||0)+e,o=i[a];if(!r)for(;o&&ES(o);)a+=e,o=i[a];return o}}var MS={}.hasOwnProperty;function NS(e){return t;function t(t,n,r){return MS.call(e,t.tagName)&&e[t.tagName](t,n,r)}}var PS=NS({body:LS,caption:FS,colgroup:FS,dd:VS,dt:BS,head:FS,html:IS,li:zS,optgroup:US,option:WS,p:RS,rp:HS,rt:HS,tbody:KS,td:YS,tfoot:qS,th:YS,thead:GS,tr:JS});function FS(e,t,n){let r=OS(n,t,!0);return!r||r.type!==`comment`&&!(r.type===`text`&&ES(r.value.charAt(0)))}function IS(e,t,n){let r=OS(n,t);return!r||r.type!==`comment`}function LS(e,t,n){let r=OS(n,t);return!r||r.type!==`comment`}function RS(e,t,n){let r=OS(n,t);return r?r.type===`element`&&(r.tagName===`address`||r.tagName===`article`||r.tagName===`aside`||r.tagName===`blockquote`||r.tagName===`details`||r.tagName===`div`||r.tagName===`dl`||r.tagName===`fieldset`||r.tagName===`figcaption`||r.tagName===`figure`||r.tagName===`footer`||r.tagName===`form`||r.tagName===`h1`||r.tagName===`h2`||r.tagName===`h3`||r.tagName===`h4`||r.tagName===`h5`||r.tagName===`h6`||r.tagName===`header`||r.tagName===`hgroup`||r.tagName===`hr`||r.tagName===`main`||r.tagName===`menu`||r.tagName===`nav`||r.tagName===`ol`||r.tagName===`p`||r.tagName===`pre`||r.tagName===`section`||r.tagName===`table`||r.tagName===`ul`):!n||n.type!==`element`||n.tagName!==`a`&&n.tagName!==`audio`&&n.tagName!==`del`&&n.tagName!==`ins`&&n.tagName!==`map`&&n.tagName!==`noscript`&&n.tagName!==`video`}function zS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&r.tagName===`li`}function BS(e,t,n){let r=OS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`))}function VS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&(r.tagName===`dt`||r.tagName===`dd`)}function HS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&(r.tagName===`rp`||r.tagName===`rt`)}function US(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&r.tagName===`optgroup`}function WS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&(r.tagName===`option`||r.tagName===`optgroup`)}function GS(e,t,n){let r=OS(n,t);return!!(r&&r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`))}function KS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&(r.tagName===`tbody`||r.tagName===`tfoot`)}function qS(e,t,n){return!OS(n,t)}function JS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&r.tagName===`tr`}function YS(e,t,n){let r=OS(n,t);return!r||r.type===`element`&&(r.tagName===`td`||r.tagName===`th`)}var XS=NS({body:$S,colgroup:eC,head:QS,html:ZS,tbody:tC});function ZS(e){let t=OS(e,-1);return!t||t.type!==`comment`}function QS(e){let t=new Set;for(let n of e.children)if(n.type===`element`&&(n.tagName===`base`||n.tagName===`title`)){if(t.has(n.tagName))return!1;t.add(n.tagName)}let n=e.children[0];return!n||n.type===`element`}function $S(e){let t=OS(e,-1,!0);return!t||t.type!==`comment`&&!(t.type===`text`&&ES(t.value.charAt(0)))&&(t.type!==`element`||t.tagName!==`meta`&&t.tagName!==`link`&&t.tagName!==`script`&&t.tagName!==`style`&&t.tagName!==`template`)}function eC(e,t,n){let r=kS(n,t),i=OS(e,-1,!0);return n&&r&&r.type===`element`&&r.tagName===`colgroup`&&PS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`col`)}function tC(e,t,n){let r=kS(n,t),i=OS(e,-1);return n&&r&&r.type===`element`&&(r.tagName===`thead`||r.tagName===`tbody`)&&PS(r,n.children.indexOf(r),n)?!1:!!(i&&i.type===`element`&&i.tagName===`tr`)}var nC={name:[[`
|
|
29
29
|
\f\r &/=>`.split(``),`
|
|
30
30
|
\f\r "&'/=>\``.split(``)],[`\0
|
|
31
31
|
\f\r "&'/<=>`.split(``),`\0
|
|
@@ -33,12 +33,12 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
|
|
33
33
|
\f\r &>`.split(``),`\0
|
|
34
34
|
\f\r "&'<=>\``.split(``)],[`\0
|
|
35
35
|
\f\r "&'<=>\``.split(``),`\0
|
|
36
|
-
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function tC(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Wx);let l=nC(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!JS(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!MS(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function nC(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=rC(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function rC(e,t,n){let r=Bx(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=mS(r.attribute,Object.assign({},e.settings.characterReferences,{subset:eC.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?xS:SS)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=mS(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:eC.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&bS(n,o)>bS(n,e.alternative)&&(o=e.alternative),s=o+mS(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?eC.single:eC.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var iC=[`<`,`&`];function aC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:mS(e.value,Object.assign({},r.settings.characterReferences,{subset:iC}))}function oC(e,t,n,r){return r.settings.allowDangerousHtml?e.value:aC(e,t,n,r)}function sC(e,t,n,r){return r.all(e)}var cC=Kx(`type`,{invalid:lC,unknown:uC,handlers:{comment:vS,doctype:yS,element:tC,raw:oC,root:sC,text:aC}});function lC(e){throw Error("Expected node, not `"+e+"`")}function uC(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var dC={},fC={},pC=[];function mC(e,t){let n=t||dC,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:hC,all:gC,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||fx,characterReferences:n.characterReferences||fC,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Wx:Ux,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function hC(e,t,n){return cC(e,t,n,this)}function gC(e){let t=[],n=e&&e.children||pC,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var _C=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,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(),By(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?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){let n=!(e===this.selectedRange||Uy(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let 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}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&dx(e.composedPath())||(IC(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(IC(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(IC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){IC(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()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();IC(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);IC(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=SC(i)&&this.hoveredLine?.lineElement===i.lineElement;xC(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),xC(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),SC(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(wC(i)&&p!=null){p(i);break}if(CC(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!SC(i))break;xC(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!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,IC(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),IC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),IC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&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);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();dx(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let 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();let 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();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(ux(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),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()}};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()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{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??(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??(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){let e=document.createElement(`div`);e.innerHTML=mC(lx());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);bC(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let 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(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(DC(t));if(bC(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(bC(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(bC(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&dx(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=DC(e);if(t&&dx(n))return;let r=OC(e);return r==null?this.pathFromAnnotationSlot(e):DC(r)}pathFromAnnotationSlot(e){let t=AC(kC(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:DC(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=jC(t)?t:jC(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Uy(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,zy(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[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,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{By(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!NC(this.renderedSelectedLinesState,n),i=!NC(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};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:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);TC(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=FC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=FC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:EC(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:EC(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:PC(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:PC(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function vC({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:yC({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function yC({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function bC(e){return e!=null&&`kind`in e&&e.kind===`line`}function xC(e){return e!=null&&`kind`in e&&e.kind===`token`}function SC(e){return bC(e)||xC(e)}function CC(e){return`type`in e&&e.type===`line-info`}function wC(e){return`kind`in e&&e.kind===`merge-conflict-action`}function TC(e){return e===`current`||e===`incoming`||e===`both`}function EC(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function DC(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function OC(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function kC(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function AC(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function jC(e){return e!=null&&typeof e.elementFromPoint==`function`}function MC(e,t){return e===t||Uy(e??void 0,t??void 0)}function NC(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&MC(e?.range??null,t.range)}function PC(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function FC(e){let 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 IC(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var LC=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),BC(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?UC(t):WC(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:RC(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:zC(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&VC(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function RC(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function zC(e){return Math.max(Math.ceil(e),0)}function BC(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?VC(e,{codeWidthChanged:!0,numberWidthChanged:!0}):HC(e))}function VC(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function HC(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 UC(e){e.codeElement.isConnected&&HC(e)}function WC(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`)}var GC=new Map,KC=new Map,qC=new Map,JC=new Set;function YC(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!JC.has(t))return!1;return!0}function XC(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(JC.has(n.name))continue;let e=GC.get(n.name);e??(e=n,GC.set(n.name,e)),JC.add(e.name),t.loadLanguageSync(e.data)}}function ZC(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var QC=Object.defineProperty,$C=Object.getOwnPropertyDescriptor,ew=Object.getOwnPropertyNames,tw=Object.prototype.hasOwnProperty,nw=(e,t)=>{let n={};for(var r in e)QC(n,r,{get:e[r],enumerable:!0});return t||QC(n,Symbol.toStringTag,{value:`Module`}),n},rw=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=ew(t),a=0,o=i.length,s;a<o;a++)s=i[a],!tw.call(e,s)&&s!==n&&QC(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=$C(t,s))||r.enumerable});return e},iw=(e,t,n)=>(rw(e,t,`default`),n&&rw(n,t,`default`)),aw=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),ow=function(e){return`/`+e},sw={},K=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=ow(t,n),t=s(t),t in sw)return;sw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:aw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},cw=[{id:`abap`,name:`ABAP`,import:(()=>K(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>K(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>K(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>K(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>K(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>K(()=>import(`./_CtMaZFiS.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>K(()=>import(`./_GnVvdLnS.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>K(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>K(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>K(()=>import(`./_DPQpBMwo.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>K(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>K(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>K(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>K(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>K(()=>import(`./_CcQeIXwg.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>K(()=>import(`./_BWXHIvNe2.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>K(()=>import(`./_B7ZEbQpA2.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>K(()=>import(`./_qdxAdBWQ2.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>K(()=>import(`./_D-usSTwE2.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>K(()=>import(`./_DKpUyyne2.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>K(()=>import(`./_Ci_nEsc72.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>K(()=>import(`./_CUHmPFLl2.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>K(()=>import(`./_CYIUgYqB2.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>K(()=>import(`./_Dia6fhph2.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>K(()=>import(`./_CpYNKFv52.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>K(()=>import(`./_D5E_RD5H2.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>K(()=>import(`./_D0apG41V2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>K(()=>import(`./_CQ2zXKGN2.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>K(()=>import(`./_kIpfj7zU2.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>K(()=>import(`./_CzS0SrVK2.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>K(()=>import(`./_CtfBBspg2.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>K(()=>import(`./_DqKBuwfJ2.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>K(()=>import(`./_Bj61d0ZC2.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>K(()=>import(`./_DQm9_WBm2.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>K(()=>import(`./_C8r90Shi2.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>K(()=>import(`./_oeQT6MSM2.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>K(()=>import(`./_8HSgn8Ae2.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>K(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>K(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>K(()=>import(`./_Bg0vcVNm.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>K(()=>import(`./_DDQcSiNZ.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>K(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>K(()=>import(`./_BpQoL5sK.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>K(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>K(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>K(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>K(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>K(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>K(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>K(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>K(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>K(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>K(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>K(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>K(()=>import(`./_CONbe6YE.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>K(()=>import(`./_9e0FE9jl.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>K(()=>import(`./_D6GBnH1C.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>K(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>K(()=>import(`./_cy1N2YQO.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>K(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>K(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>K(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>K(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>K(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>K(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>K(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>K(()=>import(`./_CY8IvGdO2.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>K(()=>import(`./_DYvRD3hg2.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>K(()=>import(`./_CBce3t8t2.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>K(()=>import(`./_CV2tkWYe2.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>K(()=>import(`./_DExj1W_82.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>K(()=>import(`./_Dl-2e7rI2.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>K(()=>import(`./_ephmTnv12.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>K(()=>import(`./_CSRkHgEL2.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>K(()=>import(`./_CTmSJ3aE2.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>K(()=>import(`./_C_N5lXIT2.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>K(()=>import(`./_D1QJFY1d.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>K(()=>import(`./_ilITqXS62.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>K(()=>import(`./_7GGW24-e2.js`),[]))},{id:`go`,name:`Go`,import:(()=>K(()=>import(`./_rLFTqkRN2.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>K(()=>import(`./_C96rg9Cn.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>K(()=>import(`./_CacY0gHj2.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>K(()=>import(`./_C9vwBOMi2.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>K(()=>import(`./_DyzfV4EQ.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>K(()=>import(`./_BoyRXB0-2.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>K(()=>import(`./_D8IpX4py2.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>K(()=>import(`./_C8oCnwJJ2.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>K(()=>import(`./_Dh228itO2.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>K(()=>import(`./_CxZEssPk2.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>K(()=>import(`./_Cvrh5tZx2.js`),[]))},{id:`html`,name:`HTML`,import:(()=>K(()=>import(`./_Dge-k2OK.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>K(()=>import(`./_D4YgBy102.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>K(()=>import(`./_CvQo4_H-2.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>K(()=>import(`./_D6mf7azh2.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>K(()=>import(`./_DLbMbJfH2.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>K(()=>import(`./_CZbG8q4J2.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>K(()=>import(`./_DsUTQ-LC2.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>K(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>K(()=>import(`./_sq9fDeBh.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>K(()=>import(`./_g8IPJgde.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>K(()=>import(`./_BrtaMKSf.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>K(()=>import(`./_DHU3s4L8.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>K(()=>import(`./_BMXWQXeX.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>K(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>K(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>K(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>K(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>K(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>K(()=>import(`./_Dh0ojLY7.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>K(()=>import(`./_CwXWcR4L.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>K(()=>import(`./_1vY8pby1.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>K(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>K(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>K(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>K(()=>import(`./_U_zJ788O.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>K(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>K(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>K(()=>import(`./_n3dr6s1l.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>K(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>K(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>K(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>K(()=>import(`./_T_Eme7qq.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>K(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>K(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>K(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>K(()=>import(`./_BiAQN2ar.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>K(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>K(()=>import(`./_CexcTijs.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>K(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>K(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>K(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>K(()=>import(`./_CFuIV2fl.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>K(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>K(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>K(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>K(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>K(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>K(()=>import(`./_DRazGDj4.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>K(()=>import(`./_aiX4inqS2.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>K(()=>import(`./_IvuFDN5E2.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>K(()=>import(`./_CjNLYCLg2.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>K(()=>import(`./_DHYfO66s2.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>K(()=>import(`./_D1A_Heim2.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>K(()=>import(`./_BsSzOQcm2.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>K(()=>import(`./_O90oeIOV2.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>K(()=>import(`./_B1RWQWA52.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>K(()=>import(`./_BUDT5pXO2.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>K(()=>import(`./_wSQWJJZf2.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>K(()=>import(`./_4ZHwLPI52.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>K(()=>import(`./_CY51jVa3.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>K(()=>import(`./_BTrOYuEk2.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>K(()=>import(`./_ot-7Btpt2.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>K(()=>import(`./_DGHpHOYJ2.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>K(()=>import(`./_BiJDBrnU2.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>K(()=>import(`./_C7UOKdEL2.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>K(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>K(()=>import(`./_DNMTfnFr2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>K(()=>import(`./_CCSX75yM2.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>K(()=>import(`./_DMgNhnYS2.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>K(()=>import(`./_iXnhIJG72.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>K(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>K(()=>import(`./_CSdPg73e.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>K(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>K(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>K(()=>import(`./_gzcpVVnB2.js`),[]))},{id:`qml`,name:`QML`,import:(()=>K(()=>import(`./_Bc6gDxIN.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>K(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>K(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>K(()=>import(`./_DUKDYAof.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>K(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>K(()=>import(`./_B3gFvitq2.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>K(()=>import(`./_c4JkcQT9.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>K(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>K(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>K(()=>import(`./_WdzvtYc4.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>K(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>K(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>K(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>K(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>K(()=>import(`./_BZzhWd3g.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>K(()=>import(`./_C6_Bkr9e.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>K(()=>import(`./_Cfkwpbl82.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>K(()=>import(`./_Dgh3CpAc.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>K(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>K(()=>import(`./_BiFt_7mu2.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>K(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>K(()=>import(`./_BC-q6DS6.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>K(()=>import(`./_bTVj8UrX2.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>K(()=>import(`./_BM315xPC.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>K(()=>import(`./_C0Aq200h.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>K(()=>import(`./_CBgFzcoa.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>K(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>K(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>K(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>K(()=>import(`./_VrKcP-IA.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>K(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>K(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>K(()=>import(`./_BdrBTnQV2.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>K(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>K(()=>import(`./_BhcFcxh_.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>K(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>K(()=>import(`./_CSCYugS_.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>K(()=>import(`./_CWiaS9tN.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>K(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>K(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>K(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>K(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>K(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>K(()=>import(`./_CZd0xW_V2.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>K(()=>import(`./_DGb5RYdw2.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>K(()=>import(`./_DswuEJGm2.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>K(()=>import(`./_hecKvkGK.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>K(()=>import(`./_CcmNWLt02.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>K(()=>import(`./_Cqdz3hZN2.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>K(()=>import(`./_sltzmVWM2.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>K(()=>import(`./_Bexv6Y9B.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>K(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>K(()=>import(`./_CekmLjtJ2.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>K(()=>import(`./_CsU7IfeP.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>K(()=>import(`./_BRdr0IET2.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>K(()=>import(`./_DI99ib-x2.js`),[]))},{id:`v`,name:`V`,import:(()=>K(()=>import(`./_DBj4K9d_2.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>K(()=>import(`./_zf12oZj62.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>K(()=>import(`./_DOwzaHZ02.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>K(()=>import(`./_B2gwz-sJ2.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>K(()=>import(`./_BroJfC0k2.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>K(()=>import(`./_DvXPmvsu2.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>K(()=>import(`./_BTQOUkJH2.js`),__vite__mapDeps([112,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>K(()=>import(`./_DxQA8DF72.js`),__vite__mapDeps([113,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>K(()=>import(`./_Dc3dYVuw2.js`),__vite__mapDeps([114,2,3,5,12,70,115])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>K(()=>import(`./_CgoNMtux2.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>K(()=>import(`./_ByWQv1Qj2.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>K(()=>import(`./_C8pVoKbM2.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>K(()=>import(`./_BsKzXJz42.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>K(()=>import(`./_ClFFjSW22.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>K(()=>import(`./_DdvCle-K2.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>K(()=>import(`./_DLL8P-h_2.js`),[]))},{id:`xml`,name:`XML`,import:(()=>K(()=>import(`./_DNygB11b.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>K(()=>import(`./_B-3tfKTw2.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>K(()=>import(`./_CVYrmNa5.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>K(()=>import(`./_BnlCZFoB2.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>K(()=>import(`./_CMLA9XwU2.js`),[]))}],lw=Object.fromEntries(cw.map(e=>[e.id,e.import])),uw=Object.fromEntries(cw.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),dw={...lw,...uw},fw=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>K(()=>import(`./_vGVdxbeo2.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>K(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>K(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>K(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>K(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>K(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>K(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>K(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>K(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>K(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>K(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>K(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>K(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>K(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>K(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>K(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>K(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>K(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>K(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>K(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>K(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>K(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>K(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>K(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>K(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>K(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>K(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>K(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>K(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>K(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>K(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>K(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>K(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>K(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>K(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>K(()=>import(`./_Bm3Qr25_2.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>K(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>K(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>K(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>K(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>K(()=>import(`./_BSWPekZh2.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>K(()=>import(`./_DDpmG2fV2.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>K(()=>import(`./_B_bV9PQ92.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>K(()=>import(`./_DhmEMT882.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>K(()=>import(`./_eJ-hLW7d2.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>K(()=>import(`./_Cb4Vim4T2.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>K(()=>import(`./_CLwyXe_n2.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>K(()=>import(`./_D7Lr4KcI2.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>K(()=>import(`./_DQwYfKfQ2.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>K(()=>import(`./_DRFjx7u42.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>K(()=>import(`./_DX1BQOs82.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>K(()=>import(`./_aMsaMD1D2.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>K(()=>import(`./_8PwUyIlP2.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>K(()=>import(`./_DO-qXg-I2.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>K(()=>import(`./_DnToyrRv2.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>K(()=>import(`./_B2OO5cIa2.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>K(()=>import(`./_4G7pJPwS2.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>K(()=>import(`./_UdsmMDCL2.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>K(()=>import(`./_C1IUL_tW2.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>K(()=>import(`./_nFMaYfgc2.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>K(()=>import(`./_oM2G3aXe2.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>K(()=>import(`./_DdrHHSXu2.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>K(()=>import(`./_fwtXNY1n2.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>K(()=>import(`./_BZCL-v6S2.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>K(()=>import(`./_VbXTXTou2.js`),[]))}].map(e=>[e.id,e.import])),pw=t({createOnigurumaEngine:()=>Vw,getDefaultWasmLoader:()=>Bw,loadWasm:()=>Pw,setDefaultWasmLoader:()=>zw}),mw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function hw(){return 2147483648}function gw(){return typeof performance<`u`?performance.now():Date.now()}var _w=(e,t)=>e+(t-e%t)%t;async function vw(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=hw();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,_w(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:gw,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var yw=Object.defineProperty,bw=(e,t,n)=>t in e?yw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,xw=(e,t,n)=>bw(e,typeof t==`symbol`?t:t+``,n),Sw=null;function Cw(e){throw new mw(e.UTF8ToString(e.getLastOnigError()))}var ww=class e{constructor(t){xw(this,`utf16Length`),xw(this,`utf8Length`),xw(this,`utf16Value`),xw(this,`utf8Value`),xw(this,`utf16OffsetToUtf8`),xw(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Tw=class e{constructor(t){if(xw(this,`id`,++e.LAST_ID),xw(this,`_onigBinding`),xw(this,`content`),xw(this,`utf16Length`),xw(this,`utf8Length`),xw(this,`utf16OffsetToUtf8`),xw(this,`utf8OffsetToUtf16`),xw(this,`ptr`),!Sw)throw new mw(`Must invoke loadWasm first.`);this._onigBinding=Sw,this.content=t;let n=new ww(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=Sw.omalloc(1e4),e._sharedPtrInUse=!0,Sw.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(Sw)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};xw(Tw,`LAST_ID`,0),xw(Tw,`_sharedPtr`,0),xw(Tw,`_sharedPtrInUse`,!1);var Ew=Tw,Dw=class{constructor(e){if(xw(this,`_onigBinding`),xw(this,`_ptr`),!Sw)throw new mw(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new ww(e[r]);t[r]=i.createString(Sw),n[r]=i.utf8Length}let r=Sw.omalloc(4*e.length);Sw.HEAPU32.set(t,r/4);let i=Sw.omalloc(4*e.length);Sw.HEAPU32.set(n,i/4);let a=Sw.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)Sw.ofree(t[n]);Sw.ofree(i),Sw.ofree(r),a===0&&Cw(Sw),this._onigBinding=Sw,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Ew(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Ow(e){return typeof e.instantiator==`function`}function kw(e){return typeof e.default==`function`}function Aw(e){return e.data!==void 0}function jw(e){return typeof Response<`u`&&e instanceof Response}function Mw(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Nw;function Pw(e){if(Nw)return Nw;async function t(){Sw=await vw(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Ow(n)?n=await n.instantiator(t):kw(n)?n=await n.default(t):(Aw(n)&&(n=n.data),jw(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Iw(n)(t):await Lw(n)(t):Mw(n)||n instanceof WebAssembly.Module?n=await Fw(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Fw(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Nw=t(),Nw}function Fw(e){return t=>WebAssembly.instantiate(e,t)}function Iw(e){return t=>WebAssembly.instantiateStreaming(e,t)}function Lw(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Rw;function zw(e){Rw=e}function Bw(){return Rw}async function Vw(e){return e&&await Pw(e),{createScanner(e){return new Dw(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Ew(e)}}}var Hw=nw({});iw(Hw,pw);var Uw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Ww(e){return Gw(e)}function Gw(e){return Array.isArray(e)?Kw(e):e instanceof RegExp?e:typeof e==`object`?qw(e):e}function Kw(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=Gw(e[n]);return t}function qw(e){let t={};for(let n in e)t[n]=Gw(e[n]);return t}function Jw(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Yw(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Yw(e.substring(0,e.length-1)):e.substr(~t+1)}var Xw=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,Zw=class{static hasCaptures(e){return e!==null&&(Xw.lastIndex=0,Xw.test(e))}static replaceCaptures(e,t,n){return e.replace(Xw,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function Qw(e,t){return e<t?-1:+(e>t)}function $w(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=Qw(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function eT(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function tT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var nT=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},rT=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(cT(e),t)}static createFromParsedTheme(e,t){return dT(e,t)}_cachedMatchRoot=new nT(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>aT(e.parent,t.parentScopes));return n?new sT(n.fontStyle,n.foreground,n.background):null}},iT=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function aT(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!oT(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function oT(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var sT=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function cT(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&eT(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&eT(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new lT(l,u,e,o,s,c)}}return n}var lT=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},uT=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(uT||{});function dT(e,t){e.sort((e,t)=>{let n=Qw(e.scope,t.scope);return n!==0||(n=$w(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new fT(t),o=new sT(n,a.getId(r),a.getId(i)),s=new hT(new mT(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new rT(a,o,s)}var fT=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},pT=Object.freeze([]),mT=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||pT,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},hT=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),mT.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if($w(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new mT(e,t,n,r,i))}},gT=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=vT(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function _T(e){return e}function vT(e){return e}function yT(e,t){let n=[],r=xT(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(bT(i)){let e=[];do e.push(i),i=r.next();while(bT(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function bT(e){return!!e&&!!e.match(/[\w\.:]+/)}function xT(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function ST(e){typeof e.dispose==`function`&&e.dispose()}var CT=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},wT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},TT=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},ET=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new CT(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new TT;for(let n of e)DT(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof CT){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function DT(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof CT?kT({baseGrammar:a,selfGrammar:i},r):OT(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new CT(e))}function OT(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];AT([r],t,n)}}function kT(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&AT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&AT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function AT(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Jw({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&AT(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=IT(i);switch(a.kind){case 0:kT({...t,selfGrammar:t.baseGrammar},n);break;case 1:kT(t,n);break;case 2:OT(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?OT(a.ruleName,i,n):kT(i,n)}else a.kind===4?n.add(new wT(a.scopeName,a.ruleName)):n.add(new CT(a.scopeName))}}}var jT=class{kind=0},MT=class{kind=1},NT=class{constructor(e){this.ruleName=e}kind=2},PT=class{constructor(e){this.scopeName=e}kind=3},FT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function IT(e){if(e===`$base`)return new jT;if(e===`$self`)return new MT;let t=e.indexOf(`#`);return t===-1?new PT(e):t===0?new NT(e.substring(1)):new FT(e.substring(0,t),e.substring(t+1))}var LT=/\\(\d+)/,RT=/\\(\d+)/g,zT=-1,BT=-2;function VT(e){return e}function HT(e){return e}var UT=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=Zw.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=Zw.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Yw(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:Zw.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:Zw.replaceCaptures(this._contentName,e,t)}},WT=class extends UT{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},GT=class extends UT{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new XT(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ZT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},KT=class extends UT{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new ZT,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},qT=class extends UT{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new XT(i,this.id),this.beginCaptures=a,this._end=new XT(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ZT;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},JT=class extends UT{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new XT(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new XT(o,BT),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new ZT;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new ZT,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},YT=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new WT(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new GT(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Jw({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new KT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new JT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new qT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=IT(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof KT||e instanceof qT||e instanceof JT)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},XT=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&<.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return RT.lastIndex=0,this.source.replace(RT,(e,t)=>tT(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},ZT=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new QT(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new QT(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},QT=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
37
|
-
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}}
|
|
38
|
-
`;let a=this.createOnigString(e),o=a.content.length,s=new xE(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=rE(this,a,i,0,t,s,!0,r);return ST(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function _E(e,t){return e=Ww(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var vE=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=iT.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new iT(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new iT(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),gT.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},yE=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?vE.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:HT(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=vE.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,VT(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,vE.fromExtension(r,n.contentNameScopesList))}},bE=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):yT(e,mE).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>yT(e,mE).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},xE=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=gT.set(n,0,_T(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=gT.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},SE=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,fE(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},CE=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new SE(rT.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(rT.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new bE(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new ET(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},wE=yE.NULL;function TE(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function EE(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function DE(e){return Array.isArray(e)?e:[e]}async function OE(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function kE(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function AE(e){return e===`ansi`||kE(e)}function jE(e){return e===`none`}function ME(e){return jE(e)}var NE=/(\r?\n)/g;function PE(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(NE),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var FE={light:`#333333`,dark:`#bbbbbb`},IE={light:`#fffffe`,dark:`#1e1e1e`},LE=`__shiki_resolved`;function RE(e){if(e?.[LE])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?FE.light:FE.dark,n||=t.type===`light`?IE.light:IE.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,LE,{enumerable:!1,writable:!1,value:!0}),t}async function zE(e){return[...new Set((await Promise.all(e.filter(e=>!AE(e)).map(async e=>await OE(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function BE(e){return(await Promise.all(e.map(async e=>ME(e)?null:RE(await OE(e))))).filter(e=>!!e)}function VE(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Uw(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var HE=class extends CE{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=RE(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=rT.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=VE(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new Uw(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},UE=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},WE=0;function GE(e){WE+=1,e.warnings!==!1&&WE>=10&&WE%10==0&&console.warn(`[Shiki] ${WE} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Uw("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(RE),i=new HE(new UE(e.engine,n),r,n,e.langAlias),a;function o(t){return VE(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Uw(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new Uw(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await zE(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await BE(e))}function g(){if(t)throw new Uw(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--WE)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function KE(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([BE(e.themes||[]),zE(e.langs||[]),e.engine]);return GE({...e,themes:t,langs:n,engine:r})}var qE=new WeakMap;function JE(e,t){qE.set(e,t)}function YE(e){return qE.get(e)}var XE=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(DE(n).map(e=>[e,wE])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return ZE(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function ZE(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function QE(e,t){if(!(e instanceof XE))throw new Uw(`Invalid grammar state`);return e.getInternalStack(t)}var $E=/,/,eD=/ /;function tD(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(kE(e.resolveLangAlias(n.lang||`text`))||jE(r))return PE(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Uw(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Uw(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return rD(t,o,i,a,n)}function nD(...e){if(e.length===2)return YE(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(kE(i)||jE(a))throw new Uw(`Plain language does not have grammar state`);if(i===`ansi`)throw new Uw(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new XE(iD(n,c,o,s,r).stateStack,c.name,o.name)}function rD(e,t,n,r,i){let a=iD(e,t,n,r,i),o=new XE(a.stateStack,t.name,n.name);return JE(a.tokens,o),a.tokens}function iD(e,t,n,r,i){let a=TE(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=PE(e),u=i.grammarState?QE(i.grammarState,n.name)??wE:i.grammarContextCode==null?wE:iD(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=EE(r[gT.getForeground(s)],a),u=gT.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=gT.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split($E).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(eD))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?aD(t.scopes):oD(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function aD(e){return e.map(e=>({scopeName:e}))}function oD(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:lD(e,i,t.slice(0,r))}}return n}function sD(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function cD(e,t,n){if(!sD(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)sD(e[r],n[i])&&--r,--i;return r===-1}function lD(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(cD(e,t,n)){r.push(a);break}return r}function uD(e,t,n,r=tD){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:YE(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=dD(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new XE(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&JE(s,c),s}function dD(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var fD=/\s+/g;function pD(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(fD)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(fD);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var mD=/:?lang=["']([^"']+)["']/g,hD=/(?:```|~~~)([\w-]+)/g,gD=/\\begin\{([\w-]+)\}/g,_D=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,vD=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function yD(e){let t=PE(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function bD(e,t,n){let r=new Set;for(let t of e.matchAll(mD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(hD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(gD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(_D)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(vD.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var xD=[`color`,`background-color`];function SD(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function CD(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function wD(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=CD(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return SD(e,a)})):e}function TD(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>ED(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&xD.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Uw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function ED(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&uT.Italic&&(t[`font-style`]=`italic`),e.fontStyle&uT.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&uT.Underline&&n.push(`underline`),e.fontStyle&uT.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function DD(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function OD(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=yD(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Uw(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new Uw(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new Uw(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));kD(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return wD(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Uw(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=AD(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Uw(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Uw(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&pD(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function kD(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Uw(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Uw(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function AD(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(AD).join(``):``}var jD=[OD()];function MD(e){let t=ND(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...jD]}function ND(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var PD=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],FD={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function ID(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function LD(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function RD(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)FD[r]&&t.push({type:`setDecoration`,value:FD[r]});else if(r<=29){let e=FD[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:PD[r-30]}});else if(r===38){let n=LD(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:PD[r-40]}});else if(r===48){let n=LD(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:PD[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:PD[r-100+8]}})}}return t}function zD(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=ID(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=RD(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var BD={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function VD(e=BD){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<PD.length;e++)r.push(t(PD[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var HD=/#([0-9a-f]{3,8})/i,UD=/var\((--[\w-]+-ansi-[\w-]+)\)/,WD={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function GD(e,t,n){let r=TE(e,n),i=PE(t),a=VD(Object.fromEntries(PD.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||WD[t]]}))),o=zD();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=EE(i,r),o=EE(o,r),n.decorations.has(`dim`)&&(i=KD(i));let s=uT.None;return n.decorations.has(`bold`)&&(s|=uT.Bold),n.decorations.has(`italic`)&&(s|=uT.Italic),n.decorations.has(`underline`)&&(s|=uT.Underline),n.decorations.has(`strikethrough`)&&(s|=uT.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function KD(e){let t=e.match(HD);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(UD);return n?`var(${n[1]}-dim)`:e}function qD(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!kE(r)&&!jE(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return GD(r,t,n)}return tD(e,t,n)}function JD(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new Uw("`themes` option must not be empty");let p=uD(e,t,n,qD);if(c=YE(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new Uw(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>TD(e,h,u,l,d))),c&&JE(a,c);let g=f.map(e=>TE(e.theme,n));i=YD(f,m,g,u,l,`fg`,d),r=YD(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=TE(n.theme,n);a=qD(e,t,n);let l=e.getTheme(n.theme);r=EE(l.bg,s),i=EE(l.fg,s),o=l.name,c=YE(a)}else throw new Uw("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function YD(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=EE(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Uw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${EE(t[r][a],n[r])||`inherit`}, ${EE(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var XD=/^\s+$/,ZD=/^(\s*)(.*?)(\s*)$/;function QD(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>QD(e,t,n),codeToTokens:(t,n)=>JD(e,t,n)}){let i=t;for(let e of MD(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=JD(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=eO(a):d===`never`&&(a=tO(a)),f&&(a=nO(a));let p={...r,get source(){return i}};for(let e of MD(n))a=e.tokens?.call(p,a)||a;return $D(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function $D(e,t,n,r=YE(e)){let i=MD(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:pD,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
39
|
-
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=
|
|
36
|
+
\f\r "&'<=>\``.split(``)]],single:[[`&'`.split(``),`"&'\``.split(``)],[`\0&'`.split(``),`\0"&'\``.split(``)]],double:[[`"&`.split(``),`"&'\``.split(``)],[`\0"&`.split(``),`\0"&'\``.split(``)]]};function rC(e,t,n,r){let i=r.schema,a=i.space!==`svg`&&r.settings.omitOptionalTags,o=i.space===`svg`?r.settings.closeEmptyElements:r.settings.voids.includes(e.tagName.toLowerCase()),s=[],c;i.space===`html`&&e.tagName===`svg`&&(r.schema=Kx);let l=iC(r,e.properties),u=r.all(i.space===`html`&&e.tagName===`template`?e.content:e);return r.schema=i,u&&(o=!1),(l||!a||!XS(e,t,n))&&(s.push(`<`,e.tagName,l?` `+l:``),o&&(i.space===`svg`||r.settings.closeSelfClosing)&&(c=l.charAt(l.length-1),(!r.settings.tightSelfClosing||c===`/`||c&&c!==`"`&&c!==`'`)&&s.push(` `),s.push(`/`)),s.push(`>`)),s.push(u),!o&&(!a||!PS(e,t,n))&&s.push(`</`+e.tagName+`>`),s.join(``)}function iC(e,t){let n=[],r=-1,i;if(t){for(i in t)if(t[i]!==null&&t[i]!==void 0){let r=aC(e,i,t[i]);r&&n.push(r)}}for(;++r<n.length;){let t=e.settings.tightAttributes?n[r].charAt(n[r].length-1):void 0;r!==n.length-1&&t!==`"`&&t!==`'`&&(n[r]+=` `)}return n.join(``)}function aC(e,t,n){let r=Hx(e.schema,t),i=e.settings.allowParseErrors&&e.schema.space===`html`?0:1,a=+!e.settings.allowDangerousCharacters,o=e.quote,s;if(r.overloadedBoolean&&(n===r.attribute||n===``)?n=!0:(r.boolean||r.overloadedBoolean)&&(typeof n!=`string`||n===r.attribute||n===``)&&(n=!!n),n==null||n===!1||typeof n==`number`&&Number.isNaN(n))return``;let c=gS(r.attribute,Object.assign({},e.settings.characterReferences,{subset:nC.name[i][a]}));return n===!0||(n=Array.isArray(n)?(r.commaSeparated?CS:wS)(n,{padLeft:!e.settings.tightCommaSeparatedLists}):String(n),e.settings.collapseEmptyAttributes&&!n)?c:(e.settings.preferUnquoted&&(s=gS(n,Object.assign({},e.settings.characterReferences,{attribute:!0,subset:nC.unquoted[i][a]}))),s!==n&&(e.settings.quoteSmart&&SS(n,o)>SS(n,e.alternative)&&(o=e.alternative),s=o+gS(n,Object.assign({},e.settings.characterReferences,{subset:(o===`'`?nC.single:nC.double)[i][a],attribute:!0}))+o),c+(s&&`=`+s))}var oC=[`<`,`&`];function sC(e,t,n,r){return n&&n.type===`element`&&(n.tagName===`script`||n.tagName===`style`)?e.value:gS(e.value,Object.assign({},r.settings.characterReferences,{subset:oC}))}function cC(e,t,n,r){return r.settings.allowDangerousHtml?e.value:sC(e,t,n,r)}function lC(e,t,n,r){return r.all(e)}var uC=Jx(`type`,{invalid:dC,unknown:fC,handlers:{comment:bS,doctype:xS,element:rC,raw:cC,root:lC,text:sC}});function dC(e){throw Error("Expected node, not `"+e+"`")}function fC(e){throw Error("Cannot compile unknown node `"+e.type+"`")}var pC={},mC={},hC=[];function gC(e,t){let n=t||pC,r=n.quote||`"`,i=r===`"`?`'`:`"`;if(r!==`"`&&r!==`'`)throw Error("Invalid quote `"+r+"`, expected `'` or `\"`");return{one:_C,all:vC,settings:{omitOptionalTags:n.omitOptionalTags||!1,allowParseErrors:n.allowParseErrors||!1,allowDangerousCharacters:n.allowDangerousCharacters||!1,quoteSmart:n.quoteSmart||!1,preferUnquoted:n.preferUnquoted||!1,tightAttributes:n.tightAttributes||!1,upperDoctype:n.upperDoctype||!1,tightDoctype:n.tightDoctype||!1,bogusComments:n.bogusComments||!1,tightCommaSeparatedLists:n.tightCommaSeparatedLists||!1,tightSelfClosing:n.tightSelfClosing||!1,collapseEmptyAttributes:n.collapseEmptyAttributes||!1,allowDangerousHtml:n.allowDangerousHtml||!1,voids:n.voids||mx,characterReferences:n.characterReferences||mC,closeSelfClosing:n.closeSelfClosing||!1,closeEmptyElements:n.closeEmptyElements||!1},schema:n.space===`svg`?Kx:Gx,quote:r,alternative:i}.one(Array.isArray(e)?{type:`root`,children:e}:e,void 0,void 0)}function _C(e,t,n){return uC(e,t,n,this)}function vC(e){let t=[],n=e&&e.children||hC,r=-1;for(;++r<n.length;)t[r]=this.one(n[r],r,e);return t.join(``)}var yC=class{mode;options;hoveredLine;hoveredToken;pre;gutterUtilityLine;gutterUtilityContainer;gutterUtilityButton;gutterUtilitySlot;interactiveLinesAttr=!1;interactiveLineNumbersAttr=!1;hasPointerListeners=!1;hasDocumentPointerListeners=!1;selectedRange=null;selectedRangeHighlightSide;selectedRangeLineNumberOnly=!1;editorActiveLine=null;editorActiveLineSide;editorLineNumberOnly=!1;proposedSelectedRange;renderedSelectedLinesState;renderedEditorActiveLineState;selectionAnchor;pointerSession={mode:`idle`};constructor(e,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(),Hy(this.renderSelection),this.interactiveLinesAttr=!1,this.interactiveLineNumbersAttr=!1,this.hasPointerListeners=!1,this.setSelectionDirty()}setup(e){this.setSelectionDirty();let{usesCustomGutterUtility:t=!1,enableGutterUtility:n=!1}=this.options;this.pre!==e&&(this.cleanUp(),this.pre=e),n?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){let n=!(e===this.selectedRange||Gy(e??void 0,this.selectedRange??void 0)),r=t?.lineNumberOnly??!1,i=t?.activeLineSide!==this.selectedRangeHighlightSide||r!==this.selectedRangeLineNumberOnly;!this.isSelectionDirty()&&!n&&!i||(this.proposedSelectedRange=void 0,this.selectedRange=e,this.selectedRangeHighlightSide=t?.activeLineSide,this.selectedRangeLineNumberOnly=r,this.renderSelection(),this.placeUtility(),n&&t?.notify!==!1&&this.notifySelectionCommitted(e))}setEditorActiveLine(e,{lineNumberOnly:t=!1,side:n}={}){let r=e!==this.editorActiveLine,i=n!==this.editorActiveLineSide||t!==this.editorLineNumberOnly;!this.isSelectionDirty()&&!r&&!i||(this.editorActiveLine=e,this.editorActiveLineSide=n,this.editorLineNumberOnly=t,this.renderSelection())}getSelection(){return this.selectedRange}getHoveredLine=()=>{let 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}}};handlePointerClick=e=>{let{onHunkExpand:t,onLineClick:n,onLineNumberClick:r,onTokenClick:i,onMergeConflictActionClick:a}=this.options;(t!=null||n!=null||r!=null||a!=null||i!=null)&&(this.options.onGutterUtilityClick!=null&&px(e.composedPath())||(RC(this.options.__debugPointerEvents,`click`,`FileDiff.DEBUG.handlePointerClick:`,e),this.handlePointerEvent({eventType:`click`,event:e})))};handlePointerMove=e=>{if(e.pointerType!==`mouse`)return;let{lineHoverHighlight:t=`disabled`,onLineEnter:n,onLineLeave:r,onTokenEnter:i,onTokenLeave:a,enableGutterUtility:o=!1}=this.options;t===`disabled`&&!o&&n==null&&r==null&&i==null&&a==null||(RC(this.options.__debugPointerEvents,`move`,`FileDiff.DEBUG.handlePointerMove:`,e),this.handlePointerEvent({eventType:`move`,event:e}))};handlePointerLeave=e=>{let{__debugPointerEvents:t}=this.options;if(RC(t,`move`,`FileDiff.DEBUG.handlePointerLeave: no event`),this.hoveredLine==null&&this.hoveredToken==null){RC(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()};handlePointerEvent({eventType:e,event:t}){let{__debugPointerEvents:n}=this.options,r=t.composedPath();RC(n,e,`FileDiff.DEBUG.handlePointerEvent:`,{eventType:e,composedPath:r});let i=this.resolvePointerTarget(r);RC(n,e,`FileDiff.DEBUG.handlePointerEvent: resolvePointerTarget result:`,i);let{onLineClick:a,onLineNumberClick:o,onLineEnter:s,onLineLeave:c,onTokenClick:l,onTokenEnter:u,onTokenLeave:d,onHunkExpand:f,onMergeConflictActionClick:p}=this.options;switch(e){case`move`:{let e=wC(i)&&this.hoveredLine?.lineElement===i.lineElement;CC(i)&&this.hoveredToken?.tokenElement===i.tokenElement||(this.hoveredToken!=null&&(d?.(this.hoveredToken,t),this.clearHoveredToken()),CC(i)&&(this.setHoveredToken(this.toTokenEventBaseProps(i)),u?.(this.hoveredToken,t))),e||(this.hoveredLine!=null&&(c?.({...this.hoveredLine,event:t}),this.clearHoveredLine()),wC(i)?(this.setHoveredLine(this.toEventBaseProps(i)),this.placeUtility(),s?.({...this.hoveredLine,event:t})):this.placeUtility());break}case`click`:{if(i==null)break;if(EC(i)&&p!=null){p(i);break}if(TC(i)&&f!=null){f(i.hunkIndex,i.all||t.shiftKey?`both`:i.direction,i.all||t.shiftKey?1/0:void 0);break}if(!wC(i))break;CC(i)&&l!=null&&l(this.toTokenEventBaseProps(i),t);let e=this.toEventBaseProps(i);o!=null&&i.numberColumn?o({...e,event:t}):a?.({...e,event:t});break}}}syncPointerListeners(e){let{__debugPointerEvents:t,lineHoverHighlight:n=`disabled`,onLineClick:r,onLineNumberClick:i,onLineEnter:a,onLineLeave:o,onTokenClick:s,onTokenEnter:c,onTokenLeave:l,onHunkExpand:u,onMergeConflictActionClick:d,enableGutterUtility:f=!1,enableLineSelection:p=!1,onGutterUtilityClick:m}=this.options,h=m!=null,g=n!==`disabled`||r!=null||i!=null||a!=null||o!=null||s!=null||c!=null||l!=null||u!=null||d!=null||f||p||h;g&&!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,RC(t,`click`,`FileDiff.DEBUG.attachEventListeners: Attaching click events for:`,(()=>{let e=[];return(t===`both`||t===`click`)&&(r!=null&&e.push(`onLineClick`),i!=null&&e.push(`onLineNumberClick`),u!=null&&e.push(`expandable hunk separators`),d!=null&&e.push(`merge conflict actions`)),e})()),RC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer move event`),RC(t,`move`,`FileDiff.DEBUG.attachEventListeners: Attaching pointer leave event`)):!g&&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);let _=this.pointerSession.mode===`selecting`||this.pointerSession.mode===`pendingSingleLineUnselect`,v=this.pointerSession.mode===`gutterSelecting`;(!p&&_||!h&&v)&&(this.clearPointerSession(),this.detachDocumentPointerListeners(),this.selectionAnchor=void 0,this.clearPendingSingleLineState())}updateInteractiveLineAttributes(){if(this.pre==null)return;let{onLineClick:e,onLineNumberClick:t,enableLineSelection:n=!1}=this.options,r=e!=null,i=t!=null||n;r&&!this.interactiveLinesAttr?(this.pre.setAttribute(`data-interactive-lines`,``),this.interactiveLinesAttr=!0):!r&&this.interactiveLinesAttr&&(this.pre.removeAttribute(`data-interactive-lines`),this.interactiveLinesAttr=!1),i&&!this.interactiveLineNumbersAttr?(this.pre.setAttribute(`data-interactive-line-numbers`,``),this.interactiveLineNumbersAttr=!0):!i&&this.interactiveLineNumbersAttr&&(this.pre.removeAttribute(`data-interactive-line-numbers`),this.interactiveLineNumbersAttr=!1)}handlePointerDown=e=>{if(e.pointerType===`mouse`&&e.button!==0||this.pre==null||this.pointerSession.mode!==`idle`)return;let t=e.composedPath();px(t)&&this.options.onGutterUtilityClick!=null?this.startGutterSelectionFromPointerDown(e):(e.pointerType!==`mouse`&&this.revealUtilityFromGutterPath(t),this.startLineSelectionFromPointerDown(e))};startLineSelectionFromPointerDown(e){let{enableLineSelection:t=!1}=this.options;if(!t)return;let n=this.resolveSelectionInfo(e,{source:`event-path`,requireNumberColumn:!0});if(n==null)return;let{pre:r}=this;if(r==null)return;let{lineNumber:i,eventSide:a,lineIndex:o}=n;if(e.shiftKey&&this.selectedRange!=null){let t=this.getIndexesFromSelection(this.selectedRange,r.getAttribute(`data-diff-type`)===`split`);if(t==null)return;let n=t.start<=t.end?o>=t.start:o<=t.end;this.selectionAnchor={lineNumber:n?this.selectedRange.start:this.selectedRange.end,side:n?this.selectedRange.side:this.selectedRange.endSide??this.selectedRange.side},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners();return}if(this.selectedRange?.start===i&&this.selectedRange?.end===i){let t={lineNumber:i,side:a};this.selectionAnchor=t,this.pointerSession={mode:`pendingSingleLineUnselect`,pointerId:e.pointerId,anchor:t,pending:t},this.attachDocumentPointerListeners();return}this.options.controlledSelection===!0?this.proposedSelectedRange=null:this.selectedRange=null,this.placeUtility(),this.selectionAnchor={lineNumber:i,side:a},this.updateSelection(i,a,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.pointerSession={mode:`selecting`,pointerId:e.pointerId},this.attachDocumentPointerListeners()}startGutterSelectionFromPointerDown(e){let{onGutterUtilityClick:t}=this.options;if(t==null)return;let n=this.currentSelectionEnds(),r=n?.bottom??this.resolveSelectionPoint(e,{source:`event-path`,excludeUtility:!1}),i=n?.top??r;r!=null&&i!=null&&(e.preventDefault(),e.stopPropagation(),this.pointerSession={mode:`gutterSelecting`,pointerId:e.pointerId,anchor:i,current:r},this.selectionAnchor={lineNumber:i.lineNumber,side:i.side},this.updateSelection(r.lineNumber,r.side,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.attachDocumentPointerListeners())}handleDocumentPointerMove=e=>{switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{if(e.pointerId!==this.pointerSession.pointerId)return;e.preventDefault();let 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();let 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();let t=this.resolveSelectionInfo(e,{source:`coordinates-first`,requireNumberColumn:!1});if(t==null||this.selectionAnchor==null)return;let n={lineNumber:t.lineNumber,side:t.eventSide};if(fx(this.pointerSession.pending,n))return;this.updateSelection(t.lineNumber,t.eventSide,!1),this.notifySelectionStart(this.getCurrentSelectionRange()),this.notifySelectionChangeDelta(),this.pointerSession={mode:`selecting`,pointerId:e.pointerId};return}}};handleDocumentPointerUp=e=>{let{onGutterUtilityClick:t}=this.options;switch(this.pointerSession.mode){case`idle`:return;case`gutterSelecting`:{let{pointerSession:n}=this;if(e.pointerId!==n.pointerId)return;e.preventDefault();let r=this.resolveSelectionPoint(e,{source:`coordinates-first`});r!=null&&(n.current=r,this.updateSelection(r.lineNumber,r.side));let i=this.buildSelectedLineRange(n.anchor,n.current);t?.({...i}),this.selectionAnchor=void 0,this.notifySelectionEnd(i),this.notifySelectionCommitted(i),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()}};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()}};clearHoveredLine(){this.hoveredLine!=null&&(this.hoveredLine.lineElement.removeAttribute(`data-hovered`),this.hoveredLine.numberElement.removeAttribute(`data-hovered`),this.hoveredLine=void 0)}setHoveredLine(e){let{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??(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??(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){let e=document.createElement(`div`);e.innerHTML=gC(dx());let t=e.firstElementChild;if(!(t instanceof HTMLButtonElement))throw Error(`InteractionManager.ensureGutterUtilityNode: Node element should be a button`);t.remove(),this.gutterUtilityButton=t}this.gutterUtilityButton.parentNode!==this.gutterUtilityContainer&&this.gutterUtilityContainer.replaceChildren(this.gutterUtilityButton)}}revealUtilityFromGutterPath(e){if(this.placeUtilityFromSelection())return;let t=this.resolvePointerTarget(e);SC(t)&&t.numberColumn&&this.showUtilityOnLine(this.toEventBaseProps(t))}placeUtility(){if(!this.placeUtilityFromSelection()){if(this.hoveredLine!=null){this.showUtilityOnLine(this.hoveredLine);return}this.hideUtility()}}placeUtilityFromSelection(){let e=this.currentSelectionEnds();if(e==null)return!1;let 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(){let e=this.getCurrentSelectionRange();return e==null?void 0:this.selectionEnds(e)}selectionEnds(e){let t={lineNumber:e.start,side:e.side},n={lineNumber:e.end,side:e.endSide??e.side},r=this.selectionPointRowIndex(t),i=this.selectionPointRowIndex(n);if(r!=null&&i!=null)return r>i?{top:n,bottom:t}:{top:t,bottom:n}}selectionPointRowIndex(e){let t=this.getLineIndex(e.lineNumber,e.side);if(t!=null)return this.isSplitDiff()?t[1]:t[0]}targetForSelectionPoint(e){if(this.pre==null)return;let t=this.getLineIndex(e.lineNumber,e.side);if(t==null)return;let n=this.mode===`diff`?`${t[0]},${t[1]}`:`${t[0]}`,r=this.pre.querySelectorAll(`[data-column-number="${e.lineNumber}"][data-line-index="${n}"]`);for(let t of r){if(!(t instanceof HTMLElement))continue;let n=this.resolvePointerTarget(kC(t));if(SC(n)&&(this.mode!==`diff`||e.side==null||n.side===e.side))return n}}attachDocumentPointerListeners(){this.hasDocumentPointerListeners||=(document.addEventListener(`pointermove`,this.handleDocumentPointerMove),document.addEventListener(`pointerup`,this.handleDocumentPointerUp),document.addEventListener(`pointercancel`,this.handleDocumentPointerCancel),!0)}detachDocumentPointerListeners(){this.hasDocumentPointerListeners&&=(document.removeEventListener(`pointermove`,this.handleDocumentPointerMove),document.removeEventListener(`pointerup`,this.handleDocumentPointerUp),document.removeEventListener(`pointercancel`,this.handleDocumentPointerCancel),!1)}clearPointerSession(){this.pointerSession={mode:`idle`}}clearPendingSingleLineState(){this.pointerSession.mode===`pendingSingleLineUnselect`&&(this.pointerSession={mode:`idle`})}selectionInfoFromPath(e,t){let n=this.resolvePointerTarget(e);if(SC(n)&&!(t&&!n.numberColumn)&&n.splitLineIndex!=null)return{lineIndex:n.splitLineIndex,lineNumber:n.lineNumber,eventSide:this.mode===`diff`?n.side:void 0}}resolveSelectionInfo(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionInfoFromPath(n,t.requireNumberColumn)}selectionPointFromPath(e){let t=this.resolvePointerTarget(e);if(SC(t))return{lineNumber:t.lineNumber,side:this.mode===`diff`?t.side:void 0}}resolveSelectionPoint(e,t){let n=this.resolveSelectionPath(e,t);return n==null?void 0:this.selectionPointFromPath(n)}resolveSelectionPath(e,t){let n=t.excludeUtility!==!1;switch(t.source){case`event-path`:return this.pathFromEventPath(e.composedPath(),n);case`coordinates-first`:{let t=this.pathFromCoordinates(e,n);return t===void 0?this.pathFromEventPath(e.composedPath(),n):t??void 0}}}pathFromCoordinates(e,t){let n=this.hitTest(e);if(n!==void 0)return n===null?null:this.pathFromElement(n,t)??null}pathFromEventPath(e,t){if(!(t&&px(e))){for(let n of e)if(n instanceof Element)return this.pathFromElement(n,t)}}pathFromElement(e,t){let n=kC(e);if(t&&px(n))return;let r=AC(e);return r==null?this.pathFromAnnotationSlot(e):kC(r)}pathFromAnnotationSlot(e){let t=MC(jC(e));if(t==null)return;let n=this.targetForSelectionPoint(t);return n==null?void 0:kC(n.lineElement)}hitTest(e){if(!Number.isFinite(e.clientX)||!Number.isFinite(e.clientY))return;let t=this.pre?.getRootNode(),n=NC(t)?t:NC(document)?document:void 0;if(n!=null)return n.elementFromPoint(e.clientX,e.clientY)}getLineIndex(e,t){let{getLineIndex:n}=this.options;return n==null?[e-1,e-1]:n(e,t)}getCurrentSelectionRange(){return this.proposedSelectedRange===void 0?this.selectedRange:this.proposedSelectedRange}clearProposedSelection(){this.proposedSelectedRange=void 0}updateSelection(e,t,n=!0){let r=this.getCurrentSelectionRange(),i;if(e==null)i=null;else{let n=this.selectionAnchor?.side??t,r=this.selectionAnchor?.lineNumber??e;i=this.buildSelectionRange(r,e,n,t)}Gy(r??void 0,i??void 0)||(this.selectedRangeHighlightSide=void 0,this.selectedRangeLineNumberOnly=!1,this.options.controlledSelection===!0?this.proposedSelectedRange=i:(this.selectedRange=i,Vy(this.renderSelection)),this.placeUtility(),n&&this.notifySelectionChangeDelta())}getIndexesFromSelection(e,t){if(this.pre==null)return;let n=this.getLineIndex(e.start,e.side),r=this.getLineIndex(e.end,e.endSide??e.side);return n!=null&&r!=null?{start:t?n[1]:n[0],end:t?r[1]:r[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,n){if(e.range==null)return;let r=this.getIndexesFromSelection(e.range,t);if(r==null)throw console.error({rowRange:r,range:e.range}),Error(`InteractionManager.renderSelection: No valid ${n} rowRange`);return r}getLineRenderColumns(e,t,n,r){if(this.pre==null||t==null&&r==null)return[];let{children:i}=this.pre;if(i.length>2)throw console.error(i),Error(`InteractionManager.renderSelection: Somehow there are more than 2 code elements...`);let a=[];for(let o of i){let i=o.hasAttribute(`data-deletions`)?`deletions`:o.hasAttribute(`data-additions`)?`additions`:void 0,s=e!=null&&t!=null&&(e.highlightSide==null||i==null||e.highlightSide===i),c=n!=null&&r!=null&&(n.highlightSide==null||i==null||n.highlightSide===i);if(!s&&!c)continue;let[l,u]=o.children;if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))throw Error(`InteractionManager.renderSelection: missing gutter or content element`);if(u.children.length!==l.children.length)throw Error(`InteractionManager.renderSelection: gutter and content children dont match, something is wrong`);a.push({content:u,gutter:l,renderEditorActiveLine:c,renderSelectedLines:s})}return a}renderSelection=()=>{Hy(this.renderSelection);let e=this.getSelectionRenderState();if(this.pre==null)return;let{editorActiveLine:t,selectedLines:n}=e,r=!FC(this.renderedSelectedLinesState,n),i=!FC(this.renderedEditorActiveLineState,t);if(!r&&!i)return;r&&(this.renderedSelectedLinesState=void 0),i&&(this.renderedEditorActiveLineState=void 0);let a=this.pre.getAttribute(`data-diff-type`)===`split`,o=r?this.resolveLineRenderRange(n,a,`selected-lines`):void 0,s=i?this.resolveLineRenderRange(t,a,`editor-active-line`):void 0,c=this.getLineRenderColumns(r?n:void 0,o,i?t:void 0,s),l=n.range==null||c.some(e=>e.renderSelectedLines),u=t.range==null||c.some(e=>e.renderEditorActiveLine);if(r)for(let e of this.pre.querySelectorAll(`[data-selected-line]`))e.removeAttribute(`data-selected-line`);if(i)for(let e of this.pre.querySelectorAll(`[data-editor-active-line]`))e.removeAttribute(`data-editor-active-line`);let d=o==null?void 0:Math.min(o.start,o.end),f=o==null?void 0:Math.max(o.start,o.end),p=d===f,m=s?.start;for(let e of c){let{content:r,gutter:i,renderEditorActiveLine:o,renderSelectedLines:s}=e,c=Math.max(s?f??-1/0:-1/0,o?m??-1/0:-1/0),l=r.children.length;for(let e=0;e<l;e++){let l=r.children[e],u=i.children[e];if(!(l instanceof HTMLElement)||!(u instanceof HTMLElement))continue;let h=this.parseLineIndex(l,a);if((h??0)>c)break;if(h!=null){if(s&&d!=null&&f!=null&&h>=d&&h<=f){let e=p?`single`:h===d?`first`:h===f?`last`:``;u.setAttribute(`data-selected-line`,e),n.lineNumberOnly||(l.setAttribute(`data-selected-line`,e),u.nextSibling instanceof HTMLElement&&l.nextSibling instanceof HTMLElement&&(l.nextSibling.hasAttribute(`data-line-annotation`)||l.nextSibling.hasAttribute(`data-merge-conflict-actions`))&&(p?(e=`last`,l.setAttribute(`data-selected-line`,`first`)):h===d?e=``:h===f&&l.setAttribute(`data-selected-line`,``),l.nextSibling.setAttribute(`data-selected-line`,e),u.nextSibling.setAttribute(`data-selected-line`,e)))}o&&h===m&&(u.setAttribute(`data-editor-active-line`,``),t.lineNumberOnly||l.setAttribute(`data-editor-active-line`,``))}}}r&&l&&(this.renderedSelectedLinesState=n),i&&u&&(this.renderedEditorActiveLineState=t)};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:n,side:r,tokenElement:i,tokenText:a}){return this.mode===`file`?{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,tokenElement:i,tokenText:a}:{type:`token`,lineCharEnd:e,lineCharStart:t,lineNumber:n,side:r,tokenElement:i,tokenText:a}}buildSelectedLineRange(e,t){return this.buildSelectionRange(e.lineNumber,t.lineNumber,e.side,t.side)}buildSelectionRange(e,t,n,r){return{start:e,end:t,...n==null?{}:{side:n},...n!==r&&r!=null?{endSide:r}:{}}}resolvePointerTarget(e){let t=!1,n,r,i,a,o,s,c,l,u,d;for(let f of e){if(!(f instanceof HTMLElement))continue;if(d==null&&f.hasAttribute(`data-merge-conflict-action`)){let e=f.getAttribute(`data-merge-conflict-action`)??void 0,t=f.getAttribute(`data-merge-conflict-conflict-index`)??void 0,n=t==null?NaN:Number.parseInt(t,10);DC(e)&&Number.isFinite(n)&&(d={kind:`merge-conflict-action`,resolution:e,conflictIndex:n})}if(s==null&&f.hasAttribute(`data-char`)){s=f;let e=f.getAttribute(`data-char`);if(e!=null){let t=Number.parseInt(e,10);if(!Number.isNaN(t)){let e=f.textContent??``,n=t+e.length;(e.trim()!==``||this.options.enableTokenInteractionsOnWhitespace===!0)&&(c={tokenElement:s,lineCharStart:t,lineCharEnd:n,tokenText:e});continue}}}let e=o==null?f.getAttribute(`data-column-number`)??void 0:void 0;if(e!=null){o=f,u=Number.parseInt(e,10),t=!0,n=LC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}let p=i==null?f.getAttribute(`data-line`)??void 0:void 0;if(p!=null){i=f,u=Number.parseInt(p,10),n=LC(f),a=f.getAttribute(`data-line-index`)??void 0;continue}if(l==null&&(f.hasAttribute(`data-expand-button`)||f.hasAttribute(`data-unmodified-lines`))){l={hunkIndex:void 0,direction:f.hasAttribute(`data-expand-up`)?`up`:f.hasAttribute(`data-expand-down`)?`down`:`both`,all:f.hasAttribute(`data-expand-all-button`)};continue}let m=l==null?void 0:f.getAttribute(`data-expand-index`)??void 0;if(l!=null&&m!=null){let e=Number.parseInt(m,10);Number.isNaN(e)||(l.hunkIndex=e);continue}if(r==null&&f.hasAttribute(`data-code`)){r=f;break}}if(d!=null)return d;if(l?.hunkIndex!=null)return{type:`line-info`,hunkIndex:l.hunkIndex,direction:l.direction,all:l.all};if(i??=a==null?void 0:OC(r,`[data-line][data-line-index="${a}"]`),o??=a==null?void 0:OC(r,`[data-column-number][data-line-index="${a}"]`),r==null||i==null||o==null||n==null||u==null||Number.isNaN(u))return;let f=this.parseLineIndex(i,this.isSplitDiff());return c==null?this.mode===`file`?{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f}:{kind:`line`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:IC(n,r),splitLineIndex:f}:this.mode===`file`?{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:void 0,splitLineIndex:f,...c}:{kind:`token`,lineType:n,lineElement:i,lineNumber:u,numberColumn:t,numberElement:o,side:IC(n,r),splitLineIndex:f,...c}}isSplitDiff(){return this.pre?.getAttribute(`data-diff-type`)===`split`}parseLineIndex(e,t){let n=(e.getAttribute(`data-line-index`)??``).split(`,`).map(e=>Number.parseInt(e,10)).filter(e=>!Number.isNaN(e));if(t&&n.length===2)return n[1];if(!t)return n[0]}};function bC({enableTokenInteractionsOnWhitespace:e,enableGutterUtility:t,lineHoverHighlight:n,onGutterUtilityClick:r,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,renderGutterUtility:d,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v},y,b,x){return{enableTokenInteractionsOnWhitespace:e,enableGutterUtility:xC({enableGutterUtility:t,renderGutterUtility:d,onGutterUtilityClick:r}),usesCustomGutterUtility:d!=null,lineHoverHighlight:n,onGutterUtilityClick:r,onHunkExpand:y,onMergeConflictActionClick:x,onLineClick:i,onLineEnter:a,onLineLeave:o,onLineNumberClick:s,onTokenClick:c,onTokenEnter:l,onTokenLeave:u,__debugPointerEvents:f,enableLineSelection:p,controlledSelection:m,onLineSelected:h,onLineSelectionStart:g,onLineSelectionChange:_,onLineSelectionEnd:v,getLineIndex:b}}function xC({enableGutterUtility:e,renderGutterUtility:t,onGutterUtilityClick:n}){if(n!=null&&t!=null)throw Error(`Cannot use both 'onGutterUtilityClick' and 'renderGutterUtility'. Use only one gutter utility API.`);return e??!1}function SC(e){return e!=null&&`kind`in e&&e.kind===`line`}function CC(e){return e!=null&&`kind`in e&&e.kind===`token`}function wC(e){return SC(e)||CC(e)}function TC(e){return`type`in e&&e.type===`line-info`}function EC(e){return`kind`in e&&e.kind===`merge-conflict-action`}function DC(e){return e===`current`||e===`incoming`||e===`both`}function OC(e,t){let n=e?.querySelector(t);return n instanceof HTMLElement?n:void 0}function kC(e){let t=[],n=e;for(;n!=null;)t.push(n),n=n.parentNode;return t}function AC(e){let t=e.closest(`[data-line], [data-column-number]`);if(t instanceof HTMLElement)return t;let n=e.closest(`[data-line-annotation], [data-gutter-buffer="annotation"]`);if(!(n instanceof HTMLElement))return;let r=n.previousElementSibling;return r instanceof HTMLElement&&(r.hasAttribute(`data-line`)||r.hasAttribute(`data-column-number`))?r:void 0}function jC(e){let t=e.closest(`[slot^="annotation-"]`);if(t instanceof HTMLElement)return t.getAttribute(`slot`)??void 0;if(e instanceof HTMLElement){let t=e.getAttribute(`name`)??void 0;return t!=null&&t.startsWith(`annotation-`)?t:void 0}}function MC(e){if(e==null)return;let t=/^annotation-(?:(additions|deletions)-)?(\d+)$/.exec(e);if(t==null)return;let n=Number.parseInt(t[2],10);if(!(!Number.isFinite(n)||n<=0))return{lineNumber:n,side:t[1]}}function NC(e){return e!=null&&typeof e.elementFromPoint==`function`}function PC(e,t){return e===t||Gy(e??void 0,t??void 0)}function FC(e,t){return e?.highlightSide===t.highlightSide&&e?.lineNumberOnly===t.lineNumberOnly&&PC(e?.range??null,t.range)}function IC(e,t){switch(e){case`change-deletion`:return`deletions`;case`change-addition`:return`additions`;default:return t.hasAttribute(`data-deletions`)?`deletions`:`additions`}}function LC(e){let 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 RC(e=`none`,t,...n){switch(e){case`none`:return;case`both`:break;case`click`:if(t!==`click`)return;break;case`move`:if(t!==`move`)return}console.log(...n)}var zC=class e{static resizeObserver;static managersByElement=new Map;static getResizeObserver(){let t=e.resizeObserver??new ResizeObserver(e.handleSharedResizeEntries);return e.resizeObserver=t,t}static handleSharedResizeEntries(t){let n=new Map;for(let r of t){let t=e.managersByElement.get(r.target);if(t==null)continue;let i=n.get(t);i==null?n.set(t,[r]):i.push(r)}for(let[e,t]of n)e.handleResizeEntries(t)}observedNodes=new Map;setup(e,{disableAnnotations:t,columnVariables:n=`apply`}){let r=new Set,i=n===`apply`,a=0,o=new Map(this.observedNodes);this.observedNodes.clear();for(let t of e.children){if(a===2)break;let e=(()=>{if(t instanceof HTMLElement&&t.tagName===`CODE`)return t})();if(e==null)continue;a++;let n=o.get(e);if(n!=null&&n.type!==`code`)throw Error(`ResizeManager.setup: somehow a code node is being used for an annotation, should be impossible`);let r=e.firstElementChild;r instanceof HTMLElement||(r=null),n==null?(n={type:`code`,codeElement:e,numberElement:r,codeWidth:`auto`,numberWidth:0,applyColumnVariables:i},this.observedNodes.set(e,n),this.observe(e),r!=null&&(this.observedNodes.set(r,n),this.observe(r))):(this.observedNodes.set(e,n),o.delete(e),n.numberElement===r?n.numberElement==null?n.numberWidth=0:(o.delete(n.numberElement),this.observedNodes.set(n.numberElement,n)):(n.numberElement!=null&&(this.unobserve(n.numberElement),o.delete(n.numberElement)),r!=null&&(this.observe(r),o.delete(r),this.observedNodes.set(r,n)),n.numberElement=r,n.numberWidth=0),HC(n,i))}if(a>1&&!t){let t=e.querySelectorAll(`[data-line-annotation*=","]`),n=new Map;for(let e of t){if(!(e instanceof HTMLElement))continue;let t=e.getAttribute(`data-line-annotation`)??``;if(!/^-?\d+,-?\d+$/.test(t)){console.error(`DiffFileRenderer.setupResizeObserver: Invalid element or annotation`,{lineAnnotation:t,element:e});continue}let r=n.get(t);r??(r=[],n.set(t,r)),r.push(e)}for(let[e,t]of n){if(t.length!==2){console.error(`DiffFileRenderer.setupResizeObserver: Bad Pair`,e,t);continue}let[n,i]=t,a=n.firstElementChild,s=i.firstElementChild;if(!(n instanceof HTMLElement)||!(i instanceof HTMLElement)||!(a instanceof HTMLElement)||!(s instanceof HTMLElement))continue;let c=o.get(a);if(c!=null){this.observedNodes.set(a,c),this.observedNodes.set(s,c),o.delete(a),o.delete(s);continue}let l=a.getBoundingClientRect().height,u=s.getBoundingClientRect().height;c={type:`annotations`,column1:{container:n,child:a,childHeight:l},column2:{container:i,child:s,childHeight:u},currentHeight:`auto`},r.add({child1:a,child2:s,item:c,newHeight:Math.max(l,u)})}for(let e of r)this.applyNewHeight(e.item,e.newHeight),this.observedNodes.set(e.child1,e.item),this.observedNodes.set(e.child2,e.item),this.observe(e.child1),this.observe(e.child2);r.clear()}for(let[e,t]of o)this.unobserve(e),t.type===`code`?GC(t):KC(t);o.clear()}cleanUp(){for(let e of this.observedNodes.keys())this.unobserve(e);this.observedNodes.clear()}observe(t){let{managersByElement:n}=e,r=n.get(t);if(r!==this){if(r!=null&&r!==this)throw Error(`ResizeManager.observe: element is already owned by another ResizeManager`);n.set(t,this),e.getResizeObserver().observe(t)}}unobserve(t){let{managersByElement:n,resizeObserver:r}=e,i=n.get(t);if(i!=null){if(i!==this)throw Error(`ResizeManager.unobserve: element is owned by another ResizeManager`);n.delete(t),r?.unobserve(t),r!=null&&n.size===0&&(r.disconnect(),e.resizeObserver=void 0)}}handleResizeEntries(e){let t=new Map,n=new Set;for(let r of e){let{target:e,borderBoxSize:i,contentBoxSize:a}=r;if(!(e instanceof HTMLElement)){console.error(`ResizeManager.handleResizeEntries: Invalid element for ResizeObserver`,r);continue}let o=this.observedNodes.get(e);if(o==null){console.error(`ResizeManager.handleResizeEntries: Not a valid observed node`,r);continue}if(o.type===`annotations`){let t=(()=>{if(e===o.column1.child)return o.column1;if(e===o.column2.child)return o.column2})();if(t==null){console.error(`ResizeManager.handleResizeEntries: Couldn't find a column for`,{item:o,target:e});continue}t.childHeight=i[0].blockSize,n.add(o)}else if(o.type===`code`){let n=t.get(o)??{},r=a[0].inlineSize;e===o.codeElement?n.codeInlineSize=r:e===o.numberElement&&(n.numberInlineSize=r),t.set(o,n)}}this.applyAnnotationUpdates(n),n.clear(),this.applyColumnUpdates(t),t.clear()}applyAnnotationUpdates(e){for(let t of e)this.applyNewHeight(t,Math.max(t.column1.childHeight,t.column2.childHeight))}applyColumnUpdates=e=>{for(let[t,n]of e){let e=n.codeInlineSize==null?t.codeWidth:BC(n.codeInlineSize),r=n.numberInlineSize==null?t.numberWidth:VC(n.numberInlineSize),i=e!==t.codeWidth,a=r!==t.numberWidth;!i&&!a||(t.codeWidth=e,t.numberWidth=r,t.applyColumnVariables&&UC(t,{codeWidthChanged:i,numberWidthChanged:a}))}};applyNewHeight(e,t){t!==e.currentHeight&&(e.currentHeight=Math.max(t,0),e.column1.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`),e.column2.container.style.setProperty(`--diffs-annotation-min-height`,`${e.currentHeight}px`))}};function BC(e){let t=Math.max(Math.floor(e),0);return t===0?`auto`:t}function VC(e){return Math.max(Math.ceil(e),0)}function HC(e,t){e.applyColumnVariables!==t&&(e.applyColumnVariables=t,t?UC(e,{codeWidthChanged:!0,numberWidthChanged:!0}):WC(e))}function UC(e,{codeWidthChanged:t,numberWidthChanged:n}){let{codeElement:r,codeWidth:i,numberWidth:a}=e;if(t&&r.style.setProperty(`--diffs-column-width`,`${typeof i==`number`?`${i}px`:`auto`}`),n&&r.style.setProperty(`--diffs-column-number-width`,`${a===0?`auto`:`${a}px`}`),t||n&&i!==`auto`){let e=typeof i==`number`?Math.max(i-a,0):0;r.style.setProperty(`--diffs-column-content-width`,`${e>0?`${e}px`:`auto`}`)}}function WC(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 GC(e){e.codeElement.isConnected&&WC(e)}function KC(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`)}var qC=new Map,JC=new Map,YC=new Map,XC=new Set;function ZC(e){for(let t of Array.isArray(e)?e:[e])if(t!==`text`&&t!==`ansi`&&!XC.has(t))return!1;return!0}function QC(e,t){e=Array.isArray(e)?e:[e];for(let n of e){if(XC.has(n.name))continue;let e=qC.get(n.name);e??(e=n,qC.set(n.name,e)),XC.add(e.name),t.loadLanguageSync(e.data)}}function $C(){return typeof WorkerGlobalScope<`u`&&typeof self<`u`&&self instanceof WorkerGlobalScope}var ew=Object.defineProperty,tw=Object.getOwnPropertyDescriptor,nw=Object.getOwnPropertyNames,rw=Object.prototype.hasOwnProperty,iw=(e,t)=>{let n={};for(var r in e)ew(n,r,{get:e[r],enumerable:!0});return t||ew(n,Symbol.toStringTag,{value:`Module`}),n},aw=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var i=nw(t),a=0,o=i.length,s;a<o;a++)s=i[a],!rw.call(e,s)&&s!==n&&ew(e,s,{get:(e=>t[e]).bind(null,s),enumerable:!(r=tw(t,s))||r.enumerable});return e},ow=(e,t,n)=>(aw(e,t,`default`),n&&aw(n,t,`default`)),sw=(function(){let e=typeof document<`u`&&document.createElement(`link`).relList;return e&&e.supports&&e.supports(`modulepreload`)?`modulepreload`:`preload`})(),cw=function(e){return`/`+e},lw={},K=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,import.meta.url).href}r=o(t.map(t=>{if(t=cw(t,n),t=s(t),t in lw)return;lw[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:sw,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},uw=[{id:`abap`,name:`ABAP`,import:(()=>K(()=>import(`./_CLvhMVsD.js`),[]))},{id:`actionscript-3`,name:`ActionScript`,aliases:[`actionscript`,`as3`],import:(()=>K(()=>import(`./_Cs6JJXT5.js`),[]))},{id:`ada`,name:`Ada`,import:(()=>K(()=>import(`./_C5qYipkI.js`),[]))},{id:`ahk`,name:`AutoHotkey`,aliases:[`ahk1`],import:(()=>K(()=>import(`./_CA9gdOdF.js`),[]))},{id:`ahk2`,name:`AutoHotkey2`,import:(()=>K(()=>import(`./__6rzW9BS.js`),[]))},{id:`angular-html`,name:`Angular HTML`,import:(()=>K(()=>import(`./_DqqLoHco.js`).then(e=>e.n),__vite__mapDeps([0,1,2,3])))},{id:`angular-ts`,name:`Angular TypeScript`,import:(()=>K(()=>import(`./_aXYWp2ZC.js`),__vite__mapDeps([4,0,1,2,3,5])))},{id:`apache`,name:`Apache Conf`,import:(()=>K(()=>import(`./_U0d_L8uA.js`),[]))},{id:`apex`,name:`Apex`,import:(()=>K(()=>import(`./_KFGFyKwG.js`),[]))},{id:`apl`,name:`APL`,import:(()=>K(()=>import(`./_C4JQ0avI.js`),__vite__mapDeps([6,2,3,1,7,8,9])))},{id:`applescript`,name:`AppleScript`,import:(()=>K(()=>import(`./_CCn79oCD.js`),[]))},{id:`ara`,name:`Ara`,import:(()=>K(()=>import(`./_4CJ0cIlV.js`),[]))},{id:`asciidoc`,name:`AsciiDoc`,aliases:[`adoc`],import:(()=>K(()=>import(`./_SCjQUq34.js`),[]))},{id:`asm`,name:`Assembly`,import:(()=>K(()=>import(`./_Cmm7eHzH.js`),[]))},{id:`astro`,name:`Astro`,import:(()=>K(()=>import(`./_BchSFDSU.js`),__vite__mapDeps([10,2,3,9,11,12,13])))},{id:`awk`,name:`AWK`,import:(()=>K(()=>import(`./_BWXHIvNe2.js`),[]))},{id:`ballerina`,name:`Ballerina`,import:(()=>K(()=>import(`./_B7ZEbQpA2.js`),[]))},{id:`bat`,name:`Batch File`,aliases:[`batch`,`cmd`],import:(()=>K(()=>import(`./_qdxAdBWQ2.js`),[]))},{id:`beancount`,name:`Beancount`,import:(()=>K(()=>import(`./_D-usSTwE2.js`),[]))},{id:`berry`,name:`Berry`,aliases:[`be`],import:(()=>K(()=>import(`./_DKpUyyne2.js`),[]))},{id:`bibtex`,name:`BibTeX`,import:(()=>K(()=>import(`./_Ci_nEsc72.js`),[]))},{id:`bicep`,name:`Bicep`,import:(()=>K(()=>import(`./_CUHmPFLl2.js`),[]))},{id:`bird2`,name:`BIRD2 Configuration`,aliases:[`bird`],import:(()=>K(()=>import(`./_CYIUgYqB2.js`),[]))},{id:`blade`,name:`Blade`,import:(()=>K(()=>import(`./_BwnkAzDN2.js`),__vite__mapDeps([14,2,3,1,7,8,9,15,16])))},{id:`bsl`,name:`1C (Enterprise)`,aliases:[`1c`],import:(()=>K(()=>import(`./_CpYNKFv52.js`),__vite__mapDeps([17,18])))},{id:`c`,name:`C`,import:(()=>K(()=>import(`./_DInIL5iq2.js`).then(e=>e.n),[]))},{id:`c3`,name:`C3`,import:(()=>K(()=>import(`./_D0apG41V2.js`),[]))},{id:`cadence`,name:`Cadence`,aliases:[`cdc`],import:(()=>K(()=>import(`./_CQ2zXKGN2.js`),[]))},{id:`cairo`,name:`Cairo`,import:(()=>K(()=>import(`./_kIpfj7zU2.js`),__vite__mapDeps([19,20])))},{id:`chapel`,name:`Chapel`,aliases:[`chpl`],import:(()=>K(()=>import(`./_Do3Q5gXZ2.js`),__vite__mapDeps([21,22])))},{id:`clarity`,name:`Clarity`,import:(()=>K(()=>import(`./_CtfBBspg2.js`),[]))},{id:`clojure`,name:`Clojure`,aliases:[`clj`],import:(()=>K(()=>import(`./_DqKBuwfJ2.js`),[]))},{id:`cmake`,name:`CMake`,import:(()=>K(()=>import(`./_Bj61d0ZC2.js`),[]))},{id:`cobol`,name:`COBOL`,import:(()=>K(()=>import(`./_CG65evuJ2.js`),__vite__mapDeps([23,1,2,3,8])))},{id:`codeowners`,name:`CODEOWNERS`,import:(()=>K(()=>import(`./_C8r90Shi2.js`),[]))},{id:`codeql`,name:`CodeQL`,aliases:[`ql`],import:(()=>K(()=>import(`./_oeQT6MSM2.js`),[]))},{id:`coffee`,name:`CoffeeScript`,aliases:[`coffeescript`],import:(()=>K(()=>import(`./_COiINYul2.js`),__vite__mapDeps([24,2])))},{id:`common-lisp`,name:`Common Lisp`,aliases:[`lisp`],import:(()=>K(()=>import(`./_Cv5bFMCO.js`),[]))},{id:`coq`,name:`Rocq`,import:(()=>K(()=>import(`./_DuBRPxYg.js`),[]))},{id:`cpp`,name:`C++`,aliases:[`c++`],import:(()=>K(()=>import(`./_BpIotmis.js`).then(e=>e.n),__vite__mapDeps([25,26,27,22])))},{id:`crystal`,name:`Crystal`,import:(()=>K(()=>import(`./_BRfYhRDN.js`),__vite__mapDeps([28,2,3,1,16,22,29])))},{id:`csharp`,name:`C#`,aliases:[`c#`,`cs`],import:(()=>K(()=>import(`./_oqKa8noW.js`),[]))},{id:`css`,name:`CSS`,import:(()=>K(()=>import(`./_C480-4NE.js`).then(e=>e.n),[]))},{id:`csv`,name:`CSV`,import:(()=>K(()=>import(`./_Dx-8-gkx.js`),[]))},{id:`cue`,name:`CUE`,import:(()=>K(()=>import(`./_CE9AQfxI.js`),[]))},{id:`cypher`,name:`Cypher`,aliases:[`cql`],import:(()=>K(()=>import(`./_ClKdZ_lG.js`),[]))},{id:`d`,name:`D`,import:(()=>K(()=>import(`./_qD-0Kul2.js`),[]))},{id:`dart`,name:`Dart`,import:(()=>K(()=>import(`./_CnvKMtbv.js`),[]))},{id:`dax`,name:`DAX`,import:(()=>K(()=>import(`./_BkyTk9wS.js`),[]))},{id:`desktop`,name:`Desktop`,import:(()=>K(()=>import(`./_Dlh5hvp9.js`),[]))},{id:`diff`,name:`Diff`,import:(()=>K(()=>import(`./_woXpYk--.js`),[]))},{id:`docker`,name:`Dockerfile`,aliases:[`dockerfile`],import:(()=>K(()=>import(`./_IyjqRm3v.js`),[]))},{id:`dotenv`,name:`dotEnv`,import:(()=>K(()=>import(`./__5a1GRtc.js`),[]))},{id:`dream-maker`,name:`Dream Maker`,import:(()=>K(()=>import(`./_DW3nJb8Q.js`),[]))},{id:`edge`,name:`Edge`,import:(()=>K(()=>import(`./_Bo2t_uNU.js`),__vite__mapDeps([30,1,2,3,11,15])))},{id:`elixir`,name:`Elixir`,import:(()=>K(()=>import(`./_CRMMWY-q.js`),__vite__mapDeps([31,1,2,3])))},{id:`elm`,name:`Elm`,import:(()=>K(()=>import(`./_B1Ress7e.js`),__vite__mapDeps([32,27,22])))},{id:`emacs-lisp`,name:`Emacs Lisp`,aliases:[`elisp`],import:(()=>K(()=>import(`./_c_oH4hRZ.js`),[]))},{id:`erb`,name:`ERB`,import:(()=>K(()=>import(`./_DtmS6252.js`),__vite__mapDeps([33,1,2,3,34,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`erlang`,name:`Erlang`,aliases:[`erl`],import:(()=>K(()=>import(`./_BaHq4SXp.js`),__vite__mapDeps([40,41])))},{id:`fennel`,name:`Fennel`,import:(()=>K(()=>import(`./_DQxkIbk2.js`),[]))},{id:`fish`,name:`Fish`,import:(()=>K(()=>import(`./_BJitypiv.js`),[]))},{id:`fluent`,name:`Fluent`,aliases:[`ftl`],import:(()=>K(()=>import(`./_C03EYrpw.js`),[]))},{id:`fortran-fixed-form`,name:`Fortran (Fixed Form)`,aliases:[`f`,`for`,`f77`],import:(()=>K(()=>import(`./_CQJs3lWb.js`),__vite__mapDeps([42,43])))},{id:`fortran-free-form`,name:`Fortran (Free Form)`,aliases:[`f90`,`f95`,`f03`,`f08`,`f18`],import:(()=>K(()=>import(`./_CYNrtFtB.js`),[]))},{id:`fsharp`,name:`F#`,aliases:[`f#`,`fs`],import:(()=>K(()=>import(`./_DmIc4jLQ.js`),__vite__mapDeps([44,41])))},{id:`gdresource`,name:`GDResource`,aliases:[`tscn`,`tres`],import:(()=>K(()=>import(`./_CY8IvGdO2.js`),__vite__mapDeps([45,46,47])))},{id:`gdscript`,name:`GDScript`,aliases:[`gd`],import:(()=>K(()=>import(`./_DYvRD3hg2.js`),[]))},{id:`gdshader`,name:`GDShader`,import:(()=>K(()=>import(`./_CBce3t8t2.js`),[]))},{id:`genie`,name:`Genie`,import:(()=>K(()=>import(`./_CV2tkWYe2.js`),[]))},{id:`gherkin`,name:`Gherkin`,import:(()=>K(()=>import(`./_DExj1W_82.js`),[]))},{id:`git-commit`,name:`Git Commit Message`,import:(()=>K(()=>import(`./_Dl-2e7rI2.js`),__vite__mapDeps([48,49])))},{id:`git-rebase`,name:`Git Rebase Message`,import:(()=>K(()=>import(`./_JmyDHQ3S2.js`),__vite__mapDeps([50,29])))},{id:`gleam`,name:`Gleam`,import:(()=>K(()=>import(`./_CSRkHgEL2.js`),[]))},{id:`glimmer-js`,name:`Glimmer JS`,aliases:[`gjs`],import:(()=>K(()=>import(`./_CXLqhKMK2.js`),__vite__mapDeps([51,2,3,1,11])))},{id:`glimmer-ts`,name:`Glimmer TS`,aliases:[`gts`],import:(()=>K(()=>import(`./_xuVEda462.js`),__vite__mapDeps([52,2,3,1,11])))},{id:`glsl`,name:`GLSL`,import:(()=>K(()=>import(`./_ChXwBYfg.js`).then(e=>e.n),__vite__mapDeps([27,22])))},{id:`gn`,name:`GN`,import:(()=>K(()=>import(`./_ilITqXS62.js`),[]))},{id:`gnuplot`,name:`Gnuplot`,import:(()=>K(()=>import(`./_7GGW24-e2.js`),[]))},{id:`go`,name:`Go`,import:(()=>K(()=>import(`./_rLFTqkRN2.js`),[]))},{id:`graphql`,name:`GraphQL`,aliases:[`gql`],import:(()=>K(()=>import(`./_CZtA_-Ie.js`).then(e=>e.n),__vite__mapDeps([36,2,11,13,37])))},{id:`groovy`,name:`Groovy`,import:(()=>K(()=>import(`./_CacY0gHj2.js`),[]))},{id:`hack`,name:`Hack`,import:(()=>K(()=>import(`./_DncMx76o2.js`),__vite__mapDeps([53,1,2,3,16])))},{id:`haml`,name:`Ruby Haml`,import:(()=>K(()=>import(`./_CeybDOH3.js`).then(e=>e.n),__vite__mapDeps([35,2,3])))},{id:`handlebars`,name:`Handlebars`,aliases:[`hbs`],import:(()=>K(()=>import(`./_D0-uwMfH2.js`),__vite__mapDeps([54,2,3,1,39])))},{id:`haskell`,name:`Haskell`,aliases:[`hs`],import:(()=>K(()=>import(`./_D8IpX4py2.js`),[]))},{id:`haxe`,name:`Haxe`,import:(()=>K(()=>import(`./_C8oCnwJJ2.js`),[]))},{id:`hcl`,name:`HashiCorp HCL`,import:(()=>K(()=>import(`./_Dh228itO2.js`),[]))},{id:`hjson`,name:`Hjson`,import:(()=>K(()=>import(`./_CxZEssPk2.js`),[]))},{id:`hlsl`,name:`HLSL`,import:(()=>K(()=>import(`./_Cvrh5tZx2.js`),[]))},{id:`html`,name:`HTML`,import:(()=>K(()=>import(`./_BGO4yXnZ.js`).then(e=>e.n),__vite__mapDeps([1,2,3])))},{id:`html-derivative`,name:`HTML (Derivative)`,import:(()=>K(()=>import(`./_C5tw5jaH2.js`),__vite__mapDeps([15,1,2,3])))},{id:`http`,name:`HTTP`,import:(()=>K(()=>import(`./_E5dbeZEm2.js`),__vite__mapDeps([55,7,8,9,29,36,2,11,13,37])))},{id:`hurl`,name:`Hurl`,import:(()=>K(()=>import(`./_DT71qSJE2.js`),__vite__mapDeps([56,7,8,57,36,2,11,13,37])))},{id:`hxml`,name:`HXML`,import:(()=>K(()=>import(`./_DLbMbJfH2.js`),__vite__mapDeps([58,59])))},{id:`hy`,name:`Hy`,import:(()=>K(()=>import(`./_CZbG8q4J2.js`),[]))},{id:`imba`,name:`Imba`,import:(()=>K(()=>import(`./_DsUTQ-LC2.js`),[]))},{id:`ini`,name:`INI`,aliases:[`properties`],import:(()=>K(()=>import(`./_B5eOa1yu.js`),[]))},{id:`java`,name:`Java`,import:(()=>K(()=>import(`./_CgX5-PN8.js`).then(e=>e.n),[]))},{id:`javascript`,name:`JavaScript`,aliases:[`js`,`cjs`,`mjs`],import:(()=>K(()=>import(`./_B7ZTox7L.js`).then(e=>e.n),[]))},{id:`jinja`,name:`Jinja`,import:(()=>K(()=>import(`./_g7Q1ADd0.js`),__vite__mapDeps([60,1,2,3])))},{id:`jison`,name:`Jison`,import:(()=>K(()=>import(`./_Bv61tUGo.js`),__vite__mapDeps([61,2])))},{id:`json`,name:`JSON`,import:(()=>K(()=>import(`./_cZMSm0LN.js`).then(e=>e.n),[]))},{id:`json5`,name:`JSON5`,import:(()=>K(()=>import(`./_BR5RXkoi.js`),[]))},{id:`jsonc`,name:`JSON with Comments`,import:(()=>K(()=>import(`./_CYpm1nAK.js`),[]))},{id:`jsonl`,name:`JSON Lines`,import:(()=>K(()=>import(`./_CmCQp5Yx.js`),[]))},{id:`jsonnet`,name:`Jsonnet`,import:(()=>K(()=>import(`./_CJTPZ8u_.js`),[]))},{id:`jssm`,name:`JSSM`,aliases:[`fsl`],import:(()=>K(()=>import(`./_DXw9l8Rf.js`),[]))},{id:`jsx`,name:`JSX`,import:(()=>K(()=>import(`./_CFwjuNga.js`).then(e=>e.n),[]))},{id:`julia`,name:`Julia`,aliases:[`jl`],import:(()=>K(()=>import(`./_DpLjBHyL.js`),__vite__mapDeps([62,2,16,20,25,26,27,22,63])))},{id:`just`,name:`Just`,aliases:[`justfile`],import:(()=>K(()=>import(`./_BBCthCRB.js`),__vite__mapDeps([64,2,11,20,29,34,3,1,7,8,16,22,25,26,27,35,36,13,37,38,39,65])))},{id:`kdl`,name:`KDL`,import:(()=>K(()=>import(`./_CsD5j6eV.js`),[]))},{id:`kotlin`,name:`Kotlin`,aliases:[`kt`,`kts`],import:(()=>K(()=>import(`./_DhhofPvG.js`),[]))},{id:`kusto`,name:`Kusto`,aliases:[`kql`],import:(()=>K(()=>import(`./_C7mF5XQf.js`),[]))},{id:`latex`,name:`LaTeX`,import:(()=>K(()=>import(`./_D32jCBoK.js`),__vite__mapDeps([66,67,63])))},{id:`lean`,name:`Lean 4`,aliases:[`lean4`],import:(()=>K(()=>import(`./_CewbzKMR.js`),[]))},{id:`less`,name:`Less`,import:(()=>K(()=>import(`./_DVTAwKKz.js`),[]))},{id:`liquid`,name:`Liquid`,import:(()=>K(()=>import(`./_ZSGrflxk.js`),__vite__mapDeps([68,2,3,1,9])))},{id:`llvm`,name:`LLVM IR`,import:(()=>K(()=>import(`./_DqHOMS-s.js`),[]))},{id:`log`,name:`Log file`,import:(()=>K(()=>import(`./_BNLmms1o.js`),[]))},{id:`logo`,name:`Logo`,import:(()=>K(()=>import(`./_Cluzi2Zq.js`),[]))},{id:`lua`,name:`Lua`,import:(()=>K(()=>import(`./_BFnmKuGb.js`).then(e=>e.n),__vite__mapDeps([38,22])))},{id:`luau`,name:`Luau`,import:(()=>K(()=>import(`./_C2pBCSgt.js`),[]))},{id:`make`,name:`Makefile`,aliases:[`makefile`],import:(()=>K(()=>import(`./_Dixweg8N.js`),[]))},{id:`markdown`,name:`Markdown`,aliases:[`md`],import:(()=>K(()=>import(`./_BYOwaDjH.js`),[]))},{id:`marko`,name:`Marko`,import:(()=>K(()=>import(`./_anllqmOe.js`),__vite__mapDeps([69,3,5,11,70])))},{id:`matlab`,name:`MATLAB`,import:(()=>K(()=>import(`./_D7qyCx1q.js`),[]))},{id:`mdc`,name:`MDC`,import:(()=>K(()=>import(`./_m1KNq0Gx.js`),__vite__mapDeps([71,15,1,2,3,39,41])))},{id:`mdx`,name:`MDX`,import:(()=>K(()=>import(`./_DQZ5AkYe.js`),[]))},{id:`mermaid`,name:`Mermaid`,aliases:[`mmd`],import:(()=>K(()=>import(`./_BxpfTIzt.js`),[]))},{id:`mipsasm`,name:`MIPS Assembly`,aliases:[`mips`],import:(()=>K(()=>import(`./_BMqwQI7S.js`),[]))},{id:`mojo`,name:`Mojo`,import:(()=>K(()=>import(`./_CFuIV2fl.js`),[]))},{id:`moonbit`,name:`MoonBit`,aliases:[`mbt`,`mbti`],import:(()=>K(()=>import(`./_DgjMoLWr.js`),[]))},{id:`move`,name:`Move`,import:(()=>K(()=>import(`./_BYnGhZoM.js`),[]))},{id:`narrat`,name:`Narrat Language`,aliases:[`nar`],import:(()=>K(()=>import(`./__X_XdTYD.js`),[]))},{id:`nextflow`,name:`Nextflow`,aliases:[`nf`],import:(()=>K(()=>import(`./_DWQbgPoS.js`),__vite__mapDeps([72,73])))},{id:`nextflow-groovy`,name:`Nextflow Groovy`,import:(()=>K(()=>import(`./_DJMQeKeT.js`),[]))},{id:`nginx`,name:`Nginx`,import:(()=>K(()=>import(`./_-3M9WuU4.js`),__vite__mapDeps([74,38,22])))},{id:`nim`,name:`Nim`,import:(()=>K(()=>import(`./_Cbg9-SI_2.js`),__vite__mapDeps([75,2,3,1,7,8,22,27,41])))},{id:`nix`,name:`Nix`,import:(()=>K(()=>import(`./_IvuFDN5E2.js`),[]))},{id:`nsis`,name:`NSIS`,import:(()=>K(()=>import(`./_CjNLYCLg2.js`),[]))},{id:`nushell`,name:`nushell`,aliases:[`nu`],import:(()=>K(()=>import(`./_DHYfO66s2.js`),[]))},{id:`objective-c`,name:`Objective-C`,aliases:[`objc`],import:(()=>K(()=>import(`./_D1A_Heim2.js`),[]))},{id:`objective-cpp`,name:`Objective-C++`,import:(()=>K(()=>import(`./_BsSzOQcm2.js`),[]))},{id:`ocaml`,name:`OCaml`,import:(()=>K(()=>import(`./_O90oeIOV2.js`),[]))},{id:`odin`,name:`Odin`,import:(()=>K(()=>import(`./_B1RWQWA52.js`),[]))},{id:`openscad`,name:`OpenSCAD`,aliases:[`scad`],import:(()=>K(()=>import(`./_BUDT5pXO2.js`),[]))},{id:`org`,name:`Org Markup`,import:(()=>K(()=>import(`./_BG21uqHk2.js`),__vite__mapDeps([76,2,3,1,5,8,7,9,11,13,16,22,20,77,24,26,25,27,29,78,79,49,80,31,38,39,34,35,36,37,41,40,48,50,81,82,83,63,65,66,67,70,84,75,85,86,87,88,89,90,91,92,93])))},{id:`pascal`,name:`Pascal`,import:(()=>K(()=>import(`./_4ZHwLPI52.js`),[]))},{id:`perl`,name:`Perl`,import:(()=>K(()=>import(`./_BpxV-2f3.js`),__vite__mapDeps([65,2,3,1,7,8,16])))},{id:`php`,name:`PHP`,import:(()=>K(()=>import(`./_dkeDDehz2.js`),__vite__mapDeps([87,2,3,1,7,8,9,16])))},{id:`pkl`,name:`Pkl`,import:(()=>K(()=>import(`./_ot-7Btpt2.js`),[]))},{id:`plsql`,name:`PL/SQL`,import:(()=>K(()=>import(`./_DGHpHOYJ2.js`),[]))},{id:`po`,name:`Gettext PO`,aliases:[`pot`,`potx`],import:(()=>K(()=>import(`./_BiJDBrnU2.js`),[]))},{id:`polar`,name:`Polar`,import:(()=>K(()=>import(`./_C7UOKdEL2.js`),[]))},{id:`postcss`,name:`PostCSS`,import:(()=>K(()=>import(`./_BXeXVLqQ.js`),[]))},{id:`powerquery`,name:`PowerQuery`,import:(()=>K(()=>import(`./_DNMTfnFr2.js`),[]))},{id:`powershell`,name:`PowerShell`,aliases:[`ps`,`ps1`,`pwsh`],import:(()=>K(()=>import(`./_CCSX75yM2.js`),[]))},{id:`prisma`,name:`Prisma`,import:(()=>K(()=>import(`./_DMgNhnYS2.js`),[]))},{id:`prolog`,name:`Prolog`,import:(()=>K(()=>import(`./_iXnhIJG72.js`),[]))},{id:`proto`,name:`Protocol Buffer 3`,aliases:[`protobuf`],import:(()=>K(()=>import(`./_DB4EqR-F.js`),[]))},{id:`pug`,name:`Pug`,aliases:[`jade`],import:(()=>K(()=>import(`./_BooCIZFD.js`),__vite__mapDeps([94,2,3,1])))},{id:`puppet`,name:`Puppet`,import:(()=>K(()=>import(`./_CDv2pdJW.js`),[]))},{id:`purescript`,name:`PureScript`,import:(()=>K(()=>import(`./_9MfHhQsQ.js`),[]))},{id:`python`,name:`Python`,aliases:[`py`],import:(()=>K(()=>import(`./_gzcpVVnB2.js`),[]))},{id:`qml`,name:`QML`,import:(()=>K(()=>import(`./_CkT411UL.js`),__vite__mapDeps([95,2])))},{id:`qmldir`,name:`QML Directory`,import:(()=>K(()=>import(`./_DCQb3MpD.js`),[]))},{id:`qss`,name:`Qt Style Sheets`,import:(()=>K(()=>import(`./_Fe1Jh2GI.js`),[]))},{id:`r`,name:`R`,import:(()=>K(()=>import(`./_C3OrD7LT.js`).then(e=>e.n),[]))},{id:`racket`,name:`Racket`,import:(()=>K(()=>import(`./_DcIDlBhZ.js`),[]))},{id:`raku`,name:`Raku`,aliases:[`perl6`],import:(()=>K(()=>import(`./_B3gFvitq2.js`),[]))},{id:`razor`,name:`ASP.NET Razor`,import:(()=>K(()=>import(`./_BfCF5T_K.js`),__vite__mapDeps([96,1,2,3,78])))},{id:`rbs`,name:`RBS`,aliases:[`ruby-signature`],import:(()=>K(()=>import(`./_C0MpOrj4.js`),[]))},{id:`reg`,name:`Windows Registry Script`,import:(()=>K(()=>import(`./_CRGYupPL.js`),[]))},{id:`regexp`,name:`RegExp`,aliases:[`regex`],import:(()=>K(()=>import(`./_DLg1-IRM.js`).then(e=>e.n),[]))},{id:`rel`,name:`Rel`,import:(()=>K(()=>import(`./_BtDbiS_P.js`),[]))},{id:`riscv`,name:`RISC-V`,import:(()=>K(()=>import(`./_Ckw8ddFX.js`),[]))},{id:`ron`,name:`RON`,import:(()=>K(()=>import(`./_VUp2lXgN.js`),[]))},{id:`rosmsg`,name:`ROS Interface`,import:(()=>K(()=>import(`./_CAekHB0j.js`),[]))},{id:`rst`,name:`reStructuredText`,import:(()=>K(()=>import(`./_B49wgrKW.js`),__vite__mapDeps([97,2,15,1,3,20,98,25,26,27,22,29,39,34,7,8,16,35,36,11,13,37,38])))},{id:`ruby`,name:`Ruby`,aliases:[`rb`],import:(()=>K(()=>import(`./_BVimx11r.js`),__vite__mapDeps([34,2,3,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39])))},{id:`rust`,name:`Rust`,aliases:[`rs`],import:(()=>K(()=>import(`./_Cfkwpbl82.js`),[]))},{id:`sas`,name:`SAS`,import:(()=>K(()=>import(`./_DK5es8xg.js`),__vite__mapDeps([99,16])))},{id:`sass`,name:`Sass`,import:(()=>K(()=>import(`./_DXrisJhu.js`),[]))},{id:`scala`,name:`Scala`,import:(()=>K(()=>import(`./_BiFt_7mu2.js`),[]))},{id:`scheme`,name:`Scheme`,import:(()=>K(()=>import(`./_DQCgrYNe.js`),[]))},{id:`scss`,name:`SCSS`,import:(()=>K(()=>import(`./_Cww6wLe3.js`).then(e=>e.n),__vite__mapDeps([5,3])))},{id:`sdbl`,name:`1C (Query)`,aliases:[`1c-query`],import:(()=>K(()=>import(`./_bTVj8UrX2.js`),[]))},{id:`shaderlab`,name:`ShaderLab`,aliases:[`shader`],import:(()=>K(()=>import(`./_BM315xPC.js`),__vite__mapDeps([100,101])))},{id:`shellscript`,name:`Shell`,aliases:[`bash`,`sh`,`shell`,`zsh`],import:(()=>K(()=>import(`./_CjNZdOEs.js`).then(e=>e.n),[]))},{id:`shellsession`,name:`Shell Session`,aliases:[`console`],import:(()=>K(()=>import(`./_DDpdWlxA.js`),__vite__mapDeps([102,29])))},{id:`smalltalk`,name:`GNU Smalltalk`,import:(()=>K(()=>import(`./_BHpQb5nM.js`),[]))},{id:`smithy`,name:`Smithy`,import:(()=>K(()=>import(`./_Dgaz7aur.js`),[]))},{id:`solidity`,name:`Solidity`,import:(()=>K(()=>import(`./_Bj7E1mRn.js`),[]))},{id:`soy`,name:`Closure Templates`,aliases:[`closure-templates`],import:(()=>K(()=>import(`./_BpB-O0HN.js`),__vite__mapDeps([103,1,2,3])))},{id:`sparql`,name:`SPARQL`,import:(()=>K(()=>import(`./_L8AbGenz.js`),__vite__mapDeps([104,105])))},{id:`splunk`,name:`Splunk Query Language`,aliases:[`spl`],import:(()=>K(()=>import(`./_BC2Px7Mm.js`),[]))},{id:`sql`,name:`SQL`,import:(()=>K(()=>import(`./_Cm-mKxlV2.js`).then(e=>e.n),[]))},{id:`ssh-config`,name:`SSH Config`,import:(()=>K(()=>import(`./_BgfXC-Er.js`),[]))},{id:`stata`,name:`Stata`,import:(()=>K(()=>import(`./_O3QIPxoe.js`),__vite__mapDeps([106,16])))},{id:`stylus`,name:`Stylus`,aliases:[`styl`],import:(()=>K(()=>import(`./_B6D30XZt.js`),[]))},{id:`surrealql`,name:`SurrealQL`,aliases:[`surql`],import:(()=>K(()=>import(`./_ByaF5Ym8.js`),__vite__mapDeps([107,2])))},{id:`svelte`,name:`Svelte`,import:(()=>K(()=>import(`./_H-G61tx0.js`),__vite__mapDeps([108,2,3,11,12])))},{id:`swift`,name:`Swift`,import:(()=>K(()=>import(`./_CyEgAFGc.js`),[]))},{id:`system-verilog`,name:`SystemVerilog`,import:(()=>K(()=>import(`./_Dh5ihWbf.js`),[]))},{id:`systemd`,name:`Systemd Units`,import:(()=>K(()=>import(`./_BxMlprV5.js`),[]))},{id:`talonscript`,name:`TalonScript`,aliases:[`talon`],import:(()=>K(()=>import(`./_CohzipZa.js`),[]))},{id:`tasl`,name:`Tasl`,import:(()=>K(()=>import(`./_DMoTqEGO.js`),[]))},{id:`tcl`,name:`Tcl`,import:(()=>K(()=>import(`./_CZd0xW_V2.js`),[]))},{id:`templ`,name:`Templ`,import:(()=>K(()=>import(`./_BWIzVLMa2.js`),__vite__mapDeps([109,2,3,81])))},{id:`terraform`,name:`Terraform`,aliases:[`tf`,`tfvars`],import:(()=>K(()=>import(`./_DswuEJGm2.js`),[]))},{id:`tex`,name:`TeX`,import:(()=>K(()=>import(`./_q9TSOuKE.js`).then(e=>e.n),__vite__mapDeps([67,63])))},{id:`toml`,name:`TOML`,import:(()=>K(()=>import(`./_CcmNWLt02.js`),[]))},{id:`ts-tags`,name:`TypeScript with Tags`,aliases:[`lit`],import:(()=>K(()=>import(`./_DkpMMWAt2.js`),__vite__mapDeps([110,2,3,1,7,8,11,16,27,22])))},{id:`tsv`,name:`TSV`,import:(()=>K(()=>import(`./_sltzmVWM2.js`),[]))},{id:`tsx`,name:`TSX`,import:(()=>K(()=>import(`./_DGZCHdAh.js`).then(e=>e.n),[]))},{id:`turtle`,name:`Turtle`,import:(()=>K(()=>import(`./_ByJddavk.js`),[]))},{id:`twig`,name:`Twig`,import:(()=>K(()=>import(`./_3ZKZeEN32.js`),__vite__mapDeps([111,2,3,5,20,34,1,7,8,16,22,25,26,27,29,35,36,11,13,37,38,39,87,9])))},{id:`typescript`,name:`TypeScript`,aliases:[`ts`,`cts`,`mts`],import:(()=>K(()=>import(`./_CjAjLYnS.js`).then(e=>e.n),[]))},{id:`typespec`,name:`TypeSpec`,aliases:[`tsp`],import:(()=>K(()=>import(`./_BRdr0IET2.js`),[]))},{id:`typst`,name:`Typst`,aliases:[`typ`],import:(()=>K(()=>import(`./_DI99ib-x2.js`),[]))},{id:`v`,name:`V`,import:(()=>K(()=>import(`./_DBj4K9d_2.js`),[]))},{id:`vala`,name:`Vala`,import:(()=>K(()=>import(`./_zf12oZj62.js`),[]))},{id:`vb`,name:`Visual Basic`,import:(()=>K(()=>import(`./_DOwzaHZ02.js`),[]))},{id:`verilog`,name:`Verilog`,import:(()=>K(()=>import(`./_B2gwz-sJ2.js`),[]))},{id:`vhdl`,name:`VHDL`,import:(()=>K(()=>import(`./_BroJfC0k2.js`),[]))},{id:`viml`,name:`Vim Script`,aliases:[`vim`,`vimscript`],import:(()=>K(()=>import(`./_DvXPmvsu2.js`),[]))},{id:`vue`,name:`Vue`,import:(()=>K(()=>import(`./_BeCpXzaO2.js`),__vite__mapDeps([112,2,3,1,9,11,15])))},{id:`vue-html`,name:`Vue HTML`,import:(()=>K(()=>import(`./_D_8pG7bS2.js`),__vite__mapDeps([113,2])))},{id:`vue-vine`,name:`Vue Vine`,import:(()=>K(()=>import(`./_D8RqMrGW2.js`),__vite__mapDeps([114,2,3,5,12,70,115])))},{id:`vyper`,name:`Vyper`,aliases:[`vy`],import:(()=>K(()=>import(`./_CgoNMtux2.js`),[]))},{id:`wasm`,name:`WebAssembly`,import:(()=>K(()=>import(`./_ByWQv1Qj2.js`),[]))},{id:`wenyan`,name:`Wenyan`,aliases:[`文言`],import:(()=>K(()=>import(`./_C8pVoKbM2.js`),[]))},{id:`wgsl`,name:`WGSL`,import:(()=>K(()=>import(`./_BsKzXJz42.js`),[]))},{id:`wikitext`,name:`Wikitext`,aliases:[`mediawiki`,`wiki`],import:(()=>K(()=>import(`./_ClFFjSW22.js`),[]))},{id:`wit`,name:`WebAssembly Interface Types`,import:(()=>K(()=>import(`./_DdvCle-K2.js`),[]))},{id:`wolfram`,name:`Wolfram`,aliases:[`wl`],import:(()=>K(()=>import(`./_DLL8P-h_2.js`),[]))},{id:`xml`,name:`XML`,import:(()=>K(()=>import(`./_753RhcUs.js`).then(e=>e.n),__vite__mapDeps([7,8])))},{id:`xsl`,name:`XSL`,import:(()=>K(()=>import(`./_DVIw_RgW2.js`),__vite__mapDeps([93,7,8])))},{id:`yaml`,name:`YAML`,aliases:[`yml`],import:(()=>K(()=>import(`./_RgPZr-u4.js`).then(e=>e.n),[]))},{id:`zenscript`,name:`ZenScript`,import:(()=>K(()=>import(`./_BnlCZFoB2.js`),[]))},{id:`zig`,name:`Zig`,import:(()=>K(()=>import(`./_CMLA9XwU2.js`),[]))}],dw=Object.fromEntries(uw.map(e=>[e.id,e.import])),fw=Object.fromEntries(uw.flatMap(e=>e.aliases?.map(t=>[t,e.import])||[])),pw={...dw,...fw},mw=Object.fromEntries([{id:`andromeeda`,displayName:`Andromeeda`,type:`dark`,import:(()=>K(()=>import(`./_vGVdxbeo2.js`),[]))},{id:`aurora-x`,displayName:`Aurora X`,type:`dark`,import:(()=>K(()=>import(`./_CDeNXAV0.js`),[]))},{id:`ayu-dark`,displayName:`Ayu Dark`,type:`dark`,import:(()=>K(()=>import(`./_DluEY0Gj.js`),[]))},{id:`ayu-light`,displayName:`Ayu Light`,type:`light`,import:(()=>K(()=>import(`./_C3h-C4tm.js`),[]))},{id:`ayu-mirage`,displayName:`Ayu Mirage`,type:`dark`,import:(()=>K(()=>import(`./_Bqwy1Gya.js`),[]))},{id:`catppuccin-frappe`,displayName:`Catppuccin Frappé`,type:`dark`,import:(()=>K(()=>import(`./_C9Q5zVZY.js`),[]))},{id:`catppuccin-latte`,displayName:`Catppuccin Latte`,type:`light`,import:(()=>K(()=>import(`./_CtsyrtPq.js`),[]))},{id:`catppuccin-macchiato`,displayName:`Catppuccin Macchiato`,type:`dark`,import:(()=>K(()=>import(`./_R8nAf1vR.js`),[]))},{id:`catppuccin-mocha`,displayName:`Catppuccin Mocha`,type:`dark`,import:(()=>K(()=>import(`./_DjuaAJKi.js`),[]))},{id:`dark-plus`,displayName:`Dark Plus`,type:`dark`,import:(()=>K(()=>import(`./_Cs2F2srj.js`),[]))},{id:`dracula`,displayName:`Dracula Theme`,type:`dark`,import:(()=>K(()=>import(`./_BHWKrbxM.js`),[]))},{id:`dracula-soft`,displayName:`Dracula Theme Soft`,type:`dark`,import:(()=>K(()=>import(`./_5eyTD99u.js`),[]))},{id:`everforest-dark`,displayName:`Everforest Dark`,type:`dark`,import:(()=>K(()=>import(`./_sB-x3p7T.js`),[]))},{id:`everforest-light`,displayName:`Everforest Light`,type:`light`,import:(()=>K(()=>import(`./_Df2xbC6M.js`),[]))},{id:`github-dark`,displayName:`GitHub Dark`,type:`dark`,import:(()=>K(()=>import(`./_C-LZuMrd.js`),[]))},{id:`github-dark-default`,displayName:`GitHub Dark Default`,type:`dark`,import:(()=>K(()=>import(`./_DXG-b-1a.js`),[]))},{id:`github-dark-dimmed`,displayName:`GitHub Dark Dimmed`,type:`dark`,import:(()=>K(()=>import(`./_Bx1FflLF.js`),[]))},{id:`github-dark-high-contrast`,displayName:`GitHub Dark High Contrast`,type:`dark`,import:(()=>K(()=>import(`./_B_tTalzw.js`),[]))},{id:`github-light`,displayName:`GitHub Light`,type:`light`,import:(()=>K(()=>import(`./_EUqPIrTm.js`),[]))},{id:`github-light-default`,displayName:`GitHub Light Default`,type:`light`,import:(()=>K(()=>import(`./_BXViO-2h.js`),[]))},{id:`github-light-high-contrast`,displayName:`GitHub Light High Contrast`,type:`light`,import:(()=>K(()=>import(`./_B68TUdTA.js`),[]))},{id:`gruvbox-dark-hard`,displayName:`Gruvbox Dark Hard`,type:`dark`,import:(()=>K(()=>import(`./_C820rvS2.js`),[]))},{id:`gruvbox-dark-medium`,displayName:`Gruvbox Dark Medium`,type:`dark`,import:(()=>K(()=>import(`./_BPjhmG05.js`),[]))},{id:`gruvbox-dark-soft`,displayName:`Gruvbox Dark Soft`,type:`dark`,import:(()=>K(()=>import(`./_MrdJrrXF.js`),[]))},{id:`gruvbox-light-hard`,displayName:`Gruvbox Light Hard`,type:`light`,import:(()=>K(()=>import(`./_BC_s9l72.js`),[]))},{id:`gruvbox-light-medium`,displayName:`Gruvbox Light Medium`,type:`light`,import:(()=>K(()=>import(`./_BAWPOn9u.js`),[]))},{id:`gruvbox-light-soft`,displayName:`Gruvbox Light Soft`,type:`light`,import:(()=>K(()=>import(`./_BSMLrYjP.js`),[]))},{id:`horizon`,displayName:`Horizon`,type:`dark`,import:(()=>K(()=>import(`./_CE9ld1lL.js`),[]))},{id:`horizon-bright`,displayName:`Horizon Bright`,type:`light`,import:(()=>K(()=>import(`./_DSNQnXHK.js`),[]))},{id:`houston`,displayName:`Houston`,type:`dark`,import:(()=>K(()=>import(`./_CsvMBhTu.js`),[]))},{id:`kanagawa-dragon`,displayName:`Kanagawa Dragon`,type:`dark`,import:(()=>K(()=>import(`./_Bozd7klA.js`),[]))},{id:`kanagawa-lotus`,displayName:`Kanagawa Lotus`,type:`light`,import:(()=>K(()=>import(`./_BmuOG9ZW.js`),[]))},{id:`kanagawa-wave`,displayName:`Kanagawa Wave`,type:`dark`,import:(()=>K(()=>import(`./_BML5mF2J.js`),[]))},{id:`laserwave`,displayName:`LaserWave`,type:`dark`,import:(()=>K(()=>import(`./_C_8bwKvT.js`),[]))},{id:`light-plus`,displayName:`Light Plus`,type:`light`,import:(()=>K(()=>import(`./_DVQuIRkW.js`),[]))},{id:`material-theme`,displayName:`Material Theme`,type:`dark`,import:(()=>K(()=>import(`./_Bm3Qr25_2.js`),[]))},{id:`material-theme-darker`,displayName:`Material Theme Darker`,type:`dark`,import:(()=>K(()=>import(`./_2IIEA8gg.js`),[]))},{id:`material-theme-lighter`,displayName:`Material Theme Lighter`,type:`light`,import:(()=>K(()=>import(`./_uhdI0v04.js`),[]))},{id:`material-theme-ocean`,displayName:`Material Theme Ocean`,type:`dark`,import:(()=>K(()=>import(`./_CHQ94UKr.js`),[]))},{id:`material-theme-palenight`,displayName:`Material Theme Palenight`,type:`dark`,import:(()=>K(()=>import(`./_B5W6OYN7.js`),[]))},{id:`min-dark`,displayName:`Min Dark`,type:`dark`,import:(()=>K(()=>import(`./_BSWPekZh2.js`),[]))},{id:`min-light`,displayName:`Min Light`,type:`light`,import:(()=>K(()=>import(`./_DDpmG2fV2.js`),[]))},{id:`monokai`,displayName:`Monokai`,type:`dark`,import:(()=>K(()=>import(`./_B_bV9PQ92.js`),[]))},{id:`night-owl`,displayName:`Night Owl`,type:`dark`,import:(()=>K(()=>import(`./_DhmEMT882.js`),[]))},{id:`night-owl-light`,displayName:`Night Owl Light`,type:`light`,import:(()=>K(()=>import(`./_eJ-hLW7d2.js`),[]))},{id:`nord`,displayName:`Nord`,type:`dark`,import:(()=>K(()=>import(`./_Cb4Vim4T2.js`),[]))},{id:`one-dark-pro`,displayName:`One Dark Pro`,type:`dark`,import:(()=>K(()=>import(`./_CLwyXe_n2.js`),[]))},{id:`one-light`,displayName:`One Light`,type:`light`,import:(()=>K(()=>import(`./_D7Lr4KcI2.js`),[]))},{id:`plastic`,displayName:`Plastic`,type:`dark`,import:(()=>K(()=>import(`./_DQwYfKfQ2.js`),[]))},{id:`poimandres`,displayName:`Poimandres`,type:`dark`,import:(()=>K(()=>import(`./_DRFjx7u42.js`),[]))},{id:`red`,displayName:`Red`,type:`dark`,import:(()=>K(()=>import(`./_DX1BQOs82.js`),[]))},{id:`rose-pine`,displayName:`Rosé Pine`,type:`dark`,import:(()=>K(()=>import(`./_aMsaMD1D2.js`),[]))},{id:`rose-pine-dawn`,displayName:`Rosé Pine Dawn`,type:`light`,import:(()=>K(()=>import(`./_8PwUyIlP2.js`),[]))},{id:`rose-pine-moon`,displayName:`Rosé Pine Moon`,type:`dark`,import:(()=>K(()=>import(`./_DO-qXg-I2.js`),[]))},{id:`slack-dark`,displayName:`Slack Dark`,type:`dark`,import:(()=>K(()=>import(`./_DnToyrRv2.js`),[]))},{id:`slack-ochin`,displayName:`Slack Ochin`,type:`light`,import:(()=>K(()=>import(`./_B2OO5cIa2.js`),[]))},{id:`snazzy-light`,displayName:`Snazzy Light`,type:`light`,import:(()=>K(()=>import(`./_4G7pJPwS2.js`),[]))},{id:`solarized-dark`,displayName:`Solarized Dark`,type:`dark`,import:(()=>K(()=>import(`./_UdsmMDCL2.js`),[]))},{id:`solarized-light`,displayName:`Solarized Light`,type:`light`,import:(()=>K(()=>import(`./_C1IUL_tW2.js`),[]))},{id:`synthwave-84`,displayName:`Synthwave '84`,type:`dark`,import:(()=>K(()=>import(`./_nFMaYfgc2.js`),[]))},{id:`tokyo-night`,displayName:`Tokyo Night`,type:`dark`,import:(()=>K(()=>import(`./_oM2G3aXe2.js`),[]))},{id:`vesper`,displayName:`Vesper`,type:`dark`,import:(()=>K(()=>import(`./_DdrHHSXu2.js`),[]))},{id:`vitesse-black`,displayName:`Vitesse Black`,type:`dark`,import:(()=>K(()=>import(`./_fwtXNY1n2.js`),[]))},{id:`vitesse-dark`,displayName:`Vitesse Dark`,type:`dark`,import:(()=>K(()=>import(`./_BZCL-v6S2.js`),[]))},{id:`vitesse-light`,displayName:`Vitesse Light`,type:`light`,import:(()=>K(()=>import(`./_VbXTXTou2.js`),[]))}].map(e=>[e.id,e.import])),hw=t({createOnigurumaEngine:()=>Uw,getDefaultWasmLoader:()=>Hw,loadWasm:()=>Iw,setDefaultWasmLoader:()=>Vw}),gw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function _w(){return 2147483648}function vw(){return typeof performance<`u`?performance.now():Date.now()}var yw=(e,t)=>e+(t-e%t)%t;async function bw(e){let t,n,r={};function i(e){n=e,r.HEAPU8=new Uint8Array(e),r.HEAPU32=new Uint32Array(e)}function a(e,t,n){r.HEAPU8.copyWithin(e,t,t+n)}function o(e){try{return t.grow(e-n.byteLength+65535>>>16),i(t.buffer),1}catch{}}function s(e){let t=r.HEAPU8.length;e>>>=0;let n=_w();if(e>n)return!1;for(let r=1;r<=4;r*=2){let i=t*(1+.2/r);if(i=Math.min(i,e+100663296),o(Math.min(n,yw(Math.max(e,i),65536))))return!0}return!1}let c=typeof TextDecoder<`u`?new TextDecoder(`utf8`):void 0;function l(e,t,n=1024){let r=t+n,i=t;for(;e[i]&&!(i>=r);)++i;if(i-t>16&&e.buffer&&c)return c.decode(e.subarray(t,i));let a=``;for(;t<i;){let n=e[t++];if(!(n&128)){a+=String.fromCharCode(n);continue}let r=e[t++]&63;if((n&224)==192){a+=String.fromCharCode((n&31)<<6|r);continue}let i=e[t++]&63;if(n=(n&240)==224?(n&15)<<12|r<<6|i:(n&7)<<18|r<<12|i<<6|e[t++]&63,n<65536)a+=String.fromCharCode(n);else{let e=n-65536;a+=String.fromCharCode(55296|e>>10,56320|e&1023)}}return a}function u(e,t){return e?l(r.HEAPU8,e,t):``}let d={emscripten_get_now:vw,emscripten_memcpy_big:a,emscripten_resize_heap:s,fd_write:()=>0};async function f(){let n=await e({env:d,wasi_snapshot_preview1:d});t=n.memory,i(t.buffer),Object.assign(r,n),r.UTF8ToString=u}return await f(),r}var xw=Object.defineProperty,Sw=(e,t,n)=>t in e?xw(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,Cw=(e,t,n)=>Sw(e,typeof t==`symbol`?t:t+``,n),ww=null;function Tw(e){throw new gw(e.UTF8ToString(e.getLastOnigError()))}var Ew=class e{constructor(t){Cw(this,`utf16Length`),Cw(this,`utf8Length`),Cw(this,`utf16Value`),Cw(this,`utf8Value`),Cw(this,`utf16OffsetToUtf8`),Cw(this,`utf8OffsetToUtf16`);let n=t.length,r=e._utf8ByteLength(t),i=r!==n,a=i?new Uint32Array(n+1):null;i&&(a[n]=r);let o=i?new Uint32Array(r+1):null;i&&(o[r]=n);let s=new Uint8Array(r),c=0;for(let e=0;e<n;e++){let r=t.charCodeAt(e),l=r,u=!1;if(r>=55296&&r<=56319&&e+1<n){let n=t.charCodeAt(e+1);n>=56320&&n<=57343&&(l=(r-55296<<10)+65536|n-56320,u=!0)}i&&(a[e]=c,u&&(a[e+1]=c),l<=127?o[c+0]=e:l<=2047?(o[c+0]=e,o[c+1]=e):l<=65535?(o[c+0]=e,o[c+1]=e,o[c+2]=e):(o[c+0]=e,o[c+1]=e,o[c+2]=e,o[c+3]=e)),l<=127?s[c++]=l:l<=2047?(s[c++]=192|(l&1984)>>>6,s[c++]=128|(l&63)>>>0):l<=65535?(s[c++]=224|(l&61440)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0):(s[c++]=240|(l&1835008)>>>18,s[c++]=128|(l&258048)>>>12,s[c++]=128|(l&4032)>>>6,s[c++]=128|(l&63)>>>0),u&&e++}this.utf16Length=n,this.utf8Length=r,this.utf16Value=t,this.utf8Value=s,this.utf16OffsetToUtf8=a,this.utf8OffsetToUtf16=o}static _utf8ByteLength(e){let t=0;for(let n=0,r=e.length;n<r;n++){let i=e.charCodeAt(n),a=i,o=!1;if(i>=55296&&i<=56319&&n+1<r){let t=e.charCodeAt(n+1);t>=56320&&t<=57343&&(a=(i-55296<<10)+65536|t-56320,o=!0)}t+=a<=127?1:a<=2047?2:a<=65535?3:4,o&&n++}return t}createString(e){let t=e.omalloc(this.utf8Length);return e.HEAPU8.set(this.utf8Value,t),t}},Dw=class e{constructor(t){if(Cw(this,`id`,++e.LAST_ID),Cw(this,`_onigBinding`),Cw(this,`content`),Cw(this,`utf16Length`),Cw(this,`utf8Length`),Cw(this,`utf16OffsetToUtf8`),Cw(this,`utf8OffsetToUtf16`),Cw(this,`ptr`),!ww)throw new gw(`Must invoke loadWasm first.`);this._onigBinding=ww,this.content=t;let n=new Ew(t);this.utf16Length=n.utf16Length,this.utf8Length=n.utf8Length,this.utf16OffsetToUtf8=n.utf16OffsetToUtf8,this.utf8OffsetToUtf16=n.utf8OffsetToUtf16,this.utf8Length<1e4&&!e._sharedPtrInUse?(e._sharedPtr||=ww.omalloc(1e4),e._sharedPtrInUse=!0,ww.HEAPU8.set(n.utf8Value,e._sharedPtr),this.ptr=e._sharedPtr):this.ptr=n.createString(ww)}convertUtf8OffsetToUtf16(e){return this.utf8OffsetToUtf16?e<0?0:e>this.utf8Length?this.utf16Length:this.utf8OffsetToUtf16[e]:e}convertUtf16OffsetToUtf8(e){return this.utf16OffsetToUtf8?e<0?0:e>this.utf16Length?this.utf8Length:this.utf16OffsetToUtf8[e]:e}dispose(){this.ptr===e._sharedPtr?e._sharedPtrInUse=!1:this._onigBinding.ofree(this.ptr)}};Cw(Dw,`LAST_ID`,0),Cw(Dw,`_sharedPtr`,0),Cw(Dw,`_sharedPtrInUse`,!1);var Ow=Dw,kw=class{constructor(e){if(Cw(this,`_onigBinding`),Cw(this,`_ptr`),!ww)throw new gw(`Must invoke loadWasm first.`);let t=[],n=[];for(let r=0,i=e.length;r<i;r++){let i=new Ew(e[r]);t[r]=i.createString(ww),n[r]=i.utf8Length}let r=ww.omalloc(4*e.length);ww.HEAPU32.set(t,r/4);let i=ww.omalloc(4*e.length);ww.HEAPU32.set(n,i/4);let a=ww.createOnigScanner(r,i,e.length);for(let n=0,r=e.length;n<r;n++)ww.ofree(t[n]);ww.ofree(i),ww.ofree(r),a===0&&Tw(ww),this._onigBinding=ww,this._ptr=a}dispose(){this._onigBinding.freeOnigScanner(this._ptr)}findNextMatchSync(e,t,n){let r=0;if(typeof n==`number`&&(r=n),typeof e==`string`){e=new Ow(e);let n=this._findNextMatchSync(e,t,!1,r);return e.dispose(),n}return this._findNextMatchSync(e,t,!1,r)}_findNextMatchSync(e,t,n,r){let i=this._onigBinding,a=i.findNextOnigScannerMatch(this._ptr,e.id,e.ptr,e.utf8Length,e.convertUtf16OffsetToUtf8(t),r);if(a===0)return null;let o=i.HEAPU32,s=a/4,c=o[s++],l=o[s++],u=[];for(let t=0;t<l;t++){let n=e.convertUtf8OffsetToUtf16(o[s++]),r=e.convertUtf8OffsetToUtf16(o[s++]);u[t]={start:n,end:r,length:r-n}}return{index:c,captureIndices:u}}};function Aw(e){return typeof e.instantiator==`function`}function jw(e){return typeof e.default==`function`}function Mw(e){return e.data!==void 0}function Nw(e){return typeof Response<`u`&&e instanceof Response}function Pw(e){return typeof ArrayBuffer<`u`&&(e instanceof ArrayBuffer||ArrayBuffer.isView(e))||typeof Buffer<`u`&&Buffer.isBuffer?.(e)||typeof SharedArrayBuffer<`u`&&e instanceof SharedArrayBuffer||typeof Uint32Array<`u`&&e instanceof Uint32Array}var Fw;function Iw(e){if(Fw)return Fw;async function t(){ww=await bw(async t=>{let n=e;return n=await n,typeof n==`function`&&(n=await n(t)),typeof n==`function`&&(n=await n(t)),Aw(n)?n=await n.instantiator(t):jw(n)?n=await n.default(t):(Mw(n)&&(n=n.data),Nw(n)?n=typeof WebAssembly.instantiateStreaming==`function`?await Rw(n)(t):await zw(n)(t):Pw(n)||n instanceof WebAssembly.Module?n=await Lw(n)(t):`default`in n&&n.default instanceof WebAssembly.Module&&(n=await Lw(n.default)(t))),`instance`in n&&(n=n.instance),`exports`in n&&(n=n.exports),n})}return Fw=t(),Fw}function Lw(e){return t=>WebAssembly.instantiate(e,t)}function Rw(e){return t=>WebAssembly.instantiateStreaming(e,t)}function zw(e){return async t=>{let n=await e.arrayBuffer();return WebAssembly.instantiate(n,t)}}var Bw;function Vw(e){Bw=e}function Hw(){return Bw}async function Uw(e){return e&&await Iw(e),{createScanner(e){return new kw(e.map(e=>typeof e==`string`?e:e.source))},createString(e){return new Ow(e)}}}var Ww=iw({});ow(Ww,hw);var Gw=class extends Error{constructor(e){super(e),this.name=`ShikiError`}};function Kw(e){return qw(e)}function qw(e){return Array.isArray(e)?Jw(e):e instanceof RegExp?e:typeof e==`object`?Yw(e):e}function Jw(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=qw(e[n]);return t}function Yw(e){let t={};for(let n in e)t[n]=qw(e[n]);return t}function Xw(e,...t){return t.forEach(t=>{for(let n in t)e[n]=t[n]}),e}function Zw(e){let t=~e.lastIndexOf(`/`)||~e.lastIndexOf(`\\`);return t===0?e:~t===e.length-1?Zw(e.substring(0,e.length-1)):e.substr(~t+1)}var Qw=/\$(\d+)|\${(\d+):\/(downcase|upcase)}/g,$w=class{static hasCaptures(e){return e!==null&&(Qw.lastIndex=0,Qw.test(e))}static replaceCaptures(e,t,n){return e.replace(Qw,(e,r,i,a)=>{let o=n[parseInt(r||i,10)];if(o){let e=t.substring(o.start,o.end);for(;e[0]===`.`;)e=e.substring(1);switch(a){case`downcase`:return e.toLowerCase();case`upcase`:return e.toUpperCase();default:return e}}else return e})}};function eT(e,t){return e<t?-1:+(e>t)}function tT(e,t){if(e===null&&t===null)return 0;if(!e)return-1;if(!t)return 1;let n=e.length,r=t.length;if(n===r){for(let r=0;r<n;r++){let n=eT(e[r],t[r]);if(n!==0)return n}return 0}return n-r}function nT(e){return!!(/^#[0-9a-f]{6}$/i.test(e)||/^#[0-9a-f]{8}$/i.test(e)||/^#[0-9a-f]{3}$/i.test(e)||/^#[0-9a-f]{4}$/i.test(e))}function rT(e){return e.replace(/[\-\\\{\}\*\+\?\|\^\$\.\,\[\]\(\)\#\s]/g,`\\$&`)}var iT=class{constructor(e){this.fn=e}cache=new Map;get(e){if(this.cache.has(e))return this.cache.get(e);let t=this.fn(e);return this.cache.set(e,t),t}},aT=class{constructor(e,t,n){this._colorMap=e,this._defaults=t,this._root=n}static createFromRawTheme(e,t){return this.createFromParsedTheme(uT(e),t)}static createFromParsedTheme(e,t){return pT(e,t)}_cachedMatchRoot=new iT(e=>this._root.match(e));getColorMap(){return this._colorMap.getColorMap()}getDefaults(){return this._defaults}match(e){if(e===null)return this._defaults;let t=e.scopeName,n=this._cachedMatchRoot.get(t).find(t=>sT(e.parent,t.parentScopes));return n?new lT(n.fontStyle,n.foreground,n.background):null}},oT=class e{constructor(e,t){this.parent=e,this.scopeName=t}static push(t,n){for(let r of n)t=new e(t,r);return t}static from(...t){let n=null;for(let r=0;r<t.length;r++)n=new e(n,t[r]);return n}push(t){return new e(this,t)}getSegments(){let e=this,t=[];for(;e;)t.push(e.scopeName),e=e.parent;return t.reverse(),t}toString(){return this.getSegments().join(` `)}extends(e){return this===e||this.parent!==null&&this.parent.extends(e)}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push(n.scopeName),n=n.parent;return n===e?t.reverse():void 0}};function sT(e,t){if(t.length===0)return!0;for(let n=0;n<t.length;n++){let r=t[n],i=!1;if(r===`>`){if(n===t.length-1)return!1;r=t[++n],i=!0}for(;e&&!cT(e.scopeName,r);){if(i)return!1;e=e.parent}if(!e)return!1;e=e.parent}return!0}function cT(e,t){return t===e||e.startsWith(t)&&e[t.length]===`.`}var lT=class{constructor(e,t,n){this.fontStyle=e,this.foregroundId=t,this.backgroundId=n}};function uT(e){if(!e||!e.settings||!Array.isArray(e.settings))return[];let t=e.settings,n=[],r=0;for(let e=0,i=t.length;e<i;e++){let i=t[e];if(!i.settings)continue;let a;if(typeof i.scope==`string`){let e=i.scope;e=e.replace(/^[,]+/,``),e=e.replace(/[,]+$/,``),a=e.split(`,`)}else a=Array.isArray(i.scope)?i.scope:[``];let o=-1;if(typeof i.settings.fontStyle==`string`){o=0;let e=i.settings.fontStyle.split(` `);for(let t=0,n=e.length;t<n;t++)switch(e[t]){case`italic`:o|=1;break;case`bold`:o|=2;break;case`underline`:o|=4;break;case`strikethrough`:o|=8}}let s=null;typeof i.settings.foreground==`string`&&nT(i.settings.foreground)&&(s=i.settings.foreground);let c=null;typeof i.settings.background==`string`&&nT(i.settings.background)&&(c=i.settings.background);for(let t=0,i=a.length;t<i;t++){let i=a[t].trim().split(` `),l=i[i.length-1],u=null;i.length>1&&(u=i.slice(0,i.length-1),u.reverse()),n[r++]=new dT(l,u,e,o,s,c)}}return n}var dT=class{constructor(e,t,n,r,i,a){this.scope=e,this.parentScopes=t,this.index=n,this.fontStyle=r,this.foreground=i,this.background=a}},fT=(e=>(e[e.NotSet=-1]=`NotSet`,e[e.None=0]=`None`,e[e.Italic=1]=`Italic`,e[e.Bold=2]=`Bold`,e[e.Underline=4]=`Underline`,e[e.Strikethrough=8]=`Strikethrough`,e))(fT||{});function pT(e,t){e.sort((e,t)=>{let n=eT(e.scope,t.scope);return n!==0||(n=tT(e.parentScopes,t.parentScopes),n!==0)?n:e.index-t.index});let n=0,r=`#000000`,i=`#ffffff`;for(;e.length>=1&&e[0].scope===``;){let t=e.shift();t.fontStyle!==-1&&(n=t.fontStyle),t.foreground!==null&&(r=t.foreground),t.background!==null&&(i=t.background)}let a=new mT(t),o=new lT(n,a.getId(r),a.getId(i)),s=new _T(new gT(0,null,-1,0,0),[]);for(let t=0,n=e.length;t<n;t++){let n=e[t];s.insert(0,n.scope,n.parentScopes,n.fontStyle,a.getId(n.foreground),a.getId(n.background))}return new aT(a,o,s)}var mT=class{_isFrozen;_lastColorId;_id2color;_color2id;constructor(e){if(this._lastColorId=0,this._id2color=[],this._color2id=Object.create(null),Array.isArray(e)){this._isFrozen=!0;for(let t=0,n=e.length;t<n;t++)this._color2id[e[t]]=t,this._id2color[t]=e[t]}else this._isFrozen=!1}getId(e){if(e===null)return 0;e=e.toUpperCase();let t=this._color2id[e];if(t)return t;if(this._isFrozen)throw Error(`Missing color in color map - ${e}`);return t=++this._lastColorId,this._color2id[e]=t,this._id2color[t]=e,t}getColorMap(){return this._id2color.slice(0)}},hT=Object.freeze([]),gT=class e{scopeDepth;parentScopes;fontStyle;foreground;background;constructor(e,t,n,r,i){this.scopeDepth=e,this.parentScopes=t||hT,this.fontStyle=n,this.foreground=r,this.background=i}clone(){return new e(this.scopeDepth,this.parentScopes,this.fontStyle,this.foreground,this.background)}static cloneArr(e){let t=[];for(let n=0,r=e.length;n<r;n++)t[n]=e[n].clone();return t}acceptOverwrite(e,t,n,r){this.scopeDepth>e?console.log(`how did this happen?`):this.scopeDepth=e,t!==-1&&(this.fontStyle=t),n!==0&&(this.foreground=n),r!==0&&(this.background=r)}},_T=class e{constructor(e,t=[],n={}){this._mainRule=e,this._children=n,this._rulesWithParentScopes=t}_rulesWithParentScopes;static _cmpBySpecificity(e,t){if(e.scopeDepth!==t.scopeDepth)return t.scopeDepth-e.scopeDepth;let n=0,r=0;for(;e.parentScopes[n]===`>`&&n++,t.parentScopes[r]===`>`&&r++,!(n>=e.parentScopes.length||r>=t.parentScopes.length);){let i=t.parentScopes[r].length-e.parentScopes[n].length;if(i!==0)return i;n++,r++}return t.parentScopes.length-e.parentScopes.length}match(t){if(t!==``){let e=t.indexOf(`.`),n,r;if(e===-1?(n=t,r=``):(n=t.substring(0,e),r=t.substring(e+1)),this._children.hasOwnProperty(n))return this._children[n].match(r)}let n=this._rulesWithParentScopes.concat(this._mainRule);return n.sort(e._cmpBySpecificity),n}insert(t,n,r,i,a,o){if(n===``){this._doInsertHere(t,r,i,a,o);return}let s=n.indexOf(`.`),c,l;s===-1?(c=n,l=``):(c=n.substring(0,s),l=n.substring(s+1));let u;this._children.hasOwnProperty(c)?u=this._children[c]:(u=new e(this._mainRule.clone(),gT.cloneArr(this._rulesWithParentScopes)),this._children[c]=u),u.insert(t+1,l,r,i,a,o)}_doInsertHere(e,t,n,r,i){if(t===null){this._mainRule.acceptOverwrite(e,n,r,i);return}for(let a=0,o=this._rulesWithParentScopes.length;a<o;a++){let o=this._rulesWithParentScopes[a];if(tT(o.parentScopes,t)===0){o.acceptOverwrite(e,n,r,i);return}}n===-1&&(n=this._mainRule.fontStyle),r===0&&(r=this._mainRule.foreground),i===0&&(i=this._mainRule.background),this._rulesWithParentScopes.push(new gT(e,t,n,r,i))}},vT=class e{static toBinaryStr(e){return e.toString(2).padStart(32,`0`)}static print(t){let n=e.getLanguageId(t),r=e.getTokenType(t),i=e.getFontStyle(t),a=e.getForeground(t),o=e.getBackground(t);console.log({languageId:n,tokenType:r,fontStyle:i,foreground:a,background:o})}static getLanguageId(e){return(e&255)>>>0}static getTokenType(e){return(e&768)>>>8}static containsBalancedBrackets(e){return!!(e&1024)}static getFontStyle(e){return(e&30720)>>>11}static getForeground(e){return(e&16744448)>>>15}static getBackground(e){return(e&4278190080)>>>24}static set(t,n,r,i,a,o,s){let c=e.getLanguageId(t),l=e.getTokenType(t),u=+!!e.containsBalancedBrackets(t),d=e.getFontStyle(t),f=e.getForeground(t),p=e.getBackground(t);return n!==0&&(c=n),r!==8&&(l=bT(r)),i!==null&&(u=+!!i),a!==-1&&(d=a),o!==0&&(f=o),s!==0&&(p=s),(c<<0|l<<8|u<<10|d<<11|f<<15|p<<24)>>>0}};function yT(e){return e}function bT(e){return e}function xT(e,t){let n=[],r=CT(e),i=r.next();for(;i!==null;){let e=0;if(i.length===2&&i.charAt(1)===`:`){switch(i.charAt(0)){case`R`:e=1;break;case`L`:e=-1;break;default:console.log(`Unknown priority ${i} in scope selector`)}i=r.next()}let t=o();if(n.push({matcher:t,priority:e}),i!==`,`)break;i=r.next()}return n;function a(){if(i===`-`){i=r.next();let e=a();return t=>!!e&&!e(t)}if(i===`(`){i=r.next();let e=s();return i===`)`&&(i=r.next()),e}if(ST(i)){let e=[];do e.push(i),i=r.next();while(ST(i));return n=>t(e,n)}return null}function o(){let e=[],t=a();for(;t;)e.push(t),t=a();return t=>e.every(e=>e(t))}function s(){let e=[],t=o();for(;t&&(e.push(t),i===`|`||i===`,`);){do i=r.next();while(i===`|`||i===`,`);t=o()}return t=>e.some(e=>e(t))}}function ST(e){return!!e&&!!e.match(/[\w\.:]+/)}function CT(e){let t=/([LR]:|[\w\.:][\w\.:\-]*|[\,\|\-\(\)])/g,n=t.exec(e);return{next:()=>{if(!n)return null;let r=n[0];return n=t.exec(e),r}}}function wT(e){typeof e.dispose==`function`&&e.dispose()}var TT=class{constructor(e){this.scopeName=e}toKey(){return this.scopeName}},ET=class{constructor(e,t){this.scopeName=e,this.ruleName=t}toKey(){return`${this.scopeName}#${this.ruleName}`}},DT=class{_references=[];_seenReferenceKeys=new Set;get references(){return this._references}visitedRule=new Set;add(e){let t=e.toKey();this._seenReferenceKeys.has(t)||(this._seenReferenceKeys.add(t),this._references.push(e))}},OT=class{constructor(e,t){this.repo=e,this.initialScopeName=t,this.seenFullScopeRequests.add(this.initialScopeName),this.Q=[new TT(this.initialScopeName)]}seenFullScopeRequests=new Set;seenPartialScopeRequests=new Set;Q;processQueue(){let e=this.Q;this.Q=[];let t=new DT;for(let n of e)kT(n,this.initialScopeName,this.repo,t);for(let e of t.references)if(e instanceof TT){if(this.seenFullScopeRequests.has(e.scopeName))continue;this.seenFullScopeRequests.add(e.scopeName),this.Q.push(e)}else{if(this.seenFullScopeRequests.has(e.scopeName)||this.seenPartialScopeRequests.has(e.toKey()))continue;this.seenPartialScopeRequests.add(e.toKey()),this.Q.push(e)}}};function kT(e,t,n,r){let i=n.lookup(e.scopeName);if(!i){if(e.scopeName===t)throw Error(`No grammar provided for <${t}>`);return}let a=n.lookup(t);e instanceof TT?jT({baseGrammar:a,selfGrammar:i},r):AT(e.ruleName,{baseGrammar:a,selfGrammar:i,repository:i.repository},r);let o=n.injections(e.scopeName);if(o)for(let e of o)r.add(new TT(e))}function AT(e,t,n){if(t.repository&&t.repository[e]){let r=t.repository[e];MT([r],t,n)}}function jT(e,t){e.selfGrammar.patterns&&Array.isArray(e.selfGrammar.patterns)&&MT(e.selfGrammar.patterns,{...e,repository:e.selfGrammar.repository},t),e.selfGrammar.injections&&MT(Object.values(e.selfGrammar.injections),{...e,repository:e.selfGrammar.repository},t)}function MT(e,t,n){for(let r of e){if(n.visitedRule.has(r))continue;n.visitedRule.add(r);let e=r.repository?Xw({},t.repository,r.repository):t.repository;Array.isArray(r.patterns)&&MT(r.patterns,{...t,repository:e},n);let i=r.include;if(!i)continue;let a=RT(i);switch(a.kind){case 0:jT({...t,selfGrammar:t.baseGrammar},n);break;case 1:jT(t,n);break;case 2:AT(a.ruleName,{...t,repository:e},n);break;case 3:case 4:let r=a.scopeName===t.selfGrammar.scopeName?t.selfGrammar:a.scopeName===t.baseGrammar.scopeName?t.baseGrammar:void 0;if(r){let i={baseGrammar:t.baseGrammar,selfGrammar:r,repository:e};a.kind===4?AT(a.ruleName,i,n):jT(i,n)}else a.kind===4?n.add(new ET(a.scopeName,a.ruleName)):n.add(new TT(a.scopeName))}}}var NT=class{kind=0},PT=class{kind=1},FT=class{constructor(e){this.ruleName=e}kind=2},IT=class{constructor(e){this.scopeName=e}kind=3},LT=class{constructor(e,t){this.scopeName=e,this.ruleName=t}kind=4};function RT(e){if(e===`$base`)return new NT;if(e===`$self`)return new PT;let t=e.indexOf(`#`);return t===-1?new IT(e):t===0?new FT(e.substring(1)):new LT(e.substring(0,t),e.substring(t+1))}var zT=/\\(\d+)/,BT=/\\(\d+)/g,VT=-1,HT=-2;function UT(e){return e}function WT(e){return e}var GT=class{$location;id;_nameIsCapturing;_name;_contentNameIsCapturing;_contentName;constructor(e,t,n,r){this.$location=e,this.id=t,this._name=n||null,this._nameIsCapturing=$w.hasCaptures(this._name),this._contentName=r||null,this._contentNameIsCapturing=$w.hasCaptures(this._contentName)}get debugName(){let e=this.$location?`${Zw(this.$location.filename)}:${this.$location.line}`:`unknown`;return`${this.constructor.name}#${this.id} @ ${e}`}getName(e,t){return!this._nameIsCapturing||this._name===null||e===null||t===null?this._name:$w.replaceCaptures(this._name,e,t)}getContentName(e,t){return!this._contentNameIsCapturing||this._contentName===null?this._contentName:$w.replaceCaptures(this._contentName,e,t)}},KT=class extends GT{retokenizeCapturedWithRuleId;constructor(e,t,n,r,i){super(e,t,n,r),this.retokenizeCapturedWithRuleId=i}dispose(){}collectPatterns(e,t){throw Error(`Not supported!`)}compile(e,t){throw Error(`Not supported!`)}compileAG(e,t,n,r){throw Error(`Not supported!`)}},qT=class extends GT{_match;captures;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,null),this._match=new QT(r,this.id),this.captures=i,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugMatchRegExp(){return`${this._match.source}`}collectPatterns(e,t){t.push(this._match)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $T,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},JT=class extends GT{hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i){super(e,t,n,r),this.patterns=i.patterns,this.hasMissingPatterns=i.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}collectPatterns(e,t){for(let n of this.patterns)e.getRule(n).collectPatterns(e,t)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){return this._cachedCompiledPatterns||(this._cachedCompiledPatterns=new $T,this.collectPatterns(e,this._cachedCompiledPatterns)),this._cachedCompiledPatterns}},YT=class extends GT{_begin;beginCaptures;_end;endHasBackReferences;endCaptures;applyEndPatternLast;hasMissingPatterns;patterns;_cachedCompiledPatterns;constructor(e,t,n,r,i,a,o,s,c,l){super(e,t,n,r),this._begin=new QT(i,this.id),this.beginCaptures=a,this._end=new QT(o||``,-1),this.endHasBackReferences=this._end.hasBackReferences,this.endCaptures=s,this.applyEndPatternLast=c||!1,this.patterns=l.patterns,this.hasMissingPatterns=l.hasMissingPatterns,this._cachedCompiledPatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugEndRegExp(){return`${this._end.source}`}getEndWithResolvedBackReferences(e,t){return this._end.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e,t).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e,t).compileAG(e,n,r)}_getCachedCompiledPatterns(e,t){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $T;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns);this.applyEndPatternLast?this._cachedCompiledPatterns.push(this._end.hasBackReferences?this._end.clone():this._end):this._cachedCompiledPatterns.unshift(this._end.hasBackReferences?this._end.clone():this._end)}return this._end.hasBackReferences&&(this.applyEndPatternLast?this._cachedCompiledPatterns.setSource(this._cachedCompiledPatterns.length()-1,t):this._cachedCompiledPatterns.setSource(0,t)),this._cachedCompiledPatterns}},XT=class extends GT{_begin;beginCaptures;whileCaptures;_while;whileHasBackReferences;hasMissingPatterns;patterns;_cachedCompiledPatterns;_cachedCompiledWhilePatterns;constructor(e,t,n,r,i,a,o,s,c){super(e,t,n,r),this._begin=new QT(i,this.id),this.beginCaptures=a,this.whileCaptures=s,this._while=new QT(o,HT),this.whileHasBackReferences=this._while.hasBackReferences,this.patterns=c.patterns,this.hasMissingPatterns=c.hasMissingPatterns,this._cachedCompiledPatterns=null,this._cachedCompiledWhilePatterns=null}dispose(){this._cachedCompiledPatterns&&=(this._cachedCompiledPatterns.dispose(),null),this._cachedCompiledWhilePatterns&&=(this._cachedCompiledWhilePatterns.dispose(),null)}get debugBeginRegExp(){return`${this._begin.source}`}get debugWhileRegExp(){return`${this._while.source}`}getWhileWithResolvedBackReferences(e,t){return this._while.resolveBackReferences(e,t)}collectPatterns(e,t){t.push(this._begin)}compile(e,t){return this._getCachedCompiledPatterns(e).compile(e)}compileAG(e,t,n,r){return this._getCachedCompiledPatterns(e).compileAG(e,n,r)}_getCachedCompiledPatterns(e){if(!this._cachedCompiledPatterns){this._cachedCompiledPatterns=new $T;for(let t of this.patterns)e.getRule(t).collectPatterns(e,this._cachedCompiledPatterns)}return this._cachedCompiledPatterns}compileWhile(e,t){return this._getCachedCompiledWhilePatterns(e,t).compile(e)}compileWhileAG(e,t,n,r){return this._getCachedCompiledWhilePatterns(e,t).compileAG(e,n,r)}_getCachedCompiledWhilePatterns(e,t){return this._cachedCompiledWhilePatterns||(this._cachedCompiledWhilePatterns=new $T,this._cachedCompiledWhilePatterns.push(this._while.hasBackReferences?this._while.clone():this._while)),this._while.hasBackReferences&&this._cachedCompiledWhilePatterns.setSource(0,t||``),this._cachedCompiledWhilePatterns}},ZT=class e{static createCaptureRule(e,t,n,r,i){return e.registerRule(e=>new KT(t,e,n,r,i))}static getCompiledRuleId(t,n,r){return t.id||n.registerRule(i=>{if(t.id=i,t.match)return new qT(t.$vscodeTextmateLocation,t.id,t.name,t.match,e._compileCaptures(t.captures,n,r));if(t.begin===void 0){t.repository&&(r=Xw({},r,t.repository));let i=t.patterns;return i===void 0&&t.include&&(i=[{include:t.include}]),new JT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,e._compilePatterns(i,n,r))}return t.while?new XT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.while,e._compileCaptures(t.whileCaptures||t.captures,n,r),e._compilePatterns(t.patterns,n,r)):new YT(t.$vscodeTextmateLocation,t.id,t.name,t.contentName,t.begin,e._compileCaptures(t.beginCaptures||t.captures,n,r),t.end,e._compileCaptures(t.endCaptures||t.captures,n,r),t.applyEndPatternLast,e._compilePatterns(t.patterns,n,r))}),t.id}static _compileCaptures(t,n,r){let i=[];if(t){let a=0;for(let e in t){if(e===`$vscodeTextmateLocation`)continue;let t=parseInt(e,10);t>a&&(a=t)}for(let e=0;e<=a;e++)i[e]=null;for(let a in t){if(a===`$vscodeTextmateLocation`)continue;let o=parseInt(a,10),s=0;t[a].patterns&&(s=e.getCompiledRuleId(t[a],n,r)),i[o]=e.createCaptureRule(n,t[a].$vscodeTextmateLocation,t[a].name,t[a].contentName,s)}}return i}static _compilePatterns(t,n,r){let i=[];if(t)for(let a=0,o=t.length;a<o;a++){let o=t[a],s=-1;if(o.include){let t=RT(o.include);switch(t.kind){case 0:case 1:s=e.getCompiledRuleId(r[o.include],n,r);break;case 2:let i=r[t.ruleName];i&&(s=e.getCompiledRuleId(i,n,r));break;case 3:case 4:let a=t.scopeName,c=t.kind===4?t.ruleName:null,l=n.getExternalGrammar(a,r);if(l){if(c){let t=l.repository[c];t&&(s=e.getCompiledRuleId(t,n,l.repository))}else s=e.getCompiledRuleId(l.repository.$self,n,l.repository)}}}else s=e.getCompiledRuleId(o,n,r);if(s!==-1){let e=n.getRule(s),t=!1;if((e instanceof JT||e instanceof YT||e instanceof XT)&&e.hasMissingPatterns&&e.patterns.length===0&&(t=!0),t)continue;i.push(s)}}return{patterns:i,hasMissingPatterns:(t?t.length:0)!==i.length}}},QT=class e{source;ruleId;hasAnchor;hasBackReferences;_anchorCache;constructor(e,t){if(e&&typeof e==`string`){let t=e.length,n=0,r=[],i=!1;for(let a=0;a<t;a++)if(e.charAt(a)===`\\`&&a+1<t){let t=e.charAt(a+1);t===`z`?(r.push(e.substring(n,a)),r.push(`$(?!\\n)(?<!\\n)`),n=a+2):(t===`A`||t===`G`)&&(i=!0),a++}this.hasAnchor=i,n===0?this.source=e:(r.push(e.substring(n,t)),this.source=r.join(``))}else this.hasAnchor=!1,this.source=e;this._anchorCache=this.hasAnchor?this._buildAnchorCache():null,this.ruleId=t,this.hasBackReferences=typeof this.source==`string`&&zT.test(this.source)}clone(){return new e(this.source,this.ruleId)}setSource(e){this.source!==e&&(this.source=e,this.hasAnchor&&(this._anchorCache=this._buildAnchorCache()))}resolveBackReferences(e,t){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let n=t.map(t=>e.substring(t.start,t.end));return BT.lastIndex=0,this.source.replace(BT,(e,t)=>rT(n[parseInt(t,10)]||``))}_buildAnchorCache(){if(typeof this.source!=`string`)throw Error(`This method should only be called if the source is a string`);let e=[],t=[],n=[],r=[],i,a,o,s;for(i=0,a=this.source.length;i<a;i++)o=this.source.charAt(i),e[i]=o,t[i]=o,n[i]=o,r[i]=o,o===`\\`&&i+1<a&&(s=this.source.charAt(i+1),s===`A`?(e[i+1]=``,t[i+1]=``,n[i+1]=`A`,r[i+1]=`A`):s===`G`?(e[i+1]=``,t[i+1]=`G`,n[i+1]=``,r[i+1]=`G`):(e[i+1]=s,t[i+1]=s,n[i+1]=s,r[i+1]=s),i++);return{A0_G0:e.join(``),A0_G1:t.join(``),A1_G0:n.join(``),A1_G1:r.join(``)}}resolveAnchors(e,t){return!this.hasAnchor||!this._anchorCache||typeof this.source!=`string`?this.source:e?t?this._anchorCache.A1_G1:this._anchorCache.A1_G0:t?this._anchorCache.A0_G1:this._anchorCache.A0_G0}},$T=class{_items;_hasAnchors;_cached;_anchorCache;constructor(){this._items=[],this._hasAnchors=!1,this._cached=null,this._anchorCache={A0_G0:null,A0_G1:null,A1_G0:null,A1_G1:null}}dispose(){this._disposeCaches()}_disposeCaches(){this._cached&&=(this._cached.dispose(),null),this._anchorCache.A0_G0&&(this._anchorCache.A0_G0.dispose(),this._anchorCache.A0_G0=null),this._anchorCache.A0_G1&&(this._anchorCache.A0_G1.dispose(),this._anchorCache.A0_G1=null),this._anchorCache.A1_G0&&(this._anchorCache.A1_G0.dispose(),this._anchorCache.A1_G0=null),this._anchorCache.A1_G1&&(this._anchorCache.A1_G1.dispose(),this._anchorCache.A1_G1=null)}push(e){this._items.push(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}unshift(e){this._items.unshift(e),this._hasAnchors=this._hasAnchors||e.hasAnchor}length(){return this._items.length}setSource(e,t){this._items[e].source!==t&&(this._disposeCaches(),this._items[e].setSource(t))}compile(e){if(!this._cached){let t=this._items.map(e=>e.source);this._cached=new eE(e,t,this._items.map(e=>e.ruleId))}return this._cached}compileAG(e,t,n){return this._hasAnchors?t?n?(this._anchorCache.A1_G1||(this._anchorCache.A1_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G1):(this._anchorCache.A1_G0||(this._anchorCache.A1_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A1_G0):n?(this._anchorCache.A0_G1||(this._anchorCache.A0_G1=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G1):(this._anchorCache.A0_G0||(this._anchorCache.A0_G0=this._resolveAnchors(e,t,n)),this._anchorCache.A0_G0):this.compile(e)}_resolveAnchors(e,t,n){return new eE(e,this._items.map(e=>e.resolveAnchors(t,n)),this._items.map(e=>e.ruleId))}},eE=class{constructor(e,t,n){this.regExps=t,this.rules=n,this.scanner=e.createOnigScanner(t)}scanner;dispose(){typeof this.scanner.dispose==`function`&&this.scanner.dispose()}toString(){let e=[];for(let t=0,n=this.rules.length;t<n;t++)e.push(` - `+this.rules[t]+`: `+this.regExps[t]);return e.join(`
|
|
37
|
+
`)}findNextMatchSync(e,t,n){let r=this.scanner.findNextMatchSync(e,t,n);return r?{ruleId:this.rules[r.index],captureIndices:r.captureIndices}:null}},tE=class{constructor(e,t){this.languageId=e,this.tokenType=t}},nE=class e{_defaultAttributes;_embeddedLanguagesMatcher;constructor(e,t){this._defaultAttributes=new tE(e,8),this._embeddedLanguagesMatcher=new rE(Object.entries(t||{}))}getDefaultAttributes(){return this._defaultAttributes}getBasicScopeAttributes(t){return t===null?e._NULL_SCOPE_METADATA:this._getBasicScopeAttributes.get(t)}static _NULL_SCOPE_METADATA=new tE(0,0);_getBasicScopeAttributes=new iT(e=>new tE(this._scopeToLanguage(e),this._toStandardTokenType(e)));_scopeToLanguage(e){return this._embeddedLanguagesMatcher.match(e)||0}_toStandardTokenType(t){let n=t.match(e.STANDARD_TOKEN_TYPE_REGEXP);if(!n)return 8;switch(n[1]){case`comment`:return 1;case`string`:return 2;case`regex`:return 3;case`meta.embedded`:return 0}throw Error(`Unexpected match for standard token type!`)}static STANDARD_TOKEN_TYPE_REGEXP=/\b(comment|string|regex|meta\.embedded)\b/},rE=class{values;scopesRegExp;constructor(e){if(e.length===0)this.values=null,this.scopesRegExp=null;else{this.values=new Map(e);let t=e.map(([e,t])=>rT(e));t.sort(),t.reverse(),this.scopesRegExp=RegExp(`^((${t.join(`)|(`)}))($|\\.)`,``)}}match(e){if(!this.scopesRegExp)return;let t=e.match(this.scopesRegExp);if(t)return this.values.get(t[1])}};typeof process<`u`&&{}.VSCODE_TEXTMATE_DEBUG;var iE=class{constructor(e,t){this.stack=e,this.stoppedEarly=t}};function aE(e,t,n,r,i,a,o,s){let c=t.content.length,l=!1,u=-1;if(o){let o=oE(e,t,n,r,i,a);i=o.stack,r=o.linePos,n=o.isFirstLine,u=o.anchorPosition}let d=Date.now();for(;!l;){if(s!==0&&Date.now()-d>s)return new iE(i,!0);f()}return new iE(i,!1);function f(){let o=sE(e,t,n,r,i,u);if(!o){a.produce(i,c),l=!0;return}let s=o.captureIndices,d=o.matchedRuleId,f=s&&s.length>0?s[0].end>r:!1;if(d===VT){let o=i.getRule(e);a.produce(i,s[0].start),i=i.withContentNameScopesList(i.nameScopesList),fE(e,t,n,i,a,o.endCaptures,s),a.produce(i,s[0].end);let d=i;if(i=i.parent,u=d.getAnchorPos(),!f&&d.getEnterPos()===r){i=d,a.produce(i,c),l=!0;return}}else{let o=e.getRule(d);a.produce(i,s[0].start);let p=i,m=o.getName(t.content,s),h=i.contentNameScopesList.pushAttributed(m,e);if(i=i.push(d,r,u,s[0].end===c,null,h,h),o instanceof YT){let r=o;fE(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.endHasBackReferences&&(i=i.withEndRule(r.getEndWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(o instanceof XT){let r=o;fE(e,t,n,i,a,r.beginCaptures,s),a.produce(i,s[0].end),u=s[0].end;let d=r.getContentName(t.content,s),m=h.pushAttributed(d,e);if(i=i.withContentNameScopesList(m),r.whileHasBackReferences&&(i=i.withEndRule(r.getWhileWithResolvedBackReferences(t.content,s))),!f&&p.hasSameRuleAs(i)){i=i.pop(),a.produce(i,c),l=!0;return}}else if(fE(e,t,n,i,a,o.captures,s),a.produce(i,s[0].end),i=i.pop(),!f){i=i.safePop(),a.produce(i,c),l=!0;return}}s[0].end>r&&(r=s[0].end,n=!1)}}function oE(e,t,n,r,i,a){let o=i.beginRuleCapturedEOL?0:-1,s=[];for(let t=i;t;t=t.pop()){let n=t.getRule(e);n instanceof XT&&s.push({rule:n,stack:t})}for(let c=s.pop();c;c=s.pop()){let{ruleScanner:s,findOptions:l}=dE(c.rule,e,c.stack.endRule,n,r===o),u=s.findNextMatchSync(t,r,l);if(u){if(u.ruleId!==HT){i=c.stack.pop();break}u.captureIndices&&u.captureIndices.length&&(a.produce(c.stack,u.captureIndices[0].start),fE(e,t,n,c.stack,a,c.rule.whileCaptures,u.captureIndices),a.produce(c.stack,u.captureIndices[0].end),o=u.captureIndices[0].end,u.captureIndices[0].end>r&&(r=u.captureIndices[0].end,n=!1))}else{i=c.stack.pop();break}}return{stack:i,linePos:r,anchorPosition:o,isFirstLine:n}}function sE(e,t,n,r,i,a){let o=cE(e,t,n,r,i,a),s=e.getInjections();if(s.length===0)return o;let c=lE(s,e,t,n,r,i,a);if(!c)return o;if(!o)return c;let l=o.captureIndices[0].start,u=c.captureIndices[0].start;return u<l||c.priorityMatch&&u===l?c:o}function cE(e,t,n,r,i,a){let{ruleScanner:o,findOptions:s}=uE(i.getRule(e),e,i.endRule,n,r===a),c=o.findNextMatchSync(t,r,s);return c?{captureIndices:c.captureIndices,matchedRuleId:c.ruleId}:null}function lE(e,t,n,r,i,a,o){let s=Number.MAX_VALUE,c=null,l,u=0,d=a.contentNameScopesList.getScopeNames();for(let a=0,f=e.length;a<f;a++){let f=e[a];if(!f.matcher(d))continue;let{ruleScanner:p,findOptions:m}=uE(t.getRule(f.ruleId),t,null,r,i===o),h=p.findNextMatchSync(n,i,m);if(!h)continue;let g=h.captureIndices[0].start;if(!(g>=s)&&(s=g,c=h.captureIndices,l=h.ruleId,u=f.priority,s===i))break}return c?{priorityMatch:u===-1,captureIndices:c,matchedRuleId:l}:null}function uE(e,t,n,r,i){return{ruleScanner:e.compileAG(t,n,r,i),findOptions:0}}function dE(e,t,n,r,i){return{ruleScanner:e.compileWhileAG(t,n,r,i),findOptions:0}}function fE(e,t,n,r,i,a,o){if(a.length===0)return;let s=t.content,c=Math.min(a.length,o.length),l=[],u=o[0].end;for(let t=0;t<c;t++){let c=a[t];if(c===null)continue;let d=o[t];if(d.length===0)continue;if(d.start>u)break;for(;l.length>0&&l[l.length-1].endPos<=d.start;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop();if(l.length>0?i.produceFromScopes(l[l.length-1].scopes,d.start):i.produce(r,d.start),c.retokenizeCapturedWithRuleId){let t=c.getName(s,o),a=r.contentNameScopesList.pushAttributed(t,e),l=c.getContentName(s,o),u=a.pushAttributed(l,e),f=r.push(c.retokenizeCapturedWithRuleId,d.start,-1,!1,null,a,u),p=e.createOnigString(s.substring(0,d.end));aE(e,p,n&&d.start===0,d.start,f,i,!1,0),wT(p);continue}let f=c.getName(s,o);if(f!==null){let t=(l.length>0?l[l.length-1].scopes:r.contentNameScopesList).pushAttributed(f,e);l.push(new pE(t,d.end))}}for(;l.length>0;)i.produceFromScopes(l[l.length-1].scopes,l[l.length-1].endPos),l.pop()}var pE=class{scopes;endPos;constructor(e,t){this.scopes=e,this.endPos=t}};function mE(e,t,n,r,i,a,o,s){return new vE(e,t,n,r,i,a,o,s)}function hE(e,t,n,r,i){let a=xT(t,gE),o=ZT.getCompiledRuleId(n,r,i.repository);for(let n of a)e.push({debugSelector:t,matcher:n.matcher,ruleId:o,grammar:i,priority:n.priority})}function gE(e,t){if(t.length<e.length)return!1;let n=0;return e.every(e=>{for(let r=n;r<t.length;r++)if(_E(t[r],e))return n=r+1,!0;return!1})}function _E(e,t){if(!e)return!1;if(e===t)return!0;let n=t.length;return e.length>n&&e.substr(0,n)===t&&e[n]===`.`}var vE=class{constructor(e,t,n,r,i,a,o,s){if(this._rootScopeName=e,this.balancedBracketSelectors=a,this._onigLib=s,this._basicScopeAttributesProvider=new nE(n,r),this._rootId=-1,this._lastRuleId=0,this._ruleId2desc=[null],this._includedGrammars={},this._grammarRepository=o,this._grammar=yE(t,null),this._injections=null,this._tokenTypeMatchers=[],i)for(let e of Object.keys(i)){let t=xT(e,gE);for(let n of t)this._tokenTypeMatchers.push({matcher:n.matcher,type:i[e]})}}_rootId;_lastRuleId;_ruleId2desc;_includedGrammars;_grammarRepository;_grammar;_injections;_basicScopeAttributesProvider;_tokenTypeMatchers;get themeProvider(){return this._grammarRepository}dispose(){for(let e of this._ruleId2desc)e&&e.dispose()}createOnigScanner(e){return this._onigLib.createOnigScanner(e)}createOnigString(e){return this._onigLib.createOnigString(e)}getMetadataForScope(e){return this._basicScopeAttributesProvider.getBasicScopeAttributes(e)}_collectInjections(){let e={lookup:e=>e===this._rootScopeName?this._grammar:this.getExternalGrammar(e),injections:e=>this._grammarRepository.injections(e)},t=[],n=this._rootScopeName,r=e.lookup(n);if(r){let e=r.injections;if(e)for(let n in e)hE(t,n,e[n],this,r);let i=this._grammarRepository.injections(n);i&&i.forEach(e=>{let n=this.getExternalGrammar(e);if(n){let e=n.injectionSelector;e&&hE(t,e,n,this,n)}})}return t.sort((e,t)=>e.priority-t.priority),t}getInjections(){return this._injections===null&&(this._injections=this._collectInjections()),this._injections}registerRule(e){let t=++this._lastRuleId,n=e(UT(t));return this._ruleId2desc[t]=n,n}getRule(e){return this._ruleId2desc[WT(e)]}getExternalGrammar(e,t){if(this._includedGrammars[e])return this._includedGrammars[e];if(this._grammarRepository){let n=this._grammarRepository.lookup(e);if(n)return this._includedGrammars[e]=yE(n,t&&t.$base),this._includedGrammars[e]}}tokenizeLine(e,t,n=0){let r=this._tokenize(e,t,!1,n);return{tokens:r.lineTokens.getResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}tokenizeLine2(e,t,n=0){let r=this._tokenize(e,t,!0,n);return{tokens:r.lineTokens.getBinaryResult(r.ruleStack,r.lineLength),ruleStack:r.ruleStack,stoppedEarly:r.stoppedEarly}}_tokenize(e,t,n,r){this._rootId===-1&&(this._rootId=ZT.getCompiledRuleId(this._grammar.repository.$self,this,this._grammar.repository),this.getInjections());let i;if(!t||t===xE.NULL){i=!0;let e=this._basicScopeAttributesProvider.getDefaultAttributes(),n=this.themeProvider.getDefaults(),r=vT.set(0,e.languageId,e.tokenType,null,n.fontStyle,n.foregroundId,n.backgroundId),a=this.getRule(this._rootId).getName(null,null),o;o=a?bE.createRootAndLookUpScopeName(a,r,this):bE.createRoot(`unknown`,r),t=new xE(null,this._rootId,-1,-1,!1,null,o,o)}else i=!1,t.reset();e+=`
|
|
38
|
+
`;let a=this.createOnigString(e),o=a.content.length,s=new CE(n,e,this._tokenTypeMatchers,this.balancedBracketSelectors),c=aE(this,a,i,0,t,s,!0,r);return wT(a),{lineLength:o,lineTokens:s,ruleStack:c.stack,stoppedEarly:c.stoppedEarly}}};function yE(e,t){return e=Kw(e),e.repository=e.repository||{},e.repository.$self={$vscodeTextmateLocation:e.$vscodeTextmateLocation,patterns:e.patterns,name:e.scopeName},e.repository.$base=t||e.repository.$self,e}var bE=class e{constructor(e,t,n){this.parent=e,this.scopePath=t,this.tokenAttributes=n}static fromExtension(t,n){let r=t,i=t?.scopePath??null;for(let t of n)i=oT.push(i,t.scopeNames),r=new e(r,i,t.encodedTokenAttributes);return r}static createRoot(t,n){return new e(null,new oT(null,t),n)}static createRootAndLookUpScopeName(t,n,r){let i=r.getMetadataForScope(t),a=new oT(null,t),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(n,i,o);return new e(null,a,s)}get scopeName(){return this.scopePath.scopeName}toString(){return this.getScopeNames().join(` `)}equals(t){return e.equals(this,t)}static equals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.scopeName!==t.scopeName||e.tokenAttributes!==t.tokenAttributes)return!1;e=e.parent,t=t.parent}while(!0)}static mergeAttributes(e,t,n){let r=-1,i=0,a=0;return n!==null&&(r=n.fontStyle,i=n.foregroundId,a=n.backgroundId),vT.set(e,t.languageId,t.tokenType,null,r,i,a)}pushAttributed(t,n){if(t===null)return this;if(t.indexOf(` `)===-1)return e._pushAttributed(this,t,n);let r=t.split(/ /g),i=this;for(let t of r)i=e._pushAttributed(i,t,n);return i}static _pushAttributed(t,n,r){let i=r.getMetadataForScope(n),a=t.scopePath.push(n),o=r.themeProvider.themeMatch(a),s=e.mergeAttributes(t.tokenAttributes,i,o);return new e(t,a,s)}getScopeNames(){return this.scopePath.getSegments()}getExtensionIfDefined(e){let t=[],n=this;for(;n&&n!==e;)t.push({encodedTokenAttributes:n.tokenAttributes,scopeNames:n.scopePath.getExtensionIfDefined(n.parent?.scopePath??null)}),n=n.parent;return n===e?t.reverse():void 0}},xE=class e{constructor(e,t,n,r,i,a,o,s){this.parent=e,this.ruleId=t,this.beginRuleCapturedEOL=i,this.endRule=a,this.nameScopesList=o,this.contentNameScopesList=s,this.depth=this.parent?this.parent.depth+1:1,this._enterPos=n,this._anchorPos=r}_stackElementBrand=void 0;static NULL=new e(null,0,0,0,!1,null,null,null);_enterPos;_anchorPos;depth;equals(t){return t!==null&&e._equals(this,t)}static _equals(e,t){return e===t?!0:this._structuralEquals(e,t)?bE.equals(e.contentNameScopesList,t.contentNameScopesList):!1}static _structuralEquals(e,t){do{if(e===t||!e&&!t)return!0;if(!e||!t||e.depth!==t.depth||e.ruleId!==t.ruleId||e.endRule!==t.endRule)return!1;e=e.parent,t=t.parent}while(!0)}clone(){return this}static _reset(e){for(;e;)e._enterPos=-1,e._anchorPos=-1,e=e.parent}reset(){e._reset(this)}pop(){return this.parent}safePop(){return this.parent?this.parent:this}push(t,n,r,i,a,o,s){return new e(this,t,n,r,i,a,o,s)}getEnterPos(){return this._enterPos}getAnchorPos(){return this._anchorPos}getRule(e){return e.getRule(this.ruleId)}toString(){let e=[];return this._writeString(e,0),`[`+e.join(`,`)+`]`}_writeString(e,t){return this.parent&&(t=this.parent._writeString(e,t)),e[t++]=`(${this.ruleId}, ${this.nameScopesList?.toString()}, ${this.contentNameScopesList?.toString()})`,t}withContentNameScopesList(e){return this.contentNameScopesList===e?this:this.parent.push(this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,this.endRule,this.nameScopesList,e)}withEndRule(t){return this.endRule===t?this:new e(this.parent,this.ruleId,this._enterPos,this._anchorPos,this.beginRuleCapturedEOL,t,this.nameScopesList,this.contentNameScopesList)}hasSameRuleAs(e){let t=this;for(;t&&t._enterPos===e._enterPos;){if(t.ruleId===e.ruleId)return!0;t=t.parent}return!1}toStateStackFrame(){return{ruleId:WT(this.ruleId),beginRuleCapturedEOL:this.beginRuleCapturedEOL,endRule:this.endRule,nameScopesList:this.nameScopesList?.getExtensionIfDefined(this.parent?.nameScopesList??null)??[],contentNameScopesList:this.contentNameScopesList?.getExtensionIfDefined(this.nameScopesList)??[]}}static pushFrame(t,n){let r=bE.fromExtension(t?.nameScopesList??null,n.nameScopesList);return new e(t,UT(n.ruleId),n.enterPos??-1,n.anchorPos??-1,n.beginRuleCapturedEOL,n.endRule,r,bE.fromExtension(r,n.contentNameScopesList))}},SE=class{balancedBracketScopes;unbalancedBracketScopes;allowAny=!1;constructor(e,t){this.balancedBracketScopes=e.flatMap(e=>e===`*`?(this.allowAny=!0,[]):xT(e,gE).map(e=>e.matcher)),this.unbalancedBracketScopes=t.flatMap(e=>xT(e,gE).map(e=>e.matcher))}get matchesAlways(){return this.allowAny&&this.unbalancedBracketScopes.length===0}get matchesNever(){return this.balancedBracketScopes.length===0&&!this.allowAny}match(e){for(let t of this.unbalancedBracketScopes)if(t(e))return!1;for(let t of this.balancedBracketScopes)if(t(e))return!0;return this.allowAny}},CE=class{constructor(e,t,n,r){this.balancedBracketSelectors=r,this._emitBinaryTokens=e,this._tokenTypeOverrides=n,this._lineText=null,this._tokens=[],this._binaryTokens=[],this._lastTokenEndIndex=0}_emitBinaryTokens;_lineText;_tokens;_binaryTokens;_lastTokenEndIndex;_tokenTypeOverrides;produce(e,t){this.produceFromScopes(e.contentNameScopesList,t)}produceFromScopes(e,t){if(this._lastTokenEndIndex>=t)return;if(this._emitBinaryTokens){let n=e?.tokenAttributes??0,r=!1;if(this.balancedBracketSelectors?.matchesAlways&&(r=!0),this._tokenTypeOverrides.length>0||this.balancedBracketSelectors&&!this.balancedBracketSelectors.matchesAlways&&!this.balancedBracketSelectors.matchesNever){let t=e?.getScopeNames()??[];for(let e of this._tokenTypeOverrides)e.matcher(t)&&(n=vT.set(n,0,yT(e.type),null,-1,0,0));this.balancedBracketSelectors&&(r=this.balancedBracketSelectors.match(t))}if(r&&(n=vT.set(n,0,8,r,-1,0,0)),this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-1]===n){this._lastTokenEndIndex=t;return}this._binaryTokens.push(this._lastTokenEndIndex),this._binaryTokens.push(n),this._lastTokenEndIndex=t;return}let n=e?.getScopeNames()??[];this._tokens.push({startIndex:this._lastTokenEndIndex,endIndex:t,scopes:n}),this._lastTokenEndIndex=t}getResult(e,t){return this._tokens.length>0&&this._tokens[this._tokens.length-1].startIndex===t-1&&this._tokens.pop(),this._tokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._tokens[this._tokens.length-1].startIndex=0),this._tokens}getBinaryResult(e,t){this._binaryTokens.length>0&&this._binaryTokens[this._binaryTokens.length-2]===t-1&&(this._binaryTokens.pop(),this._binaryTokens.pop()),this._binaryTokens.length===0&&(this._lastTokenEndIndex=-1,this.produce(e,t),this._binaryTokens[this._binaryTokens.length-2]=0);let n=new Uint32Array(this._binaryTokens.length);for(let e=0,t=this._binaryTokens.length;e<t;e++)n[e]=this._binaryTokens[e];return n}},wE=class{constructor(e,t){this._onigLib=t,this._theme=e}_grammars=new Map;_rawGrammars=new Map;_injectionGrammars=new Map;_theme;dispose(){for(let e of this._grammars.values())e.dispose()}setTheme(e){this._theme=e}getColorMap(){return this._theme.getColorMap()}addGrammar(e,t){this._rawGrammars.set(e.scopeName,e),t&&this._injectionGrammars.set(e.scopeName,t)}lookup(e){return this._rawGrammars.get(e)}injections(e){return this._injectionGrammars.get(e)}getDefaults(){return this._theme.getDefaults()}themeMatch(e){return this._theme.match(e)}grammarForScopeName(e,t,n,r,i){if(!this._grammars.has(e)){let a=this._rawGrammars.get(e);if(!a)return null;this._grammars.set(e,mE(e,a,t,n,r,i,this,this._onigLib))}return this._grammars.get(e)}},TE=class{_options;_syncRegistry;_ensureGrammarCache;constructor(e){this._options=e,this._syncRegistry=new wE(aT.createFromRawTheme(e.theme,e.colorMap),e.onigLib),this._ensureGrammarCache=new Map}dispose(){this._syncRegistry.dispose()}setTheme(e,t){this._syncRegistry.setTheme(aT.createFromRawTheme(e,t))}getColorMap(){return this._syncRegistry.getColorMap()}loadGrammarWithEmbeddedLanguages(e,t,n){return this.loadGrammarWithConfiguration(e,t,{embeddedLanguages:n})}loadGrammarWithConfiguration(e,t,n){return this._loadGrammar(e,t,n.embeddedLanguages,n.tokenTypes,new SE(n.balancedBracketSelectors||[],n.unbalancedBracketSelectors||[]))}loadGrammar(e){return this._loadGrammar(e,0,null,null,null)}_loadGrammar(e,t,n,r,i){let a=new OT(this._syncRegistry,e);for(;a.Q.length>0;)a.Q.map(e=>this._loadSingleGrammar(e.scopeName)),a.processQueue();return this._grammarForScopeName(e,t,n,r,i)}_loadSingleGrammar(e){this._ensureGrammarCache.has(e)||(this._doLoadSingleGrammar(e),this._ensureGrammarCache.set(e,!0))}_doLoadSingleGrammar(e){let t=this._options.loadGrammar(e);if(t){let n=typeof this._options.getInjections==`function`?this._options.getInjections(e):void 0;this._syncRegistry.addGrammar(t,n)}}addGrammar(e,t=[],n=0,r=null){return this._syncRegistry.addGrammar(e,t),this._grammarForScopeName(e.scopeName,n,r)}_grammarForScopeName(e,t=0,n=null,r=null,i=null){return this._syncRegistry.grammarForScopeName(e,t,n,r,i)}},EE=xE.NULL;function DE(e,t){let n=typeof e==`string`?{}:{...e.colorReplacements},r=typeof e==`string`?e:e.name;for(let[e,i]of Object.entries(t?.colorReplacements||{}))typeof i==`string`?n[e]=i:e===r&&Object.assign(n,i);return n}function OE(e,t){return e&&(t?.[e?.toLowerCase()]||e)}function kE(e){return Array.isArray(e)?e:[e]}async function AE(e){return Promise.resolve(typeof e==`function`?e():e).then(e=>e.default||e)}function jE(e){return!e||[`plaintext`,`txt`,`text`,`plain`].includes(e)}function ME(e){return e===`ansi`||jE(e)}function NE(e){return e===`none`}function PE(e){return NE(e)}var FE=/(\r?\n)/g;function IE(e,t=!1){if(e.length===0)return[[``,0]];let n=e.split(FE),r=0,i=[];for(let e=0;e<n.length;e+=2){let a=t?n[e]+(n[e+1]||``):n[e];i.push([a,r]),r+=n[e].length,r+=n[e+1]?.length||0}return i}var LE={light:`#333333`,dark:`#bbbbbb`},RE={light:`#fffffe`,dark:`#1e1e1e`},zE=`__shiki_resolved`;function BE(e){if(e?.[zE])return e;let t={...e};t.tokenColors&&!t.settings&&(t.settings=t.tokenColors,delete t.tokenColors),t.type||=`dark`,t.colorReplacements={...t.colorReplacements},t.settings||=[];let{bg:n,fg:r}=t;if(!n||!r){let e=t.settings?t.settings.find(e=>!e.name&&!e.scope):void 0;e?.settings?.foreground&&(r=e.settings.foreground),e?.settings?.background&&(n=e.settings.background),!r&&t?.colors?.[`editor.foreground`]&&(r=t.colors[`editor.foreground`]),!n&&t?.colors?.[`editor.background`]&&(n=t.colors[`editor.background`]),r||=t.type===`light`?LE.light:LE.dark,n||=t.type===`light`?RE.light:RE.dark,t.fg=r,t.bg=n}t.settings[0]&&t.settings[0].settings&&!t.settings[0].scope||t.settings.unshift({settings:{foreground:t.fg,background:t.bg}});let i=0,a=new Map;function o(e){if(a.has(e))return a.get(e);i+=1;let n=`#${i.toString(16).padStart(8,`0`).toLowerCase()}`;return t.colorReplacements?.[`#${n}`]?o(e):(a.set(e,n),n)}t.settings=t.settings.map(e=>{let n=e.settings?.foreground&&!e.settings.foreground.startsWith(`#`),r=e.settings?.background&&!e.settings.background.startsWith(`#`);if(!n&&!r)return e;let i={...e,settings:{...e.settings}};if(n){let n=o(e.settings.foreground);t.colorReplacements[n]=e.settings.foreground,i.settings.foreground=n}if(r){let n=o(e.settings.background);t.colorReplacements[n]=e.settings.background,i.settings.background=n}return i});for(let e of Object.keys(t.colors||{}))if((e===`editor.foreground`||e===`editor.background`||e.startsWith(`terminal.ansi`))&&!t.colors[e]?.startsWith(`#`)){let n=o(t.colors[e]);t.colorReplacements[n]=t.colors[e],t.colors[e]=n}return Object.defineProperty(t,zE,{enumerable:!1,writable:!1,value:!0}),t}async function VE(e){return[...new Set((await Promise.all(e.filter(e=>!ME(e)).map(async e=>await AE(e).then(e=>Array.isArray(e)?e:[e])))).flat())]}async function HE(e){return(await Promise.all(e.map(async e=>PE(e)?null:BE(await AE(e))))).filter(e=>!!e)}function UE(e,t){if(!t)return e;if(t[e]){let n=new Set([e]);for(;t[e];){if(e=t[e],n.has(e))throw new Gw(`Circular alias \`${[...n].join(` -> `)} -> ${e}\``);n.add(e)}}return e}var WE=class extends TE{_resolver;_themes;_langs;_alias;_resolvedThemes=new Map;_resolvedGrammars=new Map;_langMap=new Map;_langGraph=new Map;_textmateThemeCache=new WeakMap;_loadedThemesCache=null;_loadedLanguagesCache=null;constructor(e,t,n,r={}){super(e),this._resolver=e,this._themes=t,this._langs=n,this._alias=r,this._themes.map(e=>this.loadTheme(e)),this.loadLanguages(this._langs)}getTheme(e){return typeof e==`string`?this._resolvedThemes.get(e):this.loadTheme(e)}loadTheme(e){let t=BE(e);return t.name&&(this._resolvedThemes.set(t.name,t),this._loadedThemesCache=null),t}getLoadedThemes(){return this._loadedThemesCache||=[...this._resolvedThemes.keys()],this._loadedThemesCache}setTheme(e){let t=this._textmateThemeCache.get(e);t||(t=aT.createFromRawTheme(e),this._textmateThemeCache.set(e,t)),this._syncRegistry.setTheme(t)}getGrammar(e){return e=UE(e,this._alias),this._resolvedGrammars.get(e)}loadLanguage(e){if(this.getGrammar(e.name))return;let t=new Set([...this._langMap.values()].filter(t=>t.embeddedLangsLazy?.includes(e.name)));this._resolver.addLanguage(e);let n={balancedBracketSelectors:e.balancedBracketSelectors||[`*`],unbalancedBracketSelectors:e.unbalancedBracketSelectors||[]};this._syncRegistry._rawGrammars.set(e.scopeName,e);let r=this.loadGrammarWithConfiguration(e.scopeName,1,n);if(r.name=e.name,this._resolvedGrammars.set(e.name,r),e.aliases&&e.aliases.forEach(t=>{this._alias[t]=e.name}),this._loadedLanguagesCache=null,t.size)for(let e of t)this._resolvedGrammars.delete(e.name),this._loadedLanguagesCache=null,this._syncRegistry?._injectionGrammars?.delete(e.scopeName),this._syncRegistry?._grammars?.delete(e.scopeName),this.loadLanguage(this._langMap.get(e.name))}dispose(){super.dispose(),this._resolvedThemes.clear(),this._resolvedGrammars.clear(),this._langMap.clear(),this._langGraph.clear(),this._loadedThemesCache=null}loadLanguages(e){for(let t of e)this.resolveEmbeddedLanguages(t);let t=[...this._langGraph.entries()],n=t.filter(([e,t])=>!t);if(n.length){let e=t.filter(([e,t])=>t?(t.embeddedLanguages||t.embeddedLangs)?.some(e=>n.map(([e])=>e).includes(e)):!1).filter(e=>!n.includes(e));throw new Gw(`Missing languages ${n.map(([e])=>`\`${e}\``).join(`, `)}, required by ${e.map(([e])=>`\`${e}\``).join(`, `)}`)}for(let[e,n]of t)this._resolver.addLanguage(n);for(let[e,n]of t)this.loadLanguage(n)}getLoadedLanguages(){return this._loadedLanguagesCache||=[...new Set([...this._resolvedGrammars.keys(),...Object.keys(this._alias)])],this._loadedLanguagesCache}resolveEmbeddedLanguages(e){this._langMap.set(e.name,e),this._langGraph.set(e.name,e);let t=e.embeddedLanguages??e.embeddedLangs;if(t)for(let e of t)this._langGraph.set(e,this._langMap.get(e))}},GE=class{_langs=new Map;_scopeToLang=new Map;_injections=new Map;_onigLib;constructor(e,t){this._onigLib={createOnigScanner:t=>e.createScanner(t),createOnigString:t=>e.createString(t)},t.forEach(e=>this.addLanguage(e))}get onigLib(){return this._onigLib}getLangRegistration(e){return this._langs.get(e)}loadGrammar(e){return this._scopeToLang.get(e)}addLanguage(e){this._langs.set(e.name,e),e.aliases&&e.aliases.forEach(t=>{this._langs.set(t,e)}),this._scopeToLang.set(e.scopeName,e),e.injectTo&&e.injectTo.forEach(t=>{this._injections.get(t)||this._injections.set(t,[]),this._injections.get(t).push(e.scopeName)})}getInjections(e){let t=e.split(`.`),n=[];for(let e=1;e<=t.length;e++){let r=t.slice(0,e).join(`.`);n=[...n,...this._injections.get(r)||[]]}return n}},KE=0;function qE(e){KE+=1,e.warnings!==!1&&KE>=10&&KE%10==0&&console.warn(`[Shiki] ${KE} instances have been created. Shiki is supposed to be used as a singleton, consider refactoring your code to cache your highlighter instance; Or call \`highlighter.dispose()\` to release unused instances.`);let t=!1;if(!e.engine)throw new Gw("`engine` option is required for synchronous mode");let n=(e.langs||[]).flat(1),r=(e.themes||[]).flat(1).map(BE),i=new WE(new GE(e.engine,n),r,n,e.langAlias),a;function o(t){return UE(t,e.langAlias)}function s(e){g();let t=i.getGrammar(typeof e==`string`?e:e.name);if(!t)throw new Gw(`Language \`${e}\` not found, you may need to load it first`);return t}function c(e){if(e===`none`)return{bg:``,fg:``,name:`none`,settings:[],type:`dark`};g();let t=i.getTheme(e);if(!t)throw new Gw(`Theme \`${e}\` not found, you may need to load it first`);return t}function l(e){g();let t=c(e);return a!==e&&(i.setTheme(t),a=e),{theme:t,colorMap:i.getColorMap()}}function u(){return g(),i.getLoadedThemes()}function d(){return g(),i.getLoadedLanguages()}function f(...e){g(),i.loadLanguages(e.flat(1))}async function p(...e){return f(await VE(e))}function m(...e){g();for(let t of e.flat(1))i.loadTheme(t)}async function h(...e){return g(),m(await HE(e))}function g(){if(t)throw new Gw(`Shiki instance has been disposed`)}function _(){t||(t=!0,i.dispose(),--KE)}return{setTheme:l,getTheme:c,getLanguage:s,getLoadedThemes:u,getLoadedLanguages:d,resolveLangAlias:o,loadLanguage:p,loadLanguageSync:f,loadTheme:h,loadThemeSync:m,dispose:_,[Symbol.dispose]:_}}async function JE(e){e.engine||console.warn("`engine` option is required. Use `createOnigurumaEngine` or `createJavaScriptRegexEngine` to create an engine.");let[t,n,r]=await Promise.all([HE(e.themes||[]),VE(e.langs||[]),e.engine]);return qE({...e,themes:t,langs:n,engine:r})}var YE=new WeakMap;function XE(e,t){YE.set(e,t)}function ZE(e){return YE.get(e)}var QE=class e{_stacks={};lang;get themes(){return Object.keys(this._stacks)}get theme(){return this.themes[0]}get _stack(){return this._stacks[this.theme]}static initial(t,n){return new e(Object.fromEntries(kE(n).map(e=>[e,EE])),t)}constructor(...e){if(e.length===2){let[t,n]=e;this.lang=n,this._stacks=t}else{let[t,n,r]=e;this.lang=n,this._stacks={[r]:t}}}getInternalStack(e=this.theme){return this._stacks[e]}getScopes(e=this.theme){return $E(this._stacks[e])}toJSON(){return{lang:this.lang,theme:this.theme,themes:this.themes,scopes:this.getScopes()}}};function $E(e){let t=[],n=new Set;function r(e){if(n.has(e))return;n.add(e);let i=e?.nameScopesList?.scopeName;i&&t.push(i),e.parent&&r(e.parent)}return r(e),t}function eD(e,t){if(!(e instanceof QE))throw new Gw(`Invalid grammar state`);return e.getInternalStack(t)}var tD=/,/,nD=/ /;function rD(e,t,n={}){let{theme:r=e.getLoadedThemes()[0]}=n;if(jE(e.resolveLangAlias(n.lang||`text`))||NE(r))return IE(t).map(e=>[{content:e[0],offset:e[1]}]);let{theme:i,colorMap:a}=e.setTheme(r),o=e.getLanguage(n.lang||`text`);if(n.grammarState){if(n.grammarState.lang!==o.name)throw new Gw(`Grammar state language "${n.grammarState.lang}" does not match highlight language "${o.name}"`);if(!n.grammarState.themes.includes(i.name))throw new Gw(`Grammar state themes "${n.grammarState.themes}" do not contain highlight theme "${i.name}"`)}return aD(t,o,i,a,n)}function iD(...e){if(e.length===2)return ZE(e[1]);let[t,n,r={}]=e,{lang:i=`text`,theme:a=t.getLoadedThemes()[0]}=r;if(jE(i)||NE(a))throw new Gw(`Plain language does not have grammar state`);if(i===`ansi`)throw new Gw(`ANSI language does not have grammar state`);let{theme:o,colorMap:s}=t.setTheme(a),c=t.getLanguage(i);return new QE(oD(n,c,o,s,r).stateStack,c.name,o.name)}function aD(e,t,n,r,i){let a=oD(e,t,n,r,i),o=new QE(a.stateStack,t.name,n.name);return XE(a.tokens,o),a.tokens}function oD(e,t,n,r,i){let a=DE(n,i),{tokenizeMaxLineLength:o=0,tokenizeTimeLimit:s=500,includeExplanation:c=!1}=i,l=IE(e),u=i.grammarState?eD(i.grammarState,n.name)??EE:i.grammarContextCode==null?EE:oD(i.grammarContextCode,t,n,r,{...i,grammarState:void 0,grammarContextCode:void 0}).stateStack,d=[],f=[];for(let e=0,i=l.length;e<i;e++){let[i,p]=l[e];if(i===``){d=[],f.push([]);continue}if(o>0&&i.length>=o){d=[],f.push([{content:i,offset:p,color:``,fontStyle:0}]);continue}let m,h,g;c&&c!==`tokenType`&&(m=t.tokenizeLine(i,u,s),h=m.tokens,g=0);let _=t.tokenizeLine2(i,u,s),v=_.tokens.length/2;for(let e=0;e<v;e++){let t=_.tokens[2*e],o=e+1<v?_.tokens[2*e+2]:i.length;if(t===o)continue;let s=_.tokens[2*e+1],l=OE(r[vT.getForeground(s)],a),u=vT.getFontStyle(s),f={content:i.substring(t,o),offset:p+t,color:l,fontStyle:u};if(c===`tokenType`)f.type=vT.getTokenType(s);else if(c){let e=[];if(c!==`scopeName`)for(let t of n.settings){let n;switch(typeof t.scope){case`string`:n=t.scope.split(tD).map(e=>e.trim());break;case`object`:n=t.scope;break;default:continue}e.push({settings:t,selectors:n.map(e=>e.split(nD))})}f.explanation=[];let r=0;for(;t+r<o;){let t=h[g],n=i.substring(t.startIndex,t.endIndex);r+=n.length,f.explanation.push({content:n,scopes:c===`scopeName`?sD(t.scopes):cD(e,t.scopes)}),g+=1}}d.push(f)}f.push(d),d=[],u=_.ruleStack}return{tokens:f,stateStack:u}}function sD(e){return e.map(e=>({scopeName:e}))}function cD(e,t){let n=[];for(let r=0,i=t.length;r<i;r++){let i=t[r];n[r]={scopeName:i,themeMatches:dD(e,i,t.slice(0,r))}}return n}function lD(e,t){return e===t||t.substring(0,e.length)===e&&t[e.length]===`.`}function uD(e,t,n){if(!lD(e.at(-1),t))return!1;let r=e.length-2,i=n.length-1;for(;r>=0&&i>=0;)lD(e[r],n[i])&&--r,--i;return r===-1}function dD(e,t,n){let r=[];for(let{selectors:i,settings:a}of e)for(let e of i)if(uD(e,t,n)){r.push(a);break}return r}function fD(e,t,n,r=rD){let i=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})),a=i.map(i=>{let a=r(e,t,{...n,theme:i.theme});return{tokens:a,state:ZE(a),theme:typeof i.theme==`string`?i.theme:i.theme.name}}),o=pD(...a.map(e=>e.tokens)),s=o[0].map((e,t)=>e.map((e,r)=>{let a={content:e.content,variants:{},offset:e.offset};return`includeExplanation`in n&&n.includeExplanation&&(a.explanation=e.explanation),o.forEach((e,n)=>{let{content:o,explanation:s,offset:c,...l}=e[t][r];a.variants[i[n].color]=l}),a})),c=a[0].state?new QE(Object.fromEntries(a.map(e=>[e.theme,e.state?.getInternalStack(e.theme)])),a[0].state.lang):void 0;return c&&XE(s,c),s}function pD(...e){let t=e.map(()=>[]),n=e.length;for(let r=0;r<e[0].length;r++){let i=e.map(e=>e[r]),a=t.map(()=>[]);t.forEach((e,t)=>e.push(a[t]));let o=i.map(()=>0),s=i.map(e=>e[0]);for(;s.every(e=>e);){let e=Math.min(...s.map(e=>e.content.length));for(let t=0;t<n;t++){let n=s[t];n.content.length===e?(a[t].push(n),o[t]+=1,s[t]=i[t][o[t]]):(a[t].push({...n,content:n.content.slice(0,e)}),s[t]={...n,content:n.content.slice(e),offset:n.offset+e})}}}return t}var mD=/\s+/g;function hD(e,t){if(!t)return e;e.properties||={},e.properties.class||=[],typeof e.properties.class==`string`&&(e.properties.class=e.properties.class.split(mD)),Array.isArray(e.properties.class)||(e.properties.class=[]);let n=Array.isArray(t)?t:t.split(mD);for(let t of n)t&&!e.properties.class.includes(t)&&e.properties.class.push(t);return e}var gD=/:?lang=["']([^"']+)["']/g,_D=/(?:```|~~~)([\w-]+)/g,vD=/\\begin\{([\w-]+)\}/g,yD=/<script\s+(?:type|lang)=["']([^"']+)["']/gi,bD=/^\s*---\r?\n[\s\S]*?\r?\n---(?:\r?\n|\s*$)/;function xD(e){let t=IE(e,!0).map(([e])=>e);function n(n){if(n===e.length)return{line:t.length-1,character:t.at(-1).length};let r=n,i=0;for(let e of t){if(r<e.length)break;r-=e.length,i++}return{line:i,character:r}}function r(e,n){let r=0;for(let n=0;n<e;n++)r+=t[n].length;return r+=n,r}return{lines:t,indexToPos:n,posToIndex:r}}function SD(e,t,n){let r=new Set;for(let t of e.matchAll(gD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(_D)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(vD)){let e=t[1].toLowerCase().trim();e&&r.add(e)}for(let t of e.matchAll(yD)){let e=t[1].toLowerCase().trim(),n=e.includes(`/`)?e.split(`/`).pop():e;n&&r.add(n)}if(bD.test(e)&&r.add(`yaml`),!n)return[...r];let i=n.getBundledLanguages();return[...r].filter(e=>e&&i[e])}var CD=[`color`,`background-color`];function wD(e,t){let n=0,r=[];for(let i of t)i>n&&r.push({...e,content:e.content.slice(n,i),offset:e.offset+n}),n=i;return n<e.content.length&&r.push({...e,content:e.content.slice(n),offset:e.offset+n}),r}function TD(e,t){let n=0,r=e.length;for(;n<r;){let i=n+(r-n>>1);e[i]<=t?n=i+1:r=i}return n}function ED(e,t){let n=[...t instanceof Set?t:new Set(t)].sort((e,t)=>e-t);return n.length?e.map(e=>e.flatMap(e=>{let t=e.offset+e.content.length,r=TD(n,e.offset),i=r;for(;i<n.length&&n[i]<t;)i++;if(r===i)return e;let a=n.slice(r,i);for(let t=0;t<a.length;t++)a[t]-=e.offset;return wD(e,a)})):e}function DD(e,t,n,r,i=`css-vars`){let a={content:e.content,explanation:e.explanation,offset:e.offset},o=t.map(t=>OD(e.variants[t])),s=new Set(o.flatMap(e=>Object.keys(e))),c={},l=(e,r)=>{let i=r===`color`?``:r===`background-color`?`-bg`:`-${r}`;return n+t[e]+(r===`color`?``:i)};return o.forEach((e,n)=>{for(let a of s){let s=e[a]||`inherit`;if(n===0&&r&&CD.includes(a)){if(r===`light-dark()`&&o.length>1){let e=t.findIndex(e=>e===`light`),r=t.findIndex(e=>e===`dark`);if(e===-1||r===-1)throw new Gw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');let u=o[e][a]||`inherit`,d=o[r][a]||`inherit`;c[a]=`light-dark(${u}, ${d})`,i===`css-vars`&&(c[l(n,a)]=s)}else c[a]=s}else i===`css-vars`&&(c[l(n,a)]=s)}}),a.htmlStyle=c,a}function OD(e){let t={};if(e.color&&(t.color=e.color),e.bgColor&&(t[`background-color`]=e.bgColor),e.fontStyle){e.fontStyle&fT.Italic&&(t[`font-style`]=`italic`),e.fontStyle&fT.Bold&&(t[`font-weight`]=`bold`);let n=[];e.fontStyle&fT.Underline&&n.push(`underline`),e.fontStyle&fT.Strikethrough&&n.push(`line-through`),n.length&&(t[`text-decoration`]=n.join(` `))}return t}function kD(e){return typeof e==`string`?e:Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function AD(){let e=new WeakMap;function t(t){if(!e.has(t.meta)){let n=xD(t.source);function r(e){if(typeof e==`number`){if(e<0||e>t.source.length)throw new Gw(`Invalid decoration offset: ${e}. Code length: ${t.source.length}`);return{...n.indexToPos(e),offset:e}}{let t=n.lines[e.line];if(t===void 0)throw new Gw(`Invalid decoration position ${JSON.stringify(e)}. Lines length: ${n.lines.length}`);let r=e.character;if(r<0&&(r=t.length+r),r<0||r>t.length)throw new Gw(`Invalid decoration position ${JSON.stringify(e)}. Line ${e.line} length: ${t.length}`);return{...e,character:r,offset:n.posToIndex(e.line,r)}}}let i=(t.options.decorations||[]).map(e=>({...e,start:r(e.start),end:r(e.end)}));jD(i),e.set(t.meta,{decorations:i,converter:n,source:t.source})}return e.get(t.meta)}return{name:`shiki:decorations`,tokens(e){if(this.options.decorations?.length)return ED(e,t(this).decorations.flatMap(e=>[e.start.offset,e.end.offset]))},code(e){if(!this.options.decorations?.length)return;let n=t(this),r=[...e.children].filter(e=>e.type===`element`&&e.tagName===`span`);if(r.length!==n.converter.lines.length)throw new Gw(`Number of lines in code element (${r.length}) does not match the number of lines in the source (${n.converter.lines.length}). Failed to apply decorations.`);function i(e,t,n,i){let a=r[e],s=``,c=-1,l=-1;if(t===0&&(c=0),n===0&&(l=0),n===1/0&&(l=a.children.length),c===-1||l===-1)for(let e=0;e<a.children.length;e++)s+=MD(a.children[e]),c===-1&&s.length===t&&(c=e+1),l===-1&&s.length===n&&(l=e+1);if(c===-1)throw new Gw(`Failed to find start index for decoration ${JSON.stringify(i.start)}`);if(l===-1)throw new Gw(`Failed to find end index for decoration ${JSON.stringify(i.end)}`);let u=a.children.slice(c,l);if(!i.alwaysWrap&&u.length===a.children.length)o(a,i,`line`);else if(!i.alwaysWrap&&u.length===1&&u[0].type===`element`)o(u[0],i,`token`);else{let e={type:`element`,tagName:`span`,properties:{},children:u};o(e,i,`wrapper`),a.children.splice(c,u.length,e)}}function a(e,t){r[e]=o(r[e],t,`line`)}function o(e,t,n){let r=t.properties||{},i=t.transform||(e=>e);return e.tagName=t.tagName||`span`,e.properties={...e.properties,...r,class:e.properties.class},t.properties?.class&&hD(e,t.properties.class),e=i(e,n)||e,e}let s=[],c=n.decorations.sort((e,t)=>t.start.offset-e.start.offset||e.end.offset-t.end.offset);for(let e of c){let{start:t,end:n}=e;if(t.line===n.line)i(t.line,t.character,n.character,e);else if(t.line<n.line){i(t.line,t.character,1/0,e);for(let r=t.line+1;r<n.line;r++)s.unshift(()=>a(r,e));i(n.line,0,n.character,e)}}s.forEach(e=>e())}}}function jD(e){for(let t=0;t<e.length;t++){let n=e[t];if(n.start.offset>n.end.offset)throw new Gw(`Invalid decoration range: ${JSON.stringify(n.start)} - ${JSON.stringify(n.end)}`);for(let r=t+1;r<e.length;r++){let t=e[r],i=n.start.offset<=t.start.offset&&t.start.offset<n.end.offset,a=n.start.offset<t.end.offset&&t.end.offset<=n.end.offset,o=t.start.offset<=n.start.offset&&n.start.offset<t.end.offset,s=t.start.offset<n.end.offset&&n.end.offset<=t.end.offset;if(i||a||o||s){if(i&&a||o&&s||o&&n.start.offset===n.end.offset||a&&t.start.offset===t.end.offset)continue;throw new Gw(`Decorations ${JSON.stringify(n.start)} and ${JSON.stringify(t.start)} intersect.`)}}}}function MD(e){return e.type===`text`?e.value:e.type===`element`?e.children.map(MD).join(``):``}var ND=[AD()];function PD(e){let t=FD(e.transformers||[]);return[...t.pre,...t.normal,...t.post,...ND]}function FD(e){let t=[],n=[],r=[];for(let i of e)switch(i.enforce){case`pre`:t.push(i);break;case`post`:n.push(i);break;default:r.push(i)}return{pre:t,post:n,normal:r}}var ID=[`black`,`red`,`green`,`yellow`,`blue`,`magenta`,`cyan`,`white`,`brightBlack`,`brightRed`,`brightGreen`,`brightYellow`,`brightBlue`,`brightMagenta`,`brightCyan`,`brightWhite`],LD={1:`bold`,2:`dim`,3:`italic`,4:`underline`,7:`reverse`,8:`hidden`,9:`strikethrough`};function RD(e,t){let n=e.indexOf(`\x1B`,t);if(n!==-1&&e[n+1]===`[`){let t=e.indexOf(`m`,n);if(t!==-1)return{sequence:e.substring(n+2,t).split(`;`),startPosition:n,position:t+1}}return{position:e.length}}function zD(e){let t=e.shift();if(t===`2`){let t=e.splice(0,3).map(e=>Number.parseInt(e));return t.length!==3||t.some(e=>Number.isNaN(e))?void 0:{type:`rgb`,rgb:t}}if(t===`5`){let t=e.shift();if(t)return{type:`table`,index:Number(t)}}}function BD(e){let t=[];for(;e.length>0;){let n=e.shift();if(!n)continue;let r=Number.parseInt(n);if(!Number.isNaN(r)){if(r===0)t.push({type:`resetAll`});else if(r<=9)LD[r]&&t.push({type:`setDecoration`,value:LD[r]});else if(r<=29){let e=LD[r-20];e&&(t.push({type:`resetDecoration`,value:e}),e===`dim`&&t.push({type:`resetDecoration`,value:`bold`}))}else if(r<=37)t.push({type:`setForegroundColor`,value:{type:`named`,name:ID[r-30]}});else if(r===38){let n=zD(e);n&&t.push({type:`setForegroundColor`,value:n})}else if(r===39)t.push({type:`resetForegroundColor`});else if(r<=47)t.push({type:`setBackgroundColor`,value:{type:`named`,name:ID[r-40]}});else if(r===48){let n=zD(e);n&&t.push({type:`setBackgroundColor`,value:n})}else r===49?t.push({type:`resetBackgroundColor`}):r===53?t.push({type:`setDecoration`,value:`overline`}):r===55?t.push({type:`resetDecoration`,value:`overline`}):r>=90&&r<=97?t.push({type:`setForegroundColor`,value:{type:`named`,name:ID[r-90+8]}}):r>=100&&r<=107&&t.push({type:`setBackgroundColor`,value:{type:`named`,name:ID[r-100+8]}})}}return t}function VD(){let e=null,t=null,n=new Set;return{parse(r){let i=[],a=0;do{let o=RD(r,a),s=o.sequence?r.substring(a,o.startPosition):r.substring(a);if(s.length>0&&i.push({value:s,foreground:e,background:t,decorations:new Set(n)}),o.sequence){let r=BD(o.sequence);for(let i of r)i.type===`resetAll`?(e=null,t=null,n.clear()):i.type===`resetForegroundColor`?e=null:i.type===`resetBackgroundColor`?t=null:i.type===`resetDecoration`&&n.delete(i.value);for(let i of r)i.type===`setForegroundColor`?e=i.value:i.type===`setBackgroundColor`?t=i.value:i.type===`setDecoration`&&n.add(i.value)}a=o.position}while(a<r.length);return i}}}var HD={black:`#000000`,red:`#bb0000`,green:`#00bb00`,yellow:`#bbbb00`,blue:`#0000bb`,magenta:`#ff00ff`,cyan:`#00bbbb`,white:`#eeeeee`,brightBlack:`#555555`,brightRed:`#ff5555`,brightGreen:`#00ff00`,brightYellow:`#ffff55`,brightBlue:`#5555ff`,brightMagenta:`#ff55ff`,brightCyan:`#55ffff`,brightWhite:`#ffffff`};function UD(e=HD){function t(t){return e[t]}function n(e){return`#${e.map(e=>Math.max(0,Math.min(e,255)).toString(16).padStart(2,`0`)).join(``)}`}let r;function i(){if(r)return r;r=[];for(let e=0;e<ID.length;e++)r.push(t(ID[e]));let e=[0,95,135,175,215,255];for(let t=0;t<6;t++)for(let i=0;i<6;i++)for(let a=0;a<6;a++)r.push(n([e[t],e[i],e[a]]));let i=8;for(let e=0;e<24;e++,i+=10)r.push(n([i,i,i]));return r}function a(e){return i()[e]}function o(e){switch(e.type){case`named`:return t(e.name);case`rgb`:return n(e.rgb);case`table`:return a(e.index)}}return{value:o}}var WD=/#([0-9a-f]{3,8})/i,GD=/var\((--[\w-]+-ansi-[\w-]+)\)/,KD={black:`#000000`,red:`#cd3131`,green:`#0DBC79`,yellow:`#E5E510`,blue:`#2472C8`,magenta:`#BC3FBC`,cyan:`#11A8CD`,white:`#E5E5E5`,brightBlack:`#666666`,brightRed:`#F14C4C`,brightGreen:`#23D18B`,brightYellow:`#F5F543`,brightBlue:`#3B8EEA`,brightMagenta:`#D670D6`,brightCyan:`#29B8DB`,brightWhite:`#FFFFFF`};function qD(e,t,n){let r=DE(e,n),i=IE(t),a=UD(Object.fromEntries(ID.map(t=>{let n=`terminal.ansi${t[0].toUpperCase()}${t.substring(1)}`;return[t,e.colors?.[n]||KD[t]]}))),o=VD();return i.map(t=>o.parse(t[0]).map(n=>{let i,o;n.decorations.has(`reverse`)?(i=n.background?a.value(n.background):e.bg,o=n.foreground?a.value(n.foreground):e.fg):(i=n.foreground?a.value(n.foreground):e.fg,o=n.background?a.value(n.background):void 0),i=OE(i,r),o=OE(o,r),n.decorations.has(`dim`)&&(i=JD(i));let s=fT.None;return n.decorations.has(`bold`)&&(s|=fT.Bold),n.decorations.has(`italic`)&&(s|=fT.Italic),n.decorations.has(`underline`)&&(s|=fT.Underline),n.decorations.has(`strikethrough`)&&(s|=fT.Strikethrough),{content:n.value,offset:t[1],color:i,bgColor:o,fontStyle:s}}))}function JD(e){let t=e.match(WD);if(t){let e=t[1];if(e.length===8){let t=Math.round(Number.parseInt(e.slice(6,8),16)/2).toString(16).padStart(2,`0`);return`#${e.slice(0,6)}${t}`}if(e.length===6)return`#${e}80`;if(e.length===4){let t=e[0],n=e[1],r=e[2],i=e[3];return`#${t}${t}${n}${n}${r}${r}${Math.round(Number.parseInt(`${i}${i}`,16)/2).toString(16).padStart(2,`0`)}`}if(e.length===3){let t=e[0],n=e[1],r=e[2];return`#${t}${t}${n}${n}${r}${r}80`}}let n=e.match(GD);return n?`var(${n[1]}-dim)`:e}function YD(e,t,n={}){let r=e.resolveLangAlias(n.lang||`text`),{theme:i=e.getLoadedThemes()[0]}=n;if(!jE(r)&&!NE(i)&&r===`ansi`){let{theme:r}=e.setTheme(i);return qD(r,t,n)}return rD(e,t,n)}function XD(e,t,n){let r,i,a,o,s,c;if(`themes`in n){let{defaultColor:l=`light`,cssVariablePrefix:u=`--shiki-`,colorsRendering:d=`css-vars`}=n,f=Object.entries(n.themes).filter(e=>e[1]).map(e=>({color:e[0],theme:e[1]})).sort((e,t)=>e.color===l?-1:+(t.color===l));if(f.length===0)throw new Gw("`themes` option must not be empty");let p=fD(e,t,n,YD);if(c=ZE(p),l&&l!==`light-dark()`&&!f.some(e=>e.color===l))throw new Gw(`\`themes\` option must contain the defaultColor key \`${l}\``);let m=f.map(t=>e.getTheme(t.theme)),h=f.map(e=>e.color);a=p.map(e=>e.map(e=>DD(e,h,u,l,d))),c&&XE(a,c);let g=f.map(e=>DE(e.theme,n));i=ZD(f,m,g,u,l,`fg`,d),r=ZD(f,m,g,u,l,`bg`,d),o=`shiki-themes ${m.map(e=>e.name).join(` `)}`,s=l?void 0:[i,r].join(`;`)}else if(`theme`in n){let s=DE(n.theme,n);a=YD(e,t,n);let l=e.getTheme(n.theme);r=OE(l.bg,s),i=OE(l.fg,s),o=l.name,c=ZE(a)}else throw new Gw("Invalid options, either `theme` or `themes` must be provided");return{tokens:a,fg:i,bg:r,themeName:o,rootStyle:s,grammarState:c}}function ZD(e,t,n,r,i,a,o){return e.map((s,c)=>{let l=OE(t[c][a],n[c])||`inherit`,u=`${r+s.color}${a===`bg`?`-bg`:``}:${l}`;if(c===0&&i){if(i===`light-dark()`&&e.length>1){let r=e.findIndex(e=>e.color===`light`),i=e.findIndex(e=>e.color===`dark`);if(r===-1||i===-1)throw new Gw('When using `defaultColor: "light-dark()"`, you must provide both `light` and `dark` themes');return`light-dark(${OE(t[r][a],n[r])||`inherit`}, ${OE(t[i][a],n[i])||`inherit`});${u}`}return l}return o===`css-vars`?u:null}).filter(e=>!!e).join(`;`)}var QD=/^\s+$/,$D=/^(\s*)(.*?)(\s*)$/;function eO(e,t,n,r={meta:{},options:n,codeToHast:(t,n)=>eO(e,t,n),codeToTokens:(t,n)=>XD(e,t,n)}){let i=t;for(let e of PD(n))i=e.preprocess?.call(r,i,n)||i;let{tokens:a,fg:o,bg:s,themeName:c,rootStyle:l,grammarState:u}=XD(e,i,n),{mergeWhitespaces:d=!0,mergeSameStyleTokens:f=!1}=n;d===!0?a=nO(a):d===`never`&&(a=rO(a)),f&&(a=iO(a));let p={...r,get source(){return i}};for(let e of PD(n))a=e.tokens?.call(p,a)||a;return tO(a,{...n,fg:o,bg:s,themeName:c,rootStyle:n.rootStyle===!1?!1:n.rootStyle??l},p,u)}function tO(e,t,n,r=ZE(e)){let i=PD(t),a=[],o={type:`root`,children:[]},{structure:s=`classic`,tabindex:c=`0`}=t,l={class:`shiki ${t.themeName||``}`};t.rootStyle!==!1&&(l.style=t.rootStyle==null?`background-color:${t.bg};color:${t.fg}`:t.rootStyle),c!==!1&&c!=null&&(l.tabindex=c.toString());for(let[e,n]of Object.entries(t.meta||{}))e.startsWith(`_`)||(l[e]=n);let u={type:`element`,tagName:`pre`,properties:l,children:[],data:t.data},d={type:`element`,tagName:`code`,properties:{},children:a},f=[],p={...n,structure:s,addClassToHast:hD,get source(){return n.source},get tokens(){return e},get options(){return t},get root(){return o},get pre(){return u},get code(){return d},get lines(){return f}};if(e.forEach((e,t)=>{t&&(s===`inline`?o.children.push({type:`element`,tagName:`br`,properties:{},children:[]}):s===`classic`&&a.push({type:`text`,value:`
|
|
39
|
+
`}));let n={type:`element`,tagName:`span`,properties:{class:`line`},children:[]},r=0;for(let a of e){let e={type:`element`,tagName:`span`,properties:{...a.htmlAttrs},children:[{type:`text`,value:a.content}]},c=kD(a.htmlStyle||OD(a));c&&(e.properties.style=c);for(let o of i)e=o?.span?.call(p,e,t+1,r,n,a)||e;s===`inline`?o.children.push(e):s===`classic`&&n.children.push(e),r+=a.content.length}if(s===`classic`){for(let e of i)n=e?.line?.call(p,n,t+1)||n;f.push(n),a.push(n)}else s===`inline`&&f.push(n)}),s===`classic`){for(let e of i)d=e?.code?.call(p,d)||d;u.children.push(d);for(let e of i)u=e?.pre?.call(p,u)||u;o.children.push(u)}else if(s===`inline`){let e=[],t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]};for(let n of o.children)n.type===`element`&&n.tagName===`br`?(e.push(t),t={type:`element`,tagName:`span`,properties:{class:`line`},children:[]}):(n.type===`element`||n.type===`text`)&&t.children.push(n);e.push(t);let n={type:`element`,tagName:`code`,properties:{},children:e};for(let e of i)n=e?.code?.call(p,n)||n;o.children=[];for(let e=0;e<n.children.length;e++){e>0&&o.children.push({type:`element`,tagName:`br`,properties:{},children:[]});let t=n.children[e];t.type===`element`&&o.children.push(...t.children)}}let m=o;for(let e of i)m=e?.root?.call(p,m)||m;return r&&XE(m,r),m}function nO(e){return e.map(e=>{let t=[],n=``,r;return e.forEach((i,a)=>{let o=!(i.fontStyle&&(i.fontStyle&fT.Underline||i.fontStyle&fT.Strikethrough));o&&QD.test(i.content)&&e[a+1]?(r===void 0&&(r=i.offset),n+=i.content):n?(o?t.push({...i,offset:r,content:n+i.content}):t.push({content:n,offset:r},i),r=void 0,n=``):t.push(i)}),t})}function rO(e){return e.map(e=>e.flatMap(e=>{if(QD.test(e.content))return e;let t=e.content.match($D);if(!t)return e;let[,n,r,i]=t;if(!n&&!i)return e;let a=[{...e,offset:e.offset+n.length,content:r}];return n&&a.unshift({content:n,offset:e.offset}),i&&a.push({content:i,offset:e.offset+n.length+r.length}),a}))}function iO(e){return e.map(e=>{let t=[];for(let n of e){if(t.length===0){t.push({...n});continue}let e=t.at(-1),r=kD(e.htmlStyle||OD(e)),i=kD(n.htmlStyle||OD(n)),a=e.fontStyle&&(e.fontStyle&fT.Underline||e.fontStyle&fT.Strikethrough),o=n.fontStyle&&(n.fontStyle&fT.Underline||n.fontStyle&fT.Strikethrough);!a&&!o&&r===i?e.content+=n.content:t.push({...n})}return t})}var aO=gC;function oO(e,t,n){let r={meta:{},options:n,codeToHast:(t,n)=>eO(e,t,n),codeToTokens:(t,n)=>XD(e,t,n)},i=aO(eO(e,t,n,r));for(let e of PD(n))i=e.postprocess?.call(r,i,n)||i;return i}async function sO(e){let t=await JE(e);return{getLastGrammarState:(...e)=>iD(t,...e),codeToTokensBase:(e,n)=>YD(t,e,n),codeToTokensWithThemes:(e,n)=>fD(t,e,n),codeToTokens:(e,n)=>XD(t,e,n),codeToHast:(e,n)=>eO(t,e,n),codeToHtml:(e,n)=>oO(t,e,n),getBundledLanguages:()=>({}),getBundledThemes:()=>({}),...t,getInternalContext:()=>t}}function cO(e){let t=e.langs,n=e.themes,r=e.engine;async function i(e){function i(n){if(typeof n==`string`){if(n=e.langAlias?.[n]||n,ME(n))return[];let r=t[n];if(!r)throw new Gw(`Language \`${n}\` is not included in this bundle. You may want to load it from external source.`);return r}return n}function a(e){if(PE(e))return`none`;if(typeof e==`string`){let t=n[e];if(!t)throw new Gw(`Theme \`${e}\` is not included in this bundle. You may want to load it from external source.`);return t}return e}let o=(e.themes??[]).map(e=>a(e)),s=(e.langs??[]).map(e=>i(e)),c=await sO({engine:e.engine??r(),...e,themes:o,langs:s});return{...c,loadLanguage(...e){return c.loadLanguage(...e.map(i))},loadTheme(...e){return c.loadTheme(...e.map(a))},getBundledLanguages(){return t},getBundledThemes(){return n}}}return i}function lO(e){let t;async function n(n={}){if(t){let e=await t;return await Promise.all([e.loadTheme(...n.themes||[]),e.loadLanguage(...n.langs||[])]),e}{t=e({...n,themes:[],langs:[]});let r=await t;return await Promise.all([r.loadTheme(...n.themes||[]),r.loadLanguage(...n.langs||[])]),r}}return n}function uO(e,t){let n=lO(e);async function r(e,r){let i=await n({langs:[r.lang],themes:`theme`in r?[r.theme]:Object.values(r.themes)}),a=await t?.guessEmbeddedLanguages?.(e,r.lang,i);return a&&await i.loadLanguage(...a),i}return{getSingletonHighlighter(e){return n(e)},async codeToHtml(e,t){return(await r(e,t)).codeToHtml(e,t)},async codeToHast(e,t){return(await r(e,t)).codeToHast(e,t)},async codeToTokens(e,t){return(await r(e,t)).codeToTokens(e,t)},async codeToTokensBase(e,t){return(await r(e,t)).codeToTokensBase(e,t)},async codeToTokensWithThemes(e,t){return(await r(e,t)).codeToTokensWithThemes(e,t)},async getLastGrammarState(e,t){return(await n({langs:[t.lang],themes:[t.theme]})).getLastGrammarState(e,t)}}}var dO=cO({langs:pw,themes:mw,engine:()=>(0,Ww.createOnigurumaEngine)(K(()=>import(`./_BnjxR4X6.js`),[]))}),{codeToHtml:Dte,codeToHast:Ote,codeToTokens:kte,codeToTokensBase:Ate,codeToTokensWithThemes:jte,getSingletonHighlighter:Mte,getLastGrammarState:Nte}=uO(dO,{guessEmbeddedLanguages:SD}),fO=4294967295,pO=class{patterns;options;regexps;constructor(e,t={}){this.patterns=e,this.options=t;let{forgiving:n=!1,cache:r,regexConstructor:i}=t;if(!i)throw Error("Option `regexConstructor` is not provided");this.regexps=e.map(e=>{if(typeof e!=`string`)return e;let t=r?.get(e);if(t){if(t instanceof RegExp)return t;if(n)return null;throw t}try{let t=i(e);return r?.set(e,t),t}catch(t){if(r?.set(e,t),n)return null;throw t}})}findNextMatchSync(e,t,n){let r=typeof e==`string`?e:e.content,i=[];function a(e,t,n=0){return{index:e,captureIndices:t.indices.map(e=>e==null?{start:fO,end:fO,length:0}:{start:e[0]+n,end:e[1]+n,length:e[1]-e[0]})}}for(let e=0;e<this.regexps.length;e++){let n=this.regexps[e];if(n)try{n.lastIndex=t;let o=n.exec(r);if(!o)continue;if(o.index===t)return a(e,o,0);i.push([e,o,0])}catch(e){if(this.options.forgiving)continue;throw e}}if(i.length){let e=Math.min(...i.map(e=>e[1].index));for(let[t,n,r]of i)if(n.index===e)return a(t,n,r)}return null}};function mO(e){if([...e].length!==1)throw Error(`Expected "${e}" to be a single code point`);return e.codePointAt(0)}function hO(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}var gO=new Set([`alnum`,`alpha`,`ascii`,`blank`,`cntrl`,`digit`,`graph`,`lower`,`print`,`punct`,`space`,`upper`,`word`,`xdigit`]),_O=String.raw;function vO(e,t){if(e==null)throw Error(t??`Value expected`);return e}var yO=_O`\[\^?`,bO=`c.? | C(?:-.?)?|${_O`[pP]\{(?:\^?[-\x20_]*[A-Za-z][-\x20\w]*\})?`}|${_O`x[89A-Fa-f]\p{AHex}(?:\\x[89A-Fa-f]\p{AHex})*`}|${_O`u(?:\p{AHex}{4})? | x\{[^\}]*\}? | x\p{AHex}{0,2}`}|${_O`o\{[^\}]*\}?`}|${_O`\d{1,3}`}`,xO=/[?*+][?+]?|\{(?:\d+(?:,\d*)?|,\d+)\}\??/,SO=new RegExp(_O`
|
|
40
40
|
\\ (?:
|
|
41
|
-
${
|
|
41
|
+
${bO}
|
|
42
42
|
| [gk]<[^>]*>?
|
|
43
43
|
| [gk]'[^']*'?
|
|
44
44
|
| .
|
|
@@ -55,20 +55,20 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
|
|
55
55
|
)?
|
|
56
56
|
| \*[^\)]*\)?
|
|
57
57
|
)?
|
|
58
|
-
| (?:${
|
|
59
|
-
| ${
|
|
58
|
+
| (?:${xO.source})+
|
|
59
|
+
| ${yO}
|
|
60
60
|
| .
|
|
61
|
-
`.replace(/\s+/g,``),`gsu`),
|
|
61
|
+
`.replace(/\s+/g,``),`gsu`),CO=new RegExp(_O`
|
|
62
62
|
\\ (?:
|
|
63
|
-
${
|
|
63
|
+
${bO}
|
|
64
64
|
| .
|
|
65
65
|
)
|
|
66
66
|
| \[:(?:\^?\p{Alpha}+|\^):\]
|
|
67
|
-
| ${
|
|
67
|
+
| ${yO}
|
|
68
68
|
| &&
|
|
69
69
|
| .
|
|
70
|
-
`.replace(/\s+/g,``),`gsu`);function
|
|
71
|
-
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:FO(`dot`,n)}:n===`^`||n===`$`?{token:OO(e.singleline?{"^":hO`\A`,$:hO`\Z`}[n]:n,n)}:n===`|`?{token:DO(n)}:yO.test(n)?{tokens:tk(n)}:{token:AO(fO(n),n)}}function wO(e,t,n){let r=[PO(t[1]===`^`,t)],i=1,a;for(xO.lastIndex=n;a=xO.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(PO(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(AO(93,e));else if(i--,r.push(jO(e)),!i)break}else{let t=TO(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:xO.lastIndex||e.length}}function TO(e){if(e[0]===`\\`)return EO(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!mO.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return FO(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?MO(e):e===`&&`?NO(e):AO(fO(e),e)}function EO(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return GO(e);if(`dDhHsSwW`.includes(n))return YO(e);if(e.startsWith(hO`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return XO(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return AO(fO(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return AO($O(e),e);if(WO.has(n))return AO(WO.get(n),e);if(/\d/.test(n))return LO(t,e);if(e===`\\`)throw Error(hO`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return AO(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function DO(e){return{type:`Alternator`,raw:e}}function OO(e,t){return{type:`Assertion`,kind:e,raw:t}}function kO(e){return{type:`Backreference`,raw:e}}function AO(e,t){return{type:`Character`,value:e,raw:t}}function jO(e){return{type:`CharacterClassClose`,raw:e}}function MO(e){return{type:`CharacterClassHyphen`,raw:e}}function NO(e){return{type:`CharacterClassIntersector`,raw:e}}function PO(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function FO(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function IO(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:gO(n.flags),raw:t}}function LO(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function RO(e){return{type:`GroupClose`,raw:e}}function zO(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function BO(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function VO(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function HO(e){return{type:`Subroutine`,raw:e}}var UO=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),WO=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function GO(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return AO(fO(t.toUpperCase())-64,e)}function KO(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=ZO(n),o=ZO(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),IO(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,zO(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function qO(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=UO.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return BO(l,r??null,i?.split(`,`)??null,e)}function JO(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return VO(t,n,r,e)}function YO(e){let t=e[1].toLowerCase();return FO({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function XO(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return FO(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function ZO(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function QO(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function $O(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function ek(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[kO(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(hO`Octal encoded byte above 177 unsupported "${n}"`)}else r=fO(t);a.push(AO(r,(e===0?`\\`:``)+t))}return a}function tk(e){let t=[],n=new RegExp(yO,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(JO(e.slice(0,-1)));continue}}}t.push(JO(e))}return t}function nk(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function rk(e){return ik.has(e.type)}var ik=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function ak(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=SO(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return hk();case`Assertion`:return ok(n);case`Backreference`:return sk(n,a);case`Character`:return yk(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return ck(n,a,t);case`CharacterClassOpen`:return lk(n,a,t);case`CharacterSet`:return uk(n,a);case`Directive`:return Ck(n.kind,{flags:n.flags});case`GroupOpen`:return dk(n,a,t);case`NamedCallout`:return Dk(n.kind,n.tag,n.arguments);case`Quantifier`:return fk(n,a);case`Subroutine`:return pk(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Ak(wk(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(hO`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(hO`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function ok({kind:e}){return gk(gO({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===hO`\B`||e===hO`\Y`})}function sk({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,_k(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return _k(r)}return i(+r)}function ck(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),xk(o,e);throw Error(`Invalid character class range`)}return yk(fO(`-`))}function lk({negate:e},t,n){let{tokens:r,walk:i}=t,a=[bk()],o=r[t.nextIndex],s=zk(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(bk()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=zk(r[t.nextIndex],o)}let c=bk({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function uk({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Rk(n);if(mO.has(r)&&!o?.has(r))e=`posix`,n=r;else return Mk(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Ok(n,{negate:t}):Sk(e,{negate:t})}function dk(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Nk(e),l=c.type===`AbsenceFunction`,u=Lk(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&pO(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Bk(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(hk()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(Ik(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Ik(t)||Lk(t)&&t.negate)throw Error(e)}}f=Bk(r[t.nextIndex])}return t.nextIndex++,c}function fk({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!rk(a))throw Error(`Quantifier requires a repeatable token`);let o=kk(e,t,n,a);return i.body.pop(),o}function pk({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=jk(i);return r.push(o),o}function mk(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Pk(t?.body)}}function hk(e){return{type:`Alternative`,body:Fk(e?.body)}}function gk(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function _k(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function vk(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Ite(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Pk(t?.body)}}function yk(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function bk(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Fk(e?.body)}}function xk(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function Sk(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function Ck(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:gO(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function wk(e){return{type:`Flags`,...e}}function Tk(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Pk(e?.body)}}function Ek(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Pk(e?.body)}}function Dk(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function Ok(e,t){let n=!!t?.negate;if(!mO.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function kk(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Ak(e,t){return{type:`Regex`,body:Pk(t?.body),flags:e}}function jk(e){return{type:`Subroutine`,ref:e}}function Mk(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Rk(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Lte(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(hO`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Nk({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return mk(`repeater`);case`atomic`:return Tk({atomic:!0});case`capturing`:return vk(i,{name:n});case`group`:return Tk({flags:e});case`lookahead`:case`lookbehind`:return Ek({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Pk(e){if(e===void 0)e=[hk()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Fk(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function Ik(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function Lk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Ite(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Lte(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function Rk(e){return e.replace(/[- _]+/g,``).toLowerCase()}function zk(e,t){let n=t;return gO(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Bk(e){return gO(e,`Unclosed group`)}function Vk(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Hk(c).splice(Math.max(0,Uk(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Hk(c).splice(Uk(s)+1)},removeAllPrevSiblings(){let e=Uk(s)+l;return l-=e,Hk(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Uk(s)+l)]=e:gO(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Hk(c).splice(Math.max(0,Uk(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Uk(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Hk(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Uk(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Rte=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function zte(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Bte(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var Wk=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Gk(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===Wk.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?Wk.CHAR_CLASS:Wk.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Kk(e,t,n,r){Gk(e,t,n,r)}function Vte(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===Wk.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function qk(e,t,n){return!!Vte(e,t,0,n)}function Hte(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Jk=new RegExp(String.raw`(?<noncapturingStart>${Rte})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Ute(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Jk.lastIndex=Number.isNaN(c)?0:c+7;f=Jk.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),zte(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Gk(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},Wk.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Yk=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,Xk=new RegExp(String.raw`
|
|
70
|
+
`.replace(/\s+/g,``),`gsu`);function wO(e,t={}){let n={flags:``,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}};if(typeof e!=`string`)throw Error(`String expected as pattern`);let r=ek(n.flags),i=[r.extended],a={captureGroup:n.rules.captureGroup,getCurrentModX(){return i.at(-1)},numOpenGroups:0,popModX(){i.pop()},pushModX(e){i.push(e)},replaceCurrentModX(e){i[i.length-1]=e},singleline:n.rules.singleline},o=[],s;for(SO.lastIndex=0;s=SO.exec(e);){let t=TO(a,e,s[0],SO.lastIndex);t.tokens?o.push(...t.tokens):t.token&&o.push(t.token),t.lastIndex!==void 0&&(SO.lastIndex=t.lastIndex)}let c=[],l=0;o.filter(e=>e.type===`GroupOpen`).forEach(e=>{e.kind===`capturing`?e.number=++l:e.raw===`(`&&c.push(e)}),l||c.forEach((e,t)=>{e.kind=`capturing`,e.number=t+1});let u=l||c.length;return{tokens:o.map(e=>e.type===`EscapedNumber`?nk(e,u):e).flat(),flags:r}}function TO(e,t,n,r){let[i,a]=n;if(n===`[`||n===`[^`){let e=EO(t,n,r);return{tokens:e.tokens,lastIndex:e.lastIndex}}if(i===`\\`){if(`AbBGyYzZ`.includes(a))return{token:AO(n,n)};if(/^\\g[<']/.test(n)){if(!/^\\g(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:WO(n)}}if(/^\\k[<']/.test(n)){if(!/^\\k(?:<[^>]+>|'[^']+')$/.test(n))throw Error(`Invalid group name "${n}"`);return{token:jO(n)}}if(a===`K`)return{token:RO(`keep`,n)};if(a===`N`||a===`R`)return{token:LO(`newline`,n,{negate:a===`N`})};if(a===`O`)return{token:LO(`any`,n)};if(a===`X`)return{token:LO(`text_segment`,n)};let e=OO(n,{inCharClass:!1});return Array.isArray(e)?{tokens:e}:{token:e}}if(i===`(`){if(a===`*`)return{token:YO(n)};if(n===`(?{`)throw Error(`Unsupported callout "${n}"`);if(n.startsWith(`(?#`)){if(t[r]!==`)`)throw Error(`Unclosed comment group "(?#"`);return{lastIndex:r+1}}if(/^\(\?[-imx]+[:)]$/.test(n))return{token:JO(n,e)};if(e.pushModX(e.getCurrentModX()),e.numOpenGroups++,n===`(`&&!e.captureGroup||n===`(?:`)return{token:VO(`group`,n)};if(n===`(?>`)return{token:VO(`atomic`,n)};if(n===`(?=`||n===`(?!`||n===`(?<=`||n===`(?<!`)return{token:VO(n[2]===`<`?`lookbehind`:`lookahead`,n,{negate:n.endsWith(`!`)})};if(n===`(`&&e.captureGroup||n.startsWith(`(?<`)&&n.endsWith(`>`)||n.startsWith(`(?'`)&&n.endsWith(`'`))return{token:VO(`capturing`,n,{...n!==`(`&&{name:n.slice(3,-1)}})};if(n.startsWith(`(?~`)){if(n===`(?~|`)throw Error(`Unsupported absence function kind "${n}"`);return{token:VO(`absence_repeater`,n)}}throw Error(n===`(?(`?`Unsupported conditional "${n}"`:`Invalid or unsupported group option "${n}"`)}if(n===`)`){if(e.popModX(),e.numOpenGroups--,e.numOpenGroups<0)throw Error(`Unmatched ")"`);return{token:BO(n)}}if(e.getCurrentModX()){if(n===`#`){let e=t.indexOf(`
|
|
71
|
+
`,r);return{lastIndex:e===-1?t.length:e}}if(/^\s$/.test(n)){let e=/\s+/y;return e.lastIndex=r,{lastIndex:e.exec(t)?e.lastIndex:r}}}return n===`.`?{token:LO(`dot`,n)}:n===`^`||n===`$`?{token:AO(e.singleline?{"^":_O`\A`,$:_O`\Z`}[n]:n,n)}:n===`|`?{token:kO(n)}:xO.test(n)?{tokens:rk(n)}:{token:MO(mO(n),n)}}function EO(e,t,n){let r=[IO(t[1]===`^`,t)],i=1,a;for(CO.lastIndex=n;a=CO.exec(e);){let e=a[0];if(e[0]===`[`&&e[1]!==`:`)i++,r.push(IO(e[1]===`^`,e));else if(e===`]`){if(r.at(-1).type===`CharacterClassOpen`)r.push(MO(93,e));else if(i--,r.push(NO(e)),!i)break}else{let t=DO(e);Array.isArray(t)?r.push(...t):r.push(t)}}return{tokens:r,lastIndex:CO.lastIndex||e.length}}function DO(e){if(e[0]===`\\`)return OO(e,{inCharClass:!0});if(e[0]===`[`){let t=/\[:(?<negate>\^?)(?<name>[a-z]+):\]/.exec(e);if(!t||!gO.has(t.groups.name))throw Error(`Invalid POSIX class "${e}"`);return LO(`posix`,e,{value:t.groups.name,negate:!!t.groups.negate})}return e===`-`?PO(e):e===`&&`?FO(e):MO(mO(e),e)}function OO(e,{inCharClass:t}){let n=e[1];if(n===`c`||n===`C`)return qO(e);if(`dDhHsSwW`.includes(n))return ZO(e);if(e.startsWith(_O`\o{`))throw Error(`Incomplete, invalid, or unsupported octal code point "${e}"`);if(/^\\[pP]\{/.test(e)){if(e.length===3)throw Error(`Incomplete or invalid Unicode property "${e}"`);return QO(e)}if(/^\\x[89A-Fa-f]\p{AHex}/u.test(e))try{let t=e.split(/\\x/).slice(1).map(e=>parseInt(e,16)),n=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}).decode(new Uint8Array(t)),r=new TextEncoder;return[...n].map(e=>{let t=[...r.encode(e)].map(e=>`\\x${e.toString(16)}`).join(``);return MO(mO(e),t)})}catch{throw Error(`Multibyte code "${e}" incomplete or invalid in Oniguruma`)}if(n===`u`||n===`x`)return MO(tk(e),e);if(KO.has(n))return MO(KO.get(n),e);if(/\d/.test(n))return zO(t,e);if(e===`\\`)throw Error(_O`Incomplete escape "\"`);if(n===`M`)throw Error(`Unsupported meta "${e}"`);if([...e].length===2)return MO(e.codePointAt(1),e);throw Error(`Unexpected escape "${e}"`)}function kO(e){return{type:`Alternator`,raw:e}}function AO(e,t){return{type:`Assertion`,kind:e,raw:t}}function jO(e){return{type:`Backreference`,raw:e}}function MO(e,t){return{type:`Character`,value:e,raw:t}}function NO(e){return{type:`CharacterClassClose`,raw:e}}function PO(e){return{type:`CharacterClassHyphen`,raw:e}}function FO(e){return{type:`CharacterClassIntersector`,raw:e}}function IO(e,t){return{type:`CharacterClassOpen`,negate:e,raw:t}}function LO(e,t,n={}){return{type:`CharacterSet`,kind:e,...n,raw:t}}function RO(e,t,n={}){return e===`keep`?{type:`Directive`,kind:e,raw:t}:{type:`Directive`,kind:e,flags:vO(n.flags),raw:t}}function zO(e,t){return{type:`EscapedNumber`,inCharClass:e,raw:t}}function BO(e){return{type:`GroupClose`,raw:e}}function VO(e,t,n={}){return{type:`GroupOpen`,kind:e,...n,raw:t}}function HO(e,t,n,r){return{type:`NamedCallout`,kind:e,tag:t,arguments:n,raw:r}}function UO(e,t,n,r){return{type:`Quantifier`,kind:e,min:t,max:n,raw:r}}function WO(e){return{type:`Subroutine`,raw:e}}var GO=new Set([`COUNT`,`CMP`,`ERROR`,`FAIL`,`MAX`,`MISMATCH`,`SKIP`,`TOTAL_COUNT`]),KO=new Map([[`a`,7],[`b`,8],[`e`,27],[`f`,12],[`n`,10],[`r`,13],[`t`,9],[`v`,11]]);function qO(e){let t=e[1]===`c`?e[2]:e[3];if(!t||!/[A-Za-z]/.test(t))throw Error(`Unsupported control character "${e}"`);return MO(mO(t.toUpperCase())-64,e)}function JO(e,t){let{on:n,off:r}=/^\(\?(?<on>[imx]*)(?:-(?<off>[-imx]*))?/.exec(e).groups;r??=``;let i=(t.getCurrentModX()||n.includes(`x`))&&!r.includes(`x`),a=$O(n),o=$O(r),s={};if(a&&(s.enable=a),o&&(s.disable=o),e.endsWith(`)`))return t.replaceCurrentModX(i),RO(`flags`,e,{flags:s});if(e.endsWith(`:`))return t.pushModX(i),t.numOpenGroups++,VO(`group`,e,{...(a||o)&&{flags:s}});throw Error(`Unexpected flag modifier "${e}"`)}function YO(e){let t=/\(\*(?<name>[A-Za-z_]\w*)?(?:\[(?<tag>(?:[A-Za-z_]\w*)?)\])?(?:\{(?<args>[^}]*)\})?\)/.exec(e);if(!t)throw Error(`Incomplete or invalid named callout "${e}"`);let{name:n,tag:r,args:i}=t.groups;if(!n)throw Error(`Invalid named callout "${e}"`);if(r===``)throw Error(`Named callout tag with empty value not allowed "${e}"`);let a=i?i.split(`,`).filter(e=>e!==``).map(e=>/^[+-]?\d+$/.test(e)?+e:e):[],[o,s,c]=a,l=GO.has(n)?n.toLowerCase():`custom`;switch(l){case`fail`:case`mismatch`:case`skip`:if(a.length>0)throw Error(`Named callout arguments not allowed "${a}"`);break;case`error`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(typeof o==`string`)throw Error(`Named callout argument must be a number "${o}"`);break;case`max`:if(!a.length||a.length>2)throw Error(`Named callout must have one or two arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(a.length===2&&(typeof s==`number`||!/^[<>X]$/.test(s)))throw Error(`Named callout optional argument two must be '<', '>', or 'X' "${s}"`);break;case`count`:case`total_count`:if(a.length>1)throw Error(`Named callout allows only one argument "${a}"`);if(a.length===1&&(typeof o==`number`||!/^[<>X]$/.test(o)))throw Error(`Named callout optional argument must be '<', '>', or 'X' "${o}"`);break;case`cmp`:if(a.length!==3)throw Error(`Named callout must have three arguments "${a}"`);if(typeof o==`string`&&!/^[A-Za-z_]\w*$/.test(o))throw Error(`Named callout argument one must be a tag or number "${o}"`);if(typeof s==`number`||!/^(?:[<>!=]=|[<>])$/.test(s))throw Error(`Named callout argument two must be '==', '!=', '>', '<', '>=', or '<=' "${s}"`);if(typeof c==`string`&&!/^[A-Za-z_]\w*$/.test(c))throw Error(`Named callout argument three must be a tag or number "${c}"`);break;case`custom`:throw Error(`Undefined callout name "${n}"`);default:throw Error(`Unexpected named callout kind "${l}"`)}return HO(l,r??null,i?.split(`,`)??null,e)}function XO(e){let t=null,n,r;if(e[0]===`{`){let{minStr:i,maxStr:a}=/^\{(?<minStr>\d*)(?:,(?<maxStr>\d*))?/.exec(e).groups,o=1e5;if(+i>o||a&&+a>o)throw Error(`Quantifier value unsupported in Oniguruma`);if(n=+i,r=a===void 0?+i:a===``?1/0:+a,n>r&&(t=`possessive`,[n,r]=[r,n]),e.endsWith(`?`)){if(t===`possessive`)throw Error(`Unsupported possessive interval quantifier chain with "?"`);t=`lazy`}else t||=`greedy`}else n=+(e[0]===`+`),r=e[0]===`?`?1:1/0,t=e[1]===`+`?`possessive`:e[1]===`?`?`lazy`:`greedy`;return UO(t,n,r,e)}function ZO(e){let t=e[1].toLowerCase();return LO({d:`digit`,h:`hex`,s:`space`,w:`word`}[t],e,{negate:e[1]!==t})}function QO(e){let{p:t,neg:n,value:r}=/^\\(?<p>[pP])\{(?<neg>\^?)(?<value>[^}]+)/.exec(e).groups;return LO(`property`,e,{value:r,negate:t===`P`&&!n||t===`p`&&!!n})}function $O(e){let t={};return e.includes(`i`)&&(t.ignoreCase=!0),e.includes(`m`)&&(t.dotAll=!0),e.includes(`x`)&&(t.extended=!0),Object.keys(t).length?t:null}function ek(e){let t={ignoreCase:!1,dotAll:!1,extended:!1,digitIsAscii:!1,posixIsAscii:!1,spaceIsAscii:!1,wordIsAscii:!1,textSegmentMode:null};for(let n=0;n<e.length;n++){let r=e[n];if(!`imxDPSWy`.includes(r))throw Error(`Invalid flag "${r}"`);if(r===`y`){if(!/^y{[gw]}/.test(e.slice(n)))throw Error(`Invalid or unspecified flag "y" mode`);t.textSegmentMode=e[n+2]===`g`?`grapheme`:`word`,n+=3;continue}t[{i:`ignoreCase`,m:`dotAll`,x:`extended`,D:`digitIsAscii`,P:`posixIsAscii`,S:`spaceIsAscii`,W:`wordIsAscii`}[r]]=!0}return t}function tk(e){if(/^(?:\\u(?!\p{AHex}{4})|\\x(?!\p{AHex}{1,2}|\{\p{AHex}{1,8}\}))/u.test(e))throw Error(`Incomplete or invalid escape "${e}"`);let t=e[2]===`{`?/^\\x\{\s*(?<hex>\p{AHex}+)/u.exec(e).groups.hex:e.slice(2);return parseInt(t,16)}function nk(e,t){let{raw:n,inCharClass:r}=e,i=n.slice(1);if(!r&&(i!==`0`&&i.length===1||i[0]!==`0`&&+i<=t))return[jO(n)];let a=[],o=i.match(/^[0-7]+|\d/g);for(let e=0;e<o.length;e++){let t=o[e],r;if(e===0&&t!==`8`&&t!==`9`){if(r=parseInt(t,8),r>127)throw Error(_O`Octal encoded byte above 177 unsupported "${n}"`)}else r=mO(t);a.push(MO(r,(e===0?`\\`:``)+t))}return a}function rk(e){let t=[],n=new RegExp(xO,`gy`),r;for(;r=n.exec(e);){let e=r[0];if(e[0]===`{`){let r=/^\{(?<min>\d+),(?<max>\d+)\}\??$/.exec(e);if(r){let{min:i,max:a}=r.groups;if(+i>+a&&e.endsWith(`?`)){n.lastIndex--,t.push(XO(e.slice(0,-1)));continue}}}t.push(XO(e))}return t}function ik(e,t){if(!Array.isArray(e.body))throw Error(`Expected node with body array`);if(e.body.length!==1)return!1;let n=e.body[0];return!t||Object.keys(t).every(e=>t[e]===n[e])}function ak(e){return ok.has(e.type)}var ok=new Set([`AbsenceFunction`,`Backreference`,`CapturingGroup`,`Character`,`CharacterClass`,`CharacterSet`,`Group`,`Quantifier`,`Subroutine`]);function sk(e,t={}){let n={flags:``,normalizeUnknownPropertyNames:!1,skipBackrefValidation:!1,skipLookbehindValidation:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t,rules:{captureGroup:!1,singleline:!1,...t.rules}},r=wO(e,{flags:n.flags,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline}}),i=(e,t)=>{let n=r.tokens[a.nextIndex];switch(a.parent=e,a.nextIndex++,n.type){case`Alternator`:return _k();case`Assertion`:return ck(n);case`Backreference`:return lk(n,a);case`Character`:return xk(n.value,{useLastValid:!!t.isCheckingRangeEnd});case`CharacterClassHyphen`:return uk(n,a,t);case`CharacterClassOpen`:return dk(n,a,t);case`CharacterSet`:return fk(n,a);case`Directive`:return Tk(n.kind,{flags:n.flags});case`GroupOpen`:return pk(n,a,t);case`NamedCallout`:return kk(n.kind,n.tag,n.arguments);case`Quantifier`:return mk(n,a);case`Subroutine`:return hk(n,a);default:throw Error(`Unexpected token type "${n.type}"`)}},a={capturingGroups:[],hasNumberedRef:!1,namedGroupsByName:new Map,nextIndex:0,normalizeUnknownPropertyNames:n.normalizeUnknownPropertyNames,parent:null,skipBackrefValidation:n.skipBackrefValidation,skipLookbehindValidation:n.skipLookbehindValidation,skipPropertyNameValidation:n.skipPropertyNameValidation,subroutines:[],tokens:r.tokens,unicodePropertyMap:n.unicodePropertyMap,walk:i},o=Mk(Ek(r.flags)),s=o.body[0];for(;a.nextIndex<r.tokens.length;){let e=i(s,{});e.type===`Alternative`?(o.body.push(e),s=e):s.body.push(e)}let{capturingGroups:c,hasNumberedRef:l,namedGroupsByName:u,subroutines:d}=a;if(l&&u.size&&!n.rules.captureGroup)throw Error(`Numbered backref/subroutine not allowed when using named capture`);for(let{ref:e}of d)if(typeof e==`number`){if(e>c.length)throw Error(`Subroutine uses a group number that's not defined`);e&&(c[e-1].isSubroutined=!0)}else if(u.has(e)){if(u.get(e).length>1)throw Error(_O`Subroutine uses a duplicate group name "\g<${e}>"`);u.get(e)[0].isSubroutined=!0}else throw Error(_O`Subroutine uses a group name that's not defined "\g<${e}>"`);return o}function ck({kind:e}){return vk(vO({"^":`line_start`,$:`line_end`,"\\A":`string_start`,"\\b":`word_boundary`,"\\B":`word_boundary`,"\\G":`search_start`,"\\y":`text_segment_boundary`,"\\Y":`text_segment_boundary`,"\\z":`string_end`,"\\Z":`string_end_newline`}[e],`Unexpected assertion kind "${e}"`),{negate:e===_O`\B`||e===_O`\Y`})}function lk({raw:e},t){let n=/^\\k[<']/.test(e),r=n?e.slice(3,-1):e.slice(1),i=(n,r=!1)=>{let i=t.capturingGroups.length,a=!1;if(n>i){if(t.skipBackrefValidation)a=!0;else throw Error(`Not enough capturing groups defined to the left "${e}"`)}return t.hasNumberedRef=!0,yk(r?i+1-n:n,{orphan:a})};if(n){let n=/^(?<sign>-?)0*(?<num>[1-9]\d*)$/.exec(r);if(n)return i(+n.groups.num,!!n.groups.sign);if(/[-+]/.test(r))throw Error(`Invalid backref name "${e}"`);if(!t.namedGroupsByName.has(r))throw Error(`Group name not defined to the left "${e}"`);return yk(r)}return i(+r)}function uk(e,t,n){let{tokens:r,walk:i}=t,a=t.parent,o=a.body.at(-1),s=r[t.nextIndex];if(!n.isCheckingRangeEnd&&o&&o.type!==`CharacterClass`&&o.type!==`CharacterClassRange`&&s&&s.type!==`CharacterClassOpen`&&s.type!==`CharacterClassClose`&&s.type!==`CharacterClassIntersector`){let e=i(a,{...n,isCheckingRangeEnd:!0});if(o.type===`Character`&&e.type===`Character`)return a.body.pop(),Ck(o,e);throw Error(`Invalid character class range`)}return xk(mO(`-`))}function dk({negate:e},t,n){let{tokens:r,walk:i}=t,a=[Sk()],o=r[t.nextIndex],s=Hk(o);for(;s.type!==`CharacterClassClose`;){if(s.type===`CharacterClassIntersector`)a.push(Sk()),t.nextIndex++;else{let e=a.at(-1);e.body.push(i(e,n))}s=Hk(r[t.nextIndex],o)}let c=Sk({negate:e});return a.length===1?c.body=a[0].body:(c.kind=`intersection`,c.body=a.map(e=>e.body.length===1?e.body[0]:e)),t.nextIndex++,c}function fk({kind:e,negate:t,value:n},r){let{normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o}=r;if(e===`property`){let r=Vk(n);if(gO.has(r)&&!o?.has(r))e=`posix`,n=r;else return Pk(n,{negate:t,normalizeUnknownPropertyNames:i,skipPropertyNameValidation:a,unicodePropertyMap:o})}return e===`posix`?Ak(n,{negate:t}):wk(e,{negate:t})}function pk(e,t,n){let{tokens:r,capturingGroups:i,namedGroupsByName:a,skipLookbehindValidation:o,walk:s}=t,c=Fk(e),l=c.type===`AbsenceFunction`,u=zk(c),d=u&&c.negate;if(c.type===`CapturingGroup`&&(i.push(c),c.name&&hO(a,c.name,[]).push(c)),l&&n.isInAbsenceFunction)throw Error(`Nested absence function not supported by Oniguruma`);let f=Uk(r[t.nextIndex]);for(;f.type!==`GroupClose`;){if(f.type===`Alternator`)c.body.push(_k()),t.nextIndex++;else{let e=c.body.at(-1),t=s(e,{...n,isInAbsenceFunction:n.isInAbsenceFunction||l,isInLookbehind:n.isInLookbehind||u,isInNegLookbehind:n.isInNegLookbehind||d});if(e.body.push(t),(u||n.isInLookbehind)&&!o){let e=`Lookbehind includes a pattern not allowed by Oniguruma`;if(d||n.isInNegLookbehind){if(Rk(t)||t.type===`CapturingGroup`)throw Error(e)}else if(Rk(t)||zk(t)&&t.negate)throw Error(e)}}f=Uk(r[t.nextIndex])}return t.nextIndex++,c}function mk({kind:e,min:t,max:n},r){let i=r.parent,a=i.body.at(-1);if(!a||!ak(a))throw Error(`Quantifier requires a repeatable token`);let o=jk(e,t,n,a);return i.body.pop(),o}function hk({raw:e},t){let{capturingGroups:n,subroutines:r}=t,i=e.slice(3,-1),a=/^(?<sign>[-+]?)0*(?<num>[1-9]\d*)$/.exec(i);if(a){let e=+a.groups.num,r=n.length;if(t.hasNumberedRef=!0,i={"":e,"+":r+e,"-":r+1-e}[a.groups.sign],i<1)throw Error(`Invalid subroutine number`)}else i===`0`&&(i=0);let o=Nk(i);return r.push(o),o}function gk(e,t){if(e!==`repeater`)throw Error(`Unexpected absence function kind "${e}"`);return{type:`AbsenceFunction`,kind:e,body:Ik(t?.body)}}function _k(e){return{type:`Alternative`,body:Lk(e?.body)}}function vk(e,t){let n={type:`Assertion`,kind:e};return(e===`word_boundary`||e===`text_segment_boundary`)&&(n.negate=!!t?.negate),n}function yk(e,t){let n=!!t?.orphan;return{type:`Backreference`,ref:e,...n&&{orphan:n}}}function bk(e,t){let n={name:void 0,isSubroutined:!1,...t};if(n.name!==void 0&&!Bk(n.name))throw Error(`Group name "${n.name}" invalid in Oniguruma`);return{type:`CapturingGroup`,number:e,...n.name&&{name:n.name},...n.isSubroutined&&{isSubroutined:n.isSubroutined},body:Ik(t?.body)}}function xk(e,t){let n={useLastValid:!1,...t};if(e>1114111){let t=e.toString(16);if(n.useLastValid)e=1114111;else throw Error(e>1310719?`Invalid code point out of range "\\x{${t}}"`:`Invalid code point out of range in JS "\\x{${t}}"`)}return{type:`Character`,value:e}}function Sk(e){let t={kind:`union`,negate:!1,...e};return{type:`CharacterClass`,kind:t.kind,negate:t.negate,body:Lk(e?.body)}}function Ck(e,t){if(t.value<e.value)throw Error(`Character class range out of order`);return{type:`CharacterClassRange`,min:e,max:t}}function wk(e,t){let n=!!t?.negate,r={type:`CharacterSet`,kind:e};return(e===`digit`||e===`hex`||e===`newline`||e===`space`||e===`word`)&&(r.negate=n),(e===`text_segment`||e===`newline`&&!n)&&(r.variableLength=!0),r}function Tk(e,t={}){if(e===`keep`)return{type:`Directive`,kind:e};if(e===`flags`)return{type:`Directive`,kind:e,flags:vO(t.flags)};throw Error(`Unexpected directive kind "${e}"`)}function Ek(e){return{type:`Flags`,...e}}function Dk(e){let t=e?.atomic,n=e?.flags;if(t&&n)throw Error(`Atomic group cannot have flags`);return{type:`Group`,...t&&{atomic:t},...n&&{flags:n},body:Ik(e?.body)}}function Ok(e){let t={behind:!1,negate:!1,...e};return{type:`LookaroundAssertion`,kind:t.behind?`lookbehind`:`lookahead`,negate:t.negate,body:Ik(e?.body)}}function kk(e,t,n){return{type:`NamedCallout`,kind:e,tag:t,arguments:n}}function Ak(e,t){let n=!!t?.negate;if(!gO.has(e))throw Error(`Invalid POSIX class "${e}"`);return{type:`CharacterSet`,kind:`posix`,value:e,negate:n}}function jk(e,t,n,r){if(t>n)throw Error(`Invalid reversed quantifier range`);return{type:`Quantifier`,kind:e,min:t,max:n,body:r}}function Mk(e,t){return{type:`Regex`,body:Ik(t?.body),flags:e}}function Nk(e){return{type:`Subroutine`,ref:e}}function Pk(e,t){let n={negate:!1,normalizeUnknownPropertyNames:!1,skipPropertyNameValidation:!1,unicodePropertyMap:null,...t},r=n.unicodePropertyMap?.get(Vk(e));if(!r){if(n.normalizeUnknownPropertyNames)r=Pte(e);else if(n.unicodePropertyMap&&!n.skipPropertyNameValidation)throw Error(_O`Invalid Unicode property "\p{${e}}"`)}return{type:`CharacterSet`,kind:`property`,value:r??e,negate:n.negate}}function Fk({flags:e,kind:t,name:n,negate:r,number:i}){switch(t){case`absence_repeater`:return gk(`repeater`);case`atomic`:return Dk({atomic:!0});case`capturing`:return bk(i,{name:n});case`group`:return Dk({flags:e});case`lookahead`:case`lookbehind`:return Ok({behind:t===`lookbehind`,negate:r});default:throw Error(`Unexpected group kind "${t}"`)}}function Ik(e){if(e===void 0)e=[_k()];else if(!Array.isArray(e)||!e.length||!e.every(e=>e.type===`Alternative`))throw Error(`Invalid body; expected array of one or more Alternative nodes`);return e}function Lk(e){if(e===void 0)e=[];else if(!Array.isArray(e)||!e.every(e=>!!e.type))throw Error(`Invalid body; expected array of nodes`);return e}function Rk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookahead`}function zk(e){return e.type===`LookaroundAssertion`&&e.kind===`lookbehind`}function Bk(e){return/^[\p{Alpha}\p{Pc}][^)]*$/u.test(e)}function Pte(e){return e.trim().replace(/[- _]+/g,`_`).replace(/[A-Z][a-z]+(?=[A-Z])/g,`$&_`).replace(/[A-Za-z]+/g,e=>e[0].toUpperCase()+e.slice(1).toLowerCase())}function Vk(e){return e.replace(/[- _]+/g,``).toLowerCase()}function Hk(e,t){let n=t;return vO(e,`Unclosed character class${n?.type===`Character`&&n.value===93&&n.raw===`]`?` (started with "]")`:``}`)}function Uk(e){return vO(e,`Unclosed group`)}function Wk(e,t,n=null){function r(e,t){for(let n=0;n<e.length;n++){let r=i(e[n],t,n,e);n=Math.max(-1,n+r)}}function i(a,o=null,s=null,c=null){let l=0,u=!1,d={node:a,parent:o,key:s,container:c,root:e,remove(){Gk(c).splice(Math.max(0,Kk(s)+l),1),l--,u=!0},removeAllNextSiblings(){return Gk(c).splice(Kk(s)+1)},removeAllPrevSiblings(){let e=Kk(s)+l;return l-=e,Gk(c).splice(0,Math.max(0,e))},replaceWith(e,t={}){let n=!!t.traverse;c?c[Math.max(0,Kk(s)+l)]=e:vO(o,`Can't replace root node`)[s]=e,n&&i(e,o,s,c),u=!0},replaceWithMultiple(e,t={}){let n=!!t.traverse;if(Gk(c).splice(Math.max(0,Kk(s)+l),1,...e),l+=e.length-1,n){let t=0;for(let n=0;n<e.length;n++)t+=i(e[n],o,Kk(s)+n+t,c)}u=!0},skip(){u=!0}},{type:f}=a,p=t[`*`],m=t[f],h=typeof p==`function`?p:p?.enter,g=typeof m==`function`?m:m?.enter;if(h?.(d,n),g?.(d,n),!u)switch(f){case`AbsenceFunction`:case`Alternative`:case`CapturingGroup`:case`CharacterClass`:case`Group`:case`LookaroundAssertion`:r(a.body,a);break;case`Assertion`:case`Backreference`:case`Character`:case`CharacterSet`:case`Directive`:case`Flags`:case`NamedCallout`:case`Subroutine`:break;case`CharacterClassRange`:i(a.min,a,`min`),i(a.max,a,`max`);break;case`Quantifier`:i(a.body,a,`body`);break;case`Regex`:r(a.body,a),i(a.flags,a,`flags`);break;default:throw Error(`Unexpected node type "${f}"`)}return m?.exit?.(d,n),p?.exit?.(d,n),l}return i(e),e}function Gk(e){if(!Array.isArray(e))throw Error(`Container expected`);return e}function Kk(e){if(typeof e!=`number`)throw Error(`Numeric key expected`);return e}var Fte=String.raw`\(\?(?:[:=!>A-Za-z\-]|<[=!]|\(DEFINE\))`;function Ite(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function Lte(e,t,n,r){return e.slice(0,t)+r+e.slice(t+n.length)}var qk=Object.freeze({DEFAULT:`DEFAULT`,CHAR_CLASS:`CHAR_CLASS`});function Jk(e,t,n,r){let i=new RegExp(String.raw`${t}|(?<$skip>\[\^?|\\?.)`,`gsu`),a=[!1],o=0,s=``;for(let t of e.matchAll(i)){let{0:e,groups:{$skip:i}}=t;if(!i&&(!r||r===qk.DEFAULT==!o)){n instanceof Function?s+=n(t,{context:o?qk.CHAR_CLASS:qk.DEFAULT,negated:a[a.length-1]}):s+=n;continue}e[0]===`[`?(o++,a.push(e[1]===`^`)):e===`]`&&o&&(o--,a.pop()),s+=e}return s}function Yk(e,t,n,r){Jk(e,t,n,r)}function Rte(e,t,n=0,r){if(!new RegExp(t,`su`).test(e))return null;let i=RegExp(`${t}|(?<$skip>\\\\?.)`,`gsu`);i.lastIndex=n;let a=0,o;for(;o=i.exec(e);){let{0:e,groups:{$skip:t}}=o;if(!t&&(!r||r===qk.DEFAULT==!a))return o;e===`[`?a++:e===`]`&&a&&a--,i.lastIndex==o.index&&i.lastIndex++}return null}function Xk(e,t,n){return!!Rte(e,t,0,n)}function zte(e,t){let n=/\\?./gsu;n.lastIndex=t;let r=e.length,i=0,a=1,o;for(;o=n.exec(e);){let[e]=o;if(e===`[`)i++;else if(i)e===`]`&&i--;else if(e===`(`)a++;else if(e===`)`&&(a--,!a)){r=o.index;break}}return e.slice(t,r)}var Zk=new RegExp(String.raw`(?<noncapturingStart>${Fte})|(?<capturingStart>\((?:\?<[^>]+>)?)|\\?.`,`gsu`);function Bte(e,t){let n=t?.hiddenCaptures??[],r=t?.captureTransfers??new Map;if(!/\(\?>/.test(e))return{pattern:e,captureTransfers:r,hiddenCaptures:n};let i=[0],a=[],o=0,s=0,c=NaN,l;do{l=!1;let t=0,u=0,d=!1,f;for(Zk.lastIndex=Number.isNaN(c)?0:c+7;f=Zk.exec(e);){let{0:p,index:m,groups:{capturingStart:h,noncapturingStart:g}}=f;if(p===`[`)t++;else if(t)p===`]`&&t--;else if(p===`(?>`&&!d)c=m,d=!0;else if(d&&g)u++;else if(h)d?u++:(o++,i.push(o+s));else if(p===`)`&&d){if(!u){s++;let t=o+s;if(e=`${e.slice(0,c)}(?:(?=(${e.slice(c+3,m)}))<$$${t}>)${e.slice(m+1)}`,l=!0,a.push(t),Ite(n,t),r.size){let e=new Map;r.forEach((n,r)=>{e.set(r>=t?r+1:r,n.map(e=>e>=t?e+1:e))}),r=e}break}u--}}}while(l);return n.push(...a),e=Jk(e,String.raw`\\(?<backrefNum>[1-9]\d*)|<\$\$(?<wrappedBackrefNum>\d+)>`,({0:e,groups:{backrefNum:t,wrappedBackrefNum:n}})=>{if(t){let n=+t;if(n>i.length-1)throw Error(`Backref "${e}" greater than number of captures`);return`\\${i[n]}`}return`\\${n}`},qk.DEFAULT),{pattern:e,captureTransfers:r,hiddenCaptures:n}}var Qk=String.raw`(?:[?*+]|\{\d+(?:,\d*)?\})`,$k=new RegExp(String.raw`
|
|
72
72
|
\\(?: \d+
|
|
73
73
|
| c[A-Za-z]
|
|
74
74
|
| [gk]<[^>]+>
|
|
@@ -81,9 +81,9 @@ var e=Object.defineProperty,t=(t,n)=>{let r={};for(var i in t)e(r,i,{get:t[i],en
|
|
|
81
81
|
| [A-Za-z\-]+:
|
|
82
82
|
| \(DEFINE\)
|
|
83
83
|
))?
|
|
84
|
-
| (?<qBase>${
|
|
84
|
+
| (?<qBase>${Qk})(?<qMod>[?+]?)(?<invalidQ>[?*+\{]?)
|
|
85
85
|
| \\?.
|
|
86
|
-
`.replace(/\s+/g,``),`gsu`);function
|
|
86
|
+
`.replace(/\s+/g,``),`gsu`);function Vte(e){if(!RegExp(`${Qk}\\+`).test(e))return{pattern:e};let t=[],n=null,r=null,i=``,a=0,o;for($k.lastIndex=0;o=$k.exec(e);){let{0:s,index:c,groups:{qBase:l,qMod:u,invalidQ:d}}=o;if(s===`[`)a||(r=c),a++;else if(s===`]`)a?a--:r=null;else if(!a){if(u===`+`&&i&&!i.startsWith(`(`)){if(d)throw Error(`Invalid quantifier "${s}"`);let t=-1;if(/^\{\d+\}$/.test(l))e=Lte(e,c+l.length,u,``);else{if(i===`)`||i===`]`){let t=i===`)`?n:r;if(t===null)throw Error(`Invalid unmatched "${i}"`);e=`${e.slice(0,t)}(?>${e.slice(t,c)}${l})${e.slice(c+s.length)}`}else e=`${e.slice(0,c-i.length)}(?>${i}${l})${e.slice(c+s.length)}`;t+=4}$k.lastIndex+=t}else s[0]===`(`?t.push(c):s===`)`&&(n=t.length?t.pop():null)}i=s}return{pattern:e}}var eA=String.raw,tA=eA`\(\?R=(?<rDepth>[^\)]+)\)|${eA`\\g<(?<gRNameOrNum>[^>&]+)&R=(?<gRDepth>[^>]+)>`}`,nA=eA`\(\?<(?![=!])(?<captureName>[^>]+)>`,rA=eA`${nA}|(?<unnamed>\()(?!\?)`,iA=new RegExp(eA`${nA}|${tA}|\(\?|\\?.`,`gsu`),aA=`Cannot use multiple overlapping recursions`;function Hte(e,t){let{hiddenCaptures:n,mode:r}={hiddenCaptures:[],mode:`plugin`,...t},i=t?.captureTransfers??new Map;if(!new RegExp(tA,`su`).test(e))return{pattern:e,captureTransfers:i,hiddenCaptures:n};if(r===`plugin`&&Xk(e,eA`\(\?\(DEFINE\)`,qk.DEFAULT))throw Error(`DEFINE groups cannot be used with recursion`);let a=[],o=Xk(e,eA`\\[1-9]`,qk.DEFAULT),s=new Map,c=[],l=!1,u=0,d=0,f;for(iA.lastIndex=0;f=iA.exec(e);){let{0:t,groups:{captureName:p,rDepth:m,gRNameOrNum:h,gRDepth:g}}=f;if(t===`[`)u++;else if(u)t===`]`&&u--;else{if(m){if(oA(m),l)throw Error(aA);if(o)throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with global recursion`);let t=e.slice(0,f.index),s=e.slice(iA.lastIndex);if(Xk(s,tA,qk.DEFAULT))throw Error(aA);let c=m-1;e=sA(t,s,c,!1,n,a,d),i=lA(i,t,c,a.length,0,d);break}if(h){oA(g);let u=!1;for(let e of c)if(e.name===h||e.num===+h){if(u=!0,e.hasRecursedWithin)throw Error(aA);break}if(!u)throw Error(eA`Recursive \g cannot be used outside the referenced group "${r===`external`?h:eA`\g<${h}&R=${g}>`}"`);let p=s.get(h),m=zte(e,p);if(o&&Xk(m,eA`${nA}|\((?!\?)`,qk.DEFAULT))throw Error(`${r===`external`?`Backrefs`:`Numbered backrefs`} cannot be used with recursion of capturing groups`);let _=e.slice(p,f.index),v=m.slice(_.length+t.length),y=a.length,b=g-1,x=sA(_,v,b,!0,n,a,d);i=lA(i,_,b,a.length-y,y,d),e=`${e.slice(0,p)}${x}${e.slice(p+m.length)}`,iA.lastIndex+=x.length-t.length-_.length-v.length,c.forEach(e=>e.hasRecursedWithin=!0),l=!0}else if(p)d++,s.set(String(d),iA.lastIndex),s.set(p,iA.lastIndex),c.push({num:d,name:p});else if(t[0]===`(`){let e=t===`(`;e&&(d++,s.set(String(d),iA.lastIndex)),c.push(e?{num:d}:{})}else t===`)`&&c.pop()}}return n.push(...a),{pattern:e,captureTransfers:i,hiddenCaptures:n}}function oA(e){let t=`Max depth must be integer between 2 and 100; used ${e}`;if(!/^[1-9]\d*$/.test(e)||(e=+e,e<2||e>100))throw Error(t)}function sA(e,t,n,r,i,a,o){let s=new Set;r&&Yk(e+t,nA,({groups:{captureName:e}})=>{s.add(e)},qk.DEFAULT);let c=[n,r?s:null,i,a,o];return`${e}${cA(`(?:${e}`,`forward`,...c)}(?:)${cA(`${t})`,`backward`,...c)}${t}`}function cA(e,t,n,r,i,a,o){let s=e=>t===`forward`?e+2:n-e+2-1,c=``;for(let t=0;t<n;t++){let n=s(t);c+=Jk(e,eA`${rA}|\\k<(?<backref>[^>]+)>`,({0:e,groups:{captureName:t,unnamed:s,backref:c}})=>{if(c&&r&&!r.has(c))return e;let l=`_$${n}`;if(s||t){let n=o+a.length+1;return a.push(n),Ute(i,n),s?e:`(?<${t}${l}>`}return eA`\k<${c}${l}>`},qk.DEFAULT)}return c}function Ute(e,t){for(let n=0;n<e.length;n++)e[n]>=t&&e[n]++}function lA(e,t,n,r,i,a){if(e.size&&r){let o=0;Yk(t,rA,()=>o++,qk.DEFAULT);let s=a-o+i,c=new Map;return e.forEach((e,t)=>{let i=(r-o*n)/n,a=o*n,l=t>s+o?t+r:t,u=[];for(let t of e)if(t<=s)u.push(t);else if(t>s+o+i)u.push(t+r);else if(t<=s+o)for(let e=0;e<=n;e++)u.push(t+o*e);else for(let e=0;e<=n;e++)u.push(t+a+i*e);c.set(l,u)}),c}return e}var uA=String.fromCodePoint,q=String.raw,dA={},fA=globalThis.RegExp;dA.flagGroups=(()=>{try{new fA(`(?i:)`)}catch{return!1}return!0})(),dA.unicodeSets=(()=>{try{new fA(`[[]]`,`v`)}catch{return!1}return!0})(),dA.bugFlagVLiteralHyphenIsRange=dA.unicodeSets?(()=>{try{new fA(q`[\d\-a]`,`v`)}catch{return!0}return!1})():!1,dA.bugNestedClassIgnoresNegation=dA.unicodeSets&&new fA(`[[^a]]`,`v`).test(`a`);function pA(e,{enable:t,disable:n}){return{dotAll:!n?.dotAll&&!!(t?.dotAll||e.dotAll),ignoreCase:!n?.ignoreCase&&!!(t?.ignoreCase||e.ignoreCase)}}function mA(e,t,n){return e.has(t)||e.set(t,n),e.get(t)}function hA(e,t){return gA[e]>=gA[t]}function Wte(e,t){if(e==null)throw Error(t??`Value expected`);return e}var gA={ES2025:2025,ES2024:2024,ES2018:2018},Gte={auto:`auto`,ES2025:`ES2025`,ES2024:`ES2024`,ES2018:`ES2018`};function _A(e={}){if({}.toString.call(e)!==`[object Object]`)throw Error(`Unexpected options`);if(e.target!==void 0&&!Gte[e.target])throw Error(`Unexpected target "${e.target}"`);let t={accuracy:`default`,avoidSubclass:!1,flags:``,global:!1,hasIndices:!1,lazyCompileLength:1/0,target:`auto`,verbose:!1,...e,rules:{allowOrphanBackrefs:!1,asciiWordBoundaries:!1,captureGroup:!1,recursionLimit:20,singleline:!1,...e.rules}};return t.target===`auto`&&(t.target=dA.flagGroups?`ES2025`:dA.unicodeSets?`ES2024`:`ES2018`),t}var Kte=`[ -\r ]`,qte=new Set([uA(304),uA(305)]),vA=q`[\p{L}\p{M}\p{N}\p{Pc}]`;function yA(e){if(qte.has(e))return[e];let t=new Set,n=e.toLowerCase(),r=n.toUpperCase(),i=Xte.get(n),a=Jte.get(n),o=Yte.get(n);return[...r].length===1&&t.add(r),o&&t.add(o),i&&t.add(i),t.add(n),a&&t.add(a),[...t]}var bA=new Map(`C Other
|
|
87
87
|
Cc Control cntrl
|
|
88
88
|
Cf Format
|
|
89
89
|
Cn Unassigned
|
|
@@ -173,15 +173,15 @@ Uppercase Upper
|
|
|
173
173
|
Variation_Selector VS
|
|
174
174
|
White_Space space
|
|
175
175
|
XID_Continue XIDC
|
|
176
|
-
XID_Start XIDS`.split(/\s/).map(e=>[
|
|
176
|
+
XID_Start XIDS`.split(/\s/).map(e=>[Vk(e),e])),Jte=new Map([[`s`,uA(383)],[uA(383),`s`]]),Yte=new Map([[uA(223),uA(7838)],[uA(107),uA(8490)],[uA(229),uA(8491)],[uA(969),uA(8486)]]),Xte=new Map([xA(453),xA(456),xA(459),xA(498),...SA(8072,8079),...SA(8088,8095),...SA(8104,8111),xA(8124),xA(8140),xA(8188)]),Zte=new Map([[`alnum`,q`[\p{Alpha}\p{Nd}]`],[`alpha`,q`\p{Alpha}`],[`ascii`,q`\p{ASCII}`],[`blank`,q`[\p{Zs}\t]`],[`cntrl`,q`\p{Cc}`],[`digit`,q`\p{Nd}`],[`graph`,q`[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]`],[`lower`,q`\p{Lower}`],[`print`,q`[[\P{space}&&\P{Cc}&&\P{Cn}&&\P{Cs}]\p{Zs}]`],[`punct`,q`[\p{P}\p{S}]`],[`space`,q`\p{space}`],[`upper`,q`\p{Upper}`],[`word`,q`[\p{Alpha}\p{M}\p{Nd}\p{Pc}]`],[`xdigit`,q`\p{AHex}`]]);function Qte(e,t){let n=[];for(let r=e;r<=t;r++)n.push(r);return n}function xA(e){let t=uA(e);return[t.toLowerCase(),t]}function SA(e,t){return Qte(e,t).map(e=>xA(e))}var CA=new Set([`Lower`,`Lowercase`,`Upper`,`Uppercase`,`Ll`,`Lowercase_Letter`,`Lt`,`Titlecase_Letter`,`Lu`,`Uppercase_Letter`]);function $te(e,t){let n={accuracy:`default`,asciiWordBoundaries:!1,avoidSubclass:!1,bestEffortTarget:`ES2025`,...t};wA(e);let r={accuracy:n.accuracy,asciiWordBoundaries:n.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,flagDirectivesByAlt:new Map,jsGroupNameMap:new Map,minTargetEs2024:hA(n.bestEffortTarget,`ES2024`),passedLookbehind:!1,strategy:null,subroutineRefMap:new Map,supportedGNodes:new Set,digitIsAscii:e.flags.digitIsAscii,spaceIsAscii:e.flags.spaceIsAscii,wordIsAscii:e.flags.wordIsAscii};Wk(e,ene,r);let i={dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},a={currentFlags:i,prevFlags:null,globalFlags:i,groupOriginByCopy:new Map,groupsByName:new Map,multiplexCapturesToLeftByRef:new Map,openRefs:new Map,reffedNodesByReferencer:new Map,subroutineRefMap:r.subroutineRefMap};return Wk(e,tne,a),Wk(e,nne,{groupsByName:a.groupsByName,highestOrphanBackref:0,numCapturesToLeft:0,reffedNodesByReferencer:a.reffedNodesByReferencer}),e._originMap=a.groupOriginByCopy,e._strategy=r.strategy,e}var ene={AbsenceFunction({node:e,parent:t,replaceWith:n}){let{body:r,kind:i}=e;if(i===`repeater`){let e=Dk();e.body[0].body.push(Ok({negate:!0,body:r}),Pk(`Any`));let i=Dk();i.body[0].body.push(jk(`greedy`,0,1/0,e)),n(IA(i,t),{traverse:!0})}else throw Error(`Unsupported absence function "(?~|"`)},Alternative:{enter({node:e,parent:t,key:n},{flagDirectivesByAlt:r}){let i=e.body.filter(e=>e.kind===`flags`);for(let e=n+1;e<t.body.length;e++){let n=t.body[e];mA(r,n,[]).push(...i)}},exit({node:e},{flagDirectivesByAlt:t}){if(t.get(e)?.length){let n=OA(t.get(e));if(n){let t=Dk({flags:n});t.body[0].body=e.body,e.body=[IA(t,e)]}}}},Assertion({node:e,parent:t,key:n,container:r,root:i,remove:a,replaceWith:o},s){let{kind:c,negate:l}=e,{asciiWordBoundaries:u,avoidSubclass:d,supportedGNodes:f,wordIsAscii:p}=s;if(c===`text_segment_boundary`)throw Error(`Unsupported text segment boundary "\\${l?`Y`:`y`}"`);if(c===`line_end`)o(IA(Ok({body:[_k({body:[vk(`string_end`)]}),_k({body:[xk(10)]})]}),t));else if(c===`line_start`)o(IA(NA(q`(?<=\A|\n(?!\z))`,{skipLookbehindValidation:!0}),t));else if(c===`search_start`){if(f.has(e))i.flags.sticky=!0,a();else{let e=r[n-1];if(e&&cne(e))o(IA(Ok({negate:!0}),t));else if(d)throw Error(q`Uses "\G" in a way that requires a subclass`);else o(FA(vk(`string_start`),t)),s.strategy=`clip_search`}}else if(c!==`string_end`&&c!==`string_start`){if(c===`string_end_newline`)o(IA(NA(q`(?=\n?\z)`),t));else if(c===`word_boundary`){if(!p&&!u){let e=`(?:(?<=${vA})(?!${vA})|(?<!${vA})(?=${vA}))`,n=`(?:(?<=${vA})(?=${vA})|(?<!${vA})(?!${vA}))`;o(IA(NA(l?n:e),t))}}else throw Error(`Unexpected assertion kind "${c}"`)}},Backreference({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!MA(n)&&(n=DA(n,t),e.ref=n)},CapturingGroup({node:e},{jsGroupNameMap:t,subroutineRefMap:n}){let{name:r}=e;r&&!MA(r)&&(r=DA(r,t),e.name=r),n.set(e.number,e),r&&n.set(r,e)},CharacterClassRange({node:e,parent:t,replaceWith:n}){t.kind===`intersection`&&n(IA(Sk({body:[e]}),t),{traverse:!0})},CharacterSet({node:e,parent:t,replaceWith:n},{accuracy:r,minTargetEs2024:i,digitIsAscii:a,spaceIsAscii:o,wordIsAscii:s}){let{kind:c,negate:l,value:u}=e;if(a&&(c===`digit`||u===`digit`)){n(FA(wk(`digit`,{negate:l}),t));return}if(o&&(c===`space`||u===`space`)){n(IA(PA(NA(Kte),l),t));return}if(s&&(c===`word`||u===`word`)){n(FA(wk(`word`,{negate:l}),t));return}if(c===`any`)n(FA(Pk(`Any`),t));else if(c===`digit`)n(FA(Pk(`Nd`,{negate:l}),t));else if(c!==`dot`){if(c===`text_segment`){if(r===`strict`)throw Error(q`Use of "\X" requires non-strict accuracy`);let e=`\\p{Emoji}(?:\\p{EMod}|\\uFE0F\\u20E3?|[\\x{E0020}-\\x{E007E}]+\\x{E007F})?`,a=q`\p{RI}{2}|${e}(?:\u200D${e})*`;n(IA(NA(q`(?>\r\n|${i?q`\p{RGI_Emoji}`:a}|\P{M}\p{M}*)`,{skipPropertyNameValidation:!0}),t))}else if(c===`hex`)n(FA(Pk(`AHex`,{negate:l}),t));else if(c===`newline`)n(IA(NA(l?`[^
|
|
177
177
|
]`:`(?>\r
|
|
178
178
|
?|[
|
|
179
|
-
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${sA(e.codePointAt(0)-1)}${sA(e.codePointAt(2)+1)}-\u{10FFFF}`),n(NA(AA(`[${e}]`),t))}else n(NA(jA(AA(ene.get(u)),l),t))}else if(c===`property`)_A.has(Rk(u))||(e.key=`sc`);else if(c===`space`)n(MA(Mk(`space`,{negate:l}),t));else if(c===`word`)n(NA(jA(AA(hA),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=Tk({flags:c});e.body[0].body=o(),i(NA(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&nk(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(q`Uses "\K" in a way that's unsupported`);let o=Ek({behind:!0});o.body[0].body=a(),i(NA(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(NA(Ek({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Tk();t.body[0].body.push(e.body),e.body=NA(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=DA(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(q`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!kA(n)&&(n=wA(n,t),e.ref=n)}},ine={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=MA(CA(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&dA(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=dA(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=uA(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?CA(0):SA(o,r.groupOriginByCopy,null),l=c;if(!s){let e=TA(cne(o,e=>e.type===`Group`&&!!e.flags)),t=e?uA(r.globalFlags,e):r.globalFlags;one(t,r.currentFlags)||(l=Tk({flags:lne(t)}),l.body[0].body.push(c))}n(NA(l,t),{traverse:!s})}},ane={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>sne(t,e));i.length?i.length>1?n(NA(Tk({atomic:!0,body:i.reverse().map(e=>hk({body:[_k(e.number)]}))}),t)):e.ref=i[0].number:n(NA(Ek({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=vk();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function xA(e){Vk(e,{"*"({node:e,parent:t}){e.parent=t}})}function one(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function sne(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=EA(n.parent);for(let r of t){if(r===n)break;if(r===e||OA(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function SA(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=SA(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function CA(e){let t=jk(e);return t.isRecursive=!0,t}function cne(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function wA(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function TA(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function lne({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function EA(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function DA(e){let t=e.find(e=>e.kind===`search_start`||fne(e,{negate:!1})||!une(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=DA(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function OA(e,t){let n=EA(e)??[];for(let e of n)if(e===t||OA(e,t))return!0;return!1}function une({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function dne(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function fne(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&nk(e.body[0],{type:`Assertion`,kind:`search_start`})}function kA(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function AA(e,t){let n=ak(e,{...t,unicodePropertyMap:_A}).body;return n.length>1||n[0].body.length>1?Tk({body:n}):n[0].body[0]}function jA(e,t){return e.negate=t,e}function MA(e,t){return e.parent=t,e}function NA(e,t){return xA(e),e.parent=t,e}function pne(e,t){let n=mA(t),r=fA(n.target,`ES2024`),i=fA(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Vk(e,mne,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,qte(hne[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&dA(f._captureTransfers,e.transferTo,[]).push(t)}),f}var mne={"*":{enter({node:e},t){if(RA(e)){let n=t.getCurrentModI();t.pushModI(e.flags?uA({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){RA(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){FA(sA(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),IA(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&bA.has(e.value)&&t.setHasCasedChar()}},hne={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?q`\B`:q`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=sA(e),r=LA(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&FA(n)){let e=gA(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);cA.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(zA)&&(o=[yk(45),...o.filter(e=>!zA(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||cA.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=Tk(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=hk({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(cA.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=LA(n,i),o=LA(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&bne(IA(e)).forEach(e=>{s.add(Array.isArray(e)?`${LA(e[0],i)}-${LA(e[1],i)}`:LA(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:q`[^\n]`;if(e===`digit`)return t?q`\D`:q`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&bA.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?q`\P`:q`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?q`\W`:q`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=uA(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${xne(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+Sne(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:q`\g<${t}&R=${r}>`}},gne=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),_ne=new Set([`-`,`\\`,`]`,`^`,`[`]),vne=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),PA=new Map([[9,q`\t`],[10,q`\n`],[11,q`\v`],[12,q`\f`],[13,q`\r`],[8232,q`\u2028`],[8233,q`\u2029`],[65279,q`\uFEFF`]]),yne=/^\p{Cased}$/u;function FA(e){return yne.test(e)}function IA(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=sA(e);if(!FA(t))continue;let o=gA(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function LA(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(PA.has(e))return PA.get(e);if(e<32||e>126&&e<160||e>262143||t&&Cne(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?vne:_ne:gne,a=sA(e);return(i.has(a)?`\\`:``)+a}function bne(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function xne(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function Sne({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function RA({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function Cne(e){return e>47&&e<58}function zA({type:e,value:t}){return e===`Character`&&t===45}var wne=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Ene(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Tne(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=Dne(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Tne(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Ene(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)dA(n,t,{}).transferTo=e;return n}function Dne(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function One(e,t){let n=kne(e,t);return n.options?new wne(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function kne(e,t){let n=mA(t),r=nne(ak(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:_A}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=pne(r,n),a=Gte(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Ute(Wte(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function Ane(e,t){return One(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function jne(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>Ane(e,{target:t.target}),{createScanner(e){return new dO(e,t)},createString(e){return{content:e}}}}async function Mne(e){if(ZC())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=KC.get(e);if(t!=null)return t;try{let t=qC.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(dw,e)&&(t=dw[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return GC.has(e)||GC.set(e,n),n});return KC.set(e,n),await n}finally{KC.delete(e)}}function Nne(e){return GC.get(e)??Mne(e)}var BA=new Set;function VA(e){let t=[],n=new Set;for(let r of Pne(e.themes)){let e=HA(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return VA({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return VA({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function Pne(e){return Fne(e)?[e]:e}function Fne(e){return HA(e)||Ine(e)}function Ine(e){return typeof e.name==`string`&&typeof e.load==`function`}function HA(e){return typeof e.getThemes==`function`}function UA(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var WA=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},GA=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},KA=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function qA(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new WA(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new GA(i));let c=r,l=s().then(e=>{let a=UA(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new KA(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var JA=qA();function YA(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=JA.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,JA.getResolvedTheme(n)??JA.seedResolvedTheme(n,e);BA.has(n)||(BA.add(n),t.loadThemeSync(e))}}function XA({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:ZA(t)}}function ZA(e){return async()=>RE(UA(await e()))}var QA=`pierre`,$A=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],ej=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],tj=[...ej,...$A],nj=new Set(ej);function rj(e){return nj.has(e)?`light`:`dark`}var ij={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},aj={"pierre-dark":()=>K(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>K(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>K(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>K(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>K(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>K(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>K(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>K(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>K(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>K(()=>import(`./_CEbqgOJL.js`),[])};function oj(e){return XA({name:e,collection:QA,colorScheme:rj(e),displayName:ij[e],load:aj[e]})}var sj=VA({themes:tj.map(e=>oj(e))}),cj=`shiki`,lj=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],uj=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),dj=new Set(lj);function fj(e){return dj.has(e)?`light`:`dark`}var pj={andromeeda:()=>K(()=>import(`./_vGVdxbeo2.js`),[]),"aurora-x":()=>K(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>K(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>K(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>K(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>K(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>K(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>K(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>K(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>K(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>K(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>K(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>K(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>K(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>K(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>K(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>K(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>K(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>K(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>K(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>K(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>K(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>K(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>K(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>K(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>K(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>K(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>K(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>K(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>K(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>K(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>K(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>K(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>K(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>K(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>K(()=>import(`./_Bm3Qr25_2.js`),[]),"material-theme-darker":()=>K(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>K(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>K(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>K(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>K(()=>import(`./_BSWPekZh2.js`),[]),"min-light":()=>K(()=>import(`./_DDpmG2fV2.js`),[]),monokai:()=>K(()=>import(`./_B_bV9PQ92.js`),[]),"night-owl":()=>K(()=>import(`./_DhmEMT882.js`),[]),"night-owl-light":()=>K(()=>import(`./_eJ-hLW7d2.js`),[]),nord:()=>K(()=>import(`./_Cb4Vim4T2.js`),[]),"one-dark-pro":()=>K(()=>import(`./_CLwyXe_n2.js`),[]),"one-light":()=>K(()=>import(`./_D7Lr4KcI2.js`),[]),plastic:()=>K(()=>import(`./_DQwYfKfQ2.js`),[]),poimandres:()=>K(()=>import(`./_DRFjx7u42.js`),[]),red:()=>K(()=>import(`./_DX1BQOs82.js`),[]),"rose-pine":()=>K(()=>import(`./_aMsaMD1D2.js`),[]),"rose-pine-dawn":()=>K(()=>import(`./_8PwUyIlP2.js`),[]),"rose-pine-moon":()=>K(()=>import(`./_DO-qXg-I2.js`),[]),"slack-dark":()=>K(()=>import(`./_DnToyrRv2.js`),[]),"slack-ochin":()=>K(()=>import(`./_B2OO5cIa2.js`),[]),"snazzy-light":()=>K(()=>import(`./_4G7pJPwS2.js`),[]),"solarized-dark":()=>K(()=>import(`./_UdsmMDCL2.js`),[]),"solarized-light":()=>K(()=>import(`./_C1IUL_tW2.js`),[]),"synthwave-84":()=>K(()=>import(`./_nFMaYfgc2.js`),[]),"tokyo-night":()=>K(()=>import(`./_oM2G3aXe2.js`),[]),vesper:()=>K(()=>import(`./_DdrHHSXu2.js`),[]),"vitesse-black":()=>K(()=>import(`./_fwtXNY1n2.js`),[]),"vitesse-dark":()=>K(()=>import(`./_BZCL-v6S2.js`),[]),"vitesse-light":()=>K(()=>import(`./_VbXTXTou2.js`),[])};function mj(e){return XA({name:e,collection:cj,colorScheme:fj(e),load:pj[e]})}var hj=VA({themes:Object.freeze([...lj.map(e=>mj(e)),...uj.map(e=>mj(e))])});function gj(e){if(ZC())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(JA.hasRegisteredTheme(e))return;let t=hj.getTheme(e);if(t!=null){JA.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function _j(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function vj(e){gj(e);let t=await JA.resolveTheme(e);return _j(e,t),t}function yj(e){return JA.getResolvedTheme(e)??vj(e)}var bj;async function xj({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){bj??=lO({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Vw(K(()=>import(`./_BnjxR4X6.js`),[])):jne()});let r=Cj(bj)?await bj:bj;bj=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Nne(e);`then`in t?i.push(t):XC(t,r)}let a=[];for(let t of e){let e=yj(t);`then`in e?a.push(e):YA(e,bj)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{XC(e,r)}),Promise.all(a).then(e=>{YA(e,r)})]),r}function Sj(){if(bj!=null&&!(`then`in bj))return bj}function Cj(e=bj){return e!=null&&`then`in e}for(let e of sj.getThemes())JA.registerThemeIfAbsent(e.name,e.load);function wj(e=Oy){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Tj(e){for(let t of wj(e))if(!BA.has(t))return!1;return!0}function Ej(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 Dj(e){return U({tagName:`div`,children:[U({tagName:`div`,children:e.annotations?.map(e=>U({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function Oj(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 kj({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return U({tagName:`div`,children:[t===`custom`?U({tagName:`slot`,properties:{name:Dy}}):Aj({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[jj(r)]],properties:i})}function Aj({name:e,prevName:t,iconType:n}){let r=[U({tagName:`slot`,properties:{name:wy}}),ix({name:Oj(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[rx(t)]})],properties:{"data-prev-name":``}})),r.push(ix({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[rx(e)]})],properties:{"data-title":``}})),r.push(U({tagName:`slot`,properties:{name:Ty}})),U({tagName:`div`,children:r,properties:{"data-header-content":``}})}function jj(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(U({tagName:`span`,children:[rx(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(U({tagName:`span`,children:[rx(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(U({tagName:`slot`,properties:{name:Ey}})),U({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Mj(e){return U({tagName:`pre`,properties:Nj(e)})}function Nj({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Pj=new Map,Fj={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function Ij(e){if(Pj.has(e))return Pj.get(e)??`text`;if(Fj[e]!=null)return Fj[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Pj.has(t[1]))return Pj.get(t[1])??`text`;if(Fj[t[1]]!=null)return Fj[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Pj.has(n)?Pj.get(n)??`text`:Fj[n]??`text`}function Lj(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:wj(t),preferredHighlighter:n}}function Rj(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function zj(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(rx(`
|
|
180
|
-
`)),e}var
|
|
179
|
+
\v\f
\u2028\u2029])`),t));else if(c===`posix`){if(!i&&(u===`graph`||u===`print`)){if(r===`strict`)throw Error(`POSIX class "${u}" requires min target ES2024 or non-strict accuracy`);let e={graph:`!-~`,print:` -~`}[u];l&&(e=`\0-${uA(e.codePointAt(0)-1)}${uA(e.codePointAt(2)+1)}-\u{10FFFF}`),n(IA(NA(`[${e}]`),t))}else n(IA(PA(NA(Zte.get(u)),l),t))}else if(c===`property`)bA.has(Vk(u))||(e.key=`sc`);else if(c===`space`)n(FA(Pk(`space`,{negate:l}),t));else if(c===`word`)n(IA(PA(NA(vA),l),t));else throw Error(`Unexpected character set kind "${c}"`)}},Directive({node:e,parent:t,root:n,remove:r,replaceWith:i,removeAllPrevSiblings:a,removeAllNextSiblings:o}){let{kind:s,flags:c}=e;if(s===`flags`){if(!c.enable&&!c.disable)r();else{let e=Dk({flags:c});e.body[0].body=o(),i(IA(e,t),{traverse:!0})}}else if(s===`keep`){let e=n.body[0],r=n.body.length===1&&ik(e,{type:`Group`})&&e.body[0].body.length===1?e.body[0]:n;if(t.parent!==r||r.body.length>1)throw Error(q`Uses "\K" in a way that's unsupported`);let o=Ok({behind:!0});o.body[0].body=a(),i(IA(o,t))}else throw Error(`Unexpected directive kind "${s}"`)},Flags({node:e,parent:t}){if(e.posixIsAscii)throw Error(`Unsupported flag "P"`);if(e.textSegmentMode===`word`)throw Error(`Unsupported flag "y{w}"`);[`digitIsAscii`,`extended`,`posixIsAscii`,`spaceIsAscii`,`wordIsAscii`,`textSegmentMode`].forEach(t=>delete e[t]),Object.assign(e,{global:!1,hasIndices:!1,multiline:!1,sticky:e.sticky??!1}),t.options={disable:{x:!0,n:!0},force:{v:!0}}},Group({node:e}){if(!e.flags)return;let{enable:t,disable:n}=e.flags;t?.extended&&delete t.extended,n?.extended&&delete n.extended,t?.dotAll&&n?.dotAll&&delete t.dotAll,t?.ignoreCase&&n?.ignoreCase&&delete t.ignoreCase,t&&!Object.keys(t).length&&delete e.flags.enable,n&&!Object.keys(n).length&&delete e.flags.disable,!e.flags.enable&&!e.flags.disable&&delete e.flags},LookaroundAssertion({node:e},t){let{kind:n}=e;n===`lookbehind`&&(t.passedLookbehind=!0)},NamedCallout({node:e,parent:t,replaceWith:n}){let{kind:r}=e;if(r===`fail`)n(IA(Ok({negate:!0}),t));else throw Error(`Unsupported named callout "(*${r.toUpperCase()}"`)},Quantifier({node:e}){if(e.body.type===`Quantifier`){let t=Dk();t.body[0].body.push(e.body),e.body=IA(t,e)}},Regex:{enter({node:e},{supportedGNodes:t}){let n=[],r=!1,i=!1;for(let t of e.body)if(t.body.length===1&&t.body[0].kind===`search_start`)t.body.pop();else{let e=AA(t.body);e?(r=!0,Array.isArray(e)?n.push(...e):n.push(e)):i=!0}r&&!i&&n.forEach(e=>t.add(e))},exit(e,{accuracy:t,passedLookbehind:n,strategy:r}){if(t===`strict`&&n&&r)throw Error(q`Uses "\G" in a way that requires non-strict accuracy`)}},Subroutine({node:e},{jsGroupNameMap:t}){let{ref:n}=e;typeof n==`string`&&!MA(n)&&(n=DA(n,t),e.ref=n)}},tne={Backreference({node:e},{multiplexCapturesToLeftByRef:t,reffedNodesByReferencer:n}){let{orphan:r,ref:i}=e;r||n.set(e,[...t.get(i).map(({node:e})=>e)])},CapturingGroup:{enter({node:e,parent:t,replaceWith:n,skip:r},{groupOriginByCopy:i,groupsByName:a,multiplexCapturesToLeftByRef:o,openRefs:s,reffedNodesByReferencer:c}){let l=i.get(e);if(l&&s.has(e.number)){let r=FA(EA(e.number),t);c.set(r,s.get(e.number)),n(r);return}s.set(e.number,e),o.set(e.number,[]),e.name&&mA(o,e.name,[]);let u=o.get(e.name??e.number);for(let t=0;t<u.length;t++){let n=u[t];if(l===n.node||l&&l===n.origin||e===n.origin){u.splice(t,1);break}}if(o.get(e.number).push({node:e,origin:l}),e.name&&o.get(e.name).push({node:e,origin:l}),e.name){let t=mA(a,e.name,new Map),n=!1;if(l)n=!0;else for(let e of t.values())if(!e.hasDuplicateNameToRemove){n=!0;break}a.get(e.name).set(e,{node:e,hasDuplicateNameToRemove:n})}},exit({node:e},{openRefs:t}){t.get(e.number)===e&&t.delete(e.number)}},Group:{enter({node:e},t){t.prevFlags=t.currentFlags,e.flags&&(t.currentFlags=pA(t.currentFlags,e.flags))},exit(e,t){t.currentFlags=t.prevFlags}},Subroutine({node:e,parent:t,replaceWith:n},r){let{isRecursive:i,ref:a}=e;if(i){let n=t;for(;(n=n.parent)&&(n.type!==`CapturingGroup`||n.name!==a&&n.number!==a););r.reffedNodesByReferencer.set(e,n);return}let o=r.subroutineRefMap.get(a),s=a===0,c=s?EA(0):TA(o,r.groupOriginByCopy,null),l=c;if(!s){let e=OA(ane(o,e=>e.type===`Group`&&!!e.flags)),t=e?pA(r.globalFlags,e):r.globalFlags;rne(t,r.currentFlags)||(l=Dk({flags:one(t)}),l.body[0].body.push(c))}n(IA(l,t),{traverse:!s})}},nne={Backreference({node:e,parent:t,replaceWith:n},r){if(e.orphan){r.highestOrphanBackref=Math.max(r.highestOrphanBackref,e.ref);return}let i=r.reffedNodesByReferencer.get(e).filter(t=>ine(t,e));i.length?i.length>1?n(IA(Dk({atomic:!0,body:i.reverse().map(e=>_k({body:[yk(e.number)]}))}),t)):e.ref=i[0].number:n(IA(Ok({negate:!0}),t))},CapturingGroup({node:e},t){e.number=++t.numCapturesToLeft,e.name&&t.groupsByName.get(e.name).get(e).hasDuplicateNameToRemove&&delete e.name},Regex:{exit({node:e},t){let n=Math.max(t.highestOrphanBackref-t.numCapturesToLeft,0);for(let t=0;t<n;t++){let t=bk();e.body.at(-1).body.push(t)}}},Subroutine({node:e},t){!e.isRecursive||e.ref===0||(e.ref=t.reffedNodesByReferencer.get(e).number)}};function wA(e){Wk(e,{"*"({node:e,parent:t}){e.parent=t}})}function rne(e,t){return e.dotAll===t.dotAll&&e.ignoreCase===t.ignoreCase}function ine(e,t){let n=t;do{if(n.type===`Regex`)return!1;if(n.type===`Alternative`)continue;if(n===e)return!1;let t=kA(n.parent);for(let r of t){if(r===n)break;if(r===e||jA(r,e))return!0}}while(n=n.parent);throw Error(`Unexpected path`)}function TA(e,t,n,r){let i=Array.isArray(e)?[]:{};for(let[a,o]of Object.entries(e))a===`parent`?i.parent=Array.isArray(n)?r:n:o&&typeof o==`object`?i[a]=TA(o,t,i,n):(a===`type`&&o===`CapturingGroup`&&t.set(i,t.get(e)??e),i[a]=o);return i}function EA(e){let t=Nk(e);return t.isRecursive=!0,t}function ane(e,t){let n=[];for(;e=e.parent;)(!t||t(e))&&n.push(e);return n}function DA(e,t){if(t.has(e))return t.get(e);let n=`$${t.size}_${e.replace(/^[^$_\p{IDS}]|[^$\u200C\u200D\p{IDC}]/gu,`_`)}`;return t.set(e,n),n}function OA(e){let t=[`dotAll`,`ignoreCase`],n={enable:{},disable:{}};return e.forEach(({flags:e})=>{t.forEach(t=>{e.enable?.[t]&&(delete n.disable[t],n.enable[t]=!0),e.disable?.[t]&&(n.disable[t]=!0)})}),Object.keys(n.enable).length||delete n.enable,Object.keys(n.disable).length||delete n.disable,n.enable||n.disable?n:null}function one({dotAll:e,ignoreCase:t}){let n={};return(e||t)&&(n.enable={},e&&(n.enable.dotAll=!0),t&&(n.enable.ignoreCase=!0)),(!e||!t)&&(n.disable={},!e&&(n.disable.dotAll=!0),!t&&(n.disable.ignoreCase=!0)),n}function kA(e){if(!e)throw Error(`Node expected`);let{body:t}=e;return Array.isArray(t)?t:t?[t]:null}function AA(e){let t=e.find(e=>e.kind===`search_start`||lne(e,{negate:!1})||!sne(e));if(!t)return null;if(t.kind===`search_start`)return t;if(t.type===`LookaroundAssertion`)return t.body[0].body[0];if(t.type===`CapturingGroup`||t.type===`Group`){let e=[];for(let n of t.body){let t=AA(n.body);if(!t)return null;Array.isArray(t)?e.push(...t):e.push(t)}return e}return null}function jA(e,t){let n=kA(e)??[];for(let e of n)if(e===t||jA(e,t))return!0;return!1}function sne({type:e}){return e===`Assertion`||e===`Directive`||e===`LookaroundAssertion`}function cne(e){let t=[`Character`,`CharacterClass`,`CharacterSet`];return t.includes(e.type)||e.type===`Quantifier`&&e.min&&t.includes(e.body.type)}function lne(e,t){let n={negate:null,...t};return e.type===`LookaroundAssertion`&&(n.negate===null||e.negate===n.negate)&&e.body.length===1&&ik(e.body[0],{type:`Assertion`,kind:`search_start`})}function MA(e){return/^[$_\p{IDS}][$\u200C\u200D\p{IDC}]*$/u.test(e)}function NA(e,t){let n=sk(e,{...t,unicodePropertyMap:bA}).body;return n.length>1||n[0].body.length>1?Dk({body:n}):n[0].body[0]}function PA(e,t){return e.negate=t,e}function FA(e,t){return e.parent=t,e}function IA(e,t){return wA(e),e.parent=t,e}function une(e,t){let n=_A(t),r=hA(n.target,`ES2024`),i=hA(n.target,`ES2025`),a=n.rules.recursionLimit;if(!Number.isInteger(a)||a<2||a>20)throw Error(`Invalid recursionLimit; use 2-20`);let o=null,s=null;if(!i){let t=[e.flags.ignoreCase];Wk(e,dne,{getCurrentModI:()=>t.at(-1),popModI(){t.pop()},pushModI(e){t.push(e)},setHasCasedChar(){t.at(-1)?o=!0:s=!0}})}let c={dotAll:e.flags.dotAll,ignoreCase:!!((e.flags.ignoreCase||o)&&!s)},l=e,u={accuracy:n.accuracy,appliedGlobalFlags:c,captureMap:new Map,currentFlags:{dotAll:e.flags.dotAll,ignoreCase:e.flags.ignoreCase},inCharClass:!1,lastNode:l,originMap:e._originMap,recursionLimit:a,useAppliedIgnoreCase:!!(!i&&o&&s),useFlagMods:i,useFlagV:r,verbose:n.verbose};function d(e){return u.lastNode=l,l=e,Wte(fne[e.type],`Unexpected node type "${e.type}"`)(e,u,d)}let f={pattern:e.body.map(d).join(`|`),flags:d(e.flags),options:{...e.options}};return r||(delete f.options.force.v,f.options.disable.v=!0,f.options.unicodeSetsPlugin=null),f._captureTransfers=new Map,f._hiddenCaptures=[],u.captureMap.forEach((e,t)=>{e.hidden&&f._hiddenCaptures.push(t),e.transferTo&&mA(f._captureTransfers,e.transferTo,[]).push(t)}),f}var dne={"*":{enter({node:e},t){if(VA(e)){let n=t.getCurrentModI();t.pushModI(e.flags?pA({ignoreCase:n},e.flags).ignoreCase:n)}},exit({node:e},t){VA(e)&&t.popModI()}},Backreference(e,t){t.setHasCasedChar()},Character({node:e},t){RA(uA(e.value))&&t.setHasCasedChar()},CharacterClassRange({node:e,skip:t},n){t(),zA(e,{firstOnly:!0}).length&&n.setHasCasedChar()},CharacterSet({node:e},t){e.kind===`property`&&CA.has(e.value)&&t.setHasCasedChar()}},fne={Alternative({body:e},t,n){return e.map(n).join(``)},Assertion({kind:e,negate:t}){if(e===`string_end`)return`$`;if(e===`string_start`)return`^`;if(e===`word_boundary`)return t?q`\B`:q`\b`;throw Error(`Unexpected assertion kind "${e}"`)},Backreference({ref:e},t){if(typeof e!=`number`)throw Error(`Unexpected named backref in transformed AST`);if(!t.useFlagMods&&t.accuracy===`strict`&&t.currentFlags.ignoreCase&&!t.captureMap.get(e).ignoreCase)throw Error(`Use of case-insensitive backref to case-sensitive group requires target ES2025 or non-strict accuracy`);return`\\`+e},CapturingGroup(e,t,n){let{body:r,name:i,number:a}=e,o={ignoreCase:t.currentFlags.ignoreCase},s=t.originMap.get(e);return s&&(o.hidden=!0,a>s.number&&(o.transferTo=s.number)),t.captureMap.set(a,o),`(${i?`?<${i}>`:``}${r.map(n).join(`|`)})`},Character({value:e},t){let n=uA(e),r=BA(e,{escDigit:t.lastNode.type===`Backreference`,inCharClass:t.inCharClass,useFlagV:t.useFlagV});if(r!==n)return r;if(t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&RA(n)){let e=yA(n);return t.inCharClass?e.join(``):e.length>1?`[${e.join(``)}]`:e[0]}return n},CharacterClass(e,t,n){let{kind:r,negate:i,parent:a}=e,{body:o}=e;if(r===`intersection`&&!t.useFlagV)throw Error(`Use of character class intersection requires min target ES2024`);dA.bugFlagVLiteralHyphenIsRange&&t.useFlagV&&o.some(HA)&&(o=[xk(45),...o.filter(e=>!HA(e))]);let s=()=>`[${i?`^`:``}${o.map(n).join(r===`intersection`?`&&`:``)}]`;if(!t.inCharClass){if((!t.useFlagV||dA.bugNestedClassIgnoresNegation)&&!i){let t=o.filter(e=>e.type===`CharacterClass`&&e.kind===`union`&&e.negate);if(t.length){let r=Dk(),i=r.body[0];return r.parent=a,i.parent=r,o=o.filter(e=>!t.includes(e)),e.body=o,o.length?(e.parent=i,i.body.push(e)):r.body.pop(),t.forEach(e=>{let t=_k({body:[e]});e.parent=t,t.parent=r,r.body.push(t)}),n(r)}}t.inCharClass=!0;let r=s();return t.inCharClass=!1,r}let c=o[0];if(r===`union`&&!i&&c&&((!t.useFlagV||!t.verbose)&&a.kind===`union`&&!(dA.bugFlagVLiteralHyphenIsRange&&t.useFlagV)||!t.verbose&&a.kind===`intersection`&&o.length===1&&c.type!==`CharacterClassRange`))return o.map(n).join(``);if(!t.useFlagV&&a.type===`CharacterClass`)throw Error(`Uses nested character class in a way that requires min target ES2024`);return s()},CharacterClassRange(e,t){let n=e.min.value,r=e.max.value,i={escDigit:!1,inCharClass:!0,useFlagV:t.useFlagV},a=BA(n,i),o=BA(r,i),s=new Set;return t.useAppliedIgnoreCase&&t.currentFlags.ignoreCase&&_ne(zA(e)).forEach(e=>{s.add(Array.isArray(e)?`${BA(e[0],i)}-${BA(e[1],i)}`:BA(e,i))}),`${a}-${o}${[...s].join(``)}`},CharacterSet({kind:e,negate:t,value:n,key:r},i){if(e===`dot`)return i.currentFlags.dotAll?i.appliedGlobalFlags.dotAll||i.useFlagMods?`.`:`[^]`:q`[^\n]`;if(e===`digit`)return t?q`\D`:q`\d`;if(e===`property`){if(i.useAppliedIgnoreCase&&i.currentFlags.ignoreCase&&CA.has(n))throw Error(`Unicode property "${n}" can't be case-insensitive when other chars have specific case`);return`${t?q`\P`:q`\p`}{${r?`${r}=`:``}${n}}`}if(e===`word`)return t?q`\W`:q`\w`;throw Error(`Unexpected character set kind "${e}"`)},Flags(e,t){return(t.appliedGlobalFlags.ignoreCase?`i`:``)+(e.dotAll?`s`:``)+(e.sticky?`y`:``)},Group({atomic:e,body:t,flags:n,parent:r},i,a){let o=i.currentFlags;n&&(i.currentFlags=pA(o,n));let s=t.map(a).join(`|`),c=!i.verbose&&t.length===1&&r.type!==`Quantifier`&&!e&&(!i.useFlagMods||!n)?s:`(?${vne(e,n,i.useFlagMods)}${s})`;return i.currentFlags=o,c},LookaroundAssertion({body:e,kind:t,negate:n},r,i){return`(?${`${t===`lookahead`?``:`<`}${n?`!`:`=`}`}${e.map(i).join(`|`)})`},Quantifier(e,t,n){return n(e.body)+yne(e)},Subroutine({isRecursive:e,ref:t},n){if(!e)throw Error(`Unexpected non-recursive subroutine in transformed AST`);let r=n.recursionLimit;return t===0?`(?R=${r})`:q`\g<${t}&R=${r}>`}},pne=new Set([`$`,`(`,`)`,`*`,`+`,`.`,`?`,`[`,`\\`,`]`,`^`,`{`,`|`,`}`]),mne=new Set([`-`,`\\`,`]`,`^`,`[`]),hne=new Set("()-/[\\]^{|}!#$%&*+,.:;<=>?@`~".split(``)),LA=new Map([[9,q`\t`],[10,q`\n`],[11,q`\v`],[12,q`\f`],[13,q`\r`],[8232,q`\u2028`],[8233,q`\u2029`],[65279,q`\uFEFF`]]),gne=/^\p{Cased}$/u;function RA(e){return gne.test(e)}function zA(e,t){let n=!!t?.firstOnly,r=e.min.value,i=e.max.value,a=[];if(r<65&&(i===65535||i>=131071)||r===65536&&i>=131071)return a;for(let e=r;e<=i;e++){let t=uA(e);if(!RA(t))continue;let o=yA(t).filter(e=>{let t=e.codePointAt(0);return t<r||t>i});if(o.length&&(a.push(...o),n))break}return a}function BA(e,{escDigit:t,inCharClass:n,useFlagV:r}){if(LA.has(e))return LA.get(e);if(e<32||e>126&&e<160||e>262143||t&&bne(e))return e>255?`\\u{${e.toString(16).toUpperCase()}}`:`\\x${e.toString(16).toUpperCase().padStart(2,`0`)}`;let i=n?r?hne:mne:pne,a=uA(e);return(i.has(a)?`\\`:``)+a}function _ne(e){let t=e.map(e=>e.codePointAt(0)).sort((e,t)=>e-t),n=[],r=null;for(let e=0;e<t.length;e++)t[e+1]===t[e]+1?r??=t[e]:r===null?n.push(t[e]):(n.push([r,t[e]]),r=null);return n}function vne(e,t,n){if(e)return`>`;let r=``;if(t&&n){let{enable:e,disable:n}=t;r=(e?.ignoreCase?`i`:``)+(e?.dotAll?`s`:``)+(n?`-`:``)+(n?.ignoreCase?`i`:``)+(n?.dotAll?`s`:``)}return`${r}:`}function yne({kind:e,max:t,min:n}){let r;return r=!n&&t===1?`?`:!n&&t===1/0?`*`:n===1&&t===1/0?`+`:n===t?`{${n}}`:`{${n},${t===1/0?``:t}}`,r+{greedy:``,lazy:`?`,possessive:`+`}[e]}function VA({type:e}){return e===`CapturingGroup`||e===`Group`||e===`LookaroundAssertion`}function bne(e){return e>47&&e<58}function HA({type:e,value:t}){return e===`Character`&&t===45}var xne=class e extends RegExp{#e=new Map;#t=null;#n;#r=null;#i=null;rawOptions={};get source(){return this.#n||`(?:)`}constructor(t,n,r){let i=!!r?.lazyCompile;if(t instanceof RegExp){if(r)throw Error(`Cannot provide options when copying a regexp`);let i=t;super(i,n),this.#n=i.source,i instanceof e&&(this.#e=i.#e,this.#r=i.#r,this.#i=i.#i,this.rawOptions=i.rawOptions)}else{let e={hiddenCaptures:[],strategy:null,transfers:[],...r};super(i?``:t,n),this.#n=t,this.#e=Cne(e.hiddenCaptures,e.transfers),this.#i=e.strategy,this.rawOptions=r??{}}i||(this.#t=this)}exec(t){if(!this.#t){let{lazyCompile:t,...n}=this.rawOptions;this.#t=new e(this.#n,this.flags,n)}let n=this.global||this.sticky,r=this.lastIndex;if(this.#i===`clip_search`&&n&&r){this.lastIndex=0;let e=this.#a(t.slice(r));return e&&(Sne(e,r,t,this.hasIndices),this.lastIndex+=r),e}return this.#a(t)}#a(e){this.#t.lastIndex=this.lastIndex;let t=super.exec.call(this.#t,e);if(this.lastIndex=this.#t.lastIndex,!t||!this.#e.size)return t;let n=[...t];t.length=1;let r;this.hasIndices&&(r=[...t.indices],t.indices.length=1);let i=[0];for(let e=1;e<n.length;e++){let{hidden:a,transferTo:o}=this.#e.get(e)??{};if(a?i.push(null):(i.push(t.length),t.push(n[e]),this.hasIndices&&t.indices.push(r[e])),o&&n[e]!==void 0){let a=i[o];if(!a)throw Error(`Invalid capture transfer to "${a}"`);if(t[a]=n[e],this.hasIndices&&(t.indices[a]=r[e]),t.groups){this.#r||=wne(this.source);let i=this.#r.get(o);i&&(t.groups[i]=n[e],this.hasIndices&&(t.indices.groups[i]=r[e]))}}}return t}};function Sne(e,t,n,r){if(e.index+=t,e.input=n,r){let n=e.indices;for(let e=0;e<n.length;e++){let r=n[e];r&&(n[e]=[r[0]+t,r[1]+t])}let r=n.groups;r&&Object.keys(r).forEach(e=>{let n=r[e];n&&(r[e]=[n[0]+t,n[1]+t])})}}function Cne(e,t){let n=new Map;for(let t of e)n.set(t,{hidden:!0});for(let[e,r]of t)for(let t of r)mA(n,t,{}).transferTo=e;return n}function wne(e){let t=/(?<capture>\((?:\?<(?![=!])(?<name>[^>]+)>|(?!\?)))|\\?./gsu,n=new Map,r=0,i=0,a;for(;a=t.exec(e);){let{0:e,groups:{capture:t,name:o}}=a;e===`[`?r++:r?e===`]`&&r--:t&&(i++,o&&n.set(i,o))}return n}function Tne(e,t){let n=Ene(e,t);return n.options?new xne(n.pattern,n.flags,n.options):new RegExp(n.pattern,n.flags)}function Ene(e,t){let n=_A(t),r=$te(sk(e,{flags:n.flags,normalizeUnknownPropertyNames:!0,rules:{captureGroup:n.rules.captureGroup,singleline:n.rules.singleline},skipBackrefValidation:n.rules.allowOrphanBackrefs,unicodePropertyMap:bA}),{accuracy:n.accuracy,asciiWordBoundaries:n.rules.asciiWordBoundaries,avoidSubclass:n.avoidSubclass,bestEffortTarget:n.target}),i=une(r,n),a=Hte(i.pattern,{captureTransfers:i._captureTransfers,hiddenCaptures:i._hiddenCaptures,mode:`external`}),o=Bte(Vte(a.pattern).pattern,{captureTransfers:a.captureTransfers,hiddenCaptures:a.hiddenCaptures}),s={pattern:o.pattern,flags:`${n.hasIndices?`d`:``}${n.global?`g`:``}${i.flags}${i.options.disable.v?`u`:`v`}`};if(n.avoidSubclass){if(n.lazyCompileLength!==1/0)throw Error(`Lazy compilation requires subclass`)}else{let e=o.hiddenCaptures.sort((e,t)=>e-t),t=Array.from(o.captureTransfers),i=r._strategy,a=s.pattern.length>=n.lazyCompileLength;(e.length||t.length||i||a)&&(s.options={...e.length&&{hiddenCaptures:e},...t.length&&{transfers:t},...i&&{strategy:i},...a&&{lazyCompile:a}})}return s}function Dne(e,t){return Tne(e,{global:!0,hasIndices:!0,lazyCompileLength:3e3,rules:{allowOrphanBackrefs:!0,asciiWordBoundaries:!0,captureGroup:!0,recursionLimit:5,singleline:!0},...t})}function One(e={}){let t={target:`auto`,cache:new Map,...e};return t.regexConstructor||=e=>Dne(e,{target:t.target}),{createScanner(e){return new pO(e,t)},createString(e){return{content:e}}}}async function kne(e){if($C())throw Error(`resolveLanguage("${e}") cannot be called from a worker context. Languages must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);let t=JC.get(e);if(t!=null)return t;try{let t=YC.get(e);if(t==null&&Object.prototype.hasOwnProperty.call(pw,e)&&(t=pw[e]),t==null)throw Error(`resolveLanguage: "${e}" not found in bundled or custom languages`);let n=t().then(({default:t})=>{let n={name:e,data:t};return qC.has(e)||qC.set(e,n),n});return JC.set(e,n),await n}finally{JC.delete(e)}}function Ane(e){return qC.get(e)??kne(e)}var UA=new Set;function WA(e){let t=[],n=new Set;for(let r of jne(e.themes)){let e=GA(r)?r.getThemes():[r];for(let r of e){if(n.has(r.name))throw Error(`Theme collection already contains theme "${r.name}"`);n.add(r.name),t.push(r)}}let r=Object.freeze([...t]),i=Object.freeze(r.filter(e=>e.colorScheme===`light`)),a=Object.freeze(r.filter(e=>e.colorScheme===`dark`)),o=new Map(r.map(e=>[e.name,e])),s=Object.freeze(r.map(e=>e.name)),c=Object.freeze(i.map(e=>e.name)),l=Object.freeze(a.map(e=>e.name));function u(e){if(e==null)return r;let{colorScheme:t,collection:n}=e;return n==null?t===`light`?i:t===`dark`?a:r:r.filter(e=>e.collection===n?t==null||e.colorScheme===t:!1)}return{getTheme(e){return o.get(e)},getThemes(e){return u(e)},getThemeNames(e){return e?.collection==null?e?.colorScheme===`light`?c:e?.colorScheme===`dark`?l:s:u(e).map(e=>e.name)},hasTheme(e){return o.has(e)},orderBy(e){return WA({themes:r.map((e,t)=>({descriptor:e,index:t})).sort((t,n)=>{let r=e(t.descriptor,n.descriptor);return r===0?t.index-n.index:r}).map(e=>e.descriptor)})},pick(e){let t=[],n=new Set;for(let r of e){if(n.has(r))throw Error(`Theme collection pick already includes theme "${r}"`);n.add(r);let e=o.get(r);if(e==null)throw Error(`Theme collection does not contain theme "${r}"`);t.push(e)}return WA({themes:t})},registerInto(e){for(let t of r)e.registerThemeIfAbsent(t.name,t.load)}}}function jne(e){return Mne(e)?[e]:e}function Mne(e){return GA(e)||Nne(e)}function Nne(e){return typeof e.name==`string`&&typeof e.load==`function`}function GA(e){return typeof e.getThemes==`function`}function KA(e){return typeof e==`object`&&e&&`default`in e?e.default:e}var qA=class extends Error{constructor(e){super(`Theme "${e}" is already registered`),this.name=`DuplicateThemeError`}},JA=class extends Error{constructor(e){super(`No loader registered for theme "${e}"`),this.name=`UnregisteredThemeError`}},YA=class extends Error{constructor(e){super(`Theme "${e}" has not been resolved`),this.name=`UnresolvedThemeError`}};function XA(){let e=new Map,t=new Map,n=new Map,r=0;function i(t,n){if(e.has(t))throw new qA(t);e.set(t,n)}function a(t,n){return!e.has(t)&&(e.set(t,n),!0)}function o(t){return e.has(t)}function s(i){let a=t.get(i);if(a!==void 0)return Promise.resolve(a);let o=n.get(i);if(o!==void 0)return o;let s=e.get(i);if(s===void 0)return Promise.reject(new JA(i));let c=r,l=s().then(e=>{let a=KA(e);return c===r&&t.set(i,a),n.get(i)===l&&n.delete(i),a}).catch(e=>{throw n.get(i)===l&&n.delete(i),e});return n.set(i,l),l}function c(e){return Promise.all(e.map(e=>s(e)))}function l(e,n){t.set(e,n)}function u(e){for(let[t,n]of e)l(t,n)}function d(e){return t.get(e)}function f(e){let n=[];for(let r of e){let e=t.get(r);if(e===void 0)throw new YA(r);n.push(e)}return n}function p(e){return t.has(e)}function m(e){for(let n of e)if(!t.has(n))return!1;return!0}function h(e){let n=t.get(e);return n===void 0?s(e):n}function g(){r++,t.clear(),n.clear()}return{clearResolvedThemes:g,getResolvedOrResolveTheme:h,getResolvedTheme:d,getResolvedThemes:f,hasRegisteredTheme:o,hasResolvedTheme:p,hasResolvedThemes:m,registerTheme:i,registerThemeIfAbsent:a,resolveTheme:s,resolveThemes:c,seedResolvedTheme:l,seedResolvedThemes:u}}var ZA=XA();function QA(e,t){e=Array.isArray(e)?e:[e];for(let n of e){let e;if(typeof n==`string`){if(e=ZA.getResolvedTheme(n),e==null)throw Error(`loadResolvedThemes: ${n} is not resolved, you must resolve it before calling loadResolvedThemes`)}else e=n,n=n.name,ZA.getResolvedTheme(n)??ZA.seedResolvedTheme(n,e);UA.has(n)||(UA.add(n),t.loadThemeSync(e))}}function $A({name:e,load:t,colorScheme:n,collection:r,displayName:i}){return{name:e,colorScheme:n,collection:r,displayName:i,load:ej(t)}}function ej(e){return async()=>BE(KA(await e()))}var tj=`pierre`,nj=[`pierre-dark`,`pierre-dark-soft`,`pierre-dark-vibrant`,`pierre-dark-protanopia-deuteranopia`,`pierre-dark-tritanopia`],rj=[`pierre-light`,`pierre-light-soft`,`pierre-light-vibrant`,`pierre-light-protanopia-deuteranopia`,`pierre-light-tritanopia`],ij=[...rj,...nj],aj=new Set(rj);function oj(e){return aj.has(e)?`light`:`dark`}var sj={"pierre-dark":`Pierre Dark`,"pierre-dark-soft":`Pierre Dark Soft`,"pierre-dark-vibrant":`Pierre Dark Vibrant`,"pierre-dark-protanopia-deuteranopia":`Pierre Dark Protanopia & Deuteranopia`,"pierre-dark-tritanopia":`Pierre Dark Tritanopia`,"pierre-light":`Pierre Light`,"pierre-light-soft":`Pierre Light Soft`,"pierre-light-vibrant":`Pierre Light Vibrant`,"pierre-light-protanopia-deuteranopia":`Pierre Light Protanopia & Deuteranopia`,"pierre-light-tritanopia":`Pierre Light Tritanopia`},cj={"pierre-dark":()=>K(()=>import(`./_CpLgRqie.js`),[]),"pierre-dark-soft":()=>K(()=>import(`./_kZQmAZld.js`),[]),"pierre-dark-vibrant":()=>K(()=>import(`./_CpQYzh95.js`),[]),"pierre-dark-protanopia-deuteranopia":()=>K(()=>import(`./_B35FxJx-.js`),[]),"pierre-dark-tritanopia":()=>K(()=>import(`./_CpjhbsIL.js`),[]),"pierre-light":()=>K(()=>import(`./_CoaEpmwp.js`),[]),"pierre-light-soft":()=>K(()=>import(`./_lWLdNTOI.js`),[]),"pierre-light-vibrant":()=>K(()=>import(`./_D80Fkn33.js`),[]),"pierre-light-protanopia-deuteranopia":()=>K(()=>import(`./_0fSaH845.js`),[]),"pierre-light-tritanopia":()=>K(()=>import(`./_CEbqgOJL.js`),[])};function lj(e){return $A({name:e,collection:tj,colorScheme:oj(e),displayName:sj[e],load:cj[e]})}var uj=WA({themes:ij.map(e=>lj(e))}),dj=`shiki`,fj=[`ayu-light`,`catppuccin-latte`,`everforest-light`,`github-light`,`github-light-default`,`github-light-high-contrast`,`gruvbox-light-hard`,`gruvbox-light-medium`,`gruvbox-light-soft`,`horizon-bright`,`kanagawa-lotus`,`light-plus`,`material-theme-lighter`,`min-light`,`night-owl-light`,`one-light`,`rose-pine-dawn`,`slack-ochin`,`snazzy-light`,`solarized-light`,`vitesse-light`],pj=`andromeeda.aurora-x.ayu-dark.ayu-mirage.catppuccin-frappe.catppuccin-macchiato.catppuccin-mocha.dark-plus.dracula.dracula-soft.everforest-dark.github-dark.github-dark-default.github-dark-dimmed.github-dark-high-contrast.gruvbox-dark-hard.gruvbox-dark-medium.gruvbox-dark-soft.horizon.houston.kanagawa-dragon.kanagawa-wave.laserwave.material-theme.material-theme-darker.material-theme-ocean.material-theme-palenight.min-dark.monokai.night-owl.nord.one-dark-pro.plastic.poimandres.red.rose-pine.rose-pine-moon.slack-dark.solarized-dark.synthwave-84.tokyo-night.vesper.vitesse-black.vitesse-dark`.split(`.`),mj=new Set(fj);function hj(e){return mj.has(e)?`light`:`dark`}var gj={andromeeda:()=>K(()=>import(`./_vGVdxbeo2.js`),[]),"aurora-x":()=>K(()=>import(`./_CDeNXAV0.js`),[]),"ayu-dark":()=>K(()=>import(`./_DluEY0Gj.js`),[]),"ayu-light":()=>K(()=>import(`./_C3h-C4tm.js`),[]),"ayu-mirage":()=>K(()=>import(`./_Bqwy1Gya.js`),[]),"catppuccin-frappe":()=>K(()=>import(`./_C9Q5zVZY.js`),[]),"catppuccin-latte":()=>K(()=>import(`./_CtsyrtPq.js`),[]),"catppuccin-macchiato":()=>K(()=>import(`./_R8nAf1vR.js`),[]),"catppuccin-mocha":()=>K(()=>import(`./_DjuaAJKi.js`),[]),"dark-plus":()=>K(()=>import(`./_Cs2F2srj.js`),[]),dracula:()=>K(()=>import(`./_BHWKrbxM.js`),[]),"dracula-soft":()=>K(()=>import(`./_5eyTD99u.js`),[]),"everforest-dark":()=>K(()=>import(`./_sB-x3p7T.js`),[]),"everforest-light":()=>K(()=>import(`./_Df2xbC6M.js`),[]),"github-dark":()=>K(()=>import(`./_C-LZuMrd.js`),[]),"github-dark-default":()=>K(()=>import(`./_DXG-b-1a.js`),[]),"github-dark-dimmed":()=>K(()=>import(`./_Bx1FflLF.js`),[]),"github-dark-high-contrast":()=>K(()=>import(`./_B_tTalzw.js`),[]),"github-light":()=>K(()=>import(`./_EUqPIrTm.js`),[]),"github-light-default":()=>K(()=>import(`./_BXViO-2h.js`),[]),"github-light-high-contrast":()=>K(()=>import(`./_B68TUdTA.js`),[]),"gruvbox-dark-hard":()=>K(()=>import(`./_C820rvS2.js`),[]),"gruvbox-dark-medium":()=>K(()=>import(`./_BPjhmG05.js`),[]),"gruvbox-dark-soft":()=>K(()=>import(`./_MrdJrrXF.js`),[]),"gruvbox-light-hard":()=>K(()=>import(`./_BC_s9l72.js`),[]),"gruvbox-light-medium":()=>K(()=>import(`./_BAWPOn9u.js`),[]),"gruvbox-light-soft":()=>K(()=>import(`./_BSMLrYjP.js`),[]),horizon:()=>K(()=>import(`./_CE9ld1lL.js`),[]),"horizon-bright":()=>K(()=>import(`./_DSNQnXHK.js`),[]),houston:()=>K(()=>import(`./_CsvMBhTu.js`),[]),"kanagawa-dragon":()=>K(()=>import(`./_Bozd7klA.js`),[]),"kanagawa-lotus":()=>K(()=>import(`./_BmuOG9ZW.js`),[]),"kanagawa-wave":()=>K(()=>import(`./_BML5mF2J.js`),[]),laserwave:()=>K(()=>import(`./_C_8bwKvT.js`),[]),"light-plus":()=>K(()=>import(`./_DVQuIRkW.js`),[]),"material-theme":()=>K(()=>import(`./_Bm3Qr25_2.js`),[]),"material-theme-darker":()=>K(()=>import(`./_2IIEA8gg.js`),[]),"material-theme-lighter":()=>K(()=>import(`./_uhdI0v04.js`),[]),"material-theme-ocean":()=>K(()=>import(`./_CHQ94UKr.js`),[]),"material-theme-palenight":()=>K(()=>import(`./_B5W6OYN7.js`),[]),"min-dark":()=>K(()=>import(`./_BSWPekZh2.js`),[]),"min-light":()=>K(()=>import(`./_DDpmG2fV2.js`),[]),monokai:()=>K(()=>import(`./_B_bV9PQ92.js`),[]),"night-owl":()=>K(()=>import(`./_DhmEMT882.js`),[]),"night-owl-light":()=>K(()=>import(`./_eJ-hLW7d2.js`),[]),nord:()=>K(()=>import(`./_Cb4Vim4T2.js`),[]),"one-dark-pro":()=>K(()=>import(`./_CLwyXe_n2.js`),[]),"one-light":()=>K(()=>import(`./_D7Lr4KcI2.js`),[]),plastic:()=>K(()=>import(`./_DQwYfKfQ2.js`),[]),poimandres:()=>K(()=>import(`./_DRFjx7u42.js`),[]),red:()=>K(()=>import(`./_DX1BQOs82.js`),[]),"rose-pine":()=>K(()=>import(`./_aMsaMD1D2.js`),[]),"rose-pine-dawn":()=>K(()=>import(`./_8PwUyIlP2.js`),[]),"rose-pine-moon":()=>K(()=>import(`./_DO-qXg-I2.js`),[]),"slack-dark":()=>K(()=>import(`./_DnToyrRv2.js`),[]),"slack-ochin":()=>K(()=>import(`./_B2OO5cIa2.js`),[]),"snazzy-light":()=>K(()=>import(`./_4G7pJPwS2.js`),[]),"solarized-dark":()=>K(()=>import(`./_UdsmMDCL2.js`),[]),"solarized-light":()=>K(()=>import(`./_C1IUL_tW2.js`),[]),"synthwave-84":()=>K(()=>import(`./_nFMaYfgc2.js`),[]),"tokyo-night":()=>K(()=>import(`./_oM2G3aXe2.js`),[]),vesper:()=>K(()=>import(`./_DdrHHSXu2.js`),[]),"vitesse-black":()=>K(()=>import(`./_fwtXNY1n2.js`),[]),"vitesse-dark":()=>K(()=>import(`./_BZCL-v6S2.js`),[]),"vitesse-light":()=>K(()=>import(`./_VbXTXTou2.js`),[])};function _j(e){return $A({name:e,collection:dj,colorScheme:hj(e),load:gj[e]})}var vj=WA({themes:Object.freeze([...fj.map(e=>_j(e)),...pj.map(e=>_j(e))])});function yj(e){if($C())throw Error(`Theme "${e}" cannot be resolved from a worker context. Themes must be pre-resolved on the main thread and passed to the worker via the resolvedLanguages parameter.`);if(ZA.hasRegisteredTheme(e))return;let t=vj.getTheme(e);if(t!=null){ZA.registerThemeIfAbsent(t.name,t.load);return}throw Error(`No valid theme loader registered for "${e}"`)}function bj(e,t){if(t.name!==e)throw Error(`resolvedTheme: themeName: ${e} does not match theme.name: ${t.name}`)}async function xj(e){yj(e);let t=await ZA.resolveTheme(e);return bj(e,t),t}function Sj(e){return ZA.getResolvedTheme(e)??xj(e)}var Cj;async function wj({themes:e,langs:t,preferredHighlighter:n=`shiki-js`}){Cj??=dO({themes:[],langs:[`text`],engine:n===`shiki-wasm`?Uw(K(()=>import(`./_BnjxR4X6.js`),[])):One()});let r=Ej(Cj)?await Cj:Cj;Cj=r;let i=[];for(let e of t){if(e===`text`||e===`ansi`)continue;let t=Ane(e);`then`in t?i.push(t):QC(t,r)}let a=[];for(let t of e){let e=Sj(t);`then`in e?a.push(e):QA(e,Cj)}return(i.length>0||a.length>0)&&await Promise.all([Promise.all(i).then(e=>{QC(e,r)}),Promise.all(a).then(e=>{QA(e,r)})]),r}function Tj(){if(Cj!=null&&!(`then`in Cj))return Cj}function Ej(e=Cj){return e!=null&&`then`in e}for(let e of uj.getThemes())ZA.registerThemeIfAbsent(e.name,e.load);function Dj(e=Ay){let t=[];return typeof e==`string`?t.push(e):(t.push(e.dark),t.push(e.light)),t}function Oj(e){for(let t of Dj(e))if(!UA.has(t))return!1;return!0}function kj(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 Aj(e){return U({tagName:`div`,children:[U({tagName:`div`,children:e.annotations?.map(e=>U({tagName:`slot`,properties:{name:e}})),properties:{"data-annotation-content":``}})],properties:{"data-line-annotation":`${e.hunkIndex},${e.lineIndex}`}})}function jj(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 Mj({fileOrDiff:e,mode:t,stickyHeader:n}){let r=`type`in e?e:void 0,i={"data-diffs-header":t,"data-change-type":r?.type,"data-sticky":n?``:void 0};return U({tagName:`div`,children:[t===`custom`?U({tagName:`slot`,properties:{name:ky}}):Nj({name:e.name,prevName:`prevName`in e?e.prevName:void 0,iconType:r?.type??`file`}),...t===`custom`?[]:[Pj(r)]],properties:i})}function Nj({name:e,prevName:t,iconType:n}){let r=[U({tagName:`slot`,properties:{name:Ey}}),ox({name:jj(n),properties:{"data-change-icon":n}})];return t!=null&&(r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[ax(t)]})],properties:{"data-prev-name":``}})),r.push(ox({name:`diffs-icon-arrow-right-short`,properties:{"data-rename-icon":``}}))),r.push(U({tagName:`div`,children:[U({tagName:`bdi`,children:[ax(e)]})],properties:{"data-title":``}})),r.push(U({tagName:`slot`,properties:{name:Dy}})),U({tagName:`div`,children:r,properties:{"data-header-content":``}})}function Pj(e){let t=[];if(e!=null){let n=0,r=0;for(let t of e.hunks)n+=t.additionLines,r+=t.deletionLines;(r>0||n===0)&&t.push(U({tagName:`span`,children:[ax(`-${r}`)],properties:{"data-deletions-count":``}})),(n>0||r===0)&&t.push(U({tagName:`span`,children:[ax(`+${n}`)],properties:{"data-additions-count":``}}))}return t.push(U({tagName:`slot`,properties:{name:Oy}})),U({tagName:`div`,children:t,properties:{"data-metadata":``}})}function Fj(e){return U({tagName:`pre`,properties:Ij(e)})}function Ij({diffIndicators:e,disableBackground:t,disableLineNumbers:n,overflow:r,split:i,totalLines:a,type:o,customProperties:s}){return{...s,"data-diff":o===`diff`?``:void 0,"data-file":o===`file`?``:void 0,"data-diff-type":o===`diff`?i?`split`:`single`:void 0,"data-overflow":r,"data-disable-line-numbers":n?``:void 0,"data-background":t?void 0:``,"data-indicators":e===`bars`||e===`classic`?e:void 0,style:`--diffs-min-number-column-width-default:${`${a}`.length}ch;`}}var Lj=new Map,Rj={"1c":`1c`,abap:`abap`,as:`actionscript-3`,ada:`ada`,adb:`ada`,ads:`ada`,adoc:`asciidoc`,asciidoc:`asciidoc`,"component.html":`angular-html`,"component.ts":`angular-ts`,conf:`nginx`,htaccess:`apache`,cls:`tex`,trigger:`apex`,apl:`apl`,applescript:`applescript`,scpt:`applescript`,ara:`ara`,asm:`asm`,s:`riscv`,astro:`astro`,awk:`awk`,bal:`ballerina`,sh:`zsh`,bash:`zsh`,bat:`cmd`,cmd:`cmd`,be:`berry`,beancount:`beancount`,bib:`bibtex`,bicep:`bicep`,"blade.php":`blade`,bsl:`bsl`,c:`c`,h:`objective-cpp`,cs:`csharp`,cpp:`cpp`,hpp:`cpp`,cc:`cpp`,cxx:`cpp`,hh:`cpp`,cdc:`cdc`,cairo:`cairo`,clar:`clarity`,clj:`clojure`,cljs:`clojure`,cljc:`clojure`,soy:`soy`,cmake:`cmake`,"CMakeLists.txt":`cmake`,cob:`cobol`,cbl:`cobol`,cobol:`cobol`,CODEOWNERS:`codeowners`,ql:`ql`,coffee:`coffeescript`,lisp:`lisp`,cl:`lisp`,lsp:`lisp`,log:`log`,v:`verilog`,cql:`cql`,cr:`crystal`,css:`css`,csv:`csv`,cue:`cue`,cypher:`cypher`,cyp:`cypher`,d:`d`,dart:`dart`,dax:`dax`,desktop:`desktop`,diff:`diff`,patch:`diff`,Dockerfile:`dockerfile`,dockerfile:`dockerfile`,env:`dotenv`,dm:`dream-maker`,edge:`edge`,el:`emacs-lisp`,ex:`elixir`,exs:`elixir`,elm:`elm`,erb:`erb`,erl:`erlang`,hrl:`erlang`,f:`fortran-fixed-form`,for:`fortran-fixed-form`,fs:`fsharp`,fsi:`fsharp`,fsx:`fsharp`,f03:`f03`,f08:`f08`,f18:`f18`,f77:`f77`,f90:`fortran-free-form`,f95:`fortran-free-form`,fnl:`fennel`,fish:`fish`,ftl:`ftl`,tres:`gdresource`,res:`gdresource`,gd:`gdscript`,gdshader:`gdshader`,gs:`genie`,feature:`gherkin`,COMMIT_EDITMSG:`git-commit`,"git-rebase-todo":`git-rebase`,gjs:`glimmer-js`,gleam:`gleam`,gts:`glimmer-ts`,glsl:`glsl`,vert:`glsl`,frag:`glsl`,shader:`shaderlab`,gp:`gnuplot`,plt:`gnuplot`,gnuplot:`gnuplot`,go:`go`,graphql:`graphql`,gql:`graphql`,groovy:`groovy`,gvy:`groovy`,hack:`hack`,haml:`haml`,hbs:`handlebars`,handlebars:`handlebars`,hs:`haskell`,lhs:`haskell`,hx:`haxe`,hcl:`hcl`,hjson:`hjson`,hlsl:`hlsl`,fx:`hlsl`,html:`html`,htm:`html`,http:`http`,rest:`http`,hxml:`hxml`,hy:`hy`,imba:`imba`,ini:`ini`,cfg:`ini`,jade:`pug`,pug:`pug`,java:`java`,js:`javascript`,mjs:`javascript`,cjs:`javascript`,jinja:`jinja`,jinja2:`jinja`,j2:`jinja`,jison:`jison`,jl:`julia`,json:`json`,json5:`json5`,jsonc:`jsonc`,jsonl:`jsonl`,jsonnet:`jsonnet`,libsonnet:`jsonnet`,jssm:`jssm`,jsx:`jsx`,kt:`kotlin`,kts:`kts`,kql:`kusto`,tex:`tex`,ltx:`tex`,lean:`lean4`,less:`less`,liquid:`liquid`,lit:`lit`,ll:`llvm`,logo:`logo`,lua:`lua`,luau:`luau`,Makefile:`makefile`,mk:`makefile`,makefile:`makefile`,md:`markdown`,markdown:`markdown`,marko:`marko`,m:`wolfram`,mat:`matlab`,mdc:`mdc`,mdx:`mdx`,wiki:`wikitext`,mediawiki:`wikitext`,mmd:`mermaid`,mermaid:`mermaid`,mips:`mipsasm`,mojo:`mojo`,"🔥":`mojo`,move:`move`,nar:`narrat`,nf:`nextflow`,nim:`nim`,nims:`nim`,nimble:`nim`,nix:`nix`,nu:`nushell`,mm:`objective-cpp`,ml:`ocaml`,mli:`ocaml`,mll:`ocaml`,mly:`ocaml`,pas:`pascal`,p:`pascal`,pl:`prolog`,pm:`perl`,t:`perl`,raku:`raku`,p6:`raku`,pl6:`raku`,php:`php`,phtml:`php`,pls:`plsql`,sql:`sql`,po:`po`,polar:`polar`,pcss:`postcss`,pot:`pot`,potx:`potx`,pq:`powerquery`,pqm:`powerquery`,ps1:`powershell`,psm1:`powershell`,psd1:`powershell`,prisma:`prisma`,pro:`prolog`,P:`prolog`,properties:`properties`,proto:`protobuf`,pp:`puppet`,purs:`purescript`,py:`python`,pyw:`python`,pyi:`python`,qml:`qml`,qmldir:`qmldir`,qss:`qss`,r:`r`,R:`r`,rkt:`racket`,rktl:`racket`,razor:`razor`,cshtml:`razor`,rb:`ruby`,rbw:`ruby`,reg:`reg`,regex:`regexp`,rel:`rel`,rs:`rust`,rst:`rst`,rake:`ruby`,gemspec:`ruby`,jbuilder:`ruby`,builder:`ruby`,rabl:`ruby`,arb:`ruby`,ru:`ruby`,podspec:`ruby`,Gemfile:`ruby`,Rakefile:`ruby`,Guardfile:`ruby`,Capfile:`ruby`,Berksfile:`ruby`,Brewfile:`ruby`,Vagrantfile:`ruby`,Thorfile:`ruby`,Appraisals:`ruby`,Dangerfile:`ruby`,sas:`sas`,sass:`sass`,scala:`scala`,sc:`scala`,scm:`scheme`,ss:`scheme`,sld:`scheme`,scss:`scss`,sdbl:`sdbl`,shadergraph:`shader`,st:`smalltalk`,sol:`solidity`,sparql:`sparql`,rq:`sparql`,spl:`splunk`,config:`ssh-config`,do:`stata`,ado:`stata`,dta:`stata`,styl:`stylus`,stylus:`stylus`,svelte:`svelte`,swift:`swift`,sv:`system-verilog`,svh:`system-verilog`,service:`systemd`,socket:`systemd`,device:`systemd`,timer:`systemd`,talon:`talonscript`,tasl:`tasl`,tcl:`tcl`,templ:`templ`,tf:`tf`,tfvars:`tfvars`,toml:`toml`,ts:`typescript`,mts:`typescript`,cts:`typescript`,tsp:`typespec`,tsv:`tsv`,tsx:`tsx`,ttl:`turtle`,twig:`twig`,typ:`typst`,vv:`v`,vala:`vala`,vapi:`vala`,vb:`vb`,vbs:`vb`,bas:`vb`,vh:`verilog`,vhd:`vhdl`,vhdl:`vhdl`,vim:`vimscript`,vue:`vue`,"vine.ts":`vue-vine`,vy:`vyper`,wasm:`wasm`,wat:`wasm`,wy:`文言`,wgsl:`wgsl`,wit:`wit`,wl:`wolfram`,nb:`wolfram`,xml:`xml`,xsl:`xsl`,xslt:`xsl`,yaml:`yaml`,yml:`yml`,zs:`zenscript`,zig:`zig`,zsh:`zsh`,sty:`tex`};function zj(e){if(Lj.has(e))return Lj.get(e)??`text`;if(Rj[e]!=null)return Rj[e];let t=e.match(/\.([^/\\]+\.[^/\\]+)$/);if(t!=null){if(Lj.has(t[1]))return Lj.get(t[1])??`text`;if(Rj[t[1]]!=null)return Rj[t[1]]??`text`}let n=e.match(/\.([^.]+)$/)?.[1]??``;return Lj.has(n)?Lj.get(n)??`text`:Rj[n]??`text`}function Bj(e,{theme:t,preferredHighlighter:n=`shiki-js`}){return{langs:[e??`text`],themes:Dj(t),preferredHighlighter:n}}function Vj(e){return`annotation-${`side`in e?`${e.side}-`:``}${e.lineNumber}`}function Hj(e,t,n){let r=typeof n.lineInfo==`function`?n.lineInfo(t):n.lineInfo[t-1];if(r==null){let r=`processLine: line ${t}, contains no state.lineInfo`;throw console.error(r,{node:e,line:t,state:n}),Error(r)}return e.tagName=`div`,e.properties[`data-line`]=r.lineNumber,e.properties[`data-alt-line`]=r.altLineNumber,e.properties[`data-line-type`]=r.type,e.properties[`data-line-index`]=r.lineIndex,e.children.length===0&&e.children.push(ax(`
|
|
180
|
+
`)),e}var Uj=Symbol(`no-token`),Wj=Symbol(`multiple-tokens`);function Gj(e){let t=Kj(e);if(t!=null)return t;let n=Uj,r=[],i=[],a,o=()=>{if(i.length===0||a==null){i=[],a=void 0;return}if(i.length===1){let e=i[0];if(e?.type===`element`){Jj(e,a);for(let t of e.children)qj(t)}else qj(e);r.push(e),i=[],a=void 0;return}for(let e of i)qj(e);r.push(U({tagName:`span`,properties:{"data-char":a},children:i})),i=[],a=void 0},s=e=>{if(e!==Uj){if(e===Wj){n=Wj;return}if(n===Uj){n=e;return}n!==e&&(n=Wj)}};for(let t of e.children){let e=t.type===`element`?Gj(t):Uj;if(s(e),typeof e!=`number`){o(),r.push(t);continue}a!=null&&a!==e&&o(),a??=e,i.push(t)}return o(),e.children=r,n}function Kj(e){let t=e.properties[`data-char`];if(typeof t==`number`)return t}function qj(e){if(e.type===`element`){e.properties[`data-char`]=void 0;for(let t of e.children)qj(t)}}function Jj(e,t){e.properties[`data-char`]=t}function Yj(e={}){let{classPrefix:t=`__shiki_`,classSuffix:n=``,classReplacer:r=e=>e}=e,i=new Map;function a(e){return Object.entries(e).map(([e,t])=>`${e}:${t}`).join(`;`)}function o(e){let o=typeof e==`string`?e:a(e),s=t+Xj(o)+n;return s=r(s),i.has(s)||i.set(s,typeof e==`string`?e:{...e}),s}return{name:`@shikijs/transformers:style-to-class`,pre(e){if(!e.properties.style)return;let t=o(e.properties.style);delete e.properties.style,this.addClassToHast(e,t)},tokens(e){for(let t of e)for(let e of t){if(!e.htmlStyle)continue;let t=o(e.htmlStyle);e.htmlStyle={},e.htmlAttrs||={},e.htmlAttrs.class?e.htmlAttrs.class+=` ${t}`:e.htmlAttrs.class=t}},getClassRegistry(){return i},getCSS(){let e=``;for(let[t,n]of i.entries())e+=`.${t}{${typeof n==`string`?n:a(n)}}`;return e},clearRegistry(){i.clear()}}}function Xj(e,t=0){let n=3735928559^t,r=1103547991^t;for(let t=0,i;t<e.length;t++)i=e.charCodeAt(t),n=Math.imul(n^i,2654435761),r=Math.imul(r^i,1597334677);return n=Math.imul(n^n>>>16,2246822507),n^=Math.imul(r^r>>>13,3266489909),r=Math.imul(r^r>>>16,2246822507),r^=Math.imul(n^n>>>13,3266489909),(4294967296*(2097151&r)+(n>>>0)).toString(36).slice(0,6)}function Zj(e=!1,t=!1){let n={lineInfo:[]},r=[{line(e){return delete e.properties.class,e},pre(t){let r=sx(t),i=[];if(r!=null){let t=1;for(let a of r.children)a.type===`element`&&(e&&Gj(a),i.push(Hj(a,t,n)),t++);r.children=i}return t},...e?{tokens(e){for(let t of e){let e=0;for(let n of t){let t=n;t.__lineChar??=e,e+=n.content.length}}},preprocess(e,t){t.mergeWhitespaces=`never`},span(e,t,n,r,i){if(i?.offset!=null&&i.content!=null){let t=i.__lineChar;return t!=null&&(e.properties[`data-char`]=t),e}return e}}:null}];return t&&r.push($j,Qj),e&&r.push({line:e=>(e.type===`element`&&e.children.length===0&&e.children.push({type:`element`,tagName:`br`,properties:{},children:[]}),e)}),{state:n,transformers:r,toClass:Qj}}var Qj=Yj({classPrefix:`hl-`}),$j={name:`token-style-normalizer`,tokens(e){for(let t of e)for(let e of t){if(e.htmlStyle!=null)continue;let t={};e.color!=null&&(t.color=e.color),e.bgColor!=null&&(t[`background-color`]=e.bgColor),e.fontStyle!=null&&e.fontStyle!==0&&(e.fontStyle&1&&(t[`font-style`]=`italic`),e.fontStyle&2&&(t[`font-weight`]=`bold`),e.fontStyle&4&&(t[`text-decoration`]=`underline`)),Object.keys(t).length>0&&(e.htmlStyle=t)}}};function eM(e){return`--${e===`token`?`diffs-token`:`diffs`}-`}var tM=/^#(?:[0-9a-f]{3}0|[0-9a-f]{6}00)$/i,nM=/^0(?:\.0+)?%?$/;function rM(e){let t=e.indexOf(`(`);if(t<=0||!e.endsWith(`)`))return;let n=e.slice(0,t).trim();if(!/^(?:rgb|rgba|hsl|hsla|hwb|lab|lch|oklab|oklch|color)$/i.test(n))return;let r=e.slice(t+1,-1).trim();if(r.length===0)return;let i=r.lastIndexOf(`/`);if(i!==-1)return r.slice(i+1).trim();if(/^(?:rgba|hsla)$/i.test(n)){let e=r.split(`,`);if(e.length===4)return e[3]?.trim()}}function iM(e){let t=/^#([0-9a-f]{3}|[0-9a-f]{6}|[0-9a-f]{8})\b/i.exec(e.trim());if(t==null)return null;let n=t[1],r,i=1;return n.length===3?r=n.split(``).map(e=>e+e).join(``):n.length===6?r=n:(r=n.slice(0,6),i=parseInt(n.slice(6,8),16)/255),[parseInt(r.slice(0,2),16),parseInt(r.slice(2,4),16),parseInt(r.slice(4,6),16),i]}function aM(e){if(e==null)return null;let t=iM(e);if(t==null)return null;let n=t[0]/255,r=t[1]/255,i=t[2]/255,a=e=>e<=.03928?e/12.92:((e+.055)/1.055)**2.4;return .2126*a(n)+.7152*a(r)+.0722*a(i)}function oM(e){if(e==null)return!1;let t=e.trim().toLowerCase();if(t===`transparent`||tM.test(t))return!0;let n=rM(t);return n!=null&&nM.test(n)}function sM(e,t,n){if(t==null||n==null)return!1;let r=aM(e),i=aM(t),a=aM(n);return r==null||i==null||a==null?!1:Math.abs(r-a)<Math.abs(r-i)}var cM=new WeakMap;function lM(e){let t=cM.get(e);if(t!=null)return t;let n=e.colors??{},r={...n},i=n[`editor.background`]??e.bg,a=n[`editor.foreground`]??e.fg,o=n[`sideBar.background`]??i,s=n[`sideBar.foreground`]??a;uM(r,`editor.background`,i),uM(r,`editor.foreground`,a),uM(r,`sideBar.background`,o),uM(r,`sideBar.foreground`,s),uM(r,`input.background`,n[`input.background`]??o),uM(r,`sideBarSectionHeader.foreground`,n[`sideBarSectionHeader.foreground`]??s),uM(r,`list.activeSelectionForeground`,n[`list.activeSelectionForeground`]??s),uM(r,`gitDecoration.addedResourceForeground`,dM(n[`gitDecoration.addedResourceForeground`],n[`terminal.ansiGreen`],n[`editorGutter.addedBackground`])),uM(r,`gitDecoration.modifiedResourceForeground`,dM(n[`gitDecoration.modifiedResourceForeground`],n[`terminal.ansiBlue`],n[`editorGutter.modifiedBackground`])),uM(r,`gitDecoration.deletedResourceForeground`,dM(n[`gitDecoration.deletedResourceForeground`],n[`terminal.ansiRed`],n[`editorGutter.deletedBackground`]));let c=(oM(n[`list.focusOutline`])?void 0:n[`list.focusOutline`])??(oM(n.focusBorder)?void 0:n.focusBorder);c==null?delete r[`list.focusOutline`]:r[`list.focusOutline`]=c;let l=n[`list.hoverBackground`];l!=null&&(fM(l,o)||sM(l,o,s))&&delete r[`list.hoverBackground`];let u=Object.freeze({...e,colors:Object.freeze(r)});return cM.set(e,u),u}function uM(e,t,n){n!=null&&n!==``&&(e[t]=n)}function dM(...e){for(let t of e)if(t!=null&&t!==``)return t}function fM(e,t){return t!=null&&e.toLowerCase()===t.toLowerCase()}function pM({theme:e=Ay,highlighter:t,prefix:n}){let r=``;if(typeof e==`string`){let i=t.getTheme(e),a=lM(i);r+=`color:${a.fg};`,r+=`background-color:${a.bg};`,r+=`${eM(`global`)}fg:${a.fg};`,r+=`${eM(`global`)}bg:${a.bg};`,r+=mM(i,n)}else{let n=t.getTheme(e.dark),i=lM(n);r+=`${eM(`global`)}dark:${i.fg};`,r+=`${eM(`global`)}dark-bg:${i.bg};`,r+=mM(n,`dark`),n=t.getTheme(e.light),i=lM(n),r+=`${eM(`global`)}light:${i.fg};`,r+=`${eM(`global`)}light-bg:${i.bg};`,r+=mM(n,`light`)}return r}function mM(e,t){t=t==null?``:`${t}-`;let n=``,r=e.colors?.[`gitDecoration.addedResourceForeground`]??e.colors?.[`terminal.ansiGreen`];r!=null&&(n+=`${eM(`global`)}${t}addition-color:${r};`);let i=e.colors?.[`gitDecoration.deletedResourceForeground`]??e.colors?.[`terminal.ansiRed`];i!=null&&(n+=`${eM(`global`)}${t}deletion-color:${i};`);let a=e.colors?.[`gitDecoration.modifiedResourceForeground`]??e.colors?.[`terminal.ansiBlue`];return a!=null&&(n+=`${eM(`global`)}${t}modified-color:${a};`),n}function hM(e){let t=e.children[0];for(;t!=null;){if(t.type===`element`&&t.tagName===`code`)return t.children;t=`children`in t?t.children[0]:null}throw console.error(e),Error(`getLineNodes: Unable to find children`)}function gM(e){let t=e[0];return t!=null&&t.length>0?t:void 0}function _M(e){return e.startingLine===0&&e.totalLines>0}function vM(e,t){return e.endsWith(`\r
|
|
181
181
|
`)?t+`\r
|
|
182
182
|
`:e.endsWith(`\r`)?t+`\r`:e.endsWith(`
|
|
183
183
|
`)?t+`
|
|
184
|
-
`:t}function
|
|
184
|
+
`:t}function yM(e,t){return U({tagName:`div`,children:e,properties:{"data-content":``,style:`grid-row: span ${t}`}})}var bM=`<svg data-icon-sprite aria-hidden="true" width="0" height="0">
|
|
185
185
|
<symbol id="diffs-icon-arrow-right-short" viewBox="0 0 16 16">
|
|
186
186
|
<path d="M8.47 4.22a.75.75 0 0 0 0 1.06l1.97 1.97H3.75a.75.75 0 0 0 0 1.5h6.69l-1.97 1.97a.75.75 0 1 0 1.06 1.06l3.25-3.25a.75.75 0 0 0 0-1.06L9.53 4.22a.75.75 0 0 0-1.06 0"/>
|
|
187
187
|
</symbol>
|
|
@@ -233,7 +233,7 @@ XID_Start XIDS`.split(/\s/).map(e=>[Rk(e),e])),Zte=new Map([[`s`,sA(383)],[sA(38
|
|
|
233
233
|
<symbol id="diffs-icon-symbol-ref" viewBox="0 0 16 16">
|
|
234
234
|
<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"/>
|
|
235
235
|
</symbol>
|
|
236
|
-
</svg>`;function
|
|
236
|
+
</svg>`;function xM(e,t){return e==null||t==null?e===t:CM(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}var SM={};function CM(e=SM,t=SM){if(e===t)return!0;let n=Object.keys(e),r=Object.keys(t);if(n.length!==r.length)return!1;for(let r of n)if(e[r]!==t[r])return!1;return!0}function wM(e){let t=document.createElement(`div`);return t.dataset.annotationSlot=``,t.slot=e,t.style.whiteSpace=`normal`,t}function TM(){let 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 EM(){let e=document.createElement(`style`);return e.setAttribute(My,``),e}var DM=`@layer base {
|
|
237
237
|
:host {
|
|
238
238
|
--diffs-font-fallback: "SF Mono", Monaco, Consolas, "Ubuntu Mono", "Liberation Mono",
|
|
239
239
|
"Courier New", monospace;
|
|
@@ -1511,25 +1511,25 @@ XID_Start XIDS`.split(/\s/).map(e=>[Rk(e),e])),Zte=new Map([[`s`,sA(383)],[sA(38
|
|
|
1511
1511
|
}
|
|
1512
1512
|
|
|
1513
1513
|
@layer theme, rendered, unsafe;
|
|
1514
|
-
`,
|
|
1514
|
+
`,OM;function kM(e){if(OM!=null)return OM;let t=e.host;if(typeof HTMLElement<`u`&&t instanceof HTMLElement&&!t.isConnected)return;let n=document.createElement(`div`);n.setAttribute(`data-code`,``),n.setAttribute(Ny,`true`);let r=document.createElement(`div`);return r.style.position=`relative`,r.style.width=`200%`,r.style.height=`200%`,n.appendChild(r),e.appendChild(n),OM=Math.max(n.offsetHeight-n.clientHeight,0),n.remove(),OM}function AM(e){return`${Py}: ${e==null?`var(--diffs-scrollbar-gutter-fallback)`:`${e}px`};`}var jM=`@layer base, theme, rendered, unsafe;`,MM=RegExp(`${IM(Py)}\\s*:\\s*[^;]+;`);function NM(e){return`${jM}
|
|
1515
1515
|
@layer unsafe {
|
|
1516
1516
|
${e}
|
|
1517
|
-
}`}function
|
|
1517
|
+
}`}function PM(e,t=`system`,n){return`${jM}
|
|
1518
1518
|
@layer rendered {
|
|
1519
1519
|
:host {${t===`system`?``:`
|
|
1520
1520
|
color-scheme: ${t};`}
|
|
1521
|
-
${
|
|
1521
|
+
${AM(n)}
|
|
1522
1522
|
${e}
|
|
1523
1523
|
}
|
|
1524
|
-
}`}function MM(e,t){let n=DM(t);return e.replace(kM,n)}function NM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function PM({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function FM(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function IM(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function LM(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function RM(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function zM(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function BM({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=VM(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function VM(){let e=document.createElement(`style`);return e.setAttribute(ky,``),e}var HM=void 0;function UM(){return HM??=`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;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(wM)),t.adoptedStyleSheets=[e]}connectedCallback(){EM(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(_y,t)}function WM(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function GM(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function KM(e){return e===``?[]:e.split(yy)}function qM(e,t,n){let r=e===`clone`?GM(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return JM(r,XM(r,n),ZM(r,n));case`rename-pure`:{let e=ZM(r,n);QM(r,n);let t=KM(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,eN(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function JM(e,t,n){let r=KM(t.contents),i=KM(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=YM(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,eN(e,t,n),e}function YM(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(Qy(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=$y(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=$y(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function XM(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function ZM(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function QM(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function $M(e,t,n){return e.cacheKey==null?tN(t,n):`${e.cacheKey}:hydrated`}function eN(e,t,n){let r=$M(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function tN(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var nN=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;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,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==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!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function rN(e,t){return Hy(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function iN(e){return U({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function aN(e){return U({tagName:`div`,children:[U({tagName:`span`,children:[rx(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function oN(e){return U({tagName:`div`,children:[ix({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 sN({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(U({tagName:`div`,children:[rx(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(oN(`up`)),s++),o||(e.push(oN(`down`)),s++)):(e.push(oN(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(U({tagName:`div`,children:[U({tagName:`span`,children:[rx(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(U({tagName:`div`,children:[rx(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(U({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(U({tagName:`slot`,properties:{name:i}})),U({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function cN(e,t){return`hunk-separator-${e}-${t}`}function lN(e){let t=e.at(-1);return t==null?0:Math.max($y(t.additionStart,t.additionCount),$y(t.deletionStart,t.deletionCount))}function uN(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function dN({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function fN({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function pN(e){return[Qy(e.additionStart,e.additionCount)+1,$y(e.additionStart,e.additionCount)+1]}function mN({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function hN(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-$y(t.additionStart,t.additionCount),r=e.deletionLines.length-$y(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function gN({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-$y(n.additionStart,n.additionCount),i=e.deletionLines.length-$y(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function _N({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=gN({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function vN({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=pN(a);if(t<o){let s=mN({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=_N({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=pN(a);return t<o+i.fromStart||t>=o+i.rangeSize}function yN({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=pN(n),l=mN({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=_N({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function bN({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=xN({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=Qy(r.deletionStart,r.deletionCount),s=Qy(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=mN({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?_N({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(wN(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,wN(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(wN(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=TN(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(EN({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(wN(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function xN({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=SN({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function SN({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=mN({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?_N({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function CN(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function wN(e,t,n,r,i,a){let[o,s]=CN(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function TN(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function EN({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,ee=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,te=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,ne=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:ee}:void 0;if(te==null&&ne!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:ne};if(te!=null&&ne==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:void 0};if(te==null||ne==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:ne}}var DN={forcePlainText:!1};function ON(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=DN){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=uM({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??AN();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}bN({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&kN({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=jN({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function kN({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Wy(e),t=Wy(t),e.length>s||t.length>s))return;let c=o===`char`?Tb(e,t):Hb(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(fN({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),fN({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?fN({item:e,arr:l,enableJoin:d,isLastItem:t}):fN({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(dN({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(dN({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function AN(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function jN({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=Oy,...l}}){let u=s??Ij(e.name),d=s??Ij(t.name),{state:f,transformers:p}=Jj(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Zj(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:Zj(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,fM(i.codeToHast(Wy(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,fM(i.codeToHast(Wy(t.contents),m)))}}function MN(e,t){let n=ex({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function NN(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function PN(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function FN(e,t){return t.length>0&&t.length<e.deletionLines.length&&PN(t)}function IN(e,t,n){let r=e.deletionLines.join(``),i=NN(t.length,r),a=ex({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function LN(e,t){return IN(e,[``],t)}function RN(e,t){if(e.additionLines.length===0)return LN(e,t);if(FN(e,e.additionLines))return IN(e,e.additionLines,t);let n=e.additionLines,r=MN(e,t);return BN(r,n),r}function zN(e){return e.length>1&&e.at(-1)===``}function BN(e,t){if(!zN(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&$y(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,XN(e);return}}}function VN(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return HN(e,MN(e,n));let r=Array.from(t);if(r.length===0)return HN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Wy(r)===Wy(i))return HN(e,MN(e,n))}let i=UN(e,r);if(i.size===0)return HN(e,MN(e,n));for(let t of i)if(!GN(e,t,n))return HN(e,MN(e,n));return XN(e),hN(e)?HN(e,MN(e,n)):HN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function HN(e,t){return Object.assign(e,t),t}function UN(e,t){let n=new Set;for(let r of t){let t=WN(e,r);if(t==null)return new Set;n.add(t)}return n}function WN(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function GN(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=ex({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(qN(r,s),KN(e,t),!0)}function KN(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
1524
|
+
}`}function FM(e,t){let n=AM(t);return e.replace(MM,n)}function IM(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function LM({code:e,pre:t,columnType:n,rowSpan:r,containerSize:i=!1}={}){return e??(e=document.createElement(`code`),e.setAttribute(`data-code`,``),n!=null&&e.setAttribute(`data-${n}`,``),t?.appendChild(e)),r==null?e.style.removeProperty(`grid-row`):e.style.setProperty(`grid-row`,`span ${r}`),i?e.setAttribute(`data-container-size`,``):e.removeAttribute(`data-container-size`),e}function RM(e,t){if(t==null)return;let n=e.shadowRoot??e.attachShadow({mode:`open`});n.innerHTML===``&&(n.innerHTML=t)}function zM(e,{type:t,diffIndicators:n,disableBackground:r,disableLineNumbers:i,overflow:a,split:o,totalLines:s,customProperties:c}){if(c!=null)for(let t in c){let n=c[t];n!=null&&e.setAttribute(t,`${n}`)}switch(t===`diff`?(e.setAttribute(`data-diff`,``),e.removeAttribute(`data-file`)):(e.setAttribute(`data-file`,``),e.removeAttribute(`data-diff`)),n){case`bars`:case`classic`:e.setAttribute(`data-indicators`,n);break;case`none`:e.removeAttribute(`data-indicators`)}return i?e.setAttribute(`data-disable-line-numbers`,``):e.removeAttribute(`data-disable-line-numbers`),r?e.removeAttribute(`data-background`):e.setAttribute(`data-background`,``),t===`diff`?e.setAttribute(`data-diff-type`,o?`split`:`single`):e.removeAttribute(`data-diff-type`),e.setAttribute(`data-overflow`,a),e.style.setProperty(`--diffs-min-number-column-width-default`,`${`${s}`.length}ch`),e}function BM(e){if(typeof HTMLStyleElement<`u`&&e instanceof HTMLStyleElement)return!0;let t=e.tagName??e.nodeName;return typeof t==`string`&&t.toLowerCase()===`style`}function VM(e){return e?.useTokenTransformer===!0||e?.onTokenClick!=null||e?.onTokenEnter!=null||e?.onTokenLeave!=null}function HM(e,t){let n=e?.offsetHeight??0;if(e==null||n===0){t();return}e.style.minHeight=`${n}px`;try{t(),e.offsetHeight}finally{e.style.minHeight=``}}function UM({shadowRoot:e,currentNode:t,themeCSS:n}){if(n.trim()===``){t?.remove();return}return t??=WM(),t.textContent=n,t.parentNode!==e&&e.appendChild(t),t}function WM(){let e=document.createElement(`style`);return e.setAttribute(jy,``),e}var GM=void 0;function KM(){return GM??=`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;let t=this.attachShadow({mode:`open`});e??(e=new CSSStyleSheet,e.replaceSync(DM)),t.adoptedStyleSheets=[e]}connectedCallback(){kM(this.shadowRoot??this.attachShadow({mode:`open`}))}}customElements.define(yy,t)}function qM(e,t){return e===t||e?.cacheKey!=null&&e.cacheKey===t?.cacheKey}function JM(e){return{...e,hunks:e.hunks.map(e=>({...e,hunkContent:e.hunkContent.map(e=>({...e}))})),deletionLines:[...e.deletionLines],additionLines:[...e.additionLines]}}function YM(e){return e===``?[]:e.split(xy)}function XM(e,t,n){let r=e===`clone`?JM(t):t;if(!r.isPartial)throw Error(`hydratePartialDiff: fileDiff must be partial`);switch(r.type){case`change`:case`rename-changed`:return ZM(r,$M(r,n),eN(r,n));case`rename-pure`:{let e=eN(r,n);tN(r,n);let t=YM(e.contents);return r.isPartial=!1,r.deletionLines=t,r.additionLines=t,rN(r,null,e),r}}throw Error(`hydratePartialDiff: ${r.type} diffs cannot be hydrated from loaded files`)}function ZM(e,t,n){let r=YM(t.contents),i=YM(n.contents),{hunks:a,splitLineCount:o,unifiedLineCount:s}=QM(e.hunks,i.length);return e.hunks=a,e.splitLineCount=o,e.unifiedLineCount=s,e.isPartial=!1,e.deletionLines=r,e.additionLines=i,rN(e,t,n),e}function QM(e,t){let n=0,r=0,i=0,a=[];for(let t of e){let e=Math.max(t.additionStart-1,0),o=Math.max(t.deletionStart-1,0),s=e,c=o,l=0,u=0,d=0,f=0,p=[];for(let e of t.hunkContent){if(e.type===`context`){p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.lines,c+=e.lines,d+=e.lines,f+=e.lines;continue}p.push({...e,additionLineIndex:s,deletionLineIndex:c}),s+=e.additions,c+=e.deletions,l+=e.additions,u+=e.deletions,d+=Math.max(e.additions,e.deletions),f+=e.additions+e.deletions}let m=Math.max(eb(t.additionStart,t.additionCount)-i,0);a.push({...t,collapsedBefore:m,additionLineIndex:e,deletionLineIndex:o,additionLines:l,deletionLines:u,hunkContent:p,splitLineStart:n+m,unifiedLineStart:r+m,splitLineCount:d,unifiedLineCount:f}),n+=m+d,r+=m+f,i=tb(t.additionStart,t.additionCount)}if(a.length>0){let e=a[a.length-1],i=tb(e.additionStart,e.additionCount),o=Math.max(t-i,0);n+=o,r+=o}return{hunks:a,splitLineCount:n,unifiedLineCount:r}}function $M(e,t){if(t.oldFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile`);return t.oldFile}function eN(e,t){if(t.newFile==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires newFile`);return t.newFile}function tN(e,t){if(t.oldFile!==null)throw Error(`hydratePartialDiff: ${e.type} diff for ${e.name} requires oldFile to be null`)}function nN(e,t,n){return e.cacheKey==null?iN(t,n):`${e.cacheKey}:hydrated`}function rN(e,t,n){let r=nN(e,t,n);if(r==null){delete e.cacheKey;return}e.cacheKey=r}function iN(e,t){return e!=null&&t!=null?e.cacheKey!=null&&t.cacheKey!=null?`${e.cacheKey}:${t.cacheKey}`:void 0:e?.cacheKey??t?.cacheKey}var aN=class{isDeletionsScrolling=!1;isAdditionsScrolling=!1;timeoutId=-1;codeDeletions;codeAdditions;enabled=!1;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,!1)}setup(e,t,n){if(t==null||n==null)for(let r of e.children??[])r instanceof HTMLElement&&(`deletions`in r.dataset?t=r:`additions`in r.dataset&&(n=r));if(n==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!==n&&(this.codeAdditions?.removeEventListener(`scroll`,this.handleAdditionsScroll),this.codeAdditions=n,n.addEventListener(`scroll`,this.handleAdditionsScroll,{passive:!0})),this.enabled=!0}handleDeletionsScroll=()=>{this.isAdditionsScrolling||(this.isDeletionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isDeletionsScrolling=!1},300),this.codeAdditions?.scrollTo({left:this.codeDeletions?.scrollLeft}))};handleAdditionsScroll=()=>{this.isDeletionsScrolling||(this.isAdditionsScrolling=!0,clearTimeout(this.timeoutId),this.timeoutId=setTimeout(()=>{this.isAdditionsScrolling=!1},300),this.codeDeletions?.scrollTo({left:this.codeAdditions?.scrollLeft}))}};function oN(e,t){return Wy(e.theme,t.theme)&&e.useTokenTransformer===t.useTokenTransformer&&e.tokenizeMaxLineLength===t.tokenizeMaxLineLength&&e.lineDiffType===t.lineDiffType&&e.maxLineDiffLength===t.maxLineDiffLength}function sN(e){return U({tagName:`div`,properties:{"data-content-buffer":``,"data-buffer-size":e,style:`grid-row: span ${e};min-height:calc(${e} * 1lh)`}})}function cN(e){return U({tagName:`div`,children:[U({tagName:`span`,children:[ax(`No newline at end of file`)]})],properties:{"data-no-newline":``,"data-line-type":e,"data-column-content":``}})}function lN(e){return U({tagName:`div`,children:[ox({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 uN({type:e,content:t,expandIndex:n,chunked:r=!1,slotName:i,isFirstHunk:a,isLastHunk:o}){let s=0,c=[];if(e===`metadata`&&t!=null&&c.push(U({tagName:`div`,children:[ax(t)],properties:{"data-separator-wrapper":``}})),(e===`line-info`||e===`line-info-basic`)&&t!=null){let e=[];n!=null&&(r?(a||(e.push(lN(`up`)),s++),o||(e.push(lN(`down`)),s++)):(e.push(lN(!a&&!o?`both`:a?`down`:`up`)),s++)),e.push(U({tagName:`div`,children:[U({tagName:`span`,children:[ax(t)],properties:{"data-unmodified-lines":``}})],properties:{"data-separator-content":``}})),r&&n!=null&&e.push(U({tagName:`div`,children:[ax(`Expand all`)],properties:{role:`button`,"data-expand-button":``,"data-expand-all-button":``}})),c.push(U({tagName:`div`,children:e,properties:{"data-separator-wrapper":``,"data-separator-multi-button":s>1?``:void 0}}))}return e===`custom`&&i!=null&&c.push(U({tagName:`slot`,properties:{name:i}})),U({tagName:`div`,children:c,properties:{"data-separator":c.length===0?`simple`:e,"data-expand-index":n,"data-separator-first":a?``:void 0,"data-separator-last":o?``:void 0}})}function dN(e,t){return`hunk-separator-${e}-${t}`}function fN(e){let t=e.at(-1);return t==null?0:Math.max(tb(t.additionStart,t.additionCount),tb(t.deletionStart,t.deletionCount))}function pN(e){return e.startingLine===0&&e.totalLines===1/0&&e.bufferBefore===0&&e.bufferAfter===0}function mN({line:e,spanStart:t,spanLength:n}){return{start:{line:e,character:t},end:{line:e,character:t+n},properties:{"data-diff-span":``},alwaysWrap:!0}}function hN({item:e,arr:t,enableJoin:n,isNeutral:r=!1,isLastItem:i=!1}){let a=t[t.length-1];if(a==null||i||!n){t.push([+!r,e.value]);return}let o=a[0]===0;if(r===o||r&&e.value.length===1&&!o){a[1]+=e.value;return}t.push([+!r,e.value])}function gN(e){return[eb(e.additionStart,e.additionCount)+1,tb(e.additionStart,e.additionCount)+1]}function _N({isPartial:e,rangeSize:t,expandedHunks:n,hunkIndex:r,collapsedContextThreshold:i}){let a=Math.max(t,0);if(a===0||e)return{fromStart:0,fromEnd:0,rangeSize:a,collapsedLines:a,renderAll:!1};if(n===!0||a<=i)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(r),s=Math.min(Math.max(o?.fromStart??0,0),a),c=Math.min(Math.max(o?.fromEnd??0,0),a),l=s+c,u=l>=a;return{fromStart:u?a:s,fromEnd:u?0:c,rangeSize:a,collapsedLines:Math.max(a-l,0),renderAll:u}}function vN(e){let t=e.hunks[e.hunks.length-1];if(t==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return!1;let n=e.additionLines.length-tb(t.additionStart,t.additionCount),r=e.deletionLines.length-tb(t.deletionStart,t.deletionCount);return n<=0&&r<=0?!1:n!==r}function yN({fileDiff:e,errorPrefix:t}){let n=e.hunks[e.hunks.length-1];if(n==null||e.isPartial||e.additionLines.length===0||e.deletionLines.length===0)return 0;let r=e.additionLines.length-tb(n.additionStart,n.additionCount),i=e.deletionLines.length-tb(n.deletionStart,n.deletionCount);if(r<=0&&i<=0)return 0;if(r!==i)throw Error(`${t}: trailing context mismatch (additions=${r}, deletions=${i}) for ${e.name}`);return Math.min(r,i)}function bN({fileDiff:e,hunkIndex:t,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:i}){if(t!==e.hunks.length-1)return;let a=yN({fileDiff:e,errorPrefix:i});if(a<=0)return;if(n===!0||a<=r)return{fromStart:a,fromEnd:0,rangeSize:a,collapsedLines:0,renderAll:!0};let o=n?.get(e.hunks.length),s=Math.min(Math.max(o?.fromStart??0,0),a);return{fromStart:s,fromEnd:0,rangeSize:a,collapsedLines:a-s,renderAll:s>=a}}function xN({fileDiff:e,lineNumber:t,expandedHunks:n,collapsedContextThreshold:r}){if(n===!0||e.isPartial)return!0;for(let[i,a]of e.hunks.entries()){let[o,s]=gN(a);if(t<o){let s=_N({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:n,hunkIndex:i,collapsedContextThreshold:r}),c=o-s.rangeSize;return s.renderAll||t<c+s.fromStart||t>=o-s.fromEnd}if(t<s)return!0}let i=bN({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:n,collapsedContextThreshold:r,errorPrefix:`isAdditionLineRenderable`});if(i==null||i.renderAll)return!0;let a=e.hunks[e.hunks.length-1],[,o]=gN(a);return t<o+i.fromStart||t>=o+i.rangeSize}function SN({fileDiff:e,lineNumber:t,direction:n,expandedHunks:r,collapsedContextThreshold:i}){if(r===!0||e.isPartial)return t;let a=[],o=1;for(let[t,n]of e.hunks.entries()){let[s,c]=gN(n),l=_N({isPartial:e.isPartial,rangeSize:n.collapsedBefore,expandedHunks:r,hunkIndex:t,collapsedContextThreshold:i}),u=s-l.rangeSize;l.renderAll?a.push([u,s]):(l.fromStart>0&&a.push([u,u+l.fromStart]),l.fromEnd>0&&a.push([s-l.fromEnd,s])),a.push([s,c]),o=c}let s=bN({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:r,collapsedContextThreshold:i,errorPrefix:`getNearestRenderableAdditionLine`});if(s!=null){let e=o;o=e+s.rangeSize,s.renderAll?a.push([e,o]):s.fromStart>0&&a.push([e,e+s.fromStart])}if(t>=o)return t;if(n===`down`){for(let[e,n]of a)if(n>t)return Math.max(e,t);return}for(let e=a.length-1;e>=0;e--){let[n,r]=a[e];if(n<=t)return Math.min(r-1,t)}}function CN({diff:e,diffStyle:t,startingLine:n=0,totalLines:r=1/0,expandedHunks:i,collapsedContextThreshold:a=1,callback:o}){let s=wN({diff:e,diffStyle:t,startingLine:n,expandedHunks:i,collapsedContextThreshold:a}),c={viewportStart:n,viewportEnd:n+r,isWindowedHighlight:n>0||r<1/0,splitCount:s.splitCount,unifiedCount:s.unifiedCount,finalHunkIndex:e.hunks.length-1,shouldBreak(){if(!c.isWindowedHighlight)return!1;let e=c.unifiedCount>=n+r,i=c.splitCount>=n+r;return t===`unified`?e:(t===`split`||e)&&i},shouldSkip(e,r){if(!c.isWindowedHighlight)return!1;let i=e>0&&c.unifiedCount+e<=n,a=r>0&&c.splitCount+r<=n;return t===`unified`?i:(t===`split`||i)&&a},incrementCounts(e,n){(t===`unified`||t===`both`)&&(c.unifiedCount+=e),(t===`split`||t===`both`)&&(c.splitCount+=n)},isInWindow(e,n){if(!c.isWindowedHighlight)return!0;let r=c.isInUnifiedWindow(e),i=c.isInSplitWindow(n);return t===`unified`?r:t===`split`?i:r||i},isInUnifiedWindow(e){return!c.isWindowedHighlight||c.unifiedCount>=n-e&&c.unifiedCount<n+r},isInSplitWindow(e){return!c.isWindowedHighlight||c.splitCount>=n-e&&c.splitCount<n+r},emit(e,n=!1){return n||(t===`unified`?c.incrementCounts(1,0):t===`split`?c.incrementCounts(0,1):c.incrementCounts(1,1)),o(e)??!1}};hunkIterator:for(let n=s.hunkIndex;n<e.hunks.length;n++){let r=e.hunks[n];if(r==null)throw Error(`iterateOverDiff: invalid hunk index`);if(c.shouldBreak())break;let o=eb(r.deletionStart,r.deletionCount),s=eb(r.additionStart,r.additionCount),l=!e.isPartial&&r.deletionCount===0?o:r.deletionLineIndex,u=!e.isPartial&&r.additionCount===0?s:r.additionLineIndex,d=_N({isPartial:e.isPartial,rangeSize:r.collapsedBefore,expandedHunks:i,hunkIndex:n,collapsedContextThreshold:a}),f=n===c.finalHunkIndex?bN({fileDiff:e,hunkIndex:n,expandedHunks:i,collapsedContextThreshold:a,errorPrefix:`iterateOverDiff`}):void 0,p=d.fromStart+d.fromEnd;function m(e,n){return f==null||f.collapsedLines<=0||f.fromStart+f.fromEnd>0?0:t===`unified`?e===r.unifiedLineStart+r.unifiedLineCount-1?f.collapsedLines:0:n===r.splitLineStart+r.splitLineCount-1?f.collapsedLines:0}let h=d.collapsedLines===0;function g(){return h?0:(h=!0,d.collapsedLines)}if(c.shouldSkip(p,p))c.incrementCounts(p,p),g();else{let e=r.unifiedLineStart-d.rangeSize,i=r.splitLineStart-d.rangeSize,a=l-d.rangeSize,f=u-d.rangeSize,p=o+1-d.rangeSize,m=s+1-d.rangeSize;if(DN(c,d.fromStart,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:0,collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}))||(e=r.unifiedLineStart-d.fromEnd,i=r.splitLineStart-d.fromEnd,a=l-d.fromEnd,f=u-d.fromEnd,p=o+1-d.fromEnd,m=s+1-d.fromEnd,DN(c,d.fromEnd,t,t=>c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:0,type:`context-expanded`,deletionLine:{lineNumber:p+t,lineIndex:a+t,noEOFCR:!1,unifiedLineIndex:e+t,splitLineIndex:i+t},additionLine:{unifiedLineIndex:e+t,splitLineIndex:i+t,lineIndex:f+t,lineNumber:m+t,noEOFCR:!1}}),()=>{g()})))break hunkIterator}let _=r.unifiedLineStart,v=r.splitLineStart,y=l,b=u,x=o+1,S=s+1,C=r.hunkContent.at(-1);for(let e of r.hunkContent){if(c.shouldBreak())break hunkIterator;let i=e===C;if(e.type===`context`){if(c.shouldSkip(e.lines,e.lines))c.incrementCounts(e.lines,e.lines),g();else if(DN(c,e.lines,t,t=>{let a=i&&t===e.lines-1,o=_+t,s=v+t;return c.emit({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:m(o,s),type:`context`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:a&&r.noEOFCRDeletions,unifiedLineIndex:o,splitLineIndex:s},additionLine:{unifiedLineIndex:o,splitLineIndex:s,lineIndex:b+t,lineNumber:S+t,noEOFCR:a&&r.noEOFCRAdditions}})},()=>{g()}))break hunkIterator;_+=e.lines,v+=e.lines,y+=e.lines,b+=e.lines,x+=e.lines,S+=e.lines}else{let a=Math.max(e.deletions,e.additions),o=e.deletions+e.additions;if(!c.shouldSkip(o,a)){let s=ON(c,e,t);(s[0]?.[0]??0)>0&&g();for(let[l,u]of s)for(let s=l;s<u;s++){let l=m(_+s,t===`unified`?v+(s<e.deletions?s:s-e.deletions):v+s);if(c.emit(kN({hunkIndex:n,hunk:r,collapsedBefore:g(),collapsedAfter:l,diffStyle:t,index:s,unifiedLineIndex:_,splitLineIndex:v,additionLineIndex:b,deletionLineIndex:y,additionLineNumber:S,deletionLineNumber:x,content:e,isLastContent:i,unifiedCount:o,splitCount:a}),!0))break hunkIterator}}g(),c.incrementCounts(o,a),_+=o,v+=a,y+=e.deletions,b+=e.additions,x+=e.deletions,S+=e.additions}}if(f!=null){let{collapsedLines:n,fromStart:r,fromEnd:i}=f,a=r+i;if(DN(c,a,t,t=>{let r=t===a-1;return c.emit({hunkIndex:e.hunks.length,hunk:void 0,collapsedBefore:0,collapsedAfter:r?n:0,type:`context-expanded`,deletionLine:{lineNumber:x+t,lineIndex:y+t,noEOFCR:!1,unifiedLineIndex:_+t,splitLineIndex:v+t},additionLine:{unifiedLineIndex:_+t,splitLineIndex:v+t,lineIndex:b+t,lineNumber:S+t,noEOFCR:!1}})},void 0,()=>c.shouldBreak()))break hunkIterator}}}function wN({diff:e,diffStyle:t,startingLine:n,expandedHunks:r,collapsedContextThreshold:i}){if(n<=0||t===`both`)return{hunkIndex:0,splitCount:0,unifiedCount:0};let a=TN({diff:e,expandedHunks:r,collapsedContextThreshold:i}),o=0,s=e.hunks.length-1,c=e.hunks.length;for(;o<=s;){let e=o+s>>1,r=a[e+1];if(r==null)throw Error(`iterateOverDiff: invalid hunk prefix index`);(t===`unified`?r.unifiedCount:r.splitCount)>n?(c=e,s=e-1):o=e+1}if(c>=e.hunks.length){let t=a[e.hunks.length];if(t==null)throw Error(`iterateOverDiff: invalid terminal hunk prefix index`);return{hunkIndex:e.hunks.length,splitCount:t.splitCount,unifiedCount:t.unifiedCount}}let l=a[c];if(l==null)throw Error(`iterateOverDiff: invalid selected hunk prefix index`);return{hunkIndex:c,splitCount:l.splitCount,unifiedCount:l.unifiedCount}}function TN({diff:e,expandedHunks:t,collapsedContextThreshold:n}){let r=0,i=0,a=e.hunks.length-1,o=[{splitCount:0,unifiedCount:0}];for(let s=0;s<e.hunks.length;s++){let c=e.hunks[s];if(c==null)throw Error(`iterateOverDiff: invalid hunk summary index`);let l=_N({isPartial:e.isPartial,rangeSize:c.collapsedBefore,expandedHunks:t,hunkIndex:s,collapsedContextThreshold:n}),u=l.fromStart+l.fromEnd;r+=u+c.splitLineCount,i+=u+c.unifiedLineCount;let d=s===a?bN({fileDiff:e,hunkIndex:s,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`iterateOverDiff`}):void 0;if(d!=null){let e=d.fromStart+d.fromEnd;r+=e,i+=e}o.push({splitCount:r,unifiedCount:i})}return o}function EN(e,t,n){if(!e.isWindowedHighlight||t<=0)return[0,t];let r=[];function i(n){let i=Math.max(0,e.viewportStart-n),a=Math.min(t,e.viewportEnd-n);a>i&&r.push([i,a])}if(n!==`split`&&i(e.unifiedCount),n!==`unified`&&i(e.splitCount),r.length===0)return[0,0];let a=r[0][0],o=r[0][1];for(let e=1;e<r.length;e++){let t=r[e];a=Math.min(a,t[0]),o=Math.max(o,t[1])}return[a,o]}function DN(e,t,n,r,i,a){let[o,s]=EN(e,t,n);o>0&&(e.incrementCounts(o,o),i?.());let c=o;for(;c<t;){if(a?.()===!0)return!0;if(c>=s){e.incrementCounts(t-c,t-c);break}if(e.isInWindow(0,0)){if(r(c)===!0)return!0}else e.incrementCounts(1,1);c++}return!1}function ON(e,t,n){if(!e.isWindowedHighlight)return[[0,n===`unified`?t.deletions+t.additions:Math.max(t.deletions,t.additions)]];let r=n!==`split`,i=n!==`unified`,a=n===`unified`?`unified`:`split`,o=[];function s(t,n){if(t+n<=e.viewportStart||t>=e.viewportEnd)return;let r=Math.max(0,e.viewportStart-t),i=Math.min(n,e.viewportEnd-t);return i>r?[r,i]:void 0}function c(e,n){return a===`split`?e:n===`additions`?[e[0]+t.deletions,e[1]+t.deletions]:e}function l(e,t){if(e==null)return;let[n,r]=c(e,t);r>n&&o.push([n,r])}if(r&&(l(s(e.unifiedCount,t.deletions),`deletions`),l(s(e.unifiedCount+t.deletions,t.additions),`additions`)),i&&(l(s(e.splitCount,t.deletions),`deletions`),l(s(e.splitCount,t.additions),`additions`)),o.length===0)return o;o.sort((e,t)=>e[0]-t[0]);let u=[o[0]];for(let[e,t]of o.slice(1)){let n=u[u.length-1];e<=n[1]?n[1]=Math.max(n[1],t):u.push([e,t])}return u}function kN({hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,diffStyle:i,index:a,unifiedLineIndex:o,splitLineIndex:s,additionLineIndex:c,deletionLineIndex:l,additionLineNumber:u,deletionLineNumber:d,content:f,isLastContent:p,unifiedCount:m,splitCount:h}){let g=a<f.deletions?o+a:void 0,_=i===`unified`?a>=f.deletions?o+a:void 0:a<f.additions?o+f.deletions+a:void 0,v=i===`unified`?s+(a<f.deletions?a:a-f.deletions):s+a,y=a<f.deletions?l+a:void 0,b=a<f.deletions?d+a:void 0,x=i===`unified`?a>=f.deletions?c+(a-f.deletions):void 0:a<f.additions?c+a:void 0,S=i===`unified`?a>=f.deletions?u+(a-f.deletions):void 0:a<f.additions?u+a:void 0,C=i===`unified`?p&&a===f.deletions-1&&t.noEOFCRDeletions:p&&a===h-1&&t.noEOFCRDeletions,ee=i===`unified`?p&&a===m-1&&t.noEOFCRAdditions:p&&a===h-1&&t.noEOFCRAdditions,te=y!=null&&b!=null&&g!=null?{lineNumber:b,lineIndex:y,noEOFCR:C,unifiedLineIndex:g,splitLineIndex:v}:void 0,ne=x!=null&&S!=null&&_!=null?{unifiedLineIndex:_,splitLineIndex:v,lineIndex:x,lineNumber:S,noEOFCR:ee}:void 0;if(te==null&&ne!=null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:void 0,additionLine:ne};if(te!=null&&ne==null)return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:void 0};if(te==null||ne==null)throw Error(`iterateOverDiff: missing change line data`);return{type:`change`,hunkIndex:e,hunk:t,collapsedAfter:n,collapsedBefore:r,deletionLine:te,additionLine:ne}}var AN={forcePlainText:!1};function jN(e,t,n,{forcePlainText:r,startingLine:i,totalLines:a,expandedHunks:o,collapsedContextThreshold:s=1}=AN){r?(i??=0,a??=1/0):(i=0,a=1/0);let c=i>0||a<1/0,l=typeof n.theme==`string`?t.getTheme(n.theme).type:void 0,u=pM({theme:n.theme,highlighter:t}),d=r&&!c&&(e.unifiedLineCount>1e3||e.splitLineCount>1e3)?`none`:n.lineDiffType,f={deletionLines:[],additionLines:[]},{maxLineDiffLength:p}=n,m=!r&&!e.isPartial,h=r?o:void 0,g=new Map;function _(e){let t=m?0:e,n=g.get(t)??NN();return g.set(t,n),n}function v(e,t,n,r){if(c){let e=n.at(-1);(e==null||e.targetIndex+e.count!==t)&&(e={targetIndex:t,originalOffset:r.length,count:0},n.push(e)),e.count++}r.push(e)}CN({diff:e,diffStyle:`both`,startingLine:i,totalLines:a,expandedHunks:!c||h,collapsedContextThreshold:s,callback:({hunkIndex:t,additionLine:n,deletionLine:r,type:i})=>{let a=_(t),o=n==null?r.splitLineIndex:n.splitLineIndex;i===`change`&&n!=null&&r!=null&&MN({additionLine:e.additionLines[n.lineIndex],deletionLine:e.deletionLines[r.lineIndex],deletionLineIndex:a.deletionContent.length,additionLineIndex:a.additionContent.length,deletionDecorations:a.deletionDecorations,additionDecorations:a.additionDecorations,lineDiffType:d,maxLineDiffLength:p}),r!=null&&(v(e.deletionLines[r.lineIndex],r.lineIndex,a.deletionSegments,a.deletionContent),a.deletionInfo.push({type:i===`change`?`change-deletion`:i,lineNumber:r.lineNumber,altLineNumber:i===`change`?void 0:n.lineNumber??void 0,lineIndex:`${r.unifiedLineIndex},${o}`})),n!=null&&(v(e.additionLines[n.lineIndex],n.lineIndex,a.additionSegments,a.additionContent),a.additionInfo.push({type:i===`change`?`change-addition`:i,lineNumber:n.lineNumber,altLineNumber:i===`change`?void 0:r.lineNumber??void 0,lineIndex:`${n.unifiedLineIndex},${o}`}))}});for(let i of g.values()){if(i.deletionContent.length===0&&i.additionContent.length===0)continue;let a={name:e.prevName??e.name,contents:i.deletionContent.value},o={name:e.name,contents:i.additionContent.value},{deletionLines:s,additionLines:c}=PN({deletionFile:a,deletionInfo:i.deletionInfo,deletionDecorations:i.deletionDecorations,additionFile:o,additionInfo:i.additionInfo,additionDecorations:i.additionDecorations,highlighter:t,options:n,languageOverride:r?`text`:e.lang});if(m){f.deletionLines=s,f.additionLines=c;continue}if(i.deletionSegments.length>0)for(let e of i.deletionSegments)for(let t=0;t<e.count;t++)f.deletionLines[e.targetIndex+t]=s[e.originalOffset+t];else f.deletionLines.push(...s);if(i.additionSegments.length>0)for(let e of i.additionSegments)for(let t=0;t<e.count;t++)f.additionLines[e.targetIndex+t]=c[e.originalOffset+t];else f.additionLines.push(...c)}return{code:f,themeStyles:u,baseThemeType:l}}function MN({deletionLine:e,additionLine:t,deletionLineIndex:n,additionLineIndex:r,deletionDecorations:i,additionDecorations:a,lineDiffType:o,maxLineDiffLength:s}){if(e==null||t==null||o===`none`||(e=Ky(e),t=Ky(t),e.length>s||t.length>s))return;let c=o===`char`?Db(e,t):Wb(e,t),l=[],u=[],d=o===`word-alt`,f=c.at(-1);for(let e of c){let t=e===f;!e.added&&!e.removed?(hN({item:e,arr:l,enableJoin:d,isNeutral:!0,isLastItem:t}),hN({item:e,arr:u,enableJoin:d,isNeutral:!0,isLastItem:t})):e.removed?hN({item:e,arr:l,enableJoin:d,isLastItem:t}):hN({item:e,arr:u,enableJoin:d,isLastItem:t})}let p=0;for(let e of l)e[0]===1&&i.push(mN({line:n,spanStart:p,spanLength:e[1].length})),p+=e[1].length;p=0;for(let e of u)e[0]===1&&a.push(mN({line:r,spanStart:p,spanLength:e[1].length})),p+=e[1].length}function NN(){return{deletionContent:{push(e){this.value+=e,this.length++},value:``,length:0},additionContent:{push(e){this.value+=e,this.length++},value:``,length:0},deletionInfo:[],additionInfo:[],deletionDecorations:[],additionDecorations:[],deletionSegments:[],additionSegments:[]}}function PN({deletionFile:e,additionFile:t,deletionInfo:n,additionInfo:r,highlighter:i,deletionDecorations:a,additionDecorations:o,languageOverride:s,options:{theme:c=Ay,...l}}){let u=s??zj(e.name),d=s??zj(t.name),{state:f,transformers:p}=Zj(l.useTokenTransformer),m=typeof c==`string`?{...l,lang:`text`,theme:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:eM(`token`),tokenizeTimeLimit:0}:{...l,lang:`text`,themes:c,transformers:p,decorations:void 0,defaultColor:!1,cssVariablePrefix:eM(`token`),tokenizeTimeLimit:0};return{deletionLines:e.contents===``?[]:(m.lang=u,f.lineInfo=n,m.decorations=a,hM(i.codeToHast(Ky(e.contents),m))),additionLines:t.contents===``?[]:(m.lang=d,m.decorations=o,f.lineInfo=r,hM(i.codeToHast(Ky(t.contents),m)))}}function FN(e,t){let n=nx({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t);return{hunks:n.hunks,splitLineCount:n.splitLineCount,unifiedLineCount:n.unifiedLineCount,additionLines:n.additionLines,deletionLines:n.deletionLines,type:n.type}}function IN(e,t){let n=Math.max(e,1),r=Array.from({length:n},(e,t)=>`${` `.repeat(t+1)}\n`).join(``);return r===t&&(r=Array.from({length:n},(e,t)=>`\u0000${` `.repeat(t)}\n`).join(``)),r}function LN(e){for(let t of e)if(t.trim().length>0)return!1;return!0}function RN(e,t){return t.length>0&&t.length<e.deletionLines.length&&LN(t)}function zN(e,t,n){let r=e.deletionLines.join(``),i=IN(t.length,r),a=nx({name:e.prevName??e.name,contents:r},{name:e.name,contents:i,lang:e.lang},n);return{hunks:a.hunks,splitLineCount:a.splitLineCount,unifiedLineCount:a.unifiedLineCount,additionLines:t,deletionLines:a.deletionLines,type:a.type}}function BN(e,t){return zN(e,[``],t)}function VN(e,t){if(e.additionLines.length===0)return BN(e,t);if(RN(e,e.additionLines))return zN(e,e.additionLines,t);let n=e.additionLines,r=FN(e,t);return UN(r,n),r}function HN(e){return e.length>1&&e.at(-1)===``}function UN(e,t){if(!HN(t))return;let n=t.length-e.additionLines.length;if(n<=0)return;let r=e.additionLines.length,i=e.hunks.at(-1);if(i!=null&&tb(i.additionStart,i.additionCount)===r){for(let a of i.hunkContent)if(a.type===`change`&&a.additions<a.deletions&&a.additionLineIndex+a.additions===r){e.additionLines=t,a.additions+=n,i.additionCount+=n,i.additionLines+=n,$N(e);return}}}function WN(e,t,n){if(e.isPartial||e.deletionLines.length!==e.additionLines.length)return GN(e,FN(e,n));let r=Array.from(t);if(r.length===0)return GN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type});for(let t of r){let r=e.additionLines[t],i=e.deletionLines[t];if(r==null||i==null||Ky(r)===Ky(i))return GN(e,FN(e,n))}let i=KN(e,r);if(i.size===0)return GN(e,FN(e,n));for(let t of i)if(!JN(e,t,n))return GN(e,FN(e,n));return $N(e),vN(e)?GN(e,FN(e,n)):GN(e,{hunks:e.hunks,splitLineCount:e.splitLineCount,unifiedLineCount:e.unifiedLineCount,type:e.type})}function GN(e,t){return Object.assign(e,t),t}function KN(e,t){let n=new Set;for(let r of t){let t=qN(e,r);if(t==null)return new Set;n.add(t)}return n}function qN(e,t){for(let[n,r]of e.hunks.entries()){let e=r.additionLineIndex+r.additionCount;if(t>=r.additionLineIndex&&t<e)return n}}function JN(e,t,n){let r=e.hunks[t];if(r==null)return!1;let i=e.deletionLines.slice(r.deletionLineIndex,r.deletionLineIndex+r.deletionCount),a=e.additionLines.slice(r.additionLineIndex,r.additionLineIndex+r.additionCount),o=nx({name:e.prevName??e.name,contents:i.join(``)},{name:e.name,contents:a.join(``),lang:e.lang},{...n,context:0}),s=o.hunks[0];return s==null||o.hunks.length!==1?!1:(XN(r,s),YN(e,t),!0)}function YN(e,t){let n=e.hunks[t];if(n==null)return;if(t!==e.hunks.length-1){n.noEOFCRAdditions=!1,n.noEOFCRDeletions=!1;return}let r=e.additionLines.at(-1),i=e.deletionLines.at(-1);n.noEOFCRAdditions=r!=null&&r!==``&&!r.endsWith(`
|
|
1525
1525
|
`),n.noEOFCRDeletions=i!=null&&i!==``&&!i.endsWith(`
|
|
1526
|
-
`)}function qN(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>JN(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,YN(e)}function JN(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function YN(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function XN(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(Qy(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,YN(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=$y(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-$y(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var ZN=new WeakMap;function QN(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function $N(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function eP(e,t){let n=e.hunks,r=e.additionLines,i=QN(r),a=i===r?e:{...e,additionLines:i},o=uP(n,lP(a,t),e.deletionLines.length),s=pP(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,CP(e),BN(e,r),gP(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function tP(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<yP(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:yP(r);if(i==null||t<i||o!=null&&o!==s)return eP(e,n);o=s}if(o!=null){if(nP(e,i,o,r,n)){e.editSessionDirty=!0;return}return eP(e,n)}}function nP(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=rP(e),o=e.hunks[n];if(o.hunkContent.some(iP))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function rP(e){let t=ZN.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return ZN.set(e,{lines:e.deletionLines,set:n}),n}function iP(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function aP(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function oP(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=mN({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=bP(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=_N({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=bP(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function sP(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=bP(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,bP(i)+i.deletionCount,e.deletionLines.length),n}function cP(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?MN(e,t):RN(e,t)),!0)}function lP(e,t){if($N(e.deletionLines,e.additionLines)==null)return[];let n=ex({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=JN(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function uP(e,t,n){let r=e.map((e,t)=>{let n=bP(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&dP(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=fP(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function dP(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function fP(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 pP(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);hP(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);hP(s,c,i,r),r+=c,i+=c,n.push(mP(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function mP(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:xP(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:SP(t.additionStart,r),deletionStart:xP(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:SP(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${xP(t.deletionStart,i)},${i} +${xP(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return YN(s),s}function hP(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function gP(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(bP(r)!==bP(i)||r.deletionCount!==i.deletionCount||yP(r)!==yP(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!_P(r,i))return!0}return!1}function _P(e,t){let n=vP(e),r=vP(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*vP(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function yP(e){return Qy(e.additionStart,e.additionCount)}function bP(e){return Qy(e.deletionStart,e.deletionCount)}function xP(e,t){return t===0?e:e+1}function SP(e,t){return t===0?e-1:e}function CP(e){XN(e);for(let t=0;t<e.hunks.length;t++)KN(e,t)}function wP(e){let t=e.lang??Ij(e.name),n=e.lang??(e.prevName==null?`text`:Ij(e.prevName));return t===`text`&&n===`text`}var TP=-1,EP=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++TP}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:Oy},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Tj(e.theme??Oy)?Sj():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,LN(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||wP(e.diff)||VP(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);rN(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Py}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=Wy(l);c&&(i.additionLines[t]=hM(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,LN(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(FN(i,i.additionLines))Object.assign(i,IN(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=tP(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,VN(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=aP(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=RP(e,r),n.code.additionLines=IP(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,LN(t,this.options.parseDiffOptions)),n.code.additionLines[0]=LP(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,RN(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(FN(e,n)){Object.assign(e,IN(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(eP(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Dj(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=Oy,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Ny,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await xj(Lj(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=VP(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!rN(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!wP(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??Ij(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Oy}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!WM(e,n.diff)||!rN(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Fy){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||wP(e)||VP(e,this.getTokenizeMaxLength()),l=!WM(e,this.renderCache.diff),u=!Ej(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&uN(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,uN(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??Ij(e.name);let t=this.highlighter!=null&&Tj(i.theme),n=this.highlighter!=null&&YC(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Fy){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Mj({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=VP(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??Ij(e.name);let n=this.highlighter!=null&&Tj(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&YC(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=ON(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(bN({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=LP(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!rN(this.renderCache.options,n)||!WM(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!rN(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&WM(e,n.diff)&&rN(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=HP(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:ox(),deletionsGutterAST:ox(),additionsGutterAST:ox(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=gN({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,cx(void 0,`buffer`,this.size)),h?.push(iN(this.size))):(x.pushToGutter(`deletions`,cx(void 0,`buffer`,this.size)),g?.push(iN(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,sx(t,n,r,i))};function te(e){C.flush(),a===`unified`?NP(`unified`,e,x):(NP(`deletions`,e,x),NP(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),bN({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&te({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&AP(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});ee(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=PP(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=PP(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),MP({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&AP(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&jP(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=PP(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);ee(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=PP(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);ee(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}MP({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&jP(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),ne=_?n.noEOFCRDeletions:!1,w=_?n.noEOFCRAdditions:!1,re=(s?.noEOFCR??!1)||ne,ie=(o?.noEOFCR??!1)||w;if(ie||re){if(a===`split`&&C.flush(),re){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(aN(e)),x.pushToGutter(`unified`,cx(e,`metadata`,1))):(x.deletionsContentAST.push(aN(e)),x.pushToGutter(`deletions`,cx(e,`metadata`,1)),ie||(x.pushToGutter(`additions`,cx(void 0,`buffer`,1)),x.additionsContentAST.push(iN(1))))}if(ie){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(aN(e)),x.pushToGutter(`unified`,cx(e,`metadata`,1))):(x.additionsContentAST.push(aN(e)),x.pushToGutter(`additions`,cx(e,`metadata`,1)),re||(x.pushToGutter(`deletions`,cx(void 0,`buffer`,1)),x.deletionsContentAST.push(iN(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&te({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let ne=Math.max(lN(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,re=!f&&e.type!==`deleted`,ie=!f&&e.type!==`new`,ae=x.rowCount>0||w;h=re&&ae?h:void 0,g=ie&&ae?g:void 0,_=f&&ae?_:void 0;let oe=this.createPreElement(g!=null&&h!=null,ne);return{unifiedGutterAST:f&&ae?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:ie&&ae?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:re&&ae?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:oe,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:ne,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=ox(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,gM(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(U({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(U({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(U({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return mC(this.renderFullAST(e,t))}renderPartialHTML(e,t){return mC(t==null?e:U({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!mM(n))return;let i=e.type===`new`?[]:DP(pM(this.deletionAnnotations)),a=e.type===`deleted`?[]:DP(pM(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){MP({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}MP({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(Rj(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(Rj(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return kj({fileOrDiff:e,mode:t,stickyHeader:n})}};function DP(e){return e?.map(e=>Rj(e))??[]}var OP=new Intl.PluralRules(`en-US`);function kP(e){return`${e} unmodified line${OP.select(e)===`one`?``:`s`}`}function AP(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function jP(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function MP({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,cx(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,cx(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,cx(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function NP(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,sN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(sN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,sN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(sN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=cN(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?kP(n):`More unchanged context may be available`;c.pushToGutter(e,sN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(sN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function PP(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function FP(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function IP(e,t,n,r){let i=FP(e),a=FP(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=LP(e,r.getLineText(e));return l}function LP(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function RP(e,t){let n=[],r=BP(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!zP(i)?i+r:i)}return n}function zP(e){return e.endsWith(`
|
|
1527
|
-
`)||e.endsWith(`\r`)}function
|
|
1526
|
+
`)}function XN(e,t){let n=e.additionLineIndex,r=e.deletionLineIndex;e.hunkContent=t.hunkContent.map(e=>ZN(e,n,r)),e.additionLineIndex=n+t.additionLineIndex,e.additionStart+=t.additionLineIndex,e.additionCount=t.additionCount,e.additionLines=t.additionLines,t.deletionLineIndex>=0&&(e.deletionLineIndex=r+t.deletionLineIndex,e.deletionStart+=t.deletionLineIndex),e.deletionCount=t.deletionCount,e.deletionLines=t.deletionLines,e.noEOFCRAdditions=t.noEOFCRAdditions,e.noEOFCRDeletions=t.noEOFCRDeletions,QN(e)}function ZN(e,t,n){return{...e,additionLineIndex:e.additionLineIndex+t,deletionLineIndex:e.deletionLineIndex+n}}function QN(e){let t=0,n=0;for(let r of e.hunkContent)r.type===`context`?(t+=r.lines,n+=r.lines):(t+=Math.max(r.additions,r.deletions),n+=r.additions+r.deletions);e.splitLineCount=t,e.unifiedLineCount=n}function $N(e){let t=0,n=0,r=0;for(let i of e.hunks)i.collapsedBefore=Math.max(eb(i.additionStart,i.additionCount)-r,0),i.splitLineStart=t+i.collapsedBefore,i.unifiedLineStart=n+i.collapsedBefore,QN(i),t+=i.collapsedBefore+i.splitLineCount,n+=i.collapsedBefore+i.unifiedLineCount,r=tb(i.additionStart,i.additionCount);if(e.hunks.length>0){let r=e.hunks[e.hunks.length-1],i=Math.max(e.additionLines.length-tb(r.additionStart,r.additionCount),0);t+=i,n+=i}e.splitLineCount=t,e.unifiedLineCount=n}var eP=new WeakMap;function tP(e){return e.length>1&&e[e.length-1]===``?e.slice(0,-1):e}function nP(e,t){let n=Math.min(e.length,t.length),r=0;for(;r<n&&e[r]===t[r];)r++;let i=e.length,a=t.length;for(;i>r&&a>r&&e[i-1]===t[a-1];)i--,a--;if(r!==i||r!==a)return{start:r,deletionEnd:i,additionEnd:a}}function rP(e,t){let n=e.hunks,r=e.additionLines,i=tP(r),a=i===r?e:{...e,additionLines:i},o=pP(n,fP(a,t),e.deletionLines.length),s=gP(a,o);if(e.additionLines=i,e.hunks=s,e.editSessionDirty=!0,EP(e),UN(e,r),yP(n,e.hunks))return{regions:o.map(e=>e.previousSpan)}}function iP(e,t,n,r){let i=Array.from(new Set(t)).filter(t=>t>=0&&t<e.additionLines.length).sort((e,t)=>e-t);if(i.length===0)return;let{hunks:a}=e,o,s=0;for(let t of i){for(;s<a.length;){let e=a[s];if(t<SP(e)+e.additionCount)break;s++}let r=a[s],i=r==null?void 0:SP(r);if(i==null||t<i||o!=null&&o!==s)return rP(e,n);o=s}if(o!=null){if(aP(e,i,o,r,n)){e.editSessionDirty=!0;return}return rP(e,n)}}function aP(e,t,n,r,i){if(r==null||i?.ignoreWhitespace===!0||i?.stripTrailingCr===!0)return!1;let a=oP(e),o=e.hunks[n];if(o.hunkContent.some(sP))return!1;for(let n of t){let t=r.get(n),i=e.additionLines[n];if(t==null||i==null||a.has(t)||a.has(i))return!1;let s=!1;for(let e of o.hunkContent)if(e.type===`change`&&e.additions===e.deletions&&n>=e.additionLineIndex&&n<e.additionLineIndex+e.additions){s=!0;break}if(!s)return!1}return!0}function oP(e){let t=eP.get(e);if(t?.lines===e.deletionLines)return t.set;let n=new Set(e.deletionLines);return eP.set(e,{lines:e.deletionLines,set:n}),n}function sP(e){return e?.type===`change`&&(e.additions===0||e.deletions===0)}function cP(e,t){let n=new Map,{regions:r}=t;for(let t=0;t<=r.length;t++){let i=r[t-1],a=r[t],o=t===0?e.get(0):i==null?void 0:e.get(i.lastIndex+1),s=a==null?void 0:e.get(a.firstIndex),c=o?.fromStart??0,l=s?.fromEnd??0;(c>0||l>0)&&n.set(t,{fromStart:c,fromEnd:l})}return n}function lP(e,t,n){let r=[];if(e.isPartial)return r;for(let[i,a]of e.hunks.entries()){let o=_N({isPartial:e.isPartial,rangeSize:a.collapsedBefore,expandedHunks:t,hunkIndex:i,collapsedContextThreshold:n});if(o.rangeSize<=n)continue;let s=CP(a),c=s-o.rangeSize;o.fromStart>0&&r.push([c,c+o.fromStart]),o.fromEnd>0&&r.push([s-o.fromEnd,s])}let i=bN({fileDiff:e,hunkIndex:e.hunks.length-1,expandedHunks:t,collapsedContextThreshold:n,errorPrefix:`captureExpansionAnchors`});if(i!=null&&i.fromStart>0&&i.rangeSize>n){let t=e.hunks[e.hunks.length-1],n=CP(t)+t.deletionCount;r.push([n,n+i.fromStart])}return r}function uP(e,t){let n=new Map;if(t.length===0)return n;let r=(e,r,i)=>{if(i<=r)return;let a=0,o=0;for(let[e,n]of t)n<=r||e>=i||(e<=r&&(a=Math.max(a,Math.min(n,i)-r)),n>=i&&(o=Math.max(o,i-Math.max(e,r))));(a>0||o>0)&&n.set(e,{fromStart:a,fromEnd:o})};for(let[t,n]of e.hunks.entries()){let e=CP(n);r(t,e-Math.max(n.collapsedBefore,0),e)}let i=e.hunks[e.hunks.length-1];return i!=null&&!e.isPartial&&e.deletionLines.length>0&&r(e.hunks.length,CP(i)+i.deletionCount,e.deletionLines.length),n}function dP(e,t){return e.editSessionDirty===!0&&(e.editSessionDirty=void 0,Object.assign(e,e.additionLines.length<=1&&e.additionLines.join(``)===``?FN(e,t):VN(e,t)),!0)}function fP(e,t){if(nP(e.deletionLines,e.additionLines)==null)return[];let n=nx({name:e.prevName??e.name,contents:e.deletionLines.join(``)},{name:e.name,contents:e.additionLines.join(``),lang:e.lang},t),r=[],i=0,a=0;for(let e of n.hunks){let t=e.additionCount>0?e.additionLineIndex-i:e.deletionLineIndex-a;i+=t,a+=t;for(let t of e.hunkContent){if(t.type===`context`){i+=t.lines,a+=t.lines;continue}let e=ZN(t,0,0);e.additions===0&&(e.additionLineIndex=i),e.deletions===0&&(e.deletionLineIndex=a),r.push(e),i+=e.additions,a+=e.deletions}}return r}function pP(e,t,n){let r=e.map((e,t)=>{let n=CP(e);return{deletionStart:n,deletionEnd:n+e.deletionCount,blocks:[],previousSpan:{firstIndex:t,lastIndex:t}}}),i=[],a=0;for(let e of t){let t=e.deletionLineIndex,o=t+e.deletions;for(;a<r.length&&r[a].deletionEnd<t;)i.push(r[a]),a++;let s=i.length>0&&mP(t,o,i[i.length-1])?i.pop():void 0;for(;a<r.length&&r[a].deletionStart<=o;)s=hP(s,r[a]),a++;if(s==null){let c=t,l=o;if((e.deletions===0||e.additions===0)&&n>e.deletions){let e=i[i.length-1]?.deletionEnd??0,s=r[a]?.deletionStart??n;t>e?c--:o<s&&l++}s={deletionStart:c,deletionEnd:l,blocks:[],previousSpan:void 0}}s.deletionStart=Math.min(s.deletionStart,t),s.deletionEnd=Math.max(s.deletionEnd,o),s.blocks.push(e),i.push(s)}for(;a<r.length;)i.push(r[a]),a++;return i}function mP(e,t,n){return e<=n.deletionEnd&&t>=n.deletionStart}function hP(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 gP(e,t){let n=[],r=0,i=0;for(let a of t){let t=a.deletionStart-r;if(t<0)throw Error(`buildRegionHunks: overlapping old-side regions`);r+=t,i+=t;let o=i,s=[];for(let e of a.blocks){let t=e.deletionLineIndex-r,n=e.additionLineIndex-i;if(t<0||t!==n)throw Error(`buildRegionHunks: canonical block context mismatch`);vP(s,t,i,r),r+=t,i+=n,s.push({...e}),r+=e.deletions,i+=e.additions}let c=a.deletionEnd-r;if(c<0)throw Error(`buildRegionHunks: block exceeds its old-side region`);vP(s,c,i,r),r+=c,i+=c,n.push(_P(e,{additionStart:o,additionEnd:i,deletionStart:a.deletionStart,deletionEnd:a.deletionEnd},s))}if(e.deletionLines.length-r!==e.additionLines.length-i)throw Error(`buildRegionHunks: trailing context mismatch`);return n}function _P(e,t,n){let r=t.additionEnd-t.additionStart,i=t.deletionEnd-t.deletionStart,a=0,o=0;for(let e of n)e.type===`change`&&(a+=e.additions,o+=e.deletions);let s={collapsedBefore:0,additionStart:wP(t.additionStart,r),additionCount:r,additionLines:a,additionLineIndex:TP(t.additionStart,r),deletionStart:wP(t.deletionStart,i),deletionCount:i,deletionLines:o,deletionLineIndex:TP(t.deletionStart,i),hunkContent:n,hunkSpecs:`@@ -${wP(t.deletionStart,i)},${i} +${wP(t.additionStart,r)},${r} @@`,splitLineStart:0,splitLineCount:0,unifiedLineStart:0,unifiedLineCount:0,noEOFCRAdditions:!1,noEOFCRDeletions:!1};return QN(s),s}function vP(e,t,n,r){t>0&&e.push({type:`context`,lines:t,additionLineIndex:n,deletionLineIndex:r})}function yP(e,t){if(e.length!==t.length)return!0;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(CP(r)!==CP(i)||r.deletionCount!==i.deletionCount||SP(r)!==SP(i)||r.additionCount!==i.additionCount||r.splitLineCount!==i.splitLineCount||!bP(r,i))return!0}return!1}function bP(e,t){let n=xP(e),r=xP(t);for(;;){let e=n.next(),t=r.next();if(e.done===!0||t.done===!0)return e.done===t.done;if(e.value[0]!==t.value[0]||e.value[1]!==t.value[1])return!1}}function*xP(e){for(let t of e.hunkContent){if(t.type===`context`){for(let e=0;e<t.lines;e++)yield[t.deletionLineIndex+e,t.additionLineIndex+e];continue}let e=Math.max(t.deletions,t.additions);for(let n=0;n<e;n++)yield[n<t.deletions?t.deletionLineIndex+n:void 0,n<t.additions?t.additionLineIndex+n:void 0]}}function SP(e){return eb(e.additionStart,e.additionCount)}function CP(e){return eb(e.deletionStart,e.deletionCount)}function wP(e,t){return t===0?e:e+1}function TP(e,t){return t===0?e-1:e}function EP(e){$N(e);for(let t=0;t<e.hunks.length;t++)YN(e,t)}function DP(e){let t=e.lang??zj(e.name),n=e.lang??(e.prevName==null?`text`:zj(e.prevName));return t===`text`&&n===`text`}var OP=-1,kP=class{options;onRenderUpdate;workerManager;__id=`diff-hunks-renderer:${++OP}`;highlighter;diff;expandedHunks=new Map;deletionAnnotations={};additionAnnotations={};computedLang=`text`;renderCache;editSessionActive=!1;constructor(e={theme:Ay},t,n){this.options=e,this.onRenderUpdate=t,this.workerManager=n,n?.isWorkingPool()!==!0&&(this.highlighter=Oj(e.theme??Ay)?Tj():void 0)}cleanUp(){this.recycle(),this.expandedHunks.clear(),this.workerManager=void 0,this.onRenderUpdate=void 0}recycle(){this.highlighter=void 0,this.diff=void 0,this.clearRenderCache(),this.additionAnnotations={},this.deletionAnnotations={},this.workerManager?.cleanUpTasks(this),this.endEditSession()}beginEditSession(){this.editSessionActive=!0;let e=this.diffCache;e!=null&&!e.isPartial&&e.additionLines.length===0&&(Object.assign(e,BN(e,this.options.parseDiffOptions)),this.markEditSessionPass(e),this.clearRenderCache())}endEditSession(){this.editSessionActive=!1}editorRenderReady(){return this.renderCache?.options.useTokenTransformer===!0&&this.renderCache.highlighted&&this.renderCache.result!=null}refreshHighlightedResult(){let{renderCache:e}=this;if(e==null||DP(e.diff)||WP(e.diff,this.getTokenizeMaxLength()))return Promise.resolve();let{diff:t}=e,{workerManager:n}=this;return!this.editSessionActive&&n?.isWorkingPool()===!0&&t.cacheKey!=null?(n.evictDiffFromCache(t.cacheKey),n.primeDiffHighlightCache(t).then(()=>{this.applyRefreshedResult(t,n.getDiffResultCache(t))}).catch(e=>this.onHighlightError(e))):this.asyncHighlight(t).then(e=>this.applyRefreshedResult(t,e)).catch(e=>this.onHighlightError(e))}applyRefreshedResult(e,t){if(t==null||this.renderCache==null||this.renderCache.diff!==e||this.editSessionActive)return;let{options:n}=this.getRenderOptions(e);oN(n,t.options)&&(this.renderCache={diff:e,options:t.options,highlighted:!0,result:t.result,renderRange:void 0},this.onRenderUpdate?.())}get diffCache(){return this.renderCache?.diff??this.diff}clearRenderCache(){let e=this.renderCache;this.renderCache=void 0,e!=null&&e.isDirty===!0&&e.diff.cacheKey!=null&&this.workerManager?.evictDiffFromCache(e.diff.cacheKey)}setOptions(e){this.options=e}mergeOptions(e){this.options={...this.options,...e}}expandHunk(e,t,n=this.getOptionsWithDefaults().expansionLineCount){let r={...this.expandedHunks.get(e)??{fromStart:0,fromEnd:0}};(t===`up`||t===`both`)&&(r.fromStart+=n),(t===`down`||t===`both`)&&(r.fromEnd+=n),this.renderCache?.highlighted!==!0&&this.clearRenderCache(),this.expandedHunks.set(e,r)}getExpandedHunk(e){return this.expandedHunks.get(e)??Iy}getExpandedHunksMap(){return this.expandedHunks}setExpandedHunksMap(e){this.expandedHunks=e}setLineAnnotations(e){this.additionAnnotations={},this.deletionAnnotations={};for(let t of e){let e=(()=>{switch(t.side){case`deletions`:return this.deletionAnnotations;case`additions`:return this.additionAnnotations}})(),n=e[t.lineNumber]??[];e[t.lineNumber]=n,n.push(t)}}updateRenderCache(e,t,n=!1){if(this.renderCache==null)return!1;let{result:r,diff:i}=this.renderCache;if(r==null)return!1;if(i.isPartial)throw Error(`Could not update render cache for partial diff`);let a=r.code.additionLines,o=[],s=new Map;for(let[t,n]of e){let e=a[t]?.properties??{},r=n.map(e=>e[2]).join(``),c=t<i.additionLines.length,l=c?i.additionLines[t]??``:``,u=Ky(l);c&&(i.additionLines[t]=vM(l,r),u!==r&&(o.push(t),s.set(t,l))),a[t]={type:`element`,tagName:`div`,properties:{"data-line":e[`data-line`]??t+1,"data-line-index":e[`data-line-index`]??t,"data-line-type":e[`data-line-type`]??`context`},children:n.map(([e,t,n])=>e===0&&t===``?n===``?{type:`element`,tagName:`br`,properties:{},children:[]}:{type:`text`,value:n}:{type:`element`,tagName:`span`,properties:{"data-char":e,style:`color:${t};`},children:[{type:`text`,value:n}]})}}let c=!1;if(o.length>0){if(this.editSessionActive&&!i.isPartial){if(!n){if(i.additionLines.length<=1&&i.additionLines.join(``)===``)Object.assign(i,BN(i,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else if(RN(i,i.additionLines))Object.assign(i,zN(i,i.additionLines,this.options.parseDiffOptions)),this.markEditSessionPass(i),c=!0;else{let e=iP(i,o,this.options.parseDiffOptions,s);this.applyExpansionRemap(e),c=e!=null}}}else Object.assign(i,WN(i,o,this.options.parseDiffOptions))}return r.baseThemeType=t,this.renderCache.isDirty=!0,c}applyExpansionRemap(e){e!=null&&(this.expandedHunks=cP(this.expandedHunks,e))}applyDocumentChange(e){if(this.renderCache==null)return;let{diff:t,result:n}=this.renderCache;if(n==null)return;if(t.isPartial)throw Error(`Could not apply document change for partial diff`);let{additionLines:r}=t;t.additionLines=VP(e,r),n.code.additionLines=zP(r,t.additionLines,n.code.additionLines,e),t.additionLines.length<=1&&t.additionLines.join(``)===``?(Object.assign(t,BN(t,this.options.parseDiffOptions)),n.code.additionLines[0]=BP(0,e.getLineText(0)),this.markEditSessionPass(t)):this.editSessionActive?this.applySessionDocumentChange(t):Object.assign(t,VN(t,this.options.parseDiffOptions)),this.renderCache.isDirty=!0}applySessionDocumentChange(e){let{parseDiffOptions:t}=this.options,n=e.additionLines;if(RN(e,n)){Object.assign(e,zN(e,n,t)),this.markEditSessionPass(e);return}this.applyExpansionRemap(rP(e,t))}markEditSessionPass(e){this.editSessionActive&&(e.editSessionDirty=!0)}getUnifiedLineDecoration({lineType:e}){return{gutterLineType:e,contentProperties:{"data-line-type":e}}}getSplitLineDecoration({side:e,type:t}){let n=t===`change`?e===`deletions`?`change-deletion`:`change-addition`:t;return{gutterLineType:n,contentProperties:{"data-line-type":n}}}createAnnotationElement=e=>Aj(e);getOptionsWithDefaults(){let{diffIndicators:e=`bars`,diffStyle:t=`split`,disableBackground:n=!1,disableFileHeader:r=!1,disableLineNumbers:i=!1,disableVirtualizationBuffers:a=!1,collapsed:o=!1,expandUnchanged:s=!1,collapsedContextThreshold:c=1,expansionLineCount:l=100,hunkSeparators:u=`line-info`,lineDiffType:d=`word-alt`,maxLineDiffLength:f=1e3,overflow:p=`scroll`,stickyHeader:m=!1,theme:h=Ay,headerRenderMode:g=`default`,tokenizeMaxLineLength:_=1e3,tokenizeMaxLength:v=Fy,useTokenTransformer:y=!1,useCSSClasses:b=!1}=this.options;return{diffIndicators:e,diffStyle:t,disableBackground:n,disableFileHeader:r,disableLineNumbers:i,disableVirtualizationBuffers:a,collapsed:o,expandUnchanged:s,collapsedContextThreshold:c,expansionLineCount:l,hunkSeparators:u,lineDiffType:d,maxLineDiffLength:f,overflow:p,stickyHeader:m,theme:this.workerManager?.getDiffRenderOptions().theme??h,headerRenderMode:g,tokenizeMaxLineLength:_,tokenizeMaxLength:v,useTokenTransformer:y,useCSSClasses:b}}async initializeHighlighter(){return this.highlighter=await wj(Bj(this.computedLang,{theme:this.getLocalHighlightTheme(),preferredHighlighter:this.workerManager?.getPreferredHighlighter()??this.options.preferredHighlighter})),this.highlighter}hydrate(e){if(e==null)return;this.diff=e;let{options:t}=this.getRenderOptions(e),n=WP(e,this.getTokenizeMaxLength()),r=this.workerManager?.getDiffResultCache(e);r!=null&&!oN(t,r.options)&&(r=void 0),this.renderCache??={diff:e,highlighted:!n&&!DP(e),options:t,result:n?void 0:r?.result,renderRange:void 0},!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0?this.renderCache.result==null&&!n&&this.workerManager.highlightDiffAST(this,this.diff):this.highlighter??(this.computedLang=e.lang??zj(e.name),this.initializeHighlighter())}getLocalHighlightTheme(){return this.workerManager?.getDiffRenderOptions().theme??this.options.theme??Ay}getEffectiveCodeOptions(){let e=this.workerManager?.isWorkingPool()===!0?this.workerManager.getDiffRenderOptions():void 0;return{theme:this.getLocalHighlightTheme(),tokenizeMaxLineLength:e?.tokenizeMaxLineLength??this.options.tokenizeMaxLineLength}}getRenderOptions(e){let t=(()=>{if(this.workerManager?.isWorkingPool()===!0){let e=this.workerManager.getDiffRenderOptions();return this.editSessionActive&&e.useTokenTransformer!==!0?{...e,useTokenTransformer:!0}:e}let{theme:e,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}=this.getOptionsWithDefaults();return{theme:e,useTokenTransformer:this.editSessionActive||this.options.useTokenTransformer===!0,tokenizeMaxLineLength:t,lineDiffType:n,maxLineDiffLength:r}})();this.getOptionsWithDefaults();let{renderCache:n}=this;return n?.result==null||!qM(e,n.diff)||!oN(t,n.options)?{options:t,forceHighlight:!0}:{options:t,forceHighlight:!1}}renderDiff(e=this.renderCache?.diff,t=Ly){if(e==null)return;let{expandUnchanged:n,collapsedContextThreshold:r}=this.getOptionsWithDefaults(),{options:i,forceHighlight:a}=this.getRenderOptions(e),o=this.getMatchingWorkerResultCache(e,i);o!=null&&!this.hasHighlightedRenderCache(e,i)&&(this.renderCache={diff:e,highlighted:!0,renderRange:void 0,...o},a=!1),this.renderCache??={diff:e,highlighted:!1,options:i,result:void 0,renderRange:void 0};let s=e.additionLines.length>0||e.deletionLines.length>0,c=!s||DP(e)||WP(e,this.getTokenizeMaxLength()),l=!qM(e,this.renderCache.diff),u=!kj(this.renderCache.renderRange,t);if(!this.editSessionActive&&this.workerManager?.isWorkingPool()===!0){let o=this.renderCache.result==null&&this.renderCache.highlighted&&!c&&!l&&pN(t);o&&(this.renderCache.highlightPending=!0),!o&&(c||this.renderCache.result==null||!this.renderCache.highlighted&&(l||u))&&(this.renderCache.diff=e,this.renderCache.options=i,this.renderCache.highlighted=!1,(this.renderCache.result==null||l||u||a)&&(this.renderCache.result=this.workerManager.getPlainDiffAST(e,t.startingLine,t.totalLines,pN(t)||n?!0:this.expandedHunks,r)),this.renderCache.renderRange=t),!c&&s&&(!this.renderCache.highlighted||a)&&this.workerManager.highlightDiffAST(this,e)}else{this.computedLang=e.lang??zj(e.name);let t=this.highlighter!=null&&Oj(i.theme),n=this.highlighter!=null&&ZC(this.computedLang),r=!c&&n;if(this.highlighter!=null&&t&&(a||c||!this.renderCache.highlighted&&r||this.renderCache.result==null)){let{result:t,options:i}=this.renderDiffWithHighlighter(e,this.highlighter,c||!n);this.renderCache={diff:e,options:i,highlighted:r,result:t,renderRange:void 0}}(!t||!c&&!n)&&this.asyncHighlight(e).then(({result:t,options:n})=>{this.renderCache!=null&&(this.renderCache.highlighted=!1),this.applyHighlightResult(e,t,n,!c)})}return this.renderCache.result==null?void 0:this.processDiffResult(this.renderCache.diff,t,this.renderCache.result)}async asyncRender(e,t=Ly){let{result:n}=await this.asyncHighlight(e);return this.processDiffResult(e,t,n)}createPreElement(e,t,n){let{diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o}=this.getOptionsWithDefaults();return Fj({type:`diff`,diffIndicators:r,disableBackground:i,disableLineNumbers:a,overflow:o,split:e,totalLines:t,customProperties:n})}async asyncHighlight(e){let t=WP(e,this.getTokenizeMaxLength());this.computedLang=t?`text`:e.lang??zj(e.name);let n=this.highlighter!=null&&Oj(this.getLocalHighlightTheme()),r=t||this.highlighter!=null&&ZC(this.computedLang);return(this.highlighter==null||!n||!r)&&(this.highlighter=await this.initializeHighlighter()),this.renderDiffWithHighlighter(e,this.highlighter,t)}renderDiffWithHighlighter(e,t,n=!1){let{options:r}=this.getRenderOptions(e),{collapsedContextThreshold:i}=this.getOptionsWithDefaults(),a=jN(e,t,r,{forcePlainText:n,expandedHunks:n?!0:void 0,collapsedContextThreshold:i});if(this.editSessionActive&&e.additionLines.length===1&&e.additionLines[0]===``&&a.code.additionLines[0]==null){let t;if(CN({diff:e,diffStyle:`both`,expandedHunks:n?!0:void 0,collapsedContextThreshold:i,callback:({additionLine:e})=>{if(e?.lineIndex===0)return t=e,!0}}),t==null)throw Error(`DiffHunksRenderer: missing empty addition line`);a.code.additionLines[0]=BP(0,``,t.unifiedLineIndex,t.splitLineIndex)}return{result:a,options:r}}onHighlightSuccess(e,t,n,r=!0){this.editSessionActive||this.applyHighlightResult(e,t,n,r)}applyHighlightResult(e,t,n,r=!0){if(this.renderCache==null)return;let i=this.renderCache.highlightPending===!0||!this.renderCache.highlighted||!oN(this.renderCache.options,n)||!qM(this.renderCache.diff,e);this.renderCache={diff:e,options:n,highlighted:r,result:t,renderRange:void 0},i&&this.onRenderUpdate?.()}getMatchingWorkerResultCache(e,t){if(this.editSessionActive)return;let n=this.workerManager?.getDiffResultCache(e);if(!(n==null||!oN(t,n.options)))return n}hasHighlightedRenderCache(e,t){let{renderCache:n}=this;return n?.result!=null&&n.highlighted&&qM(e,n.diff)&&oN(t,n.options)}onHighlightError(e){console.error(e)}getTokenizeMaxLength(){return this.options.tokenizeMaxLength??1e5}processDiffResult(e,t,{code:n,themeStyles:r,baseThemeType:i}){let{diffStyle:a,disableFileHeader:o,expandUnchanged:s,expansionLineCount:c,collapsedContextThreshold:l,hunkSeparators:u}=this.getOptionsWithDefaults(),d=this.renderCache?.isDirty??!1;this.diff=e;let f=a===`unified`,p=GP(e,this.options.loadDiffFiles!=null),m=!e.isPartial||p,h=[],g=[],_=[],v=[],{additionLines:y,deletionLines:b}=n,x={rowCount:0,hunkSeparators:u,additionsContentAST:h,deletionsContentAST:g,unifiedContentAST:_,unifiedGutterAST:cx(),deletionsGutterAST:cx(),additionsGutterAST:cx(),expansionLineCount:c,hunkData:v,incrementRowCount(e=1){x.rowCount+=e},pushToGutter(e,t){switch(e){case`unified`:x.unifiedGutterAST.children.push(t);break;case`deletions`:x.deletionsGutterAST.children.push(t);break;case`additions`:x.additionsGutterAST.children.push(t)}}},S=yN({fileDiff:e,errorPrefix:`DiffHunksRenderer.processDiffResult`}),C={size:0,side:void 0,increment(){this.size+=1},flush(){if(a!==`unified`){if(this.size<=0||this.side==null){this.side=void 0,this.size=0;return}this.side===`additions`?(x.pushToGutter(`additions`,ux(void 0,`buffer`,this.size)),h?.push(sN(this.size))):(x.pushToGutter(`deletions`,ux(void 0,`buffer`,this.size)),g?.push(sN(this.size))),this.size=0,this.side=void 0}}},ee=(e,t,n,r,i)=>{x.pushToGutter(e,lx(t,n,r,i))};function te(e){C.flush(),a===`unified`?IP(`unified`,e,x):(IP(`deletions`,e,x),IP(`additions`,e,x))}this.pushFileLevelAnnotations(e,a,t,x),CN({diff:e,diffStyle:a,startingLine:t.startingLine,totalLines:t.totalLines,expandedHunks:s?!0:this.expandedHunks,collapsedContextThreshold:l,callback:({hunkIndex:t,hunk:n,collapsedBefore:r,collapsedAfter:i,additionLine:o,deletionLine:s,type:c})=>{let l=s==null?o.splitLineIndex:s.splitLineIndex,f=o==null?s.unifiedLineIndex:o.unifiedLineIndex;a===`split`&&c!==`change`&&C.flush(),r>0&&te({hunkIndex:t,collapsedLines:r,rangeSize:Math.max(n?.collapsedBefore??0,0),hunkSpecs:n?.hunkSpecs,isFirstHunk:t===0,isLastHunk:!1,isExpandable:m});let h=a===`unified`?f:l,g={type:c,hunkIndex:t,lineIndex:h,unifiedLineIndex:f,splitLineIndex:l,deletionLine:s,additionLine:o};if(a===`unified`){let n=this.getUnifiedInjectedRowsForLine?.(g);n?.before!=null&&NP(n.before,x);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex];if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let a=c===`change`?o==null?`change-deletion`:`change-addition`:c,u=this.getUnifiedLineDecoration({type:c,lineType:a,additionLineIndex:o?.lineIndex,deletionLineIndex:s?.lineIndex});ee(`unified`,u.gutterLineType,o==null?s.lineNumber:o.lineNumber,`${f},${l}`,u.gutterProperties),i==null?r!=null&&(r=LP(r,u.contentProperties,d&&s!=null?{"data-line":s.lineNumber,"data-line-index":`${f},${l}`}:void 0)):i=LP(i,u.contentProperties,d&&o!=null?{"data-line":o.lineNumber,"data-line-index":`${f},${l}`}:void 0),FP({diffStyle:`unified`,type:c,deletionLine:r,additionLine:i,unifiedSpan:this.getAnnotations(`unified`,s?.lineNumber,o?.lineNumber,t,h),createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&NP(n.after,x)}else{let n=this.getSplitInjectedRowsForLine?.(g);n?.before!=null&&PP(n.before,x,C);let r=s==null?void 0:b[s.lineIndex],i=o==null?void 0:y[o.lineIndex],a=this.getSplitLineDecoration({side:`deletions`,type:c,lineIndex:s?.lineIndex}),u=this.getSplitLineDecoration({side:`additions`,type:c,lineIndex:o?.lineIndex});if(r==null&&i==null){let t=`DiffHunksRenderer.processDiffResult: deletionLine and additionLine are null, something is wrong`;throw console.error(t,{file:e.name}),Error(t)}let f=(()=>{if(c===`change`){if(i==null)return`additions`;if(r==null)return`deletions`}})();f==null?c===`change`&&C.flush():(C.side!=null&&C.side!==f&&C.flush(),C.side=f,C.increment());let p=this.getAnnotations(`split`,s?.lineNumber,o?.lineNumber,t,h);if(p!=null&&C.size>0&&C.flush(),s!=null){let e=LP(r,a.contentProperties,d?{"data-line":s.lineNumber,"data-line-index":`${s.unifiedLineIndex},${l}`}:void 0);ee(`deletions`,a.gutterLineType,s.lineNumber,`${s.unifiedLineIndex},${l}`,a.gutterProperties),e!=null&&(r=e)}if(o!=null){let e=LP(i,u.contentProperties,d?{"data-line":o.lineNumber,"data-line-index":`${o.unifiedLineIndex},${l}`}:void 0);ee(`additions`,u.gutterLineType,o.lineNumber,`${o.unifiedLineIndex},${l}`,u.gutterProperties),e!=null&&(i=e)}FP({diffStyle:`split`,type:c,additionLine:i,deletionLine:r,...p,createAnnotationElement:e=>this.createAnnotationElement(e),context:x}),n?.after!=null&&PP(n.after,x,C)}let _=a===`split`&&n!=null&&l===n.splitLineStart+n.splitLineCount-1,v=t===e.hunks.length-1&&n!=null&&(a===`split`?l===n.splitLineStart+n.splitLineCount-1:f===n.unifiedLineStart+n.unifiedLineCount-1),ne=_?n.noEOFCRDeletions:!1,w=_?n.noEOFCRAdditions:!1,re=(s?.noEOFCR??!1)||ne,ie=(o?.noEOFCR??!1)||w;if(ie||re){if(a===`split`&&C.flush(),re){let e=c===`context`||c===`context-expanded`?c:`change-deletion`;a===`unified`?(x.unifiedContentAST.push(cN(e)),x.pushToGutter(`unified`,ux(e,`metadata`,1))):(x.deletionsContentAST.push(cN(e)),x.pushToGutter(`deletions`,ux(e,`metadata`,1)),ie||(x.pushToGutter(`additions`,ux(void 0,`buffer`,1)),x.additionsContentAST.push(sN(1))))}if(ie){let e=c===`context`||c===`context-expanded`?c:`change-addition`;a===`unified`?(x.unifiedContentAST.push(cN(e)),x.pushToGutter(`unified`,ux(e,`metadata`,1))):(x.additionsContentAST.push(cN(e)),x.pushToGutter(`additions`,ux(e,`metadata`,1)),re||(x.pushToGutter(`deletions`,ux(void 0,`buffer`,1)),x.deletionsContentAST.push(sN(1))))}x.incrementRowCount(1)}u!==`simple`&&u!==`metadata`&&(i>0||v&&p)&&te({hunkIndex:c===`context-expanded`?t:t+1,collapsedLines:v&&p?`unknown`:i,rangeSize:S,hunkSpecs:void 0,isFirstHunk:!1,isLastHunk:!0,isExpandable:m}),x.incrementRowCount(1)}}),a===`split`&&C.flush();let ne=Math.max(fN(e.hunks),e.additionLines.length??0,e.deletionLines.length??0),w=t.bufferBefore>0||t.bufferAfter>0,re=!f&&e.type!==`deleted`,ie=!f&&e.type!==`new`,ae=x.rowCount>0||w;h=re&&ae?h:void 0,g=ie&&ae?g:void 0,_=f&&ae?_:void 0;let oe=this.createPreElement(g!=null&&h!=null,ne);return{unifiedGutterAST:f&&ae?x.unifiedGutterAST.children:void 0,unifiedContentAST:_,deletionsGutterAST:ie&&ae?x.deletionsGutterAST.children:void 0,deletionsContentAST:g,additionsGutterAST:re&&ae?x.additionsGutterAST.children:void 0,additionsContentAST:h,hunkData:v,preNode:oe,themeStyles:r,baseThemeType:i,headerElement:o?void 0:this.renderHeader(this.diff),totalLines:ne,rowCount:x.rowCount,bufferBefore:t.bufferBefore,bufferAfter:t.bufferAfter,css:``}}renderCodeAST(e,t){let n=e===`unified`?t.unifiedGutterAST:e===`deletions`?t.deletionsGutterAST:t.additionsGutterAST,r=e===`unified`?t.unifiedContentAST:e===`deletions`?t.deletionsContentAST:t.additionsContentAST;if(n==null||r==null)return;let i=cx(n);return i.properties.style=`grid-row: span ${t.rowCount}`,[i,yM(r,t.rowCount)]}renderFullAST(e,t=[]){let n=this.getOptionsWithDefaults().hunkSeparators===`line-info`,r=this.renderCodeAST(`unified`,e);if(r!=null)return t.push(U({tagName:`code`,children:r,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-unified":``}})),{...e.preNode,children:t};let i=this.renderCodeAST(`deletions`,e);i!=null&&t.push(U({tagName:`code`,children:i,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-deletions":``}}));let a=this.renderCodeAST(`additions`,e);return a!=null&&t.push(U({tagName:`code`,children:a,properties:{"data-code":``,"data-container-size":n?``:void 0,"data-additions":``}})),{...e.preNode,children:t}}renderFullHTML(e,t=[]){return gC(this.renderFullAST(e,t))}renderPartialHTML(e,t){return gC(t==null?e:U({tagName:`code`,children:e,properties:{"data-code":``,"data-container-size":this.getOptionsWithDefaults().hunkSeparators===`line-info`?``:void 0,[`data-${t}`]:``}}))}pushFileLevelAnnotations(e,t,n,r){if(!_M(n))return;let i=e.type===`new`?[]:AP(gM(this.deletionAnnotations)),a=e.type===`deleted`?[]:AP(gM(this.additionAnnotations));if(i.length===0&&a.length===0)return;let{createAnnotationElement:o}=this;if(t===`unified`){FP({diffStyle:t,type:`context`,unifiedSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i.concat(a)},createAnnotationElement:o,context:r});return}FP({diffStyle:t,type:`context`,deletionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:i},additionSpan:{type:`annotation`,hunkIndex:-1,lineIndex:-1,annotations:a},createAnnotationElement:o,context:r})}getAnnotations(e,t,n,r,i){let a={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(t!=null)for(let e of this.deletionAnnotations[t]??[])a.annotations.push(Vj(e));let o={type:`annotation`,hunkIndex:r,lineIndex:i,annotations:[]};if(n!=null)for(let t of this.additionAnnotations[n]??[])(e===`unified`?a:o).annotations.push(Vj(t));if(e===`unified`)return a.annotations.length>0?a:void 0;if(o.annotations.length!==0||a.annotations.length!==0)return{deletionSpan:a,additionSpan:o}}renderHeader(e){let{headerRenderMode:t,stickyHeader:n}=this.getOptionsWithDefaults();return Mj({fileOrDiff:e,mode:t,stickyHeader:n})}};function AP(e){return e?.map(e=>Vj(e))??[]}var jP=new Intl.PluralRules(`en-US`);function MP(e){return`${e} unmodified line${jP.select(e)===`one`?``:`s`}`}function NP(e,t){for(let n of e)t.unifiedContentAST.push(n.content),t.pushToGutter(`unified`,n.gutter),t.incrementRowCount(1)}function PP(e,t,n){for(let{deletion:r,addition:i}of e){if(r==null&&i==null)continue;let e=r!=null&&i!=null?void 0:r==null?`deletions`:`additions`;(e==null||n.side!==e)&&n.flush(),r!=null&&(t.deletionsContentAST.push(r.content),t.pushToGutter(`deletions`,r.gutter)),i!=null&&(t.additionsContentAST.push(i.content),t.pushToGutter(`additions`,i.gutter)),e!=null&&(n.side=e,n.increment()),t.incrementRowCount(1)}}function FP({diffStyle:e,type:t,deletionLine:n,additionLine:r,unifiedSpan:i,deletionSpan:a,additionSpan:o,createAnnotationElement:s,context:c}){let l=!1;if(e===`unified`){if(r==null?n!=null&&c.unifiedContentAST.push(n):c.unifiedContentAST.push(r),i!=null){let e=t===`change`?n==null?`change-addition`:`change-deletion`:t;c.unifiedContentAST.push(s(i)),c.pushToGutter(`unified`,ux(e,`annotation`,1)),l=!0}}else if(e===`split`){if(n!=null&&c.deletionsContentAST.push(n),r!=null&&c.additionsContentAST.push(r),a!=null){let e=t===`change`?n==null?`context`:`change-deletion`:t;c.deletionsContentAST.push(s(a)),c.pushToGutter(`deletions`,ux(e,`annotation`,1)),l=!0}if(o!=null){let e=t===`change`?r==null?`context`:`change-addition`:t;c.additionsContentAST.push(s(o)),c.pushToGutter(`additions`,ux(e,`annotation`,1)),l=!0}}l&&c.incrementRowCount(1)}function IP(e,{hunkIndex:t,collapsedLines:n,rangeSize:r,hunkSpecs:i,isFirstHunk:a,isLastHunk:o,isExpandable:s},c){if(typeof n==`number`&&n<=0)return;let l=e===`unified`?c.unifiedContentAST:e===`deletions`?c.deletionsContentAST:c.additionsContentAST;if(c.hunkSeparators===`metadata`){i!=null&&(c.pushToGutter(e,uN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),l.push(uN({type:`metadata`,content:i,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1));return}if(c.hunkSeparators===`simple`){t>0&&(c.pushToGutter(e,uN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),l.push(uN({type:`simple`,isFirstHunk:a,isLastHunk:!1})),e!==`additions`&&c.incrementRowCount(1));return}let u=dN(e,t),d=r>c.expansionLineCount,f=s?t:void 0,p=typeof n==`number`?MP(n):`More unchanged context may be available`;c.pushToGutter(e,uN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),l.push(uN({type:c.hunkSeparators,content:p,expandIndex:f,chunked:d,slotName:u,isFirstHunk:a,isLastHunk:o})),e!==`additions`&&c.incrementRowCount(1),c.hunkData.push({slotName:u,hunkIndex:t,lines:typeof n==`number`?n:0,lineCountKnown:typeof n==`number`,type:e,expandable:s?{up:!a,down:!o,chunked:d}:void 0})}function LP(e,t,n){return e==null||e.type!==`element`||t==null&&n==null?e:{...e,properties:{...e.properties,...t,...n}}}function RP(e){return e.length>0&&e[e.length-1]===``?e.length-1:e.length}function zP(e,t,n,r){let i=RP(e),a=RP(t),o=Math.min(i,a),s=0;for(;s<o&&e[s]===t[s];)s++;let c=0;for(;c<o-s&&e[i-1-c]===t[a-1-c];)c++;let l=Array(t.length);for(let e=0;e<s;e++)l[e]=n[e];for(let e=0;e<c;e++)l[a-1-e]=n[i-1-e];i<e.length&&a<t.length&&(l[t.length-1]=n[e.length-1]);for(let r=e.length;r<t.length;r++)l[r]??=n[r];for(let e=s;e<t.length;e++)l[e]??=BP(e,r.getLineText(e));return l}function BP(e,t,n=e,r=e){return{type:`element`,tagName:`div`,properties:{"data-line":e+1,"data-line-index":`${n},${r}`,"data-line-type":`context`},children:[{type:`element`,tagName:`span`,properties:{"data-char":0},children:[{type:`text`,value:t}]}]}}function VP(e,t){let n=[],r=UP(t);for(let t=0;t<e.lineCount;t++){let i=e.getLineText(t,!0);n.push(t<e.lineCount-1&&!HP(i)?i+r:i)}return n}function HP(e){return e.endsWith(`
|
|
1527
|
+
`)||e.endsWith(`\r`)}function UP(e){for(let t of e){if(t.endsWith(`\r
|
|
1528
1528
|
`))return`\r
|
|
1529
1529
|
`;if(t.endsWith(`
|
|
1530
1530
|
`))return`
|
|
1531
1531
|
`;if(t.endsWith(`\r`))return`\r`}return`
|
|
1532
|
-
`}function VP(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function HP(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function UP(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function WP(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 GP(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function KP({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function qP(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:RM(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?`default`:`custom`}}function JP(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var YP=-1,XP=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++YP}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Oy},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new LC,this.scrollSyncManager=new nN,this.interactionManager=new _C(`diff`,vC(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}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return qP(e)}createHunksRenderer(e){return new EP(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=Qy(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(vC(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;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Hy(this.appliedThemeCSS.theme,this.options.theme??Oy)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||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(){let{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}let{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`||e===`scroll`&&(this.lineAnnotations.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){By(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(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,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.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.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:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=KP(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),eF(this.pre,QP({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||tF(this.headerElement,$P({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),FM(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.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:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?ex(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!JP(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(qM(`merge`,e,t),this.setHydratedState(t),await GP(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}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:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=KP(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!ZP(u,this.deletionFile)||!ZP(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&Ej(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=ex(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(cP(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:ee=!1}=this.options;if(ee&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Iy);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||uN(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return bN({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=oP(e,this.hunksRenderer.getExpandedHunksMap(),t);return cP(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(sP(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){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))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return vN({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return yN({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=pN(o);if(e<s){let c=mN({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=_N({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=pN(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){zy(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};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(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{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){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||wP(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!WP(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Rj(r)}`,a=this.annotationCache.get(i);if(a==null||!UP(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:xM(Rj(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=SM();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:LM(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):LM(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=_M;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let 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(let 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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??mC(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,Dy,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,wy,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Ty,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Ey,u),this.headerCustom?.remove(),this.headerCustom=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,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{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??=CM(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=AM(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Oy,s=typeof o==`string`?o:{...o},c=EM(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=BM({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:jM(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=MM(this.themeCSSStyle.textContent??``,EM(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&UM()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?zM(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=nF(t[0]),a=nF(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=mC(i),r.content.innerHTML=mC(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=PM({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=PM({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=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=PM({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=nF(r?.[0]),a=nF(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=nF(n?.[0]),i=nF(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=mC(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?zM(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=nF(t[0]),i=nF(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let 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;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]: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??(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??(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:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};vM(u,this.appliedPreAttributes)||(IM(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function ZP(e,t){return e==null||t==null?e==null&&t==null:nx(e,t)}function QP({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function $P({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function eF(e,t,n=!1){return!n&&e==null&&t}function tF(e,t,n=!1){return e==null&&t&&!n}function nF(e){if(e!=null&&e.type===`element`)return e.children??[]}function rF(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`.diff-main`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var iF=`<div class=diff-file></div>`,aF=`background:var(--panel);border-block:1px solid var(--border);padding:.5rem .75rem;font-family:system-ui,sans-serif;font-size:.85rem;display:flex;flex-direction:column;gap:.35rem;`,oF=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;`,sF=new CSSStyleSheet;sF.replaceSync(`:host { display: block; max-width: 100%; overflow-x: auto; } @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+dte);var cF=at(`c0`,0),lF=N(11,L(`c1`,e=>Et(e,{file:e.d,comments:e.e,draft:e.f,onMount:function(){let t=t=>{if(!t)return;let n=document.createElement(`div`);n.style.cssText=aF;let r=document.createElement(`p`);r.textContent=t.text,r.style.cssText=`margin:0;white-space:pre-wrap;`;let i=document.createElement(`button`);return i.textContent=`remove`,i.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;align-self:flex-start;font-size:.75rem;opacity:.7;`,i.onclick=()=>e.g?.(t.id),n.append(r,i),n},n=()=>{let t=document.createElement(`div`);t.style.cssText=aF;let n=document.createElement(`textarea`);n.placeholder=`Leave a comment…`,n.rows=3,n.style.cssText=`font:inherit;width:100%;resize:vertical;border:1px solid var(--border);border-radius:var(--radius);padding:.4rem .5rem;background:inherit;color:inherit;`+(rr()?`font-size:16px;`:``);let r=document.createElement(`button`);r.textContent=`Comment`,r.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;background:var(--accent);color:light-dark(#fff,#10131f);border-color:transparent;`;let i=document.createElement(`button`);i.textContent=`Cancel`,i.style.cssText=oF,r.onclick=()=>{n.value.trim()&&e.h?.(n.value)},i.onclick=()=>e.i?.(),n.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.onclick(),e.key===`Escape`&&i.onclick()};let a=document.createElement(`div`);a.style.cssText=`display:flex;gap:.4rem;`,a.append(r,i),t.append(n,a);let o=()=>n.scrollIntoView({block:`center`,behavior:`smooth`});return n.addEventListener(`focus`,()=>{let e=window.visualViewport;e&&(e.addEventListener(`resize`,o),n.addEventListener(`blur`,()=>e.removeEventListener(`resize`,o),{once:!0}))}),setTimeout(()=>{n.scrollIntoView({block:`center`,behavior:`instant`}),n.focus()},0),t},r=new Map,i,a={draft:!0},o,s=new XP({diffStyle:ir()?`unified`:`split`,disableFileHeader:!0,enableLineSelection:!0,onLineSelectionEnd(t){if(!t)return;let n=t.endSide!=null&&t.endSide!==t.side;e.j?.({side:t.side,start:t.start,end:n?t.start:t.end})},renderAnnotation(e){let r=e.metadata||{};return r.draft?o??=n():t(r.comment)}}),c=()=>{let t=[],n=new Map;for(let i of e.e||[]){let e=r.get(i.id)||{comment:i};n.set(i.id,e),t.push({side:i.side,lineNumber:i.line_end,metadata:e})}return r=n,e.f&&(i!==e.f&&(i=e.f,a={draft:!0},o=void 0),t.push({side:e.f.side,lineNumber:e.f.end,metadata:a})),t},l=()=>{let t=e.a.querySelector(`diffs-container`)?.shadowRoot;t&&!t.adoptedStyleSheets.includes(sF)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,sF])},u=()=>{if(e.d.old==null&&e.d.new==null){e.k?.(`could not read ${e.d.path}`);return}let t=s.render({containerWrapper:e.a,oldFile:e.d.old==null?null:{name:e.d.oldPath||e.d.path,contents:e.d.old},newFile:e.d.new==null?null:{name:e.d.path,contents:e.d.new},lineAnnotations:c()});Promise.resolve(t).then(()=>{l(),pte(e.a)}).catch(t=>e.k?.(`diff render: ${t}`))};u();let d=new AbortController;return rr()&&rF(cF(e),d.signal),{instance:s,render:u,dragAbort:d,unregSearch:fte(e.a,e.d.key),shownFile:e.d,shownComments:e.e,shownDraft:e.f}},onUpdate:function(){(this.file!==this.shownFile||this.comments!==this.shownComments||this.draft!==this.shownDraft)&&(this.shownFile=this.file,this.shownComments=this.comments,this.shownDraft=this.draft,this.render())},onDestroy:function(){this.unregSearch(),this.dragAbort.abort(),this.instance.cleanUp?.()}})),7),uF=M(3,lF),dF=M(4,lF),fF=M(5,lF),pF=M(6,lF),mF=M(7,lF),hF=M(8,lF),gF=M(9,lF),_F=M(10,lF),vF=((e,t,n,r)=>`<div class=diff-view><aside class=tree></aside><div class=diff-col><div class=diff-head><!><span class="dim diff-stats"><!> file<!> changed <!><!></span><span class=head-actions></span><!></div><div class=diff-tools><button class="icon-btn tree-toggle">${e}</button><button class=icon-btn title="Refresh diff">${t}</button><button class="btn files-btn" title="Jump to file">Files (<!>)</button><button class="btn find-btn" title="Find in the review (⌘/Ctrl+F)">${n}<span class=find-label>Find</span></button><label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input type=checkbox> include uncommitted</label>${r}</div><!><div class=diff-main><!><!><!><!><!><!><!><!></div></div><!></div>`)(Zm,xo,mv,yv),yF=((e,t,n,r)=>`D bE%bD%c%c%b%l b%lD D/${e}&l D/${t}&l Db%l D/${n}&lD l/${r}&l%b D%b%b%b%b%b%b%b%m%l`)(Qm,So,hv,`D l`),bF=P(5,0,e=>V(e.a,e._.x)),xF=bF,SF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),CF=I(35,e=>{V(e.b,e._._._.q),SF(e)},e=>e._._._),wF=e=>{CF(e),TF(e)},TF=I(36,SF,e=>e._._._),EF=I(27,e=>V(e.b,e._._._.i),e=>e._._._),DF=e=>{EF(e),OF(e),AF(e),jF(e),MF(e),NF(e),PF(e)},OF=I(28,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),kF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),AF=I(29,e=>{V(e.c,e._._._.k),kF(e)},e=>e._._._),jF=I(30,kF,e=>e._._._),MF=I(31,kF,e=>e._._._),NF=I(32,kF,e=>e._._._),PF=I(33,kF,e=>e._._._),FF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),IF=I(35,e=>{V(e.b,e._._._.q),FF(e)},e=>e._._._),LF=e=>{IF(e),RF(e)},RF=I(36,FF,e=>e._._._),zF=I(34,e=>V(e.a,e._._._.p),e=>e._._._),BF=zF,VF=I(27,e=>V(e.b,e._._._.i),e=>e._._._),HF=L(`e46`,e=>A(e.a,`click`,function(e){e.stopPropagation()})),UF=e=>{VF(e),WF(e),KF(e),qF(e),JF(e),YF(e),XF(e),HF(e)},WF=I(28,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),GF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),KF=I(29,e=>{V(e.c,e._._._.k),GF(e)},e=>e._._._),qF=I(30,GF,e=>e._._._),JF=I(31,GF,e=>e._._._),YF=I(32,GF,e=>e._._._),XF=I(33,GF,e=>e._._._),ZF=N(10,e=>z(e.a,`title`,`origin/${e.h} ${e.i} · GitHub ${e.j}`),2),QF=M(7,ZF),$F=M(8,e=>{V(e.c,iv(e.i)),ZF(e)}),eI=M(9,e=>{V(e.d,iv(e.j)),ZF(e)}),tI=(e,t)=>V(e.b,t>0?` · `:``),nI=(e,t)=>{QF(e,t[0]?.pr?.headRefName),eI(e,t[0]?.pr?.headRefOid),$F(e,t[0]?.head),tI(e,t[1])},rI=(e,t)=>V(e.a,t>0?` · `:``),iI=(e,t)=>V(e.b,t),aI=(e,t)=>V(e.c,t),oI=(e,t)=>{iI(e,t[0]?.worktree),aI(e,t[0]?.pr?.number),rI(e,t[1])},sI=(e,t)=>z(e.a,`value`,t),cI=N(7,e=>V(e.b,e.f||e.g)),lI=M(5,cI),uI=M(6,cI),dI=(e,t)=>{sI(e,t[0]?.id),lI(e,t[0]?.title),uI(e,t[0]?.agent)},fI=k(0,`<!><!> #<!>`,`%b%c%`,0,oI),pI=k(1,`<span><!><!> → <!></span>`,` D%b%c%`,0,nI),mI=I(150,e=>{fI(e,[e._._.c7,`id`]),pI(e,[e._._.c7,`id`])},e=>e._._),hI=dt(`e44`,`<span class=dim><!> — this view has a newer tip than the PR page.</span><span class="mono dim toast-meta"></span>`,`D%l `,mI),gI=O(5,`<span class=chip>local <!></span>`,` Db%`,wF),_I=N(6,e=>gI(e,+!e._._._.c5(e._._.c))),vI=I(149,_I,e=>e._._._),yI=e=>{vI(e),bI(e),wI(e),TI(e),DI(e),OI(e),kI(e)},bI=I(23,_I,e=>e._._),xI=O(0,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,DF),SI=N(9,e=>z(e.b,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),CI=N(7,e=>V(e.c,e._._.g?e._._.g.headRefName:e._._.q)),wI=I(25,e=>{xI(e,+!e._._.g),SI(e),CI(e)},e=>e._._),TI=I(31,SI,e=>e._._),EI=N(8,e=>z(e.d,`title`,`${e._._.n} ${e._._.o}`)),DI=I(32,e=>{V(e.e,e._._.n),EI(e)},e=>e._._),OI=I(33,EI,e=>e._._),kI=I(35,e=>{SI(e),CI(e)},e=>e._._),AI=P(26,0,e=>V(e.a,e._.bl.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`)),jI=AI,MI=I(139,L(`e48`,e=>Et(e,{onMount:function(){e._._._._._._.be(e.a,()=>{fR(e._,!0)})}})),e=>e._._._._._._),NI=N(9,e=>{B(e.a,`closed`,e._._._.b7.has(e._._.d)),V(e.b,e._._._.b7.has(e._._.d)?`▸`:`▾`)}),PI=I(138,NI,e=>e._._._),FI=L(`e47`,e=>A(e.a,`click`,function(){e._._._.b9(e._._.d)})),II=e=>{PI(e),zI(e),BI(e),VI(e),GI(e),KI(e),qI(e),YI(e),XI(e),ZI(e),FI(e)},LI=O(8,`<span class=chip>local <!></span>`,` Db%`,LF),RI=N(10,e=>LI(e,+!e._._._.c5(e._._.c))),zI=I(149,RI,e=>e._._._),BI=I(23,RI,e=>e._._),VI=I(24,NI,e=>e._._),HI=O(3,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,UF,`<span class=dim> </span>`,`D `,BF),UI=N(13,e=>z(e.e,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),WI=N(11,e=>V(e.f,e._._.g?e._._.g.headRefName:e._._.q)),GI=I(25,e=>{HI(e,+!e._._.g),UI(e),WI(e)},e=>e._._),KI=I(26,e=>V(e.c,e._._.h),e=>e._._),qI=I(31,UI,e=>e._._),JI=N(12,e=>z(e.g,`title`,`${e._._.n} ${e._._.o}`)),YI=I(32,e=>{V(e.h,e._._.n),JI(e)},e=>e._._),XI=I(33,JI,e=>e._._),ZI=I(35,e=>{UI(e),WI(e)},e=>e._._),QI=N(3,e=>{B(e.a,`closed`,e._._._._.b6.has(e._._.c(e._.e))),V(e.b,e._._._._.b6.has(e._._.c(e._.e))?`▸`:`▾`)},2),$I=I(137,QI,e=>e._._._._),eL=L(`e32`,e=>A(e.a,`click`,function(){let t=new Set(e._._._._.b6);t.delete(e._._.c(e._.e))||t.add(e._._.c(e._.e)),jH(e._._._._,t)})),tL=e=>{$I(e),nL(e),rL._(e),iL._(e),aL._(e),eL(e)},nL=I(7,QI,e=>e._._),rL=P(0,0,e=>{z(e.a,`title`,e._.e),QI(e)}),iL=P(0,0,e=>_t(e.a,`padding-left:${.35+e._.f*.75}rem`)),aL=P(0,0,e=>V(e.c,e._.g)),oL=P(18,0,e=>fy(e.a,e._.az)),sL=e=>{oL._(e),cL._(e),lL._(e),Dte(e.a),dy(e.a,vU(e))},cL=P(18,0,e=>sy(e.a,e._.bs)),lL=P(18,0,e=>uy(e.a,yU(e))),uL=I(133,e=>V(e.e,e._._.av?`, plus uncommitted`:``),e=>e._._),dL=e=>{uL(e),fL(e),pL(e),mL(e),hL(e)},fL=I(11,e=>V(e.a,iv(e._.h))),pL=I(12,e=>V(e.b,e._.i)),mL=I(13,e=>V(e.c,iv(e._.j))),hL=I(14,e=>V(e.d,e._.k)),gL=dt(`e45`,`this view is <!> (<!>). Local is <!> (<!><!>).`,`b%c%c%c%b%`,dL),_L=e=>{Ar(e.a,gL(e)),Cr(e.a,`info`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},vL=N(6,e=>Or(e.a,`${e.d} #${e.f}`)),yL=M(3,vL),bL=M(5,vL),xL=(e,t)=>{yL(e,t[0]?.worktree),bL(e,t[0]?.pr?.number),SL(e,t[0]?.pr?.headRefName),CL(e,t[0]?.head),wL(e,t[0]?.localHead),TL(e,t[0]?.branch)},SL=M(8,F(pL)),CL=M(7,F(fL)),wL=M(9,F(mL)),TL=M(10,F(hL)),EL=I(133,e=>V(e.b,e._._.av?` — showing uncommitted changes only`:``),e=>e._._),DL=e=>{EL(e),OL(e)},OL=I(7,e=>V(e.a,e._.g)),kL=dt(`e41`,`already in <!><!>.`,`b%b%`,DL),AL=e=>{Ar(e.a,kL(e)),Cr(e.a,`info`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},jL=N(5,e=>Or(e.a,e.d?`${e.e} #${e.d.number}`:e.e)),ML=M(3,jL),NL=M(4,jL),PL=(e,t)=>{ML(e,t[0]?.pr),NL(e,t[0]?.worktree),FL(e,t[0]?.base)},FL=M(6,F(OL)),IL=I(133,e=>V(e.b,e._._.av?` — showing uncommitted changes only`:``),e=>e._._),LL=e=>{IL(e),RL(e)},RL=I(5,e=>V(e.a,e._.e)),zL=dt(`e40`,`<!><!>.`,`%b%`,LL),BL=e=>{Ar(e.a,zL(e)),Cr(e.a,`warn`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},VL=(e,t)=>Or(e.a,`${t}: base not found`),HL=(e,t)=>{VL(e,t[0]?.worktree),UL(e,t[0]?.base)},UL=M(4,F(RL)),WL=N(1,e=>V(e.a,e._.b1.trim()?`No matches in diffs.`:`No files match "${e._.au}".`)),GL=P(26,1,WL),KL=e=>{GL._(e),qL._(e)},qL=P(26,1,WL),JL=I(128,e=>{z(e.a,`disabled`,e._._.ao),V(e.b,e._._.ao?`Reloading…`:`Reload`)},e=>e._._),YL=L(`e42`,e=>A(e.a,`click`,function(){e._._.cb()})),XL=dt(`e43`,`<button class=btn> </button>`,` D `,e=>{JL(e),YL(e)}),ZL=P(23,0,e=>Pr(e.a,bU(e))),QL=e=>{ZL._(e),Nr(e.a,tn({content:XL(e)})),Ar(e.a,hI(e)),Cr(e.a,`info`),Er(e.a,`inline`),Or(e.a,`GitHub is behind`)},$L=I(127,e=>V(e.a,e._._.an),e=>e._._),eR=dt(`e39`,` `,` `,$L),tR=e=>{Ar(e.a,eR(e)),Pr(e.a,xU(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},nR=N(1,e=>fF(e.a,e._._._._._._.al&&e._._._._._._.al?.key===e._._.l?e._._._._._._.al:null)),rR=I(126,nR,e=>e._._._._._._),iR=e=>{rR(e),oR(e),sR(e),cR(e),lR(e),uR(e),e.a,hF(e.a,CU(e)),_F(e.a,SU(e))},aR=N(2,e=>mF(e.a,wU(e))),oR=I(153,aR,e=>e._._._._._._),sR=I(154,e=>pF(e.a,TU(e)),e=>e._._._._._._),cR=I(26,e=>{uF(e.a,e._._.k),aR(e)},e=>e._._),lR=I(27,e=>{gF(e.a,EU(e)),nR(e)},e=>e._._),uR=I(28,e=>dF(e.a,e._._.w),e=>e._._),dR=O(0,`<div class=diff-wait></div>`,` `,MI,iF,(e=>`/${e}&`)(` b`),iR),fR=j(1,e=>dR(e,+!!e.b)),pR=e=>fR(e,!1),mR=O(6,`<span class=dim>✓</span>`),hR=N(10,e=>{B(e.a,`seen`,e._._.ai.has(e.j)),mR(e,+!e._._.ai.has(e.j))}),gR=I(124,hR,e=>e._._),_R=L(`e50`,e=>A(e.a,`click`,function(){CH(e._._,!1),e._._.ck(e.j)})),vR=e=>{gR(e),xR(e),_R(e)},yR=O(5,`<span>💬</span>`),bR=N(11,e=>yR(e,+!e._._.c3.has(e.j))),xR=I(148,bR,e=>e._._),SR=M(9,e=>{z(e.d,`title`,e.j),V(e.e,e.j),hR(e),bR(e)}),CR=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},wR=(e,t)=>{SR(e,t[0]?.key),CR(e,t[0]?.status)},TR=P(28,0,e=>V(e.b,e._.ak)),ER=L(`e51`,e=>{A(e.a,`click`,function(){CH(e._,!1)}),A(e.d,`click`,function(){CH(e._,!1)})}),DR=e=>{TR._(e),OR._(e),AR._(e),ER(e)},OR=P(28,0,e=>V(e.c,e._.bp)),kR=k(4,`<button class="sheet-file mono"><span> </span><span class=sheet-path><bdi> </bdi></span><!><!></button>`,` D D l E m%b%`,vR,wR),AR=P(28,0,e=>kR(e,[e._.bv,`key`])),jR=O(8,`<p class="dim diff-pad">binary file</p>`,0,0,`<p class="dim diff-pad">file too large to display</p>`,0,0,`<p class="dim diff-pad">file could not be read</p>`,0,0,`<!><!><!>`,`b%`,pR),MR=N(25,e=>jR(e,e.s?0:e.t?1:e.u==null&&e.v==null?2:e.y?3:4),4),NR=j(24,e=>{zt(e,`a`,e.y),MR(e)}),PR=N(12,e=>NR(e,!e._._._._.ai.has(e.l))),FR=N(15,e=>iee(e,`h`,e._._._._.ai.has(e.l),DU(e)),2),IR=I(124,e=>{PR(e),FR(e)},e=>e._._._._),LR=L(`e49`,e=>{A(e.a,`toggle`,function(t,n){if(NR(e,n.open),!n.open){let e=n.closest(`.diff-main`);if(e){let t=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t<0&&(e.scrollTop+=t)}}}),A(e.g,`click`,function(e){e.stopPropagation()}),aee(e,`h`)}),RR=e=>{IR(e),BR(e),WR(e),GR(e),LR(e)},zR=N(13,e=>z(e.a,`hidden`,!e._._._._.bz.has(e.l))),BR=I(145,zR,e=>e._._._._),VR=F(uR),HR=M(22,e=>{qR(e,e.w.length),VR(e)}),UR=N(14,e=>HR(e,e._._._._.c3.get(e.l)||[])),WR=I(148,UR,e=>e._._._._),GR=I(152,FR,e=>e._._._._),KR=O(5,`<span class=chip>💬 <!></span>`,`Db%`,xF),qR=M(23,e=>{KR(e,+!e.x),bF(e)}),JR=F(lR),YR=M(11,e=>{z(e.a,`data-key`,e.l),UR(e),PR(e),zR(e),FR(e),JR(e)}),XR=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},ZR=(e,t)=>{z(e.d,`title`,t),V(e.e,t)},QR=M(18,MR),$R=M(19,MR),ez=M(20,MR),tz=M(21,MR),nz=(e,t)=>iz(e,t[0]),rz=F(cR),iz=M(10,e=>{YR(e,e.k?.key),XR(e,e.k?.status),ZR(e,e.k?.path),QR(e,e.k?.binary),$R(e,e.k?.tooLarge),ez(e,e.k?.old),tz(e,e.k?.new),rz(e)}),az=k(0,`<details class=file><summary><span> </span><span class=path><bdi> </bdi></span><!><label class=viewed><input type=checkbox><span class=dim>viewed</span></label></summary><!></details>`,` E D l E m%b D m%`,RR,nz),oz=I(37,e=>az(e,[e._._.s,`key`]),e=>e._._),sz=oz,cz=N(5,e=>z(e.a,`hidden`,!e._.w&&!e._.g&&e._._.b5!==e._.d),3),lz=I(136,cz,e=>e._._),uz=e=>{lz(e),pz(e),hz(e),gz._(e),vz._(e),yz._(e),bz._(e)},dz=O(2,`<div class=files></div>`,` `,sz),fz=N(4,e=>dz(e,e._._.bn>1&&e._._.b7.has(e._.d)?1:0),2),pz=I(138,fz,e=>e._._),mz=O(1,`<button class=repo-sep><span class=tree-chev> </span><span class=mono> </span><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></button>`,` E lD l%b Db%l Db%l%`,II,`<p class=repo-meta><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></p>`,`D%b Db%l Db%l%`,yI),hz=I(141,e=>{mz(e,e._._.bn>1?0:1),fz(e)},e=>e._._),gz=P(0,0,e=>{cz(e),fz(e)}),_z=N(3,e=>z(e.a,`data-pr`,e._.g?`${e._.h}/${e._.g.number}`:void 0)),vz=P(0,0,e=>{_z(e),cz(e)}),yz=P(0,0,_z),bz=P(0,0,cz),xz=F(oz),Sz=M(18,e=>{jz(e,e.s.length),xz(e)}),Cz=N(4,e=>Sz(e,e._.c0.get(e.d)||[])),wz=Ke(27,Cz),Tz=e=>{wz._(e),Oz._(e)},Ez=(e,t)=>Pz(e,t.length),Dz=N(5,e=>Ez(e,e._.c1.get(e.d)||[])),Oz=Ke(27,Dz),kz=O(0,`<section class=repo-section><!><!></section>`,` D%b%`,uz),Az=N(20,e=>kz(e,e.t||e.g?0:1)),jz=M(19,Az),Mz=F(VI),Nz=M(3,e=>{Cz(e),Dz(e),gz(e),Mz(e)}),Pz=M(22,bz),Fz=F(GI,wI),Iz=M(6,e=>{Bz(e,e.g?.number),Vz(e,e.g?.url),Hz(e,e.g?.title),Uz(e,e.g?.headRefName),Az(e),vz(e),Fz(e)}),Lz=(e,t)=>zz(e,t[0]),Rz=F(BI,bI),zz=M(2,e=>{Nz(e,e.c?.id),Iz(e,e.c?.pr),Gz(e,e.c?.worktree),Kz(e,e.c?.head),qz(e,e.c?.base),Jz(e,e.c?.baseSha),Yz(e,e.c?.full_name),Xz(e,e.c?.branch),Zz(e,e.c?.localHead),Rz(e)}),Bz=M(8,F(VF,EF)),Vz=M(9,F(WF,OF)),Hz=M(10,F(KF,AF)),Uz=M(11,F(qF,jF)),Wz=F(KI),Gz=M(7,e=>{yz(e),Wz(e)}),Kz=M(12,F(qI,TI,JF,MF)),qz=M(13,F(YI,DI,YF,NF)),Jz=M(14,F(XI,OI,XF,PF)),Yz=M(15,F(zF)),Xz=M(16,F(ZI,kI,IF,CF)),Zz=M(17,F(RF,TF)),Qz=N(5,e=>B(e.a,`seen`,e._._._._.ai.has(e._.i))),$z=I(124,Qz,e=>e._._._._),eB=L(`e33`,e=>A(e.a,`click`,function(){e._._._._.ck(e._.i)})),tB=e=>{$z(e),iB(e),aB._(e),oB._(e),sB._(e),cB._(e),lB._(e),eB(e)},nB=O(4,`<span class=tree-note>💬</span>`),rB=N(6,e=>nB(e,+!e._._._._.c3.has(e._.i))),iB=I(148,rB,e=>e._._._._),aB=P(0,1,e=>_t(e.a,`padding-left:${.5+e._.f*.75}rem`)),oB=P(0,1,e=>{Qz(e),rB(e)}),sB=P(0,1,e=>z(e.a,`title`,e._.j)),cB=P(0,1,e=>{ht(e.b,[`status`,e._.k]),V(e.c,e._.k)}),lB=P(0,1,e=>V(e.d,e._.l)),uB=O(0,`<button class="tree-dir dim mono"><span class=tree-chev> </span><!>/</button>`,` E l%`,tL,`<button class="tree-file mono"><span> </span><span class=tree-file-name> </span><!></button>`,` D D lD l%`,tB),dB=N(3,e=>uB(e,!e._.f(e.c)&&e.c?.kind===`dir`?0:!e._.f(e.c)&&e.c?.kind!==`dir`?1:2)),fB=Ke(0,dB),pB=fB,mB=M(2,e=>{gB(e,e.c?.path),_B(e,e.c?.depth),vB(e,e.c?.label),yB(e,e.c?.file?.key),bB(e,e.c?.file?.path),xB(e,e.c?.file?.status),SB(e,e.c?.name),dB(e)}),hB=(e,t)=>mB(e,t[0]),gB=M(4,rL),_B=M(5,e=>{aB(e),iL(e)}),vB=M(6,aL),yB=M(8,oB),bB=M(9,sB),xB=M(10,cB),SB=M(11,lB),CB=M(5,fB),wB=N(4,e=>CB(e,OU(e)),2),TB=I(137,wB,e=>e._._),EB=M(3,wB),DB=e=>{TB(e),jB(e),NB._(e),EB(e,kU)},OB=k(0,`<!><!><!>`,`b%`,pB,hB),kB=(e,t)=>OB(e,[t,e=>e.kind===`dir`?`d:${e.path}`:e.file.key]),AB=N(6,e=>kB(e,cv(e._._.c1.get(e._.g)||[]))),jB=I(147,AB,e=>e._._),MB=M(2,F(nL)),NB=P(3,0,e=>{MB(e,AU(e)),AB(e),wB(e)}),PB=O(3,`<!><!><!>`,`b%`,DB),FB=N(7,e=>{B(e.a,`closed`,e._.b7.has(e.g)),V(e.b,e._.b7.has(e.g)?`▸`:`▾`),PB(e,+!!e._.b7.has(e.g))}),IB=Ke(0,FB),LB=L(`e34`,e=>A(e.a,`click`,function(){e._.b9(e.g)})),RB=e=>{IB._(e),LB(e)},zB=M(6,e=>{FB(e),NB(e)}),BB=N(10,e=>V(e.c,e.i?`${e.j} #${e.i.number}`:e.j)),VB=M(8,BB),HB=M(9,BB),UB=(e,t)=>{zB(e,t[0]?.id),VB(e,t[0]?.pr),HB(e,t[0]?.worktree)},WB=k(2,`<option> </option>`,` D `,0,dI),GB=I(121,e=>WB(e,[e._._.a9,`id`]),e=>e._._),KB=L(`e37`,e=>{A(e.a,`click`,function(){e._._.cj(e._._.c4)}),It(e,`c`)}),qB=e=>{GB(e),JB(e),YB(e),KB(e)},JB=I(130,e=>{z(e.a,`disabled`,e._._.ar),V(e.b,e._._.ar?`Sending…`:`Send to`),z(e.c,`disabled`,e._._.ar)},e=>e._._),YB=I(131,e=>Ft(e,`c`,e._._.as,jU(e)),e=>e._._),XB=N(2,e=>V(e.b,e._._.ar?`Sending…`:`Send to ${e._._.ad||e._._.ae}`),2),ZB=I(122,XB,e=>e._._),QB=L(`e36`,e=>A(e.a,`click`,function(){e._._.cj(e._._.c4)})),$B=e=>{ZB(e),eV(e),tV(e),QB(e)},eV=I(123,XB,e=>e._._),tV=I(130,e=>{z(e.a,`disabled`,e._._.ar),XB(e)},e=>e._._),nV=O(2,`<button class="btn primary"> </button>`,` D `,$B,`<span class="split-btn primary"><button> </button><select aria-label="Send comments to session"></select></span>`,`D D l `,qB),rV=P(6,0,e=>nV(e,(e._.a9||[]).length===1?0:(e._.a9||[]).length?1:2)),iV=L(`e38`,e=>A(e.a,`click`,function(){e._.ci()})),aV=e=>{rV._(e),oV._(e),iV(e)},oV=P(6,0,e=>V(e.b,e._.aq?`Copied ✓`:`Copy`)),sV=L(`e35`,e=>A(e.a,`click`,function(){e._.ac?.()})),cV=e=>{dv(e.b),fv(e.b,14),pv(e.b),sV(e)},lV=N(82,L(`e53`,e=>Et(e,{active:e.a7,load:e.bh,onMount:function(){let t=new AbortController,n={abort:t,loaded:!1,lastPr:e.a6||``,lastNonce:e.a8||0,start:()=>{this.active&&!n.loaded&&(n.loaded=!0,this.load())}};return Cn().addEventListener(`review.changed`,t=>{n.loaded&&t.data?.workspaceId===e.a5&&e.bj()},{signal:t.signal}),window.addEventListener(`keydown`,t=>{this.active&&(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||t.target?.closest?.(`.palette`)||(t.preventDefault(),TH(e,!0),DH(e,e.az+1))))},{capture:!0,signal:t.signal}),n.start(),n},onUpdate:function(){this.start();let t=e.a6||``,n=e.a8||0;this.loaded&&t&&n!==this.lastNonce?(this.lastNonce=n,this.lastPr=t,e.bf(t)):(this.lastPr=t,this.lastNonce=n)},onDestroy:function(){this.abort.abort()}})),7),uV=M(109),dV=N(80,e=>uV(e,MU(e))),fV=M(79,e=>{lV(e),dV(e)}),pV=N(78,e=>fV(e,NU(e)),3),mV=M(77,e=>{pV(e),lV(e)}),hV=M(97,F(BR)),gV=k(0,`<div class=tree-repo><button class="tree-repo-name mono"><span class=tree-chev> </span> </button><!></div>`,`D E l l%`,RB,UB),_V=N(100,e=>gV(e,[e.bl.filter(t=>e.c1.get(t.id)?.length),`id`])),vV=F(jB),yV=M(99,e=>{_V(e),vV(e),Oz(e)}),bV=N(94,e=>yV(e,new Map(e.bl.map(t=>[t.id,e.bv.filter(e=>e.repo===t.id)])))),xV=M(93,e=>{cU(e,e.bv?.length),hV(e,new Set(e.bv.map(e=>e.key))),bV(e),AR(e)}),SV=N(92,e=>xV(e,e.bt?e.bs.filter(t=>e.bt.has(t.key)||t.key===e.b4):e.bs),2),CV=M(90,e=>{SV(e),cL(e)}),wV=N(89,e=>CV(e,e.bo.filter(t=>e.bq(t.key)))),TV=M(86,e=>{sU(e,e.bo?.length),wV(e)}),EV=k(21,sr,(e=>`/${e}&`)(cr),BL,HL),DV=k(22,sr,(e=>`/${e}&`)(cr),AL,PL),OV=k(27,`<!><!><!>`,`b%`,Tz,Lz),kV=M(108,ZL),AV=N(106,e=>kV(e,FU(e))),jV=F(mI),MV=M(105,e=>{fU(e,e.c7?.length),AV(e),jV(e)}),NV=N(84,e=>MV(e,e.bl.filter(t=>t.githubDrift&&!e.b8.has(t.id)))),PV=k(24,sr,(e=>`/${e}&`)(cr),_L,xL),FV=N(104,e=>PV(e,[e.bl.filter(e.c5),`id`])),IV=M(83,e=>{oU(e,e.bl.length),TV(e,e.bl.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),EV(e,[e.bl.filter(e=>e.baseMissing),`id`]),DV(e,[e.bl.filter(e=>e.contained&&e.files.length),`id`]),OV(e,[e.bl,`id`]),bV(e),NV(e),_V(e),FV(e),AI(e)}),LV=M(98,wz),RV=e=>{LV(e,new Map(e.bl.map(t=>[t.id,e.bo.filter(e=>e.repo===t.id)])))},zV=M(116),BV=N(114,e=>zV(e,IU(e)),2),VV=M(117),HV=N(115,e=>VV(e,LU(e)),3),UV=O(25,`<div class=diff-skel><p class=dim><span class=spin></span>Loading diff…</p><div class=skel-row></div><div class=skel-row></div><div class=skel-row></div></div>`),WV=N(51,e=>UV(e,!e.af&&e.ao?0:1)),GV=O(26,`<p class="dim center-pad"> </p>`,`D `,jI,`<p class="dim center-pad"> </p>`,`D `,KL),KV=N(96,e=>GV(e,e.af&&!e.bp?0:e.af&&!e.bx&&!e.b3?1:2),3),qV=j(41,e=>{mV(e,PU(e)),IV(e,e.af||[]),RV(e),BV(e),HV(e),WV(e),KV(e)}),JV=M(101,F(iB,WR,xR)),YV=M(112,F(sR)),XV=M(111,F(oR)),ZV=N(48,e=>XV(e,zU(e)),2),QV=j(42,e=>{UH(e,e.ag?.length),JV(e,(()=>{let t=new Map;for(let n of e.ag){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),YV(e,RU(e)),ZV(e),BV(e),HV(e)}),$V=M(110,F(GR)),eH=N(45,e=>$V(e,BU(e))),tH=F($z,IR,gR),nH=j(44,e=>{WH(e,e.ai?.size),eH(e),tH(e)}),rH=F(rR),iH=j(47,e=>{ZV(e),rH(e)}),aH=O(20,sr,(e=>`/${e}&`)(cr),tR),oH=F($L),sH=j(49,e=>{aH(e,+!e.an),oH(e)}),cH=O(7,`<span class="refresh-chip dim"><span class=spin></span>Refreshing…</span>`),lH=F(JL),uH=j(50,e=>{B(e.k,`spinning`,e.ao),z(e.k,`disabled`,e.ao),cH(e,+!e.ao),WV(e),lH(e)}),dH=j(52,oV),fH=j(53,F(tV,JB)),pH=M(102),mH=N(55,e=>pH(e,(e.a9||[]).some(t=>t.id===e.as)?e.as:e.a9?.[0]?.id??null)),hH=F(YB),gH=j(54,e=>{mH(e),hH(e)}),_H=M(88,wV),vH=j(56,e=>{Ev(e.r,e.au),_H(e,$_(e.au)),GL(e)}),yH=F(IL,EL,uL),bH=j(57,e=>{kt(e,`q`,e.av),pV(e),dV(e),yH(e)}),xH=j(58,e=>{B(e.a,`closed`,!e.aw),B(e.i,`on`,e.aw),z(e.i,`title`,e.aw?`Hide file tree`:`Show file tree`)}),SH=O(28,`<div class=sheet-backdrop></div><div class=file-sheet role=dialog aria-label="Jump to file"><div class=sheet-head><strong>Files</strong><span class=dim><!>/<!> viewed</span><button class=icon-btn title=Close>×</button></div><div class=sheet-list></div></div>`,` bEbD%c%l l `,DR),CH=j(59,e=>SH(e,+!e.ax)),wH=O(18,vte,(e=>`/${e}&`)(yte),sL),TH=j(60,e=>{B(e.o,`on`,e.ay),wH(e,+!e.ay)}),EH=M(119),DH=j(61,e=>{EH(e,VU(e)),lV(e),oL(e)}),OH=M(91,SV),kH=e=>{OH(e,e.b1.trim()?new Set(e.b2):null)},AH=j(62,e=>{GH(e,e.b0?.query),KH(e,e.b0?.keys),qH(e,e.b0?.hit),kH(e)}),jH=j(68,F(TB,$I)),MH=M(71),NH=F(pz,PI),PH=j(69,e=>{MH(e,HU(e)),IB(e),NH(e)}),FH=j(70,e=>{NV(e),AV(e)}),IH=(e,t)=>{QH(e,t.cbs),$H(e,t.io)},LH=M(103,FV),RH=M(120),zH=M(118,e=>RH(e,WU(e))),BH=L(`e52`,e=>{A(e.i,`click`,function(){xH(e,!e.aw),qn(e.aw)}),A(e.k,`click`,function(){e.cb()}),A(e.m,`click`,function(){CH(e,!0)}),A(e.o,`click`,function(){e.cl()}),A(e.q,`change`,function(t){bH(e,t.target.checked),Yn(e.av),e.bh(e.av)})});function VH(e){$m(e.j),eh(e.j,14),th(e.j),Co(e.l),wo(e.l,14),To(e.l),gv(e.p),_v(e.p,14),vv(e.p),jv(e.r),Mv(e.r,KU(e)),qV(e,null),QV(e,[]),nH(e,new Set),iH(e,null),sH(e,null),uH(e,!1),dH(e,!1),fH(e,!1),gH(e,null),vH(e,``),bH(e,Jn()),xH(e,Kn()),CH(e,!1),TH(e,!1),DH(e,0),AH(e,{query:``,hit:null,keys:[]}),jH(e,new Set),PH(e,new Set),FH(e,new Set),IH(e,{io:null,cbs:null}),LH(e,UU),zH(e,GU(e)),BH(e)}var HH=O(6,`<button class=btn title="Copy comments as markdown"> </button><!><!>`,` D l%`,aV),UH=M(43,e=>{V(e.f,e.ah?`· ${pt(e.ah)} comment${pt(e.ah===1?``:`s`)}`:``),HH(e,+!e.ah)}),WH=M(46,e=>{V(e.e,e.ak?` · ${pt(e.ak)} viewed`:``),TR(e)}),GH=M(63,qL),KH=M(64),qH=M(65,e=>{JH(e,e.b3?.key),YH(e,e.b3?.repo),KV(e)}),JH=M(66,SV),YH=M(67,F(lz)),XH=M(76),ZH=N(75,e=>XH(e,qU(e))),QH=M(73,ZH),$H=M(74,ZH),eU=M(81,lV),tU=M(113,e=>{BV(e),HV(e)}),nU=M(31,e=>{eU(e,JU(e)),tU(e,YU(e)),pV(e),lV(e),eH(e),ZV(e)}),rU=M(32,e=>{pV(e),lV(e)}),iU=M(33,lV),aU=M(34,lV),oU=M(85,F(hz)),sU=M(87,e=>{V(e.c,e.bp),V(e.d,e.bp===1?``:`s`),KV(e),OR(e)}),cU=M(95,e=>{V(e.n,e.bx),KV(e)}),lU=F(GB),uU=M(35,e=>{gU(e,e.a9?.[0]?.title),_U(e,e.a9?.[0]?.agent),mH(e),rV(e),lU(e)}),dU=O(23,sr,(e=>`/${e}&`)(cr),QL),fU=(e,t)=>dU(e,+!t),pU=M(37,HV),mU=O(1,(e=>`<button class=icon-btn title="Back to terminal">${e}</button>`)(lv),(e=>` D/${e}&l`)(uv),cV),hU=M(38,e=>mU(e,+!e.ac)),gU=M(39,F(ZB)),_U=M(40,F(eV));function vU(e){return function(){TH(e._,!1),AH(e._,{query:``,hit:null,keys:[]})}}function yU(e){return function(t){e._.cm(t)}}function bU(e){return function(){e._.ca()}}function xU(e){return function(){sH(e._,null)}}function SU(e){return function(t){sH(e._._._._._._,t)}}function CU(e){return function(){iH(e._._._._._._,null)}}function wU(e){return function(t){e._._._._._._.cd(e._._.k,t)}}function TU(e){return function(t){e._._._._._._.ce(t)}}function EU(e){return function(t){iH(e._._._._._._,{key:e._._.l,side:t.side||`additions`,start:Math.min(t.start,t.end),end:Math.max(t.start,t.end)})}}function DU(e){return function(){e._._._._.cc(e.l)}}function OU(e){return t=>{let n=e.d(t);for(let r of e._._.b6){let[i,a]=[r.slice(0,r.indexOf(`/`)),r.slice(r.indexOf(`/`)+1)];if(i===e._.g&&(t.kind!==`dir`||t.path!==a)&&(n===a||n.startsWith(`${a}/`)))return!0}return!1}}function kU(e){return e.kind===`dir`?e.path:e.file.path.includes(`/`)?e.file.path.slice(0,e.file.path.lastIndexOf(`/`)):``}function AU(e){return t=>`${e._.g}/${t}`}function jU(e){return t=>{gH(e._._,t)}}function MU(e){return()=>(FH(e,new Set),e.bh(e.av,!0))}function NU(e){return async(t=e.av,n=!1)=>{uH(e,!0),sH(e,null);try{let r=new URLSearchParams;t&&r.set(`uncommitted`,`1`),n&&r.set(`refresh`,`1`);let i=r.size?`?${r}`:``,[a,o]=await Promise.all([H(`/api/workspaces/${e.a5}/diff${i}`),H(`/api/workspaces/${e.a5}/review`)]);qV(e,a),QV(e,o.comments||[]),nH(e,new Set(o.viewed||[])),e.a6&&e.bf(e.a6)}catch(t){sH(e,String(t.message||t))}uH(e,!1)}}function PU(e){return t=>{if(!t)return;let n=e.af||[],r=n.find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),i=new Set;for(let e of n)(!r||e.id!==r.id)&&i.add(e.id);PH(e,i);let a=Date.now(),o=()=>{let e=scrollEl?.(),n=e?.querySelector(`[data-pr="${CSS.escape(t)}"]`);if(!e||!n){Date.now()-a<2500&&requestAnimationFrame(o);return}let r=n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;e.scrollTo({top:Math.max(0,r-8)})};requestAnimationFrame(o)}}function FU(e){return()=>{FH(e,new Set([...e.b8,...e.c7.map(e=>e.id)]))}}function IU(e){return async()=>{if(!await X_(nv(e.ag,e.af))){sH(e,`Copy failed — clipboard needs HTTPS on this browser.`);return}dH(e,!0),setTimeout(()=>{dH(e,!1)},1500),await e.cf()}}function LU(e){return async t=>{if(t){fH(e,!0);try{await H(`/api/sessions/${t}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${nv(e.ag,e.af)}`,...Q_()||{}})}),fH(e,!1),await e.cf(),e.ab?.(t)}catch(t){sH(e,String(t.message||t)),fH(e,!1)}}}}function RU(e){return async t=>{QV(e,e.ag.filter(e=>e.id!==t)),await fetch(`/api/review-comments/${t}`,{method:`DELETE`})}}function zU(e){return async(t,n)=>{let r=e.al;iH(e,null);try{let i=await H(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:t.repo,path:t.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim()})});QV(e,e.ag.concat(i))}catch(t){sH(e,String(t.message||t))}}}function BU(e){return t=>{let n=new Set(e.ai),r=!n.has(t);r?n.add(t):n.delete(t),nH(e,n),fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`viewed`,key:t,viewed:r})}).catch(()=>{sH(e,`Saving viewed state failed — it may reset on reload.`)})}}function VU(e){return()=>{TH(e,!0),DH(e,e.az+1)}}function HU(e){return t=>{let n=new Set(e.b7);n.delete(t)||n.add(t),PH(e,n)}}function UU(e){return!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)}function WU(e){return t=>{AH(e,t),t.hit&&setTimeout(()=>e.ck(t.hit.key),0)}}function GU(e){return t=>{let n=e.t.querySelector(`details[data-key="${CSS.escape(t)}"]`);n&&(n.open=!0,n.scrollIntoView({block:`start`}))}}function KU(e){return function(t){vH(e,t)}}function qU(e){return(t,n)=>{e.bb??=new WeakMap,e.bc??=new IntersectionObserver(t=>{for(let n of t)n.isIntersecting&&(e.bc.unobserve(n.target),e.bb.get(n.target)?.())},{rootMargin:`600px 0px`}),e.bb.set(t,n),e.bc.observe(t)}}function JU(e){return async()=>{try{let t=await H(`/api/workspaces/${e.a5}/review`);QV(e,t.comments||[]),nH(e,new Set(t.viewed||[]))}catch{}}}function YU(e){return async()=>{QV(e,[]),iH(e,null),await fetch(`/api/workspaces/${e.a5}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})})}}R(`e24`,vU),R(`e23`,yU),R(`e26`,bU),R(`e25`,xU),R(`e31`,SU),R(`e29`,CU),R(`e28`,wU),R(`e30`,TU),R(`e27`,EU),R(`e1`,DU),R(`e21`,OU),R(`e20`,kU),R(`e19`,AU),R(`e0`,jU),R(`e9`,MU),R(`e5`,NU),R(`e4`,PU),R(`e8`,FU),R(`e14`,IU),R(`e15`,LU),R(`e12`,RU),R(`e11`,zU),R(`e10`,BU),R(`e17`,VU),R(`e2`,HU),R(`e7`,UU),R(`e18`,WU),R(`e16`,GU),R(`e22`,KU),R(`e3`,qU),R(`e6`,JU),R(`e13`,YU);var XU=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,QU=(e,t)=>{for(var n in t)XU(e,n,{get:t[n],enumerable:!0})},$U=(e,t,n,r)=>{for(var i=r>1?void 0:r?ZU(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&XU(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),eW=`Terminal input`,tW={get:()=>eW,set:e=>eW=e},nW=`Too much output to announce, navigate to rows manually to read`,rW={get:()=>nW,set:e=>nW=e};function iW(e){return e.replace(/\r?\n/g,`\r`)}function aW(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oW(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function sW(e,t,n,r){e.stopPropagation(),e.clipboardData&&cW(e.clipboardData.getData(`text/plain`),t,n,r)}function cW(e,t,n,r){e=iW(e),e=aW(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function lW(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function uW(e,t,n,r,i){lW(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function dW(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function fW(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var pW=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},mW=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},hW=``,gW=` `,_W=class e{constructor(){this.fg=0,this.bg=0,this.extended=new vW}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},vW=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},yW=class e extends _W{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vW,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dW(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bW=`di$target`,xW=`di$dependencies`,SW=new Map;function CW(e){return e[xW]||[]}function wW(e){if(SW.has(e))return SW.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);TW(t,e,r)};return t._id=e,SW.set(e,t),t}function TW(e,t,n){t[bW]===t?t[xW].push({id:e,index:n}):(t[xW]=[{id:e,index:n}],t[bW]=t)}var EW=wW(`BufferService`),DW=wW(`CoreMouseService`),OW=wW(`CoreService`),kW=wW(`CharsetService`),AW=wW(`InstantiationService`),jW=wW(`LogService`),MW=wW(`OptionsService`),NW=wW(`OscLinkService`),PW=wW(`UnicodeService`),FW=wW(`DecorationService`),IW=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new yW,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):LW(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};IW=$U([J(0,EW),J(1,MW),J(2,NW)],IW);function LW(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1532
|
+
`}function WP(e,t){return Math.max(e.additionLines.length,e.deletionLines.length)>t}function GP(e,t){return e.isPartial&&t&&(e.type===`change`||e.type===`rename-changed`)}function KP(e,t){return e.lineNumber===t.lineNumber&&e.side===t.side&&e.metadata===t.metadata}function qP(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 JP(e,t=300){let n;try{await Promise.race([e(),new Promise(e=>{n=setTimeout(e,t)})])}finally{n!=null&&clearTimeout(n)}}function YP({oldFile:e,newFile:t},n){if(e!==void 0||t!==void 0){if(e===void 0||t===void 0)throw Error(`${n}: Pass null for an intentionally missing oldFile or newFile side`);if(e===null){if(t===null)throw Error(`${n}: You must pass oldFile, newFile, or both`);return{oldFile:e,newFile:t}}return{oldFile:e,newFile:t}}}function XP(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:VM(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?`default`:`custom`}}function ZP(e){return e.isPartial&&(e.type===`change`||e.type===`rename-changed`||e.type===`rename-pure`)}var QP=-1,$P=class{options;workerManager;isContainerManaged;static LoadedCustomComponent=!0;__id=`file-diff:${++QP}`;type=`file-diff`;fileContainer;spriteSVG;pre;codeUnified;codeDeletions;codeAdditions;bufferBefore;bufferAfter;themeCSSStyle;appliedThemeCSS;hasAdoptedThemeCSS=!1;unsafeCSSStyle;appliedUnsafeCSS;gutterUtilityContent;headerElement;headerPrefix;headerFilenameSuffix;headerMetadata;headerCustom;separatorCache=new Map;errorWrapper;placeHolder;hunksRenderer;resizeManager;scrollSyncManager;interactionManager;annotationCache=new Map;lineAnnotations=[];managersDirty=!1;deletionFile;additionFile;fileDiff;renderRange;pendingFiles;appliedPreAttributes;lastRenderedHeaderHTML;cachedHeaderHTML;lastRowCount;mounted=!1;enabled=!0;editor;refreshViewTimeout;lineStateRefreshPending=!1;deferredSelectedLines;deferredEditorActiveLine;constructor(e={theme:Ay},t,n=!1){this.options=e,this.workerManager=t,this.isContainerManaged=n,this.hunksRenderer=this.createHunksRenderer(e),this.resizeManager=new zC,this.scrollSyncManager=new aN,this.interactionManager=new yC(`diff`,bC(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}handleHighlightRender=()=>{this.rerender()};getHunksRendererOptions(e){return XP(e)}createHunksRenderer(e){return new kP(this.getHunksRendererOptions(e),this.handleHighlightRender,this.workerManager)}getLineIndex=(e,t=`additions`)=>{let n=this.fileDiffCache;if(n==null)return;let r=n.hunks.at(-1),i,a;hunkIterator:for(let o of n.hunks){let n=t===`deletions`?o.deletionStart:o.additionStart,s=t===`deletions`?o.deletionCount:o.additionCount,c=eb(n,s)+1,l=o.splitLineStart,u=o.unifiedLineStart;if(e<c){let t=c-e;i=Math.max(u-t,0),a=Math.max(l-t,0);break hunkIterator}if(e>=c+s){if(o===r){let t=e-(c+s);i=u+o.unifiedLineCount+t,a=l+o.splitLineCount+t;break hunkIterator}continue}for(let n of o.hunkContent)if(n.type===`context`){if(e<c+n.lines){let t=e-c;a=l+t,i=u+t;break hunkIterator}c+=n.lines,l+=n.lines,u+=n.lines}else{let r=t===`deletions`?n.deletions:n.additions;if(e<c+r){let r=e-c;i=u+(t===`additions`?n.deletions:0)+r,a=l+r;break hunkIterator}c+=r,l+=Math.max(n.deletions,n.additions),u+=n.deletions+n.additions}break hunkIterator}if(i!=null&&a!=null)return[i,a]};setOptions(e){e!=null&&(this.options=e,this.cachedHeaderHTML=void 0,this.hunksRenderer.setOptions(this.getHunksRendererOptions(e)),this.syncInteractionOptions())}syncInteractionOptions(){this.interactionManager.setOptions(bC(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;let t=this.appliedThemeCSS.baseThemeType??e;return this.appliedThemeCSS.themeType!==t&&(this.applyThemeState(this.fileContainer,this.appliedThemeCSS.themeStyles,e,this.appliedThemeCSS.baseThemeType),!0)}hasThemeChanged(){return this.appliedThemeCSS!=null&&!Wy(this.appliedThemeCSS.theme,this.options.theme??Ay)}getHoveredLine=()=>this.interactionManager.getHoveredLine();setLineAnnotations(e){this.lineAnnotations=e}canPartiallyRender(e,t,n){return!(e||t||n||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(){let{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}let{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`||e===`scroll`&&(this.lineAnnotations.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){Hy(this.handleEditSessionRender),this.emitPostRender(!0),this.editor?.cleanUp(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,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.lastRenderedHeaderHTML=void 0,e||(this.cachedHeaderHTML=void 0),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.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:n=!1,lineAnnotations:r,fileDiff:i,...a}){if(!this.enabled)throw Error(`FileDiff.hydrate: attempting to call hydrate after cleaned up`);if(this.fileContainer!=null)throw Error(`FileDiff.hydrate: hydrate can only be called before the instance has rendered or hydrated`);let o=YP(a,`FileDiff.hydrate`),s=o?.oldFile,c=o?.newFile;this.hydrateElements(e,t),rF(this.pre,tF({fileDiff:i,oldFile:s,newFile:c}),this.options.collapsed)||iF(this.headerElement,nF({fileDiff:i,oldFile:s,newFile:c}),this.options.disableFileHeader)?this.render({...a,fileContainer:e,lineAnnotations:r,fileDiff:i,preventEmit:!0}):this.hydrationSetup({fileDiff:i,lineAnnotations:r,...o}),n||this.emitPostRender()}hydrateElements(e,t){this.fileContainer!==e&&this.emitPostRender(!0),RM(e,t);for(let t of e.shadowRoot?.children??[]){if(t instanceof SVGElement){this.spriteSVG=t;continue}if(t instanceof HTMLElement){if(t instanceof HTMLPreElement){this.pre=t;for(let e of t.children)!(e instanceof HTMLElement)||e.tagName.toLowerCase()!==`code`||(`deletions`in e.dataset&&(this.codeDeletions=e),`additions`in e.dataset&&(this.codeAdditions=e),`unified`in e.dataset&&(this.codeUnified=e));continue}if(`diffsHeader`in t.dataset){this.headerElement=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-theme-css`)){this.themeCSSStyle=t;continue}if(t instanceof HTMLStyleElement&&t.hasAttribute(`data-unsafe-css`)){this.unsafeCSSStyle=t,this.appliedUnsafeCSS=t.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:n,lineAnnotations:r}){this.lineAnnotations=r??this.lineAnnotations,this.additionFile=n,this.deletionFile=t,this.fileDiff=e??(t!==void 0&&n!==void 0?nx(t,n,this.options.parseDiffOptions):void 0),this.pre!=null&&(this.syncInteractionOptions(),this.hunksRenderer.hydrate(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()}handleExpandHunk=(e,t,n)=>{this.expandHunk(e,t,n)};expandHunk=(e,t,n)=>{this.hunksRenderer.expandHunk(e,t,n),this.loadFilesIfNecessary(),this.rerender()};loadFilesIfNecessary(){let{fileDiff:e,options:{loadDiffFiles:t}}=this;e==null||t==null||!ZP(e)||this.pendingFiles?.fileDiff===e||(this.pendingFiles={fileDiff:e,promise:this.loadFilesForDiff(e,t)})}async loadFilesForDiff(e,t){try{let n=await t(e);if(!this.enabled||this.fileDiff!==e)return;await this.handleFilesLoaded(e,n)}catch(e){if(this.options.disableErrorHandling===!0)throw e;console.error(e)}finally{this.pendingFiles?.fileDiff===e&&(this.pendingFiles=void 0)}}async handleFilesLoaded(e,t){this.fileDiff!==e||!e.isPartial||(XM(`merge`,e,t),this.setHydratedState(t),await JP(()=>this.primeHighlightCache(e)),!(!this.enabled||this.fileDiff!==e)&&this.rerender())}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:n=!1,preventEmit:r=!1,lineAnnotations:i,fileContainer:a,containerWrapper:o,renderRange:s,...c}){let l=YP(c,`FileDiff.render`),u=l?.oldFile,d=l?.newFile;if(!this.enabled)throw Error(`FileDiff.render: attempting to call render after cleaned up`);e!=null&&e.cacheKey===void 0&&(e.cacheKey=e.prevName==null?e.name:e.prevName+`:`+e.name),this.editor?.__postponeBgTokenizeToNextFrame();let{collapsed:f=!1,themeType:p=`system`,expandUnchanged:m=!1}=this.options,h=f?void 0:s,g=this.hasThemeChanged(),_=l!=null,v=_&&(!eF(u,this.deletionFile)||!eF(d,this.additionFile)),y=e!=null&&e!==this.fileDiff,b=i!=null&&(i.length>0||this.lineAnnotations.length>0)&&i!==this.lineAnnotations;if(!f&&kj(h,this.renderRange)&&!n&&!b&&!g&&(e!=null&&e===this.fileDiff||e==null&&!v))return this.applyCachedThemeState(p);let x;e==null&&_&&(v||this.fileDiff==null)&&(x=nx(l.oldFile,l.newFile,this.options.parseDiffOptions));let{renderRange:S}=this;if(this.renderRange=h,_?(this.deletionFile=u,this.additionFile=d):e!=null&&(this.deletionFile=void 0,this.additionFile=void 0),e==null?x!=null&&(y=!0,this.fileDiff=x):this.fileDiff=e,y&&(this.cachedHeaderHTML=void 0),i!=null&&this.setLineAnnotations(i),this.fileDiff==null)return!1;this.fileDiff.editSessionDirty===!0&&this.shouldSelfHealEditSession()&&(dP(this.fileDiff,this.options.parseDiffOptions),this.hunksRenderer.refreshHighlightedResult()),m&&this.loadFilesIfNecessary(),this.hunksRenderer.setOptions(this.getHunksRendererOptions(this.options)),this.syncInteractionOptions(),this.hunksRenderer.setLineAnnotations(this.lineAnnotations);let{disableErrorHandling:C=!1,disableFileHeader:ee=!1}=this.options;if(ee&&(this.headerElement!=null&&(this.headerElement.remove(),this.headerElement=void 0,this.lastRenderedHeaderHTML=void 0),this.clearHeaderSlots()),a=this.getOrCreateFileContainer(a,o),this.applyCachedThemeState(p),f){this.removeRenderedCode(),this.clearAuxiliaryNodes();try{let e=this.hunksRenderer.renderDiff(this.fileDiff,Ry);e!=null&&this.applyThemeState(a,e.themeStyles,p,e.baseThemeType),e?.headerElement!=null&&this.applyHeaderToDOM(e.headerElement,a),this.renderSeparators([]),this.injectUnsafeCSS()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}try{let e=this.getOrCreatePreNode(a);if(!(this.canPartiallyRender(n,b,v||y||g)&&this.applyPartialRender({previousRenderRange:S,renderRange:h}))){let t=this.hunksRenderer.renderDiff(this.fileDiff,h);if(t==null)return this.workerManager?.isInitialized()===!1&&this.workerManager.initialize().then(()=>this.rerender()),!1;this.applyThemeState(a,t.themeStyles,p,t.baseThemeType),t.headerElement!=null&&this.applyHeaderToDOM(t.headerElement,a),t.additionsContentAST!=null||t.deletionsContentAST!=null||t.unifiedContentAST!=null?this.applyHunksToDOM(e,t):this.pre!=null&&(this.pre.remove(),this.pre=void 0),this.renderSeparators(t.hunkData)}this.applyBuffers(e,h),this.injectUnsafeCSS(),this.renderAnnotations(),this.renderGutterUtility(),this.managersDirty=!0,t||this.flushManagers(),this.editor!=null&&this.syncRenderViewToEditor()}catch(e){if(C)throw e;console.error(e),e instanceof Error&&this.applyErrorToDOM(e,a)}return r||this.emitPostRender(),!0}emitPostRender(e=!1){let{fileContainer:t,options:{onPostRender:n}}=this;if(e){if(!this.mounted||(this.mounted=!1,t==null))return;this.options.onPostRender?.(t,this,`unmount`);return}if(t==null)return;let r=this.mounted?`update`:`mount`;this.mounted=!0,n?.(t,this,r)}get fileDiffCache(){return this.hunksRenderer.diffCache??this.fileDiff}syncRenderViewToEditor(){let e=this.editor,t=this.fileContainer,n=this.fileDiffCache,r=this.lineAnnotations,i=this.computeEditorRenderRange(this.renderRange);e!=null&&t!=null&&n!=null&&!n.isPartial&&this.hunksRenderer.initializeHighlighter().then(a=>{!this.enabled||this.editor!==e||this.fileContainer!==t||this.fileDiffCache!==n||e.__syncRenderView(a,t,n,r,i)})}computeEditorRenderRange(e){let t=this.fileDiffCache;if(e==null||t==null||pN(e))return e;let{diffStyle:n=`split`,expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options,a,o;return CN({diff:t,diffStyle:n,startingLine:e.startingLine,totalLines:e.totalLines,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i,callback:({additionLine:e})=>{e!=null&&(a??=e.lineNumber,o=e.lineNumber)}}),a==null||o==null?{...e,startingLine:0,totalLines:0}:{...e,startingLine:a-1,totalLines:o-a+1}}attachEditor(e){if(this.type!==`file-diff`)throw Error(`FileDiff.attachEditor: cannot attach an editor to a "${this.type}" diff`);return this.editor?.cleanUp(),this.editor=e,this.hunksRenderer.beginEditSession(),this.fileDiff?.isPartial===!0&&this.loadFilesIfNecessary(),this.hunksRenderer.editorRenderReady()?this.syncRenderViewToEditor():this.rerender(),e=>{this.editor=void 0,e!==!0&&this.finishEditSession()}}finishEditSession(){this.hunksRenderer.endEditSession(),this.completeEditSession()}completeEditSession(){let e=this.fileDiffCache;if(e==null||e.editSessionDirty!==!0)return!1;let{collapsedContextThreshold:t=1}=this.options,n=lP(e,this.hunksRenderer.getExpandedHunksMap(),t);return dP(e,this.options.parseDiffOptions),this.hunksRenderer.setExpandedHunksMap(uP(e,n)),this.hunksRenderer.refreshHighlightedResult(),this.escalateEditSessionRender(),!0}applyDocumentChange(e,t){this.hunksRenderer.applyDocumentChange(e);let n=this.hunksRenderer.diffCache;if(n!=null){let e=this.fileDiff?.cacheKey;e!=null&&n.cacheKey==null&&(n.cacheKey=e),this.fileDiff=n}t!==void 0&&t!==this.lineAnnotations&&(this.setLineAnnotations(t),this.hunksRenderer.setLineAnnotations(this.lineAnnotations),this.renderAnnotations()),this.rerender(),this.interactionManager.setSelectionDirty()}updateRenderCache(e,t,n={}){let{shouldRefreshDiffsView:r,lineCountChangeInFlight:i}=n;if(this.hunksRenderer.updateRenderCache(e,t,i)){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))}isLineRenderable(e){let t=this.fileDiffCache;if(t==null)return!0;let{expandUnchanged:n=!1,collapsedContextThreshold:r=1}=this.options;return xN({fileDiff:t,lineNumber:e,expandedHunks:n?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:r})}getNearestRenderableLine(e,t){let n=this.fileDiffCache;if(n==null)return e;let{expandUnchanged:r=!1,collapsedContextThreshold:i=1}=this.options;return SN({fileDiff:n,lineNumber:e,direction:t,expandedHunks:r?!0:this.hunksRenderer.getExpandedHunksMap(),collapsedContextThreshold:i})}revealLine(e){let t=this.fileDiffCache,{expandUnchanged:n=!1,collapsedContextThreshold:r=1,expansionLineCount:i=100}=this.options;if(t==null||t.isPartial||n)return!1;let a=this.hunksRenderer.getExpandedHunksMap();for(let[n,o]of t.hunks.entries()){let[s,c]=gN(o);if(e<s){let c=_N({isPartial:t.isPartial,rangeSize:o.collapsedBefore,expandedHunks:a,hunkIndex:n,collapsedContextThreshold:r}),l=s-c.rangeSize;if(c.renderAll||e<l+c.fromStart||e>=s-c.fromEnd)return!1;let u=e-(l+c.fromStart)+1,d=s-c.fromEnd-e;return u<=d?this.expandHunk(n,`up`,u+i):this.expandHunk(n,`down`,d+i),!0}if(e<c)return!1}let o=bN({fileDiff:t,hunkIndex:t.hunks.length-1,expandedHunks:a,collapsedContextThreshold:r,errorPrefix:`FileDiff.revealLine`});if(o==null||o.renderAll)return!1;let s=t.hunks[t.hunks.length-1],[,c]=gN(s);return e<c+o.fromStart||e>=c+o.rangeSize?!1:(this.expandHunk(t.hunks.length,`up`,e-(c+o.fromStart)+1+i),!0)}shouldSelfHealEditSession(){return this.editor==null}escalateEditSessionRender(){Vy(this.handleEditSessionRender)}handleEditSessionRender=()=>{this.rerender(),this.flushDeferredLineState()};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(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();for(let{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){let e=this.fileContainer.shadowRoot??this.fileContainer.attachShadow({mode:`open`});this.placeHolder=document.createElement(`div`),this.placeHolder.dataset.placeholder=``,e.appendChild(this.placeHolder)}return this.placeHolder.style.setProperty(`height`,`${e}px`),!0}async primeHighlightCache(e=this.fileDiff){let{workerManager:t}=this;if(e==null||t==null||!t.isWorkingPool()||e.cacheKey==null||DP(e))return;let n=this.options.tokenizeMaxLength??1e5;Math.max(e.additionLines.length,e.deletionLines.length)>n||await t.primeDiffHighlightCache(e).catch(e=>{console.error(e)})}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.lastRenderedHeaderHTML=void 0,this.lastRowCount=void 0,this.mounted=!1}renderSeparators(e){let{hunkSeparators:t}=this.options;if(this.isContainerManaged||this.fileContainer==null||typeof t!=`function`){for(let{element:e}of this.separatorCache.values())e.remove();this.separatorCache.clear();return}let n=new Map(this.separatorCache);for(let r of e){let e=r.slotName,i=this.separatorCache.get(e);if(i==null||!qP(r,i.hunkData)){i?.element.remove();let n=document.createElement(`div`);n.style.display=`contents`,n.slot=r.slotName;let a=t(r,this);a!=null&&n.appendChild(a),this.fileContainer.appendChild(n),i={element:n,hunkData:r},this.separatorCache.set(e,i)}n.delete(e)}for(let[e,{element:t}]of n.entries())this.separatorCache.delete(e),t.remove()}renderAnnotations(){if(this.isContainerManaged||this.fileContainer==null){for(let{element:e}of this.annotationCache.values())e.remove();this.annotationCache.clear();return}let e=new Map(this.annotationCache),{renderAnnotation:t}=this.options;if(t!=null&&this.lineAnnotations.length>0)for(let[n,r]of this.lineAnnotations.entries()){let i=`${n}-${Vj(r)}`,a=this.annotationCache.get(i);if(a==null||!KP(r,a.annotation)){a?.element.remove();let e=t(r);if(e==null)continue;a={element:wM(Vj(r)),annotation:r},a.element.appendChild(e),this.fileContainer.appendChild(a.element),this.annotationCache.set(i,a)}e.delete(i)}for(let[t,{element:n}]of e.entries())this.annotationCache.delete(t),n.remove()}renderGutterUtility(){let{renderGutterUtility:e}=this.options;if(this.fileContainer==null||e==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let t=e(this.interactionManager.getHoveredLine);if(t!=null&&this.gutterUtilityContent!=null)return;if(t==null){this.gutterUtilityContent?.remove(),this.gutterUtilityContent=void 0;return}let n=TM();n.appendChild(t),this.fileContainer.appendChild(n),this.gutterUtilityContent=n}getOrCreateFileContainer(e,t){let{fileContainer:n}=this,r=e??n??document.createElement(`diffs-container`),i=n!==r;return n!=null&&i&&this.editor?.__captureFocusForDOMReplacement(),i&&this.emitPostRender(!0),this.fileContainer=r,n!=null&&i&&(this.lastRenderedHeaderHTML=void 0,this.headerElement=void 0),t!=null&&this.fileContainer.parentNode!==t&&t.appendChild(this.fileContainer),i&&this.adoptReusableShellElements(this.fileContainer),this.ensureSpriteSVG(this.fileContainer),this.fileContainer}adoptReusableShellElements(e){let{shadowRoot:t}=e;if(t!=null)for(let e of t.children)e instanceof SVGElement?this.spriteSVG??=e:BM(e)&&e.hasAttribute(`data-theme-css`)?(this.themeCSSStyle??=e,this.hasAdoptedThemeCSS=!0):BM(e)&&e.hasAttribute(`data-unsafe-css`)&&(this.unsafeCSSStyle??=e,this.appliedUnsafeCSS??=this.options.unsafeCSS??void 0)}ensureSpriteSVG(e){let t=e.shadowRoot??e.attachShadow({mode:`open`});if(this.spriteSVG==null){let e=document.createElement(`div`);e.innerHTML=bM;let t=e.firstChild;t instanceof SVGElement&&(this.spriteSVG=t)}this.spriteSVG!=null&&this.spriteSVG.parentNode!==t&&t.appendChild(this.spriteSVG)}getOrCreatePreNode(e){let 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(let 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){this.cleanupErrorWrapper(),this.placeHolder?.remove(),this.placeHolder=void 0;let{fileDiff:n}=this,r=this.cachedHeaderHTML??gC(e);if(this.cachedHeaderHTML=r,r!==this.lastRenderedHeaderHTML){let e=document.createElement(`div`);e.innerHTML=r;let n=e.firstElementChild;if(!(n instanceof HTMLElement))return;this.headerElement==null?t.shadowRoot?.prepend(n):t.shadowRoot?.replaceChild(n,this.headerElement),this.headerElement=n,this.lastRenderedHeaderHTML=r}if(this.isContainerManaged||n==null)return;let{renderCustomHeader:i,renderHeaderPrefix:a,renderHeaderFilenameSuffix:o,renderHeaderMetadata:s}=this.options;if(i!=null){let e=i(n)??void 0;this.headerCustom=this.upsertHeaderSlotElement(t,this.headerCustom,ky,e),this.headerPrefix?.remove(),this.headerFilenameSuffix?.remove(),this.headerMetadata?.remove(),this.headerPrefix=void 0,this.headerFilenameSuffix=void 0,this.headerMetadata=void 0;return}let c=a?.(n)??void 0,l=o?.(n)??void 0,u=s?.(n)??void 0;this.headerPrefix=this.upsertHeaderSlotElement(t,this.headerPrefix,Ey,c),this.headerFilenameSuffix=this.upsertHeaderSlotElement(t,this.headerFilenameSuffix,Dy,l),this.headerMetadata=this.upsertHeaderSlotElement(t,this.headerMetadata,Oy,u),this.headerCustom?.remove(),this.headerCustom=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,n,r){if(r==null){t?.remove();return}let i=t??this.createHeaderSlotElement(n);return t??e.appendChild(i),this.replaceHeaderSlotContent(i,r),i}replaceHeaderSlotContent(e,t){e.replaceChildren(),t instanceof Element?e.appendChild(t):e.innerText=`${t}`}createHeaderSlotElement(e){let t=document.createElement(`div`);return t.slot=e,t}injectUnsafeCSS(){let{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??=EM(),this.unsafeCSSStyle.parentNode!==t&&t.appendChild(this.unsafeCSSStyle),this.unsafeCSSStyle.textContent=NM(e),this.appliedUnsafeCSS=e)}}applyThemeState(e,t,n,r){let i=e.shadowRoot??e.attachShadow({mode:`open`}),a=r??n,o=this.options.theme??Ay,s=typeof o==`string`?o:{...o},c=kM(i);if(this.themeCSSStyle?.parentNode===i&&this.appliedThemeCSS?.themeStyles===t&&this.appliedThemeCSS.themeType===a&&this.appliedThemeCSS.scrollbarGutter===c){this.appliedThemeCSS.theme=s;return}if(this.hasAdoptedThemeCSS&&this.themeCSSStyle?.parentNode===i){this.hasAdoptedThemeCSS=!1,this.appliedThemeCSS={theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c};return}this.themeCSSStyle=UM({shadowRoot:i,currentNode:this.themeCSSStyle,themeCSS:PM(t,a,c)}),this.appliedThemeCSS=this.themeCSSStyle==null?void 0:{theme:s,themeStyles:t,themeType:a,baseThemeType:r,scrollbarGutter:c}}hydrateMeasuredScrollbar(){let e=this.fileContainer?.shadowRoot;e!=null&&this.themeCSSStyle!=null&&(this.themeCSSStyle.textContent=FM(this.themeCSSStyle.textContent??``,kM(e)))}shouldGuardRebuildScroll(){return this.editor!=null&&KM()}applyHunksToDOM(e,t){this.shouldGuardRebuildScroll()?HM(e,()=>this.replaceCodeColumns(e,t)):this.replaceCodeColumns(e,t)}applyCodeColumnsInPlace(e,t,n){let r=this.getColumnPair(e);if(r==null)return!1;let i=aF(t[0]),a=aF(t[1]);return i==null||a==null?!1:(r.gutter.innerHTML=gC(i),r.content.innerHTML=gC(a),n!==this.lastRowCount&&(r.gutter.style.setProperty(`grid-row`,`span ${n}`),r.content.style.setProperty(`grid-row`,`span ${n}`)),!0)}replaceCodeColumns(e,t){let{overflow:n=`scroll`}=this.options,r=(this.options.hunkSeparators??`line-info`)===`line-info`,i=n===`wrap`?t.rowCount:void 0;this.cleanupErrorWrapper(),this.applyPreNodeAttributes(e,t);let a=!1,o=[],s=this.hunksRenderer.renderCodeAST(`unified`,t),c=this.hunksRenderer.renderCodeAST(`deletions`,t),l=this.hunksRenderer.renderCodeAST(`additions`,t);this.editor?.__captureFocusForDOMReplacement(),s==null?c!=null||l!=null?(c==null?(this.codeDeletions?.remove(),this.codeDeletions=void 0):(a=this.codeDeletions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions=LM({code:this.codeDeletions,columnType:`deletions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeDeletions,c,t.rowCount)||(this.codeDeletions.innerHTML=this.hunksRenderer.renderPartialHTML(c)),o.push(this.codeDeletions)),l==null?(this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=a||this.codeAdditions==null||this.codeUnified!=null,this.codeUnified?.remove(),this.codeUnified=void 0,this.codeAdditions=LM({code:this.codeAdditions,columnType:`additions`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeAdditions,l,t.rowCount)||(this.codeAdditions.innerHTML=this.hunksRenderer.renderPartialHTML(l)),o.push(this.codeAdditions))):(this.codeUnified?.remove(),this.codeUnified=void 0,this.codeDeletions?.remove(),this.codeDeletions=void 0,this.codeAdditions?.remove(),this.codeAdditions=void 0):(a=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=LM({code:this.codeUnified,columnType:`unified`,rowSpan:i,containerSize:r}),this.applyCodeColumnsInPlace(this.codeUnified,s,t.rowCount)||(this.codeUnified.innerHTML=this.hunksRenderer.renderPartialHTML(s)),o.push(this.codeUnified)),o.length===0?e.textContent=``:a&&e.replaceChildren(...o),this.lastRowCount=t.rowCount}applyPartialRender({previousRenderRange:e,renderRange:t}){let{pre:n,codeUnified:r,codeAdditions:i,codeDeletions:a,options:{diffStyle:o=`split`}}=this;if(n==null||e==null||t==null||!Number.isFinite(e.totalLines)||!Number.isFinite(t.totalLines)||this.lastRowCount==null)return!1;let s=this.getCodeColumns(o,r,a,i);if(s==null)return!1;let c=e.startingLine,l=t.startingLine,u=c+e.totalLines,d=l+t.totalLines,f=Math.max(c,l),p=Math.min(u,d);if(p<=f)return!1;let m=Math.max(0,f-c),h=Math.max(0,u-p),g=this.trimColumns({columns:s,trimStart:m,trimEnd:h,previousStart:c,overlapStart:f,overlapEnd:p,diffStyle:o});if(g<0)throw Error(`FileDiff.applyPartialRender: failed to trim to overlap`);if(this.lastRowCount<g)throw Error(`FileDiff.applyPartialRender: trimmed beyond DOM row count`);let _=this.lastRowCount-g,v=(e,t)=>{if(!(t<=0||this.fileDiff==null))return this.hunksRenderer.renderDiff(this.fileDiff,{startingLine:e,totalLines:t,bufferBefore:0,bufferAfter:0})},y=v(l,Math.max(f-l,0));if(y==null&&l<f)return!1;let b=v(p,Math.max(d-p,0));if(b==null&&d>p)return!1;let x=(e,t)=>{if(e!=null){if(o===`unified`&&!Array.isArray(s))this.insertPartialHTML(o,s,e,t);else if(o===`split`&&Array.isArray(s))this.insertPartialHTML(o,s,e,t);else throw Error(`FileDiff.applyPartialRender.applyChunk: invalid chunk application`);_+=e.rowCount}};return this.cleanupErrorWrapper(),x(y,`afterbegin`),x(b,`beforeend`),this.lastRowCount!==_&&(this.applyRowSpan(o,s,_),this.lastRowCount=_),!0}insertPartialHTML(e,t,n,r){if(e===`unified`&&!Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`unified`,n);this.renderPartialColumn(t,e,r)}else if(e===`split`&&Array.isArray(t)){let e=this.hunksRenderer.renderCodeAST(`deletions`,n),i=this.hunksRenderer.renderCodeAST(`additions`,n);this.renderPartialColumn(t[0],e,r),this.renderPartialColumn(t[1],i,r)}else throw Error(`FileDiff.insertPartialHTML: Invalid argument composition`)}refreshSplitDiffView(){if(this.options.diffStyle!==`split`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`split`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(!Array.isArray(t))return;let n=(t,n)=>{if(n==null)return;let r=this.hunksRenderer.renderCodeAST(t,e),i=aF(r?.[0]),a=aF(r?.[1]);for(let[e,t]of[[n.gutter,i],[n.content,a]])if(t!=null&&e.childElementCount===t.length)for(let n=0;n<t.length;n++){let r=e.children[n],i=t[n].properties[`data-line-type`];i!=null&&r.dataset.lineType!==i&&(r.dataset.lineType=i)}};n(`deletions`,t[0]),n(`additions`,t[1])}refreshUnifiedDiffView(){if(this.options.diffStyle!==`unified`)return;let e=this.hunksRenderer.renderDiff(this.fileDiff,this.renderRange);if(e==null)return;let t=this.getCodeColumns(`unified`,this.codeUnified,this.codeDeletions,this.codeAdditions);if(t==null||Array.isArray(t))return;let n=this.hunksRenderer.renderCodeAST(`unified`,e),r=aF(n?.[0]),i=aF(n?.[1]),a=()=>{for(let[e,n]of[[t.gutter,r],[t.content,i]])n!=null&&(e.innerHTML=gC(n));e.rowCount!==this.lastRowCount&&(this.applyRowSpan(`unified`,t,e.rowCount),this.lastRowCount=e.rowCount)};this.shouldGuardRebuildScroll()?HM(this.pre,a):a(),this.renderSeparators(e.hunkData),this.managersDirty=!0,this.flushManagers(),this.syncRenderViewToEditor()}renderPartialColumn(e,t,n){if(e==null||t==null)return;let r=aF(t[0]),i=aF(t[1]);if(r==null||i==null)throw Error(`FileDiff.insertPartialHTML: Unexpected AST structure`);let a=i.at(0);n===`beforeend`&&a?.type===`element`&&typeof a.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(a.properties[`data-buffer-size`],e.content.children[e.content.children.length-1],e.gutter.children[e.gutter.children.length-1],r,i,!0);let o=i.at(-1);n===`afterbegin`&&o?.type===`element`&&typeof o.properties[`data-buffer-size`]==`number`&&this.mergeBuffersIfNecessary(o.properties[`data-buffer-size`],e.content.children[0],e.gutter.children[0],r,i,!1),e.gutter.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(r)),e.content.insertAdjacentHTML(n,this.hunksRenderer.renderPartialHTML(i))}mergeBuffersIfNecessary(e,t,n,r,i,a){if(!(t instanceof HTMLElement)||!(n instanceof HTMLElement))return;let o=this.getBufferSize(t.dataset);o!=null&&(a?(r.shift(),i.shift()):(r.pop(),i.pop()),this.updateBufferSize(t,o+e),this.updateBufferSize(n,o+e))}applyRowSpan(e,t,n){let r=e=>{e!=null&&(e.gutter.style.setProperty(`grid-row`,`span ${n}`),e.content.style.setProperty(`grid-row`,`span ${n}`))};if(e===`unified`&&!Array.isArray(t))r(t);else if(e===`split`&&Array.isArray(t))r(t[0]),r(t[1]);else throw Error(`dun fuuuuked up`)}trimColumnRows(e,t,n){let r=0,i=0,a=0,o=!1,s=n>=0;if(e==null)return 0;let c=Array.from(e.content.children),l=Array.from(e.gutter.children);if(c.length!==l.length)throw Error(`FileDiff.trimColumnRows: columns do not match`);for(;a<c.length&&!(t<=0&&!s&&!o);){let e=l[a],u=c[a];if(a++,!(e instanceof HTMLElement)||!(u instanceof HTMLElement))throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: invalid row elements`);if(o&&(o=!1,e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset||e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset)){e.remove(),u.remove(),i++;continue}if(`lineIndex`in e.dataset&&`lineIndex`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),t>0&&(t--,t===0&&(o=!0)),i++),r++;continue}if(`separator`in e.dataset&&`separator`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`annotation`&&`lineAnnotation`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`metadata`&&`noNewline`in u.dataset){(t>0||s&&r>=n)&&(e.remove(),u.remove(),i++);continue}if(e.dataset.gutterBuffer===`buffer`&&`contentBuffer`in u.dataset){let a=this.getBufferSize(u.dataset);if(a==null)throw Error(`FileDiff.trimColumnRows: invalid element`);if(t>0){let n=Math.min(t,a),r=a-n;r>0?(this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=n):(e.remove(),u.remove(),i+=a),t-=n,t===0&&r===0&&(o=!0)}else if(s){let t=r,o=r+a-1;if(n<=t)e.remove(),u.remove(),i+=a;else if(n<=o){let t=o-n+1,r=a-t;this.updateBufferSize(e,r),this.updateBufferSize(u,r),i+=t}}r+=a;continue}throw console.error({gutterElement:e,contentElement:u}),Error(`FileDiff.trimColumnRows: unknown row elements`)}return i}trimColumns({columns:e,diffStyle:t,overlapEnd:n,overlapStart:r,previousStart:i,trimEnd:a,trimStart:o}){let s=Math.max(0,r-i),c=n-i;if(c<0)throw Error(`FileDiff.trimColumns: overlap ends before previous`);let l=o>0,u=a>0;if(!l&&!u)return 0;let d=l?s:0,f=u?c:-1;if(t===`unified`&&!Array.isArray(e))return this.trimColumnRows(e,d,f);if(t===`split`&&Array.isArray(e)){let t=this.trimColumnRows(e[0],d,f),n=this.trimColumnRows(e[1],d,f);if(e[0]!=null&&e[1]!=null&&t!==n)throw Error(`FileDiff.trimColumns: split columns out of sync`);return e[0]==null?n:t}throw console.error({diffStyle:t,columns:e}),Error(`FileDiff.trimColumns: Invalid columns for diffType`)}getBufferSize(e){let 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;let t=e.children[0],n=e.children[1];if(!(!(t instanceof HTMLElement)||!(n instanceof HTMLElement)||t.dataset.gutter==null||n.dataset.content==null))return{gutter:t,content:n}}getCodeColumns(e,t,n,r){if(e===`unified`)return this.getColumnPair(t);{let e=this.getColumnPair(n),t=this.getColumnPair(r);return e!=null||t!=null?[e,t]: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??(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??(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:n,totalLines:r},i){let{diffIndicators:a=`bars`,disableBackground:o=!1,disableLineNumbers:s=!1,overflow:c=`scroll`,diffStyle:l=`split`}=this.options,u={type:`diff`,diffIndicators:a,disableBackground:o,disableLineNumbers:s,overflow:c,split:l!==`unified`&&t!=null&&n!=null,totalLines:r,customProperties:i};xM(u,this.appliedPreAttributes)||(zM(e,u),this.appliedPreAttributes=u)}applyErrorToDOM(e,t){this.cleanupErrorWrapper(),this.pre?.remove(),this.pre=void 0,this.appliedPreAttributes=void 0;let n=t.shadowRoot??t.attachShadow({mode:`open`});this.errorWrapper??=document.createElement(`div`),this.errorWrapper.dataset.errorWrapper=``,this.errorWrapper.textContent=``,n.appendChild(this.errorWrapper);let r=document.createElement(`div`);r.dataset.errorMessage=``,r.innerText=e.message,this.errorWrapper.appendChild(r);let i=document.createElement(`pre`);i.dataset.errorStack=``,i.innerText=e.stack??`No Error Stack`,this.errorWrapper.appendChild(i)}cleanupErrorWrapper(){this.errorWrapper?.remove(),this.errorWrapper=void 0}};function eF(e,t){return e==null||t==null?e==null&&t==null:ix(e,t)}function tF({fileDiff:e,oldFile:t,newFile:n}){return e!=null&&e.hunks.length>0||t!=null||n!=null}function nF({fileDiff:e,oldFile:t,newFile:n}){return e!=null||t!=null||n!=null}function rF(e,t,n=!1){return!n&&e==null&&t}function iF(e,t,n=!1){return e==null&&t&&!n}function aF(e){if(e!=null&&e.type===`element`)return e.children??[]}function oF(e,t){let n=null,r=()=>{if(!n||t.aborted)return;let i=e().closest(`.diff-main`);if(i){let t=i.getBoundingClientRect(),r=0;if(n.y>=t.bottom-110?r=Math.max(4,Math.min(20,(n.y-(t.bottom-110))/3)):n.y<=t.top+110&&(r=-Math.max(4,Math.min(20,(t.top+110-n.y)/3))),r){i.scrollTop+=r;let a=e().getBoundingClientRect(),o=Math.max(t.top+12,a.top+48),s=Math.min(t.bottom-12,a.bottom-48),c=Math.max(o,Math.min(n.y,s));document.dispatchEvent(new PointerEvent(`pointermove`,{clientX:n.x,clientY:c,pointerId:n.pointerId,pointerType:`touch`,bubbles:!0,composed:!0}))}}requestAnimationFrame(r)};e().addEventListener(`pointerdown`,e=>{e.pointerType!==`mouse`&&e.composedPath().some(e=>e instanceof HTMLElement&&e.hasAttribute?.(`data-column-number`))&&(n={pointerId:e.pointerId,x:e.clientX,y:e.clientY},requestAnimationFrame(r))},{capture:!0,signal:t}),document.addEventListener(`pointermove`,e=>{n&&e.pointerId===n.pointerId&&e.isTrusted&&(n.x=e.clientX,n.y=e.clientY)},{capture:!0,passive:!0,signal:t});for(let e of[`pointerup`,`pointercancel`])document.addEventListener(e,e=>{n&&e.pointerId===n.pointerId&&(n=null)},{capture:!0,signal:t})}var sF=`<div class=diff-file></div>`,cF=`background:var(--panel);border-block:1px solid var(--border);padding:.5rem .75rem;font-family:system-ui,sans-serif;font-size:.85rem;display:flex;flex-direction:column;gap:.35rem;`,lF=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;`,uF=new CSSStyleSheet;uF.replaceSync(`:host { display: block; max-width: 100%; overflow-x: auto; } @media (pointer: coarse) { pre[data-diff] { touch-action: pan-x pan-y; } [data-column-number], [data-gutter-utility-slot] { touch-action: none !important; } }`+Uv);var dF=at(`c0`,0),fF=N(11,L(`c1`,e=>Et(e,{file:e.d,comments:e.e,draft:e.f,onMount:function(){let t=t=>{if(!t)return;let n=document.createElement(`div`);n.style.cssText=cF;let r=document.createElement(`p`);r.textContent=t.text,r.style.cssText=`margin:0;white-space:pre-wrap;`;let i=document.createElement(`button`);return i.textContent=`remove`,i.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;align-self:flex-start;font-size:.75rem;opacity:.7;`,i.onclick=()=>e.g?.(t.id),n.append(r,i),n},n=()=>{let t=document.createElement(`div`);t.style.cssText=cF;let n=document.createElement(`textarea`);n.placeholder=`Leave a comment…`,n.rows=3,n.style.cssText=`font:inherit;width:100%;resize:vertical;border:1px solid var(--border);border-radius:var(--radius);padding:.4rem .5rem;background:inherit;color:inherit;`+(rr()?`font-size:16px;`:``);let r=document.createElement(`button`);r.textContent=`Comment`,r.style.cssText=`font:inherit;cursor:pointer;border:1px solid var(--border);border-radius:var(--radius);padding:.2rem .6rem;background:none;color:inherit;background:var(--accent);color:light-dark(#fff,#10131f);border-color:transparent;`;let i=document.createElement(`button`);i.textContent=`Cancel`,i.style.cssText=lF,r.onclick=()=>{n.value.trim()&&e.h?.(n.value)},i.onclick=()=>e.i?.(),n.onkeydown=e=>{e.key===`Enter`&&(e.metaKey||e.ctrlKey)&&r.onclick(),e.key===`Escape`&&i.onclick()};let a=document.createElement(`div`);a.style.cssText=`display:flex;gap:.4rem;`,a.append(r,i),t.append(n,a);let o=()=>n.scrollIntoView({block:`center`,behavior:`smooth`});return n.addEventListener(`focus`,()=>{let e=window.visualViewport;e&&(e.addEventListener(`resize`,o),n.addEventListener(`blur`,()=>e.removeEventListener(`resize`,o),{once:!0}))}),setTimeout(()=>{n.scrollIntoView({block:`center`,behavior:`instant`}),n.focus()},0),t},r=new Map,i,a={draft:!0},o,s=new $P({diffStyle:ir()?`unified`:`split`,disableFileHeader:!0,enableLineSelection:!0,onLineSelectionEnd(t){if(!t)return;let n=t.endSide!=null&&t.endSide!==t.side;e.j?.({side:t.side,start:t.start,end:n?t.start:t.end})},renderAnnotation(e){let r=e.metadata||{};return r.draft?o??=n():t(r.comment)}}),c=()=>{let t=[],n=new Map;for(let i of e.e||[]){let e=r.get(i.id)||{comment:i};n.set(i.id,e),t.push({side:i.side,lineNumber:i.line_end,metadata:e})}return r=n,e.f&&(i!==e.f&&(i=e.f,a={draft:!0},o=void 0),t.push({side:e.f.side,lineNumber:e.f.end,metadata:a})),t},l=()=>{let t=e.a.querySelector(`diffs-container`)?.shadowRoot;t&&!t.adoptedStyleSheets.includes(uF)&&(t.adoptedStyleSheets=[...t.adoptedStyleSheets,uF])},u=()=>{if(e.d.old==null&&e.d.new==null){e.k?.(`could not read ${e.d.path}`);return}let t=s.render({containerWrapper:e.a,oldFile:e.d.old==null?null:{name:e.d.oldPath||e.d.path,contents:e.d.old},newFile:e.d.new==null?null:{name:e.d.path,contents:e.d.new},lineAnnotations:c()});Promise.resolve(t).then(()=>{l(),fte(e.a)}).catch(t=>e.k?.(`diff render: ${t}`))};u();let d=new AbortController;return rr()&&oF(dF(e),d.signal),{instance:s,render:u,dragAbort:d,unregSearch:dte(e.a,e.d.key),shownFile:e.d,shownComments:e.e,shownDraft:e.f}},onUpdate:function(){(this.file!==this.shownFile||this.comments!==this.shownComments||this.draft!==this.shownDraft)&&(this.shownFile=this.file,this.shownComments=this.comments,this.shownDraft=this.draft,this.render())},onDestroy:function(){this.unregSearch(),this.dragAbort.abort(),this.instance.cleanUp?.()}})),7),pF=M(3,fF),mF=M(4,fF),hF=M(5,fF),gF=M(6,fF),_F=M(7,fF),vF=M(8,fF),yF=M(9,fF),bF=M(10,fF),xF=((e,t,n,r)=>`<div class=diff-view><aside class=tree></aside><div class=diff-col><div class=diff-head><!><span class="dim diff-stats"><!> file<!> changed <!><!></span><span class=head-actions></span></div><div class=diff-tools><button class="icon-btn tree-toggle">${e}</button><button class=icon-btn title="Refresh diff">${t}</button><button class="btn files-btn" title="Jump to file">Files (<!>)</button><button class="btn find-btn" title="Find in the review (⌘/Ctrl+F)">${n}<span class=find-label>Find</span></button><label class=two-dot title="Include uncommitted and untracked files in the review. Off by default — the review is commit-to-commit."><input type=checkbox> include uncommitted</label>${r}</div><!><div class=diff-main><!><!><!><!><!><!><!></div></div><!></div>`)(Zm,xo,mv,yv),SF=((e,t,n,r)=>`D bE%bD%c%c%b%l lD D/${e}&l D/${t}&l Db%l D/${n}&lD l/${r}&l%b D%b%b%b%b%b%b%m%l`)(Qm,So,hv,`D l`),CF=P(5,0,e=>V(e.a,e._.x)),wF=CF,TF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),EF=I(35,e=>{V(e.b,e._._._.q),TF(e)},e=>e._._._),DF=e=>{EF(e),OF(e)},OF=I(36,TF,e=>e._._._),kF=I(27,e=>V(e.b,e._._._.i),e=>e._._._),AF=e=>{kF(e),jF(e),NF(e),PF(e),FF(e),IF(e),LF(e)},jF=I(28,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),MF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),NF=I(29,e=>{V(e.c,e._._._.k),MF(e)},e=>e._._._),PF=I(30,MF,e=>e._._._),FF=I(31,MF,e=>e._._._),IF=I(32,MF,e=>e._._._),LF=I(33,MF,e=>e._._._),RF=N(2,e=>z(e.a,`title`,`checked out ${e._._._.q} ${e._._._.r}`)),zF=I(35,e=>{V(e.b,e._._._.q),RF(e)},e=>e._._._),BF=e=>{zF(e),VF(e)},VF=I(36,RF,e=>e._._._),HF=I(34,e=>V(e.a,e._._._.p),e=>e._._._),UF=HF,WF=I(27,e=>V(e.b,e._._._.i),e=>e._._._),GF=L(`e46`,e=>A(e.a,`click`,function(e){e.stopPropagation()})),KF=e=>{WF(e),qF(e),YF(e),XF(e),ZF(e),QF(e),$F(e),GF(e)},qF=I(28,e=>z(e.a,`href`,`${e._._._.j}/files`),e=>e._._._),JF=N(3,e=>z(e.a,`title`,`${e._._._.k} — ${e._._._.l} ${e._._._.m} vs ${e._._._.n} ${e._._._.o}`),4),YF=I(29,e=>{V(e.c,e._._._.k),JF(e)},e=>e._._._),XF=I(30,JF,e=>e._._._),ZF=I(31,JF,e=>e._._._),QF=I(32,JF,e=>e._._._),$F=I(33,JF,e=>e._._._),eI=N(10,e=>z(e.a,`title`,`origin/${e.h} ${e.i} · GitHub ${e.j}`),2),tI=M(7,eI),nI=M(8,e=>{V(e.c,iv(e.i)),eI(e)}),rI=M(9,e=>{V(e.d,iv(e.j)),eI(e)}),iI=(e,t)=>V(e.b,t>0?` · `:``),aI=(e,t)=>{tI(e,t[0]?.pr?.headRefName),rI(e,t[0]?.pr?.headRefOid),nI(e,t[0]?.head),iI(e,t[1])},oI=(e,t)=>V(e.a,t>0?` · `:``),sI=(e,t)=>V(e.b,t),cI=(e,t)=>V(e.c,t),lI=(e,t)=>{sI(e,t[0]?.worktree),cI(e,t[0]?.pr?.number),oI(e,t[1])},uI=(e,t)=>z(e.a,`value`,t),dI=N(7,e=>V(e.b,e.f||e.g)),fI=M(5,dI),pI=M(6,dI),mI=(e,t)=>{uI(e,t[0]?.id),fI(e,t[0]?.title),pI(e,t[0]?.agent)},hI=k(0,`<!><!> #<!>`,`%b%c%`,0,lI),gI=k(1,`<span><!><!> → <!></span>`,` D%b%c%`,0,aI),_I=I(147,e=>{hI(e,[e._._.c4,`id`]),gI(e,[e._._.c4,`id`])},e=>e._._),vI=dt(`e44`,`<span class=dim><!> — this view has a newer tip than the PR page.</span><span class="mono dim toast-meta"></span>`,`D%l `,_I),yI=O(5,`<span class=chip>local <!></span>`,` Db%`,DF),bI=N(6,e=>yI(e,+!e._._._.c2(e._._.c))),xI=I(146,bI,e=>e._._._),SI=e=>{xI(e),CI(e),DI(e),OI(e),AI(e),jI(e),MI(e)},CI=I(23,bI,e=>e._._),wI=O(0,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,AF),TI=N(9,e=>z(e.b,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),EI=N(7,e=>V(e.c,e._._.g?e._._.g.headRefName:e._._.q)),DI=I(25,e=>{wI(e,+!e._._.g),TI(e),EI(e)},e=>e._._),OI=I(31,TI,e=>e._._),kI=N(8,e=>z(e.d,`title`,`${e._._.n} ${e._._.o}`)),AI=I(32,e=>{V(e.e,e._._.n),kI(e)},e=>e._._),jI=I(33,kI,e=>e._._),MI=I(35,e=>{TI(e),EI(e)},e=>e._._),NI=P(24,0,e=>V(e.a,e._.bi.some(e=>e.pr)?`No file changes on these PRs.`:`No changes vs base.`)),PI=NI,FI=I(136,L(`e48`,e=>Et(e,{onMount:function(){e._._._._._._.bb(e.a,()=>{hR(e._,!0)})}})),e=>e._._._._._._),II=N(9,e=>{B(e.a,`closed`,e._._._.b4.has(e._._.d)),V(e.b,e._._._.b4.has(e._._.d)?`▸`:`▾`)}),LI=I(135,II,e=>e._._._),RI=L(`e47`,e=>A(e.a,`click`,function(){e._._._.b6(e._._.d)})),zI=e=>{LI(e),HI(e),UI(e),WI(e),JI(e),YI(e),XI(e),QI(e),$I(e),eL(e),RI(e)},BI=O(8,`<span class=chip>local <!></span>`,` Db%`,BF),VI=N(10,e=>BI(e,+!e._._._.c2(e._._.c))),HI=I(146,VI,e=>e._._._),UI=I(23,VI,e=>e._._),WI=I(24,II,e=>e._._),GI=O(3,`<a class="chip pr" target=_blank rel=noopener>#<!></a><span class=dim> </span>`,` Db%lD `,KF,`<span class=dim> </span>`,`D `,UF),KI=N(13,e=>z(e.e,`title`,`${e._._.g?`PR head`:`checked out`} ${e._._.g?e._._.g.headRefName:e._._.q} ${e._._.m}`),2),qI=N(11,e=>V(e.f,e._._.g?e._._.g.headRefName:e._._.q)),JI=I(25,e=>{GI(e,+!e._._.g),KI(e),qI(e)},e=>e._._),YI=I(26,e=>V(e.c,e._._.h),e=>e._._),XI=I(31,KI,e=>e._._),ZI=N(12,e=>z(e.g,`title`,`${e._._.n} ${e._._.o}`)),QI=I(32,e=>{V(e.h,e._._.n),ZI(e)},e=>e._._),$I=I(33,ZI,e=>e._._),eL=I(35,e=>{KI(e),qI(e)},e=>e._._),tL=N(3,e=>{B(e.a,`closed`,e._._._._.b3.has(e._._.c(e._.e))),V(e.b,e._._._._.b3.has(e._._.c(e._.e))?`▸`:`▾`)},2),nL=I(134,tL,e=>e._._._._),rL=L(`e32`,e=>A(e.a,`click`,function(){let t=new Set(e._._._._.b3);t.delete(e._._.c(e._.e))||t.add(e._._.c(e._.e)),jH(e._._._._,t)})),iL=e=>{nL(e),aL(e),oL._(e),sL._(e),cL._(e),rL(e)},aL=I(7,tL,e=>e._._),oL=P(0,0,e=>{z(e.a,`title`,e._.e),tL(e)}),sL=P(0,0,e=>_t(e.a,`padding-left:${.35+e._.f*.75}rem`)),cL=P(0,0,e=>V(e.c,e._.g)),lL=P(17,0,e=>my(e.a,e._.aw)),uL=e=>{lL._(e),dL._(e),fL._(e),Ete(e.a),py(e.a,vU(e))},dL=P(17,0,e=>ly(e.a,e._.bp)),fL=P(17,0,e=>fy(e.a,yU(e))),pL=I(130,e=>V(e.e,e._._.as?`, plus uncommitted`:``),e=>e._._),mL=e=>{pL(e),hL(e),gL(e),_L(e),vL(e)},hL=I(11,e=>V(e.a,iv(e._.h))),gL=I(12,e=>V(e.b,e._.i)),_L=I(13,e=>V(e.c,iv(e._.j))),vL=I(14,e=>V(e.d,e._.k)),yL=dt(`e45`,`this view is <!> (<!>). Local is <!> (<!><!>).`,`b%c%c%c%b%`,mL),bL=e=>{Ar(e.a,yL(e)),Cr(e.a,`info`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},xL=N(6,e=>Or(e.a,`${e.d} #${e.f}`)),SL=M(3,xL),CL=M(5,xL),wL=(e,t)=>{SL(e,t[0]?.worktree),CL(e,t[0]?.pr?.number),TL(e,t[0]?.pr?.headRefName),EL(e,t[0]?.head),DL(e,t[0]?.localHead),OL(e,t[0]?.branch)},TL=M(8,F(gL)),EL=M(7,F(hL)),DL=M(9,F(_L)),OL=M(10,F(vL)),kL=I(130,e=>V(e.b,e._._.as?` — showing uncommitted changes only`:``),e=>e._._),AL=e=>{kL(e),jL(e)},jL=I(7,e=>V(e.a,e._.g)),ML=dt(`e41`,`already in <!><!>.`,`b%b%`,AL),NL=e=>{Ar(e.a,ML(e)),Cr(e.a,`info`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},PL=N(5,e=>Or(e.a,e.d?`${e.e} #${e.d.number}`:e.e)),FL=M(3,PL),IL=M(4,PL),LL=(e,t)=>{FL(e,t[0]?.pr),IL(e,t[0]?.worktree),RL(e,t[0]?.base)},RL=M(6,F(jL)),zL=I(130,e=>V(e.b,e._._.as?` — showing uncommitted changes only`:``),e=>e._._),BL=e=>{zL(e),VL(e)},VL=I(5,e=>V(e.a,e._.e)),HL=dt(`e40`,`<!><!>.`,`%b%`,BL),UL=e=>{Ar(e.a,HL(e)),Cr(e.a,`warn`),Er(e.a,`inline`),Nr(e.a),Pr(e.a)},WL=(e,t)=>Or(e.a,`${t}: base not found`),GL=(e,t)=>{WL(e,t[0]?.worktree),KL(e,t[0]?.base)},KL=M(4,F(VL)),qL=N(1,e=>V(e.a,e._.ay.trim()?`No matches in diffs.`:`No files match "${e._.ar}".`)),JL=P(24,1,qL),YL=e=>{JL._(e),XL._(e)},XL=P(24,1,qL),ZL=I(125,e=>{z(e.a,`disabled`,e._._.am),V(e.b,e._._.am?`Reloading…`:`Reload`)},e=>e._._),QL=L(`e42`,e=>A(e.a,`click`,function(){e._._.c8()})),$L=dt(`e43`,`<button class=btn> </button>`,` D `,e=>{ZL(e),QL(e)}),eR=P(22,0,e=>Pr(e.a,bU(e))),tR=e=>{eR._(e),Nr(e.a,tn({content:$L(e)})),Ar(e.a,vI(e)),Cr(e.a,`info`),Er(e.a,`inline`),Or(e.a,`GitHub is behind`)},nR=I(124,e=>V(e.a,e._._.al),e=>e._._),rR=dt(`e39`,` `,` `,nR),iR=e=>{Ar(e.a,rR(e)),Pr(e.a,xU(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},aR=N(1,e=>hF(e.a,e._._._._._._.aj&&e._._._._._._.aj?.key===e._._.l?e._._._._._._.aj:null)),oR=I(123,aR,e=>e._._._._._._),sR=e=>{oR(e),lR(e),uR(e),dR(e),fR(e),pR(e),e.a,vF(e.a,CU(e)),bF(e.a,SU(e))},cR=N(2,e=>_F(e.a,wU(e))),lR=I(150,cR,e=>e._._._._._._),uR=I(151,e=>gF(e.a,TU(e)),e=>e._._._._._._),dR=I(26,e=>{pF(e.a,e._._.k),cR(e)},e=>e._._),fR=I(27,e=>{yF(e.a,EU(e)),aR(e)},e=>e._._),pR=I(28,e=>mF(e.a,e._._.w),e=>e._._),mR=O(0,`<div class=diff-wait></div>`,` `,FI,sF,(e=>`/${e}&`)(` b`),sR),hR=j(1,e=>mR(e,+!!e.b)),gR=e=>hR(e,!1),_R=O(6,`<span class=dim>✓</span>`),vR=N(10,e=>{B(e.a,`seen`,e._._.ag.has(e.j)),_R(e,+!e._._.ag.has(e.j))}),yR=I(121,vR,e=>e._._),bR=L(`e50`,e=>A(e.a,`click`,function(){CH(e._._,!1),e._._.ch(e.j)})),xR=e=>{yR(e),wR(e),bR(e)},SR=O(5,`<span>💬</span>`),CR=N(11,e=>SR(e,+!e._._.c0.has(e.j))),wR=I(145,CR,e=>e._._),TR=M(9,e=>{z(e.d,`title`,e.j),V(e.e,e.j),vR(e),CR(e)}),ER=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},DR=(e,t)=>{TR(e,t[0]?.key),ER(e,t[0]?.status)},OR=P(26,0,e=>V(e.b,e._.ai)),kR=L(`e51`,e=>{A(e.a,`click`,function(){CH(e._,!1)}),A(e.d,`click`,function(){CH(e._,!1)})}),AR=e=>{OR._(e),jR._(e),NR._(e),kR(e)},jR=P(26,0,e=>V(e.c,e._.bm)),MR=k(4,`<button class="sheet-file mono"><span> </span><span class=sheet-path><bdi> </bdi></span><!><!></button>`,` D D l E m%b%`,xR,DR),NR=P(26,0,e=>MR(e,[e._.bs,`key`])),PR=O(8,`<p class="dim diff-pad">binary file</p>`,0,0,`<p class="dim diff-pad">file too large to display</p>`,0,0,`<p class="dim diff-pad">file could not be read</p>`,0,0,`<!><!><!>`,`b%`,gR),FR=N(25,e=>PR(e,e.s?0:e.t?1:e.u==null&&e.v==null?2:e.y?3:4),4),IR=j(24,e=>{zt(e,`a`,e.y),FR(e)}),LR=N(12,e=>IR(e,!e._._._._.ag.has(e.l))),RR=N(15,e=>iee(e,`h`,e._._._._.ag.has(e.l),DU(e)),2),zR=I(121,e=>{LR(e),RR(e)},e=>e._._._._),BR=L(`e49`,e=>{A(e.a,`toggle`,function(t,n){if(IR(e,n.open),!n.open){let e=n.closest(`.diff-main`);if(e){let t=n.getBoundingClientRect().top-e.getBoundingClientRect().top;t<0&&(e.scrollTop+=t)}}}),A(e.g,`click`,function(e){e.stopPropagation()}),aee(e,`h`)}),VR=e=>{zR(e),UR(e),qR(e),JR(e),BR(e)},HR=N(13,e=>z(e.a,`hidden`,!e._._._._.bw.has(e.l))),UR=I(142,HR,e=>e._._._._),WR=F(pR),GR=M(22,e=>{XR(e,e.w.length),WR(e)}),KR=N(14,e=>GR(e,e._._._._.c0.get(e.l)||[])),qR=I(145,KR,e=>e._._._._),JR=I(149,RR,e=>e._._._._),YR=O(5,`<span class=chip>💬 <!></span>`,`Db%`,wF),XR=M(23,e=>{YR(e,+!e.x),CF(e)}),ZR=F(fR),QR=M(11,e=>{z(e.a,`data-key`,e.l),KR(e),LR(e),HR(e),RR(e),ZR(e)}),$R=(e,t)=>{ht(e.b,[`status`,t]),V(e.c,t)},ez=(e,t)=>{z(e.d,`title`,t),V(e.e,t)},tz=M(18,FR),nz=M(19,FR),rz=M(20,FR),iz=M(21,FR),az=(e,t)=>sz(e,t[0]),oz=F(dR),sz=M(10,e=>{QR(e,e.k?.key),$R(e,e.k?.status),ez(e,e.k?.path),tz(e,e.k?.binary),nz(e,e.k?.tooLarge),rz(e,e.k?.old),iz(e,e.k?.new),oz(e)}),cz=k(0,`<details class=file><summary><span> </span><span class=path><bdi> </bdi></span><!><label class=viewed><input type=checkbox><span class=dim>viewed</span></label></summary><!></details>`,` E D l E m%b D m%`,VR,az),lz=I(37,e=>cz(e,[e._._.s,`key`]),e=>e._._),uz=lz,dz=N(5,e=>z(e.a,`hidden`,!e._.w&&!e._.g&&e._._.b2!==e._.d),3),fz=I(133,dz,e=>e._._),pz=e=>{fz(e),gz(e),vz(e),yz._(e),xz._(e),Sz._(e),Cz._(e)},mz=O(2,`<div class=files></div>`,` `,uz),hz=N(4,e=>mz(e,e._._.bk>1&&e._._.b4.has(e._.d)?1:0),2),gz=I(135,hz,e=>e._._),_z=O(1,`<button class=repo-sep><span class=tree-chev> </span><span class=mono> </span><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></button>`,` E lD l%b Db%l Db%l%`,zI,`<p class=repo-meta><!><span class="chip lane">on <!></span><span class=chip>vs <!></span><!></p>`,`D%b Db%l Db%l%`,SI),vz=I(138,e=>{_z(e,e._._.bk>1?0:1),hz(e)},e=>e._._),yz=P(0,0,e=>{dz(e),hz(e)}),bz=N(3,e=>z(e.a,`data-pr`,e._.g?`${e._.h}/${e._.g.number}`:void 0)),xz=P(0,0,e=>{bz(e),dz(e)}),Sz=P(0,0,bz),Cz=P(0,0,dz),wz=F(lz),Tz=M(18,e=>{Pz(e,e.s.length),wz(e)}),Ez=N(4,e=>Tz(e,e._.bx.get(e.d)||[])),Dz=Ke(25,Ez),Oz=e=>{Dz._(e),jz._(e)},kz=(e,t)=>Lz(e,t.length),Az=N(5,e=>kz(e,e._.by.get(e.d)||[])),jz=Ke(25,Az),Mz=O(0,`<section class=repo-section><!><!></section>`,` D%b%`,pz),Nz=N(20,e=>Mz(e,e.t||e.g?0:1)),Pz=M(19,Nz),Fz=F(WI),Iz=M(3,e=>{Ez(e),Az(e),yz(e),Fz(e)}),Lz=M(22,Cz),Rz=F(JI,DI),zz=M(6,e=>{Uz(e,e.g?.number),Wz(e,e.g?.url),Gz(e,e.g?.title),Kz(e,e.g?.headRefName),Nz(e),xz(e),Rz(e)}),Bz=(e,t)=>Hz(e,t[0]),Vz=F(UI,CI),Hz=M(2,e=>{Iz(e,e.c?.id),zz(e,e.c?.pr),Jz(e,e.c?.worktree),Yz(e,e.c?.head),Xz(e,e.c?.base),Zz(e,e.c?.baseSha),Qz(e,e.c?.full_name),$z(e,e.c?.branch),eB(e,e.c?.localHead),Vz(e)}),Uz=M(8,F(WF,kF)),Wz=M(9,F(qF,jF)),Gz=M(10,F(YF,NF)),Kz=M(11,F(XF,PF)),qz=F(YI),Jz=M(7,e=>{Sz(e),qz(e)}),Yz=M(12,F(XI,OI,ZF,FF)),Xz=M(13,F(QI,AI,QF,IF)),Zz=M(14,F($I,jI,$F,LF)),Qz=M(15,F(HF)),$z=M(16,F(eL,MI,zF,EF)),eB=M(17,F(VF,OF)),tB=N(5,e=>B(e.a,`seen`,e._._._._.ag.has(e._.i))),nB=I(121,tB,e=>e._._._._),rB=L(`e33`,e=>A(e.a,`click`,function(){e._._._._.ch(e._.i)})),iB=e=>{nB(e),sB(e),cB._(e),lB._(e),uB._(e),dB._(e),fB._(e),rB(e)},aB=O(4,`<span class=tree-note>💬</span>`),oB=N(6,e=>aB(e,+!e._._._._.c0.has(e._.i))),sB=I(145,oB,e=>e._._._._),cB=P(0,1,e=>_t(e.a,`padding-left:${.5+e._.f*.75}rem`)),lB=P(0,1,e=>{tB(e),oB(e)}),uB=P(0,1,e=>z(e.a,`title`,e._.j)),dB=P(0,1,e=>{ht(e.b,[`status`,e._.k]),V(e.c,e._.k)}),fB=P(0,1,e=>V(e.d,e._.l)),pB=O(0,`<button class="tree-dir dim mono"><span class=tree-chev> </span><!>/</button>`,` E l%`,iL,`<button class="tree-file mono"><span> </span><span class=tree-file-name> </span><!></button>`,` D D lD l%`,iB),mB=N(3,e=>pB(e,!e._.f(e.c)&&e.c?.kind===`dir`?0:!e._.f(e.c)&&e.c?.kind!==`dir`?1:2)),hB=Ke(0,mB),gB=hB,_B=M(2,e=>{yB(e,e.c?.path),bB(e,e.c?.depth),xB(e,e.c?.label),SB(e,e.c?.file?.key),CB(e,e.c?.file?.path),wB(e,e.c?.file?.status),TB(e,e.c?.name),mB(e)}),vB=(e,t)=>_B(e,t[0]),yB=M(4,oL),bB=M(5,e=>{cB(e),sL(e)}),xB=M(6,cL),SB=M(8,lB),CB=M(9,uB),wB=M(10,dB),TB=M(11,fB),EB=M(5,hB),DB=N(4,e=>EB(e,OU(e)),2),OB=I(134,DB,e=>e._._),kB=M(3,DB),AB=e=>{OB(e),PB(e),IB._(e),kB(e,kU)},jB=k(0,`<!><!><!>`,`b%`,gB,vB),MB=(e,t)=>jB(e,[t,e=>e.kind===`dir`?`d:${e.path}`:e.file.key]),NB=N(6,e=>MB(e,cv(e._._.by.get(e._.g)||[]))),PB=I(144,NB,e=>e._._),FB=M(2,F(aL)),IB=P(3,0,e=>{FB(e,AU(e)),NB(e),DB(e)}),LB=O(3,`<!><!><!>`,`b%`,AB),RB=N(7,e=>{B(e.a,`closed`,e._.b4.has(e.g)),V(e.b,e._.b4.has(e.g)?`▸`:`▾`),LB(e,+!!e._.b4.has(e.g))}),zB=Ke(0,RB),BB=L(`e34`,e=>A(e.a,`click`,function(){e._.b6(e.g)})),VB=e=>{zB._(e),BB(e)},HB=M(6,e=>{RB(e),IB(e)}),UB=N(10,e=>V(e.c,e.i?`${e.j} #${e.i.number}`:e.j)),WB=M(8,UB),GB=M(9,UB),KB=(e,t)=>{HB(e,t[0]?.id),WB(e,t[0]?.pr),GB(e,t[0]?.worktree)},qB=k(2,`<option> </option>`,` D `,0,mI),JB=I(118,e=>qB(e,[e._._.a7,`id`]),e=>e._._),YB=L(`e37`,e=>{A(e.a,`click`,function(){e._._.cg(e._._.c1)}),It(e,`c`)}),XB=e=>{JB(e),ZB(e),QB(e),YB(e)},ZB=I(127,e=>{z(e.a,`disabled`,e._._.ao),V(e.b,e._._.ao?`Sending…`:`Send to`),z(e.c,`disabled`,e._._.ao)},e=>e._._),QB=I(128,e=>Ft(e,`c`,e._._.ap,jU(e)),e=>e._._),$B=N(2,e=>V(e.b,e._._.ao?`Sending…`:`Send to ${e._._.ab||e._._.ac}`),2),eV=I(119,$B,e=>e._._),tV=L(`e36`,e=>A(e.a,`click`,function(){e._._.cg(e._._.c1)})),nV=e=>{eV(e),rV(e),iV(e),tV(e)},rV=I(120,$B,e=>e._._),iV=I(127,e=>{z(e.a,`disabled`,e._._.ao),$B(e)},e=>e._._),aV=O(2,`<button class="btn primary"> </button>`,` D `,nV,`<span class="split-btn primary"><button> </button><select aria-label="Send comments to session"></select></span>`,`D D l `,XB),oV=P(6,0,e=>aV(e,(e._.a7||[]).length===1?0:(e._.a7||[]).length?1:2)),sV=L(`e38`,e=>A(e.a,`click`,function(){e._.cf()})),cV=e=>{oV._(e),lV._(e),sV(e)},lV=P(6,0,e=>V(e.b,e._.an?`Copied ✓`:`Copy`)),uV=L(`e35`,e=>A(e.a,`click`,function(){e._.aa?.()})),dV=e=>{dv(e.b),fv(e.b,14),pv(e.b),uV(e)},fV=N(79,L(`e53`,e=>Et(e,{active:e.a5,load:e.be,onMount:function(){let t=new AbortController,n={abort:t,loaded:!1,lastPr:e.a4||``,lastNonce:e.a6||0,start:()=>{this.active&&!n.loaded&&(n.loaded=!0,this.load())}};return Cn().addEventListener(`review.changed`,t=>{n.loaded&&t.data?.workspaceId===e.a3&&e.bg()},{signal:t.signal}),window.addEventListener(`keydown`,t=>{this.active&&(!(t.metaKey||t.ctrlKey)||t.altKey||t.shiftKey||t.key.toLowerCase()===`f`&&(t.target instanceof HTMLTextAreaElement||t.target?.closest?.(`.palette`)||(t.preventDefault(),TH(e,!0),DH(e,e.aw+1))))},{capture:!0,signal:t.signal}),n.start(),n},onUpdate:function(){this.start();let t=e.a4||``,n=e.a6||0;this.loaded&&t&&n!==this.lastNonce?(this.lastNonce=n,this.lastPr=t,e.bc(t)):(this.lastPr=t,this.lastNonce=n)},onDestroy:function(){this.abort.abort()}})),7),pV=M(106),mV=N(77,e=>pV(e,MU(e))),hV=M(76,e=>{fV(e),mV(e)}),gV=N(75,e=>hV(e,NU(e)),3),_V=M(74,e=>{gV(e),fV(e)}),vV=M(94,F(UR)),yV=k(0,`<div class=tree-repo><button class="tree-repo-name mono"><span class=tree-chev> </span> </button><!></div>`,`D E l l%`,VB,KB),bV=N(97,e=>yV(e,[e.bi.filter(t=>e.by.get(t.id)?.length),`id`])),xV=F(PB),SV=M(96,e=>{bV(e),xV(e),jz(e)}),CV=N(91,e=>SV(e,new Map(e.bi.map(t=>[t.id,e.bs.filter(e=>e.repo===t.id)])))),wV=M(90,e=>{cU(e,e.bs?.length),vV(e,new Set(e.bs.map(e=>e.key))),CV(e),NR(e)}),TV=N(89,e=>wV(e,e.bq?e.bp.filter(t=>e.bq.has(t.key)||t.key===e.b1):e.bp),2),EV=M(87,e=>{TV(e),dL(e)}),DV=N(86,e=>EV(e,e.bl.filter(t=>e.bn(t.key)))),OV=M(83,e=>{sU(e,e.bl?.length),DV(e)}),kV=k(20,sr,(e=>`/${e}&`)(cr),UL,GL),AV=k(21,sr,(e=>`/${e}&`)(cr),NL,LL),jV=k(25,`<!><!><!>`,`b%`,Oz,Bz),MV=M(105,eR),NV=N(103,e=>MV(e,FU(e))),PV=F(_I),FV=M(102,e=>{fU(e,e.c4?.length),NV(e),PV(e)}),IV=N(81,e=>FV(e,e.bi.filter(t=>t.githubDrift&&!e.b5.has(t.id)))),LV=k(23,sr,(e=>`/${e}&`)(cr),bL,wL),RV=N(101,e=>LV(e,[e.bi.filter(e.c2),`id`])),zV=M(80,e=>{oU(e,e.bi.length),OV(e,e.bi.flatMap(e=>e.files.map(t=>({...t,repo:e.id,key:`${e.worktree}/${t.path}`})))),kV(e,[e.bi.filter(e=>e.baseMissing),`id`]),AV(e,[e.bi.filter(e=>e.contained&&e.files.length),`id`]),jV(e,[e.bi,`id`]),CV(e),IV(e),bV(e),RV(e),NI(e)}),BV=M(95,Dz),VV=e=>{BV(e,new Map(e.bi.map(t=>[t.id,e.bl.filter(e=>e.repo===t.id)])))},HV=M(113),UV=N(111,e=>HV(e,IU(e)),2),WV=M(114),GV=N(112,e=>WV(e,LU(e)),3),KV=O(24,`<p class="dim center-pad"> </p>`,`D `,PI,`<p class="dim center-pad"> </p>`,`D `,YL),qV=N(93,e=>KV(e,e.ad&&!e.bm?0:e.ad&&!e.bu&&!e.b0?1:2),3),JV=j(39,e=>{_V(e,PU(e)),zV(e,e.ad||[]),VV(e),UV(e),GV(e),qV(e)}),YV=M(98,F(sB,qR,wR)),XV=M(109,F(uR)),ZV=M(108,F(lR)),QV=N(46,e=>ZV(e,zU(e)),2),$V=j(40,e=>{UH(e,e.ae?.length),YV(e,(()=>{let t=new Map;for(let n of e.ae){let e=`${n.worktree}/${n.path}`;t.set(e,[...t.get(e)||[],n])}return t})()),XV(e,RU(e)),QV(e),UV(e),GV(e)}),eH=M(107,F(JR)),tH=N(43,e=>eH(e,BU(e))),nH=F(nB,zR,yR),rH=j(42,e=>{WH(e,e.ag?.size),tH(e),nH(e)}),iH=F(oR),aH=j(45,e=>{QV(e),iH(e)}),oH=O(19,sr,(e=>`/${e}&`)(cr),iR),sH=F(nR),cH=j(47,e=>{oH(e,+!e.al),sH(e)}),lH=F(ZL),uH=j(48,e=>{B(e.j,`spinning`,e.am),z(e.j,`disabled`,e.am),lH(e)}),dH=j(49,lV),fH=j(50,F(iV,ZB)),pH=M(99),mH=N(52,e=>pH(e,(e.a7||[]).some(t=>t.id===e.ap)?e.ap:e.a7?.[0]?.id??null)),hH=F(QB),gH=j(51,e=>{mH(e),hH(e)}),_H=M(85,DV),vH=j(53,e=>{Ev(e.q,e.ar),_H(e,$_(e.ar)),JL(e)}),yH=F(zL,kL,pL),bH=j(54,e=>{kt(e,`p`,e.as),gV(e),mV(e),yH(e)}),xH=j(55,e=>{B(e.a,`closed`,!e.at),B(e.h,`on`,e.at),z(e.h,`title`,e.at?`Hide file tree`:`Show file tree`)}),SH=O(26,`<div class=sheet-backdrop></div><div class=file-sheet role=dialog aria-label="Jump to file"><div class=sheet-head><strong>Files</strong><span class=dim><!>/<!> viewed</span><button class=icon-btn title=Close>×</button></div><div class=sheet-list></div></div>`,` bEbD%c%l l `,AR),CH=j(56,e=>SH(e,+!e.au)),wH=O(17,_te,(e=>`/${e}&`)(vte),uL),TH=j(57,e=>{B(e.n,`on`,e.av),wH(e,+!e.av)}),EH=M(116),DH=j(58,e=>{EH(e,VU(e)),fV(e),lL(e)}),OH=M(88,TV),kH=e=>{OH(e,e.ay.trim()?new Set(e.az):null)},AH=j(59,e=>{GH(e,e.ax?.query),KH(e,e.ax?.keys),qH(e,e.ax?.hit),kH(e)}),jH=j(65,F(OB,nL)),MH=M(68),NH=F(gz,LI),PH=j(66,e=>{MH(e,HU(e)),zB(e),NH(e)}),FH=j(67,e=>{IV(e),NV(e)}),IH=(e,t)=>{QH(e,t.cbs),$H(e,t.io)},LH=M(100,RV),RH=M(117),zH=M(115,e=>RH(e,WU(e))),BH=L(`e52`,e=>{A(e.h,`click`,function(){xH(e,!e.at),qn(e.at)}),A(e.j,`click`,function(){e.c8()}),A(e.l,`click`,function(){CH(e,!0)}),A(e.n,`click`,function(){e.ci()}),A(e.p,`change`,function(t){bH(e,t.target.checked),Yn(e.as),e.be(e.as)})});function VH(e){$m(e.i),eh(e.i,14),th(e.i),Co(e.k),wo(e.k,14),To(e.k),gv(e.o),_v(e.o,14),vv(e.o),jv(e.q),Mv(e.q,KU(e)),JV(e,null),$V(e,[]),rH(e,new Set),aH(e,null),cH(e,null),uH(e,!1),dH(e,!1),fH(e,!1),gH(e,null),vH(e,``),bH(e,Jn()),xH(e,Kn()),CH(e,!1),TH(e,!1),DH(e,0),AH(e,{query:``,hit:null,keys:[]}),jH(e,new Set),PH(e,new Set),FH(e,new Set),IH(e,{io:null,cbs:null}),LH(e,UU),zH(e,GU(e)),BH(e)}var HH=O(6,`<button class=btn title="Copy comments as markdown"> </button><!><!>`,` D l%`,cV),UH=M(41,e=>{V(e.f,e.af?`· ${pt(e.af)} comment${pt(e.af===1?``:`s`)}`:``),HH(e,+!e.af)}),WH=M(44,e=>{V(e.e,e.ai?` · ${pt(e.ai)} viewed`:``),OR(e)}),GH=M(60,XL),KH=M(61),qH=M(62,e=>{JH(e,e.b0?.key),YH(e,e.b0?.repo),qV(e)}),JH=M(63,TV),YH=M(64,F(fz)),XH=M(73),ZH=N(72,e=>XH(e,qU(e))),QH=M(70,ZH),$H=M(71,ZH),eU=M(78,fV),tU=M(110,e=>{UV(e),GV(e)}),nU=M(29,e=>{eU(e,JU(e)),tU(e,YU(e)),gV(e),fV(e),tH(e),QV(e)}),rU=M(30,e=>{gV(e),fV(e)}),iU=M(31,fV),aU=M(32,fV),oU=M(82,F(vz)),sU=M(84,e=>{V(e.c,e.bm),V(e.d,e.bm===1?``:`s`),qV(e),jR(e)}),cU=M(92,e=>{V(e.m,e.bu),qV(e)}),lU=F(JB),uU=M(33,e=>{gU(e,e.a7?.[0]?.title),_U(e,e.a7?.[0]?.agent),mH(e),oV(e),lU(e)}),dU=O(22,sr,(e=>`/${e}&`)(cr),tR),fU=(e,t)=>dU(e,+!t),pU=M(35,GV),mU=O(1,(e=>`<button class=icon-btn title="Back to terminal">${e}</button>`)(lv),(e=>` D/${e}&l`)(uv),dV),hU=M(36,e=>mU(e,+!e.aa)),gU=M(37,F(eV)),_U=M(38,F(rV));function vU(e){return function(){TH(e._,!1),AH(e._,{query:``,hit:null,keys:[]})}}function yU(e){return function(t){e._.cj(t)}}function bU(e){return function(){e._.c7()}}function xU(e){return function(){cH(e._,null)}}function SU(e){return function(t){cH(e._._._._._._,t)}}function CU(e){return function(){aH(e._._._._._._,null)}}function wU(e){return function(t){e._._._._._._.ca(e._._.k,t)}}function TU(e){return function(t){e._._._._._._.cb(t)}}function EU(e){return function(t){aH(e._._._._._._,{key:e._._.l,side:t.side||`additions`,start:Math.min(t.start,t.end),end:Math.max(t.start,t.end)})}}function DU(e){return function(){e._._._._.c9(e.l)}}function OU(e){return t=>{let n=e.d(t);for(let r of e._._.b3){let[i,a]=[r.slice(0,r.indexOf(`/`)),r.slice(r.indexOf(`/`)+1)];if(i===e._.g&&(t.kind!==`dir`||t.path!==a)&&(n===a||n.startsWith(`${a}/`)))return!0}return!1}}function kU(e){return e.kind===`dir`?e.path:e.file.path.includes(`/`)?e.file.path.slice(0,e.file.path.lastIndexOf(`/`)):``}function AU(e){return t=>`${e._.g}/${t}`}function jU(e){return t=>{gH(e._._,t)}}function MU(e){return()=>(FH(e,new Set),e.be(e.as,!0))}function NU(e){return async(t=e.as,n=!1)=>{uH(e,!0),cH(e,null);try{let r=new URLSearchParams;t&&r.set(`uncommitted`,`1`),n&&r.set(`refresh`,`1`);let i=r.size?`?${r}`:``,[a,o]=await Promise.all([H(`/api/workspaces/${e.a3}/diff${i}`),H(`/api/workspaces/${e.a3}/review`)]);JV(e,a),$V(e,o.comments||[]),rH(e,new Set(o.viewed||[])),e.a4&&e.bc(e.a4)}catch(t){cH(e,String(t.message||t))}uH(e,!1)}}function PU(e){return t=>{if(!t)return;let n=e.ad||[],r=n.find(e=>e.pr&&`${e.worktree}/${e.pr.number}`===t),i=new Set;for(let e of n)(!r||e.id!==r.id)&&i.add(e.id);PH(e,i);let a=Date.now(),o=()=>{let e=scrollEl?.(),n=e?.querySelector(`[data-pr="${CSS.escape(t)}"]`);if(!e||!n){Date.now()-a<2500&&requestAnimationFrame(o);return}let r=n.getBoundingClientRect().top-e.getBoundingClientRect().top+e.scrollTop;e.scrollTo({top:Math.max(0,r-8)})};requestAnimationFrame(o)}}function FU(e){return()=>{FH(e,new Set([...e.b5,...e.c4.map(e=>e.id)]))}}function IU(e){return async()=>{if(!await X_(nv(e.ae,e.ad))){cH(e,`Copy failed — clipboard needs HTTPS on this browser.`);return}dH(e,!0),setTimeout(()=>{dH(e,!1)},1500),await e.cc()}}function LU(e){return async t=>{if(t){fH(e,!0);try{await H(`/api/sessions/${t}/send`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({text:`Please address this review feedback, then summarize what you changed.\n\n${nv(e.ae,e.ad)}`,...Q_()||{}})}),fH(e,!1),await e.cc(),e.a9?.(t)}catch(t){cH(e,String(t.message||t)),fH(e,!1)}}}}function RU(e){return async t=>{$V(e,e.ae.filter(e=>e.id!==t)),await fetch(`/api/review-comments/${t}`,{method:`DELETE`})}}function zU(e){return async(t,n)=>{let r=e.aj;aH(e,null);try{let i=await H(`/api/workspaces/${e.a3}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`comment`,worktree:t.repo,path:t.path,side:r.side,line_start:r.start,line_end:r.end,text:n.trim()})});$V(e,e.ae.concat(i))}catch(t){cH(e,String(t.message||t))}}}function BU(e){return t=>{let n=new Set(e.ag),r=!n.has(t);r?n.add(t):n.delete(t),rH(e,n),fetch(`/api/workspaces/${e.a3}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`viewed`,key:t,viewed:r})}).catch(()=>{cH(e,`Saving viewed state failed — it may reset on reload.`)})}}function VU(e){return()=>{TH(e,!0),DH(e,e.aw+1)}}function HU(e){return t=>{let n=new Set(e.b4);n.delete(t)||n.add(t),PH(e,n)}}function UU(e){return!!e.pr&&!!e.localHead&&(e.localHead!==e.head||e.branch!==e.pr.headRefName)}function WU(e){return t=>{AH(e,t),t.hit&&setTimeout(()=>e.ch(t.hit.key),0)}}function GU(e){return t=>{let n=e.s.querySelector(`details[data-key="${CSS.escape(t)}"]`);n&&(n.open=!0,n.scrollIntoView({block:`start`}))}}function KU(e){return function(t){vH(e,t)}}function qU(e){return(t,n)=>{e.b8??=new WeakMap,e.b9??=new IntersectionObserver(t=>{for(let n of t)n.isIntersecting&&(e.b9.unobserve(n.target),e.b8.get(n.target)?.())},{rootMargin:`600px 0px`}),e.b8.set(t,n),e.b9.observe(t)}}function JU(e){return async()=>{try{let t=await H(`/api/workspaces/${e.a3}/review`);$V(e,t.comments||[]),rH(e,new Set(t.viewed||[]))}catch{}}}function YU(e){return async()=>{$V(e,[]),aH(e,null),await fetch(`/api/workspaces/${e.a3}/review`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`clear`})})}}R(`e24`,vU),R(`e23`,yU),R(`e26`,bU),R(`e25`,xU),R(`e31`,SU),R(`e29`,CU),R(`e28`,wU),R(`e30`,TU),R(`e27`,EU),R(`e1`,DU),R(`e21`,OU),R(`e20`,kU),R(`e19`,AU),R(`e0`,jU),R(`e9`,MU),R(`e5`,NU),R(`e4`,PU),R(`e8`,FU),R(`e14`,IU),R(`e15`,LU),R(`e12`,RU),R(`e11`,zU),R(`e10`,BU),R(`e17`,VU),R(`e2`,HU),R(`e7`,UU),R(`e18`,WU),R(`e16`,GU),R(`e22`,KU),R(`e3`,qU),R(`e6`,JU),R(`e13`,YU);var XU=Object.defineProperty,ZU=Object.getOwnPropertyDescriptor,QU=(e,t)=>{for(var n in t)XU(e,n,{get:t[n],enumerable:!0})},$U=(e,t,n,r)=>{for(var i=r>1?void 0:r?ZU(t,n):t,a=e.length-1,o;a>=0;a--)(o=e[a])&&(i=(r?o(t,n,i):o(i))||i);return r&&i&&XU(t,n,i),i},J=(e,t)=>(n,r)=>t(n,r,e),eW=`Terminal input`,tW={get:()=>eW,set:e=>eW=e},nW=`Too much output to announce, navigate to rows manually to read`,rW={get:()=>nW,set:e=>nW=e};function iW(e){return e.replace(/\r?\n/g,`\r`)}function aW(e,t){return t?`\x1B[200~`+e+`\x1B[201~`:e}function oW(e,t){e.clipboardData&&e.clipboardData.setData(`text/plain`,t.selectionText),e.preventDefault()}function sW(e,t,n,r){e.stopPropagation(),e.clipboardData&&cW(e.clipboardData.getData(`text/plain`),t,n,r)}function cW(e,t,n,r){e=iW(e),e=aW(e,n.decPrivateModes.bracketedPasteMode&&r.rawOptions.ignoreBracketedPasteMode!==!0),n.triggerDataEvent(e,!0),t.value=``}function lW(e,t,n){let r=n.getBoundingClientRect(),i=e.clientX-r.left-10,a=e.clientY-r.top-10;t.style.width=`20px`,t.style.height=`20px`,t.style.left=`${i}px`,t.style.top=`${a}px`,t.style.zIndex=`1000`,t.focus()}function uW(e,t,n,r,i){lW(e,t,n),i&&r.rightClickSelect(e),t.value=r.selectionText,t.select()}function dW(e){return e>65535?(e-=65536,String.fromCharCode((e>>10)+55296)+String.fromCharCode(e%1024+56320)):String.fromCharCode(e)}function fW(e,t=0,n=e.length){let r=``;for(let i=t;i<n;++i){let t=e[i];t>65535?(t-=65536,r+=String.fromCharCode((t>>10)+55296)+String.fromCharCode(t%1024+56320)):r+=String.fromCharCode(t)}return r}var pW=class{constructor(){this._interim=0}clear(){this._interim=0}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i=0;if(this._interim){let n=e.charCodeAt(i++);56320<=n&&n<=57343?t[r++]=(this._interim-55296)*1024+n-56320+65536:(t[r++]=this._interim,t[r++]=n),this._interim=0}for(let a=i;a<n;++a){let i=e.charCodeAt(a);if(55296<=i&&i<=56319){if(++a>=n)return this._interim=i,r;let o=e.charCodeAt(a);56320<=o&&o<=57343?t[r++]=(i-55296)*1024+o-56320+65536:(t[r++]=i,t[r++]=o);continue}i!==65279&&(t[r++]=i)}return r}},mW=class{constructor(){this.interim=new Uint8Array(3)}clear(){this.interim.fill(0)}decode(e,t){let n=e.length;if(!n)return 0;let r=0,i,a,o,s,c=0,l=0;if(this.interim[0]){let i=!1,a=this.interim[0];a&=(a&224)==192?31:(a&240)==224?15:7;let o=0,s;for(;(s=this.interim[++o]&63)&&o<4;)a<<=6,a|=s;let c=(this.interim[0]&224)==192?2:(this.interim[0]&240)==224?3:4,u=c-o;for(;l<u;){if(l>=n)return 0;if(s=e[l++],(s&192)!=128){l--,i=!0;break}this.interim[o++]=s,a<<=6,a|=s&63}i||(c===2?a<128?l--:t[r++]=a:c===3?a<2048||a>=55296&&a<=57343||a===65279||(t[r++]=a):a<65536||a>1114111||(t[r++]=a)),this.interim.fill(0)}let u=n-4,d=l;for(;d<n;){for(;d<u&&!((i=e[d])&128)&&!((a=e[d+1])&128)&&!((o=e[d+2])&128)&&!((s=e[d+3])&128);)t[r++]=i,t[r++]=a,t[r++]=o,t[r++]=s,d+=4;if(i=e[d++],i<128)t[r++]=i;else if((i&224)==192){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(c=(i&31)<<6|a&63,c<128){d--;continue}t[r++]=c}else if((i&240)==224){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(c=(i&15)<<12|(a&63)<<6|o&63,c<2048||c>=55296&&c<=57343||c===65279)continue;t[r++]=c}else if((i&248)==240){if(d>=n)return this.interim[0]=i,r;if(a=e[d++],(a&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,r;if(o=e[d++],(o&192)!=128){d--;continue}if(d>=n)return this.interim[0]=i,this.interim[1]=a,this.interim[2]=o,r;if(s=e[d++],(s&192)!=128){d--;continue}if(c=(i&7)<<18|(a&63)<<12|(o&63)<<6|s&63,c<65536||c>1114111)continue;t[r++]=c}}return r}},hW=``,gW=` `,_W=class e{constructor(){this.fg=0,this.bg=0,this.extended=new vW}static toColorRGB(e){return[e>>>16&255,e>>>8&255,e&255]}static fromColorRGB(e){return(e[0]&255)<<16|(e[1]&255)<<8|e[2]&255}clone(){let t=new e;return t.fg=this.fg,t.bg=this.bg,t.extended=this.extended.clone(),t}isInverse(){return this.fg&67108864}isBold(){return this.fg&134217728}isUnderline(){return this.hasExtendedAttrs()&&this.extended.underlineStyle!==0?1:this.fg&268435456}isBlink(){return this.fg&536870912}isInvisible(){return this.fg&1073741824}isItalic(){return this.bg&67108864}isDim(){return this.bg&134217728}isStrikethrough(){return this.fg&2147483648}isProtected(){return this.bg&536870912}isOverline(){return this.bg&1073741824}getFgColorMode(){return this.fg&50331648}getBgColorMode(){return this.bg&50331648}isFgRGB(){return(this.fg&50331648)==50331648}isBgRGB(){return(this.bg&50331648)==50331648}isFgPalette(){return(this.fg&50331648)==16777216||(this.fg&50331648)==33554432}isBgPalette(){return(this.bg&50331648)==16777216||(this.bg&50331648)==33554432}isFgDefault(){return!(this.fg&50331648)}isBgDefault(){return!(this.bg&50331648)}isAttributeDefault(){return this.fg===0&&this.bg===0}getFgColor(){switch(this.fg&50331648){case 16777216:case 33554432:return this.fg&255;case 50331648:return this.fg&16777215;default:return-1}}getBgColor(){switch(this.bg&50331648){case 16777216:case 33554432:return this.bg&255;case 50331648:return this.bg&16777215;default:return-1}}hasExtendedAttrs(){return this.bg&268435456}updateExtended(){this.extended.isEmpty()?this.bg&=-268435457:this.bg|=268435456}getUnderlineColor(){if(this.bg&268435456&&~this.extended.underlineColor)switch(this.extended.underlineColor&50331648){case 16777216:case 33554432:return this.extended.underlineColor&255;case 50331648:return this.extended.underlineColor&16777215;default:return this.getFgColor()}return this.getFgColor()}getUnderlineColorMode(){return this.bg&268435456&&~this.extended.underlineColor?this.extended.underlineColor&50331648:this.getFgColorMode()}isUnderlineColorRGB(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==50331648:this.isFgRGB()}isUnderlineColorPalette(){return this.bg&268435456&&~this.extended.underlineColor?(this.extended.underlineColor&50331648)==16777216||(this.extended.underlineColor&50331648)==33554432:this.isFgPalette()}isUnderlineColorDefault(){return this.bg&268435456&&~this.extended.underlineColor?!(this.extended.underlineColor&50331648):this.isFgDefault()}getUnderlineStyle(){return this.fg&268435456?this.bg&268435456?this.extended.underlineStyle:1:0}getUnderlineVariantOffset(){return this.extended.underlineVariantOffset}},vW=class e{constructor(e=0,t=0){this._ext=0,this._urlId=0,this._ext=e,this._urlId=t}get ext(){return this._urlId?this._ext&-469762049|this.underlineStyle<<26:this._ext}set ext(e){this._ext=e}get underlineStyle(){return this._urlId?5:(this._ext&469762048)>>26}set underlineStyle(e){this._ext&=-469762049,this._ext|=e<<26&469762048}get underlineColor(){return this._ext&67108863}set underlineColor(e){this._ext&=-67108864,this._ext|=e&67108863}get urlId(){return this._urlId}set urlId(e){this._urlId=e}get underlineVariantOffset(){let e=(this._ext&3758096384)>>29;return e<0?e^4294967288:e}set underlineVariantOffset(e){this._ext&=536870911,this._ext|=e<<29&3758096384}clone(){return new e(this._ext,this._urlId)}isEmpty(){return this.underlineStyle===0&&this._urlId===0}},yW=class e extends _W{constructor(){super(...arguments),this.content=0,this.fg=0,this.bg=0,this.extended=new vW,this.combinedData=``}static fromCharData(t){let n=new e;return n.setFromCharData(t),n}isCombined(){return this.content&2097152}getWidth(){return this.content>>22}getChars(){return this.content&2097152?this.combinedData:this.content&2097151?dW(this.content&2097151):``}getCode(){return this.isCombined()?this.combinedData.charCodeAt(this.combinedData.length-1):this.content&2097151}setFromCharData(e){this.fg=e[0],this.bg=0;let t=!1;if(e[1].length>2)t=!0;else if(e[1].length===2){let n=e[1].charCodeAt(0);if(55296<=n&&n<=56319){let r=e[1].charCodeAt(1);56320<=r&&r<=57343?this.content=(n-55296)*1024+r-56320+65536|e[2]<<22:t=!0}else t=!0}else this.content=e[1].charCodeAt(0)|e[2]<<22;t&&(this.combinedData=e[1],this.content=2097152|e[2]<<22)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},bW=`di$target`,xW=`di$dependencies`,SW=new Map;function CW(e){return e[xW]||[]}function wW(e){if(SW.has(e))return SW.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);TW(t,e,r)};return t._id=e,SW.set(e,t),t}function TW(e,t,n){t[bW]===t?t[xW].push({id:e,index:n}):(t[xW]=[{id:e,index:n}],t[bW]=t)}var EW=wW(`BufferService`),DW=wW(`CoreMouseService`),OW=wW(`CoreService`),kW=wW(`CharsetService`),AW=wW(`InstantiationService`),jW=wW(`LogService`),MW=wW(`OptionsService`),NW=wW(`OscLinkService`),PW=wW(`UnicodeService`),FW=wW(`DecorationService`),IW=class{constructor(e,t,n){this._bufferService=e,this._optionsService=t,this._oscLinkService=n}provideLinks(e,t){let n=this._bufferService.buffer.lines.get(e-1);if(!n){t(void 0);return}let r=[],i=this._optionsService.rawOptions.linkHandler,a=new yW,o=n.getTrimmedLength(),s=-1,c=-1,l=!1;for(let t=0;t<o;t++)if(!(c===-1&&!n.hasContent(t))){if(n.loadCell(t,a),a.hasExtendedAttrs()&&a.extended.urlId){if(c===-1){c=t,s=a.extended.urlId;continue}l=a.extended.urlId!==s}else c!==-1&&(l=!0);if(l||c!==-1&&t===o-1){let n=this._oscLinkService.getLinkData(s)?.uri;if(n){let a={start:{x:c+1,y:e},end:{x:t+ +(!l&&t===o-1),y:e}},s=!1;if(!i?.allowNonHttpProtocols)try{let e=new URL(n);[`http:`,`https:`].includes(e.protocol)||(s=!0)}catch{s=!0}s||r.push({text:n,range:a,activate:(e,t)=>i?i.activate(e,t,a):LW(e,t),hover:(e,t)=>i?.hover?.(e,t,a),leave:(e,t)=>i?.leave?.(e,t,a)})}l=!1,a.hasExtendedAttrs()&&a.extended.urlId?(c=t,s=a.extended.urlId):(c=-1,s=-1)}}t(r)}};IW=$U([J(0,EW),J(1,MW),J(2,NW)],IW);function LW(e,t){if(confirm(`Do you want to navigate to ${t}?
|
|
1533
1533
|
|
|
1534
1534
|
WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){try{e.opener=null}catch{}e.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}}var RW=wW(`CharSizeService`),zW=wW(`CoreBrowserService`),BW=wW(`MouseService`),VW=wW(`RenderService`),HW=wW(`SelectionService`),UW=wW(`CharacterJoinerService`),WW=wW(`ThemeService`),GW=wW(`LinkProviderService`),KW=new class{constructor(){this.listeners=[],this.unexpectedErrorHandler=function(e){setTimeout(()=>{throw e.stack?QW.isErrorNoTelemetry(e)?new QW(e.message+`
|
|
1535
1535
|
|
|
@@ -1539,7 +1539,7 @@ WARNING: This link could potentially be dangerous`)){let e=window.open();if(e){t
|
|
|
1539
1539
|
`).slice(2).join(`
|
|
1540
1540
|
`))}},kG=class extends Error{constructor(e,t){super(e),this.name=`ListenerLeakError`,this.stack=t}},AG=class extends Error{constructor(e,t){super(e),this.name=`ListenerRefusalError`,this.stack=t}},jG=0,MG=class{constructor(e){this.value=e,this.id=jG++}},NG=2,PG,X=class{constructor(e){this._size=0,this._options=e,this._leakageMon=TG>0||this._options?.leakWarningThreshold?new DG(e?.onListenerError??qW,this._options?.leakWarningThreshold??TG):void 0,this._perfMon=this._options?._profName?new wG(this._options._profName):void 0,this._deliveryQueue=this._options?.deliveryQueue}dispose(){this._disposed||(this._disposed=!0,this._deliveryQueue?.current===this&&this._deliveryQueue.reset(),this._listeners&&(this._listeners=void 0,this._size=0),this._options?.onDidRemoveLastListener?.(),this._leakageMon?.dispose())}get event(){return this._event??=(e,t,n)=>{if(this._leakageMon&&this._size>this._leakageMon.threshold**2){let e=`[${this._leakageMon.name}] REFUSES to accept new listeners because it exceeded its threshold by far (${this._size} vs ${this._leakageMon.threshold})`;console.warn(e);let t=this._leakageMon.getMostFrequentStack()??[`UNKNOWN stack`,-1],n=new AG(`${e}. HINT: Stack shows most frequent listener (${t[1]}-times)`,t[0]);return(this._options?.onListenerError||qW)(n),Y.None}if(this._disposed)return Y.None;t&&(e=e.bind(t));let r=new MG(e),i;this._leakageMon&&this._size>=Math.ceil(this._leakageMon.threshold*.2)&&(r.stack=OG.create(),i=this._leakageMon.check(r.stack,this._size+1)),this._listeners?this._listeners instanceof MG?(this._deliveryQueue??=new FG,this._listeners=[this._listeners,r]):this._listeners.push(r):(this._options?.onWillAddFirstListener?.(this),this._listeners=r,this._options?.onDidAddFirstListener?.(this)),this._size++;let a=fG(()=>{PG?.unregister(a),i?.(),this._removeListener(r)});if(n instanceof mG?n.add(a):Array.isArray(n)&&n.push(a),PG){let e=Error().stack.split(`
|
|
1541
1541
|
`).slice(2,3).join(`
|
|
1542
|
-
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);PG.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*NG<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||qW;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof MG)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},FG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},IG=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};IG.INSTANCE=new IG;var LG=IG;function RG(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}LG.INSTANCE.onDidChangeZoomLevel;function zG(e){return LG.INSTANCE.getZoomFactor(e)}LG.INSTANCE.onDidChangeFullscreen;var BG=typeof navigator==`object`?navigator.userAgent:``,VG=BG.indexOf(`Firefox`)>=0,HG=BG.indexOf(`AppleWebKit`)>=0,UG=BG.indexOf(`Chrome`)>=0,WG=!UG&&BG.indexOf(`Safari`)>=0;BG.indexOf(`Electron/`),BG.indexOf(`Android`);var GG=!1;if(typeof gG.matchMedia==`function`){let e=gG.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=gG.matchMedia(`(display-mode: fullscreen)`);GG=e.matches,RG(gG,e,({matches:e})=>{GG&&t.matches||(GG=e)})}function KG(){return GG}var qG=`en`,JG=!1,YG=!1,XG=!1,ZG=!1,QG=!1,$G=qG,eK,tK=globalThis,nK;typeof tK.vscode<`u`&&typeof tK.vscode.process<`u`?nK=tK.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(nK=process);var rK=typeof nK?.versions?.electron==`string`&&nK?.type===`renderer`;if(typeof nK==`object`){JG=nK.platform===`win32`,YG=nK.platform===`darwin`,XG=nK.platform===`linux`,XG&&nK.env.SNAP&&nK.env.SNAP_REVISION,nK.env.CI||nK.env.BUILD_ARTIFACTSTAGINGDIRECTORY,$G=qG;let e=nK.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,$G=t.resolvedLanguage||qG,t.languagePack?.translationsConfigFile}catch{}ZG=!0}else typeof navigator==`object`&&!rK?(eK=navigator.userAgent,JG=eK.indexOf(`Windows`)>=0,YG=eK.indexOf(`Macintosh`)>=0,(eK.indexOf(`Macintosh`)>=0||eK.indexOf(`iPad`)>=0||eK.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,XG=eK.indexOf(`Linux`)>=0,eK?.indexOf(`Mobi`),QG=!0,$G=globalThis._VSCODE_NLS_LANGUAGE||qG,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var iK=JG,aK=YG,oK=XG,sK=ZG;QG&&typeof tK.importScripts==`function`&&tK.origin;var cK=eK,lK=$G,uK;(e=>{function t(){return lK}e.value=t;function n(){return lK.length===2?lK===`en`:lK.length>=3&&lK[0]===`e`&&lK[1]===`n`&&lK[2]===`-`}e.isDefaultVariant=n;function r(){return lK===`en`}e.isDefault=r})(uK||={});var dK=typeof tK.postMessage==`function`&&!tK.importScripts;(()=>{if(dK){let e=[];tK.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),tK.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var fK=!!(cK&&cK.indexOf(`Chrome`)>=0);cK&&cK.indexOf(`Firefox`),!fK&&cK&&cK.indexOf(`Safari`),cK&&cK.indexOf(`Edg/`),cK&&cK.indexOf(`Android`);var pK=typeof navigator==`object`?navigator:{};sK||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||pK&&pK.clipboard&&pK.clipboard.writeText,sK||pK&&pK.clipboard&&pK.clipboard.readText,sK||KG()||pK.keyboard,`ontouchstart`in gG||pK.maxTouchPoints,gG.PointerEvent&&(`ontouchstart`in gG||navigator.maxTouchPoints);var mK=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},hK=new mK,gK=new mK,_K=new mK,vK=Array(230),yK;(e=>{function t(e){return hK.keyCodeToStr(e)}e.toString=t;function n(e){return hK.strToKeyCode(e)}e.fromString=n;function r(e){return gK.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return _K.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return gK.strToKeyCode(e)||_K.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return hK.keyCodeToStr(e)}e.toElectronAccelerator=o})(yK||={});var bK=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new xK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},xK=class{constructor(e){if(e.length===0)throw ZW(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function SK(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return yK.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(VG)switch(t){case 59:return 85;case 60:if(oK)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(aK)return 57;break}else if(HG&&(aK&&t===93||!aK&&t===92))return 57;return vK[t]||0}var CK=aK?256:2048,wK=512,TK=1024,EK=aK?2048:256,DK=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=SK(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=CK),this.altKey&&(t|=wK),this.shiftKey&&(t|=TK),this.metaKey&&(t|=EK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new bK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},OK=new WeakMap;function kK(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var AK=class{static getSameOriginWindowChain(e){let t=OK.get(e);if(!t){t=[],OK.set(e,t);let n=e,r;do r=kK(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},jK=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=AK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},MK=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(UG){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?VG&&!aK?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=WG&&iK?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?VG&&!aK?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},NK=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),PK;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof FK?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:SG.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:NK})})(PK||={});var FK=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?NK:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},IK=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new $W(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $W(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},LK=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new $W(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=fG(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var RK;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(RK||={});var zK=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await SG.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};zK.EMPTY=zK.fromArray([]);function BK(e){return VK(e,0)}function VK(e,t){switch(typeof e){case`object`:return e===null?HK(349,t):Array.isArray(e)?GK(e,t):KK(e,t);case`string`:return WK(e,t);case`boolean`:return UK(e,t);case`number`:return HK(e,t);case`undefined`:return HK(937,t);default:return HK(617,t)}}function HK(e,t){return(t<<5)-t+e|0}function UK(e,t){return HK(e?433:863,t)}function WK(e,t){t=HK(149417,t);for(let n=0,r=e.length;n<r;n++)t=HK(e.charCodeAt(n),t);return t}function GK(e,t){return t=HK(104579,t),e.reduce((e,t)=>VK(t,e),t)}function KK(e,t){return t=HK(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=WK(n,t),VK(e[n],t)),t)}var{registerWindow:Lne,getWindow:qK,getDocument:Rne,getWindows:zne,getWindowsCount:Bne,getWindowId:JK,getWindowById:Vne,hasWindow:Hne,onDidRegisterWindow:YK,onWillUnregisterWindow:Une,onDidUnregisterWindow:Wne}=function(){let e=new Map,t={window:gG,disposables:new mG};e.set(gG.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Y.None;let a=new mG,o={window:t,disposables:a.add(new mG)};return e.set(t.vscodeWindowId,o),a.add(fG(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Z(t,aq.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:gG},getDocument(e){return qK(e).document}}}(),XK=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Z(e,t,n,r){return new XK(e,t,n,r)}function ZK(e,t){return function(n){return t(new jK(e,n))}}function QK(e){return function(t){return e(new DK(t))}}var $K=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=ZK(qK(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=QK(n)),Z(e,t,i,r)},eq,tq=class extends LK{constructor(e){super(),this.defaultTarget=e&&qK(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},nq=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){qW(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(nq.sort),a.shift().execute();r.set(i,!1)};eq=(t,r,a=0)=>{let o=JK(t),s=new nq(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var rq=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};rq.None=new rq(0,0);function iq(e){let t=e.getBoundingClientRect(),n=qK(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=BK(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(fG(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var aq={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:HG?`webkitAnimationStart`:`animationstart`,ANIMATION_END:HG?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:HG?`webkitAnimationIteration`:`animationiteration`},oq=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=sq(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=sq(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=sq(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=sq(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=sq(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=sq(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=sq(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=sq(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=sq(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=sq(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=sq(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=sq(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=sq(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=sq(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function sq(e){return typeof e==`number`?`${e}px`:e}function cq(e){return new oq(e)}var lq=class{constructor(){this._hooks=new mG,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(fG(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=qK(e)}this._hooks.add(Z(a,aq.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Z(a,aq.POINTER_UP,e=>this.stopMonitoring(!0)))}};function uq(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var dq;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(dq||={});var fq=class e extends Y{constructor(){super(),this.dispatched=!1,this.targets=new yG,this.ignoreTargets=new yG,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(SG.runAndSubscribe(YK,({window:e,disposables:t})=>{t.add(Z(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Z(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Z(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:gG,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lG(new e),fG(e.INSTANCE.targets.push(t))):Y.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lG(new e),fG(e.INSTANCE.ignoreTargets.push(t))):Y.None}static isTouchDevice(){return`ontouchstart`in gG||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(dq.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-eG(s.rollingPageX))<30&&Math.abs(s.initialPageY-eG(s.rollingPageY))<30){let e=this.newGestureEvent(dq.Tap,s.initialTarget);e.pageX=eG(s.rollingPageX),e.pageY=eG(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-eG(s.rollingPageX))<30&&Math.abs(s.initialPageY-eG(s.rollingPageY))<30){let e=this.newGestureEvent(dq.Contextmenu,s.initialTarget);e.pageX=eG(s.rollingPageX),e.pageY=eG(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=eG(s.rollingPageX),n=eG(s.rollingPageY),i=eG(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(dq.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===dq.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===dq.Change||t.type===dq.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=eq(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(dq.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(dq.Change,i.initialTarget);a.translationX=r.pageX-eG(i.rollingPageX),a.translationY=r.pageY-eG(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};fq.SCROLL_FRICTION=-.005,fq.HOLD_DELAY=700,fq.CLEAR_TAP_COUNT_TIME=400,$U([uq],fq,`isTouchDevice`,1);var pq=fq,mq=class extends Y{onclick(e,t){this._register(Z(e,aq.CLICK,n=>t(new jK(qK(e),n))))}onmousedown(e,t){this._register(Z(e,aq.MOUSE_DOWN,n=>t(new jK(qK(e),n))))}onmouseover(e,t){this._register(Z(e,aq.MOUSE_OVER,n=>t(new jK(qK(e),n))))}onmouseleave(e,t){this._register(Z(e,aq.MOUSE_LEAVE,n=>t(new jK(qK(e),n))))}onkeydown(e,t){this._register(Z(e,aq.KEY_DOWN,e=>t(new DK(e))))}onkeyup(e,t){this._register(Z(e,aq.KEY_UP,e=>t(new DK(e))))}oninput(e,t){this._register(Z(e,aq.INPUT,t))}onblur(e,t){this._register(Z(e,aq.BLUR,t))}onfocus(e,t){this._register(Z(e,aq.FOCUS,t))}onchange(e,t){this._register(Z(e,aq.CHANGE,t))}ignoreGesture(e){return pq.ignoreTarget(e)}},hq=11,gq=class extends mq{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=hq+`px`,this.domNode.style.height=hq+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new lq),this._register($K(this.bgDomNode,aq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($K(this.domNode,aq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tq),this._pointerdownScheduleRepeatTimer=this._register(new IK)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qK(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},_q=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},vq=class extends Y{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _q(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Sq(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Sq.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},yq=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function bq(e,t){let n=t-e;return function(t){return e+n*wq(t)}}function xq(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Sq=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),xq(bq(e,r),bq(i,t),.33)}return bq(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new yq(this.scrollLeft(t),this.scrollTop(t),!1):new yq(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Cq(e){return e**3}function wq(e){return 1-Cq(1-e)}var Tq=class extends Y{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new IK)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Eq=140,Dq=class extends mq{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Tq(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new lq),this._shouldRender=!0,this.domNode=cq(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(Z(this.domNode.domNode,aq.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new gq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=cq(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Z(this.slider.domNode,aq.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=iq(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(iK&&a>Eq){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Oq=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},kq=class extends Dq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Oq(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Aq=class extends Dq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Oq(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},jq=500,Mq=50,Nq=!0,Pq=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Fq=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(UG){let t=zG(qK(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Pq(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Fq.INSTANCE=new Fq;var Iq=Fq,Lq=class extends mq{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=zq(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Aq(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new kq(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=cq(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=cq(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=cq(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new IK),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=uG(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,aK&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new MK(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=uG(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Z(this._listenOnDomNode,aq.MOUSE_WHEEL,e=>{this._onMouseWheel(new MK(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Iq.INSTANCE;Nq&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!aK&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Mq*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Mq*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Nq&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),jq)}},Rq=class extends Lq{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function zq(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,aK&&(t.className+=` mac`),t}var Bq=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new vq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>eq(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Rq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(SG.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(fG(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(fG(()=>this._styleElement.remove())),this._register(SG.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
1542
|
+
`).trim(),t=/(file:|vscode-file:\/\/vscode-app)?(\/[^:]*:\d+:\d+)/.exec(e);PG.register(a,t?.[2]??e,a)}return a},this._event}_removeListener(e){if(this._options?.onWillRemoveListener?.(this),!this._listeners)return;if(this._size===1){this._listeners=void 0,this._options?.onDidRemoveLastListener?.(this),this._size=0;return}let t=this._listeners,n=t.indexOf(e);if(n===-1)throw console.log(`disposed?`,this._disposed),console.log(`size?`,this._size),console.log(`arr?`,JSON.stringify(this._listeners)),Error(`Attempted to dispose unknown listener`);this._size--,t[n]=void 0;let r=this._deliveryQueue.current===this;if(this._size*NG<=t.length){let e=0;for(let n=0;n<t.length;n++)t[n]?t[e++]=t[n]:r&&(this._deliveryQueue.end--,e<this._deliveryQueue.i&&this._deliveryQueue.i--);t.length=e}}_deliver(e,t){if(!e)return;let n=this._options?.onListenerError||qW;if(!n){e.value(t);return}try{e.value(t)}catch(e){n(e)}}_deliverQueue(e){let t=e.current._listeners;for(;e.i<e.end;)this._deliver(t[e.i++],e.value);e.reset()}fire(e){if(this._deliveryQueue?.current&&(this._deliverQueue(this._deliveryQueue),this._perfMon?.stop()),this._perfMon?.start(this._size),this._listeners){if(this._listeners instanceof MG)this._deliver(this._listeners,e);else{let t=this._deliveryQueue;t.enqueue(this,e,this._listeners.length),this._deliverQueue(t)}}this._perfMon?.stop()}hasListeners(){return this._size>0}},FG=class{constructor(){this.i=-1,this.end=0}enqueue(e,t,n){this.i=0,this.end=n,this.current=e,this.value=t}reset(){this.i=this.end,this.current=void 0,this.value=void 0}},IG=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new X,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new X,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};IG.INSTANCE=new IG;var LG=IG;function RG(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}LG.INSTANCE.onDidChangeZoomLevel;function zG(e){return LG.INSTANCE.getZoomFactor(e)}LG.INSTANCE.onDidChangeFullscreen;var BG=typeof navigator==`object`?navigator.userAgent:``,VG=BG.indexOf(`Firefox`)>=0,HG=BG.indexOf(`AppleWebKit`)>=0,UG=BG.indexOf(`Chrome`)>=0,WG=!UG&&BG.indexOf(`Safari`)>=0;BG.indexOf(`Electron/`),BG.indexOf(`Android`);var GG=!1;if(typeof gG.matchMedia==`function`){let e=gG.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=gG.matchMedia(`(display-mode: fullscreen)`);GG=e.matches,RG(gG,e,({matches:e})=>{GG&&t.matches||(GG=e)})}function KG(){return GG}var qG=`en`,JG=!1,YG=!1,XG=!1,ZG=!1,QG=!1,$G=qG,eK,tK=globalThis,nK;typeof tK.vscode<`u`&&typeof tK.vscode.process<`u`?nK=tK.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&(nK=process);var rK=typeof nK?.versions?.electron==`string`&&nK?.type===`renderer`;if(typeof nK==`object`){JG=nK.platform===`win32`,YG=nK.platform===`darwin`,XG=nK.platform===`linux`,XG&&nK.env.SNAP&&nK.env.SNAP_REVISION,nK.env.CI||nK.env.BUILD_ARTIFACTSTAGINGDIRECTORY,$G=qG;let e=nK.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,$G=t.resolvedLanguage||qG,t.languagePack?.translationsConfigFile}catch{}ZG=!0}else typeof navigator==`object`&&!rK?(eK=navigator.userAgent,JG=eK.indexOf(`Windows`)>=0,YG=eK.indexOf(`Macintosh`)>=0,(eK.indexOf(`Macintosh`)>=0||eK.indexOf(`iPad`)>=0||eK.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,XG=eK.indexOf(`Linux`)>=0,eK?.indexOf(`Mobi`),QG=!0,$G=globalThis._VSCODE_NLS_LANGUAGE||qG,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var iK=JG,aK=YG,oK=XG,sK=ZG;QG&&typeof tK.importScripts==`function`&&tK.origin;var cK=eK,lK=$G,uK;(e=>{function t(){return lK}e.value=t;function n(){return lK.length===2?lK===`en`:lK.length>=3&&lK[0]===`e`&&lK[1]===`n`&&lK[2]===`-`}e.isDefaultVariant=n;function r(){return lK===`en`}e.isDefault=r})(uK||={});var dK=typeof tK.postMessage==`function`&&!tK.importScripts;(()=>{if(dK){let e=[];tK.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),tK.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var fK=!!(cK&&cK.indexOf(`Chrome`)>=0);cK&&cK.indexOf(`Firefox`),!fK&&cK&&cK.indexOf(`Safari`),cK&&cK.indexOf(`Edg/`),cK&&cK.indexOf(`Android`);var pK=typeof navigator==`object`?navigator:{};sK||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||pK&&pK.clipboard&&pK.clipboard.writeText,sK||pK&&pK.clipboard&&pK.clipboard.readText,sK||KG()||pK.keyboard,`ontouchstart`in gG||pK.maxTouchPoints,gG.PointerEvent&&(`ontouchstart`in gG||navigator.maxTouchPoints);var mK=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},hK=new mK,gK=new mK,_K=new mK,vK=Array(230),yK;(e=>{function t(e){return hK.keyCodeToStr(e)}e.toString=t;function n(e){return hK.strToKeyCode(e)}e.fromString=n;function r(e){return gK.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return _K.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return gK.strToKeyCode(e)||_K.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return hK.keyCodeToStr(e)}e.toElectronAccelerator=o})(yK||={});var bK=class e{constructor(e,t,n,r,i){this.ctrlKey=e,this.shiftKey=t,this.altKey=n,this.metaKey=r,this.keyCode=i}equals(t){return t instanceof e&&this.ctrlKey===t.ctrlKey&&this.shiftKey===t.shiftKey&&this.altKey===t.altKey&&this.metaKey===t.metaKey&&this.keyCode===t.keyCode}getHashCode(){return`K${this.ctrlKey?`1`:`0`}${this.shiftKey?`1`:`0`}${this.altKey?`1`:`0`}${this.metaKey?`1`:`0`}${this.keyCode}`}isModifierKey(){return this.keyCode===0||this.keyCode===5||this.keyCode===57||this.keyCode===6||this.keyCode===4}toKeybinding(){return new xK([this])}isDuplicateModifierCase(){return this.ctrlKey&&this.keyCode===5||this.shiftKey&&this.keyCode===4||this.altKey&&this.keyCode===6||this.metaKey&&this.keyCode===57}},xK=class{constructor(e){if(e.length===0)throw ZW(`chords`);this.chords=e}getHashCode(){let e=``;for(let t=0,n=this.chords.length;t<n;t++)t!==0&&(e+=`;`),e+=this.chords[t].getHashCode();return e}equals(e){if(e===null||this.chords.length!==e.chords.length)return!1;for(let t=0;t<this.chords.length;t++)if(!this.chords[t].equals(e.chords[t]))return!1;return!0}};function SK(e){if(e.charCode){let t=String.fromCharCode(e.charCode).toUpperCase();return yK.fromString(t)}let t=e.keyCode;if(t===3)return 7;if(VG)switch(t){case 59:return 85;case 60:if(oK)return 97;break;case 61:return 86;case 107:return 109;case 109:return 111;case 173:return 88;case 224:if(aK)return 57;break}else if(HG&&(aK&&t===93||!aK&&t===92))return 57;return vK[t]||0}var CK=aK?256:2048,wK=512,TK=1024,EK=aK?2048:256,DK=class{constructor(e){this._standardKeyboardEventBrand=!0;let t=e;this.browserEvent=t,this.target=t.target,this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,this.altGraphKey=t.getModifierState?.(`AltGraph`),this.keyCode=SK(t),this.code=t.code,this.ctrlKey=this.ctrlKey||this.keyCode===5,this.altKey=this.altKey||this.keyCode===6,this.shiftKey=this.shiftKey||this.keyCode===4,this.metaKey=this.metaKey||this.keyCode===57,this._asKeybinding=this._computeKeybinding(),this._asKeyCodeChord=this._computeKeyCodeChord()}preventDefault(){this.browserEvent&&this.browserEvent.preventDefault&&this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent&&this.browserEvent.stopPropagation&&this.browserEvent.stopPropagation()}toKeyCodeChord(){return this._asKeyCodeChord}equals(e){return this._asKeybinding===e}_computeKeybinding(){let e=0;this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode);let t=0;return this.ctrlKey&&(t|=CK),this.altKey&&(t|=wK),this.shiftKey&&(t|=TK),this.metaKey&&(t|=EK),t|=e,t}_computeKeyCodeChord(){let e=0;return this.keyCode!==5&&this.keyCode!==4&&this.keyCode!==6&&this.keyCode!==57&&(e=this.keyCode),new bK(this.ctrlKey,this.shiftKey,this.altKey,this.metaKey,e)}},OK=new WeakMap;function kK(e){if(!e.parent||e.parent===e)return null;try{let t=e.location,n=e.parent.location;if(t.origin!==`null`&&n.origin!==`null`&&t.origin!==n.origin)return null}catch{return null}return e.parent}var AK=class{static getSameOriginWindowChain(e){let t=OK.get(e);if(!t){t=[],OK.set(e,t);let n=e,r;do r=kK(n),r?t.push({window:new WeakRef(n),iframeElement:n.frameElement||null}):t.push({window:new WeakRef(n),iframeElement:null}),n=r;while(n)}return t.slice(0)}static getPositionOfChildWindowRelativeToAncestorWindow(e,t){if(!t||e===t)return{top:0,left:0};let n=0,r=0,i=this.getSameOriginWindowChain(e);for(let e of i){let i=e.window.deref();if(n+=i?.scrollY??0,r+=i?.scrollX??0,i===t||!e.iframeElement)break;let a=e.iframeElement.getBoundingClientRect();n+=a.top,r+=a.left}return{top:n,left:r}}},jK=class{constructor(e,t){this.timestamp=Date.now(),this.browserEvent=t,this.leftButton=t.button===0,this.middleButton=t.button===1,this.rightButton=t.button===2,this.buttons=t.buttons,this.target=t.target,this.detail=t.detail||1,t.type===`dblclick`&&(this.detail=2),this.ctrlKey=t.ctrlKey,this.shiftKey=t.shiftKey,this.altKey=t.altKey,this.metaKey=t.metaKey,typeof t.pageX==`number`?(this.posx=t.pageX,this.posy=t.pageY):(this.posx=t.clientX+this.target.ownerDocument.body.scrollLeft+this.target.ownerDocument.documentElement.scrollLeft,this.posy=t.clientY+this.target.ownerDocument.body.scrollTop+this.target.ownerDocument.documentElement.scrollTop);let n=AK.getPositionOfChildWindowRelativeToAncestorWindow(e,t.view);this.posx-=n.left,this.posy-=n.top}preventDefault(){this.browserEvent.preventDefault()}stopPropagation(){this.browserEvent.stopPropagation()}},MK=class{constructor(e,t=0,n=0){this.browserEvent=e||null,this.target=e?e.target||e.targetNode||e.srcElement:null,this.deltaY=n,this.deltaX=t;let r=!1;if(UG){let e=navigator.userAgent.match(/Chrome\/(\d+)/);r=(e?parseInt(e[1]):123)<=122}if(e){let t=e,n=e,i=e.view?.devicePixelRatio||1;if(typeof t.wheelDeltaY<`u`)this.deltaY=r?t.wheelDeltaY/(120*i):t.wheelDeltaY/120;else if(typeof n.VERTICAL_AXIS<`u`&&n.axis===n.VERTICAL_AXIS)this.deltaY=-n.detail/3;else if(e.type===`wheel`){let t=e;this.deltaY=t.deltaMode===t.DOM_DELTA_LINE?VG&&!aK?-e.deltaY/3:-e.deltaY:-e.deltaY/40}if(typeof t.wheelDeltaX<`u`)this.deltaX=WG&&iK?-(t.wheelDeltaX/120):r?t.wheelDeltaX/(120*i):t.wheelDeltaX/120;else if(typeof n.HORIZONTAL_AXIS<`u`&&n.axis===n.HORIZONTAL_AXIS)this.deltaX=-e.detail/3;else if(e.type===`wheel`){let t=e;this.deltaX=t.deltaMode===t.DOM_DELTA_LINE?VG&&!aK?-e.deltaX/3:-e.deltaX:-e.deltaX/40}this.deltaY===0&&this.deltaX===0&&e.wheelDelta&&(this.deltaY=r?e.wheelDelta/(120*i):e.wheelDelta/120)}}preventDefault(){this.browserEvent?.preventDefault()}stopPropagation(){this.browserEvent?.stopPropagation()}},NK=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),PK;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof FK?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:SG.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:NK})})(PK||={});var FK=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?NK:(this._emitter||=new X,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}},IK=class{constructor(e,t){this._isDisposed=!1,this._token=-1,typeof e==`function`&&typeof t==`number`&&this.setIfNotSet(e,t)}dispose(){this.cancel(),this._isDisposed=!0}cancel(){this._token!==-1&&(clearTimeout(this._token),this._token=-1)}cancelAndSet(e,t){if(this._isDisposed)throw new $W(`Calling 'cancelAndSet' on a disposed TimeoutTimer`);this.cancel(),this._token=setTimeout(()=>{this._token=-1,e()},t)}setIfNotSet(e,t){if(this._isDisposed)throw new $W(`Calling 'setIfNotSet' on a disposed TimeoutTimer`);this._token===-1&&(this._token=setTimeout(()=>{this._token=-1,e()},t))}},LK=class{constructor(){this.disposable=void 0,this.isDisposed=!1}cancel(){this.disposable?.dispose(),this.disposable=void 0}cancelAndSet(e,t,n=globalThis){if(this.isDisposed)throw new $W(`Calling 'cancelAndSet' on a disposed IntervalTimer`);this.cancel();let r=n.setInterval(()=>{e()},t);this.disposable=fG(()=>{n.clearInterval(r),this.disposable=void 0})}dispose(){this.cancel(),this.isDisposed=!0}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var RK;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(RK||={});var zK=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new X,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await SG.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};zK.EMPTY=zK.fromArray([]);function BK(e){return VK(e,0)}function VK(e,t){switch(typeof e){case`object`:return e===null?HK(349,t):Array.isArray(e)?GK(e,t):KK(e,t);case`string`:return WK(e,t);case`boolean`:return UK(e,t);case`number`:return HK(e,t);case`undefined`:return HK(937,t);default:return HK(617,t)}}function HK(e,t){return(t<<5)-t+e|0}function UK(e,t){return HK(e?433:863,t)}function WK(e,t){t=HK(149417,t);for(let n=0,r=e.length;n<r;n++)t=HK(e.charCodeAt(n),t);return t}function GK(e,t){return t=HK(104579,t),e.reduce((e,t)=>VK(t,e),t)}function KK(e,t){return t=HK(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=WK(n,t),VK(e[n],t)),t)}var{registerWindow:Pne,getWindow:qK,getDocument:Fne,getWindows:Ine,getWindowsCount:Lne,getWindowId:JK,getWindowById:Rne,hasWindow:zne,onDidRegisterWindow:YK,onWillUnregisterWindow:Bne,onDidUnregisterWindow:Vne}=function(){let e=new Map,t={window:gG,disposables:new mG};e.set(gG.vscodeWindowId,t);let n=new X,r=new X,i=new X;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return Y.None;let a=new mG,o={window:t,disposables:a.add(new mG)};return e.set(t.vscodeWindowId,o),a.add(fG(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(Z(t,aq.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:gG},getDocument(e){return qK(e).document}}}(),XK=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function Z(e,t,n,r){return new XK(e,t,n,r)}function ZK(e,t){return function(n){return t(new jK(e,n))}}function QK(e){return function(t){return e(new DK(t))}}var $K=function(e,t,n,r){let i=n;return t===`click`||t===`mousedown`||t===`contextmenu`?i=ZK(qK(e),n):(t===`keydown`||t===`keypress`||t===`keyup`)&&(i=QK(n)),Z(e,t,i,r)},eq,tq=class extends LK{constructor(e){super(),this.defaultTarget=e&&qK(e)}cancelAndSet(e,t,n){return super.cancelAndSet(e,t,n??this.defaultTarget)}},nq=class{constructor(e,t=0){this._runner=e,this.priority=t,this._canceled=!1}dispose(){this._canceled=!0}execute(){if(!this._canceled)try{this._runner()}catch(e){qW(e)}}static sort(e,t){return t.priority-e.priority}};(function(){let e=new Map,t=new Map,n=new Map,r=new Map,i=i=>{n.set(i,!1);let a=e.get(i)??[];for(t.set(i,a),e.set(i,[]),r.set(i,!0);a.length>0;)a.sort(nq.sort),a.shift().execute();r.set(i,!1)};eq=(t,r,a=0)=>{let o=JK(t),s=new nq(r,a),c=e.get(o);return c||(c=[],e.set(o,c)),c.push(s),n.get(o)||(n.set(o,!0),t.requestAnimationFrame(()=>i(o))),s}})();var rq=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};rq.None=new rq(0,0);function iq(e){let t=e.getBoundingClientRect(),n=qK(e);return{left:t.left+n.scrollX,top:t.top+n.scrollY,width:t.width,height:t.height}}new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=BK(n),a=r.get(i);if(a)a.users+=1;else{let o=new X,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(fG(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var aq={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:HG?`webkitAnimationStart`:`animationstart`,ANIMATION_END:HG?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:HG?`webkitAnimationIteration`:`animationiteration`},oq=class{constructor(e){this.domNode=e,this._maxWidth=``,this._width=``,this._height=``,this._top=``,this._left=``,this._bottom=``,this._right=``,this._paddingTop=``,this._paddingLeft=``,this._paddingBottom=``,this._paddingRight=``,this._fontFamily=``,this._fontWeight=``,this._fontSize=``,this._fontStyle=``,this._fontFeatureSettings=``,this._fontVariationSettings=``,this._textDecoration=``,this._lineHeight=``,this._letterSpacing=``,this._className=``,this._display=``,this._position=``,this._visibility=``,this._color=``,this._backgroundColor=``,this._layerHint=!1,this._contain=`none`,this._boxShadow=``}setMaxWidth(e){let t=sq(e);this._maxWidth!==t&&(this._maxWidth=t,this.domNode.style.maxWidth=this._maxWidth)}setWidth(e){let t=sq(e);this._width!==t&&(this._width=t,this.domNode.style.width=this._width)}setHeight(e){let t=sq(e);this._height!==t&&(this._height=t,this.domNode.style.height=this._height)}setTop(e){let t=sq(e);this._top!==t&&(this._top=t,this.domNode.style.top=this._top)}setLeft(e){let t=sq(e);this._left!==t&&(this._left=t,this.domNode.style.left=this._left)}setBottom(e){let t=sq(e);this._bottom!==t&&(this._bottom=t,this.domNode.style.bottom=this._bottom)}setRight(e){let t=sq(e);this._right!==t&&(this._right=t,this.domNode.style.right=this._right)}setPaddingTop(e){let t=sq(e);this._paddingTop!==t&&(this._paddingTop=t,this.domNode.style.paddingTop=this._paddingTop)}setPaddingLeft(e){let t=sq(e);this._paddingLeft!==t&&(this._paddingLeft=t,this.domNode.style.paddingLeft=this._paddingLeft)}setPaddingBottom(e){let t=sq(e);this._paddingBottom!==t&&(this._paddingBottom=t,this.domNode.style.paddingBottom=this._paddingBottom)}setPaddingRight(e){let t=sq(e);this._paddingRight!==t&&(this._paddingRight=t,this.domNode.style.paddingRight=this._paddingRight)}setFontFamily(e){this._fontFamily!==e&&(this._fontFamily=e,this.domNode.style.fontFamily=this._fontFamily)}setFontWeight(e){this._fontWeight!==e&&(this._fontWeight=e,this.domNode.style.fontWeight=this._fontWeight)}setFontSize(e){let t=sq(e);this._fontSize!==t&&(this._fontSize=t,this.domNode.style.fontSize=this._fontSize)}setFontStyle(e){this._fontStyle!==e&&(this._fontStyle=e,this.domNode.style.fontStyle=this._fontStyle)}setFontFeatureSettings(e){this._fontFeatureSettings!==e&&(this._fontFeatureSettings=e,this.domNode.style.fontFeatureSettings=this._fontFeatureSettings)}setFontVariationSettings(e){this._fontVariationSettings!==e&&(this._fontVariationSettings=e,this.domNode.style.fontVariationSettings=this._fontVariationSettings)}setTextDecoration(e){this._textDecoration!==e&&(this._textDecoration=e,this.domNode.style.textDecoration=this._textDecoration)}setLineHeight(e){let t=sq(e);this._lineHeight!==t&&(this._lineHeight=t,this.domNode.style.lineHeight=this._lineHeight)}setLetterSpacing(e){let t=sq(e);this._letterSpacing!==t&&(this._letterSpacing=t,this.domNode.style.letterSpacing=this._letterSpacing)}setClassName(e){this._className!==e&&(this._className=e,this.domNode.className=this._className)}toggleClassName(e,t){this.domNode.classList.toggle(e,t),this._className=this.domNode.className}setDisplay(e){this._display!==e&&(this._display=e,this.domNode.style.display=this._display)}setPosition(e){this._position!==e&&(this._position=e,this.domNode.style.position=this._position)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this.domNode.style.visibility=this._visibility)}setColor(e){this._color!==e&&(this._color=e,this.domNode.style.color=this._color)}setBackgroundColor(e){this._backgroundColor!==e&&(this._backgroundColor=e,this.domNode.style.backgroundColor=this._backgroundColor)}setLayerHinting(e){this._layerHint!==e&&(this._layerHint=e,this.domNode.style.transform=this._layerHint?`translate3d(0px, 0px, 0px)`:``)}setBoxShadow(e){this._boxShadow!==e&&(this._boxShadow=e,this.domNode.style.boxShadow=e)}setContain(e){this._contain!==e&&(this._contain=e,this.domNode.style.contain=this._contain)}setAttribute(e,t){this.domNode.setAttribute(e,t)}removeAttribute(e){this.domNode.removeAttribute(e)}appendChild(e){this.domNode.appendChild(e.domNode)}removeChild(e){this.domNode.removeChild(e.domNode)}};function sq(e){return typeof e==`number`?`${e}px`:e}function cq(e){return new oq(e)}var lq=class{constructor(){this._hooks=new mG,this._pointerMoveCallback=null,this._onStopCallback=null}dispose(){this.stopMonitoring(!1),this._hooks.dispose()}stopMonitoring(e,t){if(!this.isMonitoring())return;this._hooks.clear(),this._pointerMoveCallback=null;let n=this._onStopCallback;this._onStopCallback=null,e&&n&&n(t)}isMonitoring(){return!!this._pointerMoveCallback}startMonitoring(e,t,n,r,i){this.isMonitoring()&&this.stopMonitoring(!1),this._pointerMoveCallback=r,this._onStopCallback=i;let a=e;try{e.setPointerCapture(t),this._hooks.add(fG(()=>{try{e.releasePointerCapture(t)}catch{}}))}catch{a=qK(e)}this._hooks.add(Z(a,aq.POINTER_MOVE,e=>{if(e.buttons!==n){this.stopMonitoring(!0);return}e.preventDefault(),this._pointerMoveCallback(e)})),this._hooks.add(Z(a,aq.POINTER_UP,e=>this.stopMonitoring(!0)))}};function uq(e,t,n){let r=null,i=null;if(typeof n.value==`function`?(r=`value`,i=n.value,i.length!==0&&console.warn(`Memoize should only be used in functions with zero parameters`)):typeof n.get==`function`&&(r=`get`,i=n.get),!i)throw Error(`not supported`);let a=`$memoize$${t}`;n[r]=function(...e){return this.hasOwnProperty(a)||Object.defineProperty(this,a,{configurable:!1,enumerable:!1,writable:!1,value:i.apply(this,e)}),this[a]}}var dq;(e=>(e.Tap=`-xterm-gesturetap`,e.Change=`-xterm-gesturechange`,e.Start=`-xterm-gesturestart`,e.End=`-xterm-gesturesend`,e.Contextmenu=`-xterm-gesturecontextmenu`))(dq||={});var fq=class e extends Y{constructor(){super(),this.dispatched=!1,this.targets=new yG,this.ignoreTargets=new yG,this.activeTouches={},this.handle=null,this._lastSetTapCountTime=0,this._register(SG.runAndSubscribe(YK,({window:e,disposables:t})=>{t.add(Z(e.document,`touchstart`,e=>this.onTouchStart(e),{passive:!1})),t.add(Z(e.document,`touchend`,t=>this.onTouchEnd(e,t))),t.add(Z(e.document,`touchmove`,e=>this.onTouchMove(e),{passive:!1}))},{window:gG,disposables:this._store}))}static addTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lG(new e),fG(e.INSTANCE.targets.push(t))):Y.None}static ignoreTarget(t){return e.isTouchDevice()?(e.INSTANCE||=lG(new e),fG(e.INSTANCE.ignoreTargets.push(t))):Y.None}static isTouchDevice(){return`ontouchstart`in gG||navigator.maxTouchPoints>0}dispose(){this.handle&&=(this.handle.dispose(),null),super.dispose()}onTouchStart(e){let t=Date.now();this.handle&&=(this.handle.dispose(),null);for(let n=0,r=e.targetTouches.length;n<r;n++){let r=e.targetTouches.item(n);this.activeTouches[r.identifier]={id:r.identifier,initialTarget:r.target,initialTimeStamp:t,initialPageX:r.pageX,initialPageY:r.pageY,rollingTimestamps:[t],rollingPageX:[r.pageX],rollingPageY:[r.pageY]};let i=this.newGestureEvent(dq.Start,r.target);i.pageX=r.pageX,i.pageY=r.pageY,this.dispatchEvent(i)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}onTouchEnd(t,n){let r=Date.now(),i=Object.keys(this.activeTouches).length;for(let a=0,o=n.changedTouches.length;a<o;a++){let o=n.changedTouches.item(a);if(!this.activeTouches.hasOwnProperty(String(o.identifier))){console.warn(`move of an UNKNOWN touch`,o);continue}let s=this.activeTouches[o.identifier],c=Date.now()-s.initialTimeStamp;if(c<e.HOLD_DELAY&&Math.abs(s.initialPageX-eG(s.rollingPageX))<30&&Math.abs(s.initialPageY-eG(s.rollingPageY))<30){let e=this.newGestureEvent(dq.Tap,s.initialTarget);e.pageX=eG(s.rollingPageX),e.pageY=eG(s.rollingPageY),this.dispatchEvent(e)}else if(c>=e.HOLD_DELAY&&Math.abs(s.initialPageX-eG(s.rollingPageX))<30&&Math.abs(s.initialPageY-eG(s.rollingPageY))<30){let e=this.newGestureEvent(dq.Contextmenu,s.initialTarget);e.pageX=eG(s.rollingPageX),e.pageY=eG(s.rollingPageY),this.dispatchEvent(e)}else if(i===1){let e=eG(s.rollingPageX),n=eG(s.rollingPageY),i=eG(s.rollingTimestamps)-s.rollingTimestamps[0],a=e-s.rollingPageX[0],o=n-s.rollingPageY[0],c=[...this.targets].filter(e=>s.initialTarget instanceof Node&&e.contains(s.initialTarget));this.inertia(t,c,r,Math.abs(a)/i,a>0?1:-1,e,Math.abs(o)/i,o>0?1:-1,n)}this.dispatchEvent(this.newGestureEvent(dq.End,s.initialTarget)),delete this.activeTouches[o.identifier]}this.dispatched&&=(n.preventDefault(),n.stopPropagation(),!1)}newGestureEvent(e,t){let n=document.createEvent(`CustomEvent`);return n.initEvent(e,!1,!0),n.initialTarget=t,n.tapCount=0,n}dispatchEvent(t){if(t.type===dq.Tap){let n=new Date().getTime(),r=0;r=n-this._lastSetTapCountTime>e.CLEAR_TAP_COUNT_TIME?1:2,this._lastSetTapCountTime=n,t.tapCount=r}else(t.type===dq.Change||t.type===dq.Contextmenu)&&(this._lastSetTapCountTime=0);if(t.initialTarget instanceof Node){for(let e of this.ignoreTargets)if(e.contains(t.initialTarget))return;let e=[];for(let n of this.targets)if(n.contains(t.initialTarget)){let r=0,i=t.initialTarget;for(;i&&i!==n;)r++,i=i.parentElement;e.push([r,n])}e.sort((e,t)=>e[0]-t[0]);for(let[n,r]of e)r.dispatchEvent(t),this.dispatched=!0}}inertia(t,n,r,i,a,o,s,c,l){this.handle=eq(t,()=>{let u=Date.now(),d=u-r,f=0,p=0,m=!0;i+=e.SCROLL_FRICTION*d,s+=e.SCROLL_FRICTION*d,i>0&&(m=!1,f=a*i*d),s>0&&(m=!1,p=c*s*d);let h=this.newGestureEvent(dq.Change);h.translationX=f,h.translationY=p,n.forEach(e=>e.dispatchEvent(h)),m||this.inertia(t,n,u,i,a,o+f,s,c,l+p)})}onTouchMove(e){let t=Date.now();for(let n=0,r=e.changedTouches.length;n<r;n++){let r=e.changedTouches.item(n);if(!this.activeTouches.hasOwnProperty(String(r.identifier))){console.warn(`end of an UNKNOWN touch`,r);continue}let i=this.activeTouches[r.identifier],a=this.newGestureEvent(dq.Change,i.initialTarget);a.translationX=r.pageX-eG(i.rollingPageX),a.translationY=r.pageY-eG(i.rollingPageY),a.pageX=r.pageX,a.pageY=r.pageY,this.dispatchEvent(a),i.rollingPageX.length>3&&(i.rollingPageX.shift(),i.rollingPageY.shift(),i.rollingTimestamps.shift()),i.rollingPageX.push(r.pageX),i.rollingPageY.push(r.pageY),i.rollingTimestamps.push(t)}this.dispatched&&=(e.preventDefault(),e.stopPropagation(),!1)}};fq.SCROLL_FRICTION=-.005,fq.HOLD_DELAY=700,fq.CLEAR_TAP_COUNT_TIME=400,$U([uq],fq,`isTouchDevice`,1);var pq=fq,mq=class extends Y{onclick(e,t){this._register(Z(e,aq.CLICK,n=>t(new jK(qK(e),n))))}onmousedown(e,t){this._register(Z(e,aq.MOUSE_DOWN,n=>t(new jK(qK(e),n))))}onmouseover(e,t){this._register(Z(e,aq.MOUSE_OVER,n=>t(new jK(qK(e),n))))}onmouseleave(e,t){this._register(Z(e,aq.MOUSE_LEAVE,n=>t(new jK(qK(e),n))))}onkeydown(e,t){this._register(Z(e,aq.KEY_DOWN,e=>t(new DK(e))))}onkeyup(e,t){this._register(Z(e,aq.KEY_UP,e=>t(new DK(e))))}oninput(e,t){this._register(Z(e,aq.INPUT,t))}onblur(e,t){this._register(Z(e,aq.BLUR,t))}onfocus(e,t){this._register(Z(e,aq.FOCUS,t))}onchange(e,t){this._register(Z(e,aq.CHANGE,t))}ignoreGesture(e){return pq.ignoreTarget(e)}},hq=11,gq=class extends mq{constructor(e){super(),this._onActivate=e.onActivate,this.bgDomNode=document.createElement(`div`),this.bgDomNode.className=`arrow-background`,this.bgDomNode.style.position=`absolute`,this.bgDomNode.style.width=e.bgWidth+`px`,this.bgDomNode.style.height=e.bgHeight+`px`,typeof e.top<`u`&&(this.bgDomNode.style.top=`0px`),typeof e.left<`u`&&(this.bgDomNode.style.left=`0px`),typeof e.bottom<`u`&&(this.bgDomNode.style.bottom=`0px`),typeof e.right<`u`&&(this.bgDomNode.style.right=`0px`),this.domNode=document.createElement(`div`),this.domNode.className=e.className,this.domNode.style.position=`absolute`,this.domNode.style.width=hq+`px`,this.domNode.style.height=hq+`px`,typeof e.top<`u`&&(this.domNode.style.top=e.top+`px`),typeof e.left<`u`&&(this.domNode.style.left=e.left+`px`),typeof e.bottom<`u`&&(this.domNode.style.bottom=e.bottom+`px`),typeof e.right<`u`&&(this.domNode.style.right=e.right+`px`),this._pointerMoveMonitor=this._register(new lq),this._register($K(this.bgDomNode,aq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._register($K(this.domNode,aq.POINTER_DOWN,e=>this._arrowPointerDown(e))),this._pointerdownRepeatTimer=this._register(new tq),this._pointerdownScheduleRepeatTimer=this._register(new IK)}_arrowPointerDown(e){!e.target||!(e.target instanceof Element)||(this._onActivate(),this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancelAndSet(()=>{this._pointerdownRepeatTimer.cancelAndSet(()=>this._onActivate(),1e3/24,qK(e))},200),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{},()=>{this._pointerdownRepeatTimer.cancel(),this._pointerdownScheduleRepeatTimer.cancel()}),e.preventDefault())}},_q=class e{constructor(e,t,n,r,i,a,o){this._forceIntegerValues=e,this._scrollStateBrand=void 0,this._forceIntegerValues&&(t|=0,n|=0,r|=0,i|=0,a|=0,o|=0),this.rawScrollLeft=r,this.rawScrollTop=o,t<0&&(t=0),r+t>n&&(r=n-t),r<0&&(r=0),i<0&&(i=0),o+i>a&&(o=a-i),o<0&&(o=0),this.width=t,this.scrollWidth=n,this.scrollLeft=r,this.height=i,this.scrollHeight=a,this.scrollTop=o}equals(e){return this.rawScrollLeft===e.rawScrollLeft&&this.rawScrollTop===e.rawScrollTop&&this.width===e.width&&this.scrollWidth===e.scrollWidth&&this.scrollLeft===e.scrollLeft&&this.height===e.height&&this.scrollHeight===e.scrollHeight&&this.scrollTop===e.scrollTop}withScrollDimensions(t,n){return new e(this._forceIntegerValues,typeof t.width<`u`?t.width:this.width,typeof t.scrollWidth<`u`?t.scrollWidth:this.scrollWidth,n?this.rawScrollLeft:this.scrollLeft,typeof t.height<`u`?t.height:this.height,typeof t.scrollHeight<`u`?t.scrollHeight:this.scrollHeight,n?this.rawScrollTop:this.scrollTop)}withScrollPosition(t){return new e(this._forceIntegerValues,this.width,this.scrollWidth,typeof t.scrollLeft<`u`?t.scrollLeft:this.rawScrollLeft,this.height,this.scrollHeight,typeof t.scrollTop<`u`?t.scrollTop:this.rawScrollTop)}createScrollEvent(e,t){let n=this.width!==e.width,r=this.scrollWidth!==e.scrollWidth,i=this.scrollLeft!==e.scrollLeft,a=this.height!==e.height,o=this.scrollHeight!==e.scrollHeight,s=this.scrollTop!==e.scrollTop;return{inSmoothScrolling:t,oldWidth:e.width,oldScrollWidth:e.scrollWidth,oldScrollLeft:e.scrollLeft,width:this.width,scrollWidth:this.scrollWidth,scrollLeft:this.scrollLeft,oldHeight:e.height,oldScrollHeight:e.scrollHeight,oldScrollTop:e.scrollTop,height:this.height,scrollHeight:this.scrollHeight,scrollTop:this.scrollTop,widthChanged:n,scrollWidthChanged:r,scrollLeftChanged:i,heightChanged:a,scrollHeightChanged:o,scrollTopChanged:s}}},vq=class extends Y{constructor(e){super(),this._scrollableBrand=void 0,this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._smoothScrollDuration=e.smoothScrollDuration,this._scheduleAtNextAnimationFrame=e.scheduleAtNextAnimationFrame,this._state=new _q(e.forceIntegerValues,0,0,0,0,0,0),this._smoothScrolling=null}dispose(){this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),super.dispose()}setSmoothScrollDuration(e){this._smoothScrollDuration=e}validateScrollPosition(e){return this._state.withScrollPosition(e)}getScrollDimensions(){return this._state}setScrollDimensions(e,t){let n=this._state.withScrollDimensions(e,t);this._setState(n,!!this._smoothScrolling),this._smoothScrolling?.acceptScrollDimensions(this._state)}getFutureScrollPosition(){return this._smoothScrolling?this._smoothScrolling.to:this._state}getCurrentScrollPosition(){return this._state}setScrollPositionNow(e){let t=this._state.withScrollPosition(e);this._smoothScrolling&&=(this._smoothScrolling.dispose(),null),this._setState(t,!1)}setScrollPositionSmooth(e,t){if(this._smoothScrollDuration===0)return this.setScrollPositionNow(e);if(this._smoothScrolling){e={scrollLeft:typeof e.scrollLeft>`u`?this._smoothScrolling.to.scrollLeft:e.scrollLeft,scrollTop:typeof e.scrollTop>`u`?this._smoothScrolling.to.scrollTop:e.scrollTop};let n=this._state.withScrollPosition(e);if(this._smoothScrolling.to.scrollLeft===n.scrollLeft&&this._smoothScrolling.to.scrollTop===n.scrollTop)return;let r;r=t?new Sq(this._smoothScrolling.from,n,this._smoothScrolling.startTime,this._smoothScrolling.duration):this._smoothScrolling.combine(this._state,n,this._smoothScrollDuration),this._smoothScrolling.dispose(),this._smoothScrolling=r}else{let t=this._state.withScrollPosition(e);this._smoothScrolling=Sq.start(this._state,t,this._smoothScrollDuration)}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}hasPendingScrollAnimation(){return!!this._smoothScrolling}_performSmoothScrolling(){if(!this._smoothScrolling)return;let e=this._smoothScrolling.tick(),t=this._state.withScrollPosition(e);if(this._setState(t,!0),this._smoothScrolling){if(e.isDone){this._smoothScrolling.dispose(),this._smoothScrolling=null;return}this._smoothScrolling.animationFrameDisposable=this._scheduleAtNextAnimationFrame(()=>{this._smoothScrolling&&(this._smoothScrolling.animationFrameDisposable=null,this._performSmoothScrolling())})}}_setState(e,t){let n=this._state;n.equals(e)||(this._state=e,this._onScroll.fire(this._state.createScrollEvent(n,t)))}},yq=class{constructor(e,t,n){this.scrollLeft=e,this.scrollTop=t,this.isDone=n}};function bq(e,t){let n=t-e;return function(t){return e+n*wq(t)}}function xq(e,t,n){return function(r){return r<n?e(r/n):t((r-n)/(1-n))}}var Sq=class e{constructor(e,t,n,r){this.from=e,this.to=t,this.duration=r,this.startTime=n,this.animationFrameDisposable=null,this._initAnimations()}_initAnimations(){this.scrollLeft=this._initAnimation(this.from.scrollLeft,this.to.scrollLeft,this.to.width),this.scrollTop=this._initAnimation(this.from.scrollTop,this.to.scrollTop,this.to.height)}_initAnimation(e,t,n){if(Math.abs(e-t)>2.5*n){let r,i;return e<t?(r=e+.75*n,i=t-.75*n):(r=e-.75*n,i=t+.75*n),xq(bq(e,r),bq(i,t),.33)}return bq(e,t)}dispose(){this.animationFrameDisposable!==null&&(this.animationFrameDisposable.dispose(),this.animationFrameDisposable=null)}acceptScrollDimensions(e){this.to=e.withScrollPosition(this.to),this._initAnimations()}tick(){return this._tick(Date.now())}_tick(e){let t=(e-this.startTime)/this.duration;return t<1?new yq(this.scrollLeft(t),this.scrollTop(t),!1):new yq(this.to.scrollLeft,this.to.scrollTop,!0)}combine(t,n,r){return e.start(t,n,r)}static start(t,n,r){r+=10;let i=Date.now()-10;return new e(t,n,i,r)}};function Cq(e){return e**3}function wq(e){return 1-Cq(1-e)}var Tq=class extends Y{constructor(e,t,n){super(),this._visibility=e,this._visibleClassName=t,this._invisibleClassName=n,this._domNode=null,this._isVisible=!1,this._isNeeded=!1,this._rawShouldBeVisible=!1,this._shouldBeVisible=!1,this._revealTimer=this._register(new IK)}setVisibility(e){this._visibility!==e&&(this._visibility=e,this._updateShouldBeVisible())}setShouldBeVisible(e){this._rawShouldBeVisible=e,this._updateShouldBeVisible()}_applyVisibilitySetting(){return this._visibility===2?!1:this._visibility===3||this._rawShouldBeVisible}_updateShouldBeVisible(){let e=this._applyVisibilitySetting();this._shouldBeVisible!==e&&(this._shouldBeVisible=e,this.ensureVisibility())}setIsNeeded(e){this._isNeeded!==e&&(this._isNeeded=e,this.ensureVisibility())}setDomNode(e){this._domNode=e,this._domNode.setClassName(this._invisibleClassName),this.setShouldBeVisible(!1)}ensureVisibility(){if(!this._isNeeded){this._hide(!1);return}this._shouldBeVisible?this._reveal():this._hide(!0)}_reveal(){this._isVisible||(this._isVisible=!0,this._revealTimer.setIfNotSet(()=>{this._domNode?.setClassName(this._visibleClassName)},0))}_hide(e){this._revealTimer.cancel(),this._isVisible&&(this._isVisible=!1,this._domNode?.setClassName(this._invisibleClassName+(e?` fade`:``)))}},Eq=140,Dq=class extends mq{constructor(e){super(),this._lazyRender=e.lazyRender,this._host=e.host,this._scrollable=e.scrollable,this._scrollByPage=e.scrollByPage,this._scrollbarState=e.scrollbarState,this._visibilityController=this._register(new Tq(e.visibility,`visible scrollbar `+e.extraScrollbarClassName,`invisible scrollbar `+e.extraScrollbarClassName)),this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._pointerMoveMonitor=this._register(new lq),this._shouldRender=!0,this.domNode=cq(document.createElement(`div`)),this.domNode.setAttribute(`role`,`presentation`),this.domNode.setAttribute(`aria-hidden`,`true`),this._visibilityController.setDomNode(this.domNode),this.domNode.setPosition(`absolute`),this._register(Z(this.domNode.domNode,aq.POINTER_DOWN,e=>this._domNodePointerDown(e)))}_createArrow(e){let t=this._register(new gq(e));this.domNode.domNode.appendChild(t.bgDomNode),this.domNode.domNode.appendChild(t.domNode)}_createSlider(e,t,n,r){this.slider=cq(document.createElement(`div`)),this.slider.setClassName(`slider`),this.slider.setPosition(`absolute`),this.slider.setTop(e),this.slider.setLeft(t),typeof n==`number`&&this.slider.setWidth(n),typeof r==`number`&&this.slider.setHeight(r),this.slider.setLayerHinting(!0),this.slider.setContain(`strict`),this.domNode.domNode.appendChild(this.slider.domNode),this._register(Z(this.slider.domNode,aq.POINTER_DOWN,e=>{e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))})),this.onclick(this.slider.domNode,e=>{e.leftButton&&e.stopPropagation()})}_onElementSize(e){return this._scrollbarState.setVisibleSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollSize(e){return this._scrollbarState.setScrollSize(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}_onElementScrollPosition(e){return this._scrollbarState.setScrollPosition(e)&&(this._visibilityController.setIsNeeded(this._scrollbarState.isNeeded()),this._shouldRender=!0,this._lazyRender||this.render()),this._shouldRender}beginReveal(){this._visibilityController.setShouldBeVisible(!0)}beginHide(){this._visibilityController.setShouldBeVisible(!1)}render(){this._shouldRender&&(this._shouldRender=!1,this._renderDomNode(this._scrollbarState.getRectangleLargeSize(),this._scrollbarState.getRectangleSmallSize()),this._updateSlider(this._scrollbarState.getSliderSize(),this._scrollbarState.getArrowSize()+this._scrollbarState.getSliderPosition()))}_domNodePointerDown(e){e.target===this.domNode.domNode&&this._onPointerDown(e)}delegatePointerDown(e){let t=this.domNode.domNode.getClientRects()[0].top,n=t+this._scrollbarState.getSliderPosition(),r=t+this._scrollbarState.getSliderPosition()+this._scrollbarState.getSliderSize(),i=this._sliderPointerPosition(e);n<=i&&i<=r?e.button===0&&(e.preventDefault(),this._sliderPointerDown(e)):this._onPointerDown(e)}_onPointerDown(e){let t,n;if(e.target===this.domNode.domNode&&typeof e.offsetX==`number`&&typeof e.offsetY==`number`)t=e.offsetX,n=e.offsetY;else{let r=iq(this.domNode.domNode);t=e.pageX-r.left,n=e.pageY-r.top}let r=this._pointerDownRelativePosition(t,n);this._setDesiredScrollPositionNow(this._scrollByPage?this._scrollbarState.getDesiredScrollPositionFromOffsetPaged(r):this._scrollbarState.getDesiredScrollPositionFromOffset(r)),e.button===0&&(e.preventDefault(),this._sliderPointerDown(e))}_sliderPointerDown(e){if(!e.target||!(e.target instanceof Element))return;let t=this._sliderPointerPosition(e),n=this._sliderOrthogonalPointerPosition(e),r=this._scrollbarState.clone();this.slider.toggleClassName(`active`,!0),this._pointerMoveMonitor.startMonitoring(e.target,e.pointerId,e.buttons,e=>{let i=this._sliderOrthogonalPointerPosition(e),a=Math.abs(i-n);if(iK&&a>Eq){this._setDesiredScrollPositionNow(r.getScrollPosition());return}let o=this._sliderPointerPosition(e)-t;this._setDesiredScrollPositionNow(r.getDesiredScrollPositionFromDelta(o))},()=>{this.slider.toggleClassName(`active`,!1),this._host.onDragEnd()}),this._host.onDragStart()}_setDesiredScrollPositionNow(e){let t={};this.writeScrollPosition(t,e),this._scrollable.setScrollPositionNow(t)}updateScrollbarSize(e){this._updateScrollbarSize(e),this._scrollbarState.setScrollbarSize(e),this._shouldRender=!0,this._lazyRender||this.render()}isNeeded(){return this._scrollbarState.isNeeded()}},Oq=class e{constructor(e,t,n,r,i,a){this._scrollbarSize=Math.round(t),this._oppositeScrollbarSize=Math.round(n),this._arrowSize=Math.round(e),this._visibleSize=r,this._scrollSize=i,this._scrollPosition=a,this._computedAvailableSize=0,this._computedIsNeeded=!1,this._computedSliderSize=0,this._computedSliderRatio=0,this._computedSliderPosition=0,this._refreshComputedValues()}clone(){return new e(this._arrowSize,this._scrollbarSize,this._oppositeScrollbarSize,this._visibleSize,this._scrollSize,this._scrollPosition)}setVisibleSize(e){let t=Math.round(e);return this._visibleSize!==t&&(this._visibleSize=t,this._refreshComputedValues(),!0)}setScrollSize(e){let t=Math.round(e);return this._scrollSize!==t&&(this._scrollSize=t,this._refreshComputedValues(),!0)}setScrollPosition(e){let t=Math.round(e);return this._scrollPosition!==t&&(this._scrollPosition=t,this._refreshComputedValues(),!0)}setScrollbarSize(e){this._scrollbarSize=Math.round(e)}setOppositeScrollbarSize(e){this._oppositeScrollbarSize=Math.round(e)}static _computeValues(e,t,n,r,i){let a=Math.max(0,n-e),o=Math.max(0,a-2*t),s=r>0&&r>n;if(!s)return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(o),computedSliderRatio:0,computedSliderPosition:0};let c=Math.round(Math.max(20,Math.floor(n*o/r))),l=(o-c)/(r-n),u=i*l;return{computedAvailableSize:Math.round(a),computedIsNeeded:s,computedSliderSize:Math.round(c),computedSliderRatio:l,computedSliderPosition:Math.round(u)}}_refreshComputedValues(){let t=e._computeValues(this._oppositeScrollbarSize,this._arrowSize,this._visibleSize,this._scrollSize,this._scrollPosition);this._computedAvailableSize=t.computedAvailableSize,this._computedIsNeeded=t.computedIsNeeded,this._computedSliderSize=t.computedSliderSize,this._computedSliderRatio=t.computedSliderRatio,this._computedSliderPosition=t.computedSliderPosition}getArrowSize(){return this._arrowSize}getScrollPosition(){return this._scrollPosition}getRectangleLargeSize(){return this._computedAvailableSize}getRectangleSmallSize(){return this._scrollbarSize}isNeeded(){return this._computedIsNeeded}getSliderSize(){return this._computedSliderSize}getSliderPosition(){return this._computedSliderPosition}getDesiredScrollPositionFromOffset(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize-this._computedSliderSize/2;return Math.round(t/this._computedSliderRatio)}getDesiredScrollPositionFromOffsetPaged(e){if(!this._computedIsNeeded)return 0;let t=e-this._arrowSize,n=this._scrollPosition;return t<this._computedSliderPosition?n-=this._visibleSize:n+=this._visibleSize,n}getDesiredScrollPositionFromDelta(e){if(!this._computedIsNeeded)return 0;let t=this._computedSliderPosition+e;return Math.round(t/this._computedSliderRatio)}},kq=class extends Dq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Oq(t.horizontalHasArrows?t.arrowSize:0,t.horizontal===2?0:t.horizontalScrollbarSize,t.vertical===2?0:t.verticalScrollbarSize,r.width,r.scrollWidth,i.scrollLeft),visibility:t.horizontal,extraScrollbarClassName:`horizontal`,scrollable:e,scrollByPage:t.scrollByPage}),t.horizontalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(Math.floor((t.horizontalScrollbarSize-t.horizontalSliderSize)/2),0,void 0,t.horizontalSliderSize)}_updateSlider(e,t){this.slider.setWidth(e),this.slider.setLeft(t)}_renderDomNode(e,t){this.domNode.setWidth(e),this.domNode.setHeight(t),this.domNode.setLeft(0),this.domNode.setBottom(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollWidth)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollLeft)||this._shouldRender,this._shouldRender=this._onElementSize(e.width)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return e}_sliderPointerPosition(e){return e.pageX}_sliderOrthogonalPointerPosition(e){return e.pageY}_updateScrollbarSize(e){this.slider.setHeight(e)}writeScrollPosition(e,t){e.scrollLeft=t}updateOptions(e){this.updateScrollbarSize(e.horizontal===2?0:e.horizontalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._visibilityController.setVisibility(e.horizontal),this._scrollByPage=e.scrollByPage}},Aq=class extends Dq{constructor(e,t,n){let r=e.getScrollDimensions(),i=e.getCurrentScrollPosition();if(super({lazyRender:t.lazyRender,host:n,scrollbarState:new Oq(t.verticalHasArrows?t.arrowSize:0,t.vertical===2?0:t.verticalScrollbarSize,0,r.height,r.scrollHeight,i.scrollTop),visibility:t.vertical,extraScrollbarClassName:`vertical`,scrollable:e,scrollByPage:t.scrollByPage}),t.verticalHasArrows)throw Error(`horizontalHasArrows is not supported in xterm.js`);this._createSlider(0,Math.floor((t.verticalScrollbarSize-t.verticalSliderSize)/2),t.verticalSliderSize,void 0)}_updateSlider(e,t){this.slider.setHeight(e),this.slider.setTop(t)}_renderDomNode(e,t){this.domNode.setWidth(t),this.domNode.setHeight(e),this.domNode.setRight(0),this.domNode.setTop(0)}onDidScroll(e){return this._shouldRender=this._onElementScrollSize(e.scrollHeight)||this._shouldRender,this._shouldRender=this._onElementScrollPosition(e.scrollTop)||this._shouldRender,this._shouldRender=this._onElementSize(e.height)||this._shouldRender,this._shouldRender}_pointerDownRelativePosition(e,t){return t}_sliderPointerPosition(e){return e.pageY}_sliderOrthogonalPointerPosition(e){return e.pageX}_updateScrollbarSize(e){this.slider.setWidth(e)}writeScrollPosition(e,t){e.scrollTop=t}updateOptions(e){this.updateScrollbarSize(e.vertical===2?0:e.verticalScrollbarSize),this._scrollbarState.setOppositeScrollbarSize(0),this._visibilityController.setVisibility(e.vertical),this._scrollByPage=e.scrollByPage}},jq=500,Mq=50,Nq=!0,Pq=class{constructor(e,t,n){this.timestamp=e,this.deltaX=t,this.deltaY=n,this.score=0}},Fq=class{constructor(){this._capacity=5,this._memory=[],this._front=-1,this._rear=-1}isPhysicalMouseWheel(){if(this._front===-1&&this._rear===-1)return!1;let e=1,t=0,n=1,r=this._rear;do{let i=r===this._front?e:2**-n;if(e-=i,t+=this._memory[r].score*i,r===this._front)break;r=(this._capacity+r-1)%this._capacity,n++}while(!0);return t<=.5}acceptStandardWheelEvent(e){if(UG){let t=zG(qK(e.browserEvent));this.accept(Date.now(),e.deltaX*t,e.deltaY*t)}else this.accept(Date.now(),e.deltaX,e.deltaY)}accept(e,t,n){let r=null,i=new Pq(e,t,n);this._front===-1&&this._rear===-1?(this._memory[0]=i,this._front=0,this._rear=0):(r=this._memory[this._rear],this._rear=(this._rear+1)%this._capacity,this._rear===this._front&&(this._front=(this._front+1)%this._capacity),this._memory[this._rear]=i),i.score=this._computeScore(i,r)}_computeScore(e,t){if(Math.abs(e.deltaX)>0&&Math.abs(e.deltaY)>0)return 1;let n=.5;if((!this._isAlmostInt(e.deltaX)||!this._isAlmostInt(e.deltaY))&&(n+=.25),t){let r=Math.abs(e.deltaX),i=Math.abs(e.deltaY),a=Math.abs(t.deltaX),o=Math.abs(t.deltaY),s=Math.max(Math.min(r,a),1),c=Math.max(Math.min(i,o),1),l=Math.max(r,a),u=Math.max(i,o);l%s===0&&u%c===0&&(n-=.5)}return Math.min(Math.max(n,0),1)}_isAlmostInt(e){return Math.abs(Math.round(e)-e)<.01}};Fq.INSTANCE=new Fq;var Iq=Fq,Lq=class extends mq{constructor(e,t,n){super(),this._onScroll=this._register(new X),this.onScroll=this._onScroll.event,this._onWillScroll=this._register(new X),this.onWillScroll=this._onWillScroll.event,this._options=zq(t),this._scrollable=n,this._register(this._scrollable.onScroll(e=>{this._onWillScroll.fire(e),this._onDidScroll(e),this._onScroll.fire(e)}));let r={onMouseWheel:e=>this._onMouseWheel(e),onDragStart:()=>this._onDragStart(),onDragEnd:()=>this._onDragEnd()};this._verticalScrollbar=this._register(new Aq(this._scrollable,this._options,r)),this._horizontalScrollbar=this._register(new kq(this._scrollable,this._options,r)),this._domNode=document.createElement(`div`),this._domNode.className=`xterm-scrollable-element `+this._options.className,this._domNode.setAttribute(`role`,`presentation`),this._domNode.style.position=`relative`,this._domNode.appendChild(e),this._domNode.appendChild(this._horizontalScrollbar.domNode.domNode),this._domNode.appendChild(this._verticalScrollbar.domNode.domNode),this._options.useShadows?(this._leftShadowDomNode=cq(document.createElement(`div`)),this._leftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._leftShadowDomNode.domNode),this._topShadowDomNode=cq(document.createElement(`div`)),this._topShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topShadowDomNode.domNode),this._topLeftShadowDomNode=cq(document.createElement(`div`)),this._topLeftShadowDomNode.setClassName(`shadow`),this._domNode.appendChild(this._topLeftShadowDomNode.domNode)):(this._leftShadowDomNode=null,this._topShadowDomNode=null,this._topLeftShadowDomNode=null),this._listenOnDomNode=this._options.listenOnDomNode||this._domNode,this._mouseWheelToDispose=[],this._setListeningToMouseWheel(this._options.handleMouseWheel),this.onmouseover(this._listenOnDomNode,e=>this._onMouseOver(e)),this.onmouseleave(this._listenOnDomNode,e=>this._onMouseLeave(e)),this._hideTimeout=this._register(new IK),this._isDragging=!1,this._mouseIsOver=!1,this._shouldRender=!0,this._revealOnScroll=!0}get options(){return this._options}dispose(){this._mouseWheelToDispose=uG(this._mouseWheelToDispose),super.dispose()}getDomNode(){return this._domNode}getOverviewRulerLayoutInfo(){return{parent:this._domNode,insertBefore:this._verticalScrollbar.domNode.domNode}}delegateVerticalScrollbarPointerDown(e){this._verticalScrollbar.delegatePointerDown(e)}getScrollDimensions(){return this._scrollable.getScrollDimensions()}setScrollDimensions(e){this._scrollable.setScrollDimensions(e,!1)}updateClassName(e){this._options.className=e,aK&&(this._options.className+=` mac`),this._domNode.className=`xterm-scrollable-element `+this._options.className}updateOptions(e){typeof e.handleMouseWheel<`u`&&(this._options.handleMouseWheel=e.handleMouseWheel,this._setListeningToMouseWheel(this._options.handleMouseWheel)),typeof e.mouseWheelScrollSensitivity<`u`&&(this._options.mouseWheelScrollSensitivity=e.mouseWheelScrollSensitivity),typeof e.fastScrollSensitivity<`u`&&(this._options.fastScrollSensitivity=e.fastScrollSensitivity),typeof e.scrollPredominantAxis<`u`&&(this._options.scrollPredominantAxis=e.scrollPredominantAxis),typeof e.horizontal<`u`&&(this._options.horizontal=e.horizontal),typeof e.vertical<`u`&&(this._options.vertical=e.vertical),typeof e.horizontalScrollbarSize<`u`&&(this._options.horizontalScrollbarSize=e.horizontalScrollbarSize),typeof e.verticalScrollbarSize<`u`&&(this._options.verticalScrollbarSize=e.verticalScrollbarSize),typeof e.scrollByPage<`u`&&(this._options.scrollByPage=e.scrollByPage),this._horizontalScrollbar.updateOptions(this._options),this._verticalScrollbar.updateOptions(this._options),this._options.lazyRender||this._render()}setRevealOnScroll(e){this._revealOnScroll=e}delegateScrollFromMouseWheelEvent(e){this._onMouseWheel(new MK(e))}_setListeningToMouseWheel(e){this._mouseWheelToDispose.length>0!==e&&(this._mouseWheelToDispose=uG(this._mouseWheelToDispose),e)&&this._mouseWheelToDispose.push(Z(this._listenOnDomNode,aq.MOUSE_WHEEL,e=>{this._onMouseWheel(new MK(e))},{passive:!1}))}_onMouseWheel(e){if(e.browserEvent?.defaultPrevented)return;let t=Iq.INSTANCE;Nq&&t.acceptStandardWheelEvent(e);let n=!1;if(e.deltaY||e.deltaX){let r=e.deltaY*this._options.mouseWheelScrollSensitivity,i=e.deltaX*this._options.mouseWheelScrollSensitivity;this._options.scrollPredominantAxis&&(this._options.scrollYToX&&i+r===0?i=r=0:Math.abs(r)>=Math.abs(i)?i=0:r=0),this._options.flipAxes&&([r,i]=[i,r]);let a=!aK&&e.browserEvent&&e.browserEvent.shiftKey;(this._options.scrollYToX||a)&&!i&&(i=r,r=0),e.browserEvent&&e.browserEvent.altKey&&(i*=this._options.fastScrollSensitivity,r*=this._options.fastScrollSensitivity);let o=this._scrollable.getFutureScrollPosition(),s={};if(r){let e=Mq*r,t=o.scrollTop-(e<0?Math.floor(e):Math.ceil(e));this._verticalScrollbar.writeScrollPosition(s,t)}if(i){let e=Mq*i,t=o.scrollLeft-(e<0?Math.floor(e):Math.ceil(e));this._horizontalScrollbar.writeScrollPosition(s,t)}s=this._scrollable.validateScrollPosition(s),(o.scrollLeft!==s.scrollLeft||o.scrollTop!==s.scrollTop)&&(Nq&&this._options.mouseWheelSmoothScroll&&t.isPhysicalMouseWheel()?this._scrollable.setScrollPositionSmooth(s):this._scrollable.setScrollPositionNow(s),n=!0)}let r=n;!r&&this._options.alwaysConsumeMouseWheel&&(r=!0),!r&&this._options.consumeMouseWheelIfScrollbarIsNeeded&&(this._verticalScrollbar.isNeeded()||this._horizontalScrollbar.isNeeded())&&(r=!0),r&&(e.preventDefault(),e.stopPropagation())}_onDidScroll(e){this._shouldRender=this._horizontalScrollbar.onDidScroll(e)||this._shouldRender,this._shouldRender=this._verticalScrollbar.onDidScroll(e)||this._shouldRender,this._options.useShadows&&(this._shouldRender=!0),this._revealOnScroll&&this._reveal(),this._options.lazyRender||this._render()}renderNow(){if(!this._options.lazyRender)throw Error("Please use `lazyRender` together with `renderNow`!");this._render()}_render(){if(this._shouldRender&&(this._shouldRender=!1,this._horizontalScrollbar.render(),this._verticalScrollbar.render(),this._options.useShadows)){let e=this._scrollable.getCurrentScrollPosition(),t=e.scrollTop>0,n=e.scrollLeft>0,r=n?` left`:``,i=t?` top`:``,a=n||t?` top-left-corner`:``;this._leftShadowDomNode.setClassName(`shadow${r}`),this._topShadowDomNode.setClassName(`shadow${i}`),this._topLeftShadowDomNode.setClassName(`shadow${a}${i}${r}`)}}_onDragStart(){this._isDragging=!0,this._reveal()}_onDragEnd(){this._isDragging=!1,this._hide()}_onMouseLeave(e){this._mouseIsOver=!1,this._hide()}_onMouseOver(e){this._mouseIsOver=!0,this._reveal()}_reveal(){this._verticalScrollbar.beginReveal(),this._horizontalScrollbar.beginReveal(),this._scheduleHide()}_hide(){!this._mouseIsOver&&!this._isDragging&&(this._verticalScrollbar.beginHide(),this._horizontalScrollbar.beginHide())}_scheduleHide(){!this._mouseIsOver&&!this._isDragging&&this._hideTimeout.cancelAndSet(()=>this._hide(),jq)}},Rq=class extends Lq{constructor(e,t,n){super(e,t,n)}setScrollPosition(e){e.reuseAnimation?this._scrollable.setScrollPositionSmooth(e,e.reuseAnimation):this._scrollable.setScrollPositionNow(e)}getScrollPosition(){return this._scrollable.getCurrentScrollPosition()}};function zq(e){let t={lazyRender:typeof e.lazyRender<`u`&&e.lazyRender,className:typeof e.className<`u`?e.className:``,useShadows:typeof e.useShadows<`u`?e.useShadows:!0,handleMouseWheel:typeof e.handleMouseWheel<`u`?e.handleMouseWheel:!0,flipAxes:typeof e.flipAxes<`u`&&e.flipAxes,consumeMouseWheelIfScrollbarIsNeeded:typeof e.consumeMouseWheelIfScrollbarIsNeeded<`u`&&e.consumeMouseWheelIfScrollbarIsNeeded,alwaysConsumeMouseWheel:typeof e.alwaysConsumeMouseWheel<`u`&&e.alwaysConsumeMouseWheel,scrollYToX:typeof e.scrollYToX<`u`&&e.scrollYToX,mouseWheelScrollSensitivity:typeof e.mouseWheelScrollSensitivity<`u`?e.mouseWheelScrollSensitivity:1,fastScrollSensitivity:typeof e.fastScrollSensitivity<`u`?e.fastScrollSensitivity:5,scrollPredominantAxis:typeof e.scrollPredominantAxis<`u`?e.scrollPredominantAxis:!0,mouseWheelSmoothScroll:typeof e.mouseWheelSmoothScroll<`u`?e.mouseWheelSmoothScroll:!0,arrowSize:typeof e.arrowSize<`u`?e.arrowSize:11,listenOnDomNode:typeof e.listenOnDomNode<`u`?e.listenOnDomNode:null,horizontal:typeof e.horizontal<`u`?e.horizontal:1,horizontalScrollbarSize:typeof e.horizontalScrollbarSize<`u`?e.horizontalScrollbarSize:10,horizontalSliderSize:typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:0,horizontalHasArrows:typeof e.horizontalHasArrows<`u`&&e.horizontalHasArrows,vertical:typeof e.vertical<`u`?e.vertical:1,verticalScrollbarSize:typeof e.verticalScrollbarSize<`u`?e.verticalScrollbarSize:10,verticalHasArrows:typeof e.verticalHasArrows<`u`&&e.verticalHasArrows,verticalSliderSize:typeof e.verticalSliderSize<`u`?e.verticalSliderSize:0,scrollByPage:typeof e.scrollByPage<`u`&&e.scrollByPage};return t.horizontalSliderSize=typeof e.horizontalSliderSize<`u`?e.horizontalSliderSize:t.horizontalScrollbarSize,t.verticalSliderSize=typeof e.verticalSliderSize<`u`?e.verticalSliderSize:t.verticalScrollbarSize,aK&&(t.className+=` mac`),t}var Bq=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._bufferService=n,this._optionsService=o,this._renderService=s,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._isSyncing=!1,this._isHandlingScroll=!1,this._suppressOnScrollHandler=!1;let c=this._register(new vq({forceIntegerValues:!1,smoothScrollDuration:this._optionsService.rawOptions.smoothScrollDuration,scheduleAtNextAnimationFrame:e=>eq(r.window,e)}));this._register(this._optionsService.onSpecificOptionChange(`smoothScrollDuration`,()=>{c.setSmoothScrollDuration(this._optionsService.rawOptions.smoothScrollDuration)})),this._scrollableElement=this._register(new Rq(t,{vertical:1,horizontal:2,useShadows:!1,mouseWheelSmoothScroll:!0,...this._getChangeOptions()},c)),this._register(this._optionsService.onMultipleOptionChange([`scrollSensitivity`,`fastScrollSensitivity`,`overviewRuler`],()=>this._scrollableElement.updateOptions(this._getChangeOptions()))),this._register(i.onProtocolChange(e=>{this._scrollableElement.updateOptions({handleMouseWheel:!(e&16)})})),this._scrollableElement.setScrollDimensions({height:0,scrollHeight:0}),this._register(SG.runAndSubscribe(a.onChangeColors,()=>{this._scrollableElement.getDomNode().style.backgroundColor=a.colors.background.css})),e.appendChild(this._scrollableElement.getDomNode()),this._register(fG(()=>this._scrollableElement.getDomNode().remove())),this._styleElement=r.mainDocument.createElement(`style`),t.appendChild(this._styleElement),this._register(fG(()=>this._styleElement.remove())),this._register(SG.runAndSubscribe(a.onChangeColors,()=>{this._styleElement.textContent=[`.xterm .xterm-scrollable-element > .scrollbar > .slider {`,` background: ${a.colors.scrollbarSliderBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider:hover {`,` background: ${a.colors.scrollbarSliderHoverBackground.css};`,`}`,`.xterm .xterm-scrollable-element > .scrollbar > .slider.active {`,` background: ${a.colors.scrollbarSliderActiveBackground.css};`,`}`].join(`
|
|
1543
1543
|
`)})),this._register(this._bufferService.onResize(()=>this.queueSync())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._latestYDisp=void 0,this.queueSync()})),this._register(this._bufferService.onScroll(()=>this._sync())),this._register(this._scrollableElement.onScroll(e=>this._handleScroll(e)))}scrollLines(e){let t=this._scrollableElement.getScrollPosition();this._scrollableElement.setScrollPosition({reuseAnimation:!0,scrollTop:t.scrollTop+e*this._renderService.dimensions.css.cell.height})}scrollToLine(e,t){t&&(this._latestYDisp=e),this._scrollableElement.setScrollPosition({reuseAnimation:!t,scrollTop:e*this._renderService.dimensions.css.cell.height})}_getChangeOptions(){return{mouseWheelScrollSensitivity:this._optionsService.rawOptions.scrollSensitivity,fastScrollSensitivity:this._optionsService.rawOptions.fastScrollSensitivity,verticalScrollbarSize:this._optionsService.rawOptions.overviewRuler?.width||14}}queueSync(e){e!==void 0&&(this._latestYDisp=e),this._queuedAnimationFrame===void 0&&(this._queuedAnimationFrame=this._renderService.addRefreshCallback(()=>{this._queuedAnimationFrame=void 0,this._sync(this._latestYDisp)}))}_sync(e=this._bufferService.buffer.ydisp){!this._renderService||this._isSyncing||(this._isSyncing=!0,this._suppressOnScrollHandler=!0,this._scrollableElement.setScrollDimensions({height:this._renderService.dimensions.css.canvas.height,scrollHeight:this._renderService.dimensions.css.cell.height*this._bufferService.buffer.lines.length}),this._suppressOnScrollHandler=!1,e!==this._latestYDisp&&this._scrollableElement.setScrollPosition({scrollTop:e*this._renderService.dimensions.css.cell.height}),this._isSyncing=!1)}_handleScroll(e){if(!this._renderService||this._isHandlingScroll||this._suppressOnScrollHandler)return;this._isHandlingScroll=!0;let t=Math.round(e.scrollTop/this._renderService.dimensions.css.cell.height),n=t-this._bufferService.buffer.ydisp;n!==0&&(this._latestYDisp=t,this._onRequestScrollLines.fire(n)),this._isHandlingScroll=!1}};Bq=$U([J(2,EW),J(3,zW),J(4,DW),J(5,WW),J(6,MW),J(7,VW)],Bq);var Vq=class extends Y{constructor(e,t,n,r,i){super(),this._screenElement=e,this._bufferService=t,this._coreBrowserService=n,this._decorationService=r,this._renderService=i,this._decorationElements=new Map,this._altBufferIsActive=!1,this._dimensionsChanged=!1,this._container=document.createElement(`div`),this._container.classList.add(`xterm-decoration-container`),this._screenElement.appendChild(this._container),this._register(this._renderService.onRenderedViewportChange(()=>this._doRefreshDecorations())),this._register(this._renderService.onDimensionsChange(()=>{this._dimensionsChanged=!0,this._queueRefresh()})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._altBufferIsActive=this._bufferService.buffer===this._bufferService.buffers.alt})),this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh())),this._register(this._decorationService.onDecorationRemoved(e=>this._removeDecoration(e))),this._register(fG(()=>{this._container.remove(),this._decorationElements.clear()}))}_queueRefresh(){this._animationFrame===void 0&&(this._animationFrame=this._renderService.addRefreshCallback(()=>{this._doRefreshDecorations(),this._animationFrame=void 0}))}_doRefreshDecorations(){for(let e of this._decorationService.decorations)this._renderDecoration(e);this._dimensionsChanged=!1}_renderDecoration(e){this._refreshStyle(e),this._dimensionsChanged&&this._refreshXPosition(e)}_createElement(e){let t=this._coreBrowserService.mainDocument.createElement(`div`);t.classList.add(`xterm-decoration`),t.classList.toggle(`xterm-decoration-top-layer`,e?.options?.layer===`top`),t.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,t.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,t.style.top=`${(e.marker.line-this._bufferService.buffers.active.ydisp)*this._renderService.dimensions.css.cell.height}px`,t.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`;let n=e.options.x??0;return n&&n>this._bufferService.cols&&(t.style.display=`none`),this._refreshXPosition(e,t),t}_refreshStyle(e){let t=e.marker.line-this._bufferService.buffers.active.ydisp;if(t<0||t>=this._bufferService.rows)e.element&&(e.element.style.display=`none`,e.onRenderEmitter.fire(e.element));else{let n=this._decorationElements.get(e);n||(n=this._createElement(e),e.element=n,this._decorationElements.set(e,n),this._container.appendChild(n),e.onDispose(()=>{this._decorationElements.delete(e),n.remove()})),n.style.display=this._altBufferIsActive?`none`:`block`,this._altBufferIsActive||(n.style.width=`${Math.round((e.options.width||1)*this._renderService.dimensions.css.cell.width)}px`,n.style.height=`${(e.options.height||1)*this._renderService.dimensions.css.cell.height}px`,n.style.top=`${t*this._renderService.dimensions.css.cell.height}px`,n.style.lineHeight=`${this._renderService.dimensions.css.cell.height}px`),e.onRenderEmitter.fire(n)}}_refreshXPosition(e,t=e.element){if(!t)return;let n=e.options.x??0;(e.options.anchor||`left`)===`right`?t.style.right=n?`${n*this._renderService.dimensions.css.cell.width}px`:``:t.style.left=n?`${n*this._renderService.dimensions.css.cell.width}px`:``}_removeDecoration(e){this._decorationElements.get(e)?.remove(),this._decorationElements.delete(e),e.dispose()}};Vq=$U([J(1,EW),J(2,zW),J(3,FW),J(4,VW)],Vq);var Hq=class{constructor(){this._zones=[],this._zonePool=[],this._zonePoolIndex=0,this._linePadding={full:0,left:0,center:0,right:0}}get zones(){return this._zonePool.length=Math.min(this._zonePool.length,this._zones.length),this._zones}clear(){this._zones.length=0,this._zonePoolIndex=0}addDecoration(e){if(e.options.overviewRulerOptions){for(let t of this._zones)if(t.color===e.options.overviewRulerOptions.color&&t.position===e.options.overviewRulerOptions.position){if(this._lineIntersectsZone(t,e.marker.line))return;if(this._lineAdjacentToZone(t,e.marker.line,e.options.overviewRulerOptions.position)){this._addLineToZone(t,e.marker.line);return}}if(this._zonePoolIndex<this._zonePool.length){this._zonePool[this._zonePoolIndex].color=e.options.overviewRulerOptions.color,this._zonePool[this._zonePoolIndex].position=e.options.overviewRulerOptions.position,this._zonePool[this._zonePoolIndex].startBufferLine=e.marker.line,this._zonePool[this._zonePoolIndex].endBufferLine=e.marker.line,this._zones.push(this._zonePool[this._zonePoolIndex++]);return}this._zones.push({color:e.options.overviewRulerOptions.color,position:e.options.overviewRulerOptions.position,startBufferLine:e.marker.line,endBufferLine:e.marker.line}),this._zonePool.push(this._zones[this._zones.length-1]),this._zonePoolIndex++}}setPadding(e){this._linePadding=e}_lineIntersectsZone(e,t){return t>=e.startBufferLine&&t<=e.endBufferLine}_lineAdjacentToZone(e,t,n){return t>=e.startBufferLine-this._linePadding[n||`full`]&&t<=e.endBufferLine+this._linePadding[n||`full`]}_addLineToZone(e,t){e.startBufferLine=Math.min(e.startBufferLine,t),e.endBufferLine=Math.max(e.endBufferLine,t)}},Uq={full:0,left:0,center:0,right:0},Wq={full:0,left:0,center:0,right:0},Gq={full:0,left:0,center:0,right:0},Kq=class extends Y{constructor(e,t,n,r,i,a,o,s){super(),this._viewportElement=e,this._screenElement=t,this._bufferService=n,this._decorationService=r,this._renderService=i,this._optionsService=a,this._themeService=o,this._coreBrowserService=s,this._colorZoneStore=new Hq,this._shouldUpdateDimensions=!0,this._shouldUpdateAnchor=!0,this._lastKnownBufferLength=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-decoration-overview-ruler`),this._refreshCanvasDimensions(),this._viewportElement.parentElement?.insertBefore(this._canvas,this._viewportElement),this._register(fG(()=>this._canvas?.remove()));let c=this._canvas.getContext(`2d`);if(c)this._ctx=c;else throw Error(`Ctx cannot be null`);this._register(this._decorationService.onDecorationRegistered(()=>this._queueRefresh(void 0,!0))),this._register(this._decorationService.onDecorationRemoved(()=>this._queueRefresh(void 0,!0))),this._register(this._renderService.onRenderedViewportChange(()=>this._queueRefresh())),this._register(this._bufferService.buffers.onBufferActivate(()=>{this._canvas.style.display=this._bufferService.buffer===this._bufferService.buffers.alt?`none`:`block`})),this._register(this._bufferService.onScroll(()=>{this._lastKnownBufferLength!==this._bufferService.buffers.normal.lines.length&&(this._refreshDrawHeightConstants(),this._refreshColorZonePadding())})),this._register(this._renderService.onRender(()=>{(!this._containerHeight||this._containerHeight!==this._screenElement.clientHeight)&&(this._queueRefresh(!0),this._containerHeight=this._screenElement.clientHeight)})),this._register(this._coreBrowserService.onDprChange(()=>this._queueRefresh(!0))),this._register(this._optionsService.onSpecificOptionChange(`overviewRuler`,()=>this._queueRefresh(!0))),this._register(this._themeService.onChangeColors(()=>this._queueRefresh())),this._queueRefresh(!0)}get _width(){return this._optionsService.options.overviewRuler?.width||0}_refreshDrawConstants(){let e=Math.floor((this._canvas.width-1)/3),t=Math.ceil((this._canvas.width-1)/3);Wq.full=this._canvas.width,Wq.left=e,Wq.center=t,Wq.right=e,this._refreshDrawHeightConstants(),Gq.full=1,Gq.left=1,Gq.center=1+Wq.left,Gq.right=1+Wq.left+Wq.center}_refreshDrawHeightConstants(){Uq.full=Math.round(2*this._coreBrowserService.dpr);let e=this._canvas.height/this._bufferService.buffer.lines.length,t=Math.round(Math.max(Math.min(e,12),6)*this._coreBrowserService.dpr);Uq.left=t,Uq.center=t,Uq.right=t}_refreshColorZonePadding(){this._colorZoneStore.setPadding({full:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Uq.full),left:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Uq.left),center:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Uq.center),right:Math.floor(this._bufferService.buffers.active.lines.length/(this._canvas.height-1)*Uq.right)}),this._lastKnownBufferLength=this._bufferService.buffers.normal.lines.length}_refreshCanvasDimensions(){this._canvas.style.width=`${this._width}px`,this._canvas.width=Math.round(this._width*this._coreBrowserService.dpr),this._canvas.style.height=`${this._screenElement.clientHeight}px`,this._canvas.height=Math.round(this._screenElement.clientHeight*this._coreBrowserService.dpr),this._refreshDrawConstants(),this._refreshColorZonePadding()}_refreshDecorations(){this._shouldUpdateDimensions&&this._refreshCanvasDimensions(),this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height),this._colorZoneStore.clear();for(let e of this._decorationService.decorations)this._colorZoneStore.addDecoration(e);this._ctx.lineWidth=1,this._renderRulerOutline();let e=this._colorZoneStore.zones;for(let t of e)t.position!==`full`&&this._renderColorZone(t);for(let t of e)t.position===`full`&&this._renderColorZone(t);this._shouldUpdateDimensions=!1,this._shouldUpdateAnchor=!1}_renderRulerOutline(){this._ctx.fillStyle=this._themeService.colors.overviewRulerBorder.css,this._ctx.fillRect(0,0,1,this._canvas.height),this._optionsService.rawOptions.overviewRuler.showTopBorder&&this._ctx.fillRect(1,0,this._canvas.width-1,1),this._optionsService.rawOptions.overviewRuler.showBottomBorder&&this._ctx.fillRect(1,this._canvas.height-1,this._canvas.width-1,this._canvas.height)}_renderColorZone(e){this._ctx.fillStyle=e.color,this._ctx.fillRect(Gq[e.position||`full`],Math.round((this._canvas.height-1)*(e.startBufferLine/this._bufferService.buffers.active.lines.length)-Uq[e.position||`full`]/2),Wq[e.position||`full`],Math.round((this._canvas.height-1)*((e.endBufferLine-e.startBufferLine)/this._bufferService.buffers.active.lines.length)+Uq[e.position||`full`]))}_queueRefresh(e,t){this._shouldUpdateDimensions=e||this._shouldUpdateDimensions,this._shouldUpdateAnchor=t||this._shouldUpdateAnchor,this._animationFrame===void 0&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>{this._refreshDecorations(),this._animationFrame=void 0}))}};Kq=$U([J(2,EW),J(3,FW),J(4,VW),J(5,MW),J(6,WW),J(7,zW)],Kq);var Q;(e=>(e.NUL=`\0`,e.SOH=``,e.STX=``,e.ETX=``,e.EOT=``,e.ENQ=``,e.ACK=``,e.BEL=`\x07`,e.BS=`\b`,e.HT=` `,e.LF=`
|
|
1544
1544
|
`,e.VT=`\v`,e.FF=`\f`,e.CR=`\r`,e.SO=``,e.SI=``,e.DLE=``,e.DC1=``,e.DC2=``,e.DC3=``,e.DC4=``,e.NAK=``,e.SYN=``,e.ETB=``,e.CAN=``,e.EM=``,e.SUB=``,e.ESC=`\x1B`,e.FS=``,e.GS=``,e.RS=``,e.US=``,e.SP=` `,e.DEL=``))(Q||={});var qq;(e=>(e.PAD=``,e.HOP=``,e.BPH=``,e.NBH=``,e.IND=``,e.NEL=`
`,e.SSA=``,e.ESA=``,e.HTS=``,e.HTJ=``,e.VTS=``,e.PLD=``,e.PLU=``,e.RI=``,e.SS2=``,e.SS3=``,e.DCS=``,e.PU1=``,e.PU2=``,e.STS=``,e.CCH=``,e.MW=``,e.SPA=``,e.EPA=``,e.SOS=``,e.SGCI=``,e.SCI=``,e.CSI=``,e.ST=``,e.OSC=``,e.PM=``,e.APC=``))(qq||={});var Jq;(e=>e.ST=`${Q.ESC}\\`)(Jq||={});var Yq=class{constructor(e,t,n,r,i,a){this._textarea=e,this._compositionView=t,this._bufferService=n,this._optionsService=r,this._coreService=i,this._renderService=a,this._isComposing=!1,this._isSendingComposition=!1,this._compositionPosition={start:0,end:0},this._dataAlreadySent=``}get isComposing(){return this._isComposing}compositionstart(){this._isComposing=!0,this._compositionPosition.start=this._textarea.value.length,this._compositionView.textContent=``,this._dataAlreadySent=``,this._compositionView.classList.add(`active`)}compositionupdate(e){this._compositionView.textContent=e.data,this.updateCompositionElements(),setTimeout(()=>{this._compositionPosition.end=this._textarea.value.length},0)}compositionend(){this._finalizeComposition(!0)}keydown(e){if(this._isComposing||this._isSendingComposition){if(e.keyCode===20||e.keyCode===229||e.keyCode===16||e.keyCode===17||e.keyCode===18)return!1;this._finalizeComposition(!1)}return e.keyCode!==229||(this._handleAnyTextareaChanges(),!1)}_finalizeComposition(e){if(this._compositionView.classList.remove(`active`),this._isComposing=!1,e){let e={start:this._compositionPosition.start,end:this._compositionPosition.end};this._isSendingComposition=!0,setTimeout(()=>{if(this._isSendingComposition){this._isSendingComposition=!1;let t;e.start+=this._dataAlreadySent.length,t=this._isComposing?this._textarea.value.substring(e.start,this._compositionPosition.start):this._textarea.value.substring(e.start),t.length>0&&this._coreService.triggerDataEvent(t,!0)}},0)}else{this._isSendingComposition=!1;let e=this._textarea.value.substring(this._compositionPosition.start,this._compositionPosition.end);this._coreService.triggerDataEvent(e,!0)}}_handleAnyTextareaChanges(){let e=this._textarea.value;setTimeout(()=>{if(!this._isComposing){let t=this._textarea.value,n=t.replace(e,``);this._dataAlreadySent=n,t.length>e.length?this._coreService.triggerDataEvent(n,!0):t.length<e.length?this._coreService.triggerDataEvent(`${Q.DEL}`,!0):t.length===e.length&&t!==e&&this._coreService.triggerDataEvent(t,!0)}},0)}updateCompositionElements(e){if(this._isComposing){if(this._bufferService.buffer.isCursorInViewport){let e=Math.min(this._bufferService.buffer.x,this._bufferService.cols-1),t=this._renderService.dimensions.css.cell.height,n=this._bufferService.buffer.y*this._renderService.dimensions.css.cell.height,r=e*this._renderService.dimensions.css.cell.width;this._compositionView.style.left=r+`px`,this._compositionView.style.top=n+`px`,this._compositionView.style.height=t+`px`,this._compositionView.style.lineHeight=t+`px`,this._compositionView.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._compositionView.style.fontSize=this._optionsService.rawOptions.fontSize+`px`;let i=this._compositionView.getBoundingClientRect();this._textarea.style.left=r+`px`,this._textarea.style.top=n+`px`,this._textarea.style.width=Math.max(i.width,1)+`px`,this._textarea.style.height=Math.max(i.height,1)+`px`,this._textarea.style.lineHeight=i.height+`px`}e||setTimeout(()=>this.updateCompositionElements(!0),0)}}};Yq=$U([J(2,EW),J(3,MW),J(4,OW),J(5,VW)],Yq);var Xq=0,Zq=0,Qq=0,$q=0,eJ={css:`#00000000`,rgba:0},tJ;(e=>{function t(e,t,n,r){return r===void 0?`#${oJ(e)}${oJ(t)}${oJ(n)}`:`#${oJ(e)}${oJ(t)}${oJ(n)}${oJ(r)}`}e.toCss=t;function n(e,t,n,r=255){return(e<<24|t<<16|n<<8|r)>>>0}e.toRgba=n;function r(t,n,r,i){return{css:e.toCss(t,n,r,i),rgba:e.toRgba(t,n,r,i)}}e.toColor=r})(tJ||={});var nJ;(e=>{function t(e,t){if($q=(t.rgba&255)/255,$q===1)return{css:t.css,rgba:t.rgba};let n=t.rgba>>24&255,r=t.rgba>>16&255,i=t.rgba>>8&255,a=e.rgba>>24&255,o=e.rgba>>16&255,s=e.rgba>>8&255;return Xq=a+Math.round((n-a)*$q),Zq=o+Math.round((r-o)*$q),Qq=s+Math.round((i-s)*$q),{css:tJ.toCss(Xq,Zq,Qq),rgba:tJ.toRgba(Xq,Zq,Qq)}}e.blend=t;function n(e){return(e.rgba&255)==255}e.isOpaque=n;function r(e,t,n){let r=aJ.ensureContrastRatio(e.rgba,t.rgba,n);if(r)return tJ.toColor(r>>24&255,r>>16&255,r>>8&255)}e.ensureContrastRatio=r;function i(e){let t=(e.rgba|255)>>>0;return[Xq,Zq,Qq]=aJ.toChannels(t),{css:tJ.toCss(Xq,Zq,Qq),rgba:t}}e.opaque=i;function a(e,t){return $q=Math.round(t*255),[Xq,Zq,Qq]=aJ.toChannels(e.rgba),{css:tJ.toCss(Xq,Zq,Qq,$q),rgba:tJ.toRgba(Xq,Zq,Qq,$q)}}e.opacity=a;function o(e,t){return $q=e.rgba&255,a(e,$q*t/255)}e.multiplyOpacity=o;function s(e){return[e.rgba>>24&255,e.rgba>>16&255,e.rgba>>8&255]}e.toColorRGB=s})(nJ||={});var rJ;(e=>{let t,n;try{let e=document.createElement(`canvas`);e.width=1,e.height=1;let r=e.getContext(`2d`,{willReadFrequently:!0});r&&(t=r,t.globalCompositeOperation=`copy`,n=t.createLinearGradient(0,0,1,1))}catch{}function r(e){if(e.match(/#[\da-f]{3,8}/i))switch(e.length){case 4:return Xq=parseInt(e.slice(1,2).repeat(2),16),Zq=parseInt(e.slice(2,3).repeat(2),16),Qq=parseInt(e.slice(3,4).repeat(2),16),tJ.toColor(Xq,Zq,Qq);case 5:return Xq=parseInt(e.slice(1,2).repeat(2),16),Zq=parseInt(e.slice(2,3).repeat(2),16),Qq=parseInt(e.slice(3,4).repeat(2),16),$q=parseInt(e.slice(4,5).repeat(2),16),tJ.toColor(Xq,Zq,Qq,$q);case 7:return{css:e,rgba:(parseInt(e.slice(1),16)<<8|255)>>>0};case 9:return{css:e,rgba:parseInt(e.slice(1),16)>>>0}}let r=e.match(/rgba?\(\s*(\d{1,3})\s*,\s*(\d{1,3})\s*,\s*(\d{1,3})\s*(,\s*(0|1|\d?\.(\d+))\s*)?\)/);if(r)return Xq=parseInt(r[1]),Zq=parseInt(r[2]),Qq=parseInt(r[3]),$q=Math.round((r[5]===void 0?1:parseFloat(r[5]))*255),tJ.toColor(Xq,Zq,Qq,$q);if(!t||!n||(t.fillStyle=n,t.fillStyle=e,typeof t.fillStyle!=`string`)||(t.fillRect(0,0,1,1),[Xq,Zq,Qq,$q]=t.getImageData(0,0,1,1).data,$q!==255))throw Error(`css.toColor: Unsupported css format`);return{rgba:tJ.toRgba(Xq,Zq,Qq,$q),css:e}}e.toColor=r})(rJ||={});var iJ;(e=>{function t(e){return n(e>>16&255,e>>8&255,e&255)}e.relativeLuminance=t;function n(e,t,n){let r=e/255,i=t/255,a=n/255,o=r<=.03928?r/12.92:((r+.055)/1.055)**2.4,s=i<=.03928?i/12.92:((i+.055)/1.055)**2.4,c=a<=.03928?a/12.92:((a+.055)/1.055)**2.4;return o*.2126+s*.7152+c*.0722}e.relativeLuminance2=n})(iJ||={});var aJ;(e=>{function t(e,t){if($q=(t&255)/255,$q===1)return t;let n=t>>24&255,r=t>>16&255,i=t>>8&255,a=e>>24&255,o=e>>16&255,s=e>>8&255;return Xq=a+Math.round((n-a)*$q),Zq=o+Math.round((r-o)*$q),Qq=s+Math.round((i-s)*$q),tJ.toRgba(Xq,Zq,Qq)}e.blend=t;function n(e,t,n){let a=iJ.relativeLuminance(e>>8),o=iJ.relativeLuminance(t>>8);if(sJ(a,o)<n){if(o<a){let o=r(e,t,n),s=sJ(a,iJ.relativeLuminance(o>>8));if(s<n){let r=i(e,t,n);return s>sJ(a,iJ.relativeLuminance(r>>8))?o:r}return o}let s=i(e,t,n),c=sJ(a,iJ.relativeLuminance(s>>8));if(c<n){let i=r(e,t,n);return c>sJ(a,iJ.relativeLuminance(i>>8))?s:i}return s}}e.ensureContrastRatio=n;function r(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=sJ(iJ.relativeLuminance2(o,s,c),iJ.relativeLuminance2(r,i,a));for(;l<n&&(o>0||s>0||c>0);)o-=Math.max(0,Math.ceil(o*.1)),s-=Math.max(0,Math.ceil(s*.1)),c-=Math.max(0,Math.ceil(c*.1)),l=sJ(iJ.relativeLuminance2(o,s,c),iJ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.reduceLuminance=r;function i(e,t,n){let r=e>>24&255,i=e>>16&255,a=e>>8&255,o=t>>24&255,s=t>>16&255,c=t>>8&255,l=sJ(iJ.relativeLuminance2(o,s,c),iJ.relativeLuminance2(r,i,a));for(;l<n&&(o<255||s<255||c<255);)o=Math.min(255,o+Math.ceil((255-o)*.1)),s=Math.min(255,s+Math.ceil((255-s)*.1)),c=Math.min(255,c+Math.ceil((255-c)*.1)),l=sJ(iJ.relativeLuminance2(o,s,c),iJ.relativeLuminance2(r,i,a));return(o<<24|s<<16|c<<8|255)>>>0}e.increaseLuminance=i;function a(e){return[e>>24&255,e>>16&255,e>>8&255,e&255]}e.toChannels=a})(aJ||={});function oJ(e){let t=e.toString(16);return t.length<2?`0`+t:t}function sJ(e,t){return e<t?(t+.05)/(e+.05):(e+.05)/(t+.05)}var cJ=class extends _W{constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}},lJ=class{constructor(e){this._bufferService=e,this._characterJoiners=[],this._nextCharacterJoinerId=0,this._workCell=new yW}register(e){let t={id:this._nextCharacterJoinerId++,handler:e};return this._characterJoiners.push(t),t.id}deregister(e){for(let t=0;t<this._characterJoiners.length;t++)if(this._characterJoiners[t].id===e)return this._characterJoiners.splice(t,1),!0;return!1}getJoinedCharacters(e){if(this._characterJoiners.length===0)return[];let t=this._bufferService.buffer.lines.get(e);if(!t||t.length===0)return[];let n=[],r=t.translateToString(!0),i=0,a=0,o=0,s=t.getFg(0),c=t.getBg(0);for(let e=0;e<t.getTrimmedLength();e++)if(t.loadCell(e,this._workCell),this._workCell.getWidth()!==0){if(this._workCell.fg!==s||this._workCell.bg!==c){if(e-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}i=e,o=a,s=this._workCell.fg,c=this._workCell.bg}a+=this._workCell.getChars().length||gW.length}if(this._bufferService.cols-i>1){let e=this._getJoinedRanges(r,o,a,t,i);for(let t=0;t<e.length;t++)n.push(e[t])}return n}_getJoinedRanges(e,t,n,r,i){let a=e.substring(t,n),o=[];try{o=this._characterJoiners[0].handler(a)}catch(e){console.error(e)}for(let e=1;e<this._characterJoiners.length;e++)try{let t=this._characterJoiners[e].handler(a);for(let e=0;e<t.length;e++)lJ._mergeRanges(o,t[e])}catch(e){console.error(e)}return this._stringRangesToCellRanges(o,r,i),o}_stringRangesToCellRanges(e,t,n){let r=0,i=!1,a=0,o=e[r];if(o){for(let s=n;s<this._bufferService.cols;s++){let n=t.getWidth(s),c=t.getString(s).length||gW.length;if(n!==0){if(!i&&o[0]<=a&&(o[0]=s,i=!0),o[1]<=a){if(o[1]=s,o=e[++r],!o)break;o[0]<=a?(o[0]=s,i=!0):i=!1}a+=c}}o&&(o[1]=this._bufferService.cols)}}static _mergeRanges(e,t){let n=!1;for(let r=0;r<e.length;r++){let i=e[r];if(n){if(t[1]<=i[0])return e[r-1][1]=t[1],e;if(t[1]<=i[1])return e[r-1][1]=Math.max(t[1],i[1]),e.splice(r,1),e;e.splice(r,1),r--}else{if(t[1]<=i[0])return e.splice(r,0,t),e;if(t[1]<=i[1])return i[0]=Math.min(t[0],i[0]),e;t[0]<i[1]&&(i[0]=Math.min(t[0],i[0]),n=!0);continue}}return n?e[e.length-1][1]=t[1]:e.push(t),e}};lJ=$U([J(0,EW)],lJ);function uJ(e){return 57508<=e&&e<=57558}function dJ(e){return 9472<=e&&e<=9631}function fJ(e){return uJ(e)||dJ(e)}function pJ(){return{css:{canvas:mJ(),cell:mJ()},device:{canvas:mJ(),cell:mJ(),char:{width:0,height:0,left:0,top:0}}}}function mJ(){return{width:0,height:0}}var hJ=class{constructor(e,t,n,r,i,a,o){this._document=e,this._characterJoinerService=t,this._optionsService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._themeService=o,this._workCell=new yW,this._columnSelectMode=!1,this.defaultSpacing=0}handleSelectionChanged(e,t,n){this._selectionStart=e,this._selectionEnd=t,this._columnSelectMode=n}createRow(e,t,n,r,i,a,o,s,c,l,u){let d=[],f=this._characterJoinerService.getJoinedCharacters(t),p=this._themeService.colors,m=e.getNoBgTrimmedLength();n&&m<a+1&&(m=a+1);let h,g=0,_=``,v=0,y=0,b=0,x=0,S=!1,C=0,ee=!1,te=0,ne=0,w=[],re=l!==-1&&u!==-1;for(let ie=0;ie<m;ie++){e.loadCell(ie,this._workCell);let m=this._workCell.getWidth();if(m===0)continue;let ae=!1,oe=ie>=ne,se=ie,T=this._workCell;if(f.length>0&&ie===f[0][0]&&oe){let r=f.shift(),i=this._isCellInSelection(r[0],t);for(v=r[0]+1;v<r[1];v++)oe&&=i===this._isCellInSelection(v,t);oe&&=!n||a<r[0]||a>=r[1],oe?(ae=!0,T=new cJ(this._workCell,e.translateToString(!0,r[0],r[1]),r[1]-r[0]),se=r[1]-1,m=T.getWidth()):ne=r[1]}let E=this._isCellInSelection(ie,t),D=n&&ie===a,ce=re&&ie>=l&&ie<=u,O=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{O=!0});let le=T.getChars()||gW;if(le===` `&&(T.isUnderline()||T.isOverline())&&(le=`\xA0`),te=m*s-c.get(le,T.isBold(),T.isItalic()),!h)h=this._document.createElement(`span`);else if(g&&(E&&ee||!E&&!ee&&T.bg===y)&&(E&&ee&&p.selectionForeground||T.fg===b)&&T.extended.ext===x&&ce===S&&te===C&&!D&&!ae&&!O&&oe){T.isInvisible()?_+=gW:_+=le,g++;continue}else g&&(h.textContent=_),h=this._document.createElement(`span`),g=0,_=``;if(y=T.bg,b=T.fg,x=T.extended.ext,S=ce,C=te,ee=E,ae&&a>=ie&&a<=se&&(a=ie),!this._coreService.isCursorHidden&&D&&this._coreService.isCursorInitialized){if(w.push(`xterm-cursor`),this._coreBrowserService.isFocused)o&&w.push(`xterm-cursor-blink`),w.push(r===`bar`?`xterm-cursor-bar`:r===`underline`?`xterm-cursor-underline`:`xterm-cursor-block`);else if(i)switch(i){case`outline`:w.push(`xterm-cursor-outline`);break;case`block`:w.push(`xterm-cursor-block`);break;case`bar`:w.push(`xterm-cursor-bar`);break;case`underline`:w.push(`xterm-cursor-underline`);break;default:break}}if(T.isBold()&&w.push(`xterm-bold`),T.isItalic()&&w.push(`xterm-italic`),T.isDim()&&w.push(`xterm-dim`),_=T.isInvisible()?gW:T.getChars()||gW,T.isUnderline()&&(w.push(`xterm-underline-${T.extended.underlineStyle}`),_===` `&&(_=`\xA0`),!T.isUnderlineColorDefault())){if(T.isUnderlineColorRGB())h.style.textDecorationColor=`rgb(${_W.toColorRGB(T.getUnderlineColor()).join(`,`)})`;else{let e=T.getUnderlineColor();this._optionsService.rawOptions.drawBoldTextInBrightColors&&T.isBold()&&e<8&&(e+=8),h.style.textDecorationColor=p.ansi[e].css}}T.isOverline()&&(w.push(`xterm-overline`),_===` `&&(_=`\xA0`)),T.isStrikethrough()&&w.push(`xterm-strikethrough`),ce&&(h.style.textDecoration=`underline`);let ue=T.getFgColor(),de=T.getFgColorMode(),k=T.getBgColor(),fe=T.getBgColorMode(),pe=!!T.isInverse();if(pe){let e=ue;ue=k,k=e;let t=de;de=fe,fe=t}let me,he,ge=!1;this._decorationService.forEachDecorationAtCell(ie,t,void 0,e=>{e.options.layer!==`top`&&ge||(e.backgroundColorRGB&&(fe=50331648,k=e.backgroundColorRGB.rgba>>8&16777215,me=e.backgroundColorRGB),e.foregroundColorRGB&&(de=50331648,ue=e.foregroundColorRGB.rgba>>8&16777215,he=e.foregroundColorRGB),ge=e.options.layer===`top`)}),!ge&&E&&(me=this._coreBrowserService.isFocused?p.selectionBackgroundOpaque:p.selectionInactiveBackgroundOpaque,k=me.rgba>>8&16777215,fe=50331648,ge=!0,p.selectionForeground&&(de=50331648,ue=p.selectionForeground.rgba>>8&16777215,he=p.selectionForeground)),ge&&w.push(`xterm-decoration-top`);let _e;switch(fe){case 16777216:case 33554432:_e=p.ansi[k],w.push(`xterm-bg-${k}`);break;case 50331648:_e=tJ.toColor(k>>16,k>>8&255,k&255),this._addStyle(h,`background-color:#${gJ((k>>>0).toString(16),`0`,6)}`);break;default:pe?(_e=p.foreground,w.push(`xterm-bg-257`)):_e=p.background}switch(me||T.isDim()&&(me=nJ.multiplyOpacity(_e,.5)),de){case 16777216:case 33554432:T.isBold()&&ue<8&&this._optionsService.rawOptions.drawBoldTextInBrightColors&&(ue+=8),this._applyMinimumContrast(h,_e,p.ansi[ue],T,me,void 0)||w.push(`xterm-fg-${ue}`);break;case 50331648:let e=tJ.toColor(ue>>16&255,ue>>8&255,ue&255);this._applyMinimumContrast(h,_e,e,T,me,he)||this._addStyle(h,`color:#${gJ(ue.toString(16),`0`,6)}`);break;default:this._applyMinimumContrast(h,_e,p.foreground,T,me,he)||pe&&w.push(`xterm-fg-257`)}w.length&&=(h.className=w.join(` `),0),!D&&!ae&&!O&&oe?g++:h.textContent=_,te!==this.defaultSpacing&&(h.style.letterSpacing=`${te}px`),d.push(h),ie=se}return h&&g&&(h.textContent=_),d}_applyMinimumContrast(e,t,n,r,i,a){if(this._optionsService.rawOptions.minimumContrastRatio===1||fJ(r.getCode()))return!1;let o=this._getContrastCache(r),s;if(!i&&!a&&(s=o.getColor(t.rgba,n.rgba)),s===void 0){let e=this._optionsService.rawOptions.minimumContrastRatio/(r.isDim()?2:1);s=nJ.ensureContrastRatio(i||t,a||n,e),o.setColor((i||t).rgba,(a||n).rgba,s??null)}return s?(this._addStyle(e,`color:${s.css}`),!0):!1}_getContrastCache(e){return e.isDim()?this._themeService.colors.halfContrastCache:this._themeService.colors.contrastCache}_addStyle(e,t){e.setAttribute(`style`,`${e.getAttribute(`style`)||``}${t};`)}_isCellInSelection(e,t){let n=this._selectionStart,r=this._selectionEnd;return!n||!r?!1:this._columnSelectMode?n[0]<=r[0]?e>=n[0]&&t>=n[1]&&e<r[0]&&t<=r[1]:e<n[0]&&t>=n[1]&&e>=r[0]&&t<=r[1]:t>n[1]&&t<r[1]||n[1]===r[1]&&t===n[1]&&e>=n[0]&&e<r[0]||n[1]<r[1]&&t===r[1]&&e<r[0]||n[1]<r[1]&&t===n[1]&&e>=n[0]}};hJ=$U([J(1,UW),J(2,MW),J(3,zW),J(4,OW),J(5,FW),J(6,WW)],hJ);function gJ(e,t,n){for(;e.length<n;)e=t+e;return e}var _J=class{constructor(e,t){this._flat=new Float32Array(256),this._font=``,this._fontSize=0,this._weight=`normal`,this._weightBold=`bold`,this._measureElements=[],this._container=e.createElement(`div`),this._container.classList.add(`xterm-width-cache-measure-container`),this._container.setAttribute(`aria-hidden`,`true`),this._container.style.whiteSpace=`pre`,this._container.style.fontKerning=`none`;let n=e.createElement(`span`);n.classList.add(`xterm-char-measure-element`);let r=e.createElement(`span`);r.classList.add(`xterm-char-measure-element`),r.style.fontWeight=`bold`;let i=e.createElement(`span`);i.classList.add(`xterm-char-measure-element`),i.style.fontStyle=`italic`;let a=e.createElement(`span`);a.classList.add(`xterm-char-measure-element`),a.style.fontWeight=`bold`,a.style.fontStyle=`italic`,this._measureElements=[n,r,i,a],this._container.appendChild(n),this._container.appendChild(r),this._container.appendChild(i),this._container.appendChild(a),t.appendChild(this._container),this.clear()}dispose(){this._container.remove(),this._measureElements.length=0,this._holey=void 0}clear(){this._flat.fill(-9999),this._holey=new Map}setFont(e,t,n,r){e===this._font&&t===this._fontSize&&n===this._weight&&r===this._weightBold||(this._font=e,this._fontSize=t,this._weight=n,this._weightBold=r,this._container.style.fontFamily=this._font,this._container.style.fontSize=`${this._fontSize}px`,this._measureElements[0].style.fontWeight=`${n}`,this._measureElements[1].style.fontWeight=`${r}`,this._measureElements[2].style.fontWeight=`${n}`,this._measureElements[3].style.fontWeight=`${r}`,this.clear())}get(e,t,n){let r=0;if(!t&&!n&&e.length===1&&(r=e.charCodeAt(0))<256){if(this._flat[r]!==-9999)return this._flat[r];let t=this._measure(e,0);return t>0&&(this._flat[r]=t),t}let i=e;t&&(i+=`B`),n&&(i+=`I`);let a=this._holey.get(i);if(a===void 0){let r=0;t&&(r|=1),n&&(r|=2),a=this._measure(e,r),a>0&&this._holey.set(i,a)}return a}_measure(e,t){let n=this._measureElements[t];return n.textContent=e.repeat(32),n.offsetWidth/32}},vJ=class{constructor(){this.clear()}clear(){this.hasSelection=!1,this.columnSelectMode=!1,this.viewportStartRow=0,this.viewportEndRow=0,this.viewportCappedStartRow=0,this.viewportCappedEndRow=0,this.startCol=0,this.endCol=0,this.selectionStart=void 0,this.selectionEnd=void 0}update(e,t,n,r=!1){if(this.selectionStart=t,this.selectionEnd=n,!t||!n||t[0]===n[0]&&t[1]===n[1]){this.clear();return}let i=e.buffers.active.ydisp,a=t[1]-i,o=n[1]-i,s=Math.max(a,0),c=Math.min(o,e.rows-1);if(s>=e.rows||c<0){this.clear();return}this.hasSelection=!0,this.columnSelectMode=r,this.viewportStartRow=a,this.viewportEndRow=o,this.viewportCappedStartRow=s,this.viewportCappedEndRow=c,this.startCol=t[0],this.endCol=n[0]}isCellSelected(e,t,n){return this.hasSelection?(n-=e.buffer.active.viewportY,this.columnSelectMode?this.startCol<=this.endCol?t>=this.startCol&&n>=this.viewportCappedStartRow&&t<this.endCol&&n<=this.viewportCappedEndRow:t<this.startCol&&n>=this.viewportCappedStartRow&&t>=this.endCol&&n<=this.viewportCappedEndRow:n>this.viewportStartRow&&n<this.viewportEndRow||this.viewportStartRow===this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportEndRow&&t<this.endCol||this.viewportStartRow<this.viewportEndRow&&n===this.viewportStartRow&&t>=this.startCol):!1}};function yJ(){return new vJ}var bJ=`xterm-dom-renderer-owner-`,xJ=`xterm-rows`,SJ=`xterm-fg-`,CJ=`xterm-bg-`,wJ=`xterm-focus`,TJ=`xterm-selection`,EJ=1,DJ=class extends Y{constructor(e,t,n,r,i,a,o,s,c,l,u,d,f,p){super(),this._terminal=e,this._document=t,this._element=n,this._screenElement=r,this._viewportElement=i,this._helperContainer=a,this._linkifier2=o,this._charSizeService=c,this._optionsService=l,this._bufferService=u,this._coreService=d,this._coreBrowserService=f,this._themeService=p,this._terminalClass=EJ++,this._rowElements=[],this._selectionRenderModel=yJ(),this.onRequestRedraw=this._register(new X).event,this._rowContainer=this._document.createElement(`div`),this._rowContainer.classList.add(xJ),this._rowContainer.style.lineHeight=`normal`,this._rowContainer.setAttribute(`aria-hidden`,`true`),this._refreshRowElements(this._bufferService.cols,this._bufferService.rows),this._selectionContainer=this._document.createElement(`div`),this._selectionContainer.classList.add(TJ),this._selectionContainer.setAttribute(`aria-hidden`,`true`),this.dimensions=pJ(),this._updateDimensions(),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._themeService.onChangeColors(e=>this._injectCss(e))),this._injectCss(this._themeService.colors),this._rowFactory=s.createInstance(hJ,document),this._element.classList.add(bJ+this._terminalClass),this._screenElement.appendChild(this._rowContainer),this._screenElement.appendChild(this._selectionContainer),this._register(this._linkifier2.onShowLinkUnderline(e=>this._handleLinkHover(e))),this._register(this._linkifier2.onHideLinkUnderline(e=>this._handleLinkLeave(e))),this._register(fG(()=>{this._element.classList.remove(bJ+this._terminalClass),this._rowContainer.remove(),this._selectionContainer.remove(),this._widthCache.dispose(),this._themeStyleElement.remove(),this._dimensionsStyleElement.remove()})),this._widthCache=new _J(this._document,this._helperContainer),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}_updateDimensions(){let e=this._coreBrowserService.dpr;this.dimensions.device.char.width=this._charSizeService.width*e,this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*e),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.left=0,this.dimensions.device.char.top=0,this.dimensions.device.canvas.width=this.dimensions.device.cell.width*this._bufferService.cols,this.dimensions.device.canvas.height=this.dimensions.device.cell.height*this._bufferService.rows,this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/e),this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/e),this.dimensions.css.cell.width=this.dimensions.css.canvas.width/this._bufferService.cols,this.dimensions.css.cell.height=this.dimensions.css.canvas.height/this._bufferService.rows;for(let e of this._rowElements)e.style.width=`${this.dimensions.css.canvas.width}px`,e.style.height=`${this.dimensions.css.cell.height}px`,e.style.lineHeight=`${this.dimensions.css.cell.height}px`,e.style.overflow=`hidden`;this._dimensionsStyleElement||(this._dimensionsStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._dimensionsStyleElement));let t=`${this._terminalSelector} .${xJ} span { display: inline-block; height: 100%; vertical-align: top;}`;this._dimensionsStyleElement.textContent=t,this._selectionContainer.style.height=this._viewportElement.style.height,this._screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._screenElement.style.height=`${this.dimensions.css.canvas.height}px`}_injectCss(e){this._themeStyleElement||(this._themeStyleElement=this._document.createElement(`style`),this._screenElement.appendChild(this._themeStyleElement));let t=`${this._terminalSelector} .${xJ} { pointer-events: none; color: ${e.foreground.css}; font-family: ${this._optionsService.rawOptions.fontFamily}; font-size: ${this._optionsService.rawOptions.fontSize}px; font-kerning: none; white-space: pre}`;t+=`${this._terminalSelector} .${xJ} .xterm-dim { color: ${nJ.multiplyOpacity(e.foreground,.5).css};}`,t+=`${this._terminalSelector} span:not(.xterm-bold) { font-weight: ${this._optionsService.rawOptions.fontWeight};}${this._terminalSelector} span.xterm-bold { font-weight: ${this._optionsService.rawOptions.fontWeightBold};}${this._terminalSelector} span.xterm-italic { font-style: italic;}`;let n=`blink_underline_${this._terminalClass}`,r=`blink_bar_${this._terminalClass}`,i=`blink_block_${this._terminalClass}`;t+=`@keyframes ${n} { 50% { border-bottom-style: hidden; }}`,t+=`@keyframes ${r} { 50% { box-shadow: none; }}`,t+=`@keyframes ${i} { 0% { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css}; } 50% { background-color: inherit; color: ${e.cursor.css}; }}`,t+=`${this._terminalSelector} .${xJ}.${wJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-underline { animation: ${n} 1s step-end infinite;}${this._terminalSelector} .${xJ}.${wJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-bar { animation: ${r} 1s step-end infinite;}${this._terminalSelector} .${xJ}.${wJ} .xterm-cursor.xterm-cursor-blink.xterm-cursor-block { animation: ${i} 1s step-end infinite;}${this._terminalSelector} .${xJ} .xterm-cursor.xterm-cursor-block { background-color: ${e.cursor.css}; color: ${e.cursorAccent.css};}${this._terminalSelector} .${xJ} .xterm-cursor.xterm-cursor-block:not(.xterm-cursor-blink) { background-color: ${e.cursor.css} !important; color: ${e.cursorAccent.css} !important;}${this._terminalSelector} .${xJ} .xterm-cursor.xterm-cursor-outline { outline: 1px solid ${e.cursor.css}; outline-offset: -1px;}${this._terminalSelector} .${xJ} .xterm-cursor.xterm-cursor-bar { box-shadow: ${this._optionsService.rawOptions.cursorWidth}px 0 0 ${e.cursor.css} inset;}${this._terminalSelector} .${xJ} .xterm-cursor.xterm-cursor-underline { border-bottom: 1px ${e.cursor.css}; border-bottom-style: solid; height: calc(100% - 1px);}`,t+=`${this._terminalSelector} .${TJ} { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none;}${this._terminalSelector}.focus .${TJ} div { position: absolute; background-color: ${e.selectionBackgroundOpaque.css};}${this._terminalSelector} .${TJ} div { position: absolute; background-color: ${e.selectionInactiveBackgroundOpaque.css};}`;for(let[n,r]of e.ansi.entries())t+=`${this._terminalSelector} .${SJ}${n} { color: ${r.css}; }${this._terminalSelector} .${SJ}${n}.xterm-dim { color: ${nJ.multiplyOpacity(r,.5).css}; }${this._terminalSelector} .${CJ}${n} { background-color: ${r.css}; }`;t+=`${this._terminalSelector} .${SJ}257 { color: ${nJ.opaque(e.background).css}; }${this._terminalSelector} .${SJ}257.xterm-dim { color: ${nJ.multiplyOpacity(nJ.opaque(e.background),.5).css}; }${this._terminalSelector} .${CJ}257 { background-color: ${e.foreground.css}; }`,this._themeStyleElement.textContent=t}_setDefaultSpacing(){let e=this.dimensions.css.cell.width-this._widthCache.get(`W`,!1,!1);this._rowContainer.style.letterSpacing=`${e}px`,this._rowFactory.defaultSpacing=e}handleDevicePixelRatioChange(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}_refreshRowElements(e,t){for(let e=this._rowElements.length;e<=t;e++){let e=this._document.createElement(`div`);this._rowContainer.appendChild(e),this._rowElements.push(e)}for(;this._rowElements.length>t;)this._rowContainer.removeChild(this._rowElements.pop())}handleResize(e,t){this._refreshRowElements(e,t),this._updateDimensions(),this.handleSelectionChanged(this._selectionRenderModel.selectionStart,this._selectionRenderModel.selectionEnd,this._selectionRenderModel.columnSelectMode)}handleCharSizeChanged(){this._updateDimensions(),this._widthCache.clear(),this._setDefaultSpacing()}handleBlur(){this._rowContainer.classList.remove(wJ),this.renderRows(0,this._bufferService.rows-1)}handleFocus(){this._rowContainer.classList.add(wJ),this.renderRows(this._bufferService.buffer.y,this._bufferService.buffer.y)}handleSelectionChanged(e,t,n){if(this._selectionContainer.replaceChildren(),this._rowFactory.handleSelectionChanged(e,t,n),this.renderRows(0,this._bufferService.rows-1),!e||!t||(this._selectionRenderModel.update(this._terminal,e,t,n),!this._selectionRenderModel.hasSelection))return;let r=this._selectionRenderModel.viewportStartRow,i=this._selectionRenderModel.viewportEndRow,a=this._selectionRenderModel.viewportCappedStartRow,o=this._selectionRenderModel.viewportCappedEndRow,s=this._document.createDocumentFragment();if(n){let n=e[0]>t[0];s.appendChild(this._createSelectionElement(a,n?t[0]:e[0],n?e[0]:t[0],o-a+1))}else{let n=r===a?e[0]:0,c=a===i?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(a,n,c));let l=o-a-1;if(s.appendChild(this._createSelectionElement(a+1,0,this._bufferService.cols,l)),a!==o){let e=i===o?t[0]:this._bufferService.cols;s.appendChild(this._createSelectionElement(o,0,e))}}this._selectionContainer.appendChild(s)}_createSelectionElement(e,t,n,r=1){let i=this._document.createElement(`div`),a=t*this.dimensions.css.cell.width,o=this.dimensions.css.cell.width*(n-t);return a+o>this.dimensions.css.canvas.width&&(o=this.dimensions.css.canvas.width-a),i.style.height=`${r*this.dimensions.css.cell.height}px`,i.style.top=`${e*this.dimensions.css.cell.height}px`,i.style.left=`${a}px`,i.style.width=`${o}px`,i}handleCursorMove(){}_handleOptionsChanged(){this._updateDimensions(),this._injectCss(this._themeService.colors),this._widthCache.setFont(this._optionsService.rawOptions.fontFamily,this._optionsService.rawOptions.fontSize,this._optionsService.rawOptions.fontWeight,this._optionsService.rawOptions.fontWeightBold),this._setDefaultSpacing()}clear(){for(let e of this._rowElements)e.replaceChildren()}renderRows(e,t){let n=this._bufferService.buffer,r=n.ybase+n.y,i=Math.min(n.x,this._bufferService.cols-1),a=this._coreService.decPrivateModes.cursorBlink??this._optionsService.rawOptions.cursorBlink,o=this._coreService.decPrivateModes.cursorStyle??this._optionsService.rawOptions.cursorStyle,s=this._optionsService.rawOptions.cursorInactiveStyle;for(let c=e;c<=t;c++){let e=c+n.ydisp,t=this._rowElements[c],l=n.lines.get(e);if(!t||!l)break;t.replaceChildren(...this._rowFactory.createRow(l,e,e===r,o,s,i,a,this.dimensions.css.cell.width,this._widthCache,-1,-1))}}get _terminalSelector(){return`.${bJ}${this._terminalClass}`}_handleLinkHover(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!0)}_handleLinkLeave(e){this._setCellUnderline(e.x1,e.x2,e.y1,e.y2,e.cols,!1)}_setCellUnderline(e,t,n,r,i,a){n<0&&(e=0),r<0&&(t=0);let o=this._bufferService.rows-1;n=Math.max(Math.min(n,o),0),r=Math.max(Math.min(r,o),0),i=Math.min(i,this._bufferService.cols);let s=this._bufferService.buffer,c=s.ybase+s.y,l=Math.min(s.x,i-1),u=this._optionsService.rawOptions.cursorBlink,d=this._optionsService.rawOptions.cursorStyle,f=this._optionsService.rawOptions.cursorInactiveStyle;for(let o=n;o<=r;++o){let p=o+s.ydisp,m=this._rowElements[o],h=s.lines.get(p);if(!m||!h)break;m.replaceChildren(...this._rowFactory.createRow(h,p,p===c,d,f,l,u,this.dimensions.css.cell.width,this._widthCache,a?o===n?e:0:-1,a?(o===r?t:i)-1:-1))}}};DJ=$U([J(7,AW),J(8,RW),J(9,MW),J(10,EW),J(11,OW),J(12,zW),J(13,WW)],DJ);var OJ=class extends Y{constructor(e,t,n){super(),this._optionsService=n,this.width=0,this.height=0,this._onCharSizeChange=this._register(new X),this.onCharSizeChange=this._onCharSizeChange.event;try{this._measureStrategy=this._register(new jJ(this._optionsService))}catch{this._measureStrategy=this._register(new AJ(e,t,this._optionsService))}this._register(this._optionsService.onMultipleOptionChange([`fontFamily`,`fontSize`],()=>this.measure()))}get hasValidSize(){return this.width>0&&this.height>0}measure(){let e=this._measureStrategy.measure();(e.width!==this.width||e.height!==this.height)&&(this.width=e.width,this.height=e.height,this._onCharSizeChange.fire())}};OJ=$U([J(2,MW)],OJ);var kJ=class extends Y{constructor(){super(...arguments),this._result={width:0,height:0}}_validateAndSet(e,t){e!==void 0&&e>0&&t!==void 0&&t>0&&(this._result.width=e,this._result.height=t)}},AJ=class extends kJ{constructor(e,t,n){super(),this._document=e,this._parentElement=t,this._optionsService=n,this._measureElement=this._document.createElement(`span`),this._measureElement.classList.add(`xterm-char-measure-element`),this._measureElement.textContent=`W`.repeat(32),this._measureElement.setAttribute(`aria-hidden`,`true`),this._measureElement.style.whiteSpace=`pre`,this._measureElement.style.fontKerning=`none`,this._parentElement.appendChild(this._measureElement)}measure(){return this._measureElement.style.fontFamily=this._optionsService.rawOptions.fontFamily,this._measureElement.style.fontSize=`${this._optionsService.rawOptions.fontSize}px`,this._validateAndSet(Number(this._measureElement.offsetWidth)/32,Number(this._measureElement.offsetHeight)),this._result}},jJ=class extends kJ{constructor(e){super(),this._optionsService=e,this._canvas=new OffscreenCanvas(100,100),this._ctx=this._canvas.getContext(`2d`);let t=this._ctx.measureText(`W`);if(!(`width`in t&&`fontBoundingBoxAscent`in t&&`fontBoundingBoxDescent`in t))throw Error(`Required font metrics not supported`)}measure(){this._ctx.font=`${this._optionsService.rawOptions.fontSize}px ${this._optionsService.rawOptions.fontFamily}`;let e=this._ctx.measureText(`W`);return this._validateAndSet(e.width,e.fontBoundingBoxAscent+e.fontBoundingBoxDescent),this._result}},MJ=class extends Y{constructor(e,t,n){super(),this._textarea=e,this._window=t,this.mainDocument=n,this._isFocused=!1,this._cachedIsFocused=void 0,this._screenDprMonitor=this._register(new NJ(this._window)),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._onWindowChange=this._register(new X),this.onWindowChange=this._onWindowChange.event,this._register(this.onWindowChange(e=>this._screenDprMonitor.setWindow(e))),this._register(SG.forward(this._screenDprMonitor.onDprChange,this._onDprChange)),this._register(Z(this._textarea,`focus`,()=>this._isFocused=!0)),this._register(Z(this._textarea,`blur`,()=>this._isFocused=!1))}get window(){return this._window}set window(e){this._window!==e&&(this._window=e,this._onWindowChange.fire(this._window))}get dpr(){return this.window.devicePixelRatio}get isFocused(){return this._cachedIsFocused===void 0&&(this._cachedIsFocused=this._isFocused&&this._textarea.ownerDocument.hasFocus(),queueMicrotask(()=>this._cachedIsFocused=void 0)),this._cachedIsFocused}},NJ=class extends Y{constructor(e){super(),this._parentWindow=e,this._windowResizeListener=this._register(new hG),this._onDprChange=this._register(new X),this.onDprChange=this._onDprChange.event,this._outerListener=()=>this._setDprAndFireIfDiffers(),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._updateDpr(),this._setWindowResizeListener(),this._register(fG(()=>this.clearListener()))}setWindow(e){this._parentWindow=e,this._setWindowResizeListener(),this._setDprAndFireIfDiffers()}_setWindowResizeListener(){this._windowResizeListener.value=Z(this._parentWindow,`resize`,()=>this._setDprAndFireIfDiffers())}_setDprAndFireIfDiffers(){this._parentWindow.devicePixelRatio!==this._currentDevicePixelRatio&&this._onDprChange.fire(this._parentWindow.devicePixelRatio),this._updateDpr()}_updateDpr(){this._outerListener&&(this._resolutionMediaMatchList?.removeListener(this._outerListener),this._currentDevicePixelRatio=this._parentWindow.devicePixelRatio,this._resolutionMediaMatchList=this._parentWindow.matchMedia(`screen and (resolution: ${this._parentWindow.devicePixelRatio}dppx)`),this._resolutionMediaMatchList.addListener(this._outerListener))}clearListener(){!this._resolutionMediaMatchList||!this._outerListener||(this._resolutionMediaMatchList.removeListener(this._outerListener),this._resolutionMediaMatchList=void 0,this._outerListener=void 0)}},PJ=class extends Y{constructor(){super(),this.linkProviders=[],this._register(fG(()=>this.linkProviders.length=0))}registerLinkProvider(e){return this.linkProviders.push(e),{dispose:()=>{let t=this.linkProviders.indexOf(e);t!==-1&&this.linkProviders.splice(t,1)}}}};function FJ(e,t,n){let r=n.getBoundingClientRect(),i=e.getComputedStyle(n),a=parseInt(i.getPropertyValue(`padding-left`)),o=parseInt(i.getPropertyValue(`padding-top`));return[t.clientX-r.left-a,t.clientY-r.top-o]}function IJ(e,t,n,r,i,a,o,s,c){if(!a)return;let l=FJ(e,t,n);if(l)return l[0]=Math.ceil((l[0]+(c?o/2:0))/o),l[1]=Math.ceil(l[1]/s),l[0]=Math.min(Math.max(l[0],1),r+ +!!c),l[1]=Math.min(Math.max(l[1],1),i),l}var LJ=class{constructor(e,t){this._renderService=e,this._charSizeService=t}getCoords(e,t,n,r,i){return IJ(window,e,t,n,r,this._charSizeService.hasValidSize,this._renderService.dimensions.css.cell.width,this._renderService.dimensions.css.cell.height,i)}getMouseReportCoords(e,t){let n=FJ(window,e,t);if(this._charSizeService.hasValidSize)return n[0]=Math.min(Math.max(n[0],0),this._renderService.dimensions.css.canvas.width-1),n[1]=Math.min(Math.max(n[1],0),this._renderService.dimensions.css.canvas.height-1),{col:Math.floor(n[0]/this._renderService.dimensions.css.cell.width),row:Math.floor(n[1]/this._renderService.dimensions.css.cell.height),x:Math.floor(n[0]),y:Math.floor(n[1])}}};LJ=$U([J(0,VW),J(1,RW)],LJ);var RJ=class{constructor(e,t){this._renderCallback=e,this._coreBrowserService=t,this._refreshCallbacks=[]}dispose(){this._animationFrame&&=(this._coreBrowserService.window.cancelAnimationFrame(this._animationFrame),void 0)}addRefreshCallback(e){return this._refreshCallbacks.push(e),this._animationFrame||=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()),this._animationFrame}refresh(e,t,n){this._rowCount=n,e=e===void 0?0:e,t=t===void 0?this._rowCount-1:t,this._rowStart=this._rowStart===void 0?e:Math.min(this._rowStart,e),this._rowEnd=this._rowEnd===void 0?t:Math.max(this._rowEnd,t),!this._animationFrame&&(this._animationFrame=this._coreBrowserService.window.requestAnimationFrame(()=>this._innerRefresh()))}_innerRefresh(){if(this._animationFrame=void 0,this._rowStart===void 0||this._rowEnd===void 0||this._rowCount===void 0){this._runRefreshCallbacks();return}let e=Math.max(this._rowStart,0),t=Math.min(this._rowEnd,this._rowCount-1);this._rowStart=void 0,this._rowEnd=void 0,this._renderCallback(e,t),this._runRefreshCallbacks()}_runRefreshCallbacks(){for(let e of this._refreshCallbacks)e(0);this._refreshCallbacks=[]}},zJ={};QU(zJ,{getSafariVersion:()=>KJ,isChromeOS:()=>QJ,isFirefox:()=>UJ,isIpad:()=>JJ,isIphone:()=>YJ,isLegacyEdge:()=>WJ,isLinux:()=>ZJ,isMac:()=>qJ,isNode:()=>BJ,isSafari:()=>GJ,isWindows:()=>XJ});var BJ=typeof process<`u`&&`title`in process,VJ=BJ?`node`:navigator.userAgent,HJ=BJ?`node`:navigator.platform,UJ=VJ.includes(`Firefox`),WJ=VJ.includes(`Edge`),GJ=/^((?!chrome|android).)*safari/i.test(VJ);function KJ(){if(!GJ)return 0;let e=VJ.match(/Version\/(\d+)/);return e===null||e.length<2?0:parseInt(e[1])}var qJ=[`Macintosh`,`MacIntel`,`MacPPC`,`Mac68K`].includes(HJ),JJ=HJ===`iPad`,YJ=HJ===`iPhone`,XJ=[`Windows`,`Win16`,`Win32`,`WinCE`].includes(HJ),ZJ=HJ.indexOf(`Linux`)>=0,QJ=/\bCrOS\b/.test(VJ),$J=class{constructor(){this._tasks=[],this._i=0}enqueue(e){this._tasks.push(e),this._start()}flush(){for(;this._i<this._tasks.length;)this._tasks[this._i]()||this._i++;this.clear()}clear(){this._idleCallback&&=(this._cancelCallback(this._idleCallback),void 0),this._i=0,this._tasks.length=0}_start(){this._idleCallback||=this._requestCallback(this._process.bind(this))}_process(e){this._idleCallback=void 0;let t=0,n=0,r=e.timeRemaining(),i=0;for(;this._i<this._tasks.length;){if(t=performance.now(),this._tasks[this._i]()||this._i++,t=Math.max(1,performance.now()-t),n=Math.max(t,n),i=e.timeRemaining(),n*1.5>i){r-t<-20&&console.warn(`task queue exceeded allotted deadline by ${Math.abs(Math.round(r-t))}ms`),this._start();return}r=i}this.clear()}},eY=class extends $J{_requestCallback(e){return setTimeout(()=>e(this._createDeadline(16)))}_cancelCallback(e){clearTimeout(e)}_createDeadline(e){let t=performance.now()+e;return{timeRemaining:()=>Math.max(0,t-performance.now())}}},tY=class extends $J{_requestCallback(e){return requestIdleCallback(e)}_cancelCallback(e){cancelIdleCallback(e)}},nY=!BJ&&`requestIdleCallback`in window?tY:eY,rY=class{constructor(){this._queue=new nY}set(e){this._queue.clear(),this._queue.enqueue(e)}flush(){this._queue.flush()}},iY=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._rowCount=e,this._optionsService=n,this._charSizeService=r,this._coreService=i,this._coreBrowserService=s,this._renderer=this._register(new hG),this._pausedResizeTask=new rY,this._observerDisposable=this._register(new hG),this._isPaused=!1,this._needsFullRefresh=!1,this._isNextRenderRedrawOnly=!0,this._needsSelectionRefresh=!1,this._canvasWidth=0,this._canvasHeight=0,this._selectionState={start:void 0,end:void 0,columnSelectMode:!1},this._onDimensionsChange=this._register(new X),this.onDimensionsChange=this._onDimensionsChange.event,this._onRenderedViewportChange=this._register(new X),this.onRenderedViewportChange=this._onRenderedViewportChange.event,this._onRender=this._register(new X),this.onRender=this._onRender.event,this._onRefreshRequest=this._register(new X),this.onRefreshRequest=this._onRefreshRequest.event,this._renderDebouncer=new RJ((e,t)=>this._renderRows(e,t),this._coreBrowserService),this._register(this._renderDebouncer),this._syncOutputHandler=new aY(this._coreBrowserService,this._coreService,()=>this._fullRefresh()),this._register(fG(()=>this._syncOutputHandler.dispose())),this._register(this._coreBrowserService.onDprChange(()=>this.handleDevicePixelRatioChange())),this._register(o.onResize(()=>this._fullRefresh())),this._register(o.buffers.onBufferActivate(()=>this._renderer.value?.clear())),this._register(this._optionsService.onOptionChange(()=>this._handleOptionsChanged())),this._register(this._charSizeService.onCharSizeChange(()=>this.handleCharSizeChanged())),this._register(a.onDecorationRegistered(()=>this._fullRefresh())),this._register(a.onDecorationRemoved(()=>this._fullRefresh())),this._register(this._optionsService.onMultipleOptionChange([`customGlyphs`,`drawBoldTextInBrightColors`,`letterSpacing`,`lineHeight`,`fontFamily`,`fontSize`,`fontWeight`,`fontWeightBold`,`minimumContrastRatio`,`rescaleOverlappingGlyphs`],()=>{this.clear(),this.handleResize(o.cols,o.rows),this._fullRefresh()})),this._register(this._optionsService.onMultipleOptionChange([`cursorBlink`,`cursorStyle`],()=>this.refreshRows(o.buffer.y,o.buffer.y,!0))),this._register(c.onChangeColors(()=>this._fullRefresh())),this._registerIntersectionObserver(this._coreBrowserService.window,t),this._register(this._coreBrowserService.onWindowChange(e=>this._registerIntersectionObserver(e,t)))}get dimensions(){return this._renderer.value.dimensions}_registerIntersectionObserver(e,t){if(`IntersectionObserver`in e){let n=new e.IntersectionObserver(e=>this._handleIntersectionChange(e[e.length-1]),{threshold:0});n.observe(t),this._observerDisposable.value=fG(()=>n.disconnect())}}_handleIntersectionChange(e){this._isPaused=e.isIntersecting===void 0?e.intersectionRatio===0:!e.isIntersecting,!this._isPaused&&!this._charSizeService.hasValidSize&&this._charSizeService.measure(),!this._isPaused&&this._needsFullRefresh&&(this._pausedResizeTask.flush(),this.refreshRows(0,this._rowCount-1),this._needsFullRefresh=!1)}refreshRows(e,t,n=!1){if(this._isPaused){this._needsFullRefresh=!0;return}if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}let r=this._syncOutputHandler.flush();r&&(e=Math.min(e,r.start),t=Math.max(t,r.end)),n||(this._isNextRenderRedrawOnly=!1),this._renderDebouncer.refresh(e,t,this._rowCount)}_renderRows(e,t){if(this._renderer.value){if(this._coreService.decPrivateModes.synchronizedOutput){this._syncOutputHandler.bufferRows(e,t);return}e=Math.min(e,this._rowCount-1),t=Math.min(t,this._rowCount-1),this._renderer.value.renderRows(e,t),this._needsSelectionRefresh&&=(this._renderer.value.handleSelectionChanged(this._selectionState.start,this._selectionState.end,this._selectionState.columnSelectMode),!1),this._isNextRenderRedrawOnly||this._onRenderedViewportChange.fire({start:e,end:t}),this._onRender.fire({start:e,end:t}),this._isNextRenderRedrawOnly=!0}}resize(e,t){this._rowCount=t,this._fireOnCanvasResize()}_handleOptionsChanged(){this._renderer.value&&(this.refreshRows(0,this._rowCount-1),this._fireOnCanvasResize())}_fireOnCanvasResize(){this._renderer.value&&(this._renderer.value.dimensions.css.canvas.width===this._canvasWidth&&this._renderer.value.dimensions.css.canvas.height===this._canvasHeight||this._onDimensionsChange.fire(this._renderer.value.dimensions))}hasRenderer(){return!!this._renderer.value}setRenderer(e){this._renderer.value=e,this._renderer.value&&(this._renderer.value.onRequestRedraw(e=>this.refreshRows(e.start,e.end,!0)),this._needsSelectionRefresh=!0,this._fullRefresh())}addRefreshCallback(e){return this._renderDebouncer.addRefreshCallback(e)}_fullRefresh(){this._isPaused?this._needsFullRefresh=!0:this.refreshRows(0,this._rowCount-1)}clearTextureAtlas(){this._renderer.value&&(this._renderer.value.clearTextureAtlas?.(),this._fullRefresh())}handleDevicePixelRatioChange(){this._charSizeService.measure(),this._renderer.value&&(this._renderer.value.handleDevicePixelRatioChange(),this.refreshRows(0,this._rowCount-1))}handleResize(e,t){this._renderer.value&&(this._isPaused?this._pausedResizeTask.set(()=>this._renderer.value?.handleResize(e,t)):this._renderer.value.handleResize(e,t),this._fullRefresh())}handleCharSizeChanged(){this._renderer.value?.handleCharSizeChanged()}handleBlur(){this._renderer.value?.handleBlur()}handleFocus(){this._renderer.value?.handleFocus()}handleSelectionChanged(e,t,n){this._selectionState.start=e,this._selectionState.end=t,this._selectionState.columnSelectMode=n,this._renderer.value?.handleSelectionChanged(e,t,n)}handleCursorMove(){this._renderer.value?.handleCursorMove()}clear(){this._renderer.value?.clear()}};iY=$U([J(2,MW),J(3,RW),J(4,OW),J(5,FW),J(6,EW),J(7,zW),J(8,WW)],iY);var aY=class{constructor(e,t,n){this._coreBrowserService=e,this._coreService=t,this._onTimeout=n,this._start=0,this._end=0,this._isBuffering=!1}bufferRows(e,t){this._isBuffering?(this._start=Math.min(this._start,e),this._end=Math.max(this._end,t)):(this._start=e,this._end=t,this._isBuffering=!0),this._timeout===void 0&&(this._timeout=this._coreBrowserService.window.setTimeout(()=>{this._timeout=void 0,this._coreService.decPrivateModes.synchronizedOutput=!1,this._onTimeout()},1e3))}flush(){if(this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0),!this._isBuffering)return;let e={start:this._start,end:this._end};return this._isBuffering=!1,e}dispose(){this._timeout!==void 0&&(this._coreBrowserService.window.clearTimeout(this._timeout),this._timeout=void 0)}};function oY(e,t,n,r){let i=n.buffer.x,a=n.buffer.y;if(!n.buffer.hasScrollback)return lY(i,a,e,t,n,r)+uY(a,t,n,r)+dY(i,a,e,t,n,r);let o;if(a===t)return o=i>e?`D`:`C`,vY(Math.abs(i-e),_Y(o,r));o=a>t?`D`:`C`;let s=Math.abs(a-t);return vY(cY(a>t?e:i,n)+(s-1)*n.cols+1+sY(a>t?i:e,n),_Y(o,r))}function sY(e,t){return e-1}function cY(e,t){return t.cols-e}function lY(e,t,n,r,i,a){return uY(t,r,i,a).length===0?``:vY(gY(e,t,e,t-pY(t,i),!1,i).length,_Y(`D`,a))}function uY(e,t,n,r){let i=e-pY(e,n),a=t-pY(t,n);return vY(Math.abs(i-a)-fY(e,t,n),_Y(hY(e,t),r))}function dY(e,t,n,r,i,a){let o;o=uY(t,r,i,a).length>0?r-pY(r,i):t;let s=r,c=mY(e,t,n,r,i,a);return vY(gY(e,o,n,s,c===`C`,i).length,_Y(c,a))}function fY(e,t,n){let r=0,i=e-pY(e,n),a=t-pY(t,n);for(let o=0;o<Math.abs(i-a);o++){let a=hY(e,t)===`A`?-1:1;n.buffer.lines.get(i+a*o)?.isWrapped&&r++}return r}function pY(e,t){let n=0,r=t.buffer.lines.get(e),i=r?.isWrapped;for(;i&&e>=0&&e<t.rows;)n++,r=t.buffer.lines.get(--e),i=r?.isWrapped;return n}function mY(e,t,n,r,i,a){let o;return o=uY(n,r,i,a).length>0?r-pY(r,i):t,e<n&&o<=r||e>=n&&o<r?`C`:`D`}function hY(e,t){return e>t?`A`:`B`}function gY(e,t,n,r,i,a){let o=e,s=t,c=``;for(;(o!==n||s!==r)&&s>=0&&s<a.buffer.lines.length;)o+=i?1:-1,i&&o>a.cols-1?(c+=a.buffer.translateBufferLineToString(s,!1,e,o),o=0,e=0,s++):!i&&o<0&&(c+=a.buffer.translateBufferLineToString(s,!1,0,e+1),o=a.cols-1,e=o,s--);return c+a.buffer.translateBufferLineToString(s,!1,e,o)}function _Y(e,t){let n=t?`O`:`[`;return Q.ESC+n+e}function vY(e,t){e=Math.floor(e);let n=``;for(let r=0;r<e;r++)n+=t;return n}var yY=class{constructor(e){this._bufferService=e,this.isSelectAllActive=!1,this.selectionStartLength=0}clearSelection(){this.selectionStart=void 0,this.selectionEnd=void 0,this.isSelectAllActive=!1,this.selectionStartLength=0}get finalSelectionStart(){return this.isSelectAllActive?[0,0]:!this.selectionEnd||!this.selectionStart?this.selectionStart:this.areSelectionValuesReversed()?this.selectionEnd:this.selectionStart}get finalSelectionEnd(){if(this.isSelectAllActive)return[this._bufferService.cols,this._bufferService.buffer.ybase+this._bufferService.rows-1];if(this.selectionStart){if(!this.selectionEnd||this.areSelectionValuesReversed()){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?e%this._bufferService.cols===0?[this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)-1]:[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[e,this.selectionStart[1]]}if(this.selectionStartLength&&this.selectionEnd[1]===this.selectionStart[1]){let e=this.selectionStart[0]+this.selectionStartLength;return e>this._bufferService.cols?[e%this._bufferService.cols,this.selectionStart[1]+Math.floor(e/this._bufferService.cols)]:[Math.max(e,this.selectionEnd[0]),this.selectionEnd[1]]}return this.selectionEnd}}areSelectionValuesReversed(){let e=this.selectionStart,t=this.selectionEnd;return!e||!t?!1:e[1]>t[1]||e[1]===t[1]&&e[0]>t[0]}handleTrim(e){return this.selectionStart&&(this.selectionStart[1]-=e),this.selectionEnd&&(this.selectionEnd[1]-=e),this.selectionEnd&&this.selectionEnd[1]<0?(this.clearSelection(),!0):(this.selectionStart&&this.selectionStart[1]<0&&(this.selectionStart[1]=0),!1)}};function bY(e,t){if(e.start.y>e.end.y)throw Error(`Buffer range end (${e.end.x}, ${e.end.y}) cannot be before start (${e.start.x}, ${e.start.y})`);return t*(e.end.y-e.start.y)+(e.end.x-e.start.x+1)}var xY=50,SY=15,CY=50,wY=500,TY=RegExp(`\xA0`,`g`),EY=class extends Y{constructor(e,t,n,r,i,a,o,s,c){super(),this._element=e,this._screenElement=t,this._linkifier=n,this._bufferService=r,this._coreService=i,this._mouseService=a,this._optionsService=o,this._renderService=s,this._coreBrowserService=c,this._dragScrollAmount=0,this._enabled=!0,this._workCell=new yW,this._mouseDownTimeStamp=0,this._oldHasSelection=!1,this._oldSelectionStart=void 0,this._oldSelectionEnd=void 0,this._onLinuxMouseSelection=this._register(new X),this.onLinuxMouseSelection=this._onLinuxMouseSelection.event,this._onRedrawRequest=this._register(new X),this.onRequestRedraw=this._onRedrawRequest.event,this._onSelectionChange=this._register(new X),this.onSelectionChange=this._onSelectionChange.event,this._onRequestScrollLines=this._register(new X),this.onRequestScrollLines=this._onRequestScrollLines.event,this._mouseMoveListener=e=>this._handleMouseMove(e),this._mouseUpListener=e=>this._handleMouseUp(e),this._coreService.onUserInput(()=>{this.hasSelection&&this.clearSelection()}),this._trimListener=this._bufferService.buffer.lines.onTrim(e=>this._handleTrim(e)),this._register(this._bufferService.buffers.onBufferActivate(e=>this._handleBufferActivate(e))),this.enable(),this._model=new yY(this._bufferService),this._activeSelectionMode=0,this._register(fG(()=>{this._removeMouseDownListeners()})),this._register(this._bufferService.onResize(e=>{e.rowsChanged&&this.clearSelection()}))}reset(){this.clearSelection()}disable(){this.clearSelection(),this._enabled=!1}enable(){this._enabled=!0}get selectionStart(){return this._model.finalSelectionStart}get selectionEnd(){return this._model.finalSelectionEnd}get hasSelection(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;return!e||!t?!1:e[0]!==t[0]||e[1]!==t[1]}get selectionText(){let e=this._model.finalSelectionStart,t=this._model.finalSelectionEnd;if(!e||!t)return``;let n=this._bufferService.buffer,r=[];if(this._activeSelectionMode===3){if(e[0]===t[0])return``;let i=e[0]<t[0]?e[0]:t[0],a=e[0]<t[0]?t[0]:e[0];for(let o=e[1];o<=t[1];o++){let e=n.translateBufferLineToString(o,!0,i,a);r.push(e)}}else{let i=e[1]===t[1]?t[0]:void 0;r.push(n.translateBufferLineToString(e[1],!0,e[0],i));for(let i=e[1]+1;i<=t[1]-1;i++){let e=n.lines.get(i),t=n.translateBufferLineToString(i,!0);e?.isWrapped?r[r.length-1]+=t:r.push(t)}if(e[1]!==t[1]){let e=n.lines.get(t[1]),i=n.translateBufferLineToString(t[1],!0,0,t[0]);e&&e.isWrapped?r[r.length-1]+=i:r.push(i)}}return r.map(e=>e.replace(TY,` `)).join(XJ?`\r
|
|
1545
1545
|
`:`
|
|
@@ -1611,5 +1611,5 @@ out vec4 outColor;
|
|
|
1611
1611
|
|
|
1612
1612
|
void main() {
|
|
1613
1613
|
outColor = v_color;
|
|
1614
|
-
}`,w1=8,T1=w1*Float32Array.BYTES_PER_ELEMENT,E1=20*w1,D1=class{constructor(){this.attributes=new Float32Array(E1),this.count=0}},O1=0,k1=0,A1=0,j1=0,M1=0,N1=0,P1=0,F1=class extends oQ{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new D1,this._verticesCursor=new D1;let i=this._gl;this._program=OQ(e1(i,S1,C1)),this._register(rQ(()=>i.deleteProgram(this._program))),this._projectionLocation=OQ(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(rQ(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(rQ(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=OQ(i.createBuffer()),this._register(rQ(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,T1,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,T1,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,T1,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,$$),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*g1,d=e.cells[u+_1],f=e.cells[u+v1],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*w1,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*w1,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*w1,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:O1=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:O1=(n&16777215)<<8;break;case 0:default:O1=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:O1=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:O1=(r&16777215)<<8;break;case 0:default:O1=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=n1(e.attributes,this._terminal.rows*this._terminal.cols*w1)),k1=i*this._dimensions.device.cell.width,A1=o*this._dimensions.device.cell.height,j1=(O1>>24&255)/255,M1=(O1>>16&255)/255,N1=(O1>>8&255)/255,P1=1,this._addRectangle(e.attributes,t,k1,A1,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,j1,M1,N1,P1)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},I1=class extends oQ{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(rQ(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=OQ(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=K$(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=JQ,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},L1=class extends I1{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&W$(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},R1=typeof window==`object`?window:globalThis,z1=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new M$,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new M$,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};z1.INSTANCE=new z1;var B1=z1;function V1(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}B1.INSTANCE.onDidChangeZoomLevel,B1.INSTANCE.onDidChangeFullscreen;var H1=typeof navigator==`object`?navigator.userAgent:``;H1.indexOf(`Firefox`);var U1=H1.indexOf(`AppleWebKit`)>=0;!(H1.indexOf(`Chrome`)>=0)&&H1.indexOf(`Safari`),H1.indexOf(`Electron/`),H1.indexOf(`Android`);var W1=!1;if(typeof R1.matchMedia==`function`){let e=R1.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=R1.matchMedia(`(display-mode: fullscreen)`);W1=e.matches,V1(R1,e,({matches:e})=>{W1&&t.matches||(W1=e)})}function G1(){return W1}var K1=`en`,q1=!1,J1=!1,Y1=!1,X1=K1,Z1,Q1=globalThis,$1;typeof Q1.vscode<`u`&&typeof Q1.vscode.process<`u`?$1=Q1.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&($1=process);var e0=typeof $1?.versions?.electron==`string`&&$1?.type===`renderer`;if(typeof $1==`object`){$1.platform,$1.platform,q1=$1.platform===`linux`,q1&&$1.env.SNAP&&$1.env.SNAP_REVISION,$1.env.CI||$1.env.BUILD_ARTIFACTSTAGINGDIRECTORY,X1=K1;let e=$1.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,X1=t.resolvedLanguage||K1,t.languagePack?.translationsConfigFile}catch{}J1=!0}else typeof navigator==`object`&&!e0?(Z1=navigator.userAgent,Z1.indexOf(`Windows`),Z1.indexOf(`Macintosh`),(Z1.indexOf(`Macintosh`)>=0||Z1.indexOf(`iPad`)>=0||Z1.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,q1=Z1.indexOf(`Linux`)>=0,Z1?.indexOf(`Mobi`),Y1=!0,X1=globalThis._VSCODE_NLS_LANGUAGE||K1,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var t0=J1;Y1&&typeof Q1.importScripts==`function`&&Q1.origin;var n0=Z1,r0=X1,i0;(e=>{function t(){return r0}e.value=t;function n(){return r0.length===2?r0===`en`:r0.length>=3&&r0[0]===`e`&&r0[1]===`n`&&r0[2]===`-`}e.isDefaultVariant=n;function r(){return r0===`en`}e.isDefault=r})(i0||={});var a0=typeof Q1.postMessage==`function`&&!Q1.importScripts;(()=>{if(a0){let e=[];Q1.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Q1.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var o0=!!(n0&&n0.indexOf(`Chrome`)>=0);n0&&n0.indexOf(`Firefox`),!o0&&n0&&n0.indexOf(`Safari`),n0&&n0.indexOf(`Edg/`),n0&&n0.indexOf(`Android`);var s0=typeof navigator==`object`?navigator:{};t0||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||s0&&s0.clipboard&&s0.clipboard.writeText,t0||s0&&s0.clipboard&&s0.clipboard.readText,t0||G1()||s0.keyboard,`ontouchstart`in R1||s0.maxTouchPoints,R1.PointerEvent&&(`ontouchstart`in R1||navigator.maxTouchPoints);var c0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},l0=new c0,u0=new c0,d0=new c0;Array(230);var f0;(e=>{function t(e){return l0.keyCodeToStr(e)}e.toString=t;function n(e){return l0.strToKeyCode(e)}e.fromString=n;function r(e){return u0.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return d0.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return u0.strToKeyCode(e)||d0.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return l0.keyCodeToStr(e)}e.toElectronAccelerator=o})(f0||={});var p0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),m0;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof h0?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:y$.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:p0})})(m0||={});var h0=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?p0:(this._emitter||=new M$,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var g0;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(g0||={});var _0=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new M$,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await y$.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};_0.EMPTY=_0.fromArray([]);function v0(e){return y0(e,0)}function y0(e,t){switch(typeof e){case`object`:return e===null?b0(349,t):Array.isArray(e)?C0(e,t):w0(e,t);case`string`:return S0(e,t);case`boolean`:return x0(e,t);case`number`:return b0(e,t);case`undefined`:return b0(937,t);default:return b0(617,t)}}function b0(e,t){return(t<<5)-t+e|0}function x0(e,t){return b0(e?433:863,t)}function S0(e,t){t=b0(149417,t);for(let n=0,r=e.length;n<r;n++)t=b0(e.charCodeAt(n),t);return t}function C0(e,t){return t=b0(104579,t),e.reduce((e,t)=>y0(t,e),t)}function w0(e,t){return t=b0(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=S0(n,t),y0(e[n],t)),t)}var{registerWindow:Gne,getWindow:T0,getDocument:Kne,getWindows:qne,getWindowsCount:Jne,getWindowId:Yne,getWindowById:Xne,hasWindow:Zne,onDidRegisterWindow:Qne,onWillUnregisterWindow:$ne,onDidUnregisterWindow:ere}=function(){let e=new Map,t={window:R1,disposables:new aQ};e.set(R1.vscodeWindowId,t);let n=new M$,r=new M$,i=new M$;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return oQ.None;let a=new aQ,o={window:t,disposables:a.add(new aQ)};return e.set(t.vscodeWindowId,o),a.add(rQ(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(D0(t,k0.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:R1},getDocument(e){return T0(e).document}}}(),E0=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function D0(e,t,n,r){return new E0(e,t,n,r)}var O0=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};O0.None=new O0(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=v0(n),a=r.get(i);if(a)a.users+=1;else{let o=new M$,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(rQ(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var k0={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:U1?`webkitAnimationStart`:`animationstart`,ANIMATION_END:U1?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:U1?`webkitAnimationIteration`:`animationiteration`},A0=class extends oQ{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new sQ,this._charAtlasDisposable=this._register(new sQ),this._observerDisposable=this._register(new sQ),this._model=new x1,this._workCell=new Q$,this._workCell2=new Q$,this._rectangleRenderer=this._register(new sQ),this._glyphRenderer=this._register(new sQ),this._onChangeTextureAtlas=this._register(new M$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new M$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new M$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new M$),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new M$),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new KQ(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new L1(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=IQ(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(D0(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(D0(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,q$(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=X$(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=X$(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(rQ(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),q$(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new F1(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new p1(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=K$(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nQ(y$.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),y$.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Y$(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=M0(e,n.rows-1,0),t=M0(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),te=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let w=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||ee<p[0]||ee>=p[1],d?(l=!0,r=new j0(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*g1,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ne&&o===S&&(y===ee&&(this._model.cursor={x:ee,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},te=ee+r.getWidth()-1),y>=ee&&y<=te&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+_1]!==this._cellColorResolver.result.bg||this._model.cells[v+v1]!==this._cellColorResolver.result.fg||this._model.cells[v+y1]!==this._cellColorResolver.result.ext)&&(w=!0,h.length>1&&(g|=b1),this._model.cells[v]=g,this._model.cells[v+_1]=this._cellColorResolver.result.bg,this._model.cells[v+v1]=this._cellColorResolver.result.fg,this._model.cells[v+y1]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*g1,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,hQ,0,0),this._model.cells[b]=0,this._model.cells[b+_1]=this._cellColorResolver.result.bg,this._model.cells[b+v1]=this._cellColorResolver.result.fg,this._model.cells[b+y1]=this._cellColorResolver.result.ext;y--}}w&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},j0=class extends m${constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function M0(e,t,n=0){return Math.max(Math.min(e,t),n)}var N0=`di$target`,P0=`di$dependencies`,F0=new Map;function I0(e){if(F0.has(e))return F0.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);L0(t,e,r)};return t._id=e,F0.set(e,t),t}function L0(e,t,n){t[N0]===t?t[P0].push({id:e,index:n}):(t[P0]=[{id:e,index:n}],t[N0]=t)}I0(`BufferService`),I0(`CoreMouseService`),I0(`CoreService`),I0(`CharsetService`),I0(`InstantiationService`),I0(`LogService`);var R0=I0(`OptionsService`);I0(`OscLinkService`),I0(`UnicodeService`),I0(`DecorationService`);var z0={trace:0,debug:1,info:2,warn:3,error:4,off:5},B0=`xterm.js: `,V0=class extends oQ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),H0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=z0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:B0)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};V0=zZ([BZ(0,R0)],V0);var H0,U0=class extends oQ{constructor(e){if(pQ&&mQ()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new M$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new M$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new M$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new M$),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new A0(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(y$.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(y$.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(y$.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(y$.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(rQ(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},W0=2,G0=1,K0=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(W0,Math.floor(u/e.css.cell.width)),rows:Math.max(G0,Math.floor(l/e.css.cell.height))}}},q0=`3.7.8`,J0=q0,Y0=typeof Buffer==`function`,X0=typeof TextDecoder==`function`?new TextDecoder:void 0,Z0=typeof TextEncoder==`function`?new TextEncoder:void 0,Q0=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),$0=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(Q0),e2=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,t2=String.fromCharCode.bind(String),n2=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),r2=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),i2=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),a2=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=Q0[t>>18&63]+Q0[t>>12&63]+Q0[t>>6&63]+Q0[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},o2=typeof btoa==`function`?e=>btoa(e):Y0?e=>Buffer.from(e,`binary`).toString(`base64`):a2,s2=Y0?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(t2.apply(null,e.subarray(n,n+4096)));return o2(t.join(``))},c2=(e,t=!1)=>t?r2(s2(e)):s2(e),l2=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?t2(192|t>>>6)+t2(128|t&63):t2(224|t>>>12&15)+t2(128|t>>>6&63)+t2(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return t2(240|t>>>18&7)+t2(128|t>>>12&63)+t2(128|t>>>6&63)+t2(128|t&63)},u2=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,d2=e=>e.replace(u2,l2),f2=Y0?e=>Buffer.from(e,`utf8`).toString(`base64`):Z0?e=>s2(Z0.encode(e)):e=>o2(d2(e)),p2=(e,t=!1)=>t?r2(f2(e)):f2(e),m2=e=>p2(e,!0),h2=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,g2=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return t2((t>>>10)+55296)+t2((t&1023)+56320);case 3:return t2((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return t2((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},_2=e=>e.replace(h2,g2),v2=e=>{if(e=e.replace(/\s+/g,``),!e2.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=$0[e.charAt(a++)]<<18|$0[e.charAt(a++)]<<12|(n=$0[e.charAt(a++)])<<6|(r=$0[e.charAt(a++)]),n===64?i.push(t2(t>>16&255)):r===64?i.push(t2(t>>16&255,t>>8&255)):i.push(t2(t>>16&255,t>>8&255,t&255));return i.join(``)},y2=typeof atob==`function`?e=>atob(i2(e)):Y0?e=>Buffer.from(e,`base64`).toString(`binary`):v2,b2=Y0?e=>n2(Buffer.from(e,`base64`)):e=>n2(y2(e).split(``).map(e=>e.charCodeAt(0))),x2=e=>b2(C2(e)),S2=Y0?e=>Buffer.from(e,`base64`).toString(`utf8`):X0?e=>X0.decode(b2(e)):e=>_2(y2(e)),C2=e=>i2(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),w2=e=>S2(C2(e)),T2=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},E2=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),D2=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,E2(t));e(`fromBase64`,function(){return w2(this)}),e(`toBase64`,function(e){return p2(this,e)}),e(`toBase64URI`,function(){return p2(this,!0)}),e(`toBase64URL`,function(){return p2(this,!0)}),e(`toUint8Array`,function(){return x2(this)})},O2=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,E2(t));e(`toBase64`,function(e){return c2(this,e)}),e(`toBase64URI`,function(){return c2(this,!0)}),e(`toBase64URL`,function(){return c2(this,!0)})},k2={version:q0,VERSION:J0,atob:y2,atobPolyfill:v2,btoa:o2,btoaPolyfill:a2,fromBase64:w2,toBase64:p2,encode:p2,encodeURI:m2,encodeURL:m2,utob:d2,btou:_2,decode:w2,isValid:T2,fromUint8Array:c2,toUint8Array:x2,extendString:D2,extendUint8Array:O2,extendBuiltins:()=>{D2(),O2()}},A2=class{constructor(e=new M2,t=new j2){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},j2=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},M2=class{encodeText(e){return k2.encode(e)}decodeText(e){let t=k2.decode(e);return!k2.isValid(e)||k2.encode(t)!==e?``:t}},N2=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=F2.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function P2(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var F2=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!P2(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},I2=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function L2(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var R2=class{constructor(e=L2,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||I2;this._linkProvider=this._terminal.registerLinkProvider(new N2(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function z2(e,t){let{term:n,write:r}=e,i=new TextEncoder,a=null,o=0,s=!1,c=null,l=()=>{if(s)return;let i=location.protocol===`https:`?`wss`:`ws`,f=a=new WebSocket(`${i}://${location.host}/term/${e.sessionId}?cols=${n.cols}&rows=${n.rows}&visible=${+!!u()}`);f.onmessage=e=>r(e.data),f.onopen=()=>{o=0,d(f),c&&=(f.send(JSON.stringify({resize:c})),null),m()},f.onclose=()=>{if(!(t.aborted||s||a!==f)){if(document.visibilityState!==`visible`){let e=()=>{document.visibilityState===`visible`&&(document.removeEventListener(`visibilitychange`,e),!t.aborted&&a===f&&l())};document.addEventListener(`visibilitychange`,e,{signal:t})}else++o<=3?setTimeout(()=>{!t.aborted&&a===f&&l()},400*o):e.onDead()}}},u=()=>document.visibilityState===`visible`&&e.isVisible(),d=e=>{e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({visible:u()}))};document.addEventListener(`visibilitychange`,()=>a&&d(a),{signal:t}),l(),t.addEventListener(`abort`,()=>a?.close());let f=[],p=0,m=()=>{for(;f.length&&a?.readyState===WebSocket.OPEN;)a.send(i.encode(f.shift()));p=0};return{send(e){a?.readyState===WebSocket.OPEN?a.send(i.encode(e)):p<1024&&(f.push(e),p+=e.length)},resize(e,t){a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({resize:[e,t]})):c=[e,t]},syncVisibility(){a&&d(a)},get readyState(){return a?.readyState},reconnect(){s=!1,l()},disconnect(){s=!0,a?.close()}}}function B2(e,t,n,r){let i=null,a=0,o=0,s=0,c=0,l=n=>{let r=t().querySelector(`.xterm-screen`)||t(),i=r.clientHeight/e.rows||17;c+=n/i;let a=Math.trunc(c);if(!a)return;c-=a;let o=r.getBoundingClientRect(),s=a>0?1:-1;for(let e=0;e!==a;e+=s)r.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:WheelEvent.DOM_DELTA_LINE,bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2}))},u=()=>{cancelAnimationFrame(s),s=0},d=()=>{o*=.97,!(Math.abs(o)<.25)&&(l(o*16),s=requestAnimationFrame(d))};n.addEventListener(`abort`,u),t().addEventListener(`touchstart`,e=>{u(),o=0,i=e.touches[0]?.clientY??null,a=e.timeStamp},{passive:!0,signal:n}),t().addEventListener(`touchmove`,e=>{if(r?.())return;let t=e.touches[0]?.clientY;if(t==null||i==null)return;let n=i-t;Math.abs(n)>=2&&(o=n/Math.max(1,e.timeStamp-a),i=t,a=e.timeStamp,l(n)),e.preventDefault()},{passive:!1,signal:n}),t().addEventListener(`touchend`,()=>{i=null,Math.abs(o)>.5&&(u(),s=requestAnimationFrame(d))},{signal:n})}function V2(e){let t=!1,n=[],r=0;return{write(i){if(!t){e.write(i);return}for(n.push(i),r+=i.length;r>1048576&&n.length>1;)r-=n.shift().length},setFrozen(i){if(t!==i&&(t=i,!i)){let t=n.join(``);n=[],r=0,t&&e.write(t)}}}}function H2(e,t,n){let r=e.textarea;if(!r)return;let i=`\xA0`.repeat(4),a={deleteContentBackward:``,deleteWordBackward:``,deleteSoftLineBackward:``,deleteHardLineBackward:``},o=!1,s=()=>{o||(r.value!==i&&(r.value=i),r.setSelectionRange(i.length,i.length))};r.addEventListener(`beforeinput`,e=>{let n=a[e.inputType];n&&(e.preventDefault(),e.stopImmediatePropagation(),t(n))},{capture:!0,signal:n}),r.addEventListener(`compositionstart`,()=>{o=!0},{signal:n}),r.addEventListener(`compositionend`,()=>{o=!1,setTimeout(s,0)},{signal:n}),r.addEventListener(`input`,()=>setTimeout(s,0),{signal:n}),r.addEventListener(`focus`,()=>setTimeout(s,0),{signal:n}),s()}var U2=450,W2=12,G2=` ·│┃()[]{}<>'"\`,;│|`;function K2(e,t,n,r){let i=!1,a,o=0,s=0,c=null,l=null,u=()=>t().querySelector(`.xterm-screen`)||t(),d=(t,n)=>{let r=u().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}},f=t=>{let n=e.buffer.active.getLine(t.row)?.translateToString()??``,r=e=>!e||e===` `||G2.includes(e);if(r(n[t.col]))return{start:t,end:t};let i=t.col,a=t.col;for(;i>0&&!r(n[i-1]);)i--;for(;a<n.length-1&&!r(n[a+1]);)a++;return{start:{col:i,row:t.row},end:{col:a,row:t.row}}},p=(e,t)=>e.row<t.row||e.row===t.row&&e.col<=t.col,m=()=>{if(!c||!l)return;let[t,n]=p(c,l)?[c,l]:[l,c],r=(n.row-t.row)*e.cols+(n.col-t.col)+1;e.select(t.col,t.row,Math.max(1,r))},h=()=>{clearTimeout(a),a=void 0};t().addEventListener(`touchstart`,t=>{if(t.touches.length!==1){h();return}!i&&e.hasSelection()&&e.clearSelection(),o=t.touches[0].clientX,s=t.touches[0].clientY,a=setTimeout(()=>{a=void 0,i=!0,n.onStart();let e=f(d(o,s));c=e.start,l=e.end,m(),navigator.vibrate?.(10)},U2)},{passive:!0,signal:r}),t().addEventListener(`touchmove`,e=>{let t=e.touches[0];if(t){if(i){l=d(t.clientX,t.clientY),m(),e.preventDefault();return}a&&Math.hypot(t.clientX-o,t.clientY-s)>W2&&h()}},{passive:!1,signal:r});let g=()=>{if(h(),!i)return;i=!1,n.onEnd();let t=e.getSelection();t&&X_(t).then(e=>{e&&n.onCopy(t)})};return t().addEventListener(`touchend`,g,{signal:r}),t().addEventListener(`touchcancel`,g,{signal:r}),{selecting:()=>i}}var q2=5;function J2(e,t,n,r){let i=null,a=!1,o=0,s=0,c=()=>t().querySelector(`.xterm-screen`)||t(),l=(t,n)=>{let r=c().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}};t().addEventListener(`mousedown`,t=>{if(a||t.button!==0||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey)return;t.preventDefault(),t.stopImmediatePropagation();let n=t.timeStamp;s=n-o<400?s+1:1,o=n;let r=l(t.clientX,t.clientY);i={startX:t.clientX,startY:t.clientY,startCol:r.col,startRow:r.row,selecting:!1,detail:s},e.focus()},{capture:!0,signal:r}),window.addEventListener(`mousemove`,t=>{if(!i)return;if(!i.selecting){if(Math.hypot(t.clientX-i.startX,t.clientY-i.startY)<q2)return;i.selecting=!0}let n=l(t.clientX,t.clientY),r=(n.row-i.startRow)*e.cols+(n.col-i.startCol)+1,[a,o,s]=r>=0?[i.startCol,i.startRow,Math.max(1,r)]:[n.col,n.row,Math.max(1,-r+1)];e.select(a,o,s),t.preventDefault()},{signal:r}),window.addEventListener(`mouseup`,async t=>{if(!i)return;let r=i.selecting,o=i;if(i=null,r){let t=e.getSelection();t&&await X_(t)&&n(t);return}a=!0;let s={bubbles:!0,cancelable:!0,clientX:o.startX,clientY:o.startY,button:0,buttons:1,detail:o.detail,view:window},c=document.elementFromPoint(o.startX,o.startY);c?.dispatchEvent(new MouseEvent(`mousedown`,s)),c?.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0,button:0})),c?.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0})),a=!1,t.preventDefault()},{signal:r})}var Y2=Rr,X2=(e=>`/${e}&`)(zr);function Z2(e){Ur(e.a,`M15 4L8 20`)}var Q2=(e,t)=>Vr(e.a,t),$2=(e,t)=>Hr(e.a,t),e4=Rr,t4=(e=>`/${e}&`)(zr);function n4(e){Ur(e.a,`M7 12L17 12 M7 8L13 8 M3 20.2895V5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V15C21 16.1046 20.1046 17 19 17H7.96125C7.35368 17 6.77906 17.2762 6.39951 17.7506L4.06852 20.6643C3.71421 21.1072 3 20.8567 3 20.2895Z`)}var r4=(e,t)=>Vr(e.a,t),i4=(e,t)=>Hr(e.a,t),a4=Rr,o4=(e=>`/${e}&`)(zr);function s4(e){Ur(e.a,`M8.5 4H6C4.89543 4 4 4.89543 4 6V20C4 21.1046 4.89543 22 6 22H18C19.1046 22 20 21.1046 20 20V6C20 4.89543 19.1046 4 18 4H15.5 M8 6.4V4.5C8 4.22386 8.22386 4 8.5 4C8.77614 4 9.00422 3.77604 9.05152 3.50398C9.19968 2.65171 9.77399 1 12 1C14.226 1 14.8003 2.65171 14.9485 3.50398C14.9958 3.77604 15.2239 4 15.5 4C15.7761 4 16 4.22386 16 4.5V6.4C16 6.73137 15.7314 7 15.4 7H8.6C8.26863 7 8 6.73137 8 6.4Z`)}var c4=(e,t)=>Vr(e.a,t),l4=(e,t)=>Hr(e.a,t),u4=Rr,d4=(e=>`/${e}&`)(zr);function f4(e){Ur(e.a,`M21 3.6V20.4C21 20.7314 20.7314 21 20.4 21H3.6C3.26863 21 3 20.7314 3 20.4V3.6C3 3.26863 3.26863 3 3.6 3H20.4C20.7314 3 21 3.26863 21 3.6Z M3 16L10 13L21 18 M16 10C14.8954 10 14 9.10457 14 8C14 6.89543 14.8954 6 16 6C17.1046 6 18 6.89543 18 8C18 9.10457 17.1046 10 16 10Z`)}var p4=(e,t)=>Vr(e.a,t),m4=(e,t)=>Hr(e.a,t),h4=`<div class=term-wrap><div class=term></div><!><!><!><!></div><!><!>`,g4=` D b%b%b%b%l%c`,_4=400,v4=55,y4=3e4,b4=150,x4=[[{kind:`paste`},{kind:`key`,label:`▲`,seq:`\x1B[A`},{kind:`attach`}],[{kind:`key`,label:`◀`,seq:`\x1B[D`},{kind:`key`,label:`↵`,seq:`\r`},{kind:`key`,label:`▶`,seq:`\x1B[C`}],[{kind:`key`,label:`⇥`,seq:` `},{kind:`key`,label:`▼`,seq:`\x1B[B`},{kind:`key`,label:`^C`,seq:``}]],S4=L(`o20`,e=>A(e.a,`click`,function(){e._._._.d.click()})),C4=e=>{f4(e.b),p4(e.b,16),m4(e.b),S4(e)},w4=L(`o19`,e=>{A(e.a,`pointerdown`,function(e){e.preventDefault()}),A(e.a,`click`,function(){e._._._._.al()})}),T4=e=>{s4(e.b),c4(e.b,16),l4(e.b),w4(e)},E4=P(0,2,e=>{gt(e.a,{enter:e._.e===`↵`,"big-glyph":e._.e===`↵`||e._.e===`⇥`}),V(e.b,e._.e)}),D4=L(`o21`,e=>{A(e.a,`pointerdown`,function(t){t.preventDefault(),e._._._._.af(e._.f)}),A(e.a,`pointerup`,function(){e._._._._.ag()}),A(e.a,`pointercancel`,function(){e._._._._.ag()}),A(e.a,`pointerleave`,function(){e._._._._.ag()}),A(e.a,`contextmenu`,function(e){e.preventDefault()})}),O4=O(0,(e=>`<button title=Paste>${e}</button>`)(a4),(e=>` D/${e}&l`)(o4),T4,(e=>`<button title="Attach image">${e}</button>`)(u4),(e=>` D/${e}&l`)(d4),C4,`<button class=repeat> </button>`,` D `,e=>{E4._(e),D4(e)}),k4=(e,t)=>O4(e,t===`paste`?0:t===`attach`?1:2),A4=(e,t)=>{k4(e,t[0]?.kind),j4(e,t[0]?.label),M4(e,t[0]?.seq)},j4=M(4),M4=M(5),N4=k(0,`<!><!><!>`,`b%`,0,A4),P4=(e,t)=>N4(e,[t]),F4=(e,t)=>P4(e,t[0]),I4=I(60,L(`o17`,e=>A(e.a,`click`,function(){e._._.a7?.send(`\x1B`)})),e=>e._._),L4=L(`o18`,e=>A(e.a,`pointerdown`,function(e){e.preventDefault()})),R4=e=>{I4(e),L4(e)},z4=P(5,0,L(`o8`,e=>{e._.a5&&setTimeout(()=>e.c?.focus(),50)})),B4=L(`o9`,e=>{A(e.a,`click`,function(){a6(e._,!1)}),A(e.b,`click`,function(e){e.stopPropagation()}),A(e.c,`paste`,function(t){t.preventDefault(),e._.ak(t.clipboardData)}),A(e.d,`click`,function(){a6(e._,!1)})}),V4=e=>{z4._(e),B4(e)},H4=L(`o7`,e=>A(e.a,`click`,function(){X3(e._,!1)})),U4=I(51,e=>ht(e.a,[`dot`,Lr(e._._.r)]),e=>e._._),W4=e=>{U4(e),G4(e)},G4=I(57,e=>V(e.b,e._._.y),e=>e._._),K4=M(3,e=>{z(e.a,`title`,`New ${e.d} session`),vi(e.b,e.d)}),q4=L(`o15`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.p?.(e.d)})),J4=e=>{e.b,hi(e.b,15),yi(e.b),q4(e)},Y4=(e,t)=>K4(e,t[0]),X4=N(1,e=>{B(e.a,`armed`,e._._._.g===e._.j),z(e.a,`title`,e._._._.g===e._.j?`Really kill this session?`:`Kill session`)}),Z4=I(8,X4,e=>e._._._),Q4=L(`o13`,e=>A(e.a,`click`,function(t,n){e._._._.g===e._.j?(b3(e._._._,null),n.closest(`[popover]`)?.hidePopover(),e._._._._._.w?.(e._.j)):b3(e._._._,e._.j)})),$4=e=>{Z4(e),e3._(e),Q4(e)},e3=P(6,0,X4),t3=L(`o12`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._._.v?.(e._.j)})),n3=e=>{np(e.b),rp(e.b,12),ip(e.b),t3(e)},r3=N(10,e=>B(e.a,`current`,e.j===e._._._._.t)),i3=I(53,r3,e=>e._._._._),a3=L(`o14`,e=>A(e.b,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e.j!==e._._._._.t&&e._._._._.u?.(e.j)})),o3=e=>{i3(e),c3(e),u3(e),e.d,hi(e.d,14),yi(e.d),a3(e)},s3=O(5,(e=>`<button class="sess-x sess-edit" title="Rename session">${e}</button>`)(ep),(e=>` D/${e}&l`)(tp),n3),c3=I(54,e=>s3(e,+!e._._._._.v),e=>e._._._._),l3=O(6,`<button class=sess-x>×</button>`,` `,$4),u3=I(55,e=>l3(e,+!e._._._._.w),e=>e._._._._),d3=M(9,e=>{r3(e),e3(e)}),f3=(e,t)=>ht(e.c,[`dot`,Lr(t)]),p3=N(14,e=>V(e.e,e.n||e.m)),m3=M(12,e=>{vi(e.d,e.m),p3(e)}),h3=M(13,p3),g3=k(0,(e=>`<div class=sess-row><button class=sess-open><span></span>${e}<span class=sess-title> </span></button><!><!></div>`)(ai),(e=>` D D b/${e}&D m%b%l`)(`b%c`),o3,(e,t)=>{d3(e,t[0]?.id),f3(e,t[0]?.state),m3(e,t[0]?.agent),h3(e,t[0]?.title)}),_3=I(52,e=>g3(e,[e._._._.s||[],`id`]),e=>e._._._),v3=_3,y3=I(50,e=>vi(e.b,e._._.q||`shell`),e=>e._._),b3=j(6,F(Z4)),x3=(e,t)=>{z(e.a,`popovertarget`,t),z(e.d,`id`,t)},S3=L(`o16`,e=>A(e.d,`toggle`,function(t,n){if(b3(e,null),t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.left=`${Math.max(8,Math.min(t.left+t.width/2-n.offsetWidth/2,window.innerWidth-n.offsetWidth-8))}px`}})),C3=e=>{y3(e),w3(e),E3(e),O3(e),e.b,hi(e.b,16),yi(e.b),b3(e,null),x3(e,Qe(e)),S3(e)},w3=I(51,e=>ht(e.c,[`dot`,`sess-dot`,Lr(e._._.r)]),e=>e._._),T3=O(4,`<!><!><!>`,`b%`,v3),E3=I(52,e=>{B(e.f,`lone`,(e._._.s||[]).length<=1),T3(e,(e._._.s||[]).length>1?0:1)},e=>e._._),D3=k(5,(e=>`<button class=icon-btn>${e}</button>`)(ai),(e=>` D/${e}&l`)(`b%c`),J4,Y4),O3=I(56,e=>D3(e,[[...e._._.x||[],`shell`],e=>e]),e=>e._._),k3=L(`o11`,e=>{A(e.a,`click`,function(){e._._.m?.()}),A(e.c,`click`,function(){e._._.n?.()}),A(e.e,`click`,function(){e._._.o?.()})}),A3=e=>{$m(e.b),eh(e.b,16),th(e.b),Zr(e.d),Qr(e.d,16),$r(e.d),Kr(e.f),qr(e.f,16),Jr(e.f),k3(e)},j3=L(`o10`,e=>A(e.a,`click`,function(){e._._.l?.()})),M3=O(0,(e=>`<button class="icon-btn kbtn" title="Back to terminal">${e}</button>`)(lv),(e=>` D/${e}&l`)(uv),e=>{dv(e.b),fv(e.b,16),pv(e.b),j3(e)},((e,t,n)=>`<button class="icon-btn kbtn" title=Workspaces>${e}</button><button class="icon-btn kbtn" title="Manage workspace">${t}</button><button class="icon-btn kbtn" title="Review changes">${n}</button>`)(Zm,Yr,Wr),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l`)(Qm,Xr,Gr),A3),N3=O(8,`<button class="icon-btn kbtn kbtn-esc" title=Escape>esc</button>`,` `,R4),P3=O(1,(e=>`<button class="icon-btn kbtn sess-btn" title=Sessions>${e}<span></span></button><div popover=auto class=sess-pop><!><div class=sess-new></div></div>`)(ai),(e=>` D/${e}& l D%b l`)(`b%c`),C3),F3=N(11,e=>P3(e,e._.k!==`diff`&&e._.p?0:1)),I3=P(6,0,e=>{M3(e,e._.k===`diff`?0:1),N3(e,+(e._.k===`diff`)),F3(e)}),L3=(e,t)=>{z(e.e,`popovertarget`,t),z(e.j,`id`,t)},R3=k(9,`<!><!><!>`,`b%`,0,F4),z3=L(`o23`,e=>{A(e.d,`change`,function(t,n){for(let t of n.files||[])e._.ah(t);n.value=``}),A(e.e,`pointerdown`,function(e){e.preventDefault()}),A(e.g,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.bottom=`auto`}})}),B3=e=>{I3._(e),V3._(e),U3._(e),W3._(e),G3._(e),Z2(e.f),Q2(e.f,16),$2(e.f),n4(e.h),r4(e.h,16),i4(e.h),L3(e,Qe(e)),R3(e,[x4]),z3(e)},V3=P(6,0,F3),H3=O(2,`<span class="kbar-ws dim" aria-hidden=true><span></span><span class=kbar-ws-name> </span></span>`,`D bD `,W4),U3=P(6,0,e=>H3(e,+!e._.y)),W3=P(6,0,e=>{B(e.g,`on`,e._.a1),z(e.g,`title`,e._.a1?`Hide keyboard`:`Show keyboard`)}),G3=P(6,0,L(`o22`,e=>A(e.g,`click`,function(){Z3(e._,!e._.a1),e._.a7?.setKeyboard(e._.a1)}))),K3=tt(`o6`,1),q3=et(42),J3=O(4,`<div class=term-dead><button class="btn primary">Reconnect</button></div>`,`D `,H4),Y3=N(45,L(`o24`,e=>Et(e,{onMount:function(){let t=new AbortController,n=t.signal,r=new IZ({fontSize:13,fontFamily:`ui-monospace, monospace`,scrollback:5e3,allowProposedApi:!0,rightClickSelectsWord:!0,macOptionClickForcesSelection:!0,linkHandler:{activate(e,t){or(t)}}}),i=new K0;r.loadAddon(i),r.open(e.b);let a=rr();try{let e=new U0;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}try{r.loadAddon(new A2(void 0,{readText:()=>navigator.clipboard.readText().catch(()=>``),writeText:(e,t)=>X_(t).then(()=>{})}))}catch{}r.loadAddon(new R2((e,t)=>or(t))),i.fit();let o=a?V2(r):null,s=o?o.write:e=>r.write(e),c=z2({sessionId:e.t,term:r,write:s,onDead:()=>{X3(e,!0)},isVisible:()=>!!e.z},n);r.onData(e=>c.send(e)),r.attachCustomKeyEventHandler(t=>t.key===`Enter`&&t.shiftKey?(t.type===`keydown`&&c.send(`\x1B\r`),!1):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&r.hasSelection()?(t.type===`keydown`&&X_(r.getSelection()).then(t=>{t&&(r.clearSelection(),e.ab())}),!1):!(a&&t.type===`keydown`&&t.key===`Backspace`));let l=()=>{if(!e.b.clientWidth)return;let t=i.proposeDimensions();!t||t.cols===r.cols&&t.rows===r.rows||(i.fit(),c.resize(r.cols,r.rows))},u=new ResizeObserver(l);u.observe(e.b),n.addEventListener(`abort`,()=>u.disconnect());let d=()=>requestAnimationFrame(l);if(document.addEventListener(`visibilitychange`,()=>{document.hidden||d()},{signal:n}),window.addEventListener(`pageshow`,d,{signal:n}),window.addEventListener(`focus`,d,{signal:n}),window.visualViewport?.addEventListener(`resize`,d,{signal:n}),e.b.addEventListener(`paste`,t=>{let n=[...t.clipboardData?.files||[]];if(n.length){t.preventDefault(),t.stopImmediatePropagation();for(let t of n)e.ah(t)}},{capture:!0,signal:n}),e.a7={send(e){c.send(e)},setKeyboard(e){let t=r.textarea;t&&(t.inputMode=e?`text`:`none`,e?(t.focus(),setTimeout(()=>{document.activeElement!==t&&t.focus()},50)):t.blur())}},a){r.textarea&&(r.textarea.inputMode=`none`);let t=window.visualViewport;if(t){let i=0,a=()=>{i=Math.max(i,t.height),e.a1&&i-t.height<b4&&(Z3(e,!1),r.textarea&&(r.textarea.inputMode=`none`))};a(),t.addEventListener(`resize`,a,{signal:n}),window.addEventListener(`orientationchange`,()=>{i=0},{signal:n})}let i=K2(r,K3(e),{onStart(){o?.setFrozen(!0)},onEnd(){o?.setFrozen(!1)},onCopy(){e.ab()}},n);B2(r,K3(e),n,i.selecting),H2(r,e=>c.send(e),n)}else J2(r,K3(e),()=>e.ab(),n);e.z&&!a&&r.focus();let f={term:r,socket:c,abort:t,suspend:void 0};return e.z||(f.suspend=setTimeout(()=>c.disconnect(),y4)),f},onUpdate:function(){clearTimeout(this.suspend),this.socket.syncVisibility(),e.z?(!e.a0&&this.socket.readyState>=WebSocket.CLOSING&&(this.term.reset(),this.socket.reconnect()),!e.a0&&!e.a2&&this.term.focus()):this.suspend=setTimeout(()=>this.socket.disconnect(),y4)},onDestroy:function(){clearTimeout(this.suspend),this.abort.abort(),this.term.dispose()}})),7),X3=j(26,e=>{J3(e,+!e.a0),Y3(e)}),Z3=j(27,e=>{Y3(e),W3(e)}),Q3=O(6,((e,t)=>`<div class=kb-slot><div class=key-bar><!><div class=kspacer></div><!><input type=file accept=image/* hidden><button class="icon-btn kbtn dpad-btn" title="More keys">${e}</button><button class="icon-btn kbtn kb-toggle">${t}</button><!><div popover=auto class=dpad-grid></div></div></div>`)(Y2,e4),((e,t)=>`E%b b%b b D/${e}&l D/${t}&l%b m`)(X2,t4),B3),$3=j(28,e=>{Q3(e,+!e.a2),Y3(e)}),e6=O(2,`<div class="term-uploading dim">uploading…</div>`),t6=j(29,e=>e6(e,+!e.a3)),n6=O(3,`<div class=term-copied>Copied</div>`),r6=j(30,e=>n6(e,+!e.a4)),i6=O(5,`<div class=trap-backdrop><div class=paste-trap><p class=dim>Long-press below and choose Paste</p><input placeholder="Paste here…"><button class=btn>Cancel</button></div></div>`,` D Db b `,V4),a6=j(31,e=>{i6(e,+!e.a5),z4(e)}),o6=(e,t)=>v6(e,t.current),s6=(e,t)=>b6(e,t.timer),c6=(e,t)=>S6(e,t.current),l6=L(`o25`,e=>{$3(e,rr()),A(e.a,`dragover`,function(e){e.preventDefault()}),A(e.a,`drop`,function(t){t.preventDefault();for(let n of t.dataTransfer?.files||[])e.ah(n)})});function u6(e){X3(e,!1),Z3(e,!1),$3(e,!1),t6(e,!1),r6(e,!1),a6(e,!1),o6(e,{current:null}),s6(e,{timer:0}),c6(e,{current:null}),l6(e)}var d6=M(41),f6=N(40,e=>d6(e,H6(e))),p6=M(46),m6=M(47),h6=N(44,e=>{p6(e,U6(e)),m6(e,W6(e))}),g6=M(43,e=>{h6(e),Y3(e)}),_6=N(34,e=>g6(e,G6(e))),v6=M(33,e=>{f6(e),_6(e),h6(e),Y3(e)}),y6=M(37,Y3),b6=M(36,e=>y6(e,K6(e))),x6=M(42),S6=M(39,e=>{x6(e,q6(e)),f6(e)}),C6=M(9,_6),w6=M(10,e=>{z(e.a,`hidden`,e.k===`diff`),I3(e)}),T6=F(i3),E6=M(19,e=>{Y3(e),T6(e)}),D6=M(25,Y3),O6=M(11),k6=M(12),A6=M(13),j6=M(14),M6=M(15,V3),N6=M(16,F(y3)),P6=M(17,F(w3,U4)),F6=M(18,F(E3,_3)),I6=M(20),L6=M(21,F(c3)),R6=M(22,F(u3)),z6=M(23,F(O3)),B6=F(G4),V6=M(24,e=>{U3(e),B6(e)});function H6(e){return t=>{q3(e)(),e.a7?.send(t);let n={};n.delay=setTimeout(()=>{n.repeat=setInterval(()=>e.a7?.send(t),v4)},_4),e.ad=n}}function U6(e){return async t=>{let n=[...t?.files||[]];for(let t of n)await e.ah(t);if(!n.length){let n=t?.getData(`text/plain`);n&&e.a7?.send(n)}a6(e,!1)}}function W6(e){return async()=>{if(!navigator.clipboard?.read){a6(e,!0);return}try{for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));if(n){let r=await t.getType(n);await e.ah(new File([r],`pasted.${n.split(`/`)[1]||`png`}`,{type:n}))}else if(t.types.includes(`text/plain`)){let n=await(await t.getType(`text/plain`)).text();n&&e.a7?.send(n)}}}catch{a6(e,!0)}}}function G6(e){return async t=>{if(t){t6(e,!0);try{let n=await(await fetch(`/api/workspaces/${e.j}/assets?name=${encodeURIComponent(t.name||`pasted.png`)}`,{method:`POST`,body:t})).json();n.path&&e.a7?.send(`${n.path} `)}finally{t6(e,!1)}}}}function K6(e){return()=>{clearTimeout(e.aa),r6(e,!0),e.aa=setTimeout(()=>{r6(e,!1)},1200)}}function q6(e){return()=>{let t=e.ad;t&&(clearTimeout(t.delay),clearInterval(t.repeat),e.ad=null)}}R(`o1`,H6),R(`o4`,U6),R(`o5`,W6),R(`o3`,G6),R(`o0`,K6),R(`o2`,q6);var J6=Us,Y6=(e=>`/${e}&`)(Ws);function X6(e){let t=Math.round(e/6e4);if(t<60)return`${t}m`;let n=Math.round(t/60);return n<48?`${n}h`:`${Math.round(n/24)}d`}function Z6(e,t){if(!e)return null;let n=new Date(e).getTime()-Date.now();return n<=0?t?null:`now`:X6(n)}var Q6=(e,t)=>V(e.e,t?`↻ ${pt(t)}`:``),$6=N(9,e=>Q6(e,Z6(e.i,e._.h!=null))),e8=Ke(4,$6),t8=e8,n8=N(12,e=>z(e.a,`title`,`${e.k}: ${e.l}% used${e.i?` — resets ${new Date(e.i).toLocaleString()}`:``}`),2),r8=M(11,e=>{V(e.d,e.l),n8(e)}),i8=M(7,e=>{gt(e.c,{hot:e.h>=90,warm:e.h>=70&&e.h<90}),_t(e.c,`width:${Math.min(100,Math.max(2,e.h))}%`),r8(e,Math.round(e.h))}),a8=M(8,e=>{$6(e),n8(e)}),o8=M(10,e=>{V(e.b,e.k),n8(e)}),s8=(e,t)=>{i8(e,t[0]?.used_percent),a8(e,t[0]?.resets_at),o8(e,t[0]?.window)},c8=P(3,0,e=>{z(e.a,`title`,`plan-usage could not reach this provider — these are its last cached numbers, ${X6(e._.h*1e3)} old`),V(e.b,X6(e._.h*1e3))}),l8=c8,u8=P(2,0,e=>V(e.a,e._.j.replace(/^default_/,``).replaceAll(`_`,` `))),d8=u8,f8=O(3,`<span class=usage-stale>⚠ <!> old</span>`,` Db%`,l8),p8=M(7,e=>{B(e.a,`stale`,e.h!=null),f8(e,+(e.h==null)),c8(e),e8(e)}),m8=(e,t)=>V(e.b,t),h8=O(2,`<span class=dim> </span>`,`D `,d8),g8=M(9,e=>{h8(e,+!e.j),u8(e)}),_8=k(4,`<div class=meter><span class="meter-label dim"> </span><span class=meter-track><span class=meter-fill></span></span><span class=meter-pct><!>%</span><span class="meter-reset dim"> </span></div>`,` E lD lD%lD `,t8,s8),v8=(e,t)=>_8(e,[t||[],`window`]),y8=k(0,`<div class=usage-row><div class=usage-name><strong> </strong><!><!></div><div class=usage-meters></div></div>`,` F l%b%l `,0,(e,t)=>{p8(e,t[0]?.stale_seconds),m8(e,t[0]?.agent),g8(e,t[0]?.plan),v8(e,t[0]?.windows)}),b8=I(12,e=>y8(e,[e._._.g||[],e=>`${e.agent}-${e.account||``}`]),e=>e._._),x8=b8,S8=I(11,e=>V(e.a,e._._.f),e=>e._._),C8=O(2,`<p class=dim><span class=spin></span> Loading usage…</p>`,0,0,`<p class=dim> </p>`,`D `,S8,`<div class=usage-list></div>`,` `,x8),w8=I(10,e=>C8(e,e._.e?e._.e?.error?1:2:0)),T8=L(`q3`,e=>A(e.a,`click`,function(){e._.j()})),E8=e=>{w8(e),D8(e),Co(e.b),wo(e.b,13),To(e.b),T8(e)},D8=I(13,e=>{B(e.a,`spinning`,e._.h),z(e.a,`disabled`,e._.h)}),O8=ut(`q4`,(e=>`<header class=manage-head><div><h2>Usage</h2></div><button class=icon-btn title="Refresh usage">${e}</button></header><!><!>`)(xo),(e=>`Db D/${e}&m%c`)(So),E8),k8=F(w8),A8=j(4,e=>{j8(e,e.e?.error),M8(e,e.e?.agents),k8(e)}),j8=M(5,F(S8)),M8=M(6,F(b8)),N8=j(7,F(D8)),P8=M(9),F8=L(`q5`,e=>Et(e,{onMount:function(){e.i(!1)}})),I8=M(8,e=>{P8(e,z8(e)),F8(e)});function L8(e){$s(e.a),Gs(e.a,O8(e)),tc(e.a,`Usage`),ec(e.a,`usage-modal`),Qs(e.a),ac(e.a),A8(e,null),N8(e,!1),I8(e,B8(e))}var R8=M(3,e=>ic(e.a,V8(e)));function z8(e){return async()=>{N8(e,!0),await e.i(!0),N8(e,!1)}}function B8(e){return async t=>{try{A8(e,await H(`/api/usage${t?`?refresh`:``}`))}catch(t){A8(e,{error:String(t.message||t)})}}}function V8(e){return function(){e.d()}}R(`q1`,z8),R(`q0`,B8),R(`q2`,V8);var H8=Us,U8=(e=>`/${e}&`)(Ws),W8=et(1,`B2`),G8=I(12,e=>V(e.a,e._.f)),K8=L(`k4`,e=>{Mt(e,`b`),A(e.b,`keydown`,function(t){t.key===`Enter`?(t.preventDefault(),e._.l()):t.key===`Escape`&&e._.j&&e._.g()})}),q8=e=>{G8(e),J8(e),Y8(e),K8(e)},J8=I(14,e=>z(e.b,`placeholder`,e._.i)),Y8=I(15,e=>jt(e,`b`,e._.j,h5(e))),X8=ut(`k6`,`<h2 class=prompt-title> </h2><input>`,`D l `,q8,0,`B2`),Z8=I(13,e=>V(e.b,e._.h||`OK`)),Q8=L(`k3`,e=>{A(e.a,`click`,function(){e._.l()}),A(e.c,`click`,function(){e._.g()})}),$8=e=>{Z8(e),e5(e),Q8(e)},e5=I(15,e=>z(e.a,`disabled`,!e._.j.trim())),t5=dt(`k5`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,$8),n5=M(11),r5=N(10,e=>n5(e,g5(e))),i5=F(e5,Y8),a5=j(9,e=>{r5(e),i5(e)}),o5=(e,t)=>a5(e,t||``),s5=M(4,r5),c5=L(`k7`,e=>Et(e,{onMount:function(){setTimeout(()=>{let t=W8(e)();t?.focus(),t?.select()},0)}}));function l5(e){$s(e.a),ac(e.a,tn({content:t5(e)})),Gs(e.a,X8(e)),ec(e.a,`prompt-dlg`),Qs(e.a),c5(e)}var u5=F(G8),d5=M(5,e=>{tc(e.a,e.f),u5(e)}),f5=M(6,e=>ic(e.a,_5(e))),p5=M(7,F(Z8)),m5=M(8,F(J8));function h5(e){return t=>{a5(e._,t)}}function g5(e){return()=>{let t=e.j.trim();t&&e.e(t)}}function _5(e){return function(){e.g()}}R(`k0`,h5),R(`k1`,g5),R(`k2`,_5);var v5=((e,t)=>`<div class=work-view>${e}<div class=main-col><!><!>${t}<!><!><div class=term-area></div></div><!><!></div>`)(_h,vF),y5=((e,t)=>`D/${e}&D%b%b/${t}&%b%b l%b%l`)(vh,yF),b5=N(1,e=>o5(e.a,e._.a7||e._.a8)),x5=P(8,0,b5),S5=e=>{x5._(e),C5._(e),T5._(e),E5._(e),l5(e.a),d5(e.a,`Rename session`),p5(e.a,`Rename`),f5(e.a,p7(e)),m5(e.a)},C5=P(8,0,b5),w5=N(2,e=>s5(e.a,m7(e))),T5=P(8,0,w5),E5=P(8,0,w5),D5=I(68,e=>V(e.a,e._._.a4),e=>e._._),tre=dt(`r31`,` `,` `,D5),nre=e=>{Ar(e.a,tre(e)),Pr(e.a,h7(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},rre=e=>{L8(e.a),R8(e.a,g7(e))},O5=N(2,e=>V(e.b,e._._.a5?`Starting…`:`Start ${e._._.o||`claude`}`)),k5=I(65,O5,e=>e._._),ire=L(`r32`,e=>A(e.a,`click`,function(){e._._.ao(e._._.o||`claude`,!0)})),are=e=>{k5(e),A5(e),ire(e)},A5=I(69,e=>{z(e.a,`disabled`,e._._.a5),O5(e)},e=>e._._),j5=N(8,e=>D6(e.b,e._._.n&&e._._.y===`term`&&e.g===e._._.am),3),M5=I(64,j5,e=>e._._),ore=e=>{M5(e),N5(e),P5(e),I5(e),L5(e),R5(e),B5(e),V5(e),H5(e),u6(e.b),I6(e.b,b7(e)),j6(e.b,y7(e)),O6(e.b,v7(e)),k6(e.b,_7(e))},N5=I(66,e=>z6(e.b,e._._.r),e=>e._._),P5=I(67,e=>{w6(e.b,e._._.y),j5(e)},e=>e._._),F5=N(11,e=>M6(e.b,x7(e))),I5=I(73,e=>{C6(e.b,e._._.ab),A6(e.b,S7(e)),F5(e)},e=>e._._),L5=I(74,e=>V6(e.b,e._._.ag),e=>e._._),R5=I(75,e=>{F6(e.b,e._._.aj),L6(e.b,C7(e))},e=>e._._),sre=le(3,0,2),z5=N(7,e=>sre(e,e.g===e._._.am)),B5=I(77,e=>{j5(e),z5(e)},e=>e._._),V5=I(78,e=>R6(e.b,w7(e)),e=>e._._),H5=I(80,F5,e=>e._._),cre=M(6,e=>{E6(e.b,e.g),j5(e),z5(e)}),lre=(e,t)=>P6(e.b,t),ure=(e,t)=>N6(e.b,t),dre=k(0,(e=>`<!><!>${e}<!><!><!>`)(h4),(e=>`b%b/${e}&%b%c`)(g4),ore,(e,t)=>{cre(e,t[0]?.id),lre(e,t[0]?.state),ure(e,t[0]?.agent)}),U5=P(6,0,e=>dre(e,[e._.aj,`id`])),fre=e=>{U5._(e),W5._(e)},pre=O(1,`<div class=empty-sess><p class=dim>No sessions in this workspace.</p><button class="btn primary"> </button></div>`,`Db D `,are),W5=P(6,0,e=>pre(e,+!!e._.al)),mre=M(61,E5),hre=O(6,`<!><!><!><!>`,`b%b%`,fre,`<p class="dim pad-inline">Loading sessions…</p>`),gre=L(`r35`,e=>{e.n&&window.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&e.a2&&c7(e,!1),(t.metaKey||t.ctrlKey)&&t.shiftKey&&t.key.toLowerCase()===`d`&&(t.preventDefault(),i7(e,e.y===`diff`?`term`:`diff`)),t.altKey&&(t.key===`[`||t.key===`]`)&&(e.aj?.length??0)>1){t.preventDefault();let n=e.aj.map(e=>e.id);n7(e,n[(Math.max(0,n.indexOf(e.am))+(t.key===`]`?1:n.length-1))%n.length]),i7(e,`term`)}},{capture:!0,signal:Ee(e,0)})}),G5=N(49,e=>{Te(e,0),gre(e)},4),_re=F(B5),vre=M(48,e=>{Hg(e.a,e.am),G5(e),_re(e)}),K5=N(46,e=>vre(e,(()=>{if(e.w&&e.aj?.some(t=>t.id===e.w))return e.w;let t=Wn(e.ab);return t&&e.aj?.some(e=>e.id===t)?t:e.aj?.[0]?.id??null})()),2),yre=F(R5),bre=M(45,e=>{E_(e.a,e.aj),uU(e.d,e.aj||[]),Kre(e,e.aj?.length),hre(e,+!e.aj),K5(e),G5(e),U5(e),yre(e)}),q5=N(40,e=>bre(e,e.v??e.m?.[e.ab]?.sessions??null),2),J5=N(59,L(`r33`,e=>Et(e,{active:e.n,load:e.aw,onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,started:!1,stale:!1,timer:void 0,refresh:()=>{if(document.hidden){r.stale=!0;return}r.stale=!1,this.load(!1)},sync:()=>{this.active?(r.started||(r.started=!0,this.load(!0)),r.timer??=setInterval(r.refresh,1e4)):r.stop()},stop:()=>{clearInterval(r.timer),r.timer=void 0}};return Cn().addEventListener(`sessions.changed`,t=>{let n=t.data?.workspaceId;r.started&&(!n||n===e.ab)&&r.refresh()},{signal:n}),document.addEventListener(`visibilitychange`,()=>{!document.hidden&&r.stale&&r.refresh()},{signal:n}),Dn(()=>{if(!this.active)return;let t=kn(e.ab);t&&e.ah(t.pr);let n=jn(e.ab);n&&(n7(e,n),i7(e,`term`))},n),r.sync(),r},onUpdate:function(){this.sync()},onDestroy:function(){this.abort.abort(),this.stop()}})),3),xre=M(58,J5),Y5=N(57,e=>xre(e,E7(e)),2),Sre=M(56,Y5),X5=N(54,e=>Sre(e,D7(e)),6),Cre=F(H5),wre=M(62,e=>{S_(e.a,O7(e)),Cre(e)}),Z5=N(51,e=>wre(e,k7(e)),2),Tre=M(50,e=>{X5(e),Z5(e)}),Q5=N(38,e=>Tre(e,A7(e))),Ere=M(60,F(V5)),$5=N(23,e=>Ere(e,j7(e))),e7=j(21,e=>{mre(e,T7(e)),q5(e),Q5(e),X5(e),$5(e)}),t7=N(39,L(`r34`,e=>{e.w&&Gn(e.ab,e.w)})),n7=j(22,e=>{K5(e),X5(e),$5(e),t7(e)}),Dre=le(5,2,4),r7=N(25,e=>iU(e.d,e.n&&e.y===`diff`)),Ore=F(P5),i7=j(24,e=>{qg(e.a,e.y),B(e.g,`as-bar`,e.y===`diff`),Dre(e,e.y===`diff`),G5(e),r7(e),Ore(e)}),a7=j(26,e=>rU(e.d,e.a0)),o7=N(44,L(`r36`,e=>{if(e.n){let t=kn(e.ab);t&&e.ah(t.pr);let n=jn(e.ab);n&&(n7(e,n),i7(e,`term`))}}),2),kre=M(43,e=>{w_(e.a,M7(e)),o7(e),J5(e)}),s7=j(27,e=>{aU(e.d,e.a1),kre(e,N7(e))}),c7=j(28,e=>{$g(e.a,e.a2),G5(e)}),Are=O(7,J6,(e=>`/${e}&`)(Y6),rre),l7=j(29,e=>Are(e,+!e.a3)),jre=O(1,sr,(e=>`/${e}&`)(cr),nre),Mre=F(D5),u7=j(30,e=>{jre(e,+!e.a4),Mre(e)}),d7=j(31,F(A5)),Nre=O(8,H8,(e=>`/${e}&`)(U8),S5),f7=j(32,e=>{Lre(e,e.a6?.title),Rre(e,e.a6?.agent),zre(e,e.a6?.id),Nre(e,+!e.a6)}),Pre=(e,t)=>{Zre(e,t.wanted),Qre(e,t.run)},Fre=M(63);function Ire(e){l_(e.a),Ug(e.a,U7(e)),Jg(e.a,H7(e)),e_(e.a,V7(e)),u_(e.a,B7(e)),M_(e.a,z7(e)),j_(e.a,R7(e)),k_(e.a,L7(e)),VH(e.d),pU(e.d,I7(e)),hU(e.d,F7(e)),e7(e,null),n7(e,null),i7(e,`term`),a7(e,``),s7(e,0),c7(e,!1),l7(e,!1),u7(e,null),d7(e,!1),f7(e,null),Pre(e,{wanted:!1,run:void 0}),Fre(e,P7(e))}var Lre=M(33,x5),Rre=M(34,C5),zre=M(35,T5),Bre=(e,t)=>{Rg(e.a,t),Hre(e,t?.id),Ure(e,t?.status),Wre(e,t?.name)},Vre=F(I5),Hre=M(37,e=>{nU(e.d,e.ab),q5(e),K5(e),o7(e),Q5(e),X5(e),t7(e),Z5(e),J5(e),Vre(e)}),Ure=M(41,X5),Wre=M(42,F(L5)),Gre=Bre,Kre=M(47,W5),qre=M(12,e=>{h_(e.a,e.m),q5(e)}),Jre=F(M5),Yre=L(`r37`,e=>{e.n||c7(e,!1)}),Xre=M(13,e=>{d_(e.a,e.n),o7(e),G5(e),J5(e),r7(e),Jre(e),Yre(e)}),Zre=M(53,e=>{X5(e),Y5(e)}),Qre=M(55,Y5),$re=F(k5),eie=M(14,e=>{X5(e),$re(e)}),tie=M(15,e=>{__(e.a,e.p),Z5(e)}),nie=(e,t)=>f_(e.a,t),rie=F(N5),iie=M(17,e=>{b_(e.a,e.r),rie(e)}),aie=(e,t)=>D_(e.a,t),oie=M(19,e=>v_(e.a,e.t)),sie=(e,t)=>N_(e.a,t);function p7(e){return function(){f7(e._,null)}}function m7(e){return function(t){e._.az(e._.a9,t),f7(e._,null)}}function h7(e){return function(){u7(e._,null)}}function g7(e){return function(){l7(e._,!1)}}function _7(e){return function(){c7(e._._,!0)}}function v7(e){return function(){i7(e._._,`term`)}}function y7(e){return function(){e._._.ah()}}function b7(e){return function(t){n7(e._._,t)}}function x7(e){return function(t){e._._.b0(e._._.ab,t)}}function S7(e){return function(){e._._.t?.(e._._.ab)}}function C7(e){return function(t){let n=(e._._.aj||[]).find(e=>e.id===t);n&&f7(e._._,n)}}function w7(e){return function(t){e._._.ay(t)}}function T7(e){return async(t,n)=>{n=n.trim(),n&&(e7(e,(e.v||[]).map(e=>e.id===t?{...e,title:n}:e)),await fetch(`/api/sessions/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({title:n})}))}}function E7(e){return t=>(t&&(e.ar=!0),(e.at??=Mn(e.au))())}function D7(e){return async()=>{let t=e.ar;e.ar=!1;try{let n=await H(`/api/workspaces/${e.ab}/sessions`);if(!n.length&&t&&e.af===`active`){let t=await e.ao(e.o||`claude`,!1);n=t?[t]:[]}e7(e,n);let r=Wn(e.ab);r&&n.some(e=>e.id===r)&&n7(e,r),e.v.some(t=>t.id===e.w)||n7(e,e.v?.[0]?.id||null)}catch(t){e7(e,e.v||[]),u7(e,String(t))}}}function O7(e){return function(t,n){e.b0(t,n)}}function k7(e){return async(t,n)=>{if(t===e.ab){let r=await e.ao(n,!0);r&&Gn(t,r.id);return}try{Gn(t,(await H(`/api/workspaces/${t}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})})).id),e.p?.(t)}catch(t){u7(e,String(t.message||t))}}}function A7(e){return async(t,n)=>{d7(e,!0);try{let r=await H(`/api/workspaces/${e.ab}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:t})});return n&&(e7(e,(e.v||[]).concat(r)),n7(e,r.id)),r}catch(t){return u7(e,String(t.message||t)),null}finally{d7(e,!1)}}}function j7(e){return async t=>{try{await H(`/api/sessions/${t}`,{method:`DELETE`}),e7(e,(e.v||[]).filter(e=>e.id!==t)),e.w===t&&n7(e,e.v?.[0]?.id||null)}catch(t){u7(e,`Kill session failed: ${String(t.message||t)}`)}}}function M7(e){return function(t){e.ah(t)}}function N7(e){return t=>{a7(e,t||``),t&&s7(e,e.a1+1),i7(e,`diff`)}}function P7(e){return t=>{f7(e,t)}}function F7(e){return function(){i7(e,`term`)}}function I7(e){return function(t){n7(e,t),i7(e,`term`)}}function L7(e){return function(t){e.b1(t)}}function R7(e){return function(t){e.ay(t)}}function z7(e){return function(){l7(e,!0)}}function B7(e){return function(t){u7(e,t)}}function V7(e){return t=>{c7(e,t)}}function H7(e){return t=>{i7(e,t)}}function U7(e){return function(t){n7(e,t)}}R(`r30`,p7),R(`r29`,m7),R(`r17`,h7),R(`r28`,g7),R(`r26`,_7),R(`r25`,v7),R(`r24`,y7),R(`r21`,b7),R(`r20`,x7),R(`r27`,S7),R(`r23`,C7),R(`r22`,w7),R(`r5`,T7),R(`r3`,E7),R(`r2`,D7),R(`r13`,O7),R(`r6`,k7),R(`r1`,A7),R(`r4`,j7),R(`r16`,M7),R(`r0`,N7),R(`r7`,P7),R(`r19`,F7),R(`r18`,I7),R(`r15`,L7),R(`r14`,R7),R(`r12`,z7),R(`r11`,B7),R(`r10`,V7),R(`r9`,H7),R(`r8`,U7);var W7=I(40,e=>V(e.a,e._._.t),e=>e._._),cie=L(`b20`,e=>A(e.b,`click`,function(){F9(e._._,null),e._._.v()})),lie=O(0,`<p> </p><button class=btn>Retry</button>`,`D l `,e=>{W7(e),cie(e)},`<span class=spin></span>Loading workspaces…`),G7=P(1,0,e=>lie(e,+!e._.t)),uie=G7,K7=I(40,e=>V(e.a,e._._.t),e=>e._._),die=dt(`b19`,` `,` `,K7),fie=e=>{Ar(e.a,die(e)),Pr(e.a,I9(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},q7=I(34,e=>nie(e.b,e._._.g),e=>e._._),pie=e=>{q7(e),J7(e),Y7(e),Q7(e),$7(e),e9(e),t9(e),n9._(e),r9._(e),Ire(e.b),aie(e.b,R9(e)),sie(e.b,L9(e))},J7=I(35,e=>qre(e.b,e._._.h),e=>e._._),Y7=I(36,e=>{eie(e.b,e._._.i?e._._.i?.preferredAgent:`claude`),iie(e.b,e._._.i?e._._.i?.agents:[`claude`])},e=>e._._),X7=N(5,e=>Xre(e.b,!e._._.p&&!e._._.a5&&e._.f===e._._.k),3),mie=le(3,0,2),Z7=N(4,e=>mie(e,e._.f===e._._.k)),Q7=I(37,e=>{X7(e),Z7(e)},e=>e._._),$7=I(38,X7,e=>e._._),e9=I(41,e=>tie(e.b,z9(e)),e=>e._._),t9=I(42,X7,e=>e._._),n9=P(0,0,e=>Gre(e.b,e._.e)),r9=P(0,0,e=>{oie(e.b,B9(e)),X7(e),Z7(e)}),hie=O(0,(e=>`<!><!>${e}<!><!><!>`)(v5),(e=>`b%b/${e}&%b%c`)(y5),pie),gie=M(4,e=>{vie(e,e.e?.id),hie(e,+!e.e),n9(e)}),i9=N(3,e=>gie(e,e._.g.find(t=>t.id===e.c))),a9=Ke(5,i9),_ie=a9,vie=M(5,r9),yie=M(2,i9),bie=(e,t)=>yie(e,t[0]),o9=N(1,e=>Hf(e.a,V9(e))),s9=P(4,0,o9),xie=e=>{s9._(e),c9._(e),Lf(e.a),Uf(e.a,H9(e))},c9=P(4,0,o9),l9=P(3,0,e=>ud(e.a,U9(e))),Sie=e=>{l9._(e),u9._(e),Iu(e.a),dd(e.a,W9(e))},u9=P(3,0,e=>ld(e.a,e._.a5)),d9=P(2,0,e=>mo(e.a,e._.g)),Cie=e=>{d9._(e),f9._(e),p9._(e),m9._(e),g9._(e),_9._(e),v9._(e),co(e.a),Nee(e.a,J9(e)),gee(e.a,q9(e)),xee(e.a,K9(e)),Eee(e.a,G9(e))},f9=P(2,0,e=>Mee(e.a,e._.h)),p9=P(2,0,e=>kee(e.a,e._.i)),m9=P(2,0,e=>mee(e.a,e._.k)),h9=N(1,e=>Tee(e.a,!e._.s&&e._.a6)),g9=P(2,0,h9),_9=P(2,0,e=>{See(e.a,Z9(e)),hee(e.a,X9(e)),vee(e.a,Y9(e))}),v9=P(2,0,h9),y9=N(28,L(`b21`,e=>Et(e,{paletteOpen:e.s,load:e.v,activeList:e.g.filter(e=>e.status===`active`).map(e=>e.id),onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,statusStale:!1,statusDebounce:void 0,timer:void 0};er(n);let i=(t,n)=>{n&&(An(t,n),Gn(t,n)),e.a1(t)},a=new URLSearchParams(location.search);a.get(`ws`)&&(i(a.get(`ws`),a.get(`session`)),history.replaceState(null,``,`/`)),ar()&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[target="_blank"][href^="http"]`);t&&(e.preventDefault(),or(t.href))},{capture:!0,signal:n}),navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&i(e.data.workspaceId,e.data.sessionId)},{signal:n}),H(`/api/settings`).then(t=>{D9(e,t)}).catch(()=>{});let o=()=>{if(document.hidden){r.statusStale=!0;return}r.statusStale=!1,e.a0()};document.addEventListener(`visibilitychange`,()=>{document.hidden||(r.statusStale=!1,e.a0(!0))},{signal:n}),this.load(),o(),Cn().addEventListener(`workspaces.changed`,()=>{this.load(),o()},{signal:n}),Cn().addEventListener(`sessions.changed`,()=>{clearTimeout(r.statusDebounce),r.statusDebounce=setTimeout(o,300)},{signal:n}),Cn().addEventListener(`status.changed`,t=>{t.data&&(E9(e,t.data),r.statusStale=!1)},{signal:n}),r.timer=setInterval(o,6e4),window.addEventListener(`keydown`,t=>{if((t.metaKey||t.ctrlKey)&&t.key===`k`&&(t.preventDefault(),P9(e,!this.paletteOpen)),(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&t.key>=`1`&&t.key<=`9`){let n=this.activeList?.[Number(t.key)-1];n&&(t.preventDefault(),e.a1(n))}},{capture:!0,signal:n});let s=window.visualViewport;if(s){let e=()=>{let e=Math.abs(s.height-window.innerHeight)<1;document.documentElement.style.setProperty(`--app-height`,e?``:`${Math.round(s.height)}px`),e||window.scrollTo(0,0)};s.addEventListener(`resize`,e,{signal:n}),s.addEventListener(`scroll`,e,{signal:n}),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()},{signal:n}),window.addEventListener(`pageshow`,e,{signal:n}),window.addEventListener(`focus`,e,{signal:n})}return r},onDestroy:function(){this.abort.abort(),clearTimeout(this.statusDebounce),clearInterval(this.timer)}})),4),wie=F(e9),Tie=M(27,e=>{y9(e),_9(e),c9(e),wie(e)}),b9=N(13,e=>Tie(e,Q9(e))),Eie=O(2,(e=>`<!>${e}`)(bi),(e=>`b/${e}&`)(xi),Cie),x9=N(33,e=>Eie(e,e.s||e.a6?0:1)),Die=M(32,e=>{x9(e),v9(e)}),S9=N(30,e=>Die(e,!e.p&&!e.a3&&e.j),2),Oie=M(29,S9),C9=N(11,e=>Oie(e,e.g.find(t=>t.id===e.k))),kie=O(3,sc,(e=>`/${e}&`)(cc),Sie),Aie=F(t9),jie=M(31,e=>{kie(e,+!e.a5),u9(e),Aie(e)}),w9=N(17,e=>jie(e,e.g.find(t=>t.id===e.q))),Mie=F(q7),T9=j(6,e=>{b9(e),y9(e),C9(e),w9(e),d9(e),l9(e),s9(e),a9(e),Mie(e)}),Nie=F(J7),E9=j(7,e=>{f9(e),Nie(e)}),Pie=F(Y7),D9=j(8,e=>{p9(e),Pie(e)}),Fie=O(1,`<div class="boot dim"></div>`,` `,uie),Iie=M(21,y9),O9=N(14,e=>Iie(e,$9(e)),2),Lie=O(0,sr,(e=>`/${e}&`)(cr),fie),k9=N(20,e=>Lie(e,e.t&&e.j?0:1)),Rie=j(9,e=>{Fie(e,+!!e.j),O9(e),S9(e),k9(e)}),zie=F(Q7),A9=j(10,e=>{O9(e),C9(e),m9(e),zie(e)}),Bie=k(5,`<!><!><!>`,`b%`,_ie,bie),j9=j(12,e=>{Bie(e,[e.m,e=>e]),O9(e),b9(e)}),Vie=O(4,Dd,(e=>`/${e}&`)(Od),xie),Hie=F($7),M9=j(15,e=>{Vie(e,+!e.p),S9(e),Hie(e)}),N9=j(16,w9),P9=j(18,e=>{y9(e),x9(e),g9(e)}),Uie=F(K7,W7),F9=j(19,e=>{k9(e),Uie(e),G7(e)});function I9(e){return function(){F9(e._,null)}}function L9(e){return function(){M9(e._._,!0)}}function R9(e){return function(t,n){An(t,n),Gn(t,n),e._._.a1(t)}}function z9(e){return function(t){e._._.a1(t)}}function B9(e){return function(t){N9(e._._,t||e._.f)}}function V9(e){return function(t){e._.g.some(e=>e.id===t.id)||T9(e._,[t,...e._.g]),M9(e._,!1),e._.a1(t.id)}}function H9(e){return function(){M9(e._,!1)}}function U9(e){return function(t){T9(e._,e._.g.map(e=>e.id===t.id?t:e))}}function W9(e){return function(){N9(e._,null)}}function G9(e){return function(){P9(e._,!1)}}function K9(e){return function(){M9(e._,!0),P9(e._,!1)}}function q9(e){return function(t){N9(e._,t.id),M9(e._,!1),P9(e._,!1)}}function J9(e){return function(t){D9(e._,t)}}function Y9(e){return function(t,n){P9(e._,!1),H(`/api/workspaces/${t.id}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})}).then(n=>{An(t.id,n.id),e._.a1(t.id)}).catch(t=>{F9(e._,`New session failed: ${String(t.message||t)}`)})}}function X9(e){return function(t){On(t.id),e._.a1(t.id)}}function Z9(e){return function(t){e._.a1(t.id)}}function Q9(e){return async t=>{e.g.find(e=>e.id===t)?.status===`archived`&&(await H(`/api/workspaces/${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`restore`})}).catch(()=>{}),T9(e,e.g.map(e=>e.id===t?{...e,status:`active`}:e))),A9(e,t),M9(e,!1),N9(e,null),P9(e,!1),e.m.includes(t)||j9(e,e.m.concat(t)),Vn(t)}}function $9(e){return async()=>{try{let[t]=await Promise.all([H(`/api/workspaces`),In()]);if(T9(e,t),e.j){let n=new Set(t.filter(e=>e.status===`active`).map(e=>e.id));j9(e,e.m.filter(e=>n.has(e))),e.k&&!n.has(e.k)&&(A9(e,e.m[e.m?.length-1]||null),Vn(e.k))}else{let n=Bn();n&&t.some(e=>e.id===n)&&(A9(e,n),j9(e,[n]))}Rie(e,!0)}catch(t){F9(e,`Loading workspaces failed: ${t.message||String(t)}`)}}}function Wie(e){return(t=!1)=>(e.x||=t,(e.y??=Mn(async()=>{let t=e.x;e.x=!1,E9(e,await H(`/api/status${t?`?fresh`:``}`))}))())}R(`b3`,I9),R(`b18`,L9),R(`b16`,R9),R(`b15`,z9),R(`b17`,B9),R(`b14`,V9),R(`b13`,H9),R(`b12`,U9),R(`b11`,W9),R(`b10`,G9),R(`b9`,K9),R(`b8`,q9),R(`b4`,J9),R(`b7`,Y9),R(`b6`,X9),R(`b5`,Z9),R(`b2`,Q9),R(`b0`,$9),R(`b1`,Wie),tee();export{t};
|
|
1615
|
-
//# sourceMappingURL=index-
|
|
1614
|
+
}`,w1=8,T1=w1*Float32Array.BYTES_PER_ELEMENT,E1=20*w1,D1=class{constructor(){this.attributes=new Float32Array(E1),this.count=0}},O1=0,k1=0,A1=0,j1=0,M1=0,N1=0,P1=0,F1=class extends oQ{constructor(e,t,n,r){super(),this._terminal=e,this._gl=t,this._dimensions=n,this._themeService=r,this._vertices=new D1,this._verticesCursor=new D1;let i=this._gl;this._program=OQ(e1(i,S1,C1)),this._register(rQ(()=>i.deleteProgram(this._program))),this._projectionLocation=OQ(i.getUniformLocation(this._program,`u_projection`)),this._vertexArrayObject=i.createVertexArray(),i.bindVertexArray(this._vertexArrayObject);let a=new Float32Array([0,0,1,0,0,1,1,1]),o=i.createBuffer();this._register(rQ(()=>i.deleteBuffer(o))),i.bindBuffer(i.ARRAY_BUFFER,o),i.bufferData(i.ARRAY_BUFFER,a,i.STATIC_DRAW),i.enableVertexAttribArray(3),i.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let s=new Uint8Array([0,1,2,3]),c=i.createBuffer();this._register(rQ(()=>i.deleteBuffer(c))),i.bindBuffer(i.ELEMENT_ARRAY_BUFFER,c),i.bufferData(i.ELEMENT_ARRAY_BUFFER,s,i.STATIC_DRAW),this._attributesBuffer=OQ(i.createBuffer()),this._register(rQ(()=>i.deleteBuffer(this._attributesBuffer))),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.enableVertexAttribArray(0),i.vertexAttribPointer(0,2,i.FLOAT,!1,T1,0),i.vertexAttribDivisor(0,1),i.enableVertexAttribArray(1),i.vertexAttribPointer(1,2,i.FLOAT,!1,T1,2*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(1,1),i.enableVertexAttribArray(2),i.vertexAttribPointer(2,4,i.FLOAT,!1,T1,4*Float32Array.BYTES_PER_ELEMENT),i.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let t=this._gl;t.useProgram(this._program),t.bindVertexArray(this._vertexArrayObject),t.uniformMatrix4fv(this._projectionLocation,!1,$$),t.bindBuffer(t.ARRAY_BUFFER,this._attributesBuffer),t.bufferData(t.ARRAY_BUFFER,e.attributes,t.DYNAMIC_DRAW),t.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,t.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let t=this._terminal,n=this._vertices,r=1,i,a,o,s,c,l,u,d,f,p,m;for(i=0;i<t.rows;i++){for(o=-1,s=0,c=0,l=!1,a=0;a<t.cols;a++)u=(i*t.cols+a)*g1,d=e.cells[u+_1],f=e.cells[u+v1],p=!!(f&67108864),(d!==s||f!==c&&(l||p))&&((s!==0||l&&c!==0)&&(m=r++*w1,this._updateRectangle(n,m,c,s,o,a,i)),o=a,s=d,c=f,l=p);(s!==0||l&&c!==0)&&(m=r++*w1,this._updateRectangle(n,m,c,s,o,t.cols,i))}n.count=r}updateCursor(e){let t=this._verticesCursor,n=e.cursor;if(!n||n.style===`block`){t.count=0;return}let r,i=0;(n.style===`bar`||n.style===`outline`)&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.style===`bar`?n.dpr*n.cursorWidth:n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),(n.style===`underline`||n.style===`outline`)&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,(n.y+1)*this._dimensions.device.cell.height-n.dpr,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat)),n.style===`outline`&&(r=i++*w1,this._addRectangleFloat(t.attributes,r,n.x*this._dimensions.device.cell.width,n.y*this._dimensions.device.cell.height,n.width*this._dimensions.device.cell.width,n.dpr,this._cursorFloat),r=i++*w1,this._addRectangleFloat(t.attributes,r,(n.x+n.width)*this._dimensions.device.cell.width-n.dpr,n.y*this._dimensions.device.cell.height,n.dpr,this._dimensions.device.cell.height,this._cursorFloat)),t.count=i}_updateRectangle(e,t,n,r,i,a,o){if(n&67108864)switch(n&50331648){case 16777216:case 33554432:O1=this._themeService.colors.ansi[n&255].rgba;break;case 50331648:O1=(n&16777215)<<8;break;case 0:default:O1=this._themeService.colors.foreground.rgba}else switch(r&50331648){case 16777216:case 33554432:O1=this._themeService.colors.ansi[r&255].rgba;break;case 50331648:O1=(r&16777215)<<8;break;case 0:default:O1=this._themeService.colors.background.rgba}e.attributes.length<t+4&&(e.attributes=n1(e.attributes,this._terminal.rows*this._terminal.cols*w1)),k1=i*this._dimensions.device.cell.width,A1=o*this._dimensions.device.cell.height,j1=(O1>>24&255)/255,M1=(O1>>16&255)/255,N1=(O1>>8&255)/255,P1=1,this._addRectangle(e.attributes,t,k1,A1,(a-i)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,j1,M1,N1,P1)}_addRectangle(e,t,n,r,i,a,o,s,c,l){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o,e[t+5]=s,e[t+6]=c,e[t+7]=l}_addRectangleFloat(e,t,n,r,i,a,o){e[t]=n/this._dimensions.device.canvas.width,e[t+1]=r/this._dimensions.device.canvas.height,e[t+2]=i/this._dimensions.device.canvas.width,e[t+3]=a/this._dimensions.device.canvas.height,e[t+4]=o[0],e[t+5]=o[1],e[t+6]=o[2],e[t+7]=o[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(e.rgba&255)/255])}},I1=class extends oQ{constructor(e,t,n,r,i,a,o,s){super(),this._container=t,this._alpha=i,this._coreBrowserService=a,this._optionsService=o,this._themeService=s,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`),this._canvas.classList.add(`xterm-${n}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(t=>{this._refreshCharAtlas(e,t),this.reset(e)})),this._register(rQ(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=OQ(this._canvas.getContext(`2d`,{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,t,n){}handleSelectionChanged(e,t,n,r=!1){}_setTransparency(e,t){if(t===this._alpha)return;let n=this._canvas;this._alpha=t,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,n),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,t){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=K$(e,this._optionsService.rawOptions,t,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,t){this._deviceCellWidth=t.device.cell.width,this._deviceCellHeight=t.device.cell.height,this._deviceCharWidth=t.device.char.width,this._deviceCharHeight=t.device.char.height,this._deviceCharLeft=t.device.char.left,this._deviceCharTop=t.device.char.top,this._canvas.width=t.device.canvas.width,this._canvas.height=t.device.canvas.height,this._canvas.style.width=`${t.css.canvas.width}px`,this._canvas.style.height=`${t.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,t,n=1){this._ctx.fillRect(e*this._deviceCellWidth,(t+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,n*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,t,n,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,t,n,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=JQ,this._clipCell(n,r,t.getWidth()),this._ctx.fillText(t.getChars(),n*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,t,n){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,t*this._deviceCellHeight,n*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,t,n){let r=t?e.options.fontWeightBold:e.options.fontWeight;return`${n?`italic`:``} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},L1=class extends I1{constructor(e,t,n,r,i,a,o){super(n,e,`link`,t,!0,i,a,o),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,t){super.resize(e,t),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){if(e.fg===257?this._ctx.fillStyle=this._themeService.colors.background.css:e.fg!==void 0&&W$(e.fg)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let t=e.y1+1;t<e.y2;t++)this._fillBottomLineAtCells(0,t,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},R1=typeof window==`object`?window:globalThis,z1=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new M$,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new M$,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,t){if(this.getZoomLevel(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToZoomLevel.set(n,e),this._onDidChangeZoomLevel.fire(n)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,t){this.mapWindowIdToZoomFactor.set(this.getWindowId(t),e)}setFullscreen(e,t){if(this.isFullscreen(t)===e)return;let n=this.getWindowId(t);this.mapWindowIdToFullScreen.set(n,e),this._onDidChangeFullscreen.fire(n)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};z1.INSTANCE=new z1;var B1=z1;function V1(e,t,n){typeof t==`string`&&(t=e.matchMedia(t)),t.addEventListener(`change`,n)}B1.INSTANCE.onDidChangeZoomLevel,B1.INSTANCE.onDidChangeFullscreen;var H1=typeof navigator==`object`?navigator.userAgent:``;H1.indexOf(`Firefox`);var U1=H1.indexOf(`AppleWebKit`)>=0;!(H1.indexOf(`Chrome`)>=0)&&H1.indexOf(`Safari`),H1.indexOf(`Electron/`),H1.indexOf(`Android`);var W1=!1;if(typeof R1.matchMedia==`function`){let e=R1.matchMedia(`(display-mode: standalone) or (display-mode: window-controls-overlay)`),t=R1.matchMedia(`(display-mode: fullscreen)`);W1=e.matches,V1(R1,e,({matches:e})=>{W1&&t.matches||(W1=e)})}function G1(){return W1}var K1=`en`,q1=!1,J1=!1,Y1=!1,X1=K1,Z1,Q1=globalThis,$1;typeof Q1.vscode<`u`&&typeof Q1.vscode.process<`u`?$1=Q1.vscode.process:typeof process<`u`&&typeof process?.versions?.node==`string`&&($1=process);var e0=typeof $1?.versions?.electron==`string`&&$1?.type===`renderer`;if(typeof $1==`object`){$1.platform,$1.platform,q1=$1.platform===`linux`,q1&&$1.env.SNAP&&$1.env.SNAP_REVISION,$1.env.CI||$1.env.BUILD_ARTIFACTSTAGINGDIRECTORY,X1=K1;let e=$1.env.VSCODE_NLS_CONFIG;if(e)try{let t=JSON.parse(e);t.userLocale,t.osLocale,X1=t.resolvedLanguage||K1,t.languagePack?.translationsConfigFile}catch{}J1=!0}else typeof navigator==`object`&&!e0?(Z1=navigator.userAgent,Z1.indexOf(`Windows`),Z1.indexOf(`Macintosh`),(Z1.indexOf(`Macintosh`)>=0||Z1.indexOf(`iPad`)>=0||Z1.indexOf(`iPhone`)>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,q1=Z1.indexOf(`Linux`)>=0,Z1?.indexOf(`Mobi`),Y1=!0,X1=globalThis._VSCODE_NLS_LANGUAGE||K1,navigator.language.toLowerCase()):console.error(`Unable to resolve platform.`);var t0=J1;Y1&&typeof Q1.importScripts==`function`&&Q1.origin;var n0=Z1,r0=X1,i0;(e=>{function t(){return r0}e.value=t;function n(){return r0.length===2?r0===`en`:r0.length>=3&&r0[0]===`e`&&r0[1]===`n`&&r0[2]===`-`}e.isDefaultVariant=n;function r(){return r0===`en`}e.isDefault=r})(i0||={});var a0=typeof Q1.postMessage==`function`&&!Q1.importScripts;(()=>{if(a0){let e=[];Q1.addEventListener(`message`,t=>{if(t.data&&t.data.vscodeScheduleAsyncWork)for(let n=0,r=e.length;n<r;n++){let r=e[n];if(r.id===t.data.vscodeScheduleAsyncWork){e.splice(n,1),r.callback();return}}});let t=0;return n=>{let r=++t;e.push({id:r,callback:n}),Q1.postMessage({vscodeScheduleAsyncWork:r},`*`)}}return e=>setTimeout(e)})();var o0=!!(n0&&n0.indexOf(`Chrome`)>=0);n0&&n0.indexOf(`Firefox`),!o0&&n0&&n0.indexOf(`Safari`),n0&&n0.indexOf(`Edg/`),n0&&n0.indexOf(`Android`);var s0=typeof navigator==`object`?navigator:{};t0||document.queryCommandSupported&&document.queryCommandSupported(`copy`)||s0&&s0.clipboard&&s0.clipboard.writeText,t0||s0&&s0.clipboard&&s0.clipboard.readText,t0||G1()||s0.keyboard,`ontouchstart`in R1||s0.maxTouchPoints,R1.PointerEvent&&(`ontouchstart`in R1||navigator.maxTouchPoints);var c0=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,t){this._keyCodeToStr[e]=t,this._strToKeyCode[t.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},l0=new c0,u0=new c0,d0=new c0;Array(230);var f0;(e=>{function t(e){return l0.keyCodeToStr(e)}e.toString=t;function n(e){return l0.strToKeyCode(e)}e.fromString=n;function r(e){return u0.keyCodeToStr(e)}e.toUserSettingsUS=r;function i(e){return d0.keyCodeToStr(e)}e.toUserSettingsGeneral=i;function a(e){return u0.strToKeyCode(e)||d0.strToKeyCode(e)}e.fromUserSettings=a;function o(e){if(e>=98&&e<=113)return null;switch(e){case 16:return`Up`;case 18:return`Down`;case 15:return`Left`;case 17:return`Right`}return l0.keyCodeToStr(e)}e.toElectronAccelerator=o})(f0||={});var p0=Object.freeze(function(e,t){let n=setTimeout(e.bind(t),0);return{dispose(){clearTimeout(n)}}}),m0;(e=>{function t(t){return t===e.None||t===e.Cancelled||t instanceof h0?!0:!t||typeof t!=`object`?!1:typeof t.isCancellationRequested==`boolean`&&typeof t.onCancellationRequested==`function`}e.isCancellationToken=t,e.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:y$.None}),e.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:p0})})(m0||={});var h0=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?p0:(this._emitter||=new M$,this._emitter.event)}dispose(){this._emitter&&=(this._emitter.dispose(),null)}};(function(){typeof globalThis.requestIdleCallback!=`function`||globalThis.cancelIdleCallback})();var g0;(e=>{async function t(e){let t,n=await Promise.all(e.map(e=>e.then(e=>e,e=>{t||=e})));if(typeof t<`u`)throw t;return n}e.settled=t;function n(e){return new Promise(async(t,n)=>{try{await e(t,n)}catch(e){n(e)}})}e.withAsyncBody=n})(g0||={});var _0=class e{static fromArray(t){return new e(e=>{e.emitMany(t)})}static fromPromise(t){return new e(async e=>{e.emitMany(await t)})}static fromPromises(t){return new e(async e=>{await Promise.all(t.map(async t=>e.emitOne(await t)))})}static merge(t){return new e(async e=>{await Promise.all(t.map(async t=>{for await(let n of t)e.emitOne(n)}))})}constructor(e,t){this._state=0,this._results=[],this._error=null,this._onReturn=t,this._onStateChanged=new M$,queueMicrotask(async()=>{let t={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(t)),this.resolve()}catch(e){this.reject(e)}finally{t.emitOne=void 0,t.emitMany=void 0,t.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{do{if(this._state===2)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(this._state===1)return{done:!0,value:void 0};await y$.toPromise(this._onStateChanged.event)}while(!0)},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(t,n){return new e(async e=>{for await(let r of t)e.emitOne(n(r))})}map(t){return e.map(this,t)}static filter(t,n){return new e(async e=>{for await(let r of t)n(r)&&e.emitOne(r)})}filter(t){return e.filter(this,t)}static coalesce(t){return e.filter(t,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let t=[];for await(let n of e)t.push(n);return t}toPromise(){return e.toPromise(this)}emitOne(e){this._state===0&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){this._state===0&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){this._state===0&&(this._state=1,this._onStateChanged.fire())}reject(e){this._state===0&&(this._state=2,this._error=e,this._onStateChanged.fire())}};_0.EMPTY=_0.fromArray([]);function v0(e){return y0(e,0)}function y0(e,t){switch(typeof e){case`object`:return e===null?b0(349,t):Array.isArray(e)?C0(e,t):w0(e,t);case`string`:return S0(e,t);case`boolean`:return x0(e,t);case`number`:return b0(e,t);case`undefined`:return b0(937,t);default:return b0(617,t)}}function b0(e,t){return(t<<5)-t+e|0}function x0(e,t){return b0(e?433:863,t)}function S0(e,t){t=b0(149417,t);for(let n=0,r=e.length;n<r;n++)t=b0(e.charCodeAt(n),t);return t}function C0(e,t){return t=b0(104579,t),e.reduce((e,t)=>y0(t,e),t)}function w0(e,t){return t=b0(181387,t),Object.keys(e).sort().reduce((t,n)=>(t=S0(n,t),y0(e[n],t)),t)}var{registerWindow:Hne,getWindow:T0,getDocument:Une,getWindows:Wne,getWindowsCount:Gne,getWindowId:Kne,getWindowById:qne,hasWindow:Jne,onDidRegisterWindow:Yne,onWillUnregisterWindow:Xne,onDidUnregisterWindow:Zne}=function(){let e=new Map,t={window:R1,disposables:new aQ};e.set(R1.vscodeWindowId,t);let n=new M$,r=new M$,i=new M$;function a(n,r){return(typeof n==`number`?e.get(n):void 0)??(r?t:void 0)}return{onDidRegisterWindow:n.event,onWillUnregisterWindow:i.event,onDidUnregisterWindow:r.event,registerWindow(t){if(e.has(t.vscodeWindowId))return oQ.None;let a=new aQ,o={window:t,disposables:a.add(new aQ)};return e.set(t.vscodeWindowId,o),a.add(rQ(()=>{e.delete(t.vscodeWindowId),r.fire(t)})),a.add(D0(t,k0.BEFORE_UNLOAD,()=>{i.fire(t)})),n.fire(o),a},getWindows(){return e.values()},getWindowsCount(){return e.size},getWindowId(e){return e.vscodeWindowId},hasWindow(t){return e.has(t)},getWindowById:a,getWindow(e){let t=e;if(t?.ownerDocument?.defaultView)return t.ownerDocument.defaultView.window;let n=e;return n?.view?n.view.window:R1},getDocument(e){return T0(e).document}}}(),E0=class{constructor(e,t,n,r){this._node=e,this._type=t,this._handler=n,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&=(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,null)}};function D0(e,t,n,r){return new E0(e,t,n,r)}var O0=class e{constructor(e,t){this.width=e,this.height=t}with(t=this.width,n=this.height){return t!==this.width||n!==this.height?new e(t,n):this}static is(e){return typeof e==`object`&&typeof e.height==`number`&&typeof e.width==`number`}static lift(t){return t instanceof e?t:new e(t.width,t.height)}static equals(e,t){return e===t?!0:!e||!t?!1:e.width===t.width&&e.height===t.height}};O0.None=new O0(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,t,n){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let i=v0(n),a=r.get(i);if(a)a.users+=1;else{let o=new M$,s=new MutationObserver(e=>o.fire(e));s.observe(e,n);let c=a={users:1,observer:s,onDidMutate:o.event};t.add(rQ(()=>{--c.users,c.users===0&&(o.dispose(),s.disconnect(),r?.delete(i),r?.size===0&&this.mutationObservers.delete(e))})),r.set(i,a)}return a.onDidMutate}};var k0={CLICK:`click`,AUXCLICK:`auxclick`,DBLCLICK:`dblclick`,MOUSE_UP:`mouseup`,MOUSE_DOWN:`mousedown`,MOUSE_OVER:`mouseover`,MOUSE_MOVE:`mousemove`,MOUSE_OUT:`mouseout`,MOUSE_ENTER:`mouseenter`,MOUSE_LEAVE:`mouseleave`,MOUSE_WHEEL:`wheel`,POINTER_UP:`pointerup`,POINTER_DOWN:`pointerdown`,POINTER_MOVE:`pointermove`,POINTER_LEAVE:`pointerleave`,CONTEXT_MENU:`contextmenu`,WHEEL:`wheel`,KEY_DOWN:`keydown`,KEY_PRESS:`keypress`,KEY_UP:`keyup`,LOAD:`load`,BEFORE_UNLOAD:`beforeunload`,UNLOAD:`unload`,PAGE_SHOW:`pageshow`,PAGE_HIDE:`pagehide`,PASTE:`paste`,ABORT:`abort`,ERROR:`error`,RESIZE:`resize`,SCROLL:`scroll`,FULLSCREEN_CHANGE:`fullscreenchange`,WK_FULLSCREEN_CHANGE:`webkitfullscreenchange`,SELECT:`select`,CHANGE:`change`,SUBMIT:`submit`,RESET:`reset`,FOCUS:`focus`,FOCUS_IN:`focusin`,FOCUS_OUT:`focusout`,BLUR:`blur`,INPUT:`input`,STORAGE:`storage`,DRAG_START:`dragstart`,DRAG:`drag`,DRAG_ENTER:`dragenter`,DRAG_LEAVE:`dragleave`,DRAG_OVER:`dragover`,DROP:`drop`,DRAG_END:`dragend`,ANIMATION_START:U1?`webkitAnimationStart`:`animationstart`,ANIMATION_END:U1?`webkitAnimationEnd`:`animationend`,ANIMATION_ITERATION:U1?`webkitAnimationIteration`:`animationiteration`},A0=class extends oQ{constructor(e,t,n,r,i,a,o,s,c){super(),this._terminal=e,this._characterJoinerService=t,this._charSizeService=n,this._coreBrowserService=r,this._coreService=i,this._decorationService=a,this._optionsService=o,this._themeService=s,this._cursorBlinkStateManager=new sQ,this._charAtlasDisposable=this._register(new sQ),this._observerDisposable=this._register(new sQ),this._model=new x1,this._workCell=new Q$,this._workCell2=new Q$,this._rectangleRenderer=this._register(new sQ),this._glyphRenderer=this._register(new sQ),this._onChangeTextureAtlas=this._register(new M$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new M$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new M$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new M$),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new M$),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement(`canvas`);let l={antialias:!1,depth:!1,preserveDrawingBuffer:c};if(this._gl=this._canvas.getContext(`webgl2`,l),!this._gl)throw Error(`WebGL2 not supported `+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new KQ(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new L1(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,o,this._themeService)],this.dimensions=IQ(),this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(o.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(D0(this._canvas,`webglcontextlost`,e=>{console.log(`webglcontextlost event received`),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn(`webgl context not restored; firing onContextLoss`),this._onContextLoss.fire(e)},3e3)})),this._register(D0(this._canvas,`webglcontextrestored`,e=>{console.warn(`webglcontextrestored event received`),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,q$(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=X$(this._canvas,this._coreBrowserService.window,(e,t)=>this._setCanvasDevicePixelDimensions(e,t)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=X$(this._canvas,e,(e,t)=>this._setCanvasDevicePixelDimensions(e,t))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(rQ(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),q$(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,t){this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows);for(let e of this._renderLayers)e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,t,n){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,t,n);this._model.selection.update(this._core,e,t,n),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new F1(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new p1(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=K$(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nQ(y$.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),y$.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){this._clearModel(!0);for(let e of this._renderLayers)e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,t){if(!this._isAttached){if(this._core.screenElement?.isConnected&&this._charSizeService.width&&this._charSizeService.height)this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;else return}for(let n of this._renderLayers)n.handleGridChanged(this._terminal,e,t);!this._glyphRenderer.value||!this._rectangleRenderer.value||(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,t),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new Y$(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,t){let n=this._core,r=this._workCell,i,a,o,s,c,l,u=0,d=!0,f,p,m,h,g,_,v,y,b;e=M0(e,n.rows-1,0),t=M0(t,n.rows-1,0);let x=this._coreService.decPrivateModes.cursorStyle??n.options.cursorStyle??`block`,S=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,C=S-n.buffer.ydisp,ee=Math.min(this._terminal.buffer.active.cursorX,n.cols-1),te=-1,ne=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let w=!1;for(a=e;a<=t;a++)for(o=a+n.buffer.ydisp,s=n.buffer.lines.get(o),this._model.lineLengths[a]=0,m=S===o,u=0,c=this._characterJoinerService.getJoinedCharacters(o),y=0;y<n.cols;y++){if(i=this._cellColorResolver.result.bg,s.loadCell(y,r),y===0&&(i=this._cellColorResolver.result.bg),l=!1,d=y>=u,f=y,c.length>0&&y===c[0][0]&&d){p=c.shift();let e=this._model.selection.isCellSelected(this._terminal,p[0],o);for(v=p[0]+1;v<p[1];v++)d&&=e===this._model.selection.isCellSelected(this._terminal,v,o);d&&=!m||ee<p[0]||ee>=p[1],d?(l=!0,r=new j0(r,s.translateToString(!0,p[0],p[1]),p[1]-p[0]),f=p[1]-1):u=p[1]}if(h=r.getChars(),g=r.getCode(),v=(a*n.cols+y)*g1,this._cellColorResolver.resolve(r,y,o,this.dimensions.device.cell.width),ne&&o===S&&(y===ee&&(this._model.cursor={x:ee,y:C,width:r.getWidth(),style:this._coreBrowserService.isFocused?x:n.options.cursorInactiveStyle,cursorWidth:n.options.cursorWidth,dpr:this._devicePixelRatio},te=ee+r.getWidth()-1),y>=ee&&y<=te&&(this._coreBrowserService.isFocused&&x===`block`||this._coreBrowserService.isFocused===!1&&n.options.cursorInactiveStyle===`block`)&&(this._cellColorResolver.result.fg=50331648|this._themeService.colors.cursorAccent.rgba>>8&16777215,this._cellColorResolver.result.bg=50331648|this._themeService.colors.cursor.rgba>>8&16777215)),g!==0&&(this._model.lineLengths[a]=y+1),(this._model.cells[v]!==g||this._model.cells[v+_1]!==this._cellColorResolver.result.bg||this._model.cells[v+v1]!==this._cellColorResolver.result.fg||this._model.cells[v+y1]!==this._cellColorResolver.result.ext)&&(w=!0,h.length>1&&(g|=b1),this._model.cells[v]=g,this._model.cells[v+_1]=this._cellColorResolver.result.bg,this._model.cells[v+v1]=this._cellColorResolver.result.fg,this._model.cells[v+y1]=this._cellColorResolver.result.ext,_=r.getWidth(),this._glyphRenderer.value.updateCell(y,a,g,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,h,_,i),l)){for(r=this._workCell,y++;y<=f;y++)b=(a*n.cols+y)*g1,this._glyphRenderer.value.updateCell(y,a,0,0,0,0,hQ,0,0),this._model.cells[b]=0,this._model.cells[b+_1]=this._cellColorResolver.result.bg,this._model.cells[b+v1]=this._cellColorResolver.result.fg,this._model.cells[b+y1]=this._cellColorResolver.result.ext;y--}}w&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){!this._charSizeService.width||!this._charSizeService.height||(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=this._optionsService.rawOptions.lineHeight===1?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,t){this._canvas.width===e&&this._canvas.height===t||(this._canvas.width=e,this._canvas.height=t,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},j0=class extends m${constructor(e,t,n){super(),this.content=0,this.combinedData=``,this.fg=e.fg,this.bg=e.bg,this.combinedData=t,this._width=n}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error(`not implemented`)}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function M0(e,t,n=0){return Math.max(Math.min(e,t),n)}var N0=`di$target`,P0=`di$dependencies`,F0=new Map;function I0(e){if(F0.has(e))return F0.get(e);let t=function(e,n,r){if(arguments.length!==3)throw Error(`@IServiceName-decorator can only be used to decorate a parameter`);L0(t,e,r)};return t._id=e,F0.set(e,t),t}function L0(e,t,n){t[N0]===t?t[P0].push({id:e,index:n}):(t[P0]=[{id:e,index:n}],t[N0]=t)}I0(`BufferService`),I0(`CoreMouseService`),I0(`CoreService`),I0(`CharsetService`),I0(`InstantiationService`),I0(`LogService`);var R0=I0(`OptionsService`);I0(`OscLinkService`),I0(`UnicodeService`),I0(`DecorationService`);var z0={trace:0,debug:1,info:2,warn:3,error:4,off:5},B0=`xterm.js: `,V0=class extends oQ{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange(`logLevel`,()=>this._updateLogLevel())),H0=this}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=z0[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let t=0;t<e.length;t++)typeof e[t]==`function`&&(e[t]=e[t]())}_log(e,t,n){this._evalLazyOptionalParams(n),e.call(console,(this._optionsService.options.logger?``:B0)+t,...n)}trace(e,...t){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,t)}debug(e,...t){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,t)}info(e,...t){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,t)}warn(e,...t){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,t)}error(e,...t){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,t)}};V0=zZ([BZ(0,R0)],V0);var H0,U0=class extends oQ{constructor(e){if(pQ&&mQ()<16&&!document.createElement(`canvas`).getContext(`webgl2`,{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error(`Webgl2 is only supported on Safari 16 and above`);super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new M$),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new M$),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new M$),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new M$),this.onContextLoss=this._onContextLoss.event}activate(e){let t=e._core;if(!e.element){this._register(t.onWillOpen(()=>this.activate(e)));return}this._terminal=e;let n=t.coreService,r=t.optionsService,i=t,a=i._renderService,o=i._characterJoinerService,s=i._charSizeService,c=i._coreBrowserService,l=i._decorationService;i._logService;let u=i._themeService;this._renderer=this._register(new A0(e,o,s,c,n,l,r,u,this._preserveDrawingBuffer)),this._register(y$.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(y$.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(y$.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(y$.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),a.setRenderer(this._renderer),this._register(rQ(()=>{if(this._terminal._core._store._isDisposed)return;let t=this._terminal._core._renderService;t.setRenderer(this._terminal._core._createRenderer()),t.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},W0=2,G0=1,K0=class{activate(e){this._terminal=e}dispose(){}fit(){let e=this.proposeDimensions();if(!e||!this._terminal||isNaN(e.cols)||isNaN(e.rows))return;let t=this._terminal._core;(this._terminal.rows!==e.rows||this._terminal.cols!==e.cols)&&(t._renderService.clear(),this._terminal.resize(e.cols,e.rows))}proposeDimensions(){if(!this._terminal||!this._terminal.element||!this._terminal.element.parentElement)return;let e=this._terminal._core._renderService.dimensions;if(e.css.cell.width===0||e.css.cell.height===0)return;let t=this._terminal.options.scrollback===0?0:this._terminal.options.overviewRuler?.width||14,n=window.getComputedStyle(this._terminal.element.parentElement),r=parseInt(n.getPropertyValue(`height`)),i=Math.max(0,parseInt(n.getPropertyValue(`width`))),a=window.getComputedStyle(this._terminal.element),o={top:parseInt(a.getPropertyValue(`padding-top`)),bottom:parseInt(a.getPropertyValue(`padding-bottom`)),right:parseInt(a.getPropertyValue(`padding-right`)),left:parseInt(a.getPropertyValue(`padding-left`))},s=o.top+o.bottom,c=o.right+o.left,l=r-s,u=i-c-t;return{cols:Math.max(W0,Math.floor(u/e.css.cell.width)),rows:Math.max(G0,Math.floor(l/e.css.cell.height))}}},q0=`3.7.8`,J0=q0,Y0=typeof Buffer==`function`,X0=typeof TextDecoder==`function`?new TextDecoder:void 0,Z0=typeof TextEncoder==`function`?new TextEncoder:void 0,Q0=Array.prototype.slice.call(`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=`),$0=(e=>{let t={};return e.forEach((e,n)=>t[e]=n),t})(Q0),e2=/^(?:[A-Za-z\d+\/]{4})*?(?:[A-Za-z\d+\/]{2}(?:==)?|[A-Za-z\d+\/]{3}=?)?$/,t2=String.fromCharCode.bind(String),n2=typeof Uint8Array.from==`function`?Uint8Array.from.bind(Uint8Array):e=>new Uint8Array(Array.prototype.slice.call(e,0)),r2=e=>e.replace(/=/g,``).replace(/[+\/]/g,e=>e==`+`?`-`:`_`),i2=e=>e.replace(/[^A-Za-z0-9\+\/]/g,``),a2=e=>{let t,n,r,i,a=``,o=e.length%3;for(let o=0;o<e.length;){if((n=e.charCodeAt(o++))>255||(r=e.charCodeAt(o++))>255||(i=e.charCodeAt(o++))>255)throw TypeError(`invalid character found`);t=n<<16|r<<8|i,a+=Q0[t>>18&63]+Q0[t>>12&63]+Q0[t>>6&63]+Q0[t&63]}return o?a.slice(0,o-3)+`===`.substring(o):a},o2=typeof btoa==`function`?e=>btoa(e):Y0?e=>Buffer.from(e,`binary`).toString(`base64`):a2,s2=Y0?e=>Buffer.from(e).toString(`base64`):e=>{let t=[];for(let n=0,r=e.length;n<r;n+=4096)t.push(t2.apply(null,e.subarray(n,n+4096)));return o2(t.join(``))},c2=(e,t=!1)=>t?r2(s2(e)):s2(e),l2=e=>{if(e.length<2){var t=e.charCodeAt(0);return t<128?e:t<2048?t2(192|t>>>6)+t2(128|t&63):t2(224|t>>>12&15)+t2(128|t>>>6&63)+t2(128|t&63)}var t=65536+(e.charCodeAt(0)-55296)*1024+(e.charCodeAt(1)-56320);return t2(240|t>>>18&7)+t2(128|t>>>12&63)+t2(128|t>>>6&63)+t2(128|t&63)},u2=/[\uD800-\uDBFF][\uDC00-\uDFFFF]|[^\x00-\x7F]/g,d2=e=>e.replace(u2,l2),f2=Y0?e=>Buffer.from(e,`utf8`).toString(`base64`):Z0?e=>s2(Z0.encode(e)):e=>o2(d2(e)),p2=(e,t=!1)=>t?r2(f2(e)):f2(e),m2=e=>p2(e,!0),h2=/[\xC0-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF7][\x80-\xBF]{3}/g,g2=e=>{switch(e.length){case 4:var t=((7&e.charCodeAt(0))<<18|(63&e.charCodeAt(1))<<12|(63&e.charCodeAt(2))<<6|63&e.charCodeAt(3))-65536;return t2((t>>>10)+55296)+t2((t&1023)+56320);case 3:return t2((15&e.charCodeAt(0))<<12|(63&e.charCodeAt(1))<<6|63&e.charCodeAt(2));default:return t2((31&e.charCodeAt(0))<<6|63&e.charCodeAt(1))}},_2=e=>e.replace(h2,g2),v2=e=>{if(e=e.replace(/\s+/g,``),!e2.test(e))throw TypeError(`malformed base64.`);e+=`==`.slice(2-(e.length&3));let t,n,r,i=[];for(let a=0;a<e.length;)t=$0[e.charAt(a++)]<<18|$0[e.charAt(a++)]<<12|(n=$0[e.charAt(a++)])<<6|(r=$0[e.charAt(a++)]),n===64?i.push(t2(t>>16&255)):r===64?i.push(t2(t>>16&255,t>>8&255)):i.push(t2(t>>16&255,t>>8&255,t&255));return i.join(``)},y2=typeof atob==`function`?e=>atob(i2(e)):Y0?e=>Buffer.from(e,`base64`).toString(`binary`):v2,b2=Y0?e=>n2(Buffer.from(e,`base64`)):e=>n2(y2(e).split(``).map(e=>e.charCodeAt(0))),x2=e=>b2(C2(e)),S2=Y0?e=>Buffer.from(e,`base64`).toString(`utf8`):X0?e=>X0.decode(b2(e)):e=>_2(y2(e)),C2=e=>i2(e.replace(/[-_]/g,e=>e==`-`?`+`:`/`)),w2=e=>S2(C2(e)),T2=e=>{if(typeof e!=`string`)return!1;let t=e.replace(/\s+/g,``).replace(/={0,2}$/,``);return!/[^\s0-9a-zA-Z\+/]/.test(t)||!/[^\s0-9a-zA-Z\-_]/.test(t)},E2=e=>({value:e,enumerable:!1,writable:!0,configurable:!0}),D2=function(){let e=(e,t)=>Object.defineProperty(String.prototype,e,E2(t));e(`fromBase64`,function(){return w2(this)}),e(`toBase64`,function(e){return p2(this,e)}),e(`toBase64URI`,function(){return p2(this,!0)}),e(`toBase64URL`,function(){return p2(this,!0)}),e(`toUint8Array`,function(){return x2(this)})},O2=function(){let e=(e,t)=>Object.defineProperty(Uint8Array.prototype,e,E2(t));e(`toBase64`,function(e){return c2(this,e)}),e(`toBase64URI`,function(){return c2(this,!0)}),e(`toBase64URL`,function(){return c2(this,!0)})},k2={version:q0,VERSION:J0,atob:y2,atobPolyfill:v2,btoa:o2,btoaPolyfill:a2,fromBase64:w2,toBase64:p2,encode:p2,encodeURI:m2,encodeURL:m2,utob:d2,btou:_2,decode:w2,isValid:T2,fromUint8Array:c2,toUint8Array:x2,extendString:D2,extendUint8Array:O2,extendBuiltins:()=>{D2(),O2()}},A2=class{constructor(e=new M2,t=new j2){this._base64=e,this._provider=t}activate(e){this._terminal=e,this._disposable=e.parser.registerOscHandler(52,e=>this._setOrReportClipboard(e))}dispose(){return this._disposable?.dispose()}_readText(e,t){let n=this._base64.encodeText(t);this._terminal?.input(`\x1B]52;${e};${n}\x07`,!1)}_setOrReportClipboard(e){let t=e.split(`;`);if(t.length<2)return!0;let n=t[0],r=t[1];if(r===`?`){let e=this._provider.readText(n);return e instanceof Promise?e.then(e=>(this._readText(n,e),!0)):(this._readText(n,e),!0)}let i=``;try{i=this._base64.decodeText(r)}catch{}let a=this._provider.writeText(n,i);return a instanceof Promise?a.then(()=>!0):!0}},j2=class{async readText(e){return e===`c`?navigator.clipboard.readText():Promise.resolve(``)}async writeText(e,t){return e===`c`?navigator.clipboard.writeText(t):Promise.resolve()}},M2=class{encodeText(e){return k2.encode(e)}decodeText(e){let t=k2.decode(e);return!k2.isValid(e)||k2.encode(t)!==e?``:t}},N2=class{constructor(e,t,n,r={}){this._terminal=e,this._regex=t,this._handler=n,this._options=r}provideLinks(e,t){let n=F2.computeLink(e,this._regex,this._terminal,this._handler);t(this._addCallbacks(n))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(t,n)=>{if(this._options.hover){let{range:r}=e;this._options.hover(t,n,r)}},e))}};function P2(e){try{let t=new URL(e),n=t.password&&t.username?`${t.protocol}//${t.username}:${t.password}@${t.host}`:t.username?`${t.protocol}//${t.username}@${t.host}`:`${t.protocol}//${t.host}`;return e.toLocaleLowerCase().startsWith(n.toLocaleLowerCase())}catch{return!1}}var F2=class e{static computeLink(t,n,r,i){let a=new RegExp(n.source,(n.flags||``)+`g`),[o,s]=e._getWindowedLineStrings(t-1,r),c=o.join(``),l,u=[];for(;l=a.exec(c);){let t=l[0];if(!P2(t))continue;let[n,a]=e._mapStrIdx(r,s,0,l.index),[o,c]=e._mapStrIdx(r,n,a,t.length);if(n===-1||a===-1||o===-1||c===-1)continue;let d={start:{x:a+1,y:n+1},end:{x:c,y:o+1}};u.push({range:d,text:t,activate:i})}return u}static _getWindowedLineStrings(e,t){let n,r=e,i=e,a=0,o=``,s=[];if(n=t.buffer.active.getLine(e)){let e=n.translateToString(!0);if(n.isWrapped&&e[0]!==` `){for(a=0;(n=t.buffer.active.getLine(--r))&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),!(!n.isWrapped||o.indexOf(` `)!==-1)););s.reverse()}for(s.push(e),a=0;(n=t.buffer.active.getLine(++i))&&n.isWrapped&&a<2048&&(o=n.translateToString(!0),a+=o.length,s.push(o),o.indexOf(` `)===-1););}return[s,r]}static _mapStrIdx(e,t,n,r){let i=e.buffer.active,a=i.getNullCell(),o=n;for(;r;){let e=i.getLine(t);if(!e)return[-1,-1];for(let n=o;n<e.length;++n){e.getCell(n,a);let o=a.getChars();if(a.getWidth()&&(r-=o.length||1,n===e.length-1&&o===``)){let e=i.getLine(t+1);e&&e.isWrapped&&(e.getCell(0,a),a.getWidth()===2&&(r+=1))}if(r<0)return[t,n]}t++,o=0}return[t,o]}},I2=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function L2(e,t){let n=window.open();if(n){try{n.opener=null}catch{}n.location.href=t}else console.warn(`Opening link blocked as opener could not be cleared`)}var R2=class{constructor(e=L2,t={}){this._handler=e,this._options=t}activate(e){this._terminal=e;let t=this._options,n=t.urlRegex||I2;this._linkProvider=this._terminal.registerLinkProvider(new N2(this._terminal,n,this._handler,t))}dispose(){this._linkProvider?.dispose()}};function z2(e,t){let{term:n,write:r}=e,i=new TextEncoder,a=null,o=0,s=!1,c=null,l=()=>{if(s)return;let i=location.protocol===`https:`?`wss`:`ws`,f=a=new WebSocket(`${i}://${location.host}/term/${e.sessionId}?cols=${n.cols}&rows=${n.rows}&visible=${+!!u()}`);f.onmessage=e=>r(e.data),f.onopen=()=>{o=0,d(f),c&&=(f.send(JSON.stringify({resize:c})),null),m()},f.onclose=()=>{if(!(t.aborted||s||a!==f)){if(document.visibilityState!==`visible`){let e=()=>{document.visibilityState===`visible`&&(document.removeEventListener(`visibilitychange`,e),!t.aborted&&a===f&&l())};document.addEventListener(`visibilitychange`,e,{signal:t})}else++o<=3?setTimeout(()=>{!t.aborted&&a===f&&l()},400*o):e.onDead()}}},u=()=>document.visibilityState===`visible`&&e.isVisible(),d=e=>{e.readyState===WebSocket.OPEN&&e.send(JSON.stringify({visible:u()}))};document.addEventListener(`visibilitychange`,()=>a&&d(a),{signal:t}),l(),t.addEventListener(`abort`,()=>a?.close());let f=[],p=0,m=()=>{for(;f.length&&a?.readyState===WebSocket.OPEN;)a.send(i.encode(f.shift()));p=0};return{send(e){a?.readyState===WebSocket.OPEN?a.send(i.encode(e)):p<1024&&(f.push(e),p+=e.length)},resize(e,t){a?.readyState===WebSocket.OPEN?a.send(JSON.stringify({resize:[e,t]})):c=[e,t]},syncVisibility(){a&&d(a)},get readyState(){return a?.readyState},reconnect(){s=!1,l()},disconnect(){s=!0,a?.close()}}}function B2(e,t,n,r){let i=null,a=0,o=0,s=0,c=0,l=n=>{let r=t().querySelector(`.xterm-screen`)||t(),i=r.clientHeight/e.rows||17;c+=n/i;let a=Math.trunc(c);if(!a)return;c-=a;let o=r.getBoundingClientRect(),s=a>0?1:-1;for(let e=0;e!==a;e+=s)r.dispatchEvent(new WheelEvent(`wheel`,{deltaY:s,deltaMode:WheelEvent.DOM_DELTA_LINE,bubbles:!0,cancelable:!0,clientX:o.left+o.width/2,clientY:o.top+o.height/2}))},u=()=>{cancelAnimationFrame(s),s=0},d=()=>{o*=.97,!(Math.abs(o)<.25)&&(l(o*16),s=requestAnimationFrame(d))};n.addEventListener(`abort`,u),t().addEventListener(`touchstart`,e=>{u(),o=0,i=e.touches[0]?.clientY??null,a=e.timeStamp},{passive:!0,signal:n}),t().addEventListener(`touchmove`,e=>{if(r?.())return;let t=e.touches[0]?.clientY;if(t==null||i==null)return;let n=i-t;Math.abs(n)>=2&&(o=n/Math.max(1,e.timeStamp-a),i=t,a=e.timeStamp,l(n)),e.preventDefault()},{passive:!1,signal:n}),t().addEventListener(`touchend`,()=>{i=null,Math.abs(o)>.5&&(u(),s=requestAnimationFrame(d))},{signal:n})}function V2(e){let t=!1,n=[],r=0;return{write(i){if(!t){e.write(i);return}for(n.push(i),r+=i.length;r>1048576&&n.length>1;)r-=n.shift().length},setFrozen(i){if(t!==i&&(t=i,!i)){let t=n.join(``);n=[],r=0,t&&e.write(t)}}}}function H2(e,t,n){let r=e.textarea;if(!r)return;let i=`\xA0`.repeat(4),a={deleteContentBackward:``,deleteWordBackward:``,deleteSoftLineBackward:``,deleteHardLineBackward:``},o=!1,s=()=>{o||(r.value!==i&&(r.value=i),r.setSelectionRange(i.length,i.length))};r.addEventListener(`beforeinput`,e=>{let n=a[e.inputType];n&&(e.preventDefault(),e.stopImmediatePropagation(),t(n))},{capture:!0,signal:n}),r.addEventListener(`compositionstart`,()=>{o=!0},{signal:n}),r.addEventListener(`compositionend`,()=>{o=!1,setTimeout(s,0)},{signal:n}),r.addEventListener(`input`,()=>setTimeout(s,0),{signal:n}),r.addEventListener(`focus`,()=>setTimeout(s,0),{signal:n}),s()}var U2=450,W2=12,G2=` ·│┃()[]{}<>'"\`,;│|`;function K2(e,t,n,r){let i=!1,a,o=0,s=0,c=null,l=null,u=()=>t().querySelector(`.xterm-screen`)||t(),d=(t,n)=>{let r=u().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}},f=t=>{let n=e.buffer.active.getLine(t.row)?.translateToString()??``,r=e=>!e||e===` `||G2.includes(e);if(r(n[t.col]))return{start:t,end:t};let i=t.col,a=t.col;for(;i>0&&!r(n[i-1]);)i--;for(;a<n.length-1&&!r(n[a+1]);)a++;return{start:{col:i,row:t.row},end:{col:a,row:t.row}}},p=(e,t)=>e.row<t.row||e.row===t.row&&e.col<=t.col,m=()=>{if(!c||!l)return;let[t,n]=p(c,l)?[c,l]:[l,c],r=(n.row-t.row)*e.cols+(n.col-t.col)+1;e.select(t.col,t.row,Math.max(1,r))},h=()=>{clearTimeout(a),a=void 0};t().addEventListener(`touchstart`,t=>{if(t.touches.length!==1){h();return}!i&&e.hasSelection()&&e.clearSelection(),o=t.touches[0].clientX,s=t.touches[0].clientY,a=setTimeout(()=>{a=void 0,i=!0,n.onStart();let e=f(d(o,s));c=e.start,l=e.end,m(),navigator.vibrate?.(10)},U2)},{passive:!0,signal:r}),t().addEventListener(`touchmove`,e=>{let t=e.touches[0];if(t){if(i){l=d(t.clientX,t.clientY),m(),e.preventDefault();return}a&&Math.hypot(t.clientX-o,t.clientY-s)>W2&&h()}},{passive:!1,signal:r});let g=()=>{if(h(),!i)return;i=!1,n.onEnd();let t=e.getSelection();t&&X_(t).then(e=>{e&&n.onCopy(t)})};return t().addEventListener(`touchend`,g,{signal:r}),t().addEventListener(`touchcancel`,g,{signal:r}),{selecting:()=>i}}var q2=5;function J2(e,t,n,r){let i=null,a=!1,o=0,s=0,c=()=>t().querySelector(`.xterm-screen`)||t(),l=(t,n)=>{let r=c().getBoundingClientRect();return{col:Math.max(0,Math.min(e.cols-1,Math.floor((t-r.left)/r.width*e.cols))),row:Math.max(0,Math.min(e.rows-1,Math.floor((n-r.top)/r.height*e.rows)))+e.buffer.active.viewportY}};t().addEventListener(`mousedown`,t=>{if(a||t.button!==0||t.shiftKey||t.altKey||t.ctrlKey||t.metaKey)return;t.preventDefault(),t.stopImmediatePropagation();let n=t.timeStamp;s=n-o<400?s+1:1,o=n;let r=l(t.clientX,t.clientY);i={startX:t.clientX,startY:t.clientY,startCol:r.col,startRow:r.row,selecting:!1,detail:s},e.focus()},{capture:!0,signal:r}),window.addEventListener(`mousemove`,t=>{if(!i)return;if(!i.selecting){if(Math.hypot(t.clientX-i.startX,t.clientY-i.startY)<q2)return;i.selecting=!0}let n=l(t.clientX,t.clientY),r=(n.row-i.startRow)*e.cols+(n.col-i.startCol)+1,[a,o,s]=r>=0?[i.startCol,i.startRow,Math.max(1,r)]:[n.col,n.row,Math.max(1,-r+1)];e.select(a,o,s),t.preventDefault()},{signal:r}),window.addEventListener(`mouseup`,async t=>{if(!i)return;let r=i.selecting,o=i;if(i=null,r){let t=e.getSelection();t&&await X_(t)&&n(t);return}a=!0;let s={bubbles:!0,cancelable:!0,clientX:o.startX,clientY:o.startY,button:0,buttons:1,detail:o.detail,view:window},c=document.elementFromPoint(o.startX,o.startY);c?.dispatchEvent(new MouseEvent(`mousedown`,s)),c?.dispatchEvent(new MouseEvent(`mouseup`,{...s,buttons:0,button:0})),c?.dispatchEvent(new MouseEvent(`click`,{...s,buttons:0})),a=!1,t.preventDefault()},{signal:r})}var Y2=Rr,X2=(e=>`/${e}&`)(zr);function Z2(e){Ur(e.a,`M15 4L8 20`)}var Q2=(e,t)=>Vr(e.a,t),$2=(e,t)=>Hr(e.a,t),e4=Rr,t4=(e=>`/${e}&`)(zr);function n4(e){Ur(e.a,`M7 12L17 12 M7 8L13 8 M3 20.2895V5C3 3.89543 3.89543 3 5 3H19C20.1046 3 21 3.89543 21 5V15C21 16.1046 20.1046 17 19 17H7.96125C7.35368 17 6.77906 17.2762 6.39951 17.7506L4.06852 20.6643C3.71421 21.1072 3 20.8567 3 20.2895Z`)}var r4=(e,t)=>Vr(e.a,t),i4=(e,t)=>Hr(e.a,t),a4=Rr,o4=(e=>`/${e}&`)(zr);function s4(e){Ur(e.a,`M8.5 4H6C4.89543 4 4 4.89543 4 6V20C4 21.1046 4.89543 22 6 22H18C19.1046 22 20 21.1046 20 20V6C20 4.89543 19.1046 4 18 4H15.5 M8 6.4V4.5C8 4.22386 8.22386 4 8.5 4C8.77614 4 9.00422 3.77604 9.05152 3.50398C9.19968 2.65171 9.77399 1 12 1C14.226 1 14.8003 2.65171 14.9485 3.50398C14.9958 3.77604 15.2239 4 15.5 4C15.7761 4 16 4.22386 16 4.5V6.4C16 6.73137 15.7314 7 15.4 7H8.6C8.26863 7 8 6.73137 8 6.4Z`)}var c4=(e,t)=>Vr(e.a,t),l4=(e,t)=>Hr(e.a,t),u4=Rr,d4=(e=>`/${e}&`)(zr);function f4(e){Ur(e.a,`M21 3.6V20.4C21 20.7314 20.7314 21 20.4 21H3.6C3.26863 21 3 20.7314 3 20.4V3.6C3 3.26863 3.26863 3 3.6 3H20.4C20.7314 3 21 3.26863 21 3.6Z M3 16L10 13L21 18 M16 10C14.8954 10 14 9.10457 14 8C14 6.89543 14.8954 6 16 6C17.1046 6 18 6.89543 18 8C18 9.10457 17.1046 10 16 10Z`)}var p4=(e,t)=>Vr(e.a,t),m4=(e,t)=>Hr(e.a,t),h4=`<div class=term-wrap><div class=term></div><!><!><!><!></div><!><!>`,g4=` D b%b%b%b%l%c`,_4=400,v4=55,y4=3e4,b4=150,x4=[[{kind:`paste`},{kind:`key`,label:`▲`,seq:`\x1B[A`},{kind:`attach`}],[{kind:`key`,label:`◀`,seq:`\x1B[D`},{kind:`key`,label:`↵`,seq:`\r`},{kind:`key`,label:`▶`,seq:`\x1B[C`}],[{kind:`key`,label:`⇥`,seq:` `},{kind:`key`,label:`▼`,seq:`\x1B[B`},{kind:`key`,label:`^C`,seq:``}]],S4=L(`o20`,e=>A(e.a,`click`,function(){e._._._.d.click()})),C4=e=>{f4(e.b),p4(e.b,16),m4(e.b),S4(e)},w4=L(`o19`,e=>{A(e.a,`pointerdown`,function(e){e.preventDefault()}),A(e.a,`click`,function(){e._._._._.al()})}),T4=e=>{s4(e.b),c4(e.b,16),l4(e.b),w4(e)},E4=P(0,2,e=>{gt(e.a,{enter:e._.e===`↵`,"big-glyph":e._.e===`↵`||e._.e===`⇥`}),V(e.b,e._.e)}),D4=L(`o21`,e=>{A(e.a,`pointerdown`,function(t){t.preventDefault(),e._._._._.af(e._.f)}),A(e.a,`pointerup`,function(){e._._._._.ag()}),A(e.a,`pointercancel`,function(){e._._._._.ag()}),A(e.a,`pointerleave`,function(){e._._._._.ag()}),A(e.a,`contextmenu`,function(e){e.preventDefault()})}),O4=O(0,(e=>`<button title=Paste>${e}</button>`)(a4),(e=>` D/${e}&l`)(o4),T4,(e=>`<button title="Attach image">${e}</button>`)(u4),(e=>` D/${e}&l`)(d4),C4,`<button class=repeat> </button>`,` D `,e=>{E4._(e),D4(e)}),k4=(e,t)=>O4(e,t===`paste`?0:t===`attach`?1:2),A4=(e,t)=>{k4(e,t[0]?.kind),j4(e,t[0]?.label),M4(e,t[0]?.seq)},j4=M(4),M4=M(5),N4=k(0,`<!><!><!>`,`b%`,0,A4),P4=(e,t)=>N4(e,[t]),F4=(e,t)=>P4(e,t[0]),I4=I(60,L(`o17`,e=>A(e.a,`click`,function(){e._._.a7?.send(`\x1B`)})),e=>e._._),L4=L(`o18`,e=>A(e.a,`pointerdown`,function(e){e.preventDefault()})),R4=e=>{I4(e),L4(e)},z4=P(5,0,L(`o8`,e=>{e._.a5&&setTimeout(()=>e.c?.focus(),50)})),B4=L(`o9`,e=>{A(e.a,`click`,function(){a6(e._,!1)}),A(e.b,`click`,function(e){e.stopPropagation()}),A(e.c,`paste`,function(t){t.preventDefault(),e._.ak(t.clipboardData)}),A(e.d,`click`,function(){a6(e._,!1)})}),V4=e=>{z4._(e),B4(e)},H4=L(`o7`,e=>A(e.a,`click`,function(){X3(e._,!1)})),U4=I(51,e=>ht(e.a,[`dot`,Lr(e._._.r)]),e=>e._._),W4=e=>{U4(e),G4(e)},G4=I(57,e=>V(e.b,e._._.y),e=>e._._),K4=M(3,e=>{z(e.a,`title`,`New ${e.d} session`),vi(e.b,e.d)}),q4=L(`o15`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._.p?.(e.d)})),J4=e=>{e.b,hi(e.b,15),yi(e.b),q4(e)},Y4=(e,t)=>K4(e,t[0]),X4=N(1,e=>{B(e.a,`armed`,e._._._.g===e._.j),z(e.a,`title`,e._._._.g===e._.j?`Really kill this session?`:`Kill session`)}),Z4=I(8,X4,e=>e._._._),Q4=L(`o13`,e=>A(e.a,`click`,function(t,n){e._._._.g===e._.j?(b3(e._._._,null),n.closest(`[popover]`)?.hidePopover(),e._._._._._.w?.(e._.j)):b3(e._._._,e._.j)})),$4=e=>{Z4(e),e3._(e),Q4(e)},e3=P(6,0,X4),t3=L(`o12`,e=>A(e.a,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e._._._._._.v?.(e._.j)})),n3=e=>{np(e.b),rp(e.b,12),ip(e.b),t3(e)},r3=N(10,e=>B(e.a,`current`,e.j===e._._._._.t)),i3=I(53,r3,e=>e._._._._),a3=L(`o14`,e=>A(e.b,`click`,function(t,n){n.closest(`[popover]`)?.hidePopover(),e.j!==e._._._._.t&&e._._._._.u?.(e.j)})),o3=e=>{i3(e),c3(e),u3(e),e.d,hi(e.d,14),yi(e.d),a3(e)},s3=O(5,(e=>`<button class="sess-x sess-edit" title="Rename session">${e}</button>`)(ep),(e=>` D/${e}&l`)(tp),n3),c3=I(54,e=>s3(e,+!e._._._._.v),e=>e._._._._),l3=O(6,`<button class=sess-x>×</button>`,` `,$4),u3=I(55,e=>l3(e,+!e._._._._.w),e=>e._._._._),d3=M(9,e=>{r3(e),e3(e)}),f3=(e,t)=>ht(e.c,[`dot`,Lr(t)]),p3=N(14,e=>V(e.e,e.n||e.m)),m3=M(12,e=>{vi(e.d,e.m),p3(e)}),h3=M(13,p3),g3=k(0,(e=>`<div class=sess-row><button class=sess-open><span></span>${e}<span class=sess-title> </span></button><!><!></div>`)(ai),(e=>` D D b/${e}&D m%b%l`)(`b%c`),o3,(e,t)=>{d3(e,t[0]?.id),f3(e,t[0]?.state),m3(e,t[0]?.agent),h3(e,t[0]?.title)}),_3=I(52,e=>g3(e,[e._._._.s||[],`id`]),e=>e._._._),v3=_3,y3=I(50,e=>vi(e.b,e._._.q||`shell`),e=>e._._),b3=j(6,F(Z4)),x3=(e,t)=>{z(e.a,`popovertarget`,t),z(e.d,`id`,t)},S3=L(`o16`,e=>A(e.d,`toggle`,function(t,n){if(b3(e,null),t.newState===`open`){let t=e.a.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.left=`${Math.max(8,Math.min(t.left+t.width/2-n.offsetWidth/2,window.innerWidth-n.offsetWidth-8))}px`}})),C3=e=>{y3(e),w3(e),E3(e),O3(e),e.b,hi(e.b,16),yi(e.b),b3(e,null),x3(e,Qe(e)),S3(e)},w3=I(51,e=>ht(e.c,[`dot`,`sess-dot`,Lr(e._._.r)]),e=>e._._),T3=O(4,`<!><!><!>`,`b%`,v3),E3=I(52,e=>{B(e.f,`lone`,(e._._.s||[]).length<=1),T3(e,(e._._.s||[]).length>1?0:1)},e=>e._._),D3=k(5,(e=>`<button class=icon-btn>${e}</button>`)(ai),(e=>` D/${e}&l`)(`b%c`),J4,Y4),O3=I(56,e=>D3(e,[[...e._._.x||[],`shell`],e=>e]),e=>e._._),k3=L(`o11`,e=>{A(e.a,`click`,function(){e._._.m?.()}),A(e.c,`click`,function(){e._._.n?.()}),A(e.e,`click`,function(){e._._.o?.()})}),A3=e=>{$m(e.b),eh(e.b,16),th(e.b),Zr(e.d),Qr(e.d,16),$r(e.d),Kr(e.f),qr(e.f,16),Jr(e.f),k3(e)},j3=L(`o10`,e=>A(e.a,`click`,function(){e._._.l?.()})),M3=O(0,(e=>`<button class="icon-btn kbtn" title="Back to terminal">${e}</button>`)(lv),(e=>` D/${e}&l`)(uv),e=>{dv(e.b),fv(e.b,16),pv(e.b),j3(e)},((e,t,n)=>`<button class="icon-btn kbtn" title=Workspaces>${e}</button><button class="icon-btn kbtn" title="Manage workspace">${t}</button><button class="icon-btn kbtn" title="Review changes">${n}</button>`)(Zm,Yr,Wr),((e,t,n)=>` D/${e}&l D/${t}&l D/${n}&l`)(Qm,Xr,Gr),A3),N3=O(8,`<button class="icon-btn kbtn kbtn-esc" title=Escape>esc</button>`,` `,R4),P3=O(1,(e=>`<button class="icon-btn kbtn sess-btn" title=Sessions>${e}<span></span></button><div popover=auto class=sess-pop><!><div class=sess-new></div></div>`)(ai),(e=>` D/${e}& l D%b l`)(`b%c`),C3),F3=N(11,e=>P3(e,e._.k!==`diff`&&e._.p?0:1)),I3=P(6,0,e=>{M3(e,e._.k===`diff`?0:1),N3(e,+(e._.k===`diff`)),F3(e)}),L3=(e,t)=>{z(e.e,`popovertarget`,t),z(e.j,`id`,t)},R3=k(9,`<!><!><!>`,`b%`,0,F4),z3=L(`o23`,e=>{A(e.d,`change`,function(t,n){for(let t of n.files||[])e._.ah(t);n.value=``}),A(e.e,`pointerdown`,function(e){e.preventDefault()}),A(e.g,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`pointerdown`,function(e){e.preventDefault()}),A(e.j,`toggle`,function(t,n){if(t.newState===`open`){let t=e.e.getBoundingClientRect();n.style.top=`${Math.max(8,t.top-n.offsetHeight-8)}px`,n.style.bottom=`auto`}})}),B3=e=>{I3._(e),V3._(e),U3._(e),W3._(e),G3._(e),Z2(e.f),Q2(e.f,16),$2(e.f),n4(e.h),r4(e.h,16),i4(e.h),L3(e,Qe(e)),R3(e,[x4]),z3(e)},V3=P(6,0,F3),H3=O(2,`<span class="kbar-ws dim" aria-hidden=true><span></span><span class=kbar-ws-name> </span></span>`,`D bD `,W4),U3=P(6,0,e=>H3(e,+!e._.y)),W3=P(6,0,e=>{B(e.g,`on`,e._.a1),z(e.g,`title`,e._.a1?`Hide keyboard`:`Show keyboard`)}),G3=P(6,0,L(`o22`,e=>A(e.g,`click`,function(){Z3(e._,!e._.a1),e._.a7?.setKeyboard(e._.a1)}))),K3=tt(`o6`,1),q3=et(42),J3=O(4,`<div class=term-dead><button class="btn primary">Reconnect</button></div>`,`D `,H4),Y3=N(45,L(`o24`,e=>Et(e,{onMount:function(){let t=new AbortController,n=t.signal,r=new IZ({fontSize:13,fontFamily:`ui-monospace, monospace`,scrollback:5e3,allowProposedApi:!0,rightClickSelectsWord:!0,macOptionClickForcesSelection:!0,linkHandler:{activate(e,t){or(t)}}}),i=new K0;r.loadAddon(i),r.open(e.b);let a=rr();try{let e=new U0;e.onContextLoss(()=>e.dispose()),r.loadAddon(e)}catch{}try{r.loadAddon(new A2(void 0,{readText:()=>navigator.clipboard.readText().catch(()=>``),writeText:(e,t)=>X_(t).then(()=>{})}))}catch{}r.loadAddon(new R2((e,t)=>or(t))),i.fit();let o=a?V2(r):null,s=o?o.write:e=>r.write(e),c=z2({sessionId:e.t,term:r,write:s,onDead:()=>{X3(e,!0)},isVisible:()=>!!e.z},n);r.onData(e=>c.send(e)),r.attachCustomKeyEventHandler(t=>t.key===`Enter`&&t.shiftKey?(t.type===`keydown`&&c.send(`\x1B\r`),!1):(t.ctrlKey||t.metaKey)&&t.key.toLowerCase()===`c`&&r.hasSelection()?(t.type===`keydown`&&X_(r.getSelection()).then(t=>{t&&(r.clearSelection(),e.ab())}),!1):!(a&&t.type===`keydown`&&t.key===`Backspace`));let l=()=>{if(!e.b.clientWidth)return;let t=i.proposeDimensions();!t||t.cols===r.cols&&t.rows===r.rows||(i.fit(),c.resize(r.cols,r.rows))},u=new ResizeObserver(l);u.observe(e.b),n.addEventListener(`abort`,()=>u.disconnect());let d=()=>requestAnimationFrame(l);if(document.addEventListener(`visibilitychange`,()=>{document.hidden||d()},{signal:n}),window.addEventListener(`pageshow`,d,{signal:n}),window.addEventListener(`focus`,d,{signal:n}),window.visualViewport?.addEventListener(`resize`,d,{signal:n}),e.b.addEventListener(`paste`,t=>{let n=[...t.clipboardData?.files||[]];if(n.length){t.preventDefault(),t.stopImmediatePropagation();for(let t of n)e.ah(t)}},{capture:!0,signal:n}),e.a7={send(e){c.send(e)},setKeyboard(e){let t=r.textarea;t&&(t.inputMode=e?`text`:`none`,e?(t.focus(),setTimeout(()=>{document.activeElement!==t&&t.focus()},50)):t.blur())}},a){r.textarea&&(r.textarea.inputMode=`none`);let t=window.visualViewport;if(t){let i=0,a=()=>{i=Math.max(i,t.height),e.a1&&i-t.height<b4&&(Z3(e,!1),r.textarea&&(r.textarea.inputMode=`none`))};a(),t.addEventListener(`resize`,a,{signal:n}),window.addEventListener(`orientationchange`,()=>{i=0},{signal:n})}let i=K2(r,K3(e),{onStart(){o?.setFrozen(!0)},onEnd(){o?.setFrozen(!1)},onCopy(){e.ab()}},n);B2(r,K3(e),n,i.selecting),H2(r,e=>c.send(e),n)}else J2(r,K3(e),()=>e.ab(),n);e.z&&!a&&r.focus();let f={term:r,socket:c,abort:t,suspend:void 0};return e.z||(f.suspend=setTimeout(()=>c.disconnect(),y4)),f},onUpdate:function(){clearTimeout(this.suspend),this.socket.syncVisibility(),e.z?(!e.a0&&this.socket.readyState>=WebSocket.CLOSING&&(this.term.reset(),this.socket.reconnect()),!e.a0&&!e.a2&&this.term.focus()):this.suspend=setTimeout(()=>this.socket.disconnect(),y4)},onDestroy:function(){clearTimeout(this.suspend),this.abort.abort(),this.term.dispose()}})),7),X3=j(26,e=>{J3(e,+!e.a0),Y3(e)}),Z3=j(27,e=>{Y3(e),W3(e)}),Q3=O(6,((e,t)=>`<div class=kb-slot><div class=key-bar><!><div class=kspacer></div><!><input type=file accept=image/* hidden><button class="icon-btn kbtn dpad-btn" title="More keys">${e}</button><button class="icon-btn kbtn kb-toggle">${t}</button><!><div popover=auto class=dpad-grid></div></div></div>`)(Y2,e4),((e,t)=>`E%b b%b b D/${e}&l D/${t}&l%b m`)(X2,t4),B3),$3=j(28,e=>{Q3(e,+!e.a2),Y3(e)}),e6=O(2,`<div class="term-uploading dim">uploading…</div>`),t6=j(29,e=>e6(e,+!e.a3)),n6=O(3,`<div class=term-copied>Copied</div>`),r6=j(30,e=>n6(e,+!e.a4)),i6=O(5,`<div class=trap-backdrop><div class=paste-trap><p class=dim>Long-press below and choose Paste</p><input placeholder="Paste here…"><button class=btn>Cancel</button></div></div>`,` D Db b `,V4),a6=j(31,e=>{i6(e,+!e.a5),z4(e)}),o6=(e,t)=>v6(e,t.current),s6=(e,t)=>b6(e,t.timer),c6=(e,t)=>S6(e,t.current),l6=L(`o25`,e=>{$3(e,rr()),A(e.a,`dragover`,function(e){e.preventDefault()}),A(e.a,`drop`,function(t){t.preventDefault();for(let n of t.dataTransfer?.files||[])e.ah(n)})});function u6(e){X3(e,!1),Z3(e,!1),$3(e,!1),t6(e,!1),r6(e,!1),a6(e,!1),o6(e,{current:null}),s6(e,{timer:0}),c6(e,{current:null}),l6(e)}var d6=M(41),f6=N(40,e=>d6(e,H6(e))),p6=M(46),m6=M(47),h6=N(44,e=>{p6(e,U6(e)),m6(e,W6(e))}),g6=M(43,e=>{h6(e),Y3(e)}),_6=N(34,e=>g6(e,G6(e))),v6=M(33,e=>{f6(e),_6(e),h6(e),Y3(e)}),y6=M(37,Y3),b6=M(36,e=>y6(e,K6(e))),x6=M(42),S6=M(39,e=>{x6(e,q6(e)),f6(e)}),C6=M(9,_6),w6=M(10,e=>{z(e.a,`hidden`,e.k===`diff`),I3(e)}),T6=F(i3),E6=M(19,e=>{Y3(e),T6(e)}),D6=M(25,Y3),O6=M(11),k6=M(12),A6=M(13),j6=M(14),M6=M(15,V3),N6=M(16,F(y3)),P6=M(17,F(w3,U4)),F6=M(18,F(E3,_3)),I6=M(20),L6=M(21,F(c3)),R6=M(22,F(u3)),z6=M(23,F(O3)),B6=F(G4),V6=M(24,e=>{U3(e),B6(e)});function H6(e){return t=>{q3(e)(),e.a7?.send(t);let n={};n.delay=setTimeout(()=>{n.repeat=setInterval(()=>e.a7?.send(t),v4)},_4),e.ad=n}}function U6(e){return async t=>{let n=[...t?.files||[]];for(let t of n)await e.ah(t);if(!n.length){let n=t?.getData(`text/plain`);n&&e.a7?.send(n)}a6(e,!1)}}function W6(e){return async()=>{if(!navigator.clipboard?.read){a6(e,!0);return}try{for(let t of await navigator.clipboard.read()){let n=t.types.find(e=>e.startsWith(`image/`));if(n){let r=await t.getType(n);await e.ah(new File([r],`pasted.${n.split(`/`)[1]||`png`}`,{type:n}))}else if(t.types.includes(`text/plain`)){let n=await(await t.getType(`text/plain`)).text();n&&e.a7?.send(n)}}}catch{a6(e,!0)}}}function G6(e){return async t=>{if(t){t6(e,!0);try{let n=await(await fetch(`/api/workspaces/${e.j}/assets?name=${encodeURIComponent(t.name||`pasted.png`)}`,{method:`POST`,body:t})).json();n.path&&e.a7?.send(`${n.path} `)}finally{t6(e,!1)}}}}function K6(e){return()=>{clearTimeout(e.aa),r6(e,!0),e.aa=setTimeout(()=>{r6(e,!1)},1200)}}function q6(e){return()=>{let t=e.ad;t&&(clearTimeout(t.delay),clearInterval(t.repeat),e.ad=null)}}R(`o1`,H6),R(`o4`,U6),R(`o5`,W6),R(`o3`,G6),R(`o0`,K6),R(`o2`,q6);var J6=Us,Y6=(e=>`/${e}&`)(Ws);function X6(e){let t=Math.round(e/6e4);if(t<60)return`${t}m`;let n=Math.round(t/60);return n<48?`${n}h`:`${Math.round(n/24)}d`}function Z6(e,t){if(!e)return null;let n=new Date(e).getTime()-Date.now();return n<=0?t?null:`now`:X6(n)}var Q6=(e,t)=>V(e.e,t?`↻ ${pt(t)}`:``),$6=N(9,e=>Q6(e,Z6(e.i,e._.h!=null))),e8=Ke(4,$6),t8=e8,n8=N(12,e=>z(e.a,`title`,`${e.k}: ${e.l}% used${e.i?` — resets ${new Date(e.i).toLocaleString()}`:``}`),2),r8=M(11,e=>{V(e.d,e.l),n8(e)}),i8=M(7,e=>{gt(e.c,{hot:e.h>=90,warm:e.h>=70&&e.h<90}),_t(e.c,`width:${Math.min(100,Math.max(2,e.h))}%`),r8(e,Math.round(e.h))}),a8=M(8,e=>{$6(e),n8(e)}),o8=M(10,e=>{V(e.b,e.k),n8(e)}),s8=(e,t)=>{i8(e,t[0]?.used_percent),a8(e,t[0]?.resets_at),o8(e,t[0]?.window)},c8=P(3,0,e=>{z(e.a,`title`,`plan-usage could not reach this provider — these are its last cached numbers, ${X6(e._.h*1e3)} old`),V(e.b,X6(e._.h*1e3))}),l8=c8,u8=P(2,0,e=>V(e.a,e._.j.replace(/^default_/,``).replaceAll(`_`,` `))),d8=u8,f8=O(3,`<span class=usage-stale>⚠ <!> old</span>`,` Db%`,l8),p8=M(7,e=>{B(e.a,`stale`,e.h!=null),f8(e,+(e.h==null)),c8(e),e8(e)}),m8=(e,t)=>V(e.b,t),h8=O(2,`<span class=dim> </span>`,`D `,d8),g8=M(9,e=>{h8(e,+!e.j),u8(e)}),_8=k(4,`<div class=meter><span class="meter-label dim"> </span><span class=meter-track><span class=meter-fill></span></span><span class=meter-pct><!>%</span><span class="meter-reset dim"> </span></div>`,` E lD lD%lD `,t8,s8),v8=(e,t)=>_8(e,[t||[],`window`]),y8=k(0,`<div class=usage-row><div class=usage-name><strong> </strong><!><!></div><div class=usage-meters></div></div>`,` F l%b%l `,0,(e,t)=>{p8(e,t[0]?.stale_seconds),m8(e,t[0]?.agent),g8(e,t[0]?.plan),v8(e,t[0]?.windows)}),b8=I(12,e=>y8(e,[e._._.g||[],e=>`${e.agent}-${e.account||``}`]),e=>e._._),x8=b8,S8=I(11,e=>V(e.a,e._._.f),e=>e._._),C8=O(2,`<p class=dim><span class=spin></span> Loading usage…</p>`,0,0,`<p class=dim> </p>`,`D `,S8,`<div class=usage-list></div>`,` `,x8),w8=I(10,e=>C8(e,e._.e?e._.e?.error?1:2:0)),T8=L(`q3`,e=>A(e.a,`click`,function(){e._.j()})),E8=e=>{w8(e),D8(e),Co(e.b),wo(e.b,13),To(e.b),T8(e)},D8=I(13,e=>{B(e.a,`spinning`,e._.h),z(e.a,`disabled`,e._.h)}),O8=ut(`q4`,(e=>`<header class=manage-head><div><h2>Usage</h2></div><button class=icon-btn title="Refresh usage">${e}</button></header><!><!>`)(xo),(e=>`Db D/${e}&m%c`)(So),E8),k8=F(w8),A8=j(4,e=>{j8(e,e.e?.error),M8(e,e.e?.agents),k8(e)}),j8=M(5,F(S8)),M8=M(6,F(b8)),N8=j(7,F(D8)),P8=M(9),F8=L(`q5`,e=>Et(e,{onMount:function(){e.i(!1)}})),I8=M(8,e=>{P8(e,z8(e)),F8(e)});function L8(e){$s(e.a),Gs(e.a,O8(e)),tc(e.a,`Usage`),ec(e.a,`usage-modal`),Qs(e.a),ac(e.a),A8(e,null),N8(e,!1),I8(e,B8(e))}var R8=M(3,e=>ic(e.a,V8(e)));function z8(e){return async()=>{N8(e,!0),await e.i(!0),N8(e,!1)}}function B8(e){return async t=>{try{A8(e,await H(`/api/usage${t?`?refresh`:``}`))}catch(t){A8(e,{error:String(t.message||t)})}}}function V8(e){return function(){e.d()}}R(`q1`,z8),R(`q0`,B8),R(`q2`,V8);var H8=Us,U8=(e=>`/${e}&`)(Ws),W8=et(1,`B2`),G8=I(12,e=>V(e.a,e._.f)),K8=L(`k4`,e=>{Mt(e,`b`),A(e.b,`keydown`,function(t){t.key===`Enter`?(t.preventDefault(),e._.l()):t.key===`Escape`&&e._.j&&e._.g()})}),q8=e=>{G8(e),J8(e),Y8(e),K8(e)},J8=I(14,e=>z(e.b,`placeholder`,e._.i)),Y8=I(15,e=>jt(e,`b`,e._.j,h5(e))),X8=ut(`k6`,`<h2 class=prompt-title> </h2><input>`,`D l `,q8,0,`B2`),Z8=I(13,e=>V(e.b,e._.h||`OK`)),Q8=L(`k3`,e=>{A(e.a,`click`,function(){e._.l()}),A(e.c,`click`,function(){e._.g()})}),$8=e=>{Z8(e),e5(e),Q8(e)},e5=I(15,e=>z(e.a,`disabled`,!e._.j.trim())),t5=dt(`k5`,`<button class="btn primary"> </button><div class=spacer></div><button class=btn>Cancel</button>`,` D lb `,$8),n5=M(11),r5=N(10,e=>n5(e,g5(e))),i5=F(e5,Y8),a5=j(9,e=>{r5(e),i5(e)}),o5=(e,t)=>a5(e,t||``),s5=M(4,r5),c5=L(`k7`,e=>Et(e,{onMount:function(){setTimeout(()=>{let t=W8(e)();t?.focus(),t?.select()},0)}}));function l5(e){$s(e.a),ac(e.a,tn({content:t5(e)})),Gs(e.a,X8(e)),ec(e.a,`prompt-dlg`),Qs(e.a),c5(e)}var u5=F(G8),d5=M(5,e=>{tc(e.a,e.f),u5(e)}),f5=M(6,e=>ic(e.a,_5(e))),p5=M(7,F(Z8)),m5=M(8,F(J8));function h5(e){return t=>{a5(e._,t)}}function g5(e){return()=>{let t=e.j.trim();t&&e.e(t)}}function _5(e){return function(){e.g()}}R(`k0`,h5),R(`k1`,g5),R(`k2`,_5);var v5=((e,t)=>`<div class=work-view>${e}<div class=main-col><!><!>${t}<!><!><div class=term-area></div></div><!><!></div>`)(_h,xF),y5=((e,t)=>`D/${e}&D%b%b/${t}&%b%b l%b%l`)(vh,SF),b5=N(1,e=>o5(e.a,e._.a7||e._.a8)),x5=P(8,0,b5),S5=e=>{x5._(e),C5._(e),T5._(e),E5._(e),l5(e.a),d5(e.a,`Rename session`),p5(e.a,`Rename`),f5(e.a,p7(e)),m5(e.a)},C5=P(8,0,b5),w5=N(2,e=>s5(e.a,m7(e))),T5=P(8,0,w5),E5=P(8,0,w5),D5=I(68,e=>V(e.a,e._._.a4),e=>e._._),Qne=dt(`r31`,` `,` `,D5),$ne=e=>{Ar(e.a,Qne(e)),Pr(e.a,h7(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},ere=e=>{L8(e.a),R8(e.a,g7(e))},O5=N(2,e=>V(e.b,e._._.a5?`Starting…`:`Start ${e._._.o||`claude`}`)),k5=I(65,O5,e=>e._._),tre=L(`r32`,e=>A(e.a,`click`,function(){e._._.ao(e._._.o||`claude`,!0)})),nre=e=>{k5(e),A5(e),tre(e)},A5=I(69,e=>{z(e.a,`disabled`,e._._.a5),O5(e)},e=>e._._),j5=N(8,e=>D6(e.b,e._._.n&&e._._.y===`term`&&e.g===e._._.am),3),M5=I(64,j5,e=>e._._),rre=e=>{M5(e),N5(e),P5(e),I5(e),L5(e),R5(e),B5(e),V5(e),H5(e),u6(e.b),I6(e.b,b7(e)),j6(e.b,y7(e)),O6(e.b,v7(e)),k6(e.b,_7(e))},N5=I(66,e=>z6(e.b,e._._.r),e=>e._._),P5=I(67,e=>{w6(e.b,e._._.y),j5(e)},e=>e._._),F5=N(11,e=>M6(e.b,x7(e))),I5=I(73,e=>{C6(e.b,e._._.ab),A6(e.b,S7(e)),F5(e)},e=>e._._),L5=I(74,e=>V6(e.b,e._._.ag),e=>e._._),R5=I(75,e=>{F6(e.b,e._._.aj),L6(e.b,C7(e))},e=>e._._),ire=le(3,0,2),z5=N(7,e=>ire(e,e.g===e._._.am)),B5=I(77,e=>{j5(e),z5(e)},e=>e._._),V5=I(78,e=>R6(e.b,w7(e)),e=>e._._),H5=I(80,F5,e=>e._._),are=M(6,e=>{E6(e.b,e.g),j5(e),z5(e)}),ore=(e,t)=>P6(e.b,t),sre=(e,t)=>N6(e.b,t),cre=k(0,(e=>`<!><!>${e}<!><!><!>`)(h4),(e=>`b%b/${e}&%b%c`)(g4),rre,(e,t)=>{are(e,t[0]?.id),ore(e,t[0]?.state),sre(e,t[0]?.agent)}),U5=P(6,0,e=>cre(e,[e._.aj,`id`])),lre=e=>{U5._(e),W5._(e)},ure=O(1,`<div class=empty-sess><p class=dim>No sessions in this workspace.</p><button class="btn primary"> </button></div>`,`Db D `,nre),W5=P(6,0,e=>ure(e,+!!e._.al)),dre=M(61,E5),fre=O(6,`<!><!><!><!>`,`b%b%`,lre,`<p class="dim pad-inline">Loading sessions…</p>`),pre=L(`r35`,e=>{e.n&&window.addEventListener(`keydown`,t=>{if(t.key===`Escape`&&e.a2&&c7(e,!1),(t.metaKey||t.ctrlKey)&&t.shiftKey&&t.key.toLowerCase()===`d`&&(t.preventDefault(),i7(e,e.y===`diff`?`term`:`diff`)),t.altKey&&(t.key===`[`||t.key===`]`)&&(e.aj?.length??0)>1){t.preventDefault();let n=e.aj.map(e=>e.id);n7(e,n[(Math.max(0,n.indexOf(e.am))+(t.key===`]`?1:n.length-1))%n.length]),i7(e,`term`)}},{capture:!0,signal:Ee(e,0)})}),G5=N(49,e=>{Te(e,0),pre(e)},4),mre=F(B5),hre=M(48,e=>{Hg(e.a,e.am),G5(e),mre(e)}),K5=N(46,e=>hre(e,(()=>{if(e.w&&e.aj?.some(t=>t.id===e.w))return e.w;let t=Wn(e.ab);return t&&e.aj?.some(e=>e.id===t)?t:e.aj?.[0]?.id??null})()),2),gre=F(R5),_re=M(45,e=>{E_(e.a,e.aj),uU(e.d,e.aj||[]),Ure(e,e.aj?.length),fre(e,+!e.aj),K5(e),G5(e),U5(e),gre(e)}),q5=N(40,e=>_re(e,e.v??e.m?.[e.ab]?.sessions??null),2),J5=N(59,L(`r33`,e=>Et(e,{active:e.n,load:e.aw,onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,started:!1,stale:!1,timer:void 0,refresh:()=>{if(document.hidden){r.stale=!0;return}r.stale=!1,this.load(!1)},sync:()=>{this.active?(r.started||(r.started=!0,this.load(!0)),r.timer??=setInterval(r.refresh,1e4)):r.stop()},stop:()=>{clearInterval(r.timer),r.timer=void 0}};return Cn().addEventListener(`sessions.changed`,t=>{let n=t.data?.workspaceId;r.started&&(!n||n===e.ab)&&r.refresh()},{signal:n}),document.addEventListener(`visibilitychange`,()=>{!document.hidden&&r.stale&&r.refresh()},{signal:n}),Dn(()=>{if(!this.active)return;let t=kn(e.ab);t&&e.ah(t.pr);let n=jn(e.ab);n&&(n7(e,n),i7(e,`term`))},n),r.sync(),r},onUpdate:function(){this.sync()},onDestroy:function(){this.abort.abort(),this.stop()}})),3),vre=M(58,J5),Y5=N(57,e=>vre(e,E7(e)),2),yre=M(56,Y5),X5=N(54,e=>yre(e,D7(e)),6),bre=F(H5),xre=M(62,e=>{S_(e.a,O7(e)),bre(e)}),Z5=N(51,e=>xre(e,k7(e)),2),Sre=M(50,e=>{X5(e),Z5(e)}),Q5=N(38,e=>Sre(e,A7(e))),Cre=M(60,F(V5)),$5=N(23,e=>Cre(e,j7(e))),e7=j(21,e=>{dre(e,T7(e)),q5(e),Q5(e),X5(e),$5(e)}),t7=N(39,L(`r34`,e=>{e.w&&Gn(e.ab,e.w)})),n7=j(22,e=>{K5(e),X5(e),$5(e),t7(e)}),wre=le(5,2,4),r7=N(25,e=>iU(e.d,e.n&&e.y===`diff`)),Tre=F(P5),i7=j(24,e=>{qg(e.a,e.y),B(e.g,`as-bar`,e.y===`diff`),wre(e,e.y===`diff`),G5(e),r7(e),Tre(e)}),a7=j(26,e=>rU(e.d,e.a0)),o7=N(44,L(`r36`,e=>{if(e.n){let t=kn(e.ab);t&&e.ah(t.pr);let n=jn(e.ab);n&&(n7(e,n),i7(e,`term`))}}),2),Ere=M(43,e=>{w_(e.a,M7(e)),o7(e),J5(e)}),s7=j(27,e=>{aU(e.d,e.a1),Ere(e,N7(e))}),c7=j(28,e=>{$g(e.a,e.a2),G5(e)}),Dre=O(7,J6,(e=>`/${e}&`)(Y6),ere),l7=j(29,e=>Dre(e,+!e.a3)),Ore=O(1,sr,(e=>`/${e}&`)(cr),$ne),kre=F(D5),u7=j(30,e=>{Ore(e,+!e.a4),kre(e)}),d7=j(31,F(A5)),Are=O(8,H8,(e=>`/${e}&`)(U8),S5),f7=j(32,e=>{Pre(e,e.a6?.title),Fre(e,e.a6?.agent),Ire(e,e.a6?.id),Are(e,+!e.a6)}),jre=(e,t)=>{Jre(e,t.wanted),Yre(e,t.run)},Mre=M(63);function Nre(e){l_(e.a),Ug(e.a,U7(e)),Jg(e.a,H7(e)),e_(e.a,V7(e)),u_(e.a,B7(e)),M_(e.a,z7(e)),j_(e.a,R7(e)),k_(e.a,L7(e)),VH(e.d),pU(e.d,I7(e)),hU(e.d,F7(e)),e7(e,null),n7(e,null),i7(e,`term`),a7(e,``),s7(e,0),c7(e,!1),l7(e,!1),u7(e,null),d7(e,!1),f7(e,null),jre(e,{wanted:!1,run:void 0}),Mre(e,P7(e))}var Pre=M(33,x5),Fre=M(34,C5),Ire=M(35,T5),Lre=(e,t)=>{Rg(e.a,t),zre(e,t?.id),Bre(e,t?.status),Vre(e,t?.name)},Rre=F(I5),zre=M(37,e=>{nU(e.d,e.ab),q5(e),K5(e),o7(e),Q5(e),X5(e),t7(e),Z5(e),J5(e),Rre(e)}),Bre=M(41,X5),Vre=M(42,F(L5)),Hre=Lre,Ure=M(47,W5),Wre=M(12,e=>{h_(e.a,e.m),q5(e)}),Gre=F(M5),Kre=L(`r37`,e=>{e.n||c7(e,!1)}),qre=M(13,e=>{d_(e.a,e.n),o7(e),G5(e),J5(e),r7(e),Gre(e),Kre(e)}),Jre=M(53,e=>{X5(e),Y5(e)}),Yre=M(55,Y5),Xre=F(k5),Zre=M(14,e=>{X5(e),Xre(e)}),Qre=M(15,e=>{__(e.a,e.p),Z5(e)}),$re=(e,t)=>f_(e.a,t),eie=F(N5),tie=M(17,e=>{b_(e.a,e.r),eie(e)}),nie=(e,t)=>D_(e.a,t),rie=M(19,e=>v_(e.a,e.t)),iie=(e,t)=>N_(e.a,t);function p7(e){return function(){f7(e._,null)}}function m7(e){return function(t){e._.az(e._.a9,t),f7(e._,null)}}function h7(e){return function(){u7(e._,null)}}function g7(e){return function(){l7(e._,!1)}}function _7(e){return function(){c7(e._._,!0)}}function v7(e){return function(){i7(e._._,`term`)}}function y7(e){return function(){e._._.ah()}}function b7(e){return function(t){n7(e._._,t)}}function x7(e){return function(t){e._._.b0(e._._.ab,t)}}function S7(e){return function(){e._._.t?.(e._._.ab)}}function C7(e){return function(t){let n=(e._._.aj||[]).find(e=>e.id===t);n&&f7(e._._,n)}}function w7(e){return function(t){e._._.ay(t)}}function T7(e){return async(t,n)=>{n=n.trim(),n&&(e7(e,(e.v||[]).map(e=>e.id===t?{...e,title:n}:e)),await fetch(`/api/sessions/${t}`,{method:`PATCH`,headers:{"content-type":`application/json`},body:JSON.stringify({title:n})}))}}function E7(e){return t=>(t&&(e.ar=!0),(e.at??=Mn(e.au))())}function D7(e){return async()=>{let t=e.ar;e.ar=!1;try{let n=await H(`/api/workspaces/${e.ab}/sessions`);if(!n.length&&t&&e.af===`active`){let t=await e.ao(e.o||`claude`,!1);n=t?[t]:[]}e7(e,n);let r=Wn(e.ab);r&&n.some(e=>e.id===r)&&n7(e,r),e.v.some(t=>t.id===e.w)||n7(e,e.v?.[0]?.id||null)}catch(t){e7(e,e.v||[]),u7(e,String(t))}}}function O7(e){return function(t,n){e.b0(t,n)}}function k7(e){return async(t,n)=>{if(t===e.ab){let r=await e.ao(n,!0);r&&Gn(t,r.id);return}try{Gn(t,(await H(`/api/workspaces/${t}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})})).id),e.p?.(t)}catch(t){u7(e,String(t.message||t))}}}function A7(e){return async(t,n)=>{d7(e,!0);try{let r=await H(`/api/workspaces/${e.ab}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:t})});return n&&(e7(e,(e.v||[]).concat(r)),n7(e,r.id)),r}catch(t){return u7(e,String(t.message||t)),null}finally{d7(e,!1)}}}function j7(e){return async t=>{try{await H(`/api/sessions/${t}`,{method:`DELETE`}),e7(e,(e.v||[]).filter(e=>e.id!==t)),e.w===t&&n7(e,e.v?.[0]?.id||null)}catch(t){u7(e,`Kill session failed: ${String(t.message||t)}`)}}}function M7(e){return function(t){e.ah(t)}}function N7(e){return t=>{a7(e,t||``),t&&s7(e,e.a1+1),i7(e,`diff`)}}function P7(e){return t=>{f7(e,t)}}function F7(e){return function(){i7(e,`term`)}}function I7(e){return function(t){n7(e,t),i7(e,`term`)}}function L7(e){return function(t){e.b1(t)}}function R7(e){return function(t){e.ay(t)}}function z7(e){return function(){l7(e,!0)}}function B7(e){return function(t){u7(e,t)}}function V7(e){return t=>{c7(e,t)}}function H7(e){return t=>{i7(e,t)}}function U7(e){return function(t){n7(e,t)}}R(`r30`,p7),R(`r29`,m7),R(`r17`,h7),R(`r28`,g7),R(`r26`,_7),R(`r25`,v7),R(`r24`,y7),R(`r21`,b7),R(`r20`,x7),R(`r27`,S7),R(`r23`,C7),R(`r22`,w7),R(`r5`,T7),R(`r3`,E7),R(`r2`,D7),R(`r13`,O7),R(`r6`,k7),R(`r1`,A7),R(`r4`,j7),R(`r16`,M7),R(`r0`,N7),R(`r7`,P7),R(`r19`,F7),R(`r18`,I7),R(`r15`,L7),R(`r14`,R7),R(`r12`,z7),R(`r11`,B7),R(`r10`,V7),R(`r9`,H7),R(`r8`,U7);var W7=I(40,e=>V(e.a,e._._.t),e=>e._._),aie=L(`b20`,e=>A(e.b,`click`,function(){F9(e._._,null),e._._.v()})),oie=O(0,`<p> </p><button class=btn>Retry</button>`,`D l `,e=>{W7(e),aie(e)},`<span class=spin></span>Loading workspaces…`),G7=P(1,0,e=>oie(e,+!e._.t)),sie=G7,K7=I(40,e=>V(e.a,e._._.t),e=>e._._),cie=dt(`b19`,` `,` `,K7),lie=e=>{Ar(e.a,cie(e)),Pr(e.a,I9(e)),Cr(e.a),Er(e.a),Or(e.a),Nr(e.a)},q7=I(34,e=>$re(e.b,e._._.g),e=>e._._),uie=e=>{q7(e),J7(e),Y7(e),Q7(e),$7(e),e9(e),t9(e),n9._(e),r9._(e),Nre(e.b),nie(e.b,R9(e)),iie(e.b,L9(e))},J7=I(35,e=>Wre(e.b,e._._.h),e=>e._._),Y7=I(36,e=>{Zre(e.b,e._._.i?e._._.i?.preferredAgent:`claude`),tie(e.b,e._._.i?e._._.i?.agents:[`claude`])},e=>e._._),X7=N(5,e=>qre(e.b,!e._._.p&&!e._._.a5&&e._.f===e._._.k),3),die=le(3,0,2),Z7=N(4,e=>die(e,e._.f===e._._.k)),Q7=I(37,e=>{X7(e),Z7(e)},e=>e._._),$7=I(38,X7,e=>e._._),e9=I(41,e=>Qre(e.b,z9(e)),e=>e._._),t9=I(42,X7,e=>e._._),n9=P(0,0,e=>Hre(e.b,e._.e)),r9=P(0,0,e=>{rie(e.b,B9(e)),X7(e),Z7(e)}),fie=O(0,(e=>`<!><!>${e}<!><!><!>`)(v5),(e=>`b%b/${e}&%b%c`)(y5),uie),pie=M(4,e=>{hie(e,e.e?.id),fie(e,+!e.e),n9(e)}),i9=N(3,e=>pie(e,e._.g.find(t=>t.id===e.c))),a9=Ke(5,i9),mie=a9,hie=M(5,r9),gie=M(2,i9),_ie=(e,t)=>gie(e,t[0]),o9=N(1,e=>Hf(e.a,V9(e))),s9=P(4,0,o9),vie=e=>{s9._(e),c9._(e),Lf(e.a),Uf(e.a,H9(e))},c9=P(4,0,o9),l9=P(3,0,e=>ud(e.a,U9(e))),yie=e=>{l9._(e),u9._(e),Iu(e.a),dd(e.a,W9(e))},u9=P(3,0,e=>ld(e.a,e._.a5)),d9=P(2,0,e=>mo(e.a,e._.g)),bie=e=>{d9._(e),f9._(e),p9._(e),m9._(e),g9._(e),_9._(e),v9._(e),co(e.a),Nee(e.a,J9(e)),gee(e.a,q9(e)),xee(e.a,K9(e)),Eee(e.a,G9(e))},f9=P(2,0,e=>Mee(e.a,e._.h)),p9=P(2,0,e=>kee(e.a,e._.i)),m9=P(2,0,e=>mee(e.a,e._.k)),h9=N(1,e=>Tee(e.a,!e._.s&&e._.a6)),g9=P(2,0,h9),_9=P(2,0,e=>{See(e.a,Z9(e)),hee(e.a,X9(e)),vee(e.a,Y9(e))}),v9=P(2,0,h9),y9=N(28,L(`b21`,e=>Et(e,{paletteOpen:e.s,load:e.v,activeList:e.g.filter(e=>e.status===`active`).map(e=>e.id),onMount:function(){let t=new AbortController,n=t.signal,r={abort:t,statusStale:!1,statusDebounce:void 0,timer:void 0};er(n);let i=(t,n)=>{n&&(An(t,n),Gn(t,n)),e.a1(t)},a=new URLSearchParams(location.search);a.get(`ws`)&&(i(a.get(`ws`),a.get(`session`)),history.replaceState(null,``,`/`)),ar()&&document.addEventListener(`click`,e=>{let t=e.target?.closest?.(`a[target="_blank"][href^="http"]`);t&&(e.preventDefault(),or(t.href))},{capture:!0,signal:n}),navigator.serviceWorker?.addEventListener(`message`,e=>{e.data?.type===`open-session`&&i(e.data.workspaceId,e.data.sessionId)},{signal:n}),H(`/api/settings`).then(t=>{D9(e,t)}).catch(()=>{});let o=()=>{if(document.hidden){r.statusStale=!0;return}r.statusStale=!1,e.a0()};document.addEventListener(`visibilitychange`,()=>{document.hidden||(r.statusStale=!1,e.a0(!0))},{signal:n}),this.load(),o(),Cn().addEventListener(`workspaces.changed`,()=>{this.load(),o()},{signal:n}),Cn().addEventListener(`sessions.changed`,()=>{clearTimeout(r.statusDebounce),r.statusDebounce=setTimeout(o,300)},{signal:n}),Cn().addEventListener(`status.changed`,t=>{t.data&&(E9(e,t.data),r.statusStale=!1)},{signal:n}),r.timer=setInterval(o,6e4),window.addEventListener(`keydown`,t=>{if((t.metaKey||t.ctrlKey)&&t.key===`k`&&(t.preventDefault(),P9(e,!this.paletteOpen)),(t.metaKey||t.ctrlKey)&&!t.shiftKey&&!t.altKey&&t.key>=`1`&&t.key<=`9`){let n=this.activeList?.[Number(t.key)-1];n&&(t.preventDefault(),e.a1(n))}},{capture:!0,signal:n});let s=window.visualViewport;if(s){let e=()=>{let e=Math.abs(s.height-window.innerHeight)<1;document.documentElement.style.setProperty(`--app-height`,e?``:`${Math.round(s.height)}px`),e||window.scrollTo(0,0)};s.addEventListener(`resize`,e,{signal:n}),s.addEventListener(`scroll`,e,{signal:n}),document.addEventListener(`visibilitychange`,()=>{document.hidden||e()},{signal:n}),window.addEventListener(`pageshow`,e,{signal:n}),window.addEventListener(`focus`,e,{signal:n})}return r},onDestroy:function(){this.abort.abort(),clearTimeout(this.statusDebounce),clearInterval(this.timer)}})),4),xie=F(e9),Sie=M(27,e=>{y9(e),_9(e),c9(e),xie(e)}),b9=N(13,e=>Sie(e,Q9(e))),Cie=O(2,(e=>`<!>${e}`)(bi),(e=>`b/${e}&`)(xi),bie),x9=N(33,e=>Cie(e,e.s||e.a6?0:1)),wie=M(32,e=>{x9(e),v9(e)}),S9=N(30,e=>wie(e,!e.p&&!e.a3&&e.j),2),Tie=M(29,S9),C9=N(11,e=>Tie(e,e.g.find(t=>t.id===e.k))),Eie=O(3,sc,(e=>`/${e}&`)(cc),yie),Die=F(t9),Oie=M(31,e=>{Eie(e,+!e.a5),u9(e),Die(e)}),w9=N(17,e=>Oie(e,e.g.find(t=>t.id===e.q))),kie=F(q7),T9=j(6,e=>{b9(e),y9(e),C9(e),w9(e),d9(e),l9(e),s9(e),a9(e),kie(e)}),Aie=F(J7),E9=j(7,e=>{f9(e),Aie(e)}),jie=F(Y7),D9=j(8,e=>{p9(e),jie(e)}),Mie=O(1,`<div class="boot dim"></div>`,` `,sie),Nie=M(21,y9),O9=N(14,e=>Nie(e,$9(e)),2),Pie=O(0,sr,(e=>`/${e}&`)(cr),lie),k9=N(20,e=>Pie(e,e.t&&e.j?0:1)),Fie=j(9,e=>{Mie(e,+!!e.j),O9(e),S9(e),k9(e)}),Iie=F(Q7),A9=j(10,e=>{O9(e),C9(e),m9(e),Iie(e)}),Lie=k(5,`<!><!><!>`,`b%`,mie,_ie),j9=j(12,e=>{Lie(e,[e.m,e=>e]),O9(e),b9(e)}),Rie=O(4,Dd,(e=>`/${e}&`)(Od),vie),zie=F($7),M9=j(15,e=>{Rie(e,+!e.p),S9(e),zie(e)}),N9=j(16,w9),P9=j(18,e=>{y9(e),x9(e),g9(e)}),Bie=F(K7,W7),F9=j(19,e=>{k9(e),Bie(e),G7(e)});function I9(e){return function(){F9(e._,null)}}function L9(e){return function(){M9(e._._,!0)}}function R9(e){return function(t,n){An(t,n),Gn(t,n),e._._.a1(t)}}function z9(e){return function(t){e._._.a1(t)}}function B9(e){return function(t){N9(e._._,t||e._.f)}}function V9(e){return function(t){e._.g.some(e=>e.id===t.id)||T9(e._,[t,...e._.g]),M9(e._,!1),e._.a1(t.id)}}function H9(e){return function(){M9(e._,!1)}}function U9(e){return function(t){T9(e._,e._.g.map(e=>e.id===t.id?t:e))}}function W9(e){return function(){N9(e._,null)}}function G9(e){return function(){P9(e._,!1)}}function K9(e){return function(){M9(e._,!0),P9(e._,!1)}}function q9(e){return function(t){N9(e._,t.id),M9(e._,!1),P9(e._,!1)}}function J9(e){return function(t){D9(e._,t)}}function Y9(e){return function(t,n){P9(e._,!1),H(`/api/workspaces/${t.id}/sessions`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({agent:n})}).then(n=>{An(t.id,n.id),e._.a1(t.id)}).catch(t=>{F9(e._,`New session failed: ${String(t.message||t)}`)})}}function X9(e){return function(t){On(t.id),e._.a1(t.id)}}function Z9(e){return function(t){e._.a1(t.id)}}function Q9(e){return async t=>{e.g.find(e=>e.id===t)?.status===`archived`&&(await H(`/api/workspaces/${t}`,{method:`POST`,headers:{"content-type":`application/json`},body:JSON.stringify({action:`restore`})}).catch(()=>{}),T9(e,e.g.map(e=>e.id===t?{...e,status:`active`}:e))),A9(e,t),M9(e,!1),N9(e,null),P9(e,!1),e.m.includes(t)||j9(e,e.m.concat(t)),Vn(t)}}function $9(e){return async()=>{try{let[t]=await Promise.all([H(`/api/workspaces`),In()]);if(T9(e,t),e.j){let n=new Set(t.filter(e=>e.status===`active`).map(e=>e.id));j9(e,e.m.filter(e=>n.has(e))),e.k&&!n.has(e.k)&&(A9(e,e.m[e.m?.length-1]||null),Vn(e.k))}else{let n=Bn();n&&t.some(e=>e.id===n)&&(A9(e,n),j9(e,[n]))}Fie(e,!0)}catch(t){F9(e,`Loading workspaces failed: ${t.message||String(t)}`)}}}function Vie(e){return(t=!1)=>(e.x||=t,(e.y??=Mn(async()=>{let t=e.x;e.x=!1,E9(e,await H(`/api/status${t?`?fresh`:``}`))}))())}R(`b3`,I9),R(`b18`,L9),R(`b16`,R9),R(`b15`,z9),R(`b17`,B9),R(`b14`,V9),R(`b13`,H9),R(`b12`,U9),R(`b11`,W9),R(`b10`,G9),R(`b9`,K9),R(`b8`,q9),R(`b4`,J9),R(`b7`,Y9),R(`b6`,X9),R(`b5`,Z9),R(`b2`,Q9),R(`b0`,$9),R(`b1`,Vie),tee();export{t};
|
|
1615
|
+
//# sourceMappingURL=index-DJu3fA99.js.map
|