zl-code 0.0.33 → 0.0.34

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.
Files changed (83) hide show
  1. package/dist/bin.mjs +1 -1
  2. package/dist/client/assets/{DiffPanel-Dew6UYPZ.js → DiffPanel-BglICQ3G.js} +1 -1
  3. package/dist/client/assets/{FilePreviewPanel-CCTd783X.js → FilePreviewPanel-DVCMU_hl.js} +1 -1
  4. package/dist/client/assets/{PreviewPanel-CEuFEIg2.js → PreviewPanel-ybwMlROU.js} +1 -1
  5. package/dist/client/assets/{angular-html-DpYlOsdu.js → angular-html-BikjrdTp.js} +1 -1
  6. package/dist/client/assets/{angular-ts-k9gceU0J.js → angular-ts-BsZGvWl3.js} +1 -1
  7. package/dist/client/assets/{apl-BHsOIlx0.js → apl-Dt3DiZVC.js} +1 -1
  8. package/dist/client/assets/{astro-BRP9d5kv.js → astro-BqHRosRq.js} +1 -1
  9. package/dist/client/assets/{blade-Ci5kBEbc.js → blade-B_UcQBg1.js} +1 -1
  10. package/dist/client/assets/{c-CDTnUyWb.js → c-B_0Yh5Iz.js} +1 -1
  11. package/dist/client/assets/{cobol-CQooN41g.js → cobol-sZWIDik2.js} +1 -1
  12. package/dist/client/assets/{coffee-C_FR_5__.js → coffee-CEar-izf.js} +1 -1
  13. package/dist/client/assets/{cpp-DfPmXCkV.js → cpp-CzX7KaYg.js} +1 -1
  14. package/dist/client/assets/{crystal-BoHM1ULI.js → crystal-B3sM9TS8.js} +1 -1
  15. package/dist/client/assets/{css-D6Cof-DN.js → css--gmaw_Tx.js} +1 -1
  16. package/dist/client/assets/{edge-rgMa9QWn.js → edge-CPQWOz08.js} +1 -1
  17. package/dist/client/assets/{elixir-BH2v0_d4.js → elixir-CVRGfPiV.js} +1 -1
  18. package/dist/client/assets/{elm-BHWIubxr.js → elm-BzmDaW3g.js} +1 -1
  19. package/dist/client/assets/{erb-Pz-D6yRY.js → erb-D8r0etLH.js} +1 -1
  20. package/dist/client/assets/{fileCommentAnnotations-BoN6oS32.js → fileCommentAnnotations-DQRHHOXQ.js} +1 -1
  21. package/dist/client/assets/{git-rebase-Dh_sXPOh.js → git-rebase-BjwhysoH.js} +1 -1
  22. package/dist/client/assets/{glimmer-js-BZ3UURwY.js → glimmer-js-DbbcU-_E.js} +1 -1
  23. package/dist/client/assets/{glimmer-ts-OLPvG1OW.js → glimmer-ts-DE4Pq5is.js} +1 -1
  24. package/dist/client/assets/{glsl-CbntEWBR.js → glsl-HjrMmVT6.js} +1 -1
  25. package/dist/client/assets/{graphql-C8i4DBJv.js → graphql-C8lkr3SM.js} +1 -1
  26. package/dist/client/assets/{hack-B4bUWIa7.js → hack-FcooWMSG.js} +1 -1
  27. package/dist/client/assets/{haml-DjHVfk_B.js → haml-CG0efzVL.js} +1 -1
  28. package/dist/client/assets/{handlebars-DCffb3yQ.js → handlebars-D7F6orfR.js} +1 -1
  29. package/dist/client/assets/{html-D0FUpWbq.js → html-BF4UKLZD.js} +1 -1
  30. package/dist/client/assets/{html-derivative-Cd2WzFWv.js → html-derivative-WfpuZW0e.js} +1 -1
  31. package/dist/client/assets/{http-CzcR829V.js → http-AXgerX1L.js} +1 -1
  32. package/dist/client/assets/{hurl-CioDJ1Jl.js → hurl-DIpBMZDF.js} +1 -1
  33. package/dist/client/assets/index-Bm3UH4fJ.css +1 -0
  34. package/dist/client/assets/{index-BxzkZoll.js → index-C5JWzjIR.js} +164 -164
  35. package/dist/client/assets/{java-iGP3F64X.js → java-D-FjsptT.js} +1 -1
  36. package/dist/client/assets/{javascript-BDqcM1vm.js → javascript-_IdqS95t.js} +1 -1
  37. package/dist/client/assets/{jinja-BS38AvDV.js → jinja-BZp91059.js} +1 -1
  38. package/dist/client/assets/{jison-jOGuUzCy.js → jison-CDeIgoVo.js} +1 -1
  39. package/dist/client/assets/{json-4S0V7xkn.js → json-DIHOBkHr.js} +1 -1
  40. package/dist/client/assets/{jsx-CxIGxG9g.js → jsx-B1hpKt3h.js} +1 -1
  41. package/dist/client/assets/{julia-CIDANico.js → julia-DW_9Rc7N.js} +1 -1
  42. package/dist/client/assets/{just-CgekMvlg.js → just-Cg9PcJ7G.js} +1 -1
  43. package/dist/client/assets/{latex-cPwccfjn.js → latex-D410shYf.js} +1 -1
  44. package/dist/client/assets/{liquid-DYhmIWKq.js → liquid-rGafJIYO.js} +1 -1
  45. package/dist/client/assets/{lua-C96yvbLm.js → lua-C7b8bZ40.js} +1 -1
  46. package/dist/client/assets/{marko-DDZmb7_E.js → marko-CWIoLIAb.js} +1 -1
  47. package/dist/client/assets/{mdc-LvXYez6-.js → mdc-B-7b3Jul.js} +1 -1
  48. package/dist/client/assets/{nginx-BiGjwB-g.js → nginx-8bVyIP6Q.js} +1 -1
  49. package/dist/client/assets/{nim-Cai0iInM.js → nim-1SF1AnhS.js} +1 -1
  50. package/dist/client/assets/{perl-DLTu5ceb.js → perl-DzbgYxpf.js} +1 -1
  51. package/dist/client/assets/{php-D-Bp1G8s.js → php-DoJPCxq2.js} +1 -1
  52. package/dist/client/assets/{pug-Dbk0-PMr.js → pug-Ca43Rfh5.js} +1 -1
  53. package/dist/client/assets/{qml-BIRY1hO0.js → qml-_4FxYKn1.js} +1 -1
  54. package/dist/client/assets/{r-DZaPuMAc.js → r-BRmsy7hf.js} +1 -1
  55. package/dist/client/assets/{razor-Dnh335aq.js → razor-Bhwv6gyA.js} +1 -1
  56. package/dist/client/assets/{regexp-Bqs3CYnj.js → regexp-2wfWv-bg.js} +1 -1
  57. package/dist/client/assets/{rst-us3SNRf9.js → rst-ZB5bq-kF.js} +1 -1
  58. package/dist/client/assets/{ruby-CC6pII1h.js → ruby-Igi4vQSq.js} +1 -1
  59. package/dist/client/assets/{sas-8O6UQnf1.js → sas-DQHMM6uL.js} +1 -1
  60. package/dist/client/assets/{scss-BbDyd-jm.js → scss-Bkc2g7Um.js} +1 -1
  61. package/dist/client/assets/{shellscript-BQ2q-m6q.js → shellscript-CvZRipUZ.js} +1 -1
  62. package/dist/client/assets/{shellsession-D7eJC6Se.js → shellsession-ZRVGxD2-.js} +1 -1
  63. package/dist/client/assets/{soy-JGDFQDKt.js → soy-N-X4C5rK.js} +1 -1
  64. package/dist/client/assets/{sql-DoVTD6SC.js → sql-CFayiAKU.js} +1 -1
  65. package/dist/client/assets/{stata-CHyJPdtP.js → stata-C6PIdbBg.js} +1 -1
  66. package/dist/client/assets/{surrealql-DNhL2Io7.js → surrealql-CQ-sND2G.js} +1 -1
  67. package/dist/client/assets/{svelte-C6R9l2ot.js → svelte-Bl02ltEl.js} +1 -1
  68. package/dist/client/assets/{templ-BKC3wUk5.js → templ-DOhaAB6e.js} +1 -1
  69. package/dist/client/assets/{tex-DXzAqlyk.js → tex-DCA0tWW2.js} +1 -1
  70. package/dist/client/assets/{textarea-BthLp4DC.js → textarea-D9Ba06Vy.js} +22 -22
  71. package/dist/client/assets/{ts-tags-CeH-XJni.js → ts-tags-Bx33v7tt.js} +1 -1
  72. package/dist/client/assets/{tsx-BEoD7AzT.js → tsx-CVtcGRJO.js} +1 -1
  73. package/dist/client/assets/{twig-igVpWEsN.js → twig-B3h2EaQy.js} +1 -1
  74. package/dist/client/assets/{typescript-DOVNGMgh.js → typescript-BQS7ujO0.js} +1 -1
  75. package/dist/client/assets/{vue-DgSziX80.js → vue-BZp0q8do.js} +1 -1
  76. package/dist/client/assets/{vue-html-DJVCIucM.js → vue-html-CP-Lm6PK.js} +1 -1
  77. package/dist/client/assets/{vue-vine-DnjEeCQW.js → vue-vine-BGj_Vokw.js} +1 -1
  78. package/dist/client/assets/{xml-CJpqjW47.js → xml-DEEbId5k.js} +1 -1
  79. package/dist/client/assets/{xsl-BIkRIPIZ.js → xsl-DeXh-Jcm.js} +1 -1
  80. package/dist/client/assets/{yaml-Dlw5OutN.js → yaml-Bi6of0em.js} +1 -1
  81. package/dist/client/index.html +4 -4
  82. package/package.json +1 -1
  83. package/dist/client/assets/index-lDvh6gd9.css +0 -1
package/dist/bin.mjs CHANGED
@@ -246,7 +246,7 @@ const make$81 = () => {
246
246
  const layer$77 = Layer.sync(NetService, make$81);
247
247
  //#endregion
248
248
  //#region package.json
249
- var version = "0.0.33";
249
+ var version = "0.0.34";
250
250
  //#endregion
251
251
  //#region ../../packages/contracts/src/baseSchemas.ts
252
252
  const TrimmedString = Schema$1.String.pipe(Schema$1.decodeTo(Schema$1.String, SchemaTransformation.transformOrFail({
@@ -1,4 +1,4 @@
1
- import{$a as e,Ad as t,Ba as n,C as r,E as i,Ea as a,En as o,Et as s,F as c,Gd as l,Gi as u,Hs as d,Ja as f,Mn as p,Nn as m,Pn as h,Ra as g,Sd as _,Ss as v,St as y,Tn as b,X as x,Xd as S,Yi as C,_r as w,b as T,eo as E,ft as D,gs as O,jl as k,jn as ee,jt as te,ls as A,no as j,qd as ne,rs as re,rt as M,to as N,w as P,xn as ie}from"./textarea-BthLp4DC.js";import{a as ae,c as F,n as oe,o as se}from"./fileCommentAnnotations-BoN6oS32.js";import{A as I,Bt as L,C as ce,Cn as le,Dn as ue,En as de,Ft as R,In as fe,It as pe,Jt as z,Mn as me,Nn as B,On as he,Pt as ge,S as _e,Sn as ve,Tn as ye,Ut as V,Vt as H,Wt as U,_ as W,ar as be,b as xe,bn as Se,cr as Ce,ct as we,dn as Te,dt as G,fn as K,ft as Ee,hr as De,ir as Oe,jr as ke,kn as Ae,kr as je,ln as Me,lt as Ne,mr as Pe,nr as Fe,ot as Ie,pn as Le,pt as Re,qn as ze,qt as Be,rr as Ve,sr as He,st as Ue,un as We,ur as Ge,ut as Ke,v as qe,w as Je,wn as Ye,x as Xe,xn as Ze,y as Qe,yn as q}from"./index-BxzkZoll.js";var $e=j(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),et=j(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),tt=j(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),J=()=>`Automatic`,nt=()=>`Automático`,rt=()=>`Automático`,it=()=>`Automatique`,at=()=>`Automatico`,ot=()=>`自動`,st=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?nt(e):n===`es`?rt(e):n===`fr`?it(e):n===`it`?at(e):n===`ja`?ot(e):J(e)},ct=()=>`Branch changes`,lt=()=>`Alterações da branch`,ut=()=>`Cambios de la rama`,dt=()=>`Modifications de la branche`,ft=()=>`Modifiche branch`,pt=()=>`ブランチの変更`,mt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?lt(e):n===`es`?ut(e):n===`fr`?dt(e):n===`it`?ft(e):n===`ja`?pt(e):ct(e)},ht=e=>`Change comparison target. Currently ${e?.base}`,gt=e=>`Alterar alvo da comparação. Atual: ${e?.base}`,Y=e=>`Cambiar objetivo de comparación. Actual: ${e?.base}`,_t=e=>`Changer la cible de comparaison. Actuelle : ${e?.base}`,vt=e=>`Cambia destinazione confronto. Attuale: ${e?.base}`,yt=e=>`比較対象を変更。現在: ${e?.base}`,bt=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?gt(e):n===`es`?Y(e):n===`fr`?_t(e):n===`it`?vt(e):n===`ja`?yt(e):ht(e)},xt=e=>`Comparing ${e?.head} against ${e?.base}`,St=e=>`Comparando ${e?.head} com ${e?.base}`,Ct=e=>`Comparando ${e?.head} con ${e?.base}`,wt=e=>`Comparaison de ${e?.head} avec ${e?.base}`,Tt=e=>`Confronto di ${e?.head} con ${e?.base}`,Et=e=>`${e?.head} と ${e?.base} を比較中`,Dt=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?St(e):n===`es`?Ct(e):n===`fr`?wt(e):n===`it`?Tt(e):n===`ja`?Et(e):xt(e)},Ot=()=>`Disable diff line wrapping`,kt=()=>`Desativar quebra de linha no diff`,At=()=>`Desactivar ajuste de líneas del diff`,jt=()=>`Désactiver le retour à la ligne du diff`,Mt=()=>`Disattiva ritorno a capo del diff`,Nt=()=>`差分の行折り返しを無効化`,Pt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?kt(e):n===`es`?At(e):n===`fr`?jt(e):n===`it`?Mt(e):n===`ja`?Nt(e):Ot(e)},Ft=()=>`Enable diff line wrapping`,It=()=>`Ativar quebra de linha no diff`,Lt=()=>`Activar ajuste de líneas del diff`,Rt=()=>`Activer le retour à la ligne du diff`,zt=()=>`Attiva ritorno a capo del diff`,Bt=()=>`差分の行折り返しを有効化`,Vt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?It(e):n===`es`?Lt(e):n===`fr`?Rt(e):n===`it`?zt(e):n===`ja`?Bt(e):Ft(e)},Ht=()=>`Latest turn`,Ut=()=>`Último turno`,Wt=()=>`Último turno`,Gt=()=>`Dernier tour`,Kt=()=>`Ultimo turno`,qt=()=>`最新ターン`,Jt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Ut(e):n===`es`?Wt(e):n===`fr`?Gt(e):n===`it`?Kt(e):n===`ja`?qt(e):Ht(e)},Yt=()=>`No completed turns yet.`,Xt=()=>`Nenhum turno concluído ainda.`,Zt=()=>`Aún no hay turnos completados.`,Qt=()=>`Aucun tour terminé pour le moment.`,$t=()=>`Nessun turno completato.`,en=()=>`完了したターンはまだありません。`,tn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Xt(e):n===`es`?Zt(e):n===`fr`?Qt(e):n===`it`?$t(e):n===`ja`?en(e):Yt(e)},nn=()=>`No matching refs.`,rn=()=>`Nenhuma ref correspondente.`,an=()=>`No hay refs coincidentes.`,on=()=>`Aucune ref correspondante.`,sn=()=>`Nessuna ref corrispondente.`,cn=()=>`一致する ref はありません。`,ln=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?rn(e):n===`es`?an(e):n===`fr`?on(e):n===`it`?sn(e):n===`ja`?cn(e):nn(e)},un=()=>`Turn diffs are unavailable because this project is not a Git repository.`,dn=()=>`Os diffs de turno não estão disponíveis porque este projeto não é um repositório Git.`,fn=()=>`Los diffs de turno no están disponibles porque este proyecto no es un repositorio Git.`,pn=()=>`Les diffs de tour sont indisponibles car ce projet n’est pas un dépôt Git.`,mn=()=>`I diff dei turni non sono disponibili perché questo progetto non è un repository Git.`,hn=()=>`このプロジェクトは Git リポジトリではないため、ターンの差分を利用できません。`,gn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?dn(e):n===`es`?fn(e):n===`fr`?pn(e):n===`it`?mn(e):n===`ja`?hn(e):un(e)},_n=()=>`Remote only`,vn=()=>`Somente remoto`,yn=()=>`Solo remoto`,bn=()=>`Distant uniquement`,xn=()=>`Solo remoto`,Sn=()=>`リモートのみ`,Cn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?vn(e):n===`es`?yn(e):n===`fr`?bn(e):n===`it`?xn(e):n===`ja`?Sn(e):_n(e)},wn=e=>`Diff scope: ${e?.scope}`,Tn=e=>`Escopo do diff: ${e?.scope}`,En=e=>`Ámbito del diff: ${e?.scope}`,Dn=e=>`Portée du diff : ${e?.scope}`,On=e=>`Ambito diff: ${e?.scope}`,kn=e=>`差分範囲: ${e?.scope}`,An=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?Tn(e):n===`es`?En(e):n===`fr`?Dn(e):n===`it`?On(e):n===`ja`?kn(e):wn(e)},jn=()=>`Select a thread to inspect turn diffs.`,Mn=()=>`Selecione uma conversa para inspecionar os diffs dos turnos.`,Nn=()=>`Selecciona un hilo para inspeccionar los diffs de los turnos.`,Pn=()=>`Sélectionnez un fil pour examiner les diffs des tours.`,Fn=()=>`Seleziona una conversazione per esaminare i diff dei turni.`,In=()=>`ターンの差分を確認するスレッドを選択してください。`,Ln=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Mn(e):n===`es`?Nn(e):n===`fr`?Pn(e):n===`it`?Fn(e):n===`ja`?In(e):jn(e)},Rn=()=>`Split diff view`,zn=()=>`Visualização dividida do diff`,Bn=()=>`Vista de diff dividida`,Vn=()=>`Vue diff divisée`,Hn=()=>`Vista diff divisa`,Un=()=>`分割 diff 表示`,Wn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?zn(e):n===`es`?Bn(e):n===`fr`?Vn(e):n===`it`?Hn(e):n===`ja`?Un(e):Rn(e)},Gn=()=>`Stacked diff view`,Kn=()=>`Visualização empilhada do diff`,qn=()=>`Vista de diff apilada`,Jn=()=>`Vue diff empilée`,Yn=()=>`Vista diff sovrapposta`,Xn=()=>`積み重ね diff 表示`,Zn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Kn(e):n===`es`?qn(e):n===`fr`?Jn(e):n===`it`?Yn(e):n===`ja`?Xn(e):Gn(e)},Qn=()=>`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`,$n=()=>`Este diff foi truncado por exceder o limite de prévia. As alterações exibidas estão incompletas.`,er=()=>`Este diff se truncó porque superó el límite de vista previa. Los cambios mostrados están incompletos.`,tr=()=>`Ce diff a été tronqué car il dépassait la limite d’aperçu. Les modifications affichées sont incomplètes.`,nr=()=>`Questo diff è stato troncato perché superava il limite di anteprima. Le modifiche mostrate sono incomplete.`,rr=()=>`プレビュー上限を超えたため、この差分は省略されています。表示されている変更は不完全です。`,ir=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?$n(e):n===`es`?er(e):n===`fr`?tr(e):n===`it`?nr(e):n===`ja`?rr(e):Qn(e)},ar=()=>`Turn`,or=()=>`Turno`,sr=()=>`Turno`,cr=()=>`Tour`,lr=()=>`Turno`,ur=()=>`ターン`,dr=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?or(e):n===`es`?sr(e):n===`fr`?cr(e):n===`it`?lr(e):n===`ja`?ur(e):ar(e)},fr=e=>`Turn ${e?.count}`,pr=e=>`Turno ${e?.count}`,mr=e=>`Turno ${e?.count}`,hr=e=>`Tour ${e?.count}`,gr=e=>`Turno ${e?.count}`,_r=e=>`ターン ${e?.count}`,vr=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?pr(e):n===`es`?mr(e):n===`fr`?hr(e):n===`it`?gr(e):n===`ja`?_r(e):fr(e)},yr=e=>`Use remote version of ${e?.name}`,br=e=>`Usar versão remota de ${e?.name}`,xr=e=>`Usar versión remota de ${e?.name}`,Sr=e=>`Utiliser la version distante de ${e?.name}`,Cr=e=>`Usa versione remota di ${e?.name}`,wr=e=>`${e?.name} のリモート版を使用`,Tr=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?br(e):n===`es`?xr(e):n===`fr`?Sr(e):n===`it`?Cr(e):n===`ja`?wr(e):yr(e)},Er=()=>`Working tree`,Dr=()=>`Árvore de trabalho`,Or=()=>`Árbol de trabajo`,kr=()=>`Arbre de travail`,Ar=()=>`Albero di lavoro`,jr=()=>`作業ツリー`,Mr=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Dr(e):n===`es`?Or(e):n===`fr`?kr(e):n===`it`?Ar(e):n===`ja`?jr(e):Er(e)};function Nr(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function X(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Pr=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Fr=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Ir=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Lr=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Rr=Symbol(`CodeView.itemOptionsState`);function zr(e,t){Object.defineProperty(e,Rr,{configurable:!1,enumerable:!1,value:t})}function Br(e){return e[Rr]}function Z(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Vr=120,Hr=`--diffs-overflow-override`,Ur=12e6,Wr=1e6,Gr=2e6,Kr=Ur-Gr,qr=Ur-Wr,Jr=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Yr=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=L;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isContainerManaged;constructor(e={theme:U},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??H}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??L.hunkLineCount,lineHeight:e?.lineHeight??L.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??L.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??L.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??V}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Be&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<1||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Jr&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Hr,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Vr)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Hr,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(z),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))ei(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return Nr()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);return n==null?(console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1):this.idToItem.has(t)?(console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1):(this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0)}addItem(e){this.addItems([e]),this.syncSelection()}addItems(e){this.appendItemsInternal(e),this.syncSelection()}setItems(e){e.length===0?this.reset():this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||this.reconcileItems(e),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Xr(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Zr(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!Ee(r,i),o=!Ee(n,this.getLayout());o&&this.syncLayout();let s=a||Qr(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||$r(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),G(t,e)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(t=!1){e.__STOP||(t?(Ne(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Ke(this.computeRenderRangeAndEmit))}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e===this.slotCoordinator?!1:(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return oi(this.getRenderedItems(),e)}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getLayout().paddingTop}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new I(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new se(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&we(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null;return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n==null||n.type===`position`||n.id!==e||(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Fr)Z(e,t,()=>this.options[t]);Z(e,`stickyHeader`,()=>this.options.stickyHeaders),Z(e,`collapsed`,e=>this.getItemOptions(Br(e),`file`)?.item.collapsed===!0);for(let t of Ir)this.defineItemSharedCallback(e,`file`,t);for(let t of Lr)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Pr)Z(e,t,()=>this.options[t]);Z(e,`stickyHeader`,()=>this.options.stickyHeaders),Z(e,`hunkSeparators`,()=>this.options.hunkSeparators),Z(e,`collapsed`,e=>this.getItemOptions(Br(e),`diff`)?.item.collapsed===!0);for(let t of Ir)this.defineItemSharedCallback(e,`diff`,t);for(let t of Lr)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return zr(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return zr(t,{id:e}),t}updateItemOptionsId(e,t){Br(e).id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(!(n==null||n.type!==t))return n}defineItemSharedCallback(e,t,n){Z(e,n,e=>{if(this.options[n]==null)return;let r=Br(e),i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Z(e,n,e=>{if(this.options.enableLineSelection!==!0)return;let r=Br(e),i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s;for(let c=0;c<e.length;c++){let l=e[c];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,c,0);d.index=c,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(s=Math.min(s??c,c))):s=Math.min(s??c,c),t[c]!==d&&(s=Math.min(s??c,c)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);s=Math.min(s??a,a)}s!=null&&(this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(s),this.scrollDirty=!0,this.render())}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version===t.version?!1:(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+e+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>qr}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Ur):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=X(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=X(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>qr&&t<i,o=n<Wr&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Kr,r):Gr):{pagedScrollTop:X(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=X(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getLayout().paddingTop+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getLayout().paddingTop;let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null)return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=Ue({scrollTop:s,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m,h=new Set,g=this.findFirstVisibleIndex(u),_=this.findLastVisibleIndex(d);for(let e=g;e<=_;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),ii(this.stickyContainer,t.element,m),n.virtualizedSetup(),ri(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element):(ii(this.stickyContainer,t.element,m),ri(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element)}this.renderState.firstIndex=g<=_?g:-1,this.renderState.lastIndex=_,this.flushSlotCoordinator(),this.reconcileRenderedItems(h),this.syncContainerHeight(),this.updateStickyPositioning();let v=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let y=v==null?0:v-i,b=s,x=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,y);e==null?b=i:(b=e,x=!0)}else b=v??s;b!==l&&(this.applyScrollFix(b,l,this.windowSpecs),l=b),x&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=X(l),this.flushManagers(h),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container==null||this.containerHeight===e||(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(!(r==null||i==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);t!=null&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null)return;let{stickyTop:t,stickyBottom:n}=e;n-t===this.renderState.stickyHeight&&t===this.renderState.stickyTop&&n===this.renderState.stickyBottom||this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{for(let t of e)if(t.target===this.stickyContainer){if(t.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){let e=this.getScrollTop(),t=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let n=t==null?void 0:this.resolveAnchoredScrollTop(t);if(n!=null){let t=n-e;this.applyScrollFix(n,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e){if(this.pendingLayoutAnchor!=null)return this.pendingLayoutAnchor;let{firstIndex:t,lastIndex:n,stickyTop:r,stickyBottom:i}=this.renderState;if(t===-1||n===-1)return;let a=this.getHeight();if(!(r===-1||i===-1))for(let r=t;r<=n;r++){let t=this.items[r];if(t==null)continue;let n=this.getLayout().paddingTop+t.top;if(n+t.height<=e)continue;if(n>=e+a)break;if(n>=e)return{type:`item`,id:t.item.id,viewportOffset:n-e};let i=this.getScrollAnchorViewportTop(n,e)-n,o=t.instance.getNumericScrollAnchor(i);if(o!=null){let r=n+o.top;return{type:`line`,id:t.item.id,lineNumber:o.lineNumber,side:o.side,viewportOffset:r-e}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let{paddingTop:n}=this.getLayout();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=X(this.clampScrollTop(e)),i=X(t),{scrollPageOffset:a}=this,o=X(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null?!0:X(this.getScrollTop())===X(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let{onSnapshotChange:e}=this.slotCoordinator,t=oi(this.getRenderedItems(),this.slotCoordinator);si(this.slotSnapshot,t)||(this.slotSnapshot=t,e(t))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.type===`diff`?e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,r,t,e.item.annotations??[]):e.height=e.instance.prepareCodeViewItem(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Xr(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function Zr(e,t){return!ge(e.theme??U,t.theme??U)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Qr(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function $r(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ei(e){return e instanceof SVGElement?!0:Ie(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function ti(e){let t=ni(e.start,e.side),n=ni(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function ni(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function ri(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function ii(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function ai(e){return(e.annotations?.length??0)>0}function oi(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)ai(t.item)&&i.push(t);return i.length>0?i:void 0}function si(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.version!==i.version)return!1}return!0}function ci(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.version!==i.version)return!1}return!0}var Q=S(ne(),1),$=t(),li=S(l(),1),ui=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function di(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function fi(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,initialItems:a,items:o,onScroll:s,onSelectedLinesChange:c,options:l,renderAnnotation:u,renderCustomHeader:d,renderGutterUtility:f,renderHeaderMetadata:p,renderHeaderPrefix:m,selectedLines:h,style:g}=e,_=o!==void 0,v=(0,Q.useContext)(Re),y=(0,Q.useRef)(di(_)),b=d!=null,x=u!=null,S=f!=null,C=b||m!=null||p!=null,w=C||x||S,T=R(e=>{c?.(e)}),E=h!==void 0,D=(0,Q.useMemo)(()=>vi({options:l,hasCustomHeader:b,hasGutterRenderer:S,onSelectedLinesChange:c==null?void 0:T,controlledSelection:E}),[l,b,S,c,T,E]),[O]=(0,Q.useState)(()=>_i()),[,k]=(0,Q.useState)({}),ee=R(e=>{y.current.instance!=null&&(e==null||e!==y.current.instance.getContainerElement())&&(y.current.instance.cleanUp(),O.publish(void 0),y.current=di(_)),e!=null&&e!==y.current.instance?.getContainerElement()&&(y.current.instance=new Yr(D,i?void 0:v,!0),y.current.instance.setup(e)),typeof r==`function`?r(e):r!=null&&(r.current=e)}),te=R(e=>{y.current.disableFlushSync?O.publish(e):(0,li.flushSync)(()=>{O.publish(e)})}),A=(0,Q.useMemo)(()=>{if(!(!C&&!x&&!S))return{hasHeaderRenderers:C,hasAnnotationRenderer:x,hasGutterRenderer:S,onSnapshotChange:te}},[te,x,S,C]);return ui(()=>s==null?void 0:y.current.instance?.subscribeToScroll(s)),ui(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=y.current;if(e!=null)try{y.current.disableFlushSync=!0;let s=!1;if(G(D,r)||(y.current.managedOptions=D,e.setOptions(D),s=!0),t!==_){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(_)o!==n&&(hi(n,o)?y.current.items=o:mi(n,o)?(y.current.items=o,e.addItems(o.slice(n.length))):(y.current.items=o,e.setItems(o),s=!0));else if(n==null){let t=a??[];y.current.items=t,t.length>0&&(e.setItems(t),s=!0)}h!==void 0&&e.setSelectedLines(h,{notify:!1});let c=e.setSlotCoordinator(A),l=!1;A!==i&&((A==null||i==null)&&(l=!0),y.current.slotCoordinator=A),(s||c)&&e.render(!0),c&&A==null&&O.publish(void 0),l&&k({})}finally{y.current.disableFlushSync=!1}}),(0,Q.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=y.current;gi(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=y.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}else return t.getItem(e)},updateItem(e){let{controlled:t,instance:n}=y.current;return gi(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=y.current;return gi(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=y.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=y.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),T(e))},getSelectedLines(){let{instance:e}=y.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=y.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),T(null))},getInstance(){return y.current.instance}}),[T]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:ee,className:n,style:g}),w&&(0,$.jsx)(yi,{managedContentStore:O,renderCustomHeader:d,renderHeaderPrefix:m,renderHeaderMetadata:p,renderAnnotation:u,renderGutterUtility:f})]})}var pi=(0,Q.forwardRef)(fi);function mi(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function hi(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function gi(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function _i(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!ci(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function vi({options:e,hasCustomHeader:t,hasGutterRenderer:n,onSelectedLinesChange:r,controlledSelection:i}){return!t&&!n&&r==null&&!i?e:(e={...e,controlledSelection:i,onSelectedLinesChange:r},t&&(e.renderCustomHeader=xi),n&&(e.renderGutterUtility=xi),e)}var yi=(0,Q.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}){let o=R(t=>e.subscribe(t)),s=R(()=>e.getSnapshot());return(0,Q.useSyncExternalStore)(o,s,s)?.map(e=>(0,li.createPortal)(bi({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}),e.element,e.id))});function bi({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}){if(e.type===`diff`){let{item:o,instance:s}=e;return pe({fileDiff:o.fileDiff,renderCustomHeader:t==null?void 0:()=>t(o),renderHeaderPrefix:n==null?void 0:()=>n(o),renderHeaderMetadata:r==null?void 0:()=>r(o),renderAnnotation:i==null?void 0:e=>i(e,o),lineAnnotations:o.annotations,renderGutterUtility:a==null?void 0:e=>a(e,o),getHoveredLine:s.getHoveredLine})}else{let{item:o,instance:s}=e;return F({file:o.file,renderCustomHeader:t==null?void 0:()=>t(o),renderHeaderPrefix:n==null?void 0:()=>n(o),renderHeaderMetadata:r==null?void 0:()=>r(o),renderAnnotation:i==null?void 0:e=>i(e,o),lineAnnotations:o.annotations,renderGutterUtility:a==null?void 0:e=>a(e,o),getHoveredLine:s.getHoveredLine})}}function xi(){}function Si({threadRef:e,filePath:t,activeCwd:n,openInEditor:r}){if(e){ze.getState().openFile(e,t);return}r(n?W(t,n):t)}var Ci=k();function wi(e,t){let n=(0,Ci.c)(4),r=me(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}function Ti(e){return a(`flex items-center justify-between gap-2 px-4`,ke&&e!==`sheet`&&e!==`embedded`?`drag-region h-[52px] border-b border-border wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]`:`surface-subheader`)}function Ei(e){let t=(0,Ci.c)(10),n=ke&&e.mode!==`sheet`&&e.mode!==`embedded`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=a(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let o;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(o=n?(0,$.jsx)(`div`,{className:Ti(e.mode),children:e.header}):(0,$.jsx)(`div`,{className:Ti(e.mode),"data-surface-subheader":!0,children:e.header}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=o):o=t[5];let s;return t[6]!==e.children||t[7]!==i||t[8]!==o?(s=(0,$.jsxs)(`div`,{className:i,children:[o,e.children]}),t[6]=e.children,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function Di(e){let t=(0,Ci.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,$.jsx)(B,{className:`h-4 w-32 rounded-full`}),(0,$.jsx)(B,{className:`ml-auto h-4 w-20 rounded-full`})]}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(B,{className:`h-3 w-full rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-full rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-10/12 rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-11/12 rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-9/12 rounded-full`})]}),t[1]=r):r=t[1];let i;t[2]===e.label?i=t[3]:(i=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 px-3 py-4`,children:[r,(0,$.jsx)(`span`,{className:`sr-only`,children:e.label})]}),t[2]=e.label,t[3]=i);let a;return t[4]!==e.label||t[5]!==i?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col p-2`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border/60 bg-card/25`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,i]})}),t[4]=e.label,t[5]=i,t[6]=a):a=t[6],a}var Oi=[];function ki(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function Ai(e,t,n){let r=ki(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function ji(e){let t=(0,Ci.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:c,className:l,renderHeaderPrefix:u}=e,d=y(Ii),f=y(Fi),p;t[0]===a?p=t[1]:(p=e=>e.getComposerDraft(a)?.reviewComments??Oi,t[0]=a,t[1]=p);let m=y(p),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),b;t[2]===n?b=t[3]:(b=new Map(n.map(Pi)),t[2]=n,t[3]=b);let x=b,S;if(t[4]!==_||t[5]!==n||t[6]!==m||t[7]!==r){let e;t[9]!==_||t[10]!==m||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=m.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=te(t,n);return r?Ai(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=_?.fileKey===i?[...o,_.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:xe(`${a?`1`:`0`}:${s.flatMap(Mi).join(`:`)}`)}},t[9]=_,t[10]=m,t[11]=r,t[12]=e):e=t[12],S=n.map(e),t[4]=_,t[5]=n,t[6]=m,t[7]=r,t[8]=S}else S=t[8];let C=S,w;t[13]!==a||t[14]!==_?.annotation||t[15]!==f?(w=e=>{g(null),_?.annotation.metadata.entries.some(t=>t.id===e)?v(null):f(a,e)},t[13]=a,t[14]=_?.annotation,t[15]=f,t[16]=w):w=t[16];let T=w,E;t[17]!==d||t[18]!==a||t[19]!==_||t[20]!==x||t[21]!==r||t[22]!==i?(E=(e,t)=>{let n=_?.annotation.metadata.entries.find(t=>t.id===e),o=_?x.get(_.fileKey):void 0;if(!n||!o)return;let c=s({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});c&&d(a,c),g(null),v(null)},t[17]=d,t[18]=a,t[19]=_,t[20]=x,t[21]=r,t[22]=i,t[23]=E):E=t[23];let D=E,O;t[24]!==x||t[25]!==r||t[26]!==i?(O=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=x.get(n.id);if(!a)return;let o=oe(),c=s({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});c&&v({fileKey:n.id,annotation:{side:ki(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:c.rangeLabel,text:``}]}}})},t[24]=x,t[25]=r,t[26]=i,t[27]=O):O=t[27];let k=O,ee=_!==null,A;t[28]===c?A=t[29]:(A=c?{ref:c}:{},t[28]=c,t[29]=A);let j;t[30]===l?j=t[31]:(j=l?{className:l}:{},t[30]=l,t[31]=j);let ne=!ee,re=!ee,M;t[32]!==k||t[33]!==o||t[34]!==re||t[35]!==ne?(M={...o,enableGutterUtility:ne,enableLineSelection:re,onLineSelectionEnd:k},t[32]=k,t[33]=o,t[34]=re,t[35]=ne,t[36]=M):M=t[36];let N;t[37]===u?N=t[38]:(N=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=N);let P;t[39]!==T||t[40]!==D?(P=e=>(0,$.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,$.jsx)(ae,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>T(e.id),onComment:t=>D(e.id,t),onDelete:()=>T(e.id)},e.id))}),t[39]=T,t[40]=D,t[41]=P):P=t[41];let ie;return t[42]!==C||t[43]!==h||t[44]!==M||t[45]!==N||t[46]!==P||t[47]!==A||t[48]!==j?(ie=(0,$.jsx)(pi,{...A,...j,items:C,selectedLines:h,onSelectedLinesChange:g,options:M,renderHeaderPrefix:N,renderAnnotation:P}),t[42]=C,t[43]=h,t[44]=M,t[45]=N,t[46]=P,t[47]=A,t[48]=j,t[49]=ie):ie=t[49],ie}function Mi(e){return e.metadata.entries.map(Ni)}function Ni(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Pi(e){return[e.fileKey,e]}function Fi(e){return e.removeReviewComment}function Ii(e){return e.addReviewComment}var Li=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),Ri={multiple(e){return e?{[Li.multiple]:``}:null}},zi=Q.forwardRef(function(e,t){let{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:o,orientation:s=`horizontal`,multiple:c=!1,value:l,className:d,render:f,style:p,...m}=e,h=w(!0),_=Q.useMemo(()=>l!==void 0||r!==void 0,[l,r]),v=(h?.disabled??!1)||i,[y,b]=C({controlled:l,default:l===void 0?r??n:void 0,name:`ToggleGroup`,state:`value`}),x=u((e,t,n)=>{let r;c?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],o?.(r,n),!n.isCanceled&&b(r)}),S={disabled:v,multiple:c,orientation:s},T=Q.useMemo(()=>({disabled:v,orientation:s,setGroupValue:x,value:y,isValueInitialized:_}),[v,s,x,y,_]),E={role:`group`},D=g(`div`,e,{enabled:!!h,state:S,ref:t,props:[E,m],stateAttributesMapping:Ri});return(0,$.jsx)(Le.Provider,{value:T,children:h?D:(0,$.jsx)(q,{render:f,className:d,style:p,state:S,refs:[t],props:[E,m],stateAttributesMapping:Ri,loopFocus:a,enableHomeAndEndKeys:!0,orientation:s})})}),Bi=Q.createContext({size:`default`,variant:`default`});function Vi(e){let t=(0,Ci.c)(24),n,r,i,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6]):({className:r,variant:o,size:s,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`default`:o,u=s===void 0?`default`:s,d=c===void 0?`horizontal`:c,f;t[7]!==u||t[8]!==l?(f={size:u,variant:l},t[7]=u,t[8]=l,t[9]=f):f=t[9];let p=f,m=d===`horizontal`?`*:pointer-coarse:after:min-w-auto`:`*:pointer-coarse:after:min-h-auto`,h=l==="default"?`gap-0.5`:d===`horizontal`?`*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none`:`*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block`,g;t[10]!==r||t[11]!==m||t[12]!==h?(g=a(`flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input`,m,h,r),t[10]=r,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==p?(_=(0,$.jsx)(Bi,{value:p,children:n}),t[14]=n,t[15]=p,t[16]=_):_=t[16];let v;return t[17]!==d||t[18]!==i||t[19]!==u||t[20]!==g||t[21]!==_||t[22]!==l?(v=(0,$.jsx)(zi,{className:g,"data-size":u,"data-slot":`toggle-group`,"data-variant":l,orientation:d,...i,children:_}),t[17]=d,t[18]=i,t[19]=u,t[20]=g,t[21]=_,t[22]=l,t[23]=v):v=t[23],v}function Hi(e){let t=(0,Ci.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Q.use(Bi),c=o??s.variant,l=a??s.size,u;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==l||t[10]!==c?(u=(0,$.jsx)(K,{className:r,"data-size":l,"data-variant":c,size:l,variant:c,...i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=c,t[11]=u):u=t[11],u}function Ui(e){return{diffPreview:re(e,{label:`environment-data:review:diff-preview`,tag:d.reviewGetDiffPreview,staleTimeMs:5e3})}}var Wi=Ui(M);function Gi(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function Ki(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&Gi(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function qi(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var Ji=`__automatic_base_ref__`,Yi=new Set,Xi=`
1
+ import{$a as e,Ad as t,Ba as n,C as r,E as i,Ea as a,En as o,Et as s,F as c,Gd as l,Gi as u,Hs as d,Ja as f,Mn as p,Nn as m,Pn as h,Ra as g,Sd as _,Ss as v,St as y,Tn as b,X as x,Xd as S,Yi as C,_r as w,b as T,eo as E,ft as D,gs as O,jl as k,jn as ee,jt as te,ls as A,no as j,qd as ne,rs as re,rt as M,to as N,w as P,xn as ie}from"./textarea-D9Ba06Vy.js";import{a as ae,c as F,n as oe,o as se}from"./fileCommentAnnotations-DQRHHOXQ.js";import{A as I,Bt as L,C as ce,Cn as le,Dn as ue,En as de,Ft as R,In as fe,It as pe,Jt as z,Mn as me,Nn as B,On as he,Pt as ge,S as _e,Sn as ve,Tn as ye,Ut as V,Vt as H,Wt as U,_ as W,ar as be,b as xe,bn as Se,cr as Ce,ct as we,dn as Te,dt as G,fn as K,ft as Ee,hr as De,ir as Oe,jr as ke,kn as Ae,kr as je,ln as Me,lt as Ne,mr as Pe,nr as Fe,ot as Ie,pn as Le,pt as Re,qn as ze,qt as Be,rr as Ve,sr as He,st as Ue,un as We,ur as Ge,ut as Ke,v as qe,w as Je,wn as Ye,x as Xe,xn as Ze,y as Qe,yn as q}from"./index-C5JWzjIR.js";var $e=j(`columns-2`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M12 3v18`,key:`108xh3`}]]),et=j(`pilcrow`,[[`path`,{d:`M13 4v16`,key:`8vvj80`}],[`path`,{d:`M17 4v16`,key:`7dpous`}],[`path`,{d:`M19 4H9.5a4.5 4.5 0 0 0 0 9H13`,key:`sh4n9v`}]]),tt=j(`rows-3`,[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M21 9H3`,key:`1338ky`}],[`path`,{d:`M21 15H3`,key:`9uk58r`}]]),J=()=>`Automatic`,nt=()=>`Automático`,rt=()=>`Automático`,it=()=>`Automatique`,at=()=>`Automatico`,ot=()=>`自動`,st=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?nt(e):n===`es`?rt(e):n===`fr`?it(e):n===`it`?at(e):n===`ja`?ot(e):J(e)},ct=()=>`Branch changes`,lt=()=>`Alterações da branch`,ut=()=>`Cambios de la rama`,dt=()=>`Modifications de la branche`,ft=()=>`Modifiche branch`,pt=()=>`ブランチの変更`,mt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?lt(e):n===`es`?ut(e):n===`fr`?dt(e):n===`it`?ft(e):n===`ja`?pt(e):ct(e)},ht=e=>`Change comparison target. Currently ${e?.base}`,gt=e=>`Alterar alvo da comparação. Atual: ${e?.base}`,Y=e=>`Cambiar objetivo de comparación. Actual: ${e?.base}`,_t=e=>`Changer la cible de comparaison. Actuelle : ${e?.base}`,vt=e=>`Cambia destinazione confronto. Attuale: ${e?.base}`,yt=e=>`比較対象を変更。現在: ${e?.base}`,bt=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?gt(e):n===`es`?Y(e):n===`fr`?_t(e):n===`it`?vt(e):n===`ja`?yt(e):ht(e)},xt=e=>`Comparing ${e?.head} against ${e?.base}`,St=e=>`Comparando ${e?.head} com ${e?.base}`,Ct=e=>`Comparando ${e?.head} con ${e?.base}`,wt=e=>`Comparaison de ${e?.head} avec ${e?.base}`,Tt=e=>`Confronto di ${e?.head} con ${e?.base}`,Et=e=>`${e?.head} と ${e?.base} を比較中`,Dt=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?St(e):n===`es`?Ct(e):n===`fr`?wt(e):n===`it`?Tt(e):n===`ja`?Et(e):xt(e)},Ot=()=>`Disable diff line wrapping`,kt=()=>`Desativar quebra de linha no diff`,At=()=>`Desactivar ajuste de líneas del diff`,jt=()=>`Désactiver le retour à la ligne du diff`,Mt=()=>`Disattiva ritorno a capo del diff`,Nt=()=>`差分の行折り返しを無効化`,Pt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?kt(e):n===`es`?At(e):n===`fr`?jt(e):n===`it`?Mt(e):n===`ja`?Nt(e):Ot(e)},Ft=()=>`Enable diff line wrapping`,It=()=>`Ativar quebra de linha no diff`,Lt=()=>`Activar ajuste de líneas del diff`,Rt=()=>`Activer le retour à la ligne du diff`,zt=()=>`Attiva ritorno a capo del diff`,Bt=()=>`差分の行折り返しを有効化`,Vt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?It(e):n===`es`?Lt(e):n===`fr`?Rt(e):n===`it`?zt(e):n===`ja`?Bt(e):Ft(e)},Ht=()=>`Latest turn`,Ut=()=>`Último turno`,Wt=()=>`Último turno`,Gt=()=>`Dernier tour`,Kt=()=>`Ultimo turno`,qt=()=>`最新ターン`,Jt=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Ut(e):n===`es`?Wt(e):n===`fr`?Gt(e):n===`it`?Kt(e):n===`ja`?qt(e):Ht(e)},Yt=()=>`No completed turns yet.`,Xt=()=>`Nenhum turno concluído ainda.`,Zt=()=>`Aún no hay turnos completados.`,Qt=()=>`Aucun tour terminé pour le moment.`,$t=()=>`Nessun turno completato.`,en=()=>`完了したターンはまだありません。`,tn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Xt(e):n===`es`?Zt(e):n===`fr`?Qt(e):n===`it`?$t(e):n===`ja`?en(e):Yt(e)},nn=()=>`No matching refs.`,rn=()=>`Nenhuma ref correspondente.`,an=()=>`No hay refs coincidentes.`,on=()=>`Aucune ref correspondante.`,sn=()=>`Nessuna ref corrispondente.`,cn=()=>`一致する ref はありません。`,ln=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?rn(e):n===`es`?an(e):n===`fr`?on(e):n===`it`?sn(e):n===`ja`?cn(e):nn(e)},un=()=>`Turn diffs are unavailable because this project is not a Git repository.`,dn=()=>`Os diffs de turno não estão disponíveis porque este projeto não é um repositório Git.`,fn=()=>`Los diffs de turno no están disponibles porque este proyecto no es un repositorio Git.`,pn=()=>`Les diffs de tour sont indisponibles car ce projet n’est pas un dépôt Git.`,mn=()=>`I diff dei turni non sono disponibili perché questo progetto non è un repository Git.`,hn=()=>`このプロジェクトは Git リポジトリではないため、ターンの差分を利用できません。`,gn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?dn(e):n===`es`?fn(e):n===`fr`?pn(e):n===`it`?mn(e):n===`ja`?hn(e):un(e)},_n=()=>`Remote only`,vn=()=>`Somente remoto`,yn=()=>`Solo remoto`,bn=()=>`Distant uniquement`,xn=()=>`Solo remoto`,Sn=()=>`リモートのみ`,Cn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?vn(e):n===`es`?yn(e):n===`fr`?bn(e):n===`it`?xn(e):n===`ja`?Sn(e):_n(e)},wn=e=>`Diff scope: ${e?.scope}`,Tn=e=>`Escopo do diff: ${e?.scope}`,En=e=>`Ámbito del diff: ${e?.scope}`,Dn=e=>`Portée du diff : ${e?.scope}`,On=e=>`Ambito diff: ${e?.scope}`,kn=e=>`差分範囲: ${e?.scope}`,An=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?Tn(e):n===`es`?En(e):n===`fr`?Dn(e):n===`it`?On(e):n===`ja`?kn(e):wn(e)},jn=()=>`Select a thread to inspect turn diffs.`,Mn=()=>`Selecione uma conversa para inspecionar os diffs dos turnos.`,Nn=()=>`Selecciona un hilo para inspeccionar los diffs de los turnos.`,Pn=()=>`Sélectionnez un fil pour examiner les diffs des tours.`,Fn=()=>`Seleziona una conversazione per esaminare i diff dei turni.`,In=()=>`ターンの差分を確認するスレッドを選択してください。`,Ln=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Mn(e):n===`es`?Nn(e):n===`fr`?Pn(e):n===`it`?Fn(e):n===`ja`?In(e):jn(e)},Rn=()=>`Split diff view`,zn=()=>`Visualização dividida do diff`,Bn=()=>`Vista de diff dividida`,Vn=()=>`Vue diff divisée`,Hn=()=>`Vista diff divisa`,Un=()=>`分割 diff 表示`,Wn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?zn(e):n===`es`?Bn(e):n===`fr`?Vn(e):n===`it`?Hn(e):n===`ja`?Un(e):Rn(e)},Gn=()=>`Stacked diff view`,Kn=()=>`Visualização empilhada do diff`,qn=()=>`Vista de diff apilada`,Jn=()=>`Vue diff empilée`,Yn=()=>`Vista diff sovrapposta`,Xn=()=>`積み重ね diff 表示`,Zn=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Kn(e):n===`es`?qn(e):n===`fr`?Jn(e):n===`it`?Yn(e):n===`ja`?Xn(e):Gn(e)},Qn=()=>`This diff was truncated because it exceeded the preview limit. The changes shown are incomplete.`,$n=()=>`Este diff foi truncado por exceder o limite de prévia. As alterações exibidas estão incompletas.`,er=()=>`Este diff se truncó porque superó el límite de vista previa. Los cambios mostrados están incompletos.`,tr=()=>`Ce diff a été tronqué car il dépassait la limite d’aperçu. Les modifications affichées sont incomplètes.`,nr=()=>`Questo diff è stato troncato perché superava il limite di anteprima. Le modifiche mostrate sono incomplete.`,rr=()=>`プレビュー上限を超えたため、この差分は省略されています。表示されている変更は不完全です。`,ir=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?$n(e):n===`es`?er(e):n===`fr`?tr(e):n===`it`?nr(e):n===`ja`?rr(e):Qn(e)},ar=()=>`Turn`,or=()=>`Turno`,sr=()=>`Turno`,cr=()=>`Tour`,lr=()=>`Turno`,ur=()=>`ターン`,dr=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?or(e):n===`es`?sr(e):n===`fr`?cr(e):n===`it`?lr(e):n===`ja`?ur(e):ar(e)},fr=e=>`Turn ${e?.count}`,pr=e=>`Turno ${e?.count}`,mr=e=>`Turno ${e?.count}`,hr=e=>`Tour ${e?.count}`,gr=e=>`Turno ${e?.count}`,_r=e=>`ターン ${e?.count}`,vr=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?pr(e):n===`es`?mr(e):n===`fr`?hr(e):n===`it`?gr(e):n===`ja`?_r(e):fr(e)},yr=e=>`Use remote version of ${e?.name}`,br=e=>`Usar versão remota de ${e?.name}`,xr=e=>`Usar versión remota de ${e?.name}`,Sr=e=>`Utiliser la version distante de ${e?.name}`,Cr=e=>`Usa versione remota di ${e?.name}`,wr=e=>`${e?.name} のリモート版を使用`,Tr=(e,t={})=>{let n=t.locale??f();return n===`pt-BR`?br(e):n===`es`?xr(e):n===`fr`?Sr(e):n===`it`?Cr(e):n===`ja`?wr(e):yr(e)},Er=()=>`Working tree`,Dr=()=>`Árvore de trabalho`,Or=()=>`Árbol de trabajo`,kr=()=>`Arbre de travail`,Ar=()=>`Albero di lavoro`,jr=()=>`作業ツリー`,Mr=(e={},t={})=>{let n=t.locale??f();return n===`pt-BR`?Dr(e):n===`es`?Or(e):n===`fr`?kr(e):n===`it`?Ar(e):n===`ja`?jr(e):Er(e)};function Nr(){return typeof window>`u`||typeof window.matchMedia!=`function`?!1:window.matchMedia(`(prefers-reduced-motion: reduce)`).matches}function X(e){let t=window.devicePixelRatio??1;return Math.round(e*t)/t}var Pr=`theme.disableLineNumbers.overflow.themeType.disableFileHeader.disableVirtualizationBuffers.preferredHighlighter.useCSSClasses.useTokenTransformer.tokenizeMaxLineLength.tokenizeMaxLength.unsafeCSS.diffStyle.diffIndicators.disableBackground.expandUnchanged.collapsedContextThreshold.lineDiffType.maxLineDiffLength.expansionLineCount.lineHoverHighlight.enableTokenInteractionsOnWhitespace.enableGutterUtility.__debugPointerEvents.enableLineSelection.controlledSelection.disableErrorHandling`.split(`.`),Fr=[`theme`,`disableLineNumbers`,`overflow`,`themeType`,`disableFileHeader`,`disableVirtualizationBuffers`,`preferredHighlighter`,`useCSSClasses`,`useTokenTransformer`,`tokenizeMaxLineLength`,`tokenizeMaxLength`,`unsafeCSS`,`lineHoverHighlight`,`enableTokenInteractionsOnWhitespace`,`enableGutterUtility`,`__debugPointerEvents`,`enableLineSelection`,`controlledSelection`,`disableErrorHandling`],Ir=[`renderCustomHeader`,`renderHeaderPrefix`,`renderHeaderMetadata`,`renderAnnotation`,`renderGutterUtility`,`onPostRender`,`onGutterUtilityClick`,`onLineClick`,`onLineNumberClick`,`onLineEnter`,`onLineLeave`,`onTokenClick`,`onTokenEnter`,`onTokenLeave`],Lr=[`onLineSelected`,`onLineSelectionStart`,`onLineSelectionChange`,`onLineSelectionEnd`],Rr=Symbol(`CodeView.itemOptionsState`);function zr(e,t){Object.defineProperty(e,Rr,{configurable:!1,enumerable:!1,value:t})}function Br(e){return e[Rr]}function Z(e,t,n){Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get(){return n(this)}})}var Vr=120,Hr=`--diffs-overflow-override`,Ur=12e6,Wr=1e6,Gr=2e6,Kr=Ur-Gr,qr=Ur-Wr,Jr=(()=>{let{navigator:e}=globalThis,t=e.userAgent,n=/iP(?:hone|ad|od)/.test(t),r=e.platform===`MacIntel`&&e.maxTouchPoints>1;return(n||r)&&/AppleWebKit/.test(t)&&/Safari/.test(t)&&!/(CriOS|FxiOS|EdgiOS|OPiOS)/.test(t)})(),Yr=class e{static __STOP=!1;static __lastScrollPosition=0;type=`advanced`;config={overscrollSize:200,intersectionObserverMargin:0,resizeDebugging:!1};items=[];idToItem=new Map;selectedLines=null;instanceToItem=new Map;layoutDirtyIndex;pendingLayoutReset;renderOptionsRevision=0;slotCoordinator;slotSnapshot;scrollListeners=new Set;scrollHeight=0;containerHeight=-1;scrollTop=0;scrollPageOffset=0;scrollDirty=!0;scrollInteractionFixTimer;pointerEventsDisabled=!1;codeOverflowFix=!1;height=0;heightDirty=!0;windowSpecs={top:0,bottom:0};renderState={scrollTop:-1,firstIndex:-1,lastIndex:-1,stickyHeight:0,stickyTop:-1,stickyBottom:-1};itemMetricsCache=L;fileOptionsPrototype;diffOptionsPrototype;pendingScrollTarget;pendingLayoutAnchor;shouldFixContainerFocus=!1;scrollAnimation;root;resizeObserver;container=document.createElement(`div`);stickyContainer=document.createElement(`div`);stickyOffset=document.createElement(`div`);elementPool=[];elementPoolVersion=0;elementPoolTracker=new WeakMap;pendingElementPool=[];options;workerManager;isContainerManaged;constructor(e={theme:U},t,n=!1){this.options=e,this.computeMetricsCache(e.itemMetrics),this.fileOptionsPrototype=this.createFileOptionsPrototype(),this.diffOptionsPrototype=this.createDiffOptionsPrototype(),this.workerManager=t,this.isContainerManaged=n,this.stickyOffset.style.contain=`layout size`,this.stickyContainer.style.position=`sticky`,this.stickyContainer.style.width=`100%`,this.stickyContainer.style.contain=`layout style inline-size`,this.stickyContainer.style.isolation=`isolate`,this.stickyContainer.style.display=`flex`,this.stickyContainer.style.flexDirection=`column`}getLayout(){return this.options.layout??H}computeMetricsCache(e){return this.itemMetricsCache={hunkLineCount:e?.hunkLineCount??L.hunkLineCount,lineHeight:e?.lineHeight??L.lineHeight,diffHeaderHeight:e?.diffHeaderHeight??L.diffHeaderHeight,hunkSeparatorHeight:e?.hunkSeparatorHeight,spacing:e?.spacing??L.spacing,paddingTop:e?.paddingTop,paddingBottom:e?.paddingBottom},this.itemMetricsCache}getSmoothScrollSettings(){return this.options.smoothScrollSettings??V}shouldDisablePointerEvents(){return this.options.pointerEventsOnScroll!==!0}shouldValidateItemHeights(){return Be&&this.options.__devOnlyValidateItemHeights===!0}validateRenderedItemHeight(e){if(!this.shouldValidateItemHeights()||e.element==null)return;let t=e.instance.getAdvancedStickySpecs();if(t==null)return;let n=t.height,r=e.element.getBoundingClientRect().height;n!==r&&console.error(`CodeView: reconciled item height does not match DOM height`,{id:e.item.id,type:e.type,index:e.index,version:e.version,expectedHeight:n,actualHeight:r,delta:r-n,stickyTopOffset:t.topOffset,virtualizedHeight:e.instance.getVirtualizedHeight(),top:e.top,scrollTop:this.getScrollTop(),windowSpecs:{...this.windowSpecs},element:e.element,instance:e.instance})}validateStickyContainerHeight(){if(!this.shouldValidateItemHeights())return;let{firstIndex:e,lastIndex:t,stickyHeight:n,stickyTop:r,stickyBottom:i}=this.renderState;if(e===-1||t===-1)return;let a=this.stickyContainer.getBoundingClientRect().height;Math.abs(a-n)<1||console.error(`CodeView: sticky container height does not match computed layout`,{computedStickyHeight:n,actualStickyHeight:a,delta:a-n,stickyTop:r,stickyBottom:i,firstIndex:e,lastIndex:t,firstStickySpecs:this.items[e]?.instance.getAdvancedStickySpecs(),lastStickySpecs:this.items[t]?.instance.getAdvancedStickySpecs(),scrollTop:this.getScrollTop(),scrollPageOffset:this.scrollPageOffset,windowSpecs:{...this.windowSpecs},stickyContainer:this.stickyContainer})}clearScrollInteractionTimer(){this.scrollInteractionFixTimer!=null&&(clearTimeout(this.scrollInteractionFixTimer),this.scrollInteractionFixTimer=void 0)}suspendScrollInteractions(){this.clearScrollInteractionTimer(),this.shouldDisablePointerEvents()&&!this.pointerEventsDisabled&&(this.stickyContainer.style.pointerEvents=`none`,this.pointerEventsDisabled=!0),Jr&&!this.codeOverflowFix&&(this.stickyContainer.style.setProperty(Hr,`hidden`),this.codeOverflowFix=!0),this.scrollInteractionFixTimer=setTimeout(this.restoreScrollInteractions,Vr)}restoreScrollInteractions=()=>{this.clearScrollInteractionTimer(),this.pointerEventsDisabled&&=(this.stickyContainer.style.removeProperty(`pointer-events`),!1),this.codeOverflowFix&&=(this.stickyContainer.style.setProperty(Hr,`auto`),!1)};syncLayout(){let{gap:e,paddingBottom:t,paddingTop:n}=this.getLayout();this.stickyContainer.style.gap=`${e}px`,this.container?.style.setProperty(`margin-top`,`${n}px`),this.container?.style.setProperty(`margin-bottom`,`${t}px`)}setup(t){if(this.root!=null)throw Error(`CodeView.setup: already setup`);this.workerManager?.subscribeToThemeChanges(this),this.root=t,this.root.style.overflowAnchor=`none`,this.root.hasAttribute(`tabindex`)||(this.root.tabIndex=-1),this.container??=document.createElement(`div`),this.container.style.contain=`layout style`,this.syncLayout(),this.container.appendChild(this.stickyOffset),this.container.appendChild(this.stickyContainer),this.root.appendChild(this.container),this.scrollDirty=!0,this.heightDirty=!0,this.resizeObserver=new ResizeObserver(this.handleResize),this.resizeObserver.observe(this.stickyContainer),this.root.addEventListener(`scroll`,this.handleScroll,{passive:!0}),this.root.addEventListener(`wheel`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`touchstart`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`pointerdown`,this.clearPendingScroll,{passive:!0}),this.root.addEventListener(`keydown`,this.clearPendingScroll,{passive:!0}),this.resizeObserver.observe(this.root),this.render(!0),window.__INSTANCE=this,window.__TOGGLE=()=>{e.__STOP?(e.__STOP=!1,this.scrollTo({type:`position`,position:e.__lastScrollPosition,behavior:`instant`})):(e.__lastScrollPosition=this.getScrollTop(),e.__STOP=!0)}}reset(){this.restoreScrollInteractions(),this.cleanAllRenderedItems(),this.selectedLines=null,this.items.length=0,this.idToItem.clear(),this.instanceToItem.clear(),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,this.stickyContainer.textContent=``,this.stickyOffset.style.height=``,this.container?.style.removeProperty(`height`),this.containerHeight=-1,this.windowSpecs={top:0,bottom:0},this.pendingLayoutAnchor=void 0,this.shouldFixContainerFocus=!1,this.height=0,this.scrollTop=0,this.scrollPageOffset=0,this.scrollHeight=0,this.scrollDirty=!0,this.heightDirty=!0,this.resetRenderState(),this.isContainerManaged||this.flushSlotCoordinator()}cleanUp(){this.reset(),this.clearElementPool(),this.restoreScrollInteractions(),this.workerManager?.unsubscribeToThemeChanges(this),this.resizeObserver?.disconnect(),this.resizeObserver=void 0,this.root?.removeEventListener(`scroll`,this.handleScroll),this.root?.removeEventListener(`wheel`,this.clearPendingScroll),this.root?.removeEventListener(`touchstart`,this.clearPendingScroll),this.root?.removeEventListener(`pointerdown`,this.clearPendingScroll),this.root?.removeEventListener(`keydown`,this.clearPendingScroll),this.root?.style.removeProperty(`overflow-anchor`),this.container?.remove(),this.stickyOffset.remove(),this.stickyContainer.remove(),this.stickyContainer.textContent=``,this.root=void 0,this.container=void 0}cleanAllRenderedItems(){if(this.renderState.firstIndex!==-1)for(let e=this.renderState.firstIndex;e<=this.renderState.lastIndex;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.cleanAllRenderedItems: Item does not exist at index: ${e}`);this.releaseRenderedItem(t)}}primeScrollTarget(e){e.type!==`position`&&this.idToItem.get(e.id)?.instance.primeHighlightCache()}getElementPoolLimit(){let e=this.getHeight()+this.config.overscrollSize*2,{diffHeaderHeight:t}=this.itemMetricsCache;return Math.max(8,Math.ceil(e/Math.max(t,10))+1)*(this.isContainerManaged?2:1)}acquireElement(){this.promotePendingPooledElements();let e=this.elementPool.pop();for(;e!=null&&!this.isElementPoolGenerationCurrent(e);)e=this.elementPool.pop();return e??=document.createElement(z),this.markElementPoolGenerationCurrent(e),e}releaseRenderedItem(e){let{element:t}=e;t!=null&&this.renderedItemOwnsFocus(t)&&(this.shouldFixContainerFocus=!0),e.instance.cleanUp(!0),e.element=void 0,t!=null&&(t.remove(),this.cleanElement(t),this.queueElementForPool(t))}renderedItemOwnsFocus(e){let{activeElement:t}=document;return t===e||e.contains(t)||e.shadowRoot?.activeElement!=null}fixContainerFocus(){this.shouldFixContainerFocus&&(this.shouldFixContainerFocus=!1,this.root?.focus({preventScroll:!0}))}cleanElement(e){let{shadowRoot:t}=e;if(t!=null)for(let e of Array.from(t.children))ei(e)||e.remove();this.isContainerManaged||e.replaceChildren()}queueElementForPool(e){let t=this.getElementPoolLimit();!this.isElementPoolGenerationCurrent(e)||this.getElementPoolSize()>=t||(this.isElementClean(e)?this.elementPool.push(e):this.pendingElementPool.push(e))}promotePendingPooledElements(){if(this.pendingElementPool.length===0)return;let{pendingElementPool:e}=this;this.pendingElementPool=[];let t=this.getElementPoolLimit();for(let n of e)this.isElementPoolGenerationCurrent(n)&&this.isElementClean(n)&&this.elementPool.length<t?this.elementPool.push(n):this.isElementPoolGenerationCurrent(n)&&this.getElementPoolSize()<t&&this.pendingElementPool.push(n)}isElementClean(e){return e.childNodes.length===0}getElementPoolSize(){return this.elementPool.length+this.pendingElementPool.length}clearElementPool(){this.elementPool.length=0,this.pendingElementPool.length=0}invalidateElementPool(){this.elementPoolVersion++,this.clearElementPool()}markElementPoolGenerationCurrent(e){this.elementPoolTracker.set(e,this.elementPoolVersion)}isElementPoolGenerationCurrent(e){return this.elementPoolTracker.get(e)===this.elementPoolVersion}resolveEffectiveScrollBehavior(e,t){return Nr()?`instant`:e.behavior===`smooth-auto`?Math.abs(t-this.getScrollTop())<=this.getHeight()*10?`smooth`:`instant`:e.behavior??`instant`}scrollTo(e){if(this.root==null)return;let t=this.normalizeScrollTarget(e);if(t==null)return;let n=this.resolveScrollTargetTop(t);n!=null&&(this.primeScrollTarget(t),this.resolveEffectiveScrollBehavior(t,n)===`smooth`?this.scrollAnimation??={position:this.getScrollTop(),velocity:0,lastTimestamp:performance.now()}:this.scrollAnimation=void 0,this.suspendScrollInteractions(),this.pendingLayoutAnchor=void 0,this.pendingScrollTarget=t,this.render())}setSelectedLines(e,t){this.applySelectedLines(e,t)}getSelectedLines(){return this.selectedLines}clearSelectedLines(e){this.applySelectedLines(null,e)}getItem(e){return this.idToItem.get(e)?.item}updateItem(e){let t=this.idToItem.get(e.id);return t==null?(console.error(`CodeView.updateItem: unknown item id "${e.id}"`),!1):this.syncItemRecord(t,e)?(this.markItemLayoutDirty(t),this.scrollDirty=!0,this.render(),this.syncSelection(),!0):!1}updateItemId(e,t){if(e===t)return!0;let n=this.idToItem.get(e);return n==null?(console.error(`CodeView.updateItemId: unknown item id "${e}"`),!1):this.idToItem.has(t)?(console.error(`CodeView.updateItemId: duplicate item id "${t}"`),!1):(this.idToItem.delete(e),n.item.id=t,this.idToItem.set(t,n),this.updateItemOptionsId(n.instance.options,t),this.selectedLines?.id===e&&(this.selectedLines={...this.selectedLines,id:t},this.options.onSelectedLinesChange?.(this.selectedLines)),this.renamePendingScrollTarget(e,t),this.renamePendingLayoutAnchor(e,t),this.render(),!0)}addItem(e){this.addItems([e]),this.syncSelection()}addItems(e){this.appendItemsInternal(e),this.syncSelection()}setItems(e){e.length===0?this.reset():this.items.length===0?this.appendItemsInternal(e):this.tryAppendItems(e)||this.reconcileItems(e),this.syncSelection()}appendItemsInternal(e,t=!0){if(e.length===0)return;let n=this.getLayout(),r=this.items.length===0?0:this.scrollHeight+n.gap,i=r;for(let t=0;t<e.length;t++){let i=e[t];if(i==null)throw Error(`CodeView.appendItemsInternal: missing input item`);if(this.idToItem.has(i.id))throw Error(`CodeView.addItem: duplicate id "${i.id}"`);let a=this.createItem(i,this.items.length,r);this.items.push(a),this.idToItem.set(a.item.id,a),this.instanceToItem.set(a.instance,a),a.height=Xr(a),r+=a.height+n.gap}this.scrollHeight=r-n.gap,this.scrollDirty=!0,t&&(this.canSkipRenderForAppend(i)?this.syncContainerHeight():this.render())}canSkipRenderForAppend(e){return this.container!=null&&this.renderState.firstIndex!==-1&&this.pendingScrollTarget==null&&this.scrollAnimation==null&&this.layoutDirtyIndex==null&&e>this.windowSpecs.bottom}onThemeChange(){this.invalidateElementPool()}setOptions(e){if(e==null)return;this.capturePendingLayoutAnchor();let{options:t}=this,n=this.getLayout(),{itemMetricsCache:r}=this;Zr(t,e)&&this.invalidateElementPool(),this.options=e;let i=this.computeMetricsCache(e.itemMetrics),a=!Ee(r,i),o=!Ee(n,this.getLayout());o&&this.syncLayout();let s=a||Qr(t,e);if(s){let n=this.pendingLayoutReset;this.pendingLayoutReset={metrics:a?i:n?.metrics,resetFileLayoutCache:!0,resetDiffLayoutCache:!0,includeEstimatedDiffHeights:n?.includeEstimatedDiffHeights===!0||a||$r(t,e)}}(o||s)&&(this.markLayoutDirtyFromIndex(0),this.scrollDirty=!0),G(t,e)||this.renderOptionsRevision++,!this.isContainerManaged&&this.items.length>0&&this.render()}capturePendingLayoutAnchor(){this.root==null||this.items.length===0||this.pendingScrollTarget!=null||(this.pendingLayoutAnchor=this.getScrollAnchor(this.getScrollTop()))}render(t=!1){e.__STOP||(t?(Ne(this.computeRenderRangeAndEmit),this.computeRenderRangeAndEmit()):Ke(this.computeRenderRangeAndEmit))}instanceChanged(e,t){let n=this.instanceToItem.get(e);if(n==null)throw Error(`CodeView.instanceChanged: An instance has changed that is not registered`);t&&this.markItemLayoutDirty(n),this.render()}getWindowSpecs(){return this.windowSpecs}getContainerElement(){return this.root}getRenderedItems(){let{firstIndex:e,lastIndex:t}=this.renderState;if(e===-1||t===-1||t<e)return[];let n=[];for(let r=e;r<=t;r++){let e=this.items[r];e?.element!=null&&(e.type===`diff`?n.push({id:e.item.id,type:`diff`,item:e.item,version:e.version,element:e.element,instance:e.instance}):n.push({id:e.item.id,type:`file`,item:e.item,version:e.version,element:e.element,instance:e.instance}))}return n}setSlotCoordinator(e){return e===this.slotCoordinator?!1:(this.slotCoordinator=e,this.slotSnapshot=void 0,!0)}getSlotSnapshot(e){return oi(this.getRenderedItems(),e)}subscribeToScroll(e){return this.scrollListeners.add(e),()=>{this.scrollListeners.delete(e)}}getLocalTopForInstance(e){let t=this.instanceToItem.get(e);if(t==null)throw Error(`CodeView.getLocalTopForInstance: unknown virtualized instance`);return t.top}getTopForItem(e){let t=this.idToItem.get(e);if(t!=null)return t.top+this.getLayout().paddingTop}createItem(e,t,n){let{itemMetricsCache:r}=this;if(e.type===`diff`){let i=new I(this.createDiffOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`diff`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}let i=new se(this.createFileOptions(e.id),this,r,this.workerManager,this.isContainerManaged);return{type:`file`,item:e,version:e.version,index:t,top:n,height:0,element:void 0,renderedOptionsRevision:this.renderOptionsRevision,instance:i}}applySelectedLines(e,t){let{selectedLines:n}=this;e==null&&n==null||e!=null&&n?.id===e.id&&we(n.range,e.range)||(n!=null&&n.id!==e?.id&&this.idToItem.get(n.id)?.instance.setSelectedLines(null,{notify:!1}),this.selectedLines=e,this.idToItem.get(e?.id??``)?.instance.setSelectedLines(e?.range??null,t))}syncSelection(){if(this.selectedLines==null)return;let e=this.idToItem.get(this.selectedLines.id);if(e==null){this.selectedLines=null;return}e.instance.setSelectedLines(this.selectedLines.range,{notify:!1})}renamePendingScrollTarget(e,t){let{pendingScrollTarget:n}=this;n==null||n.type===`position`||n.id!==e||(this.pendingScrollTarget={...n,id:t})}renamePendingLayoutAnchor(e,t){this.pendingLayoutAnchor?.id===e&&(this.pendingLayoutAnchor.id=t)}createFileOptionsPrototype(){let e={};for(let t of Fr)Z(e,t,()=>this.options[t]);Z(e,`stickyHeader`,()=>this.options.stickyHeaders),Z(e,`collapsed`,e=>this.getItemOptions(Br(e),`file`)?.item.collapsed===!0);for(let t of Ir)this.defineItemSharedCallback(e,`file`,t);for(let t of Lr)this.defineItemSelectionCallback(e,`file`,t);return e}createDiffOptionsPrototype(){let e={};for(let t of Pr)Z(e,t,()=>this.options[t]);Z(e,`stickyHeader`,()=>this.options.stickyHeaders),Z(e,`hunkSeparators`,()=>this.options.hunkSeparators),Z(e,`collapsed`,e=>this.getItemOptions(Br(e),`diff`)?.item.collapsed===!0);for(let t of Ir)this.defineItemSharedCallback(e,`diff`,t);for(let t of Lr)this.defineItemSelectionCallback(e,`diff`,t);return e}createFileOptions(e){let t=Object.create(this.fileOptionsPrototype);return zr(t,{id:e}),t}createDiffOptions(e){let t=Object.create(this.diffOptionsPrototype);return zr(t,{id:e}),t}updateItemOptionsId(e,t){Br(e).id=t}getItemOptions(e,t){let n=this.idToItem.get(e.id);if(!(n==null||n.type!==t))return n}defineItemSharedCallback(e,t,n){Z(e,n,e=>{if(this.options[n]==null)return;let r=Br(e),i=r.callbackCache??={},a=i[n];return a??(a=((...e)=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=this.options[n];return a?.(...e,i)}),i[n]=a),a})}defineItemSelectionCallback(e,t,n){Z(e,n,e=>{if(this.options.enableLineSelection!==!0)return;let r=Br(e),i=r.callbackCache??={},a=i[n];return a??(a=(e=>{let i=this.getItemOptions(r,t);if(i==null)return;let a=e==null?null:{id:i.item.id,range:e};this.options.controlledSelection!==!0&&(e!=null||this.selectedLines?.id===i.item.id)&&this.applySelectedLines(a,{notify:!1}),this.options.onSelectedLinesChange?.(a);let o=this.options[n];return o?.(e,i)}),i[n]=a),a})}markLayoutDirtyFromIndex(e){this.layoutDirtyIndex=Math.min(this.layoutDirtyIndex??e,e)}markItemLayoutDirty(e){if(this.items[e.index]!==e)throw Error(`CodeView.markItemLayoutDirty: unknown item id "${e.item.id}"`);this.markLayoutDirtyFromIndex(e.index)}tryAppendItems(e){if(e.length<=this.items.length)return!1;for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null||n.item.id!==r.id||n.type!==r.type)return!1}for(let t=0;t<this.items.length;t++){let n=this.items[t];if(n==null)throw Error(`CodeView.tryAppendItems: missing existing item`);let r=e[t];if(r==null)throw Error(`CodeView.tryAppendItems: append candidate missing prefix item`);this.syncItemRecord(n,r)&&this.markLayoutDirtyFromIndex(t)}return this.appendItemsInternal(e.slice(this.items.length),!1),this.scrollDirty=!0,this.render(),!0}reconcileItems(e){let{items:t,idToItem:n}=this,r=new Set(t),i=[],a=new Map,o=new Map,s;for(let c=0;c<e.length;c++){let l=e[c];if(l==null)throw Error(`CodeView.reconcileItems: missing input item`);if(a.has(l.id))throw Error(`CodeView.setItems: duplicate id "${l.id}"`);let u=n.get(l.id),d=u!=null&&u.type===l.type?u:this.createItem(l,c,0);d.index=c,u!=null&&u.type===l.type?(r.delete(u),this.syncItemRecord(d,l)&&(s=Math.min(s??c,c))):s=Math.min(s??c,c),t[c]!==d&&(s=Math.min(s??c,c)),i.push(d),a.set(l.id,d),o.set(d.instance,d)}for(let e=0;e<t.length;e++){let n=t[e];if(n==null||!r.has(n))continue;this.releaseRenderedItem(n);let a=Math.max(i.length-1,0);s=Math.min(s??a,a)}s!=null&&(this.items=i,this.idToItem=a,this.instanceToItem=o,this.renderState.firstIndex>=i.length?this.resetRenderState():this.renderState.lastIndex>=i.length&&(this.renderState.lastIndex=i.length-1),this.markLayoutDirtyFromIndex(s),this.scrollDirty=!0,this.render())}syncItemRecord(e,t){if(e.type!==t.type)throw Error(`CodeView.syncItemRecord: type mismatch for id "${t.id}"`);return e.version===t.version?!1:(e.item=t,e.version=t.version,e.renderedOptionsRevision=-1,!0)}getMaxScrollTopForHeight(e){let{paddingBottom:t,paddingTop:n}=this.getLayout();return Math.max(n+e+t-this.getHeight(),0)}getMaxScrollTop(){return this.getMaxScrollTopForHeight(this.getScrollHeight())}shouldRebaseScroll(){return this.getMaxScrollTop()>qr}getPagedScrollHeight(){return this.shouldRebaseScroll()?Math.min(this.getScrollHeight(),Ur):this.getScrollHeight()}getMaxPagedScrollTop(){return this.getMaxScrollTopForHeight(this.getPagedScrollHeight())}clampPagedScrollTop(e){let t=this.getMaxPagedScrollTop();return Math.max(0,Math.min(e,t))}clampScrollTop(e){let t=this.getMaxScrollTop();return Math.max(0,Math.min(e,t))}getMaxScrollPageOffset(){return Math.max(this.getMaxScrollTop()-this.getMaxPagedScrollTop(),0)}clampScrollPageOffset(e){let t=this.getMaxScrollPageOffset();return Math.max(0,Math.min(e,t))}resolveScrollPageWindow(e,t){let n=X(this.clampPagedScrollTop(t)),r=this.clampScrollPageOffset(e-n);return n=X(this.clampPagedScrollTop(e-r)),r=this.clampScrollPageOffset(e-n),{pagedScrollTop:n,scrollPageOffset:r}}resolvePagedScrollPosition(e){if(!this.shouldRebaseScroll())return{pagedScrollTop:this.clampPagedScrollTop(e),scrollPageOffset:0};let t=this.clampScrollPageOffset(this.scrollPageOffset),n=e-t,r=this.getMaxPagedScrollTop(),i=this.getMaxScrollPageOffset(),a=n>qr&&t<i,o=n<Wr&&t>0;return n<0||n>r||a||o?this.resolveScrollPageWindow(e,o?Math.min(Kr,r):Gr):{pagedScrollTop:X(this.clampPagedScrollTop(n)),scrollPageOffset:t}}needsScrollPageUpdate(e){let t=X(this.clampScrollTop(e)),{scrollPageOffset:n}=this.resolvePagedScrollPosition(t);return n!==this.scrollPageOffset}getPagedLayoutTop(e){return this.shouldRebaseScroll()?Math.max(e-this.scrollPageOffset,0):e}getStickyHeaderOffset(){return this.options.stickyHeaders===!0&&this.options.disableFileHeader!==!0?this.itemMetricsCache.diffHeaderHeight:0}getScrollTargetRect(e){let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return{top:t.top,height:t.height};if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(e.range)} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return{top:t.top+n.top,height:n.height}}normalizeScrollTarget(e){if(e.type===`position`||e.align!==`nearest`)return e;let t=this.getScrollTargetRect(e);if(t==null)return;let n=e.offset??0,r=this.getLayout().paddingTop+t.top,i=r+t.height,a=this.getScrollTop(),o=a+(e.type===`line`||e.type===`range`?this.getStickyHeaderOffset():0),s=a+this.getHeight();if(!(r-n<=o&&i+n>=s)){if(r-n<o)return{...e,align:`start`};if(i+n>s)return{...e,align:`end`}}}resolveScrollTargetTop(e){if(e.type===`position`){let t=this.clampScrollTop(e.position);return t===e.position?this.clampScrollTop(e.position-this.getStickyHeaderOffset()):t}let t=this.idToItem.get(e.id);if(t==null){console.warn(`CodeView.scrollTo: unknown item id "${e.id}"`);return}if(e.type===`item`)return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top,t.height,e.align,e.offset));if(e.type===`range`){let n=this.getRangeScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve range ${ti(e.range)} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}let n=this.getLineScrollPosition(t,e);if(n==null){console.warn(`CodeView.scrollTo: unable to resolve line ${e.lineNumber} for item "${e.id}"`);return}return this.clampScrollTop(this.resolveAlignedScrollPosition(t.top+n.top,n.height,e.align,e.offset,this.getStickyHeaderOffset()))}resolveAlignedScrollPosition(e,t,n,r=0,i=0){e+=this.getLayout().paddingTop;let a=this.getHeight();return n===`center`&&t+r<a?e-(a-t)/2+r:n===`end`?e-(a-t)+r:e-i-r}getLineScrollPosition(e,t){return e.type===`diff`?e.instance.getLinePosition(t.lineNumber,t.side):e.instance.getLinePosition(t.lineNumber)}getRangeScrollPosition(e,t){let{range:n}=t,r=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.start,side:n.side}),i=this.getLineScrollPosition(e,{type:`line`,id:t.id,lineNumber:n.end,side:n.endSide??n.side});if(r==null||i==null)return;let a=r.top,o=a+r.height,s=i.top,c=s+i.height,l=Math.min(a,s);return{top:l,height:Math.max(o,c)-l}}computeTargetScrollTopForFrame(e,t){if(this.pendingScrollTarget==null)return e;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null)return e;let{scrollAnimation:r}=this;return r==null?n:this.computeSpringStep(r,n,t).position}computeSpringStep(e,t,n){let r=Math.max(0,n-e.lastTimestamp),{omega:i}=this.getSmoothScrollSettings(),a=Math.exp(-i*r),o=e.position-t,s=e.velocity+i*o;return{position:t+(o+s*r)*a,velocity:(s*(1-i*r)-i*o)*a}}advanceScrollAnimation(e,t){if(this.pendingScrollTarget==null)return;let n=this.resolveScrollTargetTop(this.pendingScrollTarget);if(n==null){this.pendingScrollTarget=void 0,this.scrollAnimation=void 0;return}let r=this.scrollAnimation;if(r==null)return n;r.position+=t;let{position:i,velocity:a}=this.computeSpringStep(r,n,e);r.lastTimestamp=e,r.position=i,r.velocity=a;let{positionEpsilon:o,velocityEpsilon:s}=this.getSmoothScrollSettings();return Math.abs(n-i)<=o&&Math.abs(a)<=s?(r.position=n,r.velocity=0,this.scrollAnimation=void 0,n):r.position}computeRenderRangeAndEmit=(t=performance.now())=>{if(e.__STOP||this.container==null)return;let n=this.getHeight(),r=this.getScrollTop(),i=r,a=this.pendingLayoutAnchor!=null,o=this.getScrollAnchor(i);if(this.layoutDirtyIndex!=null&&(this.recomputeLayout(this.layoutDirtyIndex,this.pendingLayoutReset),this.layoutDirtyIndex=void 0,this.pendingLayoutReset=void 0,a=!0),a&&o!=null){let e=this.resolveAnchoredScrollTop(o);if(e!=null){let t=e-i;i=e,this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}}a&&(i=this.clampScrollTop(i),this.syncContainerHeight());let s=this.computeTargetScrollTopForFrame(i,t),c=!a&&(this.renderState.scrollTop===-1||Math.abs(s-this.renderState.scrollTop)>n+this.config.overscrollSize*2);c&&(o=void 0),this.windowSpecs=Ue({scrollTop:s,height:n,scrollHeight:this.getScrollHeight(),fitPerfectly:c,fitPerfectlyOverscroll:this.getFitPerfectlyOverscroll(),overscrollSize:this.config.overscrollSize});let l=r;(this.pendingScrollTarget!=null&&s!==l||this.needsScrollPageUpdate(s))&&(this.applyScrollFix(s,l,this.windowSpecs),l=s);let{top:u,bottom:d}=this.windowSpecs,{firstIndex:f,lastIndex:p}=this.renderState;if(f>=0)for(let e=f;e<=p;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: No item at index: ${e}`);t.top>u-t.height&&t.top<=d||this.releaseRenderedItem(t)}let m,h=new Set,g=this.findFirstVisibleIndex(u),_=this.findLastVisibleIndex(d);for(let e=g;e<=_;e++){let t=this.items[e];if(t==null)throw Error(`CodeView.computeRenderRangeAndEmit: missing item`);let{instance:n}=t;t.element==null?(t.element=this.acquireElement(),ii(this.stickyContainer,t.element,m),n.virtualizedSetup(),ri(t,t.element)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element):(ii(this.stickyContainer,t.element,m),ri(t,void 0,t.renderedOptionsRevision!==this.renderOptionsRevision)&&(t.renderedOptionsRevision=this.renderOptionsRevision,h.add(t)),m=t.element)}this.renderState.firstIndex=g<=_?g:-1,this.renderState.lastIndex=_,this.flushSlotCoordinator(),this.reconcileRenderedItems(h),this.syncContainerHeight(),this.updateStickyPositioning();let v=o==null?void 0:this.resolveAnchoredScrollTop(o);o===this.pendingLayoutAnchor&&(this.pendingLayoutAnchor=void 0);let y=v==null?0:v-i,b=s,x=!1;if(this.pendingScrollTarget!=null){let e=this.advanceScrollAnimation(t,y);e==null?b=i:(b=e,x=!0)}else b=v??s;b!==l&&(this.applyScrollFix(b,l,this.windowSpecs),l=b),x&&this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0),this.renderState.scrollTop=X(l),this.flushManagers(h),this.validateStickyContainerHeight(),this.fixContainerFocus(),(c||this.scrollAnimation!=null)&&this.render()};flushManagers(e){for(let t of e)t.instance.flushManagers()}syncContainerHeight(){let e=this.getPagedScrollHeight();this.container==null||this.containerHeight===e||(this.container.style.height=`${e}px`,this.containerHeight=e)}getStickyBounds(e){let{firstIndex:t,lastIndex:n}=e==null?this.renderState:{firstIndex:this.findFirstVisibleIndex(e.top),lastIndex:this.findLastVisibleIndex(e.bottom)};if(t===-1||n===-1||t>n)return;let r=this.items[t]?.instance.getAdvancedStickySpecs(e),i=this.items[n]?.instance.getAdvancedStickySpecs(e);if(!(r==null||i==null))return{stickyTop:this.getPagedLayoutTop(Math.max(r.topOffset,0)),stickyBottom:this.getPagedLayoutTop(i.topOffset+i.height)}}applyStickyPositioning({stickyTop:e,stickyBottom:t}){let n=this.getHeight(),{itemMetricsCache:r}=this,i=t-e;this.renderState.stickyHeight=i,this.renderState.stickyTop=e,this.renderState.stickyBottom=t,this.stickyOffset.style.height=`${e}px`;let a=(Math.random()*r.lineHeight>>0)*-1,o=-Math.max(i+a,0)+n;this.stickyContainer.style.top=`${o}px`,this.stickyContainer.style.bottom=`${o+r.diffHeaderHeight}px`}syncPagedScrollScaffolding(e){this.syncContainerHeight();let t=this.getStickyBounds(e);t!=null&&this.applyStickyPositioning(t)}reconcileRenderedItems(e){let{firstIndex:t,lastIndex:n}=this.renderState;if(t===-1)return;let r=-1,i=!1;for(let a=t;a<this.items.length&&!(!i&&a>n);a++){let t=this.items[a];if(t==null)throw Error(`CodeView.reconcileRenderedItems: Invalid item`);r===-1?r=t.top:t.top!==r&&(t.top=r,t.instance.syncVirtualizedTop(),i=!0),(e==null?a<=n:e.has(t))&&(t.instance.reconcileHeights()&&(i=!0,t.height=t.instance.getVirtualizedHeight()),this.validateRenderedItemHeight(t)),r+=t.instance.getVirtualizedHeight(),a<this.items.length-1&&(r+=this.getLayout().gap)}i&&r!=null&&(this.scrollDirty=!0,this.scrollHeight=r)}updateStickyPositioning(){let e=this.getStickyBounds();if(e==null)return;let{stickyTop:t,stickyBottom:n}=e;n-t===this.renderState.stickyHeight&&t===this.renderState.stickyTop&&n===this.renderState.stickyBottom||this.applyStickyPositioning(e)}handleScroll=()=>{e.__STOP||(this.suspendScrollInteractions(),this.scrollDirty=!0,this.notifyScroll(),this.render())};clearPendingScroll=()=>{this.pendingScrollTarget=void 0,this.pendingLayoutAnchor=void 0,this.scrollAnimation=void 0};handleResize=e=>{for(let t of e)if(t.target===this.stickyContainer){if(t.borderBoxSize[0].blockSize!==this.renderState.stickyHeight){let e=this.getScrollTop(),t=this.getScrollAnchor(e);this.reconcileRenderedItems(),this.updateStickyPositioning();let n=t==null?void 0:this.resolveAnchoredScrollTop(t);if(n!=null){let t=n-e;this.applyScrollFix(n,e,this.windowSpecs),this.scrollAnimation!=null&&(this.scrollAnimation.position+=t)}this.pendingScrollTarget!=null&&this.isPendingTargetSettled(this.pendingScrollTarget)&&(this.pendingScrollTarget=void 0,this.scrollAnimation=void 0)}}else this.scrollDirty=!0,this.heightDirty=!0,this.render()};getScrollAnchorViewportTop(e,t){return e<t?t+this.getStickyHeaderOffset():t}getScrollAnchor(e){if(this.pendingLayoutAnchor!=null)return this.pendingLayoutAnchor;let{firstIndex:t,lastIndex:n,stickyTop:r,stickyBottom:i}=this.renderState;if(t===-1||n===-1)return;let a=this.getHeight();if(!(r===-1||i===-1))for(let r=t;r<=n;r++){let t=this.items[r];if(t==null)continue;let n=this.getLayout().paddingTop+t.top;if(n+t.height<=e)continue;if(n>=e+a)break;if(n>=e)return{type:`item`,id:t.item.id,viewportOffset:n-e};let i=this.getScrollAnchorViewportTop(n,e)-n,o=t.instance.getNumericScrollAnchor(i);if(o!=null){let r=n+o.top;return{type:`line`,id:t.item.id,lineNumber:o.lineNumber,side:o.side,viewportOffset:r-e}}}}resolveAnchoredScrollTop(e){let t=this.idToItem.get(e.id);if(t==null)return;let{paddingTop:n}=this.getLayout();if(e.type===`item`){let r=n+t.top;return this.clampScrollTop(r-e.viewportOffset)}let r=t.type===`diff`?t.instance.getLinePosition(e.lineNumber,e.side):t.instance.getLinePosition(e.lineNumber);if(r==null)return;let i=n+t.top+r.top;return this.clampScrollTop(i-e.viewportOffset)}applyScrollFix(e,t,n){if(this.root==null)return;let r=X(this.clampScrollTop(e)),i=X(t),{scrollPageOffset:a}=this,o=X(this.clampPagedScrollTop(i-a)),{pagedScrollTop:s,scrollPageOffset:c}=this.resolvePagedScrollPosition(r),l=s,u=a!==c;r===this.renderState.scrollTop&&r===i&&l===o&&!u||(this.suspendScrollInteractions(),(l!==o||u)&&(this.scrollPageOffset=c,this.syncPagedScrollScaffolding(n)),l!==o&&this.root.scrollTo({top:l,behavior:`instant`}),this.renderState.scrollTop=r,this.scrollTop=r,this.scrollDirty=!1)}isPendingTargetSettled(e){let t=this.resolveScrollTargetTop(e);return t==null?!0:X(this.getScrollTop())===X(t)}getScrollTop(){if(!this.scrollDirty)return this.scrollTop;this.scrollDirty=!1;let e=this.root?.scrollTop??0;return this.scrollTop=this.clampScrollTop(e+this.scrollPageOffset),this.scrollTop}getHeight(){return this.heightDirty?(this.heightDirty=!1,this.height=this.root?.getBoundingClientRect().height??0,this.height):this.height}getScrollHeight(){return this.scrollHeight}flushSlotCoordinator(){if(this.slotCoordinator==null)return;let{onSnapshotChange:e}=this.slotCoordinator,t=oi(this.getRenderedItems(),this.slotCoordinator);si(this.slotSnapshot,t)||(this.slotSnapshot=t,e(t))}notifyScroll(){if(this.scrollListeners.size===0)return;let e=this.getScrollTop();for(let t of this.scrollListeners)t(e,this)}findFirstVisibleIndex(e){let t=0,n=this.items.length-1,r=this.items.length;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findFirstVisibleIndex: invalid item index`);a.top+a.height>e?(r=i,n=i-1):t=i+1}return r}findLastVisibleIndex(e){let t=0,n=this.items.length-1,r=-1;for(;t<=n;){let i=t+n>>1,a=this.items[i];if(a==null)throw Error(`CodeView.findLastVisibleIndex: invalid item index`);a.top<=e?(r=i,t=i+1):n=i-1}return r}recomputeLayout(e=0,t){if(this.items.length===0){this.scrollHeight=0;return}let n=this.getLayout(),r=0;if(e>0){let t=this.items[e-1];if(t==null)throw Error(`CodeView.recomputeLayout: invalid dirty index`);r=t.top+t.height+n.gap}for(let i=e;i<this.items.length;i++){let e=this.items[i];if(e==null)throw Error(`CodeView.recomputeLayout: invalid item index`);e.top=r,e.type===`diff`?e.height=e.instance.prepareCodeViewItem(e.item.fileDiff,r,t,e.item.annotations??[]):e.height=e.instance.prepareCodeViewItem(e.item.file,r,t,e.item.annotations??[]),r+=e.height,i<this.items.length-1&&(r+=n.gap)}r!==this.scrollHeight&&(this.scrollDirty=!0),this.scrollHeight=r}resetRenderState(){this.renderState.scrollTop=-1,this.renderState.firstIndex=-1,this.renderState.lastIndex=-1,this.renderState.stickyHeight=0,this.renderState.stickyTop=-1,this.renderState.stickyBottom=-1}getFitPerfectlyOverscroll(){return this.getLayout().gap+this.itemMetricsCache.diffHeaderHeight}};function Xr(e){return e.instance.cleanUp(!0),e.type===`diff`?e.instance.prepareCodeViewItem(e.item.fileDiff,e.top,void 0,e.item.annotations??[]):e.instance.prepareCodeViewItem(e.item.file,e.top,void 0,e.item.annotations??[])}function Zr(e,t){return!ge(e.theme??U,t.theme??U)||(e.themeType??`system`)!==(t.themeType??`system`)||e.unsafeCSS!==t.unsafeCSS}function Qr(e,t){return(e.overflow??`scroll`)!==(t.overflow??`scroll`)||(e.disableLineNumbers??!1)!==(t.disableLineNumbers??!1)||(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||e.unsafeCSS!==t.unsafeCSS||(e.diffStyle??`split`)!==(t.diffStyle??`split`)||(e.diffIndicators??`bars`)!==(t.diffIndicators??`bars`)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function $r(e,t){return(e.disableFileHeader??!1)!==(t.disableFileHeader??!1)||(e.hunkSeparators??`line-info`)!==(t.hunkSeparators??`line-info`)||(e.expandUnchanged??!1)!==(t.expandUnchanged??!1)||(e.collapsedContextThreshold??1)!==(t.collapsedContextThreshold??1)}function ei(e){return e instanceof SVGElement?!0:Ie(e)&&(e.hasAttribute(`data-core-css`)||e.hasAttribute(`data-theme-css`)||e.hasAttribute(`data-unsafe-css`))}function ti(e){let t=ni(e.start,e.side),n=ni(e.end,e.endSide??e.side);return t===n?t:`${t}-${n}`}function ni(e,t){return t==null?`${e}`:`${t===`deletions`?`D`:`A`}${e}`}function ri(e,t,n=!1){return e.type===`diff`?e.instance.render({deferManagers:!0,fileContainer:t,fileDiff:e.item.fileDiff,forceRender:n,lineAnnotations:e.item.annotations??[]}):e.instance.render({deferManagers:!0,fileContainer:t,file:e.item.file,forceRender:n,lineAnnotations:e.item.annotations??[]})}function ii(e,t,n){if(n==null){e.firstChild!==t&&e.prepend(t);return}n.nextSibling!==t&&n.after(t)}function ai(e){return(e.annotations?.length??0)>0}function oi(e,{hasHeaderRenderers:t,hasAnnotationRenderer:n,hasGutterRenderer:r}){if(e.length===0)return;if(t||r)return e;if(!n)return;let i=[];for(let t of e)ai(t.item)&&i.push(t);return i.length>0?i:void 0}function si(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.version!==i.version)return!1}return!0}function ci(e,t){if(e==null||t==null)return e===t;if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++){let r=e[n],i=t[n];if(r==null||i==null||r.id!==i.id||r.type!==i.type||r.element!==i.element||r.version!==i.version)return!1}return!0}var Q=S(ne(),1),$=t(),li=S(l(),1),ui=typeof window>`u`?Q.useEffect:Q.useLayoutEffect;function di(e){return{instance:void 0,items:void 0,controlled:e,managedOptions:void 0,disableFlushSync:!1,slotCoordinator:void 0}}function fi(e,t){let{className:n,containerRef:r,disableWorkerPool:i=!1,initialItems:a,items:o,onScroll:s,onSelectedLinesChange:c,options:l,renderAnnotation:u,renderCustomHeader:d,renderGutterUtility:f,renderHeaderMetadata:p,renderHeaderPrefix:m,selectedLines:h,style:g}=e,_=o!==void 0,v=(0,Q.useContext)(Re),y=(0,Q.useRef)(di(_)),b=d!=null,x=u!=null,S=f!=null,C=b||m!=null||p!=null,w=C||x||S,T=R(e=>{c?.(e)}),E=h!==void 0,D=(0,Q.useMemo)(()=>vi({options:l,hasCustomHeader:b,hasGutterRenderer:S,onSelectedLinesChange:c==null?void 0:T,controlledSelection:E}),[l,b,S,c,T,E]),[O]=(0,Q.useState)(()=>_i()),[,k]=(0,Q.useState)({}),ee=R(e=>{y.current.instance!=null&&(e==null||e!==y.current.instance.getContainerElement())&&(y.current.instance.cleanUp(),O.publish(void 0),y.current=di(_)),e!=null&&e!==y.current.instance?.getContainerElement()&&(y.current.instance=new Yr(D,i?void 0:v,!0),y.current.instance.setup(e)),typeof r==`function`?r(e):r!=null&&(r.current=e)}),te=R(e=>{y.current.disableFlushSync?O.publish(e):(0,li.flushSync)(()=>{O.publish(e)})}),A=(0,Q.useMemo)(()=>{if(!(!C&&!x&&!S))return{hasHeaderRenderers:C,hasAnnotationRenderer:x,hasGutterRenderer:S,onSnapshotChange:te}},[te,x,S,C]);return ui(()=>s==null?void 0:y.current.instance?.subscribeToScroll(s)),ui(()=>{let{instance:e,controlled:t,items:n,managedOptions:r,slotCoordinator:i}=y.current;if(e!=null)try{y.current.disableFlushSync=!0;let s=!1;if(G(D,r)||(y.current.managedOptions=D,e.setOptions(D),s=!0),t!==_){console.error(`CodeView: cannot switch between controlled and uncontrolled modes. Remount with a new key instead.`);return}if(_)o!==n&&(hi(n,o)?y.current.items=o:mi(n,o)?(y.current.items=o,e.addItems(o.slice(n.length))):(y.current.items=o,e.setItems(o),s=!0));else if(n==null){let t=a??[];y.current.items=t,t.length>0&&(e.setItems(t),s=!0)}h!==void 0&&e.setSelectedLines(h,{notify:!1});let c=e.setSlotCoordinator(A),l=!1;A!==i&&((A==null||i==null)&&(l=!0),y.current.slotCoordinator=A),(s||c)&&e.render(!0),c&&A==null&&O.publish(void 0),l&&k({})}finally{y.current.disableFlushSync=!1}}),(0,Q.useImperativeHandle)(t,()=>({addItems(e){let{controlled:t,instance:n}=y.current;gi(t,`addItems`),n==null?console.error(`CodeView.addItems: no valid instance to append items with`,e):n.addItems(e)},getItem(e){let{instance:t}=y.current;if(t==null){console.error(`CodeView.getItem: no valid instance exists`,e);return}else return t.getItem(e)},updateItem(e){let{controlled:t,instance:n}=y.current;return gi(t,`updateItem`),n==null?(console.error(`CodeView.updateItem: no valid instance to update item with`,e),!1):n.updateItem(e)},updateItemId(e,t){let{controlled:n,instance:r}=y.current;return gi(n,`updateItemId`),r==null?(console.error(`CodeView.updateItemId: no valid instance to update item id with`,e,t),!1):r.updateItemId(e,t)},scrollTo(e){let{instance:t}=y.current;t==null?console.error(`CodeView.scrollTo: no valid instance to scroll with`,e):t.scrollTo(e)},setSelectedLines(e){let{instance:t}=y.current;t==null?console.error(`CodeView.setSelectedLines: no valid instance to update selection with`,e):(t.setSelectedLines(e,{notify:!1}),T(e))},getSelectedLines(){let{instance:e}=y.current;return e==null?(console.error(`CodeView.getSelectedLines: no valid instance exists`),null):e.getSelectedLines()},clearSelectedLines(){let{instance:e}=y.current;e==null?console.error(`CodeView.clearSelectedLines: no valid instance to update selection with`):(e.clearSelectedLines({notify:!1}),T(null))},getInstance(){return y.current.instance}}),[T]),(0,$.jsxs)($.Fragment,{children:[(0,$.jsx)(`div`,{ref:ee,className:n,style:g}),w&&(0,$.jsx)(yi,{managedContentStore:O,renderCustomHeader:d,renderHeaderPrefix:m,renderHeaderMetadata:p,renderAnnotation:u,renderGutterUtility:f})]})}var pi=(0,Q.forwardRef)(fi);function mi(e,t){if(e==null||t.length<=e.length)return!1;if(e.length===0)return!0;for(let n=0;n<e.length;n++)if(t[n]!==e[n])return!1;return!0}function hi(e,t){if(e==null||e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}function gi(e,t){if(e)throw Error(`CodeView.${t} cannot be used when CodeView is controlled. Use initialItems for imperative item updates.`)}function _i(){let e,t=new Set;return{getSnapshot(){return e},publish(n){if(!ci(e,n)){e=n;for(let e of t)e()}},subscribe(e){return t.add(e),()=>{t.delete(e)}}}}function vi({options:e,hasCustomHeader:t,hasGutterRenderer:n,onSelectedLinesChange:r,controlledSelection:i}){return!t&&!n&&r==null&&!i?e:(e={...e,controlledSelection:i,onSelectedLinesChange:r},t&&(e.renderCustomHeader=xi),n&&(e.renderGutterUtility=xi),e)}var yi=(0,Q.memo)(function({managedContentStore:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}){let o=R(t=>e.subscribe(t)),s=R(()=>e.getSnapshot());return(0,Q.useSyncExternalStore)(o,s,s)?.map(e=>(0,li.createPortal)(bi({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}),e.element,e.id))});function bi({renderedItem:e,renderCustomHeader:t,renderHeaderPrefix:n,renderHeaderMetadata:r,renderAnnotation:i,renderGutterUtility:a}){if(e.type===`diff`){let{item:o,instance:s}=e;return pe({fileDiff:o.fileDiff,renderCustomHeader:t==null?void 0:()=>t(o),renderHeaderPrefix:n==null?void 0:()=>n(o),renderHeaderMetadata:r==null?void 0:()=>r(o),renderAnnotation:i==null?void 0:e=>i(e,o),lineAnnotations:o.annotations,renderGutterUtility:a==null?void 0:e=>a(e,o),getHoveredLine:s.getHoveredLine})}else{let{item:o,instance:s}=e;return F({file:o.file,renderCustomHeader:t==null?void 0:()=>t(o),renderHeaderPrefix:n==null?void 0:()=>n(o),renderHeaderMetadata:r==null?void 0:()=>r(o),renderAnnotation:i==null?void 0:e=>i(e,o),lineAnnotations:o.annotations,renderGutterUtility:a==null?void 0:e=>a(e,o),getHoveredLine:s.getHoveredLine})}}function xi(){}function Si({threadRef:e,filePath:t,activeCwd:n,openInEditor:r}){if(e){ze.getState().openFile(e,t);return}r(n?W(t,n):t)}var Ci=k();function wi(e,t){let n=(0,Ci.c)(4),r=me(e,t),i;return n[0]!==r.data||n[1]!==r.error||n[2]!==r.isPending?(i={data:r.data,error:r.error,isPending:r.isPending},n[0]=r.data,n[1]=r.error,n[2]=r.isPending,n[3]=i):i=n[3],i}function Ti(e){return a(`flex items-center justify-between gap-2 px-4`,ke&&e!==`sheet`&&e!==`embedded`?`drag-region h-[52px] border-b border-border wco:h-[env(titlebar-area-height)] wco:pr-[calc(100vw-env(titlebar-area-width)-env(titlebar-area-x)+1em)]`:`surface-subheader`)}function Ei(e){let t=(0,Ci.c)(10),n=ke&&e.mode!==`sheet`&&e.mode!==`embedded`,r=e.mode===`inline`?`w-[42vw] min-w-[360px] max-w-[560px] shrink-0 border-l border-border`:`w-full`,i;t[0]===r?i=t[1]:(i=a(`flex h-full min-w-0 flex-col bg-background`,r),t[0]=r,t[1]=i);let o;t[2]!==e.header||t[3]!==e.mode||t[4]!==n?(o=n?(0,$.jsx)(`div`,{className:Ti(e.mode),children:e.header}):(0,$.jsx)(`div`,{className:Ti(e.mode),"data-surface-subheader":!0,children:e.header}),t[2]=e.header,t[3]=e.mode,t[4]=n,t[5]=o):o=t[5];let s;return t[6]!==e.children||t[7]!==i||t[8]!==o?(s=(0,$.jsxs)(`div`,{className:i,children:[o,e.children]}),t[6]=e.children,t[7]=i,t[8]=o,t[9]=s):s=t[9],s}function Di(e){let t=(0,Ci.c)(7),n;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-border/50 px-3 py-2`,children:[(0,$.jsx)(B,{className:`h-4 w-32 rounded-full`}),(0,$.jsx)(B,{className:`ml-auto h-4 w-20 rounded-full`})]}),t[0]=n):n=t[0];let r;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,$.jsxs)(`div`,{className:`space-y-2`,children:[(0,$.jsx)(B,{className:`h-3 w-full rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-full rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-10/12 rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-11/12 rounded-full`}),(0,$.jsx)(B,{className:`h-3 w-9/12 rounded-full`})]}),t[1]=r):r=t[1];let i;t[2]===e.label?i=t[3]:(i=(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col gap-4 px-3 py-4`,children:[r,(0,$.jsx)(`span`,{className:`sr-only`,children:e.label})]}),t[2]=e.label,t[3]=i);let a;return t[4]!==e.label||t[5]!==i?(a=(0,$.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col p-2`,children:(0,$.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col overflow-hidden rounded-md border border-border/60 bg-card/25`,role:`status`,"aria-live":`polite`,"aria-label":e.label,children:[n,i]})}),t[4]=e.label,t[5]=i,t[6]=a):a=t[6],a}var Oi=[];function ki(e){return(e.endSide??e.side)===`deletions`?`deletions`:`additions`}function Ai(e,t,n){let r=ki(t),i=e.findIndex(e=>e.side===r&&e.lineNumber===t.end);return i<0?[...e,{side:r,lineNumber:t.end,metadata:{entries:[n]}}]:e.map((e,t)=>t===i?{...e,metadata:{entries:[...e.metadata.entries,n]}}:e)}function ji(e){let t=(0,Ci.c)(50),{files:n,sectionId:r,sectionTitle:i,composerDraftTarget:a,options:o,viewerRef:c,className:l,renderHeaderPrefix:u}=e,d=y(Ii),f=y(Fi),p;t[0]===a?p=t[1]:(p=e=>e.getComposerDraft(a)?.reviewComments??Oi,t[0]=a,t[1]=p);let m=y(p),[h,g]=(0,Q.useState)(null),[_,v]=(0,Q.useState)(null),b;t[2]===n?b=t[3]:(b=new Map(n.map(Pi)),t[2]=n,t[3]=b);let x=b,S;if(t[4]!==_||t[5]!==n||t[6]!==m||t[7]!==r){let e;t[9]!==_||t[10]!==m||t[11]!==r?(e=e=>{let{fileDiff:t,filePath:n,fileKey:i,collapsed:a}=e,o=m.filter(e=>e.sectionId===r&&e.filePath===n&&(e.fenceLanguage??`diff`)===`diff`).reduce((e,n)=>{let r=te(t,n);return r?Ai(e,r,{id:n.id,kind:`comment`,range:r,rangeLabel:n.rangeLabel,text:n.text}):e},[]),s=_?.fileKey===i?[...o,_.annotation]:o;return{id:i,type:`diff`,fileDiff:t,annotations:s,collapsed:a,version:xe(`${a?`1`:`0`}:${s.flatMap(Mi).join(`:`)}`)}},t[9]=_,t[10]=m,t[11]=r,t[12]=e):e=t[12],S=n.map(e),t[4]=_,t[5]=n,t[6]=m,t[7]=r,t[8]=S}else S=t[8];let C=S,w;t[13]!==a||t[14]!==_?.annotation||t[15]!==f?(w=e=>{g(null),_?.annotation.metadata.entries.some(t=>t.id===e)?v(null):f(a,e)},t[13]=a,t[14]=_?.annotation,t[15]=f,t[16]=w):w=t[16];let T=w,E;t[17]!==d||t[18]!==a||t[19]!==_||t[20]!==x||t[21]!==r||t[22]!==i?(E=(e,t)=>{let n=_?.annotation.metadata.entries.find(t=>t.id===e),o=_?x.get(_.fileKey):void 0;if(!n||!o)return;let c=s({id:n.id,sectionId:r,sectionTitle:i,filePath:o.filePath,fileDiff:o.fileDiff,range:n.range,text:t});c&&d(a,c),g(null),v(null)},t[17]=d,t[18]=a,t[19]=_,t[20]=x,t[21]=r,t[22]=i,t[23]=E):E=t[23];let D=E,O;t[24]!==x||t[25]!==r||t[26]!==i?(O=(e,t)=>{if(!e)return;let n=t.item;if(n.type!==`diff`)return;let a=x.get(n.id);if(!a)return;let o=oe(),c=s({id:o,sectionId:r,sectionTitle:i,filePath:a.filePath,fileDiff:a.fileDiff,range:e,text:``});c&&v({fileKey:n.id,annotation:{side:ki(e),lineNumber:e.end,metadata:{entries:[{id:o,kind:`draft`,range:e,rangeLabel:c.rangeLabel,text:``}]}}})},t[24]=x,t[25]=r,t[26]=i,t[27]=O):O=t[27];let k=O,ee=_!==null,A;t[28]===c?A=t[29]:(A=c?{ref:c}:{},t[28]=c,t[29]=A);let j;t[30]===l?j=t[31]:(j=l?{className:l}:{},t[30]=l,t[31]=j);let ne=!ee,re=!ee,M;t[32]!==k||t[33]!==o||t[34]!==re||t[35]!==ne?(M={...o,enableGutterUtility:ne,enableLineSelection:re,onLineSelectionEnd:k},t[32]=k,t[33]=o,t[34]=re,t[35]=ne,t[36]=M):M=t[36];let N;t[37]===u?N=t[38]:(N=e=>e.type===`diff`?u(e.fileDiff,e.id,e.collapsed===!0):null,t[37]=u,t[38]=N);let P;t[39]!==T||t[40]!==D?(P=e=>(0,$.jsx)(`div`,{className:`py-1`,children:e.metadata.entries.map(e=>(0,$.jsx)(ae,{kind:e.kind,rangeLabel:e.rangeLabel,text:e.text,onCancel:()=>T(e.id),onComment:t=>D(e.id,t),onDelete:()=>T(e.id)},e.id))}),t[39]=T,t[40]=D,t[41]=P):P=t[41];let ie;return t[42]!==C||t[43]!==h||t[44]!==M||t[45]!==N||t[46]!==P||t[47]!==A||t[48]!==j?(ie=(0,$.jsx)(pi,{...A,...j,items:C,selectedLines:h,onSelectedLinesChange:g,options:M,renderHeaderPrefix:N,renderAnnotation:P}),t[42]=C,t[43]=h,t[44]=M,t[45]=N,t[46]=P,t[47]=A,t[48]=j,t[49]=ie):ie=t[49],ie}function Mi(e){return e.metadata.entries.map(Ni)}function Ni(e){return`${e.id}:${e.rangeLabel}:${e.text}`}function Pi(e){return[e.fileKey,e]}function Fi(e){return e.removeReviewComment}function Ii(e){return e.addReviewComment}var Li=function(e){return e.disabled=`data-disabled`,e.orientation=`data-orientation`,e.multiple=`data-multiple`,e}({}),Ri={multiple(e){return e?{[Li.multiple]:``}:null}},zi=Q.forwardRef(function(e,t){let{defaultValue:r,disabled:i=!1,loopFocus:a=!0,onValueChange:o,orientation:s=`horizontal`,multiple:c=!1,value:l,className:d,render:f,style:p,...m}=e,h=w(!0),_=Q.useMemo(()=>l!==void 0||r!==void 0,[l,r]),v=(h?.disabled??!1)||i,[y,b]=C({controlled:l,default:l===void 0?r??n:void 0,name:`ToggleGroup`,state:`value`}),x=u((e,t,n)=>{let r;c?(r=y.slice(),t?r.push(e):r.splice(y.indexOf(e),1)):r=t?[e]:[],o?.(r,n),!n.isCanceled&&b(r)}),S={disabled:v,multiple:c,orientation:s},T=Q.useMemo(()=>({disabled:v,orientation:s,setGroupValue:x,value:y,isValueInitialized:_}),[v,s,x,y,_]),E={role:`group`},D=g(`div`,e,{enabled:!!h,state:S,ref:t,props:[E,m],stateAttributesMapping:Ri});return(0,$.jsx)(Le.Provider,{value:T,children:h?D:(0,$.jsx)(q,{render:f,className:d,style:p,state:S,refs:[t],props:[E,m],stateAttributesMapping:Ri,loopFocus:a,enableHomeAndEndKeys:!0,orientation:s})})}),Bi=Q.createContext({size:`default`,variant:`default`});function Vi(e){let t=(0,Ci.c)(24),n,r,i,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],o=t[4],s=t[5],c=t[6]):({className:r,variant:o,size:s,orientation:c,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=o,t[5]=s,t[6]=c);let l=o===void 0?`default`:o,u=s===void 0?`default`:s,d=c===void 0?`horizontal`:c,f;t[7]!==u||t[8]!==l?(f={size:u,variant:l},t[7]=u,t[8]=l,t[9]=f):f=t[9];let p=f,m=d===`horizontal`?`*:pointer-coarse:after:min-w-auto`:`*:pointer-coarse:after:min-h-auto`,h=l==="default"?`gap-0.5`:d===`horizontal`?`*:not-first:not-data-[slot=separator]:before:-start-[0.5px] *:not-last:not-data-[slot=separator]:before:-end-[0.5px] *:not-first:rounded-s-none *:not-last:rounded-e-none *:not-first:border-s-0 *:not-last:border-e-0 *:not-first:before:rounded-s-none *:not-last:before:rounded-e-none`:`*:not-first:not-data-[slot=separator]:before:-top-[0.5px] *:not-last:not-data-[slot=separator]:before:-bottom-[0.5px] flex-col *:not-first:rounded-t-none *:not-last:rounded-b-none *:not-first:border-t-0 *:not-last:border-b-0 *:not-first:before:rounded-t-none *:not-last:before:rounded-b-none *:data-[slot=toggle]:not-last:before:hidden dark:*:last:before:hidden dark:*:first:before:block`,g;t[10]!==r||t[11]!==m||t[12]!==h?(g=a(`flex w-fit *:focus-visible:z-10 dark:*:[[data-slot=separator]:has(+[data-slot=toggle]:hover)]:before:bg-input/64 dark:*:[[data-slot=separator]:has(+[data-slot=toggle][data-pressed])]:before:bg-input dark:*:[[data-slot=toggle]:hover+[data-slot=separator]]:before:bg-input/64 dark:*:[[data-slot=toggle][data-pressed]+[data-slot=separator]]:before:bg-input`,m,h,r),t[10]=r,t[11]=m,t[12]=h,t[13]=g):g=t[13];let _;t[14]!==n||t[15]!==p?(_=(0,$.jsx)(Bi,{value:p,children:n}),t[14]=n,t[15]=p,t[16]=_):_=t[16];let v;return t[17]!==d||t[18]!==i||t[19]!==u||t[20]!==g||t[21]!==_||t[22]!==l?(v=(0,$.jsx)(zi,{className:g,"data-size":u,"data-slot":`toggle-group`,"data-variant":l,orientation:d,...i,children:_}),t[17]=d,t[18]=i,t[19]=u,t[20]=g,t[21]=_,t[22]=l,t[23]=v):v=t[23],v}function Hi(e){let t=(0,Ci.c)(12),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:o,size:a,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=Q.use(Bi),c=o??s.variant,l=a??s.size,u;return t[6]!==n||t[7]!==r||t[8]!==i||t[9]!==l||t[10]!==c?(u=(0,$.jsx)(K,{className:r,"data-size":l,"data-variant":c,size:l,variant:c,...i,children:n}),t[6]=n,t[7]=r,t[8]=i,t[9]=l,t[10]=c,t[11]=u):u=t[11],u}function Ui(e){return{diffPreview:re(e,{label:`environment-data:review:diff-preview`,tag:d.reviewGetDiffPreview,staleTimeMs:5e3})}}var Wi=Ui(M);function Gi(e){return e.remoteName&&e.name.startsWith(`${e.remoteName}/`)?e.name.slice(e.remoteName.length+1):e.name}function Ki(e,t){let n=new Set(t),r=e.map(e=>{let r=t.filter(t=>n.has(t)&&Gi(t)===e.name),i=r.find(e=>e.remoteName===`origin`)??r[0]??null;return i&&n.delete(i),{id:`local:${e.name}`,label:e.name,local:e,remote:i}}),i=t.filter(e=>n.has(e)).map(e=>({id:`remote:${e.name}`,label:e.name,local:null,remote:e}));return[...r,...i]}function qi(e,t){let n=t.trim().toLocaleLowerCase();return n.length===0?e:e.filter(e=>e.label.toLocaleLowerCase().includes(n)||e.local?.name.toLocaleLowerCase().includes(n)===!0||e.remote?.name.toLocaleLowerCase().includes(n)===!0)}var Ji=`__automatic_base_ref__`,Yi=new Set,Xi=`
2
2
  [data-diffs-header],
3
3
  [data-diff],
4
4
  [data-file],